Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4375143rwd; Tue, 30 May 2023 04:44:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6klkgblu+VihUgm5ZtpfFbRfwqN4MYCTQRylcbuAWAGbCTqXU6eVet4QE5Qz3G8Am4wfCs X-Received: by 2002:a17:90a:9606:b0:244:d441:8f68 with SMTP id v6-20020a17090a960600b00244d4418f68mr11468516pjo.16.1685447076681; Tue, 30 May 2023 04:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685447076; cv=none; d=google.com; s=arc-20160816; b=hv7t4ZhzAIv6lVReZbhPXV+M4u6Yi2jYl3dXGiSRe4U/TfTAMiqYeKYlKvymIXNqY7 sD6FkuuXMx7JwHznqrm3JhoM3KpYZHCycf9/PJUFJATrUY6vBnBg2DTUX3DDvouE+gqX LwiTnztAPuyLeETn+Z+MmaVaiU/+vqJLHzOcueTlZlI8TRd4B9YI55manDaPTcKBzlQp Fn74g9TVT5/+a68MHwRrCW0BuwsfoKluzCOR+TLqEwMo73jEu195ep61l9G/aQuPXImq 2RecBM7xf/acRrt2Mxi+HSUG5J5zHOENIM0nsHSRann69G9/C+SeWaZ+ZI51ejM2XjxI Smqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=jzxR1ScglUhfxqqGJjgvOS5NAqJpfFc/FG469x51F+w=; b=Tk1HTOF24A5PCFVNWOfXXXG4fvTPbozxnyG9yFJMmDPrMyBeZt8sD/UfRdcZH1Xp8h wa4WkfEa4/Teu+g+/FtF+ACRJ26+CE5adPST0hEAMqhSk8Dijrpqxqtq8L336V+Zsgka XI8ZGcXWXDLpfmk1DXyHXqX/xEaHOwaJm9Gmr6XRps9UqNFsGNk5KszVsQAMpuWC0C+z 27BZMwHfX6YYI/FmbTSvQk1o4e4CWw7knhYXgoMQV8wpeCsXmZiL3TkX3jaXFfKZyvxv WAt0zlr4EenxidpKIiEqzzQ4zyl5TwoQnyQeOJM//QQI3se5JdLCkuaE5yIp0CfAxBf5 rPVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov.name header.s=fm2 header.b=zGm7H8q2; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=IGCHqhWW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a17090a974400b00247498bcea7si6085890pjw.107.2023.05.30.04.44.19; Tue, 30 May 2023 04:44:36 -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=@shutemov.name header.s=fm2 header.b=zGm7H8q2; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=IGCHqhWW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbjE3LNC (ORCPT + 99 others); Tue, 30 May 2023 07:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjE3LNB (ORCPT ); Tue, 30 May 2023 07:13:01 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEF4793; Tue, 30 May 2023 04:12:56 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9E5085C010B; Tue, 30 May 2023 07:12:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 30 May 2023 07:12:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1685445173; x= 1685531573; bh=jzxR1ScglUhfxqqGJjgvOS5NAqJpfFc/FG469x51F+w=; b=z Gm7H8q2xAwH65t7g76y5CpNRNA5QhcTT9CVh8xcZZdtfZF7xTv87d7VZCAAC/TEk ggEOsQ0d0JIIol5LaBUgMQPQGyyrsBk+MQRBvYZ8pzb0V1hZ+o8+a0kCFt4nMBVi DLzwKpOEDjkVtg8s4OlRz2e20pJZ/fwWcSqsVwRSlWLupRb6L8t3scy1jBdt+w58 H4dOxL5cdxo5A2z1zjta/UDnxuIDN5al4owNBMvK5avlfyNWjfjgnHrYuUWsxjca YIUFnkT6n2B1y7mZnyFLTJy4jGY7MofSeCiX3Ash7A71fm447OX0Nrg2/sSqQhHc 7lxckU497HvK26OalRNAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1685445173; x=1685531573; bh=jzxR1ScglUhfx qqGJjgvOS5NAqJpfFc/FG469x51F+w=; b=IGCHqhWWcbyh6MB/CW4j9E5nOLkNc MB5S7AG5+9Uao8lFbpTrQFWDCxAgeAz50TkB7sSIqfCZe4GJqucU4q2of+fNzkAZ ozqucMxrSsKk8D4vwBp0M3nOXWfV55tZ+BwneK280TDjbxLiTaJ04HPIW2zPIAzi QzLxwlWrF7USZaAaKKXFYwDt4taOmxnalJUHUqeeb5tBFH5OcyG/0aW3BAk2IrsU OTU0Fx6sm6GJ4r1ZrQShU6ReUHcyoxDjL+s0xU4PF/zfeUk6T4mjxgMP+QeS1d22 +L+cEp2vpyKyphRpU18a5qW3k8RyRCCLLIP2NVTJQFY/VyVoSdg5pTTFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekjedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpefhieeghfdtfeehtdeftdehgfehuddtvdeuheet tddtheejueekjeegueeivdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 30 May 2023 07:12:51 -0400 (EDT) Received: by box.shutemov.name (Postfix, from userid 1000) id 3A8FC10CE6B; Tue, 30 May 2023 14:12:48 +0300 (+03) Date: Tue, 30 May 2023 14:12:48 +0300 From: "Kirill A. Shutemov" To: Thomas Gleixner Cc: LKML , 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 , Usama Arif , Juergen Gross , Boris Ostrovsky , xen-devel@lists.xenproject.org, 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 , "Michael Kelley (LINUX)" , Dave Hansen Subject: Re: [patch] x86/realmode: Make stack lock work in trampoline_compat() Message-ID: <20230530111248.lzt77sydi7x3wau7@box.shutemov.name> References: <20230508181633.089804905@linutronix.de> <20230508185218.962208640@linutronix.de> <20230524204818.3tjlwah2euncxzmh@box.shutemov.name> <87y1lbl7r6.ffs@tglx> <87sfbhlwp9.ffs@tglx> <20230529023939.mc2akptpxcg3eh2f@box.shutemov.name> <87bki3kkfi.ffs@tglx> <20230529203129.sthnhzgds7ynddxd@box.shutemov.name> <87h6rujdvl.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h6rujdvl.ffs@tglx> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, May 30, 2023 at 12:46:22PM +0200, Thomas Gleixner wrote: > The stack locking and stack assignment macro LOAD_REALMODE_ESP fails to > work when invoked from the 64bit trampoline entry point: > > trampoline_start64 > trampoline_compat > LOAD_REALMODE_ESP <- lock > > Accessing tr_lock is only possible from 16bit mode. For the compat entry > point this needs to be pa_tr_lock so that the required relocation entry is > generated. Otherwise it locks the non-relocated address which is > aside of being wrong never cleared in secondary_startup_64() causing all > but the first CPU to get stuck on the lock. > > Make the macro take an argument lock_pa which defaults to 0 and rename it > to LOCK_AND_LOAD_REALMODE_ESP to make it clear what this is about. > > Fixes: f6f1ae9128d2 ("x86/smpboot: Implement a bit spinlock to protect the realmode stack") > Reported-by: Kirill A. Shutemov > Signed-off-by: Thomas Gleixner Tested-by: Kirill A. Shutemov -- Kiryl Shutsemau / Kirill A. Shutemov