[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/xen: simplify sysenter and syscall setup
- To: Borislav Petkov <bp@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Fri, 21 Oct 2022 08:06:11 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oBBXKcPklp326C9bkH7mVNGCsVSdgT3RZmSK1wEZp14=; b=CTwFINXPamva51jFdFtys3sJtBOdj9XIv3BxXZWM7ePd0CRr4wWJ04iJg9o8lfiLq+fVqzCsC53xzwNzXHs8FjhkJAx/g9XmqDoGIJTylGqhtP2GWeA9lm5z5PRYZecW6DvhkO9ipHUHhreIrKocCzBqjbpcBCSNcL8XZdjJKzhHm/8xOXk4KWKt4jWRAHFHDkQSpcfzIWwBaEAzFy8whk7KctFOQvSSxcbYQJxmrPUO28UFbP/4mkucMfp+TO7lfyluyRwGVmAxw6VjwWT8dbtoIyVk8vZe+7xwtgK/fGDM7Vy/OB8SOpEXCA5RUi3OEfxZntjBiOLsiS7RqmbaSg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MPNGgz2deE7FY6Rf9LzkGjBk3JSbMRSCvJf/AnoIdhWpBEGvR16XNPmAB+8GrBx9uHUsuIzYuSo0BPuMCwdmknp50HmuEj42et0oXpEtVHNT9Le8eoy/pRkqpAIRSeohrXVpKCstQgAdJpGW8ogIWQrjncRJlhqjCklrpZbTrZvpH5Ok2zkjKRUR0N6FAF2gjdg5veiz7UQciw0WPAiXTxxW9YCfNe3RL/dYazLp2Kr+JETxj8E2hVAFQ9PmxjLdpuAQHQCOO2zNLcvcvSq0pumFFGSnqj9h3Jg3X0innwp7xwCgE6wfQNGWpm1DHj/0rwSQO3OyLeEJuYJOtQIRow==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>
- Delivery-date: Fri, 21 Oct 2022 08:06:26 +0000
- Ironport-data: A9a23:pm5NUq6ExJp9NEP1qoqnkAxRtGjHchMFZxGqfqrLsTDasY5as4F+v mMeDWuFb66NNGGmetl+Po7j/BkB7cXVztAyQQZl+3wyHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvymTras1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPewP9TlK6q4mlB5gZnPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5aXCJsr NMSFQxUYz6Cmuuag52ccuJV05FLwMnDZOvzu1lG5BSAVbMKZM6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UelnpFTOIlGfZsRKEkjTRo+a07bVTHwZFiFP MrANDX5f5Qf1/fZ3fFvnN3yNjpWngoBB+JTkULp8TQilFt7TtE5lpdwNZakmYL9Zo7RZUB7+ PYMr5wnLULSsMNd6pyCOoIXMPyAG3QRhDHNn6UPD3cZek6EmOIr4Sy7KQ+5emsdpBNxJwumI 7ZWFcdrmI2c1KGM7z74HSKyGG5fIyQZ0Wf9igF3ekJhlTVfsuaDQSTDFYzjsCnv/ITRsXGRv fbAuMlP8Pe
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHY5Hg6cWouKk4hAkKcpxKDANECg64XKDGAgAFW1YA=
- Thread-topic: [PATCH] x86/xen: simplify sysenter and syscall setup
On 20/10/2022 12:39, Borislav Petkov wrote:
> On Thu, Oct 20, 2022 at 01:36:19PM +0200, Juergen Gross wrote:
>> xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot.
>>
>> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
>> ---
>> arch/x86/xen/setup.c | 23 ++++++-----------------
>> 1 file changed, 6 insertions(+), 17 deletions(-)
>>
>> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>> index cfa99e8f054b..0f33ed6d3a7b 100644
>> --- a/arch/x86/xen/setup.c
>> +++ b/arch/x86/xen/setup.c
>> @@ -910,17 +910,9 @@ static int register_callback(unsigned type, const void
>> *func)
>>
>> void xen_enable_sysenter(void)
>> {
>> - int ret;
>> - unsigned sysenter_feature;
>> -
>> - sysenter_feature = X86_FEATURE_SYSENTER32;
>> -
>> - if (!boot_cpu_has(sysenter_feature))
>> - return;
>> -
>> - ret = register_callback(CALLBACKTYPE_sysenter,
>> xen_entry_SYSENTER_compat);
>> - if(ret != 0)
>> - setup_clear_cpu_cap(sysenter_feature);
>> + if (boot_cpu_has(X86_FEATURE_SYSENTER32) &&
> Can you switch that and below to cpu_feature_enabled() while at it, pls?
Why?
This function (should) be called on the BSP only (because Xen's API lets
this be specified when starting APs).
Whether it's once, or one per cpu, it doesn't matter.
cpu_feature_enabled() puts in an out-of-line thunk (which is what
actually gets used), and a patchable code section.
Text patching will happen at least once to orphan the out-of-line thunk,
probably after the last time it gets used, then then maybe again later
to clear the feature. Even if you had several million CPUs, there's no
way the overhead of cpu_feature_enabled() is worth it here.
~Andrew
|