Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3663689pxb; Tue, 19 Apr 2022 07:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo5oHW83sq/rQ/E1Sexuo3m5/SpDvettn09hNjufUvnZcGCs+6MHkivDLyuNDOmqCsZCrI X-Received: by 2002:a05:6a00:174a:b0:4fd:ac35:6731 with SMTP id j10-20020a056a00174a00b004fdac356731mr18058905pfc.71.1650378649885; Tue, 19 Apr 2022 07:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650378649; cv=none; d=google.com; s=arc-20160816; b=xRRJqyTbuqp4xuP4lCHzfiRVmzAhqK474ED8y4dmSP340rJU+H0h7jXEd3mfokLH7i 7oTJ8kvrmVpkrf9mjNfldX2rzAyp1LXeIvYsZqwXSDvGdZket7YIxTcO6lWow311TVVY +GwwwY5p5ZEnfLWps7Pw2ILg8Em+PYI8JoCqdFDNByzl1VKJ15H6k/jCBqkXzIpB9yqF fSxhWgwMtMK+roICMaM5rij44QMexTRRY9zcr5Bpk09bcq99q/WvGZf8iE40k4clF+14 7D/1H9EPT6j5gYXchlProUOoZOdt7+x5PZL3+JBIhbiO1+Q/a8czHbbcjokcSmjKDq7q s3uA== 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=GFfXE03SBgVOlqIZG6GFQX0TJxA7rEvLCZyZ6L4niJ0=; b=LbiCnkNrqx6aCd0GFIorHd+GGArpJELTG+cBI2S9Q7Jrs2lC0BUA/bdcGDk65baIJ/ bGtlRK4cyNTAdyth9+2aJURRquDObJwcwhgXKsIAxL6VjaP7rExLYs2fCQQXuzcs4zDq rCpgRX3GBpYSJk//2gnJ0AZU4xDoP6NoSQqKLdm9lTQPyVTasL4H35n7pGEOzWeKsUSn EO0ELNcuEkYuTguqVyBdtG7AStRcTCEgsQ+h6t2j2zE+xvi2oJhZOgey3QFYLaitNsyU KwLxjuHHgl48+xxd/9gcvS1GMjN1rbROKAaVBsPXNWjXb9dEV5GKiWZHXjim6eOQe8LJ RAtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AuwHufPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p24-20020a056a000a1800b00505a754da37si12771237pfh.208.2022.04.19.07.30.31; Tue, 19 Apr 2022 07:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AuwHufPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240357AbiDRMjB (ORCPT + 99 others); Mon, 18 Apr 2022 08:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239765AbiDRMdY (ORCPT ); Mon, 18 Apr 2022 08:33:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1ACB1EACE; Mon, 18 Apr 2022 05:25:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id 99B9AB80ED6; Mon, 18 Apr 2022 12:25:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9092C385A1; Mon, 18 Apr 2022 12:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284735; bh=OheKLmfXH/0ETv6AsmLPpvnGotO5nZR5o2vxS0ci7Fg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AuwHufPjomyMb7lTLMdJDK5W8CyJtiihdnkkgtjTbEH8IS0JYBueWurCvWxCSdsGY A79ZAmkL708y02glhaqlpseGH2PSv1l/GNHmA05mknGcwcQKVQOuxd0C2Fk63NYS23 WPtBiYjyqbmLCMAawBTYyIC2nluQHw6umQZLhkE4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , Thomas Gleixner Subject: [PATCH 5.17 210/219] smp: Fix offline cpu check in flush_smp_call_function_queue() Date: Mon, 18 Apr 2022 14:12:59 +0200 Message-Id: <20220418121212.746298475@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Nadav Amit commit 9e949a3886356fe9112c6f6f34a6e23d1d35407f upstream. The check in flush_smp_call_function_queue() for callbacks that are sent to offline CPUs currently checks whether the queue is empty. However, flush_smp_call_function_queue() has just deleted all the callbacks from the queue and moved all the entries into a local list. This checks would only be positive if some callbacks were added in the short time after llist_del_all() was called. This does not seem to be the intention of this check. Change the check to look at the local list to which the entries were moved instead of the queue from which all the callbacks were just removed. Fixes: 8d056c48e4862 ("CPU hotplug, smp: flush any pending IPI callbacks before CPU offline") Signed-off-by: Nadav Amit Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20220319072015.1495036-1-namit@vmware.com Signed-off-by: Greg Kroah-Hartman --- kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/smp.c +++ b/kernel/smp.c @@ -579,7 +579,7 @@ static void flush_smp_call_function_queu /* There shouldn't be any pending callbacks on an offline CPU. */ if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) && - !warned && !llist_empty(head))) { + !warned && entry != NULL)) { warned = true; WARN(1, "IPI on offline CPU %d\n", smp_processor_id());