Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3124244pxu; Mon, 19 Oct 2020 04:46:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaDemznk3rgTg3xgyBOfvyuAfFAuwHEVs6QL47FeYJAXT5tmY8GFY4tvoSP0yZDFQRiBRp X-Received: by 2002:a17:906:eb15:: with SMTP id mb21mr17377996ejb.318.1603107970454; Mon, 19 Oct 2020 04:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603107970; cv=none; d=google.com; s=arc-20160816; b=L+LWTp8MC+kdNPukfLE3pSHBkDdOyd3RNcOnZ9vipYUjJYZ563Z6z3iJNau8GW4xhc 8j6rEw7s5iMaTDX3ogJM7tnpcFLh+IjiN4feJQHxihu9mwT7cLHMchTtSaGIYCCLQTw3 ev+42E5ZDH6BVrYJtZ3KMhKhygAaFdnyKw2fgosOQMFCfodnIqsw2FYhvpZVuvsSi8gO nHqSdPLXID5HGYENZoABbJ8c6Tz0zdE1RacVzGpb7p+MaEQrHG5VTEThMBoAERTwXD5u 0TtpK7LhPUdAbpKlq68jz14u1wl3p5bhnXcIEPnt9+Y/Icz+XEMAhvqqAl+Z4X2gTcnC 1b2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=aKA2eYNo0tRyWFjey5VCWB5m13CWJjS0iw4yD8SF5eA=; b=iRgp4Fo+dCE7oS3Wn2fIsIthg84nIRr5LeqKDwbXOvBBFtjjvsbeFlO5Vi+BzAQFmT SeIeB1zDYP/FI0AuJBjuBvGOOLPoCGZ5LbFXMVZWTfCbJ3+kC2BsssT8iMLDF56g5gGw ZZxIu5To/6KFFeejFwhwFo8a2Nm55MqjgngWN/u6weJA2NTbtAoJh9cqMQr+ApzqeoBZ eUjkrFyZUF2m7oLVVQtK3n1eiqP/iPBS1806WNGU46Y9fZ3e2DYKJNlWWGPTIIRhDb7z ddPC4NKWogb+HqJM9OMQqEUxIemoCaVD9jrYnW79wkdLZDGlTsKpLPp/I+U1SpNbrJNG Ww5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CcX6tzEl; dkim=neutral (no key) header.i=@linutronix.de header.b="/GKktdww"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si8251383edj.504.2020.10.19.04.45.48; Mon, 19 Oct 2020 04:46:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=CcX6tzEl; dkim=neutral (no key) header.i=@linutronix.de header.b="/GKktdww"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbgJSKdP (ORCPT + 99 others); Mon, 19 Oct 2020 06:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbgJSKdO (ORCPT ); Mon, 19 Oct 2020 06:33:14 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9BFC0613CE; Mon, 19 Oct 2020 03:33:14 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603103593; 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=aKA2eYNo0tRyWFjey5VCWB5m13CWJjS0iw4yD8SF5eA=; b=CcX6tzElPYUO1nkyuBaVspg5k5BMlZFQwZ5U6J62eNeDgRzE43paXiUfw6tMROG+fSrvf6 igYtCsmr+HeLVWDguz3XoGUG7A5EBYAgEwvCGzn+JjhxQ2gQJO5RoF/8R0lO2KagpqSyLP 8MbfMZ2EeQPNs4HU30xnP46OE/mnkj2lI+2Uw4bMFQB7nnySRG3p0fAnbNHS7WuM3zEgBt Z1FDIPlDpnUhRlC3Tr4aXoRWKNboLi5SyBUemkQOseNGrFJMPgBQP6bo141QoWrk1+ZAoj o5LiWhELHrjAPkYwcYWv7NYbCK2qyvVQxBggLVOE4d1ZBEC7p1NyWlaXci8pYw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603103593; 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=aKA2eYNo0tRyWFjey5VCWB5m13CWJjS0iw4yD8SF5eA=; b=/GKktdwwjmHvEG5j+CWj85M5AdiombMk4VRDFF3rcm886EWbj5sYrcLuRner9OKKdfEiLc 66LXrH04JdYYo3Ag== To: Jakub Kicinski , Heiner Kallweit Cc: Eric Dumazet , Eric Dumazet , David Miller , "netdev\@vger.kernel.org" , LKML Subject: Re: Remove __napi_schedule_irqoff? In-Reply-To: <20201018101947.419802df@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <01af7f4f-bd05-b93e-57ad-c2e9b8726e90@gmail.com> <20201017162949.0a6dd37a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <668a1291-e7f0-ef71-c921-e173d4767a14@gmail.com> <20201018101947.419802df@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Date: Mon, 19 Oct 2020 12:33:12 +0200 Message-ID: <87ft6aa4k7.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 18 2020 at 10:19, Jakub Kicinski wrote: > On Sun, 18 Oct 2020 10:20:41 +0200 Heiner Kallweit wrote: >> >> Otherwise a non-solution could be to make IRQ_FORCED_THREADING >> >> configurable. >> > >> > I have to say I do not understand why we want to defer to a thread the >> > hard IRQ that we use in NAPI model. >> > >> Seems like the current forced threading comes with the big hammer and >> thread-ifies all hard irq's. To avoid this all NAPI network drivers >> would have to request the interrupt with IRQF_NO_THREAD. In a !RT kernel, forced threading (via commandline option) is mostly a debug aid. It's pretty useful when something crashes in hard interrupt context which usually takes the whole machine down. It's rather unlikely to be used on production systems, and if so then the admin surely should know what he's doing. > Right, it'd work for some drivers. Other drivers try to take spin locks > in their IRQ handlers. I checked a few which do and some of these spinlocks just protect register access and are not used for more complex serialization. So these could be converted to raw spinlocks because their scope is short and limited. But yes, you are right that this might be an issue in general. > What gave me a pause was that we have a busy loop in napi_schedule_prep: > > bool napi_schedule_prep(struct napi_struct *n) > { > unsigned long val, new; > > do { > val = READ_ONCE(n->state); > if (unlikely(val & NAPIF_STATE_DISABLE)) > return false; > new = val | NAPIF_STATE_SCHED; > > /* Sets STATE_MISSED bit if STATE_SCHED was already set > * This was suggested by Alexander Duyck, as compiler > * emits better code than : > * if (val & NAPIF_STATE_SCHED) > * new |= NAPIF_STATE_MISSED; > */ > new |= (val & NAPIF_STATE_SCHED) / NAPIF_STATE_SCHED * > NAPIF_STATE_MISSED; > } while (cmpxchg(&n->state, val, new) != val); > > return !(val & NAPIF_STATE_SCHED); > } > > > Dunno how acceptable this is to run in an IRQ handler on RT.. In theory it's bad, but I don't think it's a big deal in reality. Thanks, tglx