Message ID | Zc9493j46rZMRIDv@tpad |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-68776-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp571025dyb; Fri, 16 Feb 2024 07:03:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWo0KujIDEyT7ypwNoJ8OaCN6YsXfYs2zjjTBQok9Xf1jOdeBpT2WV5KZIUbfg84lp4IIc5J65bC0AMUrOPZ7UnpJ1Y5A== X-Google-Smtp-Source: AGHT+IEzdQIFiRgij7iK95w5CVpLVKePtvdY5uRYWhDooORvz3wnYxCN//Au/p/kkjgl19OsRB5A X-Received: by 2002:aa7:d4d9:0:b0:560:be95:aa64 with SMTP id t25-20020aa7d4d9000000b00560be95aa64mr3803147edr.37.1708095790192; Fri, 16 Feb 2024 07:03:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708095790; cv=pass; d=google.com; s=arc-20160816; b=W5br6xBjA1+nH/nhYGmP9Gl3pOhhbyq5Tyenbd8uW/H05bRVV6KM5hK8GIN+sB1QTe 4ZcuCuD07agnmSfqsCqRcGvoJgbLc5TuNlIRd8rpkNw8if1DmHqwNyI0xMzqOOwLMl0j Vc5HGJYBqB24dRbmAu+UAs9vIB18Q8/yPcmXKL+oh81qZaLsNbQKlN10eILpx4pYVCFK j3/Ipi3Yc1zshDeKs5z5w05mtx2lMP8h11I0g+WsV4DWdDhQQfmYhcEH5IERAPwhpFP4 KJ60TKPOBHcv7uj/vj1bSCBpX8mEoU4gnYXu84vt1lIpoKNUTb3mfxKqxwdVj5o/P5cC U5CA== 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=aZ1RnOnTSLBiglbkhX1NHskWW94OsYikvhSwmo5Uu90=; fh=ZIVyYq35TavSok2dM29AVxDZPjjhTBUJp3Lu7dcXQ84=; b=0Z+g9+jkfSpm0hok2LF3Rg+qM3wUuZUAI9VRJGb3oseJku9jEO/5wleenU+gyZRqgz VSDihKK5U9+Lo+8Vbi72ITvHFDvDLglnAwW7oCkHkCxeymsqqKTZPpY7e1zFDopdS9bA EKm+7E3AlrV5w55+3ivkvcOXqW+U6AFDVMK+m8h3l9bCd5H/ZOrG/wqEkFXvhb31DcF/ KPTxtl4Dtp+iTeoZdYDcPztCc0odmAnbXK3N8fxMh0BCRA4X26n47Beer6bvqkFfXsa9 kodm2S+n0SZDRmkPX3nwzhwZWCJNPN5nXp1bwQhz3fVAdZ10j0khqp/SJefpdqJCUBi/ SH3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y+i/G1OA"; 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-68776-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68776-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m2-20020aa7c482000000b00563f8e1ceabsi38986edq.383.2024.02.16.07.03.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:03:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68776-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y+i/G1OA"; 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-68776-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68776-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 am.mirrors.kernel.org (Postfix) with ESMTPS id AB01A1F223FD for <ouuuleilei@gmail.com>; Fri, 16 Feb 2024 15:03:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A899712F394; Fri, 16 Feb 2024 15:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y+i/G1OA" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 EE77A12C7FB for <linux-kernel@vger.kernel.org>; Fri, 16 Feb 2024 15:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708095777; cv=none; b=Km6koc1UUq0I6cpzPdKBchO1uDb5MqYTPwDQYTN7bb+JxZ2lf2dX+KkAoC3l38083R/TQ/7UmOAHpPHEbyl3nqZ7HpNthz3vSvW7BqIiwnwvUbagaNj6U8qpk3GQgdGGkZrmThJNiv/2zrO5dfaF9omIBlEBJ+X4FSeID7Wgreo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708095777; c=relaxed/simple; bh=GqVjIc3Y9GJCrVy/nye5izgJbw3sIDygaE+0C7huDFg=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=kA20wpgxmszgwj3IbS1hNtO7AHufvJo9QrR0u1qBBw8ABNw7f6p9clrswY1CUP0lp5Ly5OweCKnWbcAil56qdmU3oja53OpsI+zqRo3IRDd0seqYgwCqb05loULvyauMGXnZUBP5donCMFtc3EhAdRfxAzB73t2wUHjoUgR0YUM= 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=Y+i/G1OA; arc=none smtp.client-ip=170.10.129.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=1708095773; 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=aZ1RnOnTSLBiglbkhX1NHskWW94OsYikvhSwmo5Uu90=; b=Y+i/G1OAhEhbfjjwzvvNOl/sHLxJfT+AtT3zfVECWlDpHoBeEjeZ0LsD2XsxS+batTiLHw OowJj+qZRPXBDWHqLqiIEiiqMX1kub07CGUCuoeOZfejL0UtWjWIAtV/fFan9WMrEjF0C7 qS1LLY7+iYmD2R19V8Wd8PevVklB/OY= 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-329-W3BTSf1FMa6m6Uev6EHpOg-1; Fri, 16 Feb 2024 10:02:51 -0500 X-MC-Unique: W3BTSf1FMa6m6Uev6EHpOg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 F014684AE4A; Fri, 16 Feb 2024 15:02:50 +0000 (UTC) Received: from tpad.localdomain (unknown [10.96.133.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BDB1240C9444; Fri, 16 Feb 2024 15:02:50 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id B80BE4086D5AC; Fri, 16 Feb 2024 12:02:15 -0300 (-03) Date: Fri, 16 Feb 2024 12:02:15 -0300 From: Marcelo Tosatti <mtosatti@redhat.com> To: linux-kernel@vger.kernel.org Cc: Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Frederic Weisbecker <frederic@kernel.org>, Valentin Schneider <vschneid@redhat.com> Subject: [PATCH] net/core/dev.c: enable timestamp static key if CPU isolation is configured Message-ID: <Zc9493j46rZMRIDv@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.2 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791068251220342342 X-GMAIL-MSGID: 1791068251220342342 |
Series |
net/core/dev.c: enable timestamp static key if CPU isolation is configured
|
|
Commit Message
Marcelo Tosatti
Feb. 16, 2024, 3:02 p.m. UTC
For systems that use CPU isolation (via nohz_full), creating or destroying
a socket with timestamping (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>
Comments
On Fri, Feb 16, 2024 at 4:02 PM Marcelo Tosatti <mtosatti@redhat.com> wrote: > > > For systems that use CPU isolation (via nohz_full), creating or destroying > a socket with timestamping (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> > > diff --git a/net/core/dev.c b/net/core/dev.c > index 0d548431f3fa..cc9a77b4aa4e 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -153,6 +153,7 @@ > #include <linux/prandom.h> > #include <linux/once_lite.h> > #include <net/netdev_rx_queue.h> > +#include <linux/sched/isolation.h> > > #include "dev.h" > #include "net-sysfs.h" > @@ -11601,3 +11602,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); > CC netdev@ SGTM, but could you please add netdev@ when sending patches for network trees ? Thanks.
diff --git a/net/core/dev.c b/net/core/dev.c index 0d548431f3fa..cc9a77b4aa4e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -153,6 +153,7 @@ #include <linux/prandom.h> #include <linux/once_lite.h> #include <net/netdev_rx_queue.h> +#include <linux/sched/isolation.h> #include "dev.h" #include "net-sysfs.h" @@ -11601,3 +11602,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);