Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2835979rdb; Tue, 12 Sep 2023 13:43:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG77RdkbStTmhkwMzjLdpx3PeTd8Oty7ad15h8VO7k5FV7IzvKY6MKaiDh42xajubAxrA8y X-Received: by 2002:a05:6808:1a19:b0:3a7:2eb4:ce04 with SMTP id bk25-20020a0568081a1900b003a72eb4ce04mr1004690oib.5.1694551393782; Tue, 12 Sep 2023 13:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694551393; cv=none; d=google.com; s=arc-20160816; b=G8tVDAlvPWhGYfItqzDdKemCtWtEnaJPBvoz9TBPEwm0Crd38Fe4oPVX7dPau8FXLd DEVeDBRtcpOaXINK7M7dbDpcE5myNKimKopdHVUWyuY1Lp2pXj0I1SrDvSwVsj8GLSnx WoVFRCrVsHVOVs5YpUGFpCcuMfHs8+C5JCzbnhokO1CeiUHArT0EP03BlCLZTLnob9mS DMgtYOKRyIIHsttcnKqjlN+C7A34shau9fGzbIk934rb7p9OKDvWaHn+QiMH+i7Nc98g 20ueJLE38C/Z8BwL+wWFV2wg68RFFwQLzywreN1toHHRUN+C6sZV//b/3OTUtovabPho IlYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dYqDUs3nkzy+99JdbqiBWkMenPxzjtYzz/eA+mvCidk=; fh=3FqSAtdDZlHeNogW7Ogvr/+bh39HT/wkq0D3/3wCuBI=; b=H7/CqdLfi2CLndBIn44N/Oi1rBXFQGSUnfDkMmJk+hx6mzhSm9AydEFHmqxjI0PAdO 5EEXhmRIIdn9JbpfGsCr2RUJ6OqcbsXLl+aOejnYs92AHNXCul+tiYcT+pWSJdct9Vlo yVfAPjhWXvhhukfPsF8e1+4lzFiW8KJ9kqWZ7z0zlCXrS0Md8HEoBPkZgzjCP+ezRoPq 0J17FoW+X7CUE70COGADGxKXsAyyumITRg7dYbLPBCPo2qZTNhJISXaDUVEGk7hcsfSV ulsUEtblBnLEzQi+OSu8neCwENALfyITj81Dhq8yMJOGNC3kEnRUKljH44c440u3X7pW YoWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pEdgLNOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e24-20020a63e018000000b00573f116f1c3si8646701pgh.789.2023.09.12.13.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 13:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pEdgLNOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9F7F8807D247; Tue, 12 Sep 2023 11:06:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231772AbjILSGC (ORCPT + 99 others); Tue, 12 Sep 2023 14:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjILSGC (ORCPT ); Tue, 12 Sep 2023 14:06:02 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E561E59 for ; Tue, 12 Sep 2023 11:05:58 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-529fa243739so2271a12.0 for ; Tue, 12 Sep 2023 11:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694541956; x=1695146756; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dYqDUs3nkzy+99JdbqiBWkMenPxzjtYzz/eA+mvCidk=; b=pEdgLNOfVB/fRhmxx8BGsFlFx3MoU7VDnEDB/S+Y3W9CJW04mevLIHVX3HsorF5U6R 2V5jgW8g9AiD6yru9aaaLFh8fXC35dz0nR0GS/dQz5bdy0itnBt91HVlMjglk2tJS2Nc v671pgDG5oL9ootYL1U3L756IKxPQ6z4ViZ7iwq2QcG9trkO3AC/JdBwxl88Nrh+etWH GkNfzhv/NJwvPAw4q6GSD6Oi8188Yn9t4xT9GYDhAlmKd5muJcWuadcDPLuOd+UodnYr YrfSySnqyA3Id4tNKisgfBvY9QcB2DQYdU+sRBgEff+3e82ItGT6espRlAIFytmFGTUh l3fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694541956; x=1695146756; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dYqDUs3nkzy+99JdbqiBWkMenPxzjtYzz/eA+mvCidk=; b=C7/izoMEZBDCbL9ieestClhJMNcMkxE+T1AyTe869i5Tdjlf3GxqiHeB1jzZbgi68o PsRYrefgcu2C0+Ohl+Yz3dtN2P/7lOrA938UNhIPwZBviIzxOwJtgi6n3BDIdGqLhvsj 7ameD8lSCzi/IGowbWMcmO9eqVs2GcIk/sNmDCOhDQ+rKkO4wIKaNGqfcEC/I2r0AX3+ hlvzflSp3qdFJSmGpn6iNNmZu1O9l44KIpY5U1wJY93sv2zBlHQFhqiUGsbgU/eRvyN4 FIOSjfF0YBMezFk8ui51VwGLx0QD5AwxQD6/Ol9XzCuAIgU3krw+gs8BOdg7ep9lphP0 RVpw== X-Gm-Message-State: AOJu0YyjyIFpXcIcY45kcVUq99DuhX/OrGtPqDhiiGr1vaU1unYP/okC QNKDpT5R5hi5zlagb7fCUVTy0CSz/4G03eb/1GD7CWk7f48ii4pqJnJlnA== X-Received: by 2002:a50:cd59:0:b0:522:4741:d992 with SMTP id d25-20020a50cd59000000b005224741d992mr12316edj.4.1694541956322; Tue, 12 Sep 2023 11:05:56 -0700 (PDT) MIME-Version: 1.0 References: <20230911082016.3694700-1-yajun.deng@linux.dev> <39c906f6-910d-01c7-404a-8fe6a161ef2e@intel.com> <8bc6c1cd-50bb-44ef-5979-3bb50a70afcb@intel.com> In-Reply-To: From: Eric Dumazet Date: Tue, 12 Sep 2023 20:05:42 +0200 Message-ID: Subject: Re: [PATCH] net/core: Export dev_core_stats_rx_dropped_inc sets To: Alexander Lobakin Cc: Yajun Deng , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 11:06:01 -0700 (PDT) On Tue, Sep 12, 2023 at 8:03=E2=80=AFPM Eric Dumazet = wrote: > Sure, this was what was suggested (perhaps not _very_ precisely, but > the general idea was pretty clear). > v2 seems ok, right ? > > It seems we are all on the same page. > > +static __cold struct net_device_core_stats __percpu > *dev_core_stats(struct net_device *dev) > +{ > + /* This READ_ONCE() pairs with the write in netdev_core_stats_all= oc() */ > + struct net_device_core_stats __percpu *p =3D READ_ONCE(dev->core_= stats); > + > + if (likely(p)) > + return p; > + > + return netdev_core_stats_alloc(dev); > +} > + > +#define DEV_CORE_STATS_INC(FIELD) \ > +void dev_core_stats_##FIELD##_inc(struct net_device *dev) \ > +{ \ > + struct net_device_core_stats __percpu *p; \ > + \ > + p =3D dev_core_stats(dev); \ > + if (p) \ > + this_cpu_inc(p->FIELD); \ > +} \ > +EXPORT_SYMBOL(dev_core_stats_##FIELD##_inc) Oh well, I just read the patch, and it seems wrong indeed. netdev_core_stats_alloc() is the one that can be cold.