[-v2,net-next] net/core/dev.c: enable timestamp static key if CPU isolation is configured
Message ID | Zd81gp2utD9+ripX@tpad |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3345917dyb; Wed, 28 Feb 2024 05:31:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWX4VHjgHTffz95AMaKV6p2mboHiirvEMibMdWDVF2osNlv1cP9lfvH3Skc8R2yPFY0JR2z+DhGjpiMbFIZh6sGqN4Ffw== X-Google-Smtp-Source: AGHT+IE6YKW7xTKwf2m0Ib72Y6YjoUEw3E4ADJ2g12l7TANOmZOGQ5XYg4dndSMiAj1vSLZRjyOf X-Received: by 2002:a05:622a:120c:b0:42e:3fa6:28a6 with SMTP id y12-20020a05622a120c00b0042e3fa628a6mr13547721qtx.3.1709127080424; Wed, 28 Feb 2024 05:31:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709127080; cv=pass; d=google.com; s=arc-20160816; b=Ppa3S2L+nUDL98+Q9BRvU6VpXYTcW5OF6vRYI0bcrIa88ksM+7x0IocqsZDgOPc1Hk rk0RPe2qQ+8CHJOzbV/Lnf9TRu99wBjKR6krTgpthpd1ofQX0iIuET1Yn1CeSOoMNHxl vQkTbjJbEK4+Lkt1m2Opwtpc08o0mvr6saCEtgGMDeMGeLNqYsaz1kvOoNbPNeHOX97J 4Fblb657TVtYb78SHx/VAhyBL6mDVN0vdPozkriiFwW4JndujaeW2jvXcKMRwGQgXnO6 6f/nujhehO6H1V7+XQHmh+JLDEJuC3d9XNZy6YO8riCpUP5sL5O73WKrtZETv35PgF60 YsgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=mYhUY0xj59xhvUYFGeVBejeoiizOAuL7jH7HPYGmaLI=; fh=FAgatP2hVymb49LNj3Pe151k8iWwltUkVsL4vF+tGSc=; b=KuLyIynE7/CsP3/nRCr72yjst0HBzj591OY1aQ+3m08lWW0aELgXatQ9sXW1rINue/ TWfr2UxRrPuVMRS1kiVrD5Ndq/+vVOffIvZ2KlZT2kOyxzU3YHRGmjRFhQSbNADCbFJU /bd/arQydcuzVe4MQXZQLnnyGtVKuCrRAOYaohGBGIbHVgK48VMPA5k5otztaAQXpQiJ 2ZzAF/b6rmQ9BZacI0jGRUS59zlIanGuYXcNLxmy9FLgo08E5gu1EfZXKj8ShUNmj/li onpRwH9frkzWtulHnH49cTbG3EWqb76hi2OGNEIYoTitwWpjN8qhCRD8q75jjf3kQ827 +q4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ZC/kXNJ5"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n15-20020a05622a040f00b0042ea04dddd6si3344525qtx.747.2024.02.28.05.31.20 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 05:31:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ZC/kXNJ5"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85095-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A43C1C22CDD for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 13:31:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C389514CACE; Wed, 28 Feb 2024 13:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZC/kXNJ5" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5D7B1E493 for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 13:31:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127067; cv=none; b=DeEQ8AfsZ/7GEI/BJtezRamm0+pZcW0gy1w2QN9K8FNkpqTo5LddCW/9/3Edx2JmDmu/1UUqQJ3ervz6b1s1ICNOY98WqI+yspFDsws8qNd5QHm0PBSLCr8RSZz4J1B1txqukfbsjyddosCpsJ4b6Prydx9rZ1hLxOaHN9Evdok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709127067; c=relaxed/simple; bh=3VQZtPFFjJ6KMik5qwmu9RFH9g6RLd3eRx0NWCx6Qko=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Fnr4P9ejRxI/VruD1cqPVE4BfkJXMluqHt9j4+4cGYQd9dQIAfJztG2TyLeOVN4/UpJQ5p0vZHb3/md/86EAVa5x8ckN4j4rPj+XIVHkC0Q8xgz6Rg1oxNk8gvXUpq0hZ4k7Lds7adrM4DA3uRiwdCRIiTpRe3Km9M1Qc6Ji6kQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZC/kXNJ5; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709127063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=mYhUY0xj59xhvUYFGeVBejeoiizOAuL7jH7HPYGmaLI=; b=ZC/kXNJ5NUV/Ec4C2J2EV0+HAV1fdM5L/N11qkgCz1Dfsa97q0MCxqHSdxWoBaCfTyN2PZ FY3Rv31J4gtv0w6JWY04NcTEy5N4aPKcopvINjCUkVXwI7C+/oDiXa0zemdo3933+nbOXl 6yEtUEmR9e5H4h/JktfgEvZRKjMoS2Q= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-aBSN9Oe7P5W_Su_A28IPow-1; Wed, 28 Feb 2024 08:31:01 -0500 X-MC-Unique: aBSN9Oe7P5W_Su_A28IPow-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD1CF8B39A5; Wed, 28 Feb 2024 13:31:00 +0000 (UTC) Received: from tpad.localdomain (unknown [10.96.133.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 937901121312; Wed, 28 Feb 2024 13:31:00 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id EC662401E122B; Wed, 28 Feb 2024 10:30:42 -0300 (-03) Date: Wed, 28 Feb 2024 10:30:42 -0300 From: Marcelo Tosatti <mtosatti@redhat.com> To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Frederic Weisbecker <frederic@kernel.org>, Valentin Schneider <vschneid@redhat.com>, Paolo Abeni <pabeni@redhat.com> Subject: [PATCH -v2 net-next] net/core/dev.c: enable timestamp static key if CPU isolation is configured Message-ID: <Zd81gp2utD9+ripX@tpad> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792149637434906572 X-GMAIL-MSGID: 1792149637434906572 |
Series |
[-v2,net-next] net/core/dev.c: enable timestamp static key if CPU isolation is configured
|
|
Commit Message
Marcelo Tosatti
Feb. 28, 2024, 1:30 p.m. UTC
For systems that use CPU isolation (via nohz_full), creating or destroying
a socket with timestamping (SOCK_TIMESTAMPING_RX_SOFTWARE and
SOF_TIMESTAMPING_OPT_TX_SWHW) might cause a
static key to be enabled/disabled. This in turn causes undesired
IPIs to isolated CPUs.
So enable the static key unconditionally, if CPU isolation is enabled,
thus avoiding the IPIs.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
---
v2: mention SOF_TIMESTAMPING_OPT_TX_SWHW in the commit log (Willem de Bruijn / Paolo Abeni)
Comments
Marcelo Tosatti wrote: > > For systems that use CPU isolation (via nohz_full), creating or destroying > a socket with timestamping (SOCK_TIMESTAMPING_RX_SOFTWARE and > SOF_TIMESTAMPING_OPT_TX_SWHW) might cause a Again, SOF_TIMESTAMPING_OPT_TX_SWHW is irrelevant here. See Documentation/networking/timestamping.rst for a definition of the various flags. > static key to be enabled/disabled. This in turn causes undesired > IPIs to isolated CPUs. > > So enable the static key unconditionally, if CPU isolation is enabled, > thus avoiding the IPIs. > > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> > > --- > v2: mention SOF_TIMESTAMPING_OPT_TX_SWHW in the commit log (Willem de Bruijn / Paolo Abeni) I did not suggest that The subject line is slightly corrupted: net-next -v2 > > diff --git a/net/core/dev.c b/net/core/dev.c > index c588808be77f..15a32f5900e6 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -155,6 +155,7 @@ > #include <net/netdev_rx_queue.h> > #include <net/page_pool/types.h> > #include <net/page_pool/helpers.h> > +#include <linux/sched/isolation.h> > > #include "dev.h" > #include "net-sysfs.h" > @@ -11851,3 +11852,14 @@ static int __init net_dev_init(void) > } > > subsys_initcall(net_dev_init); > + > +static int __init net_dev_late_init(void) > +{ > + /* avoid static key IPIs to isolated CPUs */ > + if (housekeeping_enabled(HK_TYPE_MISC)) > + net_enable_timestamp(); > + > + return 0; > +} > + > +late_initcall(net_dev_late_init); >
diff --git a/net/core/dev.c b/net/core/dev.c index c588808be77f..15a32f5900e6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -155,6 +155,7 @@ #include <net/netdev_rx_queue.h> #include <net/page_pool/types.h> #include <net/page_pool/helpers.h> +#include <linux/sched/isolation.h> #include "dev.h" #include "net-sysfs.h" @@ -11851,3 +11852,14 @@ static int __init net_dev_init(void) } subsys_initcall(net_dev_init); + +static int __init net_dev_late_init(void) +{ + /* avoid static key IPIs to isolated CPUs */ + if (housekeeping_enabled(HK_TYPE_MISC)) + net_enable_timestamp(); + + return 0; +} + +late_initcall(net_dev_late_init);