Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27826477rwd; Tue, 4 Jul 2023 08:21:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlGAUyhM1+stTkxhfUuV6zgatruCdCiKqBpvmBLXzN/VKT8WExVdx2vLh82i/xjCVsoNoIbN X-Received: by 2002:a17:902:dad1:b0:1b8:87dc:3371 with SMTP id q17-20020a170902dad100b001b887dc3371mr7368988plx.67.1688484106069; Tue, 04 Jul 2023 08:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688484106; cv=none; d=google.com; s=arc-20160816; b=XK3uslN5ZidQD5wnkczj+ovvPkz7z1ILM/DbqpiTCofVAS1TXpzUlV30mjRurXET8s bUNu8dGUbT1jht23PXLzmb0d6S4Izd3gp7jj+zHxzowvfcU4gLFc+eGBMWFQTYMqQX80 znhIqGXR6u0RW+wB83g8I+EjKuOROpxiMyeL3bpztjF8YQjrWxdxvcff+h4rMqOy3/vd tV0vbLeLSkYAnAZ0suBEcsRGoS6PlEScr8j2Mr4+dYboZAnUtHrXoAcOp73NxYmptdc3 vEeYRhTOZLYHqlGKnCrr9u065GjIrdPtvPuv0BeTaEz7NcM6FDbLGFeKIOIjglBPry01 IHtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=3Qmq4SKQQ7gKHnn/JkJpEXp7Z561AjgrQQ8nebwxnbE=; fh=Tuj3P1CJS7eLTguHs3eH63V+A720NM+8cF+8pNMkVxQ=; b=oIKCg4U6SaKZ5HiKxTziK0xw4FGu9w2Td4DQHuCaF0zsSvHK7LQwBalRBYsikdoIwm b2D42otItu1FpHhELq0s54dqZPj//BZs0jmYC2I11kHXKzi+odSRvCvJabt/UsAwAj14 6q9zRBJNPkvuJQc2eWC5JzgnAKtD0UorRuVjU4v6M6lmp3W03tCX1dMHp26avli0yNAW hUKJ7xlgACWi/vjTstzBG7KfmjHwFu9Fw8YBZG0zhmCmkQI/HXPbAwE7e0T9C6Rg63un DoTu0E+0ALLJW3mOy/Z9pXFxczkfyJVsurCSQBPEooru0+8z22QY5fe9l55kgxsWArLp tucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0gvl+bGO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9mNXV1XD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a170903018800b001b8971cb96asi4994444plg.601.2023.07.04.08.21.29; Tue, 04 Jul 2023 08:21:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0gvl+bGO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9mNXV1XD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231660AbjGDOsH (ORCPT + 99 others); Tue, 4 Jul 2023 10:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231639AbjGDOr4 (ORCPT ); Tue, 4 Jul 2023 10:47:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15E9D10CF; Tue, 4 Jul 2023 07:47:54 -0700 (PDT) Date: Tue, 4 Jul 2023 16:47:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1688482072; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Qmq4SKQQ7gKHnn/JkJpEXp7Z561AjgrQQ8nebwxnbE=; b=0gvl+bGOgGOiLURH54fDatcGdd8MjBgZfcnwAwVVkf4gA28kMPlkVBrHMQrLLpxDDB+UYi GNDhJsej80SMFtSO1xhs2KUl0aWkEtXlREvKJFEnNhO7O1K9dbnzTPEUgkqOv3yfjLCR1s XmIl1FdHF94pwmvJA1cCpoQRzAOayNYxOo9500ZDoZI/it6qT4QsHtUCZMXsiolTUDVxt2 jodh7JYw4ndQYh8znHGZxUTp2g4urPTMcoPfnIuOPVwrWqYcCPR5cYGPL/ZpH1xy1F63G9 K1qCqiJQYyzo/kTCQvGXl09aAYF4FUvBwXkGIm5tBqiHYf+Cs56oGFPcz4QyKw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1688482072; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Qmq4SKQQ7gKHnn/JkJpEXp7Z561AjgrQQ8nebwxnbE=; b=9mNXV1XDq2TewPCvWKvPq+HGiD4Uwo/9ihdfKiFM7wmzHiZR8QuJj3F5TBoh8n8HQFK8C/ +49i+Kxn/2aZ1hCQ== From: Sebastian Andrzej Siewior To: Paolo Abeni Cc: Wander Lairson Costa , linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, juri.lelli@redhat.com Subject: Re: Splat in kernel RT while processing incoming network packets Message-ID: <20230704144749.wJUlub6-@linutronix.de> References: <20230703142908.RcxjjF_E@linutronix.de> <20230704100527.75hMNZ35@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-07-04 12:29:33 [+0200], Paolo Abeni wrote: > Just to hopefully clarify the networking side of it, napi instances !=3D > network backlog (used by RPS). The network backlog (RPS) is available > for all the network devices, including the loopback and all the virtual > ones.=C2=A0 Yes. > The napi instances (and the threaded mode) are available only on > network device drivers implementing the napi model. The loopback driver > does not implement the napi model, as most virtual devices and even > some H/W NICs (mostily low end ones). Yes. > The network backlog can't run in threaded mode: there is no API/sysctl > nor infrastructure for that. The backlog processing threaded mode could > be implemented, even if should not be completely trivial and it sounds > a bit weird to me. Yes, I mean that this needs to be done. >=20 > Just for the records, I mentioned the following in the bz: >=20 > It looks like flush_smp_call_function_queue() has 2 only callers, > migration, and do_idle(). >=20 > What about moving softirq processing from > flush_smp_call_function_queue() into cpu_stopper_thread(), outside the > unpreemptable critical section? This doesn't solve anything. You schedule softirq from hardirq and from this moment on you are in "anonymous context" and we solve this by processing it in ksoftirqd. For !RT you process it while leaving the hardirq. For RT, we can't. Processing it in the context of the currently running process (say idle as in the reported backtrace or an another running user task) would lead to processing network related that originated somewhere at someone else's expense. Assume you have a high prio RT task running, not related to networking at all, and suddenly you throw a bunch of skbs on it. Therefore it is preferred to process them within the interrupt thread in which the softirq was raised/ within its origin. The other problem with ksoftirqd processing is that everything is added to a global state and then left for ksoftirqd to process. The global state is considered by every local_bh_enable() instance so random interrupt thread could process it or even a random task doing a syscall involving spin_lock_bh(). The NAPI-threads are nice in a way that they don't clobber the global state. For RPS we would need either per-CPU threads or serve this in ksoftirqd/X. The additional thread per-CPU makes only sense if it runs at higher priority. However without the priority it would be no different to ksoftirqd unless it does only the backlog's work. puh. I'm undecided here. We might want to throw it into ksoftirqd, remove the warning. But then this will be processed with other softirqs (like USB due to tasklet) and at some point and might be picked up by another interrupt thread. > Cheers, >=20 > Paolo Sebastian