Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2177141iof; Tue, 7 Jun 2022 22:16:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyUG6jRJy7GUNguWM6nIRKK2hoMzNqORfZCP4nMo1iQL/nWA820Lo5TfT6Gv2OnbNfUTlI X-Received: by 2002:a63:2cd0:0:b0:3fe:2810:ba99 with SMTP id s199-20020a632cd0000000b003fe2810ba99mr2323419pgs.27.1654665393162; Tue, 07 Jun 2022 22:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665393; cv=none; d=google.com; s=arc-20160816; b=flyr07kkvmT8BIcmwZReNukOvqB6jSQGCEFyzyHdjafc2oDcxmmvASSpZpQUanKVmL W4n+cStgriTuGfb85Z3CWgfjt0fITTC7biJ8a/GD2xiq+BLAo+Ksy6txu6+qA+RUCVg3 hBMWusIixBT6AKgbmJB59q830UjtB888hRMqU4tgttKnU8fdSZ0M3OTONALpnECbax7w PviLT1ZWTaxs0Ad0vPgv8OMl394c8QHTV4GEoiiSlk0y05wSZL1kFzgtaFs++Rk81xnj ghcUcRzxJdzgX9ffRncA6Yxiihx1JqUl6heV7DBEDvC8PahiNIv2s/zTEtu4N5vjluQB Je3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GhUgRmHz8pa8JenexpmSV/bXp46aVN36Egmv7dF+G4Y=; b=mWJ4sdfHZ+UhqRTI4NlBapmpwd8lbaoS20OQJUXH3e/zFt96Bkq5ExrsK8OxG6nJUy EmhUKlklPFjPm8pZ8w8tFI/JDcNLfWi7HwHIGf1sFbv4xXVymq++2lFVf/RVoepaYft6 NSgpmxFJvh5CSQPUB3/xchwSfRFLFwP5ziHHlVNZgvUNZiT/GGRphjWGbVqD9YmhkVUS pEWe02bfH4N3pjEXAsDxiP/zvw/bTAJeC5/OYdb8GQKVDCMk5XIhMvinuvZTTLJAnFkl b5a7qA61vv/9QVr8BTCgI8qP2n3XtMSFDrgkwoAxRkzay3m9jIb38VRzM87poFAIHL2c tCRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GOeJwOT1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t70-20020a638149000000b003f63e139713si28449612pgd.780.2022.06.07.22.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:16:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GOeJwOT1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 040FD1BBACB; Tue, 7 Jun 2022 21:57:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359824AbiFGUZq (ORCPT + 99 others); Tue, 7 Jun 2022 16:25:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355923AbiFGTe0 (ORCPT ); Tue, 7 Jun 2022 15:34:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2A41AA17E; Tue, 7 Jun 2022 11:13:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 06CF060B3B; Tue, 7 Jun 2022 18:13:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EF5FC385A2; Tue, 7 Jun 2022 18:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654625585; bh=j8edraf78Gz65VYZ9nUIUzDh7hJEDVGQ5Xh3R5WcUCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GOeJwOT1WeEJ1syymSdTgEVvRZdkYhDYQiMiYB8b8b/QwoXF9Px3VnT6ZWEDKYYR8 bu7KIlABArThNrz5dCQfa9S2Iv0SehQ1rWfej9gNLDR2zixcNzGK99RJAqp+pp5P+H Rk94vwo5HspzqJ8yiGtLFNaqjg7OAhIE4Gk/knTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.17 070/772] rcu-tasks: Handle sparse cpu_possible_mask in rcu_tasks_invoke_cbs() Date: Tue, 7 Jun 2022 18:54:22 +0200 Message-Id: <20220607164951.103939864@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Paul E. McKenney [ Upstream commit ab2756ea6b74987849b44ad0e33c3cfec159033b ] If the cpu_possible_mask is sparse (for example, if bits are set only for CPUs 0, 4, 8, ...), then rcu_tasks_invoke_cbs() will access per-CPU data for a CPU not in cpu_possible_mask. It makes these accesses while doing a workqueue-based binary search for non-empty callback lists. Although this search must pass through CPUs not represented in cpu_possible_mask, it has no need to check the callback list for such CPUs. This commit therefore changes the rcu_tasks_invoke_cbs() function's binary search so as to only check callback lists for CPUs present in cpu_possible_mask. Reported-by: Eric Dumazet Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 30c42797f53b..1664e472524b 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -460,7 +460,7 @@ static void rcu_tasks_invoke_cbs(struct rcu_tasks *rtp, struct rcu_tasks_percpu } } - if (rcu_segcblist_empty(&rtpcp->cblist)) + if (rcu_segcblist_empty(&rtpcp->cblist) || !cpu_possible(cpu)) return; raw_spin_lock_irqsave_rcu_node(rtpcp, flags); rcu_segcblist_advance(&rtpcp->cblist, rcu_seq_current(&rtp->tasks_gp_seq)); -- 2.35.1