Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2868602rwb; Mon, 15 Aug 2022 12:59:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7TS6oafHVyX/d0z0nsoJSkFpKG/02agQXqpI78xudSw8VLjc1BL0S1x0gdLeT5G9XH3AKY X-Received: by 2002:a05:6402:329b:b0:43d:bd4b:2f08 with SMTP id f27-20020a056402329b00b0043dbd4b2f08mr15966171eda.244.1660593558816; Mon, 15 Aug 2022 12:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660593558; cv=none; d=google.com; s=arc-20160816; b=YUHBSxZnxtQuT7ZMBIdaLLAV0J9l726snR87zn7r896vbR+PXOXQiHV2YzYTPg8RDP Y+F83sM/rUq0rJWCTK5gJHgO9HO1A6WaS4bt9XVzGn2sIdqhAalNRwD85Ib4GUra0MRu zb808SnCYPqGSaiejlCtLsAl7OaXcjn7YNpDcV8IEjnb5hCbZ1KmRgiuu/+mZfcxYBvx BQ+6vVBsuWzfbqIb3aNr10b149v5cj8aNkHUDqShKECpFhSxntsz79mnMJXQ0eRX2ywm JGi9jgzfuIiTPRfLCQT047lEYH2xGW2l5/BsokQOTDCP0Jxtk6Ly8BOo/BXKeKW8lAzP a2gw== 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=OJBE/Si1qIlWA0aGu8gJiECcks+RznA7i6GqXy0OBN4=; b=nLbYCDRzO/YCV7VZ8Kwmz0bsyGtDRZDKZIZNFbrWsR4Pr2I+kQOKGiiZBfdy2hxHmn D4Cm5MJ8+7CkmZGNcW7yt6MLWBuCylO1B6jzUYVdH+DmI3RohP6JzM1hZ9XaOWAX8LBq 0V2r9bJaQpMSXoLKezITZvQE8MRIDcbDCtgweW2mjbfFD9LXITjdnZ/pVGEZvZ/J7wZQ pLP6SH/fDzd8zc/DUXMcTpaM5d610uYMfiiz8xESHUu37PNJbh8iu42kuuWfXzP62FWI T5mqVEPbOmiD8UfG+QC3sKKTAY0nktTNWfV8Vn5nEVcG9CnPojv+k+QVrk9atnotod6Y fCpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NvUpYPVK; 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 qn9-20020a170907210900b0073143b33d7asi7045593ejb.465.2022.08.15.12.58.53; Mon, 15 Aug 2022 12:59:18 -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=NvUpYPVK; 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 S245049AbiHOTmx (ORCPT + 99 others); Mon, 15 Aug 2022 15:42:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343957AbiHOTiQ (ORCPT ); Mon, 15 Aug 2022 15:38:16 -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 8F36031DC4; Mon, 15 Aug 2022 11:46:30 -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 2D383611DB; Mon, 15 Aug 2022 18:46:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A48FC433C1; Mon, 15 Aug 2022 18:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589189; bh=6He/nieo34FbAoePLRcPRcoYRJZGQDmNooBT9RKLjkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvUpYPVKjemBDeYkrXCZ3T1uEnx1+CPE0cK9rJpnpu+f22sm3q3mgJ0qIkcq7vR4r x7JUWK0Qdih6lR5T8tfabyjpm38sN1lFUpBMtMe250goGMgV0oJUmQaFW+bw5BVgiE eolfAxp/8gzC5eJA4H0zLdxiFugMG0b7bMFd3PuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 641/779] s390/smp: cleanup target CPU callback starting Date: Mon, 15 Aug 2022 20:04:45 +0200 Message-Id: <20220815180404.755545770@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Alexander Gordeev [ Upstream commit dc2ab23b992c9d5dab93b9bf01b10b10465e537e ] Macro mem_assign_absolute() is used to initialize a target CPU lowcore callback parameters. But despite the macro name it writes to the absolute lowcore only if the target CPU is offline. In case the CPU is online the macro does implicitly write to the normal memory. That behaviour is correct, but extremely subtle. Sacrifice few program bits in favour of clarity and distinguish between online vs offline CPUs and normal vs absolute lowcore pointer. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/smp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index e57eb2260b90..982b72ca677c 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -328,10 +328,17 @@ static void pcpu_delegate(struct pcpu *pcpu, /* Stop target cpu (if func returns this stops the current cpu). */ pcpu_sigp_retry(pcpu, SIGP_STOP, 0); /* Restart func on the target cpu and stop the current cpu. */ - mem_assign_absolute(lc->restart_stack, stack); - mem_assign_absolute(lc->restart_fn, (unsigned long) func); - mem_assign_absolute(lc->restart_data, (unsigned long) data); - mem_assign_absolute(lc->restart_source, source_cpu); + if (lc) { + lc->restart_stack = stack; + lc->restart_fn = (unsigned long)func; + lc->restart_data = (unsigned long)data; + lc->restart_source = source_cpu; + } else { + mem_assign_absolute(lc->restart_stack, stack); + mem_assign_absolute(lc->restart_fn, (unsigned long)func); + mem_assign_absolute(lc->restart_data, (unsigned long)data); + mem_assign_absolute(lc->restart_source, source_cpu); + } __bpon(); asm volatile( "0: sigp 0,%0,%2 # sigp restart to target cpu\n" -- 2.35.1