From patchwork Fri Apr 14 23:44:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 83622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp742834vqo; Fri, 14 Apr 2023 17:25:07 -0700 (PDT) X-Google-Smtp-Source: AKy350YFJlJymEKK45qmWagBcADzFP12VCMLUKDjESIP4savNB7ww0rdVgGspZncIrES/MrD84g1 X-Received: by 2002:a05:6a00:1a8c:b0:625:ea57:389b with SMTP id e12-20020a056a001a8c00b00625ea57389bmr11567887pfv.5.1681518307478; Fri, 14 Apr 2023 17:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681518307; cv=none; d=google.com; s=arc-20160816; b=AnjwBQy/wnSug6Fm8tZXyu/tV3bLs6dabp7+jLwY3H1q5rBsynfr+FOiCCBTO+nARK cZMJurUZn5dFgBSPeVbFvMkEgZfrMQJnqYd2aDhFsrxxhffGy7GnxCg8NYp+giOYd/gP kvi7WRZDbWPP1YuDDrX7dn/JOZknqdqGkj/JIht9rnpoIJdrvp4Sn+3uxlBv7EZ1hUXv 5hWCtLewRjb8+HIlGcJcQNzz0e7MjosCb6glYxIg2S2AqrRzhOMZQBLQHl4jBZ8Vw5/i s1lc7YgTUI/wXQPtlX5C0UG11QYtykWuBsbah/1DboMD1CrEwYCN0AKdxBrwjtZmTqFU jjIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=e1FMo66EmKhD6c9vNMbCMEr10b7nb30z1HTBJhSwsws=; b=PtDxalXCODyonkkJRDAg+qqeZpNIAMmxVMnvH9slpFJBMvH25cYM5JvshqwATglvI2 w3tRWFa22RBUAKojbQ34tpoRQyV3G42xYFHNJiD2fP79OMChDvhacH8dI/fpCODYLxtC JM/jEX0wNYQrHhtX8qufJTeZc2cAAwrnIdhwosSEYKB0VOQsimiSHh6yQ42XxviA1ZyM xTepoxxMX+UD79vhccADTz8lbeTxe4ADkrtNwKxl4PjCaftva70o6tJBsaw46A+LWxAE jxwFVHKsTk+B1AU09XfaWYw9wQI1NVrIpAafcx9skylI1qxhz+xsPWyB2Q2fvahcexaA E5+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gZ0HEhv3; dkim=neutral (no key) header.i=@linutronix.de header.b=4fNwIQeL; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020aa79429000000b0063b1f577d29si5372053pfo.192.2023.04.14.17.24.52; Fri, 14 Apr 2023 17:25:07 -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=@linutronix.de header.s=2020 header.b=gZ0HEhv3; dkim=neutral (no key) header.i=@linutronix.de header.b=4fNwIQeL; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbjDNXpy (ORCPT + 99 others); Fri, 14 Apr 2023 19:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbjDNXpV (ORCPT ); Fri, 14 Apr 2023 19:45:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B17A5CD; Fri, 14 Apr 2023 16:44:44 -0700 (PDT) Message-ID: <20230414232310.256412375@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681515881; 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: references:references; bh=e1FMo66EmKhD6c9vNMbCMEr10b7nb30z1HTBJhSwsws=; b=gZ0HEhv3acCl5QBYyuBxsWswUfiT2pTSEiPx8KAuYf607AwMRXvsLBlYW5dljp8oWs/ntm Rl62blc06B+wdYag6mxiaHF4d6UazbaaiGafHMeetJ/A7Hs5RVhUzMngs/dEe59idC0O2F aA4jOVKszqOh4s2mn+PKplYpnPle5vYAOnMKw27lKXhJvIh/kbhLy4lRj7cXXA/G581Bej PsarGBYF6AEmBjKJMVj8L9q7SGw5rle2qMtTuVh6V6kezaC/bwaovVLX9d1Zsm+GX8ANmu PhMCi/IYxY/Oqm30JTDcZDBgs/Y7EGdHwcz8miDR/Arr0Wrr//IGKwmjd5YAMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681515881; 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: references:references; bh=e1FMo66EmKhD6c9vNMbCMEr10b7nb30z1HTBJhSwsws=; b=4fNwIQeLJaYUXs5/LQAEGEGLbWkObI//eYOHt1swXrTx799wwKeZFlTzry5MJCiAr70s7q ypFOiCNeSLElyzBg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, David Woodhouse , Andrew Cooper , Brian Gerst , "Arjan van de Veen" , Paolo Bonzini , Paul McKenney , Tom Lendacky , Sean Christopherson , Oleksandr Natalenko , Paul Menzel , "Guilherme G. Piccoli" , Piotr Gorski , Juergen Gross , Boris Ostrovsky , xen-devel@lists.xenproject.org, David Woodhouse , Usama Arif , Russell King , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Guo Ren , linux-csky@vger.kernel.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Mark Rutland , Sabin Rapan Subject: [patch 17/37] x86/xen/hvm: Get rid of DEAD_FROZEN handling References: <20230414225551.858160935@linutronix.de> MIME-Version: 1.0 Date: Sat, 15 Apr 2023 01:44:41 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763199740626595845?= X-GMAIL-MSGID: =?utf-8?q?1763199740626595845?= No point in this conditional voodoo. Un-initializing the lock mechanism is safe to be called unconditionally even if it was already invoked when the CPU died. Remove the invocation of xen_smp_intr_free() as that has been already cleaned up in xen_cpu_dead_hvm(). Signed-off-by: Thomas Gleixner Cc: Juergen Gross Cc: Boris Ostrovsky Cc: xen-devel@lists.xenproject.org --- arch/x86/xen/enlighten_hvm.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -161,13 +161,12 @@ static int xen_cpu_up_prepare_hvm(unsign int rc = 0; /* - * This can happen if CPU was offlined earlier and - * offlining timed out in common_cpu_die(). + * If a CPU was offlined earlier and offlining timed out then the + * lock mechanism is still initialized. Uninit it unconditionally + * as it's safe to call even if already uninited. Interrupts and + * timer have already been handled in xen_cpu_dead_hvm(). */ - if (cpu_report_state(cpu) == CPU_DEAD_FROZEN) { - xen_smp_intr_free(cpu); - xen_uninit_lock_cpu(cpu); - } + xen_uninit_lock_cpu(cpu); if (cpu_acpi_id(cpu) != U32_MAX) per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu);