Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2669867lqt; Mon, 22 Apr 2024 19:21:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNHR7DF3cv01ijF3lXI0mVKqRyEClymhHdW96csIpbv/CNlE7pyeovbr0SRDGwco+xWJ8E5S7oGVylkNmHAy2XdNLVBgm5xetzrP4N/A== X-Google-Smtp-Source: AGHT+IFOT/JcFzPF36TRqoeTnhrsH0/PGeHg3jVmO78RaFT/FpL4gaLXXOVnLabAvIVHRSkf/5MA X-Received: by 2002:a05:6214:1544:b0:6a0:7e1c:b8f5 with SMTP id t4-20020a056214154400b006a07e1cb8f5mr5852867qvw.24.1713838879334; Mon, 22 Apr 2024 19:21:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713838879; cv=pass; d=google.com; s=arc-20160816; b=hkMG1DDrD28eB2z//Nw+/RC6EC1nkdFKL9upJMEo+kBeOwJS2ROX+TXUobkq7tzh7p FtmwbnheKiQFQHCl1fsHbqK1l+fovnkDSED3PvipZWOUC+MUz5ZmwH98JtJ1mKpuoZBx YHaUEy40dwk51K7o1s1XjRgtZAOGkgK0vnU0X/Mlh+hSKb/fun5Penq+jAbPIAY7Ac8w JJ8oU+ZwVfh3jj3AQdMPgA6W1Yvk3QCzF9c1pYO6KbI592tgGTrFxGQbWiEnzGZNPZWJ fNV8nlzjSMNS91JwxttFGw/xHqTOflnm3hZQAP397PsZUQ8/OWHbS71O8rQODRqUGRbC 5odQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=B7CVLFkG4LVPo9khN3K18ng6Nrhw4sSOvkWg8BF2MNI=; fh=Ji/7x6QHYTID22laOOHtLwz4ca8Gc1CTK2PEu2aLwpg=; b=p9pN+1NVk7KuLK5WFbUXZTeSpojNnSMloinIpP4ckss33KXxLNZMlapDYkMjY5tib0 W/lyVUqmGOIWm6T6iD95BBz7ehXg9tNzkT9nE94W03rCuAzX6z8FhA+zK49hIzjlkw4n C7RdbLWM+tUerTHRCswH3GyaLExzQigZomqVtq68N49IAp0ptoCKB163tvXixnPtOqg8 Yyr0xXHdG3vCNbudXybOeX1EqkSLmsoF8O6tkGljk/+hI/BVNUS91IPLyg4a3lvy8NKd kTpMbMdJKvAeE0puBxlJo4dO/gDvcIWhRGyLj++Yso1WwAXPNsNE8Q3En7z9EvW9H6jR lJ8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZbaOGWXc; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-154418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 1-20020a05621420e100b0069b4efe07e2si11762288qvk.406.2024.04.22.19.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 19:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZbaOGWXc; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-154418-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 13BC51C20E6C for ; Tue, 23 Apr 2024 02:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6009199B0; Tue, 23 Apr 2024 02:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZbaOGWXc" Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.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 BFC5218AEA for ; Tue, 23 Apr 2024 02:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713838863; cv=none; b=NgTg0QzNTbfrO/Yof0772Ii0aL8P3lspB1WMbKpVpZUol6tTQ2HZg9IMxFWmaKE3972Q/p5IABgYWbsV6Ivi+BSYJiTnrAVQc9iCmyS9aF2QGD5XqLspWUM7QKkfS1l0n8e7uS0VLbBVrPQwwmNEj6w5npL8BWrycJ5+v58dWdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713838863; c=relaxed/simple; bh=8Ibj4thCAh6i50cqtS856hkkUxnvWGF8MvlKu5e36XE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hjIaT2RVggvKOt0kJW/Qxha0f64pDUM22sAmip7AQdTVg6BP+pofqioVaSu3p/O4OlKT7M9hYUaglXvudfGJOhb/kVn4tkxsYOlYwgAd/sM+rkpZtqjpp1TsOszMigkD28eSRafv4jxPySOvERjeluqU7ws7m6d1JTUBIUN67WE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZbaOGWXc; arc=none smtp.client-ip=209.85.215.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5d8b519e438so4004860a12.1 for ; Mon, 22 Apr 2024 19:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713838861; x=1714443661; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=B7CVLFkG4LVPo9khN3K18ng6Nrhw4sSOvkWg8BF2MNI=; b=ZbaOGWXcaIpPlxj0wwW0R96jtUEUin6GO/nGtCllxZVMvnrkqQfHFETuaH1uEZryKj sU3VpbfcV4W9KSry3iW80ZlQ0VQaGea8S1GSDisl9gNBO8QMOATjN2r01NPHiH1ZAvjw JKxiVyy6OB67FBOQe0lod+vfChtv7AtoDf3c41dgatA8AGcdEC/s4UgFywAp7Nv0DW5R cp7y9/Ms2jlhsbPEugacyMeW8dpbJ5jjCI+l+4mN8zoLDrJ4Cn5mi2AP1ns9lgpy0B3Q tmQpqk4ed1pJxy9svUMQgMw6E1eNQyxavjr2DmCk4FI7dnpwKh7QvRoxCZMHSYm3TgSZ 9j/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713838861; x=1714443661; h=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=B7CVLFkG4LVPo9khN3K18ng6Nrhw4sSOvkWg8BF2MNI=; b=uLKn6U5VqvAbFv7X3CJP1cfnS1W1nrbbT+bL0miXd47i3289qg0VPUcUb1J14ZQrcU 94jXGZs6x40mClH/j/JHNzjVNl5YN0ZsIqnER12RUw7UQYSdYuB7zQCYvz92AfpZF7n/ hnnh8SRiKy9i3hwTbf+XIn3d1ZNg//6zU7fFkTZHUmvhL/OaN9QFUBZmhniZ2SR5w7jX 6xCXZbQe2agzM+02gymgM7GdjhjPTzP5IYPiCyax9CZir9gNKDHwngGwifQzo4aPVXRs Zf3OczAN+g8QFgdkoRgbxYvdRJxDFSkBpbHLHszsAFj3ZdOVyM5csEr3fyIDp8eNuj0O XZmw== X-Forwarded-Encrypted: i=1; AJvYcCVn3ZtY68HrmOfyytYVCQRQZQ6jAOuTeBVIehuBN9OmwfKXcJVbzAoMzUGpg1F7q4l87O+5E+JIBW+aue8Ba1hJ6Wej+IBymxQIiD3W X-Gm-Message-State: AOJu0YxT857rSyswvornhDEZFO+2VGhoc4ETpNEdsD87jAUBW0DdG0iD bXRJ5+BnBCq7xQj3+5uXyeq3Dga52ehJsxEnvKK1CbqNfOpZ7yOMmmDMV/RTExozuCOxla8Z2Gr 1aDGY0gjbBtxaM8wXhRhfIpavin4= X-Received: by 2002:a17:90a:f408:b0:2a2:775:9830 with SMTP id ch8-20020a17090af40800b002a207759830mr10656584pjb.11.1713838860940; Mon, 22 Apr 2024 19:21:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <000000000000b24903061520f3e9@google.com> <8f281a10-b85a-4586-9586-5bbc12dc784f@paulmck-laptop> <4c09abb6-4f6e-42d7-9944-c5da995649cb@paulmck-laptop> <87o7a1umj3.ffs@tglx> In-Reply-To: <87o7a1umj3.ffs@tglx> From: Z qiang Date: Tue, 23 Apr 2024 10:20:49 +0800 Message-ID: Subject: Re: [syzbot] [kernel?] WARNING: suspicious RCU usage in __do_softirq To: Thomas Gleixner Cc: paulmck@kernel.org, syzbot , linux-kernel@vger.kernel.org, peterz@infradead.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" > > On Fri, Apr 19 2024 at 13:50, Z qiang wrote: > >> On Thu, Apr 18, 2024 at 05:49:38PM +0800, Z qiang wrote: > > static __init int spawn_ksoftirqd(void) > > { > > + int cpu; > > + > > + for_each_possible_cpu(cpu) > > + per_cpu(ksoftirqd_work, cpu) = false; > > First of all that initialization is pointless, but why making all of > this complex as hell? > > Thanks, > > tglx > --- > diff --git a/kernel/softirq.c b/kernel/softirq.c > index b315b21fb28c..e991d735be0d 100644 > --- a/kernel/softirq.c > +++ b/kernel/softirq.c > @@ -508,7 +508,7 @@ static inline bool lockdep_softirq_start(void) { return false; } > static inline void lockdep_softirq_end(bool in_hardirq) { } > #endif > > -asmlinkage __visible void __softirq_entry __do_softirq(void) > +static void handle_softirqs(bool kirqd) > { > unsigned long end = jiffies + MAX_SOFTIRQ_TIME; > unsigned long old_flags = current->flags; > @@ -563,8 +563,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) > pending >>= softirq_bit; > } > > - if (!IS_ENABLED(CONFIG_PREEMPT_RT) && > - __this_cpu_read(ksoftirqd) == current) > + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && kirqd) > rcu_softirq_qs(); > > local_irq_disable(); > @@ -584,6 +583,11 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) > current_restore_flags(old_flags, PF_MEMALLOC); > } > > +asmlinkage __visible void __softirq_entry __do_softirq(void) > +{ > + handle_softirqs(false); > +} > + > /** > * irq_enter_rcu - Enter an interrupt context with RCU watching > */ > @@ -921,7 +925,7 @@ static void run_ksoftirqd(unsigned int cpu) > * We can safely run softirq on inline stack, as we are not deep > * in the task stack here. > */ > - __do_softirq(); > + handle_softirqs(true); Thanks, this is good for me :), Paul, what do you think? Thanks Zqiang > ksoftirqd_run_end(); > cond_resched(); > return;