Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FE08C43458 for ; Tue, 7 Jul 2026 07:04:09 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1355970.1610633 (Exim 4.92) (envelope-from ) id 1wgzqU-0002gi-W0; Tue, 07 Jul 2026 07:03:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1355970.1610633; Tue, 07 Jul 2026 07:03:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgzqU-0002gb-TO; Tue, 07 Jul 2026 07:03:54 +0000 Received: by outflank-mailman (input) for mailman id 1355970; Tue, 07 Jul 2026 07:03:52 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wgzqS-0002gV-PF for xen-devel@lists.xenproject.org; Tue, 07 Jul 2026 07:03:52 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wgzqR-00AxM5-Iv for xen-devel@lists.xenproject.org; Tue, 07 Jul 2026 09:03:51 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a4ca4c9-bab6-0a2a0a5309dd-0a2a4501c0fa-44 for ; Tue, 07 Jul 2026 09:03:51 +0200 Received: from [209.85.221.43] (helo=mail-wr1-f43.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a4ca4d7-400f-0a2a45010019-d155dd2bd907-3 for ; Tue, 07 Jul 2026 09:03:51 +0200 Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-45fd464d51fso1945421f8f.3 for ; Tue, 07 Jul 2026 00:03:51 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493e0f43912sm39170425e9.7.2026.07.07.00.03.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jul 2026 00:03:50 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1783407831; x=1784012631; darn=lists.xenproject.org; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=6fy7Qln24UXWaLRE76c209nR2gsTmukRmjmzTSulMGc=; b=A5YJojyKAwQbK/RZ2sEwJijFF9IJNgoCGwzXfA2e8YhB2oiE6Bi1Y3+dOIazmsWXSG tMawf4qh8Lr7jHeJ8+Cr5YfWuAk3WxkPU9L28UOOKr8ZtCiTRBCvIAj10JIn7iMSUhMJ uzA6MrkXW23QAL1VrhQGRTYCRTGioQ1HAncsTB66sqS3fKDYAQe34AGkgBBg0ixvUpgy p7Nd+0hreNbVayFP3p+tYAU9/ILPZDFuqb1cGq9YHKqzftcb1LkNioSYf8ADdXea2b9m lmtjmUbgJDHFlZe4F+pdrz/sGLftQR8JP5oL+ec3J51X1BE99AXgssHx6yZDG/S2/dUg VLng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783407831; x=1784012631; h=content-transfer-encoding:content-type:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=6fy7Qln24UXWaLRE76c209nR2gsTmukRmjmzTSulMGc=; b=HiW5uiNSMcnoEnPNlGyiBOn6MgNxTP2zQVkD/qiWynYNI7m8gCtdcCpQ/ZcwWsQHLg ZIc27mahqn4tKPdGDoPn+Phq81QvRv+g7tNWfWYQNpSGiAbpxi3mn0hd9Erij14kjH3N p42GdmBuP3KIDUZx/hxH5iVmu5t9euDb8sjG+TEc04CV8uFInvYtDIAPUFYdWY9vKmEe f1Im0vu5WPlktLwuJSxAu1sOhtYPC4vrJNvi5PzPdfNFYq/6X0veEfI5wyXNdHJvyr0m W0KuFKLeuEbVFtst2ZOj2+J58BY+7ZREGyVHDxDpMKHxm4EJd0ByljQchvStfLvdy4RD dELA== X-Forwarded-Encrypted: i=1; AHgh+RrbGcBfSmv6/tTvT2qR7I2DPpSHoLIVG479Z3rmgRtFhy/c4FA7s2imekewemymjNVmOmGydiiPiLg=@lists.xenproject.org X-Gm-Message-State: AOJu0YxFMGO5eyfnAH3l2qJ/iC7EH3dzRSOH+JciX8xZBwZ8c+efJyl7 aXKVXc3kl22dpPBn4jQDdrRv2LWy2GBIoZ1oAix+c7SVax7N4pKM+ZDJMyMAo3QCuA== X-Gm-Gg: AfdE7cmBSyMPFc0ZRhwhYzelLv78V1Bzcq4LukBfg12/sgSbDoU1LbxVrgQF/4p/PYz qRH6xLL5PXqsCtUFkzKZatnDWDI1eq3aeEMRvcVMKXMknFnvELOKdSoaCjWUZ5tmJ8eveQb2rIL Vh0FEluIS2Tvm4UxwYqDZTdUxINlgiQGcIjIE/EQ4/BLVEPCtm4IbH7hQ9ZICdpzsgL1hsRaanJ R50a5BaLOOf8UPzvbHh0Tt3qgv9kYk+Zg2PNA/QHnde5TADhJh2K/dDPzqkpD5lR4gI/NXHVOMa QEer4gAX0PqNr0syZ1UoIa3c9PxF7YEBoaZCn2+rY4QauKb+H53HdsKByBZ14pVCzqYeUinNCrk s8uoA1PxokQFzVUBCuKLvXrjm8wexQGdXW8lVMcNwsyOpNkCiamrdOxX8VQumpw5VR25DOkvVIu 5BKes2yhBrV+nKGBXRaTvNNUUnesBBUlL/Kw21qfM+29yIOgYeytAdOyDtN6hJwX9ETrn9qttTn 98j X-Received: by 2002:a05:600c:8b6e:b0:493:a5d4:3798 with SMTP id 5b1f17b1804b1-493df0663fdmr38673565e9.1.1783407830756; Tue, 07 Jul 2026 00:03:50 -0700 (PDT) Message-ID: <25cdcaa0-64cf-4014-ae52-3114f39abea7@suse.com> Date: Tue, 7 Jul 2026 09:03:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] x86/entry: Use POP_GPRS and remove RESTORE_ALL To: Andrew Cooper Cc: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Teddy Astie , Xen-devel References: <20260706153415.1264750-1-andrew.cooper3@citrix.com> <20260706153415.1264750-3-andrew.cooper3@citrix.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6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wAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <20260706153415.1264750-3-andrew.cooper3@citrix.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-d62444/1783407831-838C81E0-6711E8DC/0/0 X-purgate-type: clean X-purgate-size: 3090 On 06.07.2026 17:34, Andrew Cooper wrote: > POP_GPRS is shorter than RESTORE_ALL in terms of emitted code. > > By separating the popping of entry_vector/error_code off the stack, > SPEC_CTRL_COND_VERW doesn't need custom displacements. > > Get rid of the compat=1 special case for PV32. It's not obviously a win, and > PV32 is getting increasingly rare these days. > > No functional change. > > Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich as-is, however ... > --- a/xen/arch/x86/x86_64/compat/entry.S > +++ b/xen/arch/x86/x86_64/compat/entry.S > @@ -160,12 +160,11 @@ FUNC(compat_restore_all_guest) > /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ > SPEC_CTRL_EXIT_TO_PV /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ > > - RESTORE_ALL adj=8, compat=1 > + POP_GPRS > > - /* Account for ev/ec having already been popped off the stack. */ > - SPEC_CTRL_COND_VERW \ > - scf=STK_REL(CPUINFO_scf, CPUINFO_rip), \ > - sel=STK_REL(CPUINFO_verw_sel, CPUINFO_rip) > + SPEC_CTRL_COND_VERW /* Req: %rsp=eframe Clob: efl */ > + > + add $8, %rsp /* Pop ev/ec off the stack */ > > jmp iret_to_guest > END(compat_restore_all_guest) > --- a/xen/arch/x86/x86_64/entry.S > +++ b/xen/arch/x86/x86_64/entry.S > @@ -226,7 +226,8 @@ FUNC_LOCAL(restore_all_guest) > /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ > SPEC_CTRL_EXIT_TO_PV /* Req: a=spec_ctrl %rsp=regs/cpuinfo, Clob: cd */ > > - RESTORE_ALL > + POP_GPRS > + > BUILD_BUG_ON(TRAP_syscall & 0xff) > testb $TRAP_syscall >> 8, EFRAME_entry_vector + 1(%rsp) > jz iret_exit_to_guest > @@ -753,20 +754,17 @@ UNLIKELY_END(exit_cr3) > /* WARNING! `ret`, `call *`, `jmp *` not safe beyond this point. */ > SPEC_CTRL_EXIT_TO_XEN /* Req: %r12=ist_exit %r14=end %rsp=regs, Clob: abcd */ > > - RESTORE_ALL adj=8 > + POP_GPRS > > /* > * When the CPU pushed this exception frame, it zero-extended eflags. > * For an IST exit, SPEC_CTRL_EXIT_TO_XEN stashed shadow copies of > * scf and ver_sel above eflags, as we can't use any GPRs, > * and we're at a random place on the stack, not in a CPUFINFO block. > - * > - * Account for ev/ec having already been popped off the stack. > */ > - SPEC_CTRL_COND_VERW \ > - scf=STK_REL(EFRAME_shadow_scf, EFRAME_rip), \ > - sel=STK_REL(EFRAME_shadow_sel, EFRAME_rip) > + SPEC_CTRL_COND_VERW /* Req: %rsp=eframe Clob: efl */ > > + add $8, %rsp /* Pop ev/ec off the stack */ > iretq > END(restore_all_xen) ... both uses of SPEC_CTRL_COND_VERW's with arguments go away. Shouldn't the macro thus also be pruned of its parameters? Jan