From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB35418E20 for ; Fri, 1 Nov 2024 00:49:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422158; cv=none; b=X4RFghhPY11FfVuBLBNEfzUP0JGQ2wpmHCx6r0QEYD6H6q/5ZSz2rYs462kXCap5kukSA3K//FeaY1KIn1XvdIpd+ENuJ4iEdy3rJ+fWw8Py0XkspV8+YTwjvJVLwGmjPG6JbZCJ1RkIKg2KhJx39Pi793nZSX2lzUhzxiQvTNc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422158; c=relaxed/simple; bh=BbiMmQ9lhHSZwz2GE4uUBK215d1RjaKUDOHmpZeB798=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oT4IpAbyZoXvo+MxVncDF/GPXp2B7KpQHZvEt+dxOyyqKg2Q3JTmwTj3s1TgTBZjWm9Wc6H0CMiUjhkn5e95ZVoiKdkdZS+kQJVy9uKbNdWzwpeTlp2GVNGU24ViApainvEgEexIbgbI4eKUnUtiETIIsYJF8+VinSYvyw5ltQ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=kBPdms8z; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="kBPdms8z" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2e2eb9dde40so1183073a91.0 for ; Thu, 31 Oct 2024 17:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422151; x=1731026951; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MQwJosGQqGKWCzWvyn5N2YN0Mkzhky7gbPUGL1mnPGo=; b=kBPdms8zwj2G72EaH8cF79A7VlhIWhIuKrVkkV/rVayIQLJj8/pYBrMDP9DzHFzO0E QOm153ostn3ugy0WYCgEogiymkE4gbYPrP+e11MutWpZhFnwraA/cNV/nAuC32JxKtto kedpCU4bWsJYZI0hG47+UlUNOiHpC9DCDESGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422151; x=1731026951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MQwJosGQqGKWCzWvyn5N2YN0Mkzhky7gbPUGL1mnPGo=; b=Go+J6Mps9sj39Nuz27zfq2LsVXg+qFSgxkqNeWusp5D/FZUp2ydsTVE3tvH6V47Hh6 3+d8rrxI0EGM8g4O8ucmnuBaSpTPAFsYLfFmZO5r25PUUKMF4ZlQod2xpHVbFEolVQkE 38CK1dlxZfKFChdAQetx6kku4gEDY+MfAVYrywuAOceJlO/byuo+GfblbGhRpUoMZHUh DuGKwUnT5dEtvRaHSCP41Ym6LKxHfVw/cZlP0lRmv3ckeXCLO2aJGPiwWztwu2Iku8xu oWmfrUOEFvWUU1cWait16gqRsr6PgFnKPa5lpmibrpiyOfbhLepwipAFcAMT59rkmjaO gxFQ== X-Forwarded-Encrypted: i=1; AJvYcCWYBucsHQi1yhBa3xNPA8PvuBFs2FAbfjlv1/nlmfSm4QdrCpA8jNt7YjYf8Gx8Tp+1frZKBLiPhovByJE=@vger.kernel.org X-Gm-Message-State: AOJu0YwU3cGS8NwKPYV7aJ/7eWYGuprrFz5IwI9iTkZDmEHevtWmjpLh +HSvvj3Oy5SA1rF59rW3u0aZy37B92UGAf+L8xoUsYPvrlNxzpweJtXksUjsA9Q= X-Google-Smtp-Source: AGHT+IFH+MwGe53WeQGFbHYKRVHLNYqcQbbMSoQAF3kRqudHNgLybQBOPxcygcY5dwLE43cd+o04sQ== X-Received: by 2002:a17:90b:4a01:b0:2e2:bd7a:71ea with SMTP id 98e67ed59e1d1-2e93c12931bmr6132260a91.8.1730422151031; Thu, 31 Oct 2024 17:49:11 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:10 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Martin Karsten , Joe Damato , "David S. Miller" , Simon Horman , Donald Hunter , Andrew Lunn , Jesper Dangaard Brouer , Mina Almasry , Xuan Zhuo , David Ahern , Sebastian Andrzej Siewior , Lorenzo Bianconi , Alexander Lobakin , Jiri Pirko , Johannes Berg , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 1/7] net: Add napi_struct parameter irq_suspend_timeout Date: Fri, 1 Nov 2024 00:48:28 +0000 Message-Id: <20241101004846.32532-2-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Martin Karsten Add a per-NAPI IRQ suspension parameter, which can be get/set with netdev-genl. This patch doesn't change any behavior but prepares the code for other changes in the following commits which use irq_suspend_timeout as a timeout for IRQ suspension. Signed-off-by: Martin Karsten Co-developed-by: Joe Damato Signed-off-by: Joe Damato Tested-by: Joe Damato Tested-by: Martin Karsten Acked-by: Stanislav Fomichev --- v1 -> v2: - rewrote this patch to make irq_suspend_timeout per-napi via netdev-genl. rfc -> v1: - removed napi.rst documentation from this patch; added to patch 6. Documentation/netlink/specs/netdev.yaml | 7 +++++++ include/linux/netdevice.h | 2 ++ include/uapi/linux/netdev.h | 1 + net/core/dev.c | 2 ++ net/core/dev.h | 25 +++++++++++++++++++++++++ net/core/netdev-genl-gen.c | 5 +++-- net/core/netdev-genl.c | 12 ++++++++++++ tools/include/uapi/linux/netdev.h | 1 + 8 files changed, 53 insertions(+), 2 deletions(-) diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlin= k/specs/netdev.yaml index f9cb97d6106c..cbb544bd6c84 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -263,6 +263,11 @@ attribute-sets: the end of a NAPI cycle. This may add receive latency in exch= ange for reducing the number of frames processed by the network st= ack. type: uint + - + name: irq-suspend-timeout + doc: The timeout, in nanoseconds, of how long to suspend irq + processing, if event polling finds events + type: uint - name: queue attributes: @@ -653,6 +658,7 @@ operations: - pid - defer-hard-irqs - gro-flush-timeout + - irq-suspend-timeout dump: request: attributes: @@ -704,6 +710,7 @@ operations: - id - defer-hard-irqs - gro-flush-timeout + - irq-suspend-timeout =20 kernel-family: headers: [ "linux/list.h"] diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3c552b648b27..c8ab5f08092b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -347,6 +347,7 @@ struct gro_list { */ struct napi_config { u64 gro_flush_timeout; + u64 irq_suspend_timeout; u32 defer_hard_irqs; unsigned int napi_id; }; @@ -383,6 +384,7 @@ struct napi_struct { struct hrtimer timer; struct task_struct *thread; unsigned long gro_flush_timeout; + unsigned long irq_suspend_timeout; u32 defer_hard_irqs; /* control-path-only fields follow */ struct list_head dev_list; diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h index e3ebb49f60d2..e4be227d3ad6 100644 --- a/include/uapi/linux/netdev.h +++ b/include/uapi/linux/netdev.h @@ -124,6 +124,7 @@ enum { NETDEV_A_NAPI_PID, NETDEV_A_NAPI_DEFER_HARD_IRQS, NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT, + NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT, =20 __NETDEV_A_NAPI_MAX, NETDEV_A_NAPI_MAX =3D (__NETDEV_A_NAPI_MAX - 1) diff --git a/net/core/dev.c b/net/core/dev.c index c682173a7642..68d0b16c2f2c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6662,6 +6662,7 @@ static void napi_restore_config(struct napi_struct *n) { n->defer_hard_irqs =3D n->config->defer_hard_irqs; n->gro_flush_timeout =3D n->config->gro_flush_timeout; + n->irq_suspend_timeout =3D n->config->irq_suspend_timeout; /* a NAPI ID might be stored in the config, if so use it. if not, use * napi_hash_add to generate one for us. It will be saved to the config * in napi_disable. @@ -6676,6 +6677,7 @@ static void napi_save_config(struct napi_struct *n) { n->config->defer_hard_irqs =3D n->defer_hard_irqs; n->config->gro_flush_timeout =3D n->gro_flush_timeout; + n->config->irq_suspend_timeout =3D n->irq_suspend_timeout; n->config->napi_id =3D n->napi_id; napi_hash_del(n); } diff --git a/net/core/dev.h b/net/core/dev.h index 7881bced70a9..d043dee25a68 100644 --- a/net/core/dev.h +++ b/net/core/dev.h @@ -236,6 +236,31 @@ static inline void netdev_set_gro_flush_timeout(struct= net_device *netdev, netdev->napi_config[i].gro_flush_timeout =3D timeout; } =20 +/** + * napi_get_irq_suspend_timeout - get the irq_suspend_timeout + * @n: napi struct to get the irq_suspend_timeout from + * + * Return: the per-NAPI value of the irq_suspend_timeout field. + */ +static inline unsigned long +napi_get_irq_suspend_timeout(const struct napi_struct *n) +{ + return READ_ONCE(n->irq_suspend_timeout); +} + +/** + * napi_set_irq_suspend_timeout - set the irq_suspend_timeout for a napi + * @n: napi struct to set the irq_suspend_timeout + * @timeout: timeout value to set + * + * napi_set_irq_suspend_timeout sets the per-NAPI irq_suspend_timeout + */ +static inline void napi_set_irq_suspend_timeout(struct napi_struct *n, + unsigned long timeout) +{ + WRITE_ONCE(n->irq_suspend_timeout, timeout); +} + int rps_cpumask_housekeeping(struct cpumask *mask); =20 #if defined(CONFIG_DEBUG_NET) && defined(CONFIG_BPF_SYSCALL) diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c index 21de7e10be16..a89cbd8d87c3 100644 --- a/net/core/netdev-genl-gen.c +++ b/net/core/netdev-genl-gen.c @@ -92,10 +92,11 @@ static const struct nla_policy netdev_bind_rx_nl_policy= [NETDEV_A_DMABUF_FD + 1] }; =20 /* NETDEV_CMD_NAPI_SET - do */ -static const struct nla_policy netdev_napi_set_nl_policy[NETDEV_A_NAPI_GRO= _FLUSH_TIMEOUT + 1] =3D { +static const struct nla_policy netdev_napi_set_nl_policy[NETDEV_A_NAPI_IRQ= _SUSPEND_TIMEOUT + 1] =3D { [NETDEV_A_NAPI_ID] =3D { .type =3D NLA_U32, }, [NETDEV_A_NAPI_DEFER_HARD_IRQS] =3D NLA_POLICY_FULL_RANGE(NLA_U32, &netde= v_a_napi_defer_hard_irqs_range), [NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT] =3D { .type =3D NLA_UINT, }, + [NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT] =3D { .type =3D NLA_UINT, }, }; =20 /* Ops table for netdev */ @@ -186,7 +187,7 @@ static const struct genl_split_ops netdev_nl_ops[] =3D { .cmd =3D NETDEV_CMD_NAPI_SET, .doit =3D netdev_nl_napi_set_doit, .policy =3D netdev_napi_set_nl_policy, - .maxattr =3D NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT, + .maxattr =3D NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT, .flags =3D GENL_ADMIN_PERM | GENL_CMD_CAP_DO, }, }; diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index b49c3b4e5fbe..765ce7c9d73b 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -161,6 +161,7 @@ static int netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi, const struct genl_info *info) { + unsigned long irq_suspend_timeout; unsigned long gro_flush_timeout; u32 napi_defer_hard_irqs; void *hdr; @@ -196,6 +197,11 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct na= pi_struct *napi, napi_defer_hard_irqs)) goto nla_put_failure; =20 + irq_suspend_timeout =3D napi_get_irq_suspend_timeout(napi); + if (nla_put_uint(rsp, NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT, + irq_suspend_timeout)) + goto nla_put_failure; + gro_flush_timeout =3D napi_get_gro_flush_timeout(napi); if (nla_put_uint(rsp, NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT, gro_flush_timeout)) @@ -306,6 +312,7 @@ int netdev_nl_napi_get_dumpit(struct sk_buff *skb, stru= ct netlink_callback *cb) static int netdev_nl_napi_set_config(struct napi_struct *napi, struct genl_info *info) { + u64 irq_suspend_timeout =3D 0; u64 gro_flush_timeout =3D 0; u32 defer =3D 0; =20 @@ -314,6 +321,11 @@ netdev_nl_napi_set_config(struct napi_struct *napi, st= ruct genl_info *info) napi_set_defer_hard_irqs(napi, defer); } =20 + if (info->attrs[NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT]) { + irq_suspend_timeout =3D nla_get_uint(info->attrs[NETDEV_A_NAPI_IRQ_SUSPE= ND_TIMEOUT]); + napi_set_irq_suspend_timeout(napi, irq_suspend_timeout); + } + if (info->attrs[NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT]) { gro_flush_timeout =3D nla_get_uint(info->attrs[NETDEV_A_NAPI_GRO_FLUSH_T= IMEOUT]); napi_set_gro_flush_timeout(napi, gro_flush_timeout); diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/n= etdev.h index e3ebb49f60d2..e4be227d3ad6 100644 --- a/tools/include/uapi/linux/netdev.h +++ b/tools/include/uapi/linux/netdev.h @@ -124,6 +124,7 @@ enum { NETDEV_A_NAPI_PID, NETDEV_A_NAPI_DEFER_HARD_IRQS, NETDEV_A_NAPI_GRO_FLUSH_TIMEOUT, + NETDEV_A_NAPI_IRQ_SUSPEND_TIMEOUT, =20 __NETDEV_A_NAPI_MAX, NETDEV_A_NAPI_MAX =3D (__NETDEV_A_NAPI_MAX - 1) --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A63A28E3F for ; Fri, 1 Nov 2024 00:49:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422160; cv=none; b=U0ABJD34zi76rrBatxln1Rr9+S5cwP2a1JUtZUMuMggKlkQWCQUPLAw1zyHBBj+mnVroraBuV6U+4oyUyTpD1Yx9nG2rt0jIRLLASKL1g+r1No9c4meqwtNpt4JXEXuUX7y6+bHk12/larULX/a867dU2HXGL9Yg4Eez5JeoXK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422160; c=relaxed/simple; bh=sxmIdc/sf/bIbzvaUc2kAE34qI248wxvFYvdvCkPsdU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PR1MDJkV3dFH5LGYKkAAK6JM3qscM1QY+Lwc2/dImNGDcc9IFfku4ZrGopW/wrmUZO3uHq+3f5NzA06/oteewbso6cKW07TP1b876tWHabLce281X2wqHcwtOCPpfY898E7Eg1/9tjP0oKOD3/3HZHghrxuD2Zd4pjlYuibIz0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=UxPCaSRV; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="UxPCaSRV" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e4c2e36daso1836703b3a.0 for ; Thu, 31 Oct 2024 17:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422154; x=1731026954; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C84IinfynAgOtsJcnt7PRBvv5jmEZH+SpaWYZvenng4=; b=UxPCaSRVuFLOjK6PyWLffYW/hCT2lnDj+iKACs1qJvSjajUaYaAsKlzAOg9W/ir1IE C+Q1uktET4VRmguRf1Stl/KHbplX1F9wrCsdrcl3xvWv1mOEYXPwhm/q3c+1n/UkW5ym fll4Q5OrQrsg0KtZmY8FYv3up0/xKUgxL2Wqc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422154; x=1731026954; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C84IinfynAgOtsJcnt7PRBvv5jmEZH+SpaWYZvenng4=; b=bOgb+7Dox2WurRMDJ9TQilA0Hzkxu1HEtt7gDxIx8CxHClmVWyylLfFMhAyOZT4AF9 KxulVtJ2WaP7cjRS27ujPrKh78X9s5nZiX++S5Ju4Z/0FKbdQq8T7g2V2XTqxQLoiBoS zNdgUOlUW1p1FbmwuhM2fRNyFYEeeH2Bo3oTsu9ZM/d9C725sOkzmZL/1ROPMNpo+iGI kcqrHyzAe0w2PWaxymxWW6fmzBedAi0cTAeQo+WKBp2oWmbQpAu2zB2dC05Jn795KFv+ 6aXX3DvK/AitXTUJh48DkUneLoKIBD+YAZ0nqYYOiyJbXBqwI9wOlrvkncJGkhNrywiG 0S5A== X-Forwarded-Encrypted: i=1; AJvYcCWI6AJvTRoBe6iF4U/ikJpBNBPtDb+98DmE+Ao+L0ky2YIz2/pT8KRKWZ3pmu6epHxaO07pAQKR5MUbMrY=@vger.kernel.org X-Gm-Message-State: AOJu0YyEQhy5DXzU4+uab+F7yGzCj+6oSI73yBxM+XtXZt2cF3nj11HC y4BNA6oFVEcsRJn0oW971YcoqzJb/Pyhi5gkQ4+Q67ATUQ3In8A3EwwWloUIczg= X-Google-Smtp-Source: AGHT+IE9WOD6/yfsc6BWuxiJjhfnL8HBDUHOKZxJZ9gg36KeZpLNUbIMLjPvZ3muP19ag2B9GvlzQA== X-Received: by 2002:a05:6a20:432c:b0:1cf:34c3:9d0 with SMTP id adf61e73a8af0-1dba420306dmr2642123637.17.1730422154329; Thu, 31 Oct 2024 17:49:14 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:13 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Martin Karsten , Joe Damato , "David S. Miller" , Simon Horman , David Ahern , Sebastian Andrzej Siewior , Lorenzo Bianconi , Alexander Lobakin , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 2/7] net: Suspend softirq when prefer_busy_poll is set Date: Fri, 1 Nov 2024 00:48:29 +0000 Message-Id: <20241101004846.32532-3-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Martin Karsten When NAPI_F_PREFER_BUSY_POLL is set during busy_poll_stop and the irq_suspend_timeout is nonzero, this timeout is used to defer softirq scheduling, potentially longer than gro_flush_timeout. This can be used to effectively suspend softirq processing during the time it takes for an application to process data and return to the next busy-poll. The call to napi->poll in busy_poll_stop might lead to an invocation of napi_complete_done, but the prefer-busy flag is still set at that time, so the same logic is used to defer softirq scheduling for irq_suspend_timeout. Signed-off-by: Martin Karsten Co-developed-by: Joe Damato Signed-off-by: Joe Damato Tested-by: Joe Damato Tested-by: Martin Karsten Acked-by: Stanislav Fomichev --- v3: - Removed reference to non-existent sysfs parameter from commit message. No functional/code changes. net/core/dev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 68d0b16c2f2c..a388303b26b9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6235,7 +6235,12 @@ bool napi_complete_done(struct napi_struct *n, int w= ork_done) timeout =3D napi_get_gro_flush_timeout(n); n->defer_hard_irqs_count =3D napi_get_defer_hard_irqs(n); } - if (n->defer_hard_irqs_count > 0) { + if (napi_prefer_busy_poll(n)) { + timeout =3D napi_get_irq_suspend_timeout(n); + if (timeout) + ret =3D false; + } + if (ret && n->defer_hard_irqs_count > 0) { n->defer_hard_irqs_count--; timeout =3D napi_get_gro_flush_timeout(n); if (timeout) @@ -6371,9 +6376,13 @@ static void busy_poll_stop(struct napi_struct *napi,= void *have_poll_lock, bpf_net_ctx =3D bpf_net_ctx_set(&__bpf_net_ctx); =20 if (flags & NAPI_F_PREFER_BUSY_POLL) { - napi->defer_hard_irqs_count =3D napi_get_defer_hard_irqs(napi); - timeout =3D napi_get_gro_flush_timeout(napi); - if (napi->defer_hard_irqs_count && timeout) { + timeout =3D napi_get_irq_suspend_timeout(napi); + if (!timeout) { + napi->defer_hard_irqs_count =3D napi_get_defer_hard_irqs(napi); + if (napi->defer_hard_irqs_count) + timeout =3D napi_get_gro_flush_timeout(napi); + } + if (timeout) { hrtimer_start(&napi->timer, ns_to_ktime(timeout), HRTIMER_MODE_REL_PINN= ED); skip_schedule =3D true; } --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70D45381B9 for ; Fri, 1 Nov 2024 00:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422164; cv=none; b=JNFRgf0KwRAqh1lmDP8kw2H1/GPaAofYyW2XWWormFsWUh8uksA8Z9wWynZspSrfKnvG42Ykuquqwx85VzqG34RXmryBB+9GXbNsKlRLI2O+UnIMoECnHtl/uBvgLk6A4ylQOGykT0OFq4N3se3Kv5SJeHq5iIcWKCVaGkrPGEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422164; c=relaxed/simple; bh=yc3wnUgFEAEEiEFhgZgC741hzb7w+J/HyVmirOX1Re0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=esz6IyO4SY270p7/+e4W8LLylytpw7dsOWj6+MhawAatRI8XbhyYKQTooI7+ivzB4gxmK37wNB/DnsYMZJ6smvpjfQ/d1UzvJIMzbfSoPjlsyYBJ7B28rFbautcpHT5iIv1NnjCUfaQSGMnGGKcwRZRV+CXCj0PyvVgCK/rnWHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=JcTWJlvl; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="JcTWJlvl" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-72041ff06a0so1236244b3a.2 for ; Thu, 31 Oct 2024 17:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422158; x=1731026958; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T9Y5L1+xzJ293SL11vPNvlx36v2lWJ4xwPuQoBWQt1Y=; b=JcTWJlvl4+eJYmm+B0NfCqhhH7XXPvVSMmuLaJTewOP6oxSmrj0Z1eh5czdRDT0wxY WVUWVvGZIObFD/uWaUC0NaQm/v99Yg5QuwOL6jK59oZOzQS6z6u1YNQ2vXARgMlxoSOu 2Vey8I1hdv/n0uFbyXHoQMoQjwIpm4Wq2G6jI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422158; x=1731026958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T9Y5L1+xzJ293SL11vPNvlx36v2lWJ4xwPuQoBWQt1Y=; b=Ilr2cX+5vTfOwYmZW0R5wR//CEdeUjGTmZTEHnYiG71D6SY/rNBwMdqWdn4PvS/f43 z5OUVUunqm3nOUg66TnV7H0bV0dS0DUepaHNwEZpFour4ev4PZufTaZxqQx9n+CfMYwW PVBUYfUkjbOl4oaYSUWTeR/ffciPF6WNGQhQ93KceVuFa0Buurl8U3jQrTGwI4tIn7HQ XJfRLVwvNiBeucxyBYj9oIar5xqh4BdGXWjpuZibuaCMyRwgs+h5RyqKddgxIB3phf/7 TZsiJNO7dA1ijIidcdpQMC7EyMwu1lb8C3jLsWcZRKq7zqxgn19vAGaOYRxS8Vhuyr3a jRFw== X-Forwarded-Encrypted: i=1; AJvYcCVKN3BHcHYCHFWIx7j1ZcziarEbvm7CzAFPXgXdiL+AkPV1vbF0/dCoF+a0SWIQiXfth84oT+g4DrWr73Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxV3Datd1NdubxQrBwecBBFadpvbe5RNvKZrubq3daUZOujBo7U vCAVJIWkrKpNCeUx+ZY1ZaRzFcmG2HAasVCefTL9BZxqF82Q7TPnK4IqzBdCQjY= X-Google-Smtp-Source: AGHT+IExFtUEKMxFPR3RDSeM+CYyDqc3EqcQkSw+upklvNK8Ev/Io2BBe9ENsYMa2l8I0ymq9DRciA== X-Received: by 2002:a05:6a21:e590:b0:1d9:2bed:c7d8 with SMTP id adf61e73a8af0-1dba55285d1mr2006068637.43.1730422157774; Thu, 31 Oct 2024 17:49:17 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:17 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Martin Karsten , Joe Damato , "David S. Miller" , Simon Horman , David Ahern , Sebastian Andrzej Siewior , Lorenzo Bianconi , Alexander Lobakin , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 3/7] net: Add control functions for irq suspension Date: Fri, 1 Nov 2024 00:48:30 +0000 Message-Id: <20241101004846.32532-4-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Martin Karsten The napi_suspend_irqs routine bootstraps irq suspension by elongating the defer timeout to irq_suspend_timeout. The napi_resume_irqs routine effectively cancels irq suspension by forcing the napi to be scheduled immediately. Signed-off-by: Martin Karsten Co-developed-by: Joe Damato Signed-off-by: Joe Damato Tested-by: Joe Damato Tested-by: Martin Karsten Acked-by: Stanislav Fomichev --- v1 -> v2: - Added a comment to napi_resume_irqs. include/net/busy_poll.h | 3 +++ net/core/dev.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index f03040baaefd..c858270141bc 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -52,6 +52,9 @@ void napi_busy_loop_rcu(unsigned int napi_id, bool (*loop_end)(void *, unsigned long), void *loop_end_arg, bool prefer_busy_poll, u16 budget); =20 +void napi_suspend_irqs(unsigned int napi_id); +void napi_resume_irqs(unsigned int napi_id); + #else /* CONFIG_NET_RX_BUSY_POLL */ static inline unsigned long net_busy_loop_on(void) { diff --git a/net/core/dev.c b/net/core/dev.c index a388303b26b9..143b3e690169 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6512,6 +6512,45 @@ void napi_busy_loop(unsigned int napi_id, } EXPORT_SYMBOL(napi_busy_loop); =20 +void napi_suspend_irqs(unsigned int napi_id) +{ + struct napi_struct *napi; + + rcu_read_lock(); + napi =3D napi_by_id(napi_id); + if (napi) { + unsigned long timeout =3D napi_get_irq_suspend_timeout(napi); + + if (timeout) + hrtimer_start(&napi->timer, ns_to_ktime(timeout), + HRTIMER_MODE_REL_PINNED); + } + rcu_read_unlock(); +} +EXPORT_SYMBOL(napi_suspend_irqs); + +void napi_resume_irqs(unsigned int napi_id) +{ + struct napi_struct *napi; + + rcu_read_lock(); + napi =3D napi_by_id(napi_id); + if (napi) { + /* If irq_suspend_timeout is set to 0 between the call to + * napi_suspend_irqs and now, the original value still + * determines the safety timeout as intended and napi_watchdog + * will resume irq processing. + */ + if (napi_get_irq_suspend_timeout(napi)) { + local_bh_disable(); + napi_schedule(napi); + local_bh_enable(); + } + } + rcu_read_unlock(); +} +EXPORT_SYMBOL(napi_resume_irqs); + #endif /* CONFIG_NET_RX_BUSY_POLL */ =20 static void __napi_hash_add_with_id(struct napi_struct *napi, --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 658F84594A for ; Fri, 1 Nov 2024 00:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422166; cv=none; b=LQU2Fi5e++nR6DkiadW3Y/Y0E1yhEkNHPEHuKhuxZzH+qgrh2W2V/bk9uzG/CfmtNGbzuxkLxio+BOz1Cbrkxn7Bq1i5FyZCK0eGfF9Wxw71hrDCXePUe3VQlmptwaZCmE+UO51QaaY3cX9HipShuZ6kxyWNU7d4SDQvBavNOvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422166; c=relaxed/simple; bh=aGe3m9f05dLxeBPRr1eRz+KFLkuOg8ceUeij3ovk3Q4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DnUdzKdWzAzv74/uO/SXMwhe86TkWMp3uUqcSW6gAk1RqoVEtgWn91Yw65aM8VWRjNh6xnvc2CY9CCARF6QHqtHQFFhDsg6RNfWWhxjrwZdrwUpUSSwqZxUtNvb7h+X8lacigYLjBWbsQZokpNlBL/RHia7VP9Lbi5n2u7yFcR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=EOl9dT7r; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="EOl9dT7r" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7203c431f93so1263842b3a.1 for ; Thu, 31 Oct 2024 17:49:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422160; x=1731026960; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yNzsrSrDdKCfiGrjyj6BVJ0PxYUn3ubPvyVnHqdF5ew=; b=EOl9dT7rqZ/XjE/Es3RJSORRnQSOmGvYBzkLqlURXuMRCAha7Loeei7+POyhP8uY9C 4YQIvmTbQZPtVgIuUPSM+X9Twy+T8eKSO5/FKJjqIa9ua3K9IpiiN+fwcogFG46qCYki dB5tO5+fOGPLW97Ia9OplWjtER+O/Pjaps/Fg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422160; x=1731026960; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yNzsrSrDdKCfiGrjyj6BVJ0PxYUn3ubPvyVnHqdF5ew=; b=NsUu51IUbLcJT8Y7XaZFM3B0AtfVMMPgmcT2sMCLOwadToIddJvvCZck2/Sb/sqkz/ 0ZaTuHAtLAv+VDGepvtEdD3ECikeNep36BQq3kkUMVFAinVdqHzBbVG9wUl6l8rgBFVB DhcotJ4vriVIyUoRo0W8BHjiFM7lJSLsO5OVfwn+lpBqIBPtRZHZ0s2qhX/GHJruy6IN GRoEwDl46IlVBeqkWiUWmI0FRXtn8mkTYZMtuezlBdIykDvhkdyzDsLxnDHpV5dUpGY2 2BgZsYXVoAvzd/fxkasQ0P8CHLg5Pf1A+NOCd1Yz4X4R/E83lVVMX404yvBVYTlEn+IS 9VEw== X-Forwarded-Encrypted: i=1; AJvYcCVlzQhChr4sdLcCZoWOZMvG58XEv7fvrMlOk8kkujcot4Dq61OyIvvyzyn8dXo22aI+hlHu19Aas1xq4kg=@vger.kernel.org X-Gm-Message-State: AOJu0YzVpweCrAK3I0n6+IfCKAzYw8OPOv4vGh6QoNMUCogfQN+wlHCA Ar06eZb259xIBcXgGycKGyPOC46PibnoE+/20ZxXNIkuzHMT9JyVAyO7uYgm6+Q= X-Google-Smtp-Source: AGHT+IGknkQOlPQzMWzF3Nd5ddeqEP5+C9cHjsG5MuxNVuNJP+70dz/NU6AVLw9eSZ98XT55SfIr/w== X-Received: by 2002:a05:6a20:c998:b0:1d9:1c20:4092 with SMTP id adf61e73a8af0-1db91d892d8mr5691359637.16.1730422159752; Thu, 31 Oct 2024 17:49:19 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:19 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Martin Karsten , Joe Damato , Alexander Viro , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 4/7] eventpoll: Trigger napi_busy_loop, if prefer_busy_poll is set Date: Fri, 1 Nov 2024 00:48:31 +0000 Message-Id: <20241101004846.32532-5-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Martin Karsten Setting prefer_busy_poll now leads to an effectively nonblocking iteration though napi_busy_loop, even when busy_poll_usecs is 0. Signed-off-by: Martin Karsten Co-developed-by: Joe Damato Signed-off-by: Joe Damato Tested-by: Joe Damato Tested-by: Martin Karsten Acked-by: Stanislav Fomichev --- v1 -> v2: - Rebased to apply now that commit b9ca079dd6b0 ("eventpoll: Annotate data-race of busy_poll_usecs") has been picked up from VFS. fs/eventpoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 1ae4542f0bd8..f9e0d9307dad 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -420,7 +420,9 @@ static bool busy_loop_ep_timeout(unsigned long start_ti= me, =20 static bool ep_busy_loop_on(struct eventpoll *ep) { - return !!READ_ONCE(ep->busy_poll_usecs) || net_busy_loop_on(); + return !!READ_ONCE(ep->busy_poll_usecs) || + READ_ONCE(ep->prefer_busy_poll) || + net_busy_loop_on(); } =20 static bool ep_busy_loop_end(void *p, unsigned long start_time) --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6487E53E23 for ; Fri, 1 Nov 2024 00:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422168; cv=none; b=do25PHCBspFJkiC3OvXYRYV/y6ExRaH7wUPKbj/Gy1OECp7PF9kxk+/hLgrX115+qxbNWoL5+HyxAOtMsomNagKRGI6+bLoFxzVdqU0+wfhsKslsXMH5UAtQBXKo+4butIoWHLDPIyw7WNE/thSjXw8hPjojY/FPSEZ4+9YG41c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422168; c=relaxed/simple; bh=nTVHqzMjxVaFGtFwKysoiZKk4YEWDQibSQdexzn6DUQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eW0aO2NtgMv/pKrWumUTHDBpUR21c9D7qMXxywc49KKY6hXsb+SNpz2pfd9YhjIiFVNfYhR5xHf/EoNkcOxbg74KrYek0J+W9wpwYOuPa/SyosVN8soRpBCx1W495NiKDn9+Nj8W00a13i33M3/gxip3ylL+MJWb8JY6G+RWEN4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=g4FsDE9h; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="g4FsDE9h" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-71e4c2e36daso1836744b3a.0 for ; Thu, 31 Oct 2024 17:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422162; x=1731026962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PhVjl1Gry+K7A+Im8XGVxnCvKP7p4PT8RH2VXkmIRG8=; b=g4FsDE9hSub8oOafoJ2gM6+1cVpVJSgXSqTISVkXgSXVlUIXFLAUkorN+2I2tYb8w4 ZsAr5Ny9y75dp1e0RNzDFG9s0bKUTrmtgxuETbtBLqHq09jH6z+8QCdgiZL4qSUNoDPG OoHAeZhE5nXBgAsjOtK+lnDwVSncQedRyhq9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422162; x=1731026962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PhVjl1Gry+K7A+Im8XGVxnCvKP7p4PT8RH2VXkmIRG8=; b=YM89cFVGMPXHYGfkyCglMa9Ih0p+vw6aa8LpgbWnkmBAaR5i+VOylFspQIPJfVuonm 1XvzEiJVz/HWX91si65PgzNYrxRGyClG89UujYAix1Sy5BZkjAm1V1iGdbzd6qcuTZdD qcCSTdEulPJSudTMGEyX2OZfyWfRKV1dI3wv1OQEn36p7pmyA8xjTC/8Jc3+CYMjeCJD ZVRYq6aUNo/eQO3YvKfso7QyAgN+ZbS9Hjw0vkVq8f2znnVy3UPfGhjaVt6+YgzNmES2 EBciOg8dBfogyF2SNyqdStHtUBRWxOFCh3FhWnc1/D/amM4WR3fODgQr4nSl2c8iczez Z8IQ== X-Forwarded-Encrypted: i=1; AJvYcCW6NnBrgF/re6DU0brEGbziSzeM/Mhj/TYtsHbFbXJbq3bO4yd2u9gOxP6H7Tf10B/XNOAdByS6HpsIJ3A=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2mgYPkK10+ipvtNLwxFCbJeLOFxNH3AiUIgxEBNytNRUy/pOr rFrJErcSW7egVwBTFo+6LocUGJyx7LyAjqQdskESsKV/9XVJ1RYfJ+O+il2l6GQ= X-Google-Smtp-Source: AGHT+IEH+IJhhOqJTbEvWAGa+fGdT8tPf8aU+VscbzoV1yq0/QUbvAn4d2Gmi8WnlrR0slwEVeyS9g== X-Received: by 2002:a05:6a20:be18:b0:1db:822f:36d8 with SMTP id adf61e73a8af0-1db94f33e87mr6081599637.3.1730422161735; Thu, 31 Oct 2024 17:49:21 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:21 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Martin Karsten , Joe Damato , Alexander Viro , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next v3 5/7] eventpoll: Control irq suspension for prefer_busy_poll Date: Fri, 1 Nov 2024 00:48:32 +0000 Message-Id: <20241101004846.32532-6-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Martin Karsten When events are reported to userland and prefer_busy_poll is set, irqs are temporarily suspended using napi_suspend_irqs. If no events are found and ep_poll would go to sleep, irq suspension is cancelled using napi_resume_irqs. Signed-off-by: Martin Karsten Co-developed-by: Joe Damato Signed-off-by: Joe Damato Tested-by: Joe Damato Tested-by: Martin Karsten Acked-by: Stanislav Fomichev --- rfc -> v1: - move irq resume code from ep_free to a helper which either resumes IRQs or does nothing if !defined(CONFIG_NET_RX_BUSY_POLL). fs/eventpoll.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index f9e0d9307dad..36a657594352 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -457,6 +457,8 @@ static bool ep_busy_loop(struct eventpoll *ep, int nonb= lock) * it back in when we have moved a socket with a valid NAPI * ID onto the ready list. */ + if (prefer_busy_poll) + napi_resume_irqs(napi_id); ep->napi_id =3D 0; return false; } @@ -540,6 +542,22 @@ static long ep_eventpoll_bp_ioctl(struct file *file, u= nsigned int cmd, } } =20 +static void ep_suspend_napi_irqs(struct eventpoll *ep) +{ + unsigned int napi_id =3D READ_ONCE(ep->napi_id); + + if (napi_id >=3D MIN_NAPI_ID && READ_ONCE(ep->prefer_busy_poll)) + napi_suspend_irqs(napi_id); +} + +static void ep_resume_napi_irqs(struct eventpoll *ep) +{ + unsigned int napi_id =3D READ_ONCE(ep->napi_id); + + if (napi_id >=3D MIN_NAPI_ID && READ_ONCE(ep->prefer_busy_poll)) + napi_resume_irqs(napi_id); +} + #else =20 static inline bool ep_busy_loop(struct eventpoll *ep, int nonblock) @@ -557,6 +575,14 @@ static long ep_eventpoll_bp_ioctl(struct file *file, u= nsigned int cmd, return -EOPNOTSUPP; } =20 +static void ep_suspend_napi_irqs(struct eventpoll *ep) +{ +} + +static void ep_resume_napi_irqs(struct eventpoll *ep) +{ +} + #endif /* CONFIG_NET_RX_BUSY_POLL */ =20 /* @@ -788,6 +814,7 @@ static bool ep_refcount_dec_and_test(struct eventpoll *= ep) =20 static void ep_free(struct eventpoll *ep) { + ep_resume_napi_irqs(ep); mutex_destroy(&ep->mtx); free_uid(ep->user); wakeup_source_unregister(ep->ws); @@ -2005,8 +2032,10 @@ static int ep_poll(struct eventpoll *ep, struct epol= l_event __user *events, * trying again in search of more luck. */ res =3D ep_send_events(ep, events, maxevents); - if (res) + if (res) { + ep_suspend_napi_irqs(ep); return res; + } } =20 if (timed_out) --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 593AD132122 for ; Fri, 1 Nov 2024 00:49:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422175; cv=none; b=sG2msYH97TfDUE06TuHYXlypTrRgoiFGXZayB+zFNL9qqzdSw0joFweNXphFtaOinW8f92n67vi6zk0sXwdL2lsw3/xwrL0Fz9rl77aB6UbY06hhmAOvoww0ctrSPs/jyDDAM0BQ1aHdT0CgE4e/dxPDSnUHHkQkZVnU9VebK28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422175; c=relaxed/simple; bh=TFXbJW6wVeRX+arBDsjadpw5E4y4OvAphmOQrEKaPIM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BPKLv6MZEFGSFiskAtWxACDUFoiq+Jq0C1a1+fgyDk0/7XgowSim1SYHweNwOGs0PVyIolbnfyvjweQReMEHQfDPfPATgKU+fGNKszQglrfBxknqQoOesH9h5vzdkTFsY5cYGgLevRV6nYvz+/c1SFdvN/GBrRP/1ZGvVnXBteo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=nCCg3sz5; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="nCCg3sz5" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-715716974baso819904a34.1 for ; Thu, 31 Oct 2024 17:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422165; x=1731026965; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XkoSEaVvEKME4ZqF6oQuraqIgV/sbYh4Q6GVty3dPs8=; b=nCCg3sz5XtQ1E3mqfbb+LCBMl1KeYtMH2zFXKz8JAtW7aeB7i5oa1DOzkczXhXleU4 8IRZN/hOsTKhGoxZel3eSMDI2yTgDWPo74xsCwUVFTezkKTi9Ja39uzMzV4L0TuRaFA1 Ad6QJNeP5xKG/cdzEiHCgeSauuTupDRuMa7ks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422165; x=1731026965; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XkoSEaVvEKME4ZqF6oQuraqIgV/sbYh4Q6GVty3dPs8=; b=W6aG6JHkBszGmrCdkEER4uLCUrXu4d6xgcYZdYJyFPNgHPo30rnwmXtRVfCwijaG6m +OWHSx3LdTQHtD14aj+Dpk2YCRc7OHdGiku6kSUVrVLyYAukh7d6Yek7r3eBpYmx23Zk ddnpWzclo4mZ0SX97H6ME5hkLJtSKfvu2r1PTqJCk4W1y2D7JUppe8n+MZ+uena4yI9G 9cGlAHuWOq+IsqK/DN9RPu8eS0WSBi4tbtk0aOymHBhLG9ZPBntDhWJoatk9ckEr2ryf hJFSAUeu+vJ920FLtfI77wVgdoG6s5niBE2dQ7Hw9Y2mx7g92dZMcjuC5QDcG77dVhOk 5sHA== X-Forwarded-Encrypted: i=1; AJvYcCXfmTto+064G9XxtfnSwlMyImJGswtuGyMc5BcvfiZ9Oaq96IIWDaFo42dHcWUozaD6y/9DBLNa20ir82Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwWupoXy5A7ruyeN+stUGn5oZpXUYQBl+iyO2ulkktVkm8OePuz IGC9skiREI78BnWWYk+B2F0gD+CCGwwQVLi+NDMW0l3PFMmKfNpW5ARsKwlWy2Q= X-Google-Smtp-Source: AGHT+IEDVwLwzF5d/8qYC9UrmWwdMTMdr3jym2akk77xaWJwrb7upupKTbx/Un21wVI9DTh6SWf04g== X-Received: by 2002:a05:6830:3152:b0:718:99a0:2168 with SMTP id 46e09a7af769-719ca174bd6mr2051826a34.4.1730422164808; Thu, 31 Oct 2024 17:49:24 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:24 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Joe Damato , Martin Karsten , "David S. Miller" , Simon Horman , Shuah Khan , linux-kernel@vger.kernel.org (open list), linux-kselftest@vger.kernel.org (open list:KERNEL SELFTEST FRAMEWORK) Subject: [PATCH net-next v3 6/7] selftests: net: Add busy_poll_test Date: Fri, 1 Nov 2024 00:48:33 +0000 Message-Id: <20241101004846.32532-7-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add an epoll busy poll test using netdevsim. This test is comprised of: - busy_poller (via busy_poller.c) - busy_poll_test.sh which loads netdevsim, sets up network namespaces, and runs busy_poller to receive data and netcat to send data. The selftest tests two different scenarios: - busy poll (the pre-existing version in the kernel) - busy poll with suspend enabled (what this series adds) The data transmit is a 1MiB temporary file generated from /dev/urandom and the test is considered passing if the md5sum of the input file to netcat matches the md5sum of the output file from busy_poller. netdevsim was chosen instead of veth due to netdevsim's support for netdev-genl. For now, this test uses the functionality that netdevim provides. In the future, perhaps netdevsim can be extended to emulate device IRQs to more thoroughly test all pre-existing kernel options (like defer_hard_irqs) and suspend. Signed-off-by: Joe Damato Co-developed-by: Martin Karsten Signed-off-by: Martin Karsten --- v3: - New in v3 tools/testing/selftests/net/.gitignore | 1 + tools/testing/selftests/net/Makefile | 2 + tools/testing/selftests/net/busy_poll_test.sh | 164 ++++++++++++ tools/testing/selftests/net/busy_poller.c | 245 ++++++++++++++++++ 4 files changed, 412 insertions(+) create mode 100755 tools/testing/selftests/net/busy_poll_test.sh create mode 100644 tools/testing/selftests/net/busy_poller.c diff --git a/tools/testing/selftests/net/.gitignore b/tools/testing/selftes= ts/net/.gitignore index 217d8b7a7365..85b0c4a2179f 100644 --- a/tools/testing/selftests/net/.gitignore +++ b/tools/testing/selftests/net/.gitignore @@ -2,6 +2,7 @@ bind_bhash bind_timewait bind_wildcard +busy_poller cmsg_sender diag_uid epoll_busy_poll diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests= /net/Makefile index 26a4883a65c9..4b5f3d7d900b 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -69,6 +69,7 @@ TEST_GEN_FILES +=3D hwtstamp_config rxtimestamp timestamp= ing txtimestamp TEST_GEN_FILES +=3D ipsec TEST_GEN_FILES +=3D ioam6_parser TEST_GEN_FILES +=3D gro +TEST_GEN_FILES +=3D busy_poller TEST_GEN_PROGS =3D reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa TEST_GEN_PROGS +=3D reuseport_dualstack reuseaddr_conflict tls tun tap epo= ll_busy_poll TEST_GEN_FILES +=3D toeplitz @@ -96,6 +97,7 @@ TEST_PROGS +=3D fdb_flush.sh TEST_PROGS +=3D fq_band_pktlimit.sh TEST_PROGS +=3D vlan_hw_filter.sh TEST_PROGS +=3D bpf_offload.py +TEST_PROGS +=3D busy_poll_test.sh =20 # YNL files, must be before "include ..lib.mk" YNL_GEN_FILES :=3D ncdevmem diff --git a/tools/testing/selftests/net/busy_poll_test.sh b/tools/testing/= selftests/net/busy_poll_test.sh new file mode 100755 index 000000000000..bf33737691a4 --- /dev/null +++ b/tools/testing/selftests/net/busy_poll_test.sh @@ -0,0 +1,164 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only +source net_helper.sh + +NSIM_DEV_1_ID=3D$((256 + RANDOM % 256)) +NSIM_DEV_1_SYS=3D/sys/bus/netdevsim/devices/netdevsim$NSIM_DEV_1_ID +NSIM_DEV_2_ID=3D$((512 + RANDOM % 256)) +NSIM_DEV_2_SYS=3D/sys/bus/netdevsim/devices/netdevsim$NSIM_DEV_2_ID + +NSIM_DEV_SYS_NEW=3D/sys/bus/netdevsim/new_device +NSIM_DEV_SYS_DEL=3D/sys/bus/netdevsim/del_device +NSIM_DEV_SYS_LINK=3D/sys/bus/netdevsim/link_device +NSIM_DEV_SYS_UNLINK=3D/sys/bus/netdevsim/unlink_device + +YNL_PATH=3D$(realpath $(dirname ${0}))/../../../net/ynl/cli.py +SPEC_PATH=3D$(realpath $(dirname ${0}))/../../../../Documentation/netlink/= specs/netdev.yaml + +check_ynl() +{ + if [ ! -f ${YNL_PATH} ]; then + echo "YNL path invalid: ${YNL_PATH}" + exit 1 + fi + + if [ ! -f ${SPEC_PATH} ]; then + echo "spec path invalid: ${SPEC_PATH}" + exit 1 + fi +} + +setup_ns() +{ + set -e + ip netns add nssv + ip netns add nscl + + NSIM_DEV_1_NAME=3D$(find $NSIM_DEV_1_SYS/net -maxdepth 1 -type d ! \ + -path $NSIM_DEV_1_SYS/net -exec basename {} \;) + NSIM_DEV_2_NAME=3D$(find $NSIM_DEV_2_SYS/net -maxdepth 1 -type d ! \ + -path $NSIM_DEV_2_SYS/net -exec basename {} \;) + + # ensure the server has 1 queue + ethtool -L $NSIM_DEV_1_NAME combined 1 2>/dev/null + + ip link set $NSIM_DEV_1_NAME netns nssv + ip link set $NSIM_DEV_2_NAME netns nscl + + ip netns exec nssv ip addr add '192.168.1.1/24' dev $NSIM_DEV_1_NAME + ip netns exec nscl ip addr add '192.168.1.2/24' dev $NSIM_DEV_2_NAME + + ip netns exec nssv ip link set dev $NSIM_DEV_1_NAME up + ip netns exec nscl ip link set dev $NSIM_DEV_2_NAME up + + set +e +} + +cleanup_ns() +{ + ip netns del nscl + ip netns del nssv +} + +test_busypoll() +{ + tmp_file=3D$(mktemp) + out_file=3D$(mktemp) + + # fill a test file with random data + dd if=3D/dev/urandom of=3D${tmp_file} bs=3D1M count=3D1 2> /dev/null + + timeout -k 60s 60s ip netns exec nssv ./busy_poller -p48675 -b192.168.1.1= -m8 -u0 -P1 -g16 -o${out_file}& + + wait_local_port_listen nssv 48675 tcp + + ip netns exec nscl nc -N 192.168.1.1 48675 < $tmp_file + + wait + + tmp_file_md5sum=3D$(md5sum $tmp_file | cut -f1 -d' ') + out_file_md5sum=3D$(md5sum $out_file | cut -f1 -d' ') + + if [ "$tmp_file_md5sum" =3D "$out_file_md5sum" ]; then + res=3D0 + else + echo "md5sum mismatch" + echo "input file md5sum: ${tmp_file_md5sum}"; + echo "output file md5sum: ${out_file_md5sum}"; + res=3D1 + fi + + rm $out_file $tmp_file + + return $res +} + +test_busypoll_with_suspend() +{ + # set the suspend parameter for the server via its IFIDX + + DUMP_CMD=3D"${YNL_PATH} --spec ${SPEC_PATH} --dump napi-get --json=3D\"{\= \\"ifindex\\\": ${NSIM_DEV_1_IFIDX}}\" --output-json" + NSIM_DEV_1_NAPIID=3D$(ip netns exec nssv bash -c "$DUMP_CMD") + NSIM_DEV_1_NAPIID=3D$(echo $NSIM_DEV_1_NAPIID | jq '.[] | .id') + + SUSPEND_CMD=3D"${YNL_PATH} --spec ${SPEC_PATH} --do napi-set --json=3D\"{= \\\"id\\\": ${NSIM_DEV_1_NAPIID}, \\\"irq-suspend-timeout\\\": 20000000, \\= \"gro-flush-timeout\\\": 50000, \\\"defer-hard-irqs\\\": 100}\"" + NSIM_DEV_1_SETCONFIG=3D$(ip netns exec nssv bash -c "$SUSPEND_CMD") + + test_busypoll + return $? +} + +### +### Code start +### + +check_ynl + +modprobe netdevsim + +# linking + +echo $NSIM_DEV_1_ID > $NSIM_DEV_SYS_NEW +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_NEW +udevadm settle + +setup_ns + +NSIM_DEV_1_FD=3D$((256 + RANDOM % 256)) +exec {NSIM_DEV_1_FD}= $NSIM_DEV_SYS_LINK +if [ $? -ne 0 ]; then + echo "linking netdevsim1 with netdevsim2 should succeed" + cleanup_ns + exit 1 +fi + +test_busypoll +if [ $? -ne 0 ]; then + echo "test_busypoll failed" + cleanup_ns + exit 1 +fi + +test_busypoll_with_suspend +if [ $? -ne 0 ]; then + echo "test_busypoll_with_suspend failed" + cleanup_ns + exit 1 +fi + +echo "$NSIM_DEV_1_FD:$NSIM_DEV_1_IFIDX" > $NSIM_DEV_SYS_UNLINK + +echo $NSIM_DEV_2_ID > $NSIM_DEV_SYS_DEL + +cleanup_ns + +modprobe -r netdevsim + +exit 0 diff --git a/tools/testing/selftests/net/busy_poller.c b/tools/testing/self= tests/net/busy_poller.c new file mode 100644 index 000000000000..b49d67ce0ca8 --- /dev/null +++ b/tools/testing/selftests/net/busy_poller.c @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +/* if the headers haven't been updated, we need to define some things */ +#if !defined(EPOLL_IOC_TYPE) +struct epoll_params { + uint32_t busy_poll_usecs; + uint16_t busy_poll_budget; + uint8_t prefer_busy_poll; + + /* pad the struct to a multiple of 64bits */ + uint8_t __pad; +}; + +#define EPOLL_IOC_TYPE 0x8A +#define EPIOCSPARAMS _IOW(EPOLL_IOC_TYPE, 0x01, struct epoll_params) +#define EPIOCGPARAMS _IOR(EPOLL_IOC_TYPE, 0x02, struct epoll_params) +#endif + +static uint32_t cfg_port =3D 8000; +static struct in_addr cfg_bind_addr =3D { .s_addr =3D INADDR_ANY }; +static char *cfg_outfile; +static int cfg_max_events =3D 8; + +/* busy poll params */ +static uint32_t cfg_busy_poll_usecs; +static uint16_t cfg_busy_poll_budget; +static uint8_t cfg_prefer_busy_poll; + +static void usage(const char *filepath) +{ + error(1, 0, + "Usage: %s -p -b -m -u -P<= prefer_busy_poll> -g -o", + filepath); +} + +static void parse_opts(int argc, char **argv) +{ + int ret; + int c; + + if (argc <=3D 1) + usage(argv[0]); + + while ((c =3D getopt(argc, argv, "p:m:b:u:P:g:o:")) !=3D -1) { + switch (c) { + case 'u': + cfg_busy_poll_usecs =3D strtoul(optarg, NULL, 0); + if (cfg_busy_poll_usecs =3D=3D ULONG_MAX || + cfg_busy_poll_usecs > UINT32_MAX) + error(1, ERANGE, "busy_poll_usecs too large"); + break; + case 'P': + cfg_prefer_busy_poll =3D strtoul(optarg, NULL, 0); + if (cfg_prefer_busy_poll =3D=3D ULONG_MAX || + cfg_prefer_busy_poll > 1) + error(1, ERANGE, + "prefer busy poll should be 0 or 1"); + break; + case 'g': + cfg_busy_poll_budget =3D strtoul(optarg, NULL, 0); + if (cfg_busy_poll_budget =3D=3D ULONG_MAX || + cfg_busy_poll_budget > UINT16_MAX) + error(1, ERANGE, + "busy poll budget must be [0, UINT16_MAX]"); + break; + case 'p': + cfg_port =3D strtoul(optarg, NULL, 0); + if (cfg_port > UINT16_MAX) + error(1, ERANGE, "port must be <=3D 65535"); + break; + case 'b': + ret =3D inet_aton(optarg, &cfg_bind_addr); + if (ret =3D=3D 0) + error(1, errno, + "bind address %s invalid", optarg); + break; + case 'o': + cfg_outfile =3D strdup(optarg); + if (!cfg_outfile) + error(1, 0, "outfile invalid"); + break; + case 'm': + cfg_max_events =3D strtol(optarg, NULL, 0); + + if (cfg_max_events =3D=3D LONG_MIN || + cfg_max_events =3D=3D LONG_MAX || + cfg_max_events <=3D 0) + error(1, ERANGE, + "max events must be > 0 and < LONG_MAX"); + break; + } + } + + if (optind !=3D argc) + usage(argv[0]); +} + +static void epoll_ctl_add(int epfd, int fd, uint32_t events) +{ + struct epoll_event ev; + + ev.events =3D events; + ev.data.fd =3D fd; + if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev) =3D=3D -1) + error(1, errno, "epoll_ctl add fd: %d", fd); +} + +static void setnonblock(int sockfd) +{ + int flags; + + flags =3D fcntl(sockfd, F_GETFL, 0); + + if (fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) =3D=3D -1) + error(1, errno, "unable to set socket to nonblocking mode"); +} + +static void write_chunk(int fd, char *buf, ssize_t buflen) +{ + ssize_t remaining =3D buflen; + char *buf_offset =3D buf; + ssize_t writelen =3D 0; + ssize_t write_result; + + while (writelen < buflen) { + write_result =3D write(fd, buf_offset, remaining); + if (write_result =3D=3D -1) + error(1, errno, "unable to write data to outfile"); + + writelen +=3D write_result; + remaining -=3D write_result; + buf_offset +=3D write_result; + } +} + +static void run_poller(void) +{ + struct epoll_event events[cfg_max_events]; + struct epoll_params epoll_params =3D {0}; + struct sockaddr_in server_addr; + int i, epfd, nfds; + ssize_t readlen; + int outfile_fd; + char buf[1024]; + int sockfd; + int conn; + int val; + + outfile_fd =3D open(cfg_outfile, O_WRONLY | O_CREAT, 0644); + if (outfile_fd =3D=3D -1) + error(1, errno, "unable to open outfile: %s", cfg_outfile); + + sockfd =3D socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (sockfd =3D=3D -1) + error(1, errno, "unable to create listen socket"); + + server_addr.sin_family =3D AF_INET; + server_addr.sin_port =3D htons(cfg_port); + server_addr.sin_addr =3D cfg_bind_addr; + + epoll_params.busy_poll_usecs =3D cfg_busy_poll_usecs; + epoll_params.busy_poll_budget =3D cfg_busy_poll_budget; + epoll_params.prefer_busy_poll =3D cfg_prefer_busy_poll; + epoll_params.__pad =3D 0; + + val =3D 1; + if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val))) + error(1, errno, "poller setsockopt reuseaddr"); + + setnonblock(sockfd); + + if (bind(sockfd, (struct sockaddr *)&server_addr, + sizeof(struct sockaddr_in))) + error(0, errno, "poller bind to port: %d\n", cfg_port); + + if (listen(sockfd, 1)) + error(1, errno, "poller listen"); + + epfd =3D epoll_create1(0); + if (ioctl(epfd, EPIOCSPARAMS, &epoll_params) =3D=3D -1) + error(1, errno, "unable to set busy poll params"); + + epoll_ctl_add(epfd, sockfd, EPOLLIN | EPOLLOUT | EPOLLET); + + for (;;) { + nfds =3D epoll_wait(epfd, events, cfg_max_events, -1); + for (i =3D 0; i < nfds; i++) { + if (events[i].data.fd =3D=3D sockfd) { + conn =3D accept(sockfd, NULL, NULL); + if (conn =3D=3D -1) + error(1, errno, + "accepting incoming connection failed"); + + setnonblock(conn); + epoll_ctl_add(epfd, conn, + EPOLLIN | EPOLLET | EPOLLRDHUP | + EPOLLHUP); + } else if (events[i].events & EPOLLIN) { + for (;;) { + readlen =3D read(events[i].data.fd, buf, + sizeof(buf)); + if (readlen > 0) + write_chunk(outfile_fd, buf, + readlen); + else + break; + } + } else { + /* spurious event ? */ + } + if (events[i].events & (EPOLLRDHUP | EPOLLHUP)) { + epoll_ctl(epfd, EPOLL_CTL_DEL, + events[i].data.fd, NULL); + close(events[i].data.fd); + close(outfile_fd); + return; + } + } + } +} + +int main(int argc, char *argv[]) +{ + parse_opts(argc, argv); + run_poller(); + return 0; +} --=20 2.25.1 From nobody Sun Nov 24 23:39:22 2024 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDE721369AE for ; Fri, 1 Nov 2024 00:49:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422175; cv=none; b=HFRa8JLusoHVebylJpJlr2Ph9PeEW0DrxcsK/TAPzOl16WiUSgyqq7iKfGsIp99qHpSf1jAubu3DM9jpS+raG1wzPLrUEqPnsbl20ADetxO+1dQ3tyYFlntThtB+dWJCm/QbvCDa69bluUjWj2TaReoiJH0e5kIV8Ml9m0Ca644= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730422175; c=relaxed/simple; bh=JIqIEaw/Xkb4IhEOecWCp/j56eekf1dIpHWraAxZfLU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rDZ9JCXG+IGxUyhejE1lP5Vi46XlMA3yt1vA5iQN6IK3R8hHF1CXm1FisZ3Rni8D1zMXKPNokUg8CvfOO5s2mOB6JFVbFwuWOQGsnhVji5OV2k+JXlWeZkSRIYhXDskE9JVNyq/JJW9Mo2kNYiKPOIwQgyEsfeyFlRkGS3QlOt4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=KUpcA0EH; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="KUpcA0EH" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71e52582cf8so1232448b3a.2 for ; Thu, 31 Oct 2024 17:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1730422167; x=1731026967; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eTHWnISoB9bhQ055WvkbHwZ+dmeJ9HCmVk36PR/yRAs=; b=KUpcA0EH5KESLUq6Zved1VHltKSZzJoyLEFDaCVF4wniN6HN69TRFBkuNgbsQ1vSue fRcijUitgqKc6Og5lz/+qNMfA9MlW39MrksklNL4/H+6cYPb+m5Me0sMGkrdEJRGFV1O BFe9GJWW6tvgGm9CkCqIiOz8RqxBm1F8XWDn0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730422167; x=1731026967; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eTHWnISoB9bhQ055WvkbHwZ+dmeJ9HCmVk36PR/yRAs=; b=E1M452a/54euICJ4pLhiZOPnkCfg6BgMtC/Xxas4AWZ6oex+93abZRTnGwnuuesO/w FPpCziUgAA2RD1QvBiAtbbgToNqmCCJQtwiCsTtGz6ThBa/3aUu/zU+lfGMp6sTTKY1h 97e8Z1jma1L4AZ3sMW4Xajbdn9KXXDBRHCzjlHZs0doPJAEjIYKrJq/vvldn5fSywuvC WoNdc1vreT/yVa0aCy0BvfIecs/PAAJsVPA2pUxH3v/uQLqj3w8wYDzY9bme7YaaNCn0 mEI2oxgCfkQxGJL/ywGjpGPApv6ayN7f3XtJQPgVCYqKbYoiVnMEmKHh0pfMvqYvyuL3 +vZQ== X-Forwarded-Encrypted: i=1; AJvYcCV3gyhqEIl+Bk7e3UL2kzFIfL0fq5FuTaIST8T6quQhUjR7v54+0oQLiSzE5AvSOEwPiyl5fPq+A1uvCAY=@vger.kernel.org X-Gm-Message-State: AOJu0YzYflZ5GXGn13TXgWfpkEPe64ixzwPBcgI/GgO8C6cLI22092vR BWthtQYl6ngHJ4f92m9B5/QtcI6bEL24BEZPMooSKJ0tyocGAjIyBrUIVgsFz1k= X-Google-Smtp-Source: AGHT+IEoY1KMHd8KZb8qMlUl9iT2A/57KkBUfF8xPOGHBaPR4o7uPXqExc76fhPtwVsPduFrWv4bRQ== X-Received: by 2002:a05:6a21:670f:b0:1d9:266e:8216 with SMTP id adf61e73a8af0-1dba53bf472mr1794797637.22.1730422166902; Thu, 31 Oct 2024 17:49:26 -0700 (PDT) Received: from localhost.localdomain ([2620:11a:c019:0:65e:3115:2f58:c5fd]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee45a12c27sm1585365a12.93.2024.10.31.17.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:49:26 -0700 (PDT) From: Joe Damato To: netdev@vger.kernel.org Cc: pabeni@redhat.com, namangulati@google.com, edumazet@google.com, amritha.nambiar@intel.com, sridhar.samudrala@intel.com, sdf@fomichev.me, peter@typeblog.net, m2shafiei@uwaterloo.ca, bjorn@rivosinc.com, hch@infradead.org, willy@infradead.org, willemdebruijn.kernel@gmail.com, skhawaja@google.com, kuba@kernel.org, Joe Damato , Martin Karsten , Bagas Sanjaya , "David S. Miller" , Simon Horman , Jonathan Corbet , linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list), bpf@vger.kernel.org (open list:BPF [MISC]:Keyword:(?:\b|_)bpf(?:\b|_)) Subject: [PATCH net-next v3 7/7] docs: networking: Describe irq suspension Date: Fri, 1 Nov 2024 00:48:34 +0000 Message-Id: <20241101004846.32532-8-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241101004846.32532-1-jdamato@fastly.com> References: <20241101004846.32532-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Describe irq suspension, the epoll ioctls, and the tradeoffs of using different gro_flush_timeout values. Signed-off-by: Joe Damato Co-developed-by: Martin Karsten Signed-off-by: Martin Karsten Acked-by: Stanislav Fomichev Reviewed-by: Bagas Sanjaya --- v1 -> v2: - Updated documentation to describe the per-NAPI configuration parameters. Documentation/networking/napi.rst | 132 +++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 2 deletions(-) diff --git a/Documentation/networking/napi.rst b/Documentation/networking/n= api.rst index dfa5d549be9c..3b43477a52ce 100644 --- a/Documentation/networking/napi.rst +++ b/Documentation/networking/napi.rst @@ -192,6 +192,28 @@ is reused to control the delay of the timer, while ``napi_defer_hard_irqs`` controls the number of consecutive empty polls before NAPI gives up and goes back to using hardware IRQs. =20 +The above parameters can also be set on a per-NAPI basis using netlink via +netdev-genl. This can be done programmatically in a user application or by +using a script included in the kernel source tree: ``tools/net/ynl/cli.py`= `. + +For example, using the script: + +.. code-block:: bash + + $ kernel-source/tools/net/ynl/cli.py \ + --spec Documentation/netlink/specs/netdev.yaml \ + --do napi-set \ + --json=3D'{"id": 345, + "defer-hard-irqs": 111, + "gro-flush-timeout": 11111}' + +Similarly, the parameter ``irq-suspend-timeout`` can be set using netlink +via netdev-genl. There is no global sysfs parameter for this value. + +``irq_suspend_timeout`` is used to determine how long an application can +completely suspend IRQs. It is used in combination with SO_PREFER_BUSY_POL= L, +which can be set on a per-epoll context basis with ``EPIOCSPARAMS`` ioctl. + .. _poll: =20 Busy polling @@ -207,6 +229,46 @@ selected sockets or using the global ``net.core.busy_p= oll`` and ``net.core.busy_read`` sysctls. An io_uring API for NAPI busy polling also exists. =20 +epoll-based busy polling +------------------------ + +It is possible to trigger packet processing directly from calls to +``epoll_wait``. In order to use this feature, a user application must ensu= re +all file descriptors which are added to an epoll context have the same NAP= I ID. + +If the application uses a dedicated acceptor thread, the application can o= btain +the NAPI ID of the incoming connection using SO_INCOMING_NAPI_ID and then +distribute that file descriptor to a worker thread. The worker thread woul= d add +the file descriptor to its epoll context. This would ensure each worker th= read +has an epoll context with FDs that have the same NAPI ID. + +Alternatively, if the application uses SO_REUSEPORT, a bpf or ebpf program= be +inserted to distribute incoming connections to threads such that each thre= ad is +only given incoming connections with the same NAPI ID. Care must be taken = to +carefully handle cases where a system may have multiple NICs. + +In order to enable busy polling, there are two choices: + +1. ``/proc/sys/net/core/busy_poll`` can be set with a time in useconds to = busy + loop waiting for events. This is a system-wide setting and will cause a= ll + epoll-based applications to busy poll when they call epoll_wait. This m= ay + not be desirable as many applications may not have the need to busy pol= l. + +2. Applications using recent kernels can issue an ioctl on the epoll conte= xt + file descriptor to set (``EPIOCSPARAMS``) or get (``EPIOCGPARAMS``) ``s= truct + epoll_params``:, which user programs can define as follows: + +.. code-block:: c + + struct epoll_params { + uint32_t busy_poll_usecs; + uint16_t busy_poll_budget; + uint8_t prefer_busy_poll; + + /* pad the struct to a multiple of 64bits */ + uint8_t __pad; + }; + IRQ mitigation --------------- =20 @@ -222,12 +284,78 @@ Such applications can pledge to the kernel that they = will perform a busy polling operation periodically, and the driver should keep the device IRQs permanently masked. This mode is enabled by using the ``SO_PREFER_BUSY_POL= L`` socket option. To avoid system misbehavior the pledge is revoked -if ``gro_flush_timeout`` passes without any busy poll call. +if ``gro_flush_timeout`` passes without any busy poll call. For epoll-based +busy polling applications, the ``prefer_busy_poll`` field of ``struct +epoll_params`` can be set to 1 and the ``EPIOCSPARAMS`` ioctl can be issue= d to +enable this mode. See the above section for more details. =20 The NAPI budget for busy polling is lower than the default (which makes sense given the low latency intention of normal busy polling). This is not the case with IRQ mitigation, however, so the budget can be adjusted -with the ``SO_BUSY_POLL_BUDGET`` socket option. +with the ``SO_BUSY_POLL_BUDGET`` socket option. For epoll-based busy polli= ng +applications, the ``busy_poll_budget`` field can be adjusted to the desire= d value +in ``struct epoll_params`` and set on a specific epoll context using the `= `EPIOCSPARAMS`` +ioctl. See the above section for more details. + +It is important to note that choosing a large value for ``gro_flush_timeou= t`` +will defer IRQs to allow for better batch processing, but will induce late= ncy +when the system is not fully loaded. Choosing a small value for +``gro_flush_timeout`` can cause interference of the user application which= is +attempting to busy poll by device IRQs and softirq processing. This value +should be chosen carefully with these tradeoffs in mind. epoll-based busy +polling applications may be able to mitigate how much user processing happ= ens +by choosing an appropriate value for ``maxevents``. + +Users may want to consider an alternate approach, IRQ suspension, to help = deal +with these tradeoffs. + +IRQ suspension +-------------- + +IRQ suspension is a mechanism wherein device IRQs are masked while epoll +triggers NAPI packet processing. + +While application calls to epoll_wait successfully retrieve events, the ke= rnel will +defer the IRQ suspension timer. If the kernel does not retrieve any events +while busy polling (for example, because network traffic levels subsided),= IRQ +suspension is disabled and the IRQ mitigation strategies described above a= re +engaged. + +This allows users to balance CPU consumption with network processing +efficiency. + +To use this mechanism: + + 1. The per-NAPI config parameter ``irq_suspend_timeout`` should be set t= o the + maximum time (in nanoseconds) the application can have its IRQs + suspended. This is done using netlink, as described above. This timeo= ut + serves as a safety mechanism to restart IRQ driver interrupt processi= ng if + the application has stalled. This value should be chosen so that it c= overs + the amount of time the user application needs to process data from its + call to epoll_wait, noting that applications can control how much data + they retrieve by setting ``max_events`` when calling epoll_wait. + + 2. The sysfs parameter or per-NAPI config parameters ``gro_flush_timeout= `` + and ``napi_defer_hard_irqs`` can be set to low values. They will be u= sed + to defer IRQs after busy poll has found no data. + + 3. The ``prefer_busy_poll`` flag must be set to true. This can be done u= sing + the ``EPIOCSPARAMS`` ioctl as described above. + + 4. The application uses epoll as described above to trigger NAPI packet + processing. + +As mentioned above, as long as subsequent calls to epoll_wait return event= s to +userland, the ``irq_suspend_timeout`` is deferred and IRQs are disabled. T= his +allows the application to process data without interference. + +Once a call to epoll_wait results in no events being found, IRQ suspension= is +automatically disabled and the ``gro_flush_timeout`` and +``napi_defer_hard_irqs`` mitigation mechanisms take over. + +It is expected that ``irq_suspend_timeout`` will be set to a value much la= rger +than ``gro_flush_timeout`` as ``irq_suspend_timeout`` should suspend IRQs = for +the duration of one userland processing cycle. =20 .. _threaded: =20 --=20 2.25.1