Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp2489lqf; Thu, 25 Apr 2024 19:10:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzhbdsFl9vqnxP7WVLoVTGjNN2O3ZnselTkETgWaqCDPSHhYxwVq06xkaznP1KXhi8Q+/TPbJdLumHidJogSfWqHiPLGFe1bKbCR6ryg== X-Google-Smtp-Source: AGHT+IEfn9skjaRJVv85drBrI9k1GN0YAJLCVAuWolYGmlhL7xDklhPIaQotxFmlp8I0Bp6W7kRd X-Received: by 2002:a05:6a20:2594:b0:1a7:5100:7559 with SMTP id k20-20020a056a20259400b001a751007559mr1965038pzd.32.1714097400522; Thu, 25 Apr 2024 19:10:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714097400; cv=pass; d=google.com; s=arc-20160816; b=dejhXPNYYuU28INmzre0upJla92m6QTXsMgxjJUg0k04nxBpwUZN7GRNIbZkE3we6M EwYwhHeO7ZTi/vmCY2JOlZXJ5Ln+rBIxrbj0GbyYkK7lTjpaRy37hcHoue9czqpt19Cr F+D1dlUVs+fwOJAldp57oPbLLcDFHAyEW5oTnab8iNWq0tQC0Tj420QTocm3gC+nIfHJ 93lq995vnOeQT11wFQZqyJPQxtADFV2PDEU3hUN+y1ku0zfKUuDxKw+JW225srZTSCiC Rf5zQM/GXOmGlLRVf1AKqRZ+djNbu0HfwrY9n3auWLeTcbZRRgYhxqwio8mXtyHpP8ST 7izw== 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=CMCsFUqUgYms1WmtM5Vc8C2+q3f5Kprb1BLjL9ZLzIY=; fh=RyMNcPVnU4INTeKOn580PKf+YGdfbXxJCqcLTaRuF/g=; b=GAfvvyd7bMI0gFEJ/dzCstdiG45WR0elL9Zm2Xa6uCJIA3gvd9YfamYJ1nx07zpzNb nbtGJrZLoFbTyLf8Wow5CY9RsPfxWeaahfFjgAa6JFYjk+x63hOWhhoCoI8YT/XvFSI5 MLO8f11EBib4qZtpSJWByNRwQEWDHjEKqDDyOLFEn0+42JkHr15F49vKUwFjElE7MIkp EFc8sT7LU4imj7P50yYBE8wSCUiZOrJumlZDB4J1a2NjZYSjD3T07wl0f2qjUCU/u/bb N8kineJyyv0WvVNPozlKNvZ+6J31vU9GzW6KAzdaeFLszdyIkia/7VmXXZ8Hhewvvjb2 DiBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YLSLEG++; 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-159432-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159432-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d17-20020a170903209100b001e528f373edsi13708144plc.602.2024.04.25.19.10.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 19:10:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159432-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YLSLEG++; 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-159432-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159432-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1F87E284DC1 for ; Fri, 26 Apr 2024 02:10:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46EC9187F; Fri, 26 Apr 2024 02:09:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YLSLEG++" Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 222EC1849 for ; Fri, 26 Apr 2024 02:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714097393; cv=none; b=k13Fm5DcJ9pyy0UzEg9sjBeTODku26QILYJmGGfJ3fzshf6J9s921rjU262XO9MIVDW2c1qMe1XI2giZlGEvc61lRZeu2cK3CiUicixH4rSzReJ6bXrFuE0lKW/ksYMpfSL+6IVNRCfXeUx+dIhKScFZotG9VCleIaESFMb9v0U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714097393; c=relaxed/simple; bh=CJQPDJjLXFcAcTD6jR0pZXL7qJ7UBG26LY2nhUlRLz4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=n6LO0yFznV3WMpDSLJyc9Wud9F6zwTSIV7vRA4poak2Q89/o3IZgfbQTuRBlOCkeMwJcUcpYds0dESjZ5IrQFO0bWPdlWAiKC+yhDUCbqXm6sL15unQjY4dxDMv08kcXvnevAnt3oEVFGrx9ZDPvgv54mikauiIUDxTlINeyMXI= 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=YLSLEG++; arc=none smtp.client-ip=209.85.215.177 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-f177.google.com with SMTP id 41be03b00d2f7-5d8b887bb0cso1389442a12.2 for ; Thu, 25 Apr 2024 19:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714097391; x=1714702191; 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=CMCsFUqUgYms1WmtM5Vc8C2+q3f5Kprb1BLjL9ZLzIY=; b=YLSLEG++Xzi4AhcACEWm646LSWbaJmq0uZaUHwwUc5A2Mlqo5Kjqmv91kfHpyacZ9V tAZ201vJXESMkg7g0IrXEfL2HybOjngmhrmqCLAgC8ycVZCU2DV3Iir/RNNwE5h5C2fN 3FiP1SAlqatULSGe6T+wuKl40tDXKaeHyGW7PUSdc2q5wo9khYz17FCdQgHunaFXXKHE S9r/0nFV2U9/MJauasc/mMrQrQIEGqQpYXIYvga+HT+divm9kvaxNHC1z1QXwui3pQNQ mo+R3/Xko8cky1YHgyM8OJVFrtoHU2Qf47Lmrl8izgN0X73b7VemXzln/nj6uc3yq9/2 X6Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714097391; x=1714702191; 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=CMCsFUqUgYms1WmtM5Vc8C2+q3f5Kprb1BLjL9ZLzIY=; b=uxvEH05zJEME/CfGYZJ0rjG3R+bwJj1QtSv7ETAxW1Ib/gMxfHuVGAIwaxYksYwVrw stjABoeIDqPCz84d7+MrDTabA7y/BxLNR8EcHOqAOn4ZnQqtghg9ApRgVEcp5/vZH67k fo2+geuyGuloKD/JGnMxnMAur7Ax6uM3gaaobaEktoUZmk4cKtTCWtt4hNhbGm/2QRlB AUu4BEvmbDPqzLmkuKBB2OdGzhd8P9zfePNSpd0br7Xt9nJHhNw69J7a3Yt6rPKvvhde Mo2wZFq4DRcOLTBqJ6zE1nd4sLxVDOzdrXSKFHw0l7AI41robBA5vF9xwI4HHZHr+y15 KicA== X-Forwarded-Encrypted: i=1; AJvYcCW+TYaEcSuHTH6LUgjrMi7VeO4DnUm2nWQY3KDWnllsQp5SYDbOs42y5Crq8FsSofA4m/MODkcXuuQbC1oA2UBQWtzHq6K6pjhC+K6u X-Gm-Message-State: AOJu0YztVq1Wrih8cqcnIBKPQf0LPwsVi/4d7ZSyP3Dow+vzzhit3qFu Cxn8jbM+OwzpINmUIhrhqgsic+yQQW22n5pQlgCxtKdXQSUWIaVdlAaGEAstSg/lAHxB+ZsVVrv cjy81rBUdTX+nemtqsCWCIwMjpDQ= X-Received: by 2002:a05:6a21:3d94:b0:1a7:5fbf:3774 with SMTP id bj20-20020a056a213d9400b001a75fbf3774mr1928166pzc.55.1714097391310; Thu, 25 Apr 2024 19:09:51 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <8f281a10-b85a-4586-9586-5bbc12dc784f@paulmck-laptop> <4c09abb6-4f6e-42d7-9944-c5da995649cb@paulmck-laptop> <87o7a1umj3.ffs@tglx> In-Reply-To: From: Z qiang Date: Fri, 26 Apr 2024 10:09:39 +0800 Message-ID: Subject: Re: [syzbot] [kernel?] WARNING: suspicious RCU usage in __do_softirq To: paulmck@kernel.org Cc: Thomas Gleixner , syzbot , linux-kernel@vger.kernel.org, peterz@infradead.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" > > On Tue, Apr 23, 2024 at 10:20:49AM +0800, Z qiang wrote: > > > > > > 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? > > This looks quite nice to me, especially given that it avoids changing > all the other calls to __do_softirq(). Some architectures might want > to directly call handle_softirqs(), but if so, they can send the patches. Hello, Thomas Can you send an official patch? or I will send and add you to Co-developed-by tags. Thanks Zqiang > > Thanx, Paul > > > Thanks > > Zqiang > > > > > ksoftirqd_run_end(); > > > cond_resched(); > > > return;