Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2551990lqt; Mon, 22 Apr 2024 14:15:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUytLdeZ7h/+fu011Ul3GMUGIesldNpErb41sJkWsNHezC6qfNOfEEiuzCvt+RgOz8u20fcFyUoyGGhB3FH0+uWUmeqaJVYWr9l0Lna4Q== X-Google-Smtp-Source: AGHT+IETirsQPqVDsT8Fz9UNoyjpJRCVN2V7XdgdcnPY7weU9Ze56xKYoA5rts6nLqItx7cSxEG0 X-Received: by 2002:a05:6870:37d4:b0:22f:bdb:54d0 with SMTP id p20-20020a05687037d400b0022f0bdb54d0mr13249172oai.11.1713820542355; Mon, 22 Apr 2024 14:15:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713820542; cv=pass; d=google.com; s=arc-20160816; b=jUK7rdI4yJJ+MuXCS4qftIGJ5c7O7XfF1jKlOqBbe2k1QVNhW8FH9S1xXUudI7us9C tDYrV8Dx5bCS9WeUfKo1IOkMDqnY6EHG9FWRxsRCLiHPptox3igEuT4Y61TzIM7lDt/4 PcsLCl4U8kg3HaILOyO/FADgzbhVJYlkAvJjecmu2unIi0SWuSbQpxDxNDrYOs1CZK3i PjSvF8RkJpjKAcRyNXxVGo3/6B4vfq34w6nppuny01vCoUHqL+6WV1luE8W2gyyEDVEv b7d6FGG/XBOy6CeHxFZTAfbBHc22DTbVrH3r8Px+WD62oeBFK21bDXS1ZZUxoQHSIG2C MFUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=4/WzVm6vkdqQBH8TJFQlbBy0ETJLmjovhycHFl4LuAY=; fh=fpxcDWYMHa1gNankWbmewSVk9PxVFRGtAgHpdEFvIOc=; b=iE8Gt3SRyh/po0cO+jzdkxck5r1jUKBnWlQYlCJ2J8rjtOhWEar+urAXfZ+9hQ/Wem F6dk+NljUGCtLqM9KwpoMOLCk/HsTBteF7sor7cU0ROhtIYyS3vB24Iu8/A20scn5bZY ABSgT+oZQPHO9AzASLNPMEdiX2aMtd1AGYADwk1ZMSoSMvJODBnksoKRbCaswRyHCdSu jNeADwSMmtVzHy4Su4p/zoBDFB07o5Cj2SE/t78tbWFSVuxqd3zq+dGITmr2KLSZRvdP LrkuM38VgyjzWAeoG8kz6+vfmAUFqWgFqPXw+8SQ3EUss/qmCHfc7KE3J11he/OUrjFN Wf6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LI8OLR0g; 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-154033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f23-20020a05620a20d700b0078ee7907da6si11550174qka.342.2024.04.22.14.15.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 14:15:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154033-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=@linutronix.de header.s=2020 header.b=LI8OLR0g; 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-154033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154033-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E25D71C210C3 for ; Mon, 22 Apr 2024 21:15:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED45D1CA85; Mon, 22 Apr 2024 21:15:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LI8OLR0g"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LlsSVL43" 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 DBA631BC2A for ; Mon, 22 Apr 2024 21:15:33 +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=1713820535; cv=none; b=FjK3VwTodOGfYoDQrlLPBuwcjYd0ynbZeL64o8ZAtJHw+9tgvKlvw2j3IVOEnww9VGyiOgPWBh0c8czVshbpkmfTs4jvRpYk7oGzVu9k2z78gLjPH0vn8eeR0zTdgB6DDdEefd061Q1oza9ct3RjaLXuZt7ShPwWE4cHsvDAsCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713820535; c=relaxed/simple; bh=ZfD8GDUf+BpUFvHq2DztCjPOiFTDW6U9w5FFA/E+6+E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=G7v8yVyO/Orjkaqrzw7WC7Lb/ilLNVapx2SiWhahlK5ayeFcsNuRRl1UpCLBDBRfNoXgLTTruVqBkwWX36/m/VYdTbc5f87b6AOxwNQZvSI4sF63Hum20GiF9HjFoQB75R/KBB3/GSbGgCyyR8Jqy96ApcOiBAExpL4JlfELk0s= 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=LI8OLR0g; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LlsSVL43; 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 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713820532; 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=4/WzVm6vkdqQBH8TJFQlbBy0ETJLmjovhycHFl4LuAY=; b=LI8OLR0gs1l2T4gDe/DYYI3pSr+N4vVctjgC0n+OCz/erSdl8HRWRhLMAKnr224yPE2/XV 7FbfgEad9ioH6l7Hw7spra6a68iJQESQNB5u+o9OmLr3bk2DsQzhOhCSzASkaZNc5r0dZh HdJh1d5nUhUm49XQsAqpRYqVhFTj2/DSoGEpGFxjXbY6haBD5CPiR/0nwQcmJvX/6MM7od as0MyHu3KAwLDSQqNvL9fRrMkBGvLe9oDcXkK13hrqrtAu3scW74Akb+OsTACv4BzVPlTL wyKB0RJV5mxCpviTRCpYIJJ+yG/1J60ATHzCg21/yZGF7tFQOWelV4LIoJu0Kw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713820532; 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=4/WzVm6vkdqQBH8TJFQlbBy0ETJLmjovhycHFl4LuAY=; b=LlsSVL43dKz/SBoN993pJPhyetX2IbV/g9QQXgTf05GSu9Z9ywDtZWe66Stevl/nLreG3d djgBjYKXqPhVXyBQ== To: Z qiang , paulmck@kernel.org Cc: syzbot , linux-kernel@vger.kernel.org, peterz@infradead.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [kernel?] WARNING: suspicious RCU usage in __do_softirq In-Reply-To: References: <000000000000b24903061520f3e9@google.com> <8f281a10-b85a-4586-9586-5bbc12dc784f@paulmck-laptop> <4c09abb6-4f6e-42d7-9944-c5da995649cb@paulmck-laptop> Date: Mon, 22 Apr 2024 23:15:28 +0200 Message-ID: <87o7a1umj3.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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); ksoftirqd_run_end(); cond_resched(); return;