Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp668450rdh; Wed, 14 Feb 2024 08:04:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWCZmz5oLClG55MWPN1XKA/ycJoo0FpuErrC1EDyxLFiSfcfZeb+kPI3jxzsEIapLavmhzsQ4UOmBjZ/FJD5W/QLt9zKjdKFxYsvsozPw== X-Google-Smtp-Source: AGHT+IHxXGB2zEcy9wTOTBfMJoqfuLU0mxgnucgironuxauFwIwf9vnYfII2S00BSmcjgOWS4xVg X-Received: by 2002:a17:90a:bc81:b0:298:a701:aacc with SMTP id x1-20020a17090abc8100b00298a701aaccmr2294492pjr.47.1707926673475; Wed, 14 Feb 2024 08:04:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707926673; cv=pass; d=google.com; s=arc-20160816; b=jY7ixBkahu7Eux749K3w6PTJ5bP6JaUtiExbmKw57wlRMuxTqHMJib7v4G+C8WauwN qwL2vVfw1O6jLalp06EZ8Q0XTG/fGXf93QB0y5lzRZeDtNbFwv/0Qxzc86TqDP7DDrS6 QBbKnHhxoOMHp4S2/9Tq8j33i0m2cZ8dr3ecxku+mx2JTEVoTvlCToyzw9dQsu2kIOUC 6hMai7H36IYZEUxAJRt+r5t2ZyXIHS/hqR41uYHIc1ltD0AgcmHaj6/I35Rqb1wTF3wl sQ7izLGRWZYtMueso75A+4k4DoSOg18+qGMYhdPs5tr6i2r6xoYoK5RPoYZbLqPS2jwh OO2A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=lO0kPo0wQG6yAYplBE7Kc5TleYz6hCDgP3CJnwE4tbo=; fh=E9hObRudT4kWriE5OB1tL3rHpeHBouI++dbLBMwTC5Q=; b=SW6iS5ku2jRAb/ktoEfR23v5+BEykWIdN53Zcs1htTBKGkVLTjhtwYcRsayD1p6ktJ TFAVN+8DUsgsHDL8dXszs0apfdP5tnwMYVc62E6jlTDOAhpRyMWySkKz/O6dM9skRNp2 jleoqWtmkUcUExOWlrDKeCdDl9G8nNtpT5v/DeQnZyRkwguXujZDZ0eKYDuzzkxpVRWd JC4lUW+DXeywOt3mP6ifd6cDa7d0C9lzZ3QUuIa1TtP6czFtay/vSWPcM5xSi8qdEW0i xfI9FFtaaDe2J9BNZlRUth1JqZDj1AvKJOMGjXVgHgYVcG8vFtlo2QmNzeZQNEHEuD6O a1Ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dCRZfiQy; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-65441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCW6KcpJT1r4Q+Pza52vH48fPlDuq8I5lxOODcFF6mLqS6GP/96QQTf84a99k7RgKYlK7psmADz6VT3JaR4AP0rk2jfewyQiwZG1w9sPMg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l193-20020a6391ca000000b005d64d951c89si4005263pge.143.2024.02.14.08.04.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 08:04:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dCRZfiQy; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-65441-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 19AD2B2A27F for ; Wed, 14 Feb 2024 15:42:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 621D65D8E7; Wed, 14 Feb 2024 15:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dCRZfiQy" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 C66D05D49E for ; Wed, 14 Feb 2024 15:41:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707925314; cv=none; b=eLAnhuL1KhYiKxKMoM38iqA2CInG38eka35SvKY68U+YCaEzdnYgOyLKVAulBYuSU4sWwylMGPZrTVvzaLXiDRUE6occRIqz606DI90lcCNfNSMsdNk7Resjw7Qifx5VVAFK0s7b8olfcyh5HHBQBWJjqu96wGAMvyFPWM4MUNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707925314; c=relaxed/simple; bh=EIEkv/XLD+cnUEMJDO7B1AIZaiYtCJIbv4xIqENV9i4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=M8/z9hyAk6CRy5yHwkSH8Lh1jeSZCB1bGcbQHs50VTQkGVcQBnMz6vHVPKk9/MxC0WO4l2qf79025N6HRDkinft/QxpCo4lR4mv7rXBdH39CuW0Cp97wb3MjRsb7cOURfCpUtO/fg6XyyjPUI3fjOzkN+EUtBs0kzfPq78BL91o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dCRZfiQy; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-56101dee221so24704a12.1 for ; Wed, 14 Feb 2024 07:41:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707925311; x=1708530111; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lO0kPo0wQG6yAYplBE7Kc5TleYz6hCDgP3CJnwE4tbo=; b=dCRZfiQyLanCe1ui5uNglIotP3qd0Ux9/M985+bZHcx00GD2dqjIWxQf9l9NKFndit RKogoqUmSQEB2s55ko3LPuQUVX0nXowma194yK4ZnciuNi0QOIOGM52ysX0PzyMmuFoO uN0ywAcuIgW1t3IL4W6tH15gQc2rMSkqnpnyGPQ14ICcZRtK2idQafa3toivZX4ca64s nI4/2Mx9KBBGo0LpZNMbw6HiSWp6d+GoKRVyFETBmpD+N17Zp/W3Ddytabb26VQdmoa3 BPw8rbWzcS0GmsEgWMTogxE+k43i3Z7ccgRNXPr+91P0H99B37paFQx2t6TTElioaseY 5Chg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707925311; x=1708530111; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lO0kPo0wQG6yAYplBE7Kc5TleYz6hCDgP3CJnwE4tbo=; b=wr8YlVl5Gq14dSnaywcxPdWct6tOU4zq4u2KY7mDBUu9XIvUqeegP16v+0My6utNfl jElcEB/T6HkoSKdsogAONbIXs3F080rXtu1TwkxVMnvL5e8hoJ9nxSb107vDofQgeoXW DTTNKy+o9ew71o5sSWJo7LmUq9PIzryS2Cjudk7B6tXp8vBmCq/rd8EEqi9ZpKKMVEyG r+ZmYNTYYpLi+gf+D9j2jT4q9Zp1aMNtt+EpJUokDQqhFLHnYNq1c0mulL24Ulq4gw7/ trakwAJgK95fkdYHoDvUXC8CFBrBlFDxk3WVOAkiWTZ5gMYDc0eG8dYe4cjXXEZxcF1O BAOg== X-Forwarded-Encrypted: i=1; AJvYcCXmHsH9VZ5LI5QkoIx2mYRSrP5fQZSYlaO+o9DPZzA0yc0N2D3OkBfzbG7i+MtsGwvCnxHZx59RBus6d3/Ui4U8zvhuy2wLlSipfjyw X-Gm-Message-State: AOJu0Yw+GOP/q/uhVt+sJCMkVp/NhCsElIx/3UoXjcq7d8mNAMig0pZ3 1LC8yYDFztVUcOwRdp7gbyqdlPMgoRLoSDecQawuQuaM7IPUe09OntWspv/T+0XvxgwDu0w5opS VzSxYVebDB0YOXAlTnUo77m5QiFkErsu9uuz8 X-Received: by 2002:a50:99d2:0:b0:563:847d:2e02 with SMTP id n18-20020a5099d2000000b00563847d2e02mr111874edb.2.1707925310648; Wed, 14 Feb 2024 07:41:50 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240202165315.2506384-1-leitao@debian.org> <20240213100457.6648a8e0@kernel.org> In-Reply-To: From: Eric Dumazet Date: Wed, 14 Feb 2024 16:41:36 +0100 Message-ID: Subject: Re: [PATCH net-next v3] net: dqs: add NIC stall detector based on BQL To: Breno Leitao Cc: Jakub Kicinski , davem@davemloft.net, pabeni@redhat.com, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Andrew Morton , weiwan@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, horms@kernel.org, Jonathan Corbet , Randy Dunlap , Bjorn Helgaas , Johannes Berg , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , "open list:TRACING" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 3:45=E2=80=AFPM Breno Leitao wr= ote: > > On Tue, Feb 13, 2024 at 10:04:57AM -0800, Jakub Kicinski wrote: > > On Tue, 13 Feb 2024 14:57:49 +0100 Eric Dumazet wrote: > > > Please note that adding other sysfs entries is expensive for workload= s > > > creating/deleting netdev and netns often. > > > > > > I _think_ we should find a way for not creating > > > /sys/class/net//queues/tx-{Q}/byte_queue_limits directory > > > and files > > > for non BQL enabled devices (like loopback !) > > > > We should try, see if anyone screams. We could use IFF_NO_QUEUE, and > > NETIF_F_LLTX as a proxy for "device doesn't have a real queue so BQL > > would be pointless"? Obviously better to annotate the drivers which > > do have BQL support, but there's >50 of them on a quick count.. > > Let me make sure I understand the suggestion above. We want to disable > BQL completely for devices that has dev->features & NETIF_F_LLTX or > dev->priv_flags & IFF_NO_QUEUE, right? > > Maybe we can add a ->enabled field in struct dql, and set it according > to the features above. Then we can created the sysfs and process the dql > operations based on that field. This should avoid some unnecessary calls > also, if we are not display sysfs. > > Here is a very simple PoC to represent what I had in mind. Am I in the > right direction? No, this was really about sysfs entries (aka dql_group) Partial patch would be: diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index a09d507c5b03d24a829bf7af0b7cf1e6a0bdb65a..094e3b2d78cca40d810b2fa3bd4= 393d22b30e6ad 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1709,9 +1709,11 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index) goto err; #ifdef CONFIG_BQL - error =3D sysfs_create_group(kobj, &dql_group); - if (error) - goto err; + if (netdev_uses_bql(dev)) { + error =3D sysfs_create_group(kobj, &dql_group); + if (error) + goto err; + } #endif kobject_uevent(kobj, KOBJ_ADD); @@ -1734,7 +1736,8 @@ static int tx_queue_change_owner(struct net_device *ndev, int index, return error; #ifdef CONFIG_BQL - error =3D sysfs_group_change_owner(kobj, &dql_group, kuid, kgid); + if (netdev_uses_bql(ndev)) + error =3D sysfs_group_change_owner(kobj, &dql_group, kuid, = kgid); #endif return error; } @@ -1768,7 +1771,8 @@ netdev_queue_update_kobjects(struct net_device *dev, int old_num, int new_num) if (!refcount_read(&dev_net(dev)->ns.count)) queue->kobj.uevent_suppress =3D 1; #ifdef CONFIG_BQL - sysfs_remove_group(&queue->kobj, &dql_group); + if (netdev_uses_bql(dev)) + sysfs_remove_group(&queue->kobj, &dql_group); #endif kobject_put(&queue->kobj); }