Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp658849lqs; Fri, 14 Jun 2024 01:28:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4BkvKZjrqrNGYELWBpSdckCMxj05pt0n+Mq0FUiZjr1pyypZdoNa5baqpy8JkAcIZG8FeOSla988Ip629+i2mn8bEgiZd/IJ0lloWnQ== X-Google-Smtp-Source: AGHT+IHIafz8GYeI8XnjnvEDmiwvsnvBvsIoMTIjhUjnQHysUKpoHX+SADH2tqFz9YMo0jkQqNTJ X-Received: by 2002:a17:906:17d5:b0:a6f:3350:3533 with SMTP id a640c23a62f3a-a6f60d2963bmr125008266b.24.1718353701570; Fri, 14 Jun 2024 01:28:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718353701; cv=pass; d=google.com; s=arc-20160816; b=n0Wrv2ODznS0TwNG+N9lusdZAQGMNbz/3KXi8vCiSddoJkNwpvpOUnju9I6x7iP/pq MeGPL+levMMBIfBjG084nzJBn66V49ufCuqkhWCEyf0WWBdNjckfQq9U6t+XowadBUdG bvdz2ywshI6l3xBbMoCxfArvHQWW7juxgABHb8yjpERIsbtwQ8MaS6/XcpWn0UEKPFnT NPfDJzkXRHjc01BpOyg5hwDq7/j2JuiAVkUv909klkb9qKSeyqH45lBT4yGJQLh2TbqS mWzXYghZZaik1JF3UUcWYqBGp9fnS4LP2D2m7nFTeQvK2WaC+ImmNIRvUgBqnEtrRJc1 Z1pQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=L3nKvveBbIdAVcomoyZQI6KphWn4AlPcGB27/+M6BDk=; fh=l6Qx1s9OaL0PkJngnmF+Fr+SJh/pmq9yYIMO+6YyVoo=; b=hH6Nq0mCMSNiHD7IKSsDiJJgn1TiQ0krQAy4OfaEGE2x+DPACNic2M0UeAggq9yQO/ k5TuegpF27Jc2OorHGbeClhUykOaeJfkeX+olSHYiZboantOEoiKrBvdj3VpePeeCKYs hbrjcAEO/WkEGD0NIgaHDMtGFs+mCkR87ouiLhcyg9EGQlhcQm+9+ol7biczHpMVTEuH dUUACnDzKCHVqhFJaxcjY0dqJwPxtSNZSi3Knynxuc9FOIEpblj1GbRM67zsmeGeuiPJ PaYPv/Ya4CcvTRbdK16+qUBnSvUfjm+mWYC8tW42GyVuk4GEYyo3MkpHb/aOOwyMwNov Rbjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=maj2hoIn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-214550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56dd606fsi152336666b.415.2024.06.14.01.28.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 01:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214550-linux.lists.archive=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=@linutronix.de header.s=2020 header.b=maj2hoIn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-214550-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214550-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 49EAA1F22678 for ; Fri, 14 Jun 2024 08:28:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0647118F2FB; Fri, 14 Jun 2024 08:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="maj2hoIn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5hSzIfF4" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3AD0B1836DE; Fri, 14 Jun 2024 08:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718353692; cv=none; b=OejZWGD9DdEss+AXLITChL0GjZu900Lq1a6KqiWg7WIh4t7oCbHI41b6xG5UqOlAcONz+AHsQoBynOnRV58QdgMVXJqKtXQsOWHAkIxsNvnOBaE3tHpwIHqfAUmsIUVyFAKHPkZQxqnUCaYZllH3Y9o8w2JaaHxyxbt20Trocj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718353692; c=relaxed/simple; bh=5y3JIRl5B8fTjGFCjViDuLr0cHXTRA4yiKCDgSZN1NI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VTyGFXPQg+kROBoOQ1+udMpz2cwqlCUSa2JA+CByz4ipeAYfUQtE25VD0EZKb85VaiKJkFEij+6bHyvb9kD9I5uyGM38v2BIZf2pzJQO5/fg67NIrtkv6VdVUlYlHERg6+dmUfK0SLdY0PKCqPvwSBKlBqn21rTR86R6GjU/178= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=maj2hoIn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5hSzIfF4; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 14 Jun 2024 10:27:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718353680; 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: in-reply-to:in-reply-to:references:references; bh=L3nKvveBbIdAVcomoyZQI6KphWn4AlPcGB27/+M6BDk=; b=maj2hoIn4ulJag7Dw8dSiyVu8OHipxA/llSTfgfpS2gSsRxF2HK4wjf6a0dqFcF3DyyLdX t2XLX1MN9BGC+FtR6rbVv3aSwGFWGcIETjaAAFlT8dBVpuYBDZkfzcxeHZ3gvl7sgiqmim IIRoHPnnnyYMJFzrApetR2NjJEhoDQBgVFORMJBGK0IRJmGV6EHpvjAjvBojsrMOZxOGU/ GoXav+Jg828LyRBoPPNRFoPIOr8MESwr51QtLgR2TShBXdqFg6WPVCKGAOs2nC+1z/xREx 3mlRoddFN13R6OZqfBw700iBIqKDHoyHRtLhcPvO3tvfm1mLaLjgeLmT30qSqw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718353680; 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: in-reply-to:in-reply-to:references:references; bh=L3nKvveBbIdAVcomoyZQI6KphWn4AlPcGB27/+M6BDk=; b=5hSzIfF4aLTdTYxEaqozQd2jH7+jZXJQfrFiItzikUfs1NXoNEyRIcu4b3IfQdmAIDNa+M sSbDkT29lfPLuFDQ== From: Sebastian Andrzej Siewior To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Daniel Bristot de Oliveira , Boqun Feng , Daniel Borkmann , Eric Dumazet , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Juri Lelli , Mel Gorman , Valentin Schneider , Vincent Guittot Subject: Re: [PATCH v6 net-next 08/15] net: softnet_data: Make xmit.recursion per task. Message-ID: <20240614082758.6pSMV3aq@linutronix.de> References: <20240612170303.3896084-1-bigeasy@linutronix.de> <20240612170303.3896084-9-bigeasy@linutronix.de> <20240612131829.2e33ca71@rorschach.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240612131829.2e33ca71@rorschach.local.home> On 2024-06-12 13:18:29 [-0400], Steven Rostedt wrote: > On Wed, 12 Jun 2024 18:44:34 +0200 > Sebastian Andrzej Siewior wrote: > > > Softirq is preemptible on PREEMPT_RT. Without a per-CPU lock in > > local_bh_disable() there is no guarantee that only one device is > > transmitting at a time. > > With preemption and multiple senders it is possible that the per-CPU > > recursion counter gets incremented by different threads and exceeds > > XMIT_RECURSION_LIMIT leading to a false positive recursion alert. > > > > Instead of adding a lock to protect the per-CPU variable it is simpler > > to make the counter per-task. Sending and receiving skbs happens always > > in thread context anyway. > > > > Having a lock to protected the per-CPU counter would block/ serialize two > > sending threads needlessly. It would also require a recursive lock to > > ensure that the owner can increment the counter further. > > > > Make the recursion counter a task_struct member on PREEMPT_RT. > > I'm curious to what would be the harm to using a per_task counter > instead of per_cpu outside of PREEMPT_RT. That way, we wouldn't have to > have the #ifdef. There should be a hole on !RT, too so we shouldn't gain weight. The limit is set to 8 so an u8 would be enough. The counter is only accessed with BH-disabled so it will be used only in one context since it can't schedule(). I think it should work fine. netdev folks, you want me to remove that ifdef and use a per-Task counter unconditionally? > -- Steve Sebastian