Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2149587iof; Tue, 7 Jun 2022 21:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgy1BYMGSYP251bWeLUokGD1T8FlWNYpSCy9ewHQoc2173SdRBc+8KZcTZ5uV79dnofSTh X-Received: by 2002:a17:903:124a:b0:168:98a6:be2e with SMTP id u10-20020a170903124a00b0016898a6be2emr507847plh.68.1654662268114; Tue, 07 Jun 2022 21:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662268; cv=none; d=google.com; s=arc-20160816; b=IkhCuVoJzS1YbTw0fDU0dTnh62hscfJvQ2R3nYlFni26SoOAT4VrCMMXS82UMu8ElF PF8LvYmqVr2vi3ckw1nAass3G8kU1Vk47biUPQUbTkQVM9FB6X7x0J399NLcNz7yrzMJ QI7vrC8+E/wHdebgwwMbVs7kH7xqPMRBLVeprtih6sN/N34ElQP4gH7WvbzqCM6K8bD7 bpdAILZZ7lU3czA0qJE/sR+8OzHpHq8yJDw77Xpr14wxL/09Jo2m8ApKjoQFFd1iSuI/ 4+ls/7/sR8A5RdDDuAn6H8pqmGYZ1aa8oHRhjHs+pZQa8fLBrpZlgFmmAEzGXk6YgjOZ aJOg== 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=5RzubnK5QG8ptF/VZI5fG4zz7M8Ok66xM0o6SFxIWVg=; b=1GDdAE9BHWO2Dy3U///9Wt4HLZq0zbgR4Esc6mB5HgKWEqEuz0mpeONad8rBaKgv6S 2lNvBFDADseEJ72eyIyN5wxjjmijQRPQdZPrXYDgi0/HfctH65/mw9CSNn7oV4CDwqo3 jmwwdWBlGFuPJyQPRInKjLiB4Yd8gKnfsZ6yOHLuYvpe6Ir8Gv6oZHTUqJi8FsBtwam1 D+talqyFurgwZ4uVYutjFB+4E579aXia7dC4wdE4AbDb3UXJJZW5JBi+ius7jjwrjYEW mr1WVDi8QWOe+MMxExZIOjC3HB3xx3Otto0kDp5Keczy1SSlRRHqBynTL8loT1HW4w8s J3ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Aa1vBW9h; 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 2-20020a170902ee4200b0015e7a2f9741si24564470plo.395.2022.06.07.21.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:24:28 -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=Aa1vBW9h; 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 7D49143DE37; Tue, 7 Jun 2022 21:10:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383490AbiFGWFa (ORCPT + 99 others); Tue, 7 Jun 2022 18:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378993AbiFGVEe (ORCPT ); Tue, 7 Jun 2022 17:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 800C0703D1; Tue, 7 Jun 2022 11:49:04 -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 63E9A612F2; Tue, 7 Jun 2022 18:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697D5C385A2; Tue, 7 Jun 2022 18:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627743; bh=8n4OgktZlvppTMNUSoL4V5FRUeTebTWR5ynJTOiyTVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa1vBW9hbSbaoU3mCjIITOledednbXshrn8pH85VolWwWoq3tBM51PE2XZZ6JL8bL S5MV9yMVHbqXKX0PljFBL/8IY9dmW4UZvMSnBhc6DdA8GlvsUx8AtBrIvhAloU7FOs YEVH1TTcK0IniqgNcY/JEl8aRgjIuWha9dSduIW4= 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.18 078/879] rcu-tasks: Handle sparse cpu_possible_mask in rcu_tasks_invoke_cbs() Date: Tue, 7 Jun 2022 18:53:16 +0200 Message-Id: <20220607165004.954494734@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 b43320b149d2..00ff0896fb00 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