Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp655760iog; Thu, 30 Jun 2022 07:47:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vAynElaGayn0MfuYMuIQkChCNxkJRxn3xh2pEzhui06e7JdztY7dq2G43raRtB/UMe5Cdh X-Received: by 2002:a17:902:f683:b0:16a:6456:5369 with SMTP id l3-20020a170902f68300b0016a64565369mr14590832plg.136.1656600474800; Thu, 30 Jun 2022 07:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656600474; cv=none; d=google.com; s=arc-20160816; b=U/TZRsKxV/IA9CggLRLngWXSKaUaunBci+FslLVRJ2Q38ut+JUPWt9fbtpSIDnmoCz hh2fsWaO6v3f3VgOoXoek0wPXOs4mwfbwb8/+nsjwDt2rpIMueOpjRiaIIOsPRN6f35T +ofoteoujiH0WI3c2kbVnk3pHx/u8suJ2wo64Ip4knV9ZNEk/kQdMTB9ZdQS5s+c7nlZ LPnO8PpbwMLf2QJi7OP5DUYrEJvMGBclWONj5sJwsybw1lassU9Hw9Sh80iqTU4IUiUb F14lyft4Sj8rSnKu3wnGkxKGcGG9duzxSBoIW9QYj4fQM8cDDlcHR8st7SvWvWksZMg9 HkRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=sp2as9wUo8MpFZ4R2MjqaRIBmU0r9ta8NSKQjnvGtyI=; b=sAZpOKuFDhb5xkFUQ9eSrxghY7IkzgM9wo1BovgJA1FCPnDKl2wnamVktToQHfmv+M MoaTG/Rx7bO1p0i4xiSjliyOIpYIcoRrilsxpsJoJD/RFKJ+uOM06A1DBHAYhxsq90do qz7Kub6VGYJJ8hDN/brGIhmQrdsSA/dQR8nOf9HO2Wgz8OfVk9oMP6IqwlxExdb9Xa+B GHlbEkVJ5BlZXJehe+3grc5+imK53VidyFSLFpeQyox7Rwpi7jrp0l+tJkZcoCC2t9We N7Cqot09oW+LeG9IwD3gycI6pnN9mfutepPJU0LafQVwCaVX5ba26t0OL+WV5Mk9ElXk Kvzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me1-20020a17090b17c100b001ec92216b35si3520946pjb.160.2022.06.30.07.47.43; Thu, 30 Jun 2022 07:47:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236875AbiF3Odc (ORCPT + 99 others); Thu, 30 Jun 2022 10:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236985AbiF3OdQ (ORCPT ); Thu, 30 Jun 2022 10:33:16 -0400 Received: from out199-1.us.a.mail.aliyun.com (out199-1.us.a.mail.aliyun.com [47.90.199.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A0BC5C9F9; Thu, 30 Jun 2022 07:16:10 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=mqaio@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VHtfz19_1656598514; Received: from 30.13.190.220(mailfrom:mqaio@linux.alibaba.com fp:SMTPD_---0VHtfz19_1656598514) by smtp.aliyun-inc.com; Thu, 30 Jun 2022 22:15:16 +0800 Message-ID: <529eadf1-5c7a-2068-2932-8e75ae02e405@linux.alibaba.com> Date: Thu, 30 Jun 2022 22:15:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] net: hinic: avoid kernel hung in hinic_get_stats64() To: Eric Dumazet Cc: David Miller , Jakub Kicinski , Paolo Abeni , gustavoars@kernel.org, cai.huoqing@linux.dev, Aviad Krawczyk , zhaochen6@huawei.com, netdev , LKML References: <07736c2b7019b6883076a06129e06e8f7c5f7154.1656487154.git.mqaio@linux.alibaba.com> <8b012bbd-a175-5699-1f26-108dd52fc5b7@linux.alibaba.com> From: maqiao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/6/30 下午9:59, Eric Dumazet 写道: > On Thu, Jun 30, 2022 at 3:57 PM maqiao wrote: >> >> >> >> 在 2022/6/30 下午6:23, Eric Dumazet 写道: > >>> Note: The following is racy, because multiple threads can call >>> hinic_get_stats64() at the same time. >>> It needs a loop, see include/linux/u64_stats_sync.h for detail. >> Thanks for reminding, and I noticed that nic_tx_stats/nic_rx_stats has >> been protected by u64_stats_sync in update_t/rx_stats(), it seems that >> it's unnecessary to use spinlock in update_nic_stats(). > > It is necessary to use the spinlock to protect writers among themselves. Ohhh, sorry, I was wrong. I did not realize that seqlock cannot prevent mutil writers enter critical section... > > >> >> I will send v2 as soon as possible, thanks.