[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector


  • To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Jane Malalane <Jane.Malalane@xxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Mon, 18 Jul 2022 08:56:02 +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=mBwG3F2FB9u8m+MzWXH8m4m2+uk9RGt0rE6NNCVZoqU=; b=ERpR2KonXn306P0Neh1MtspCFJxPHacwl4tMY1+VjxZBTUBGbF2LbstJXOxzihau7KDy8lR6AGHitwKEufTN88bdJCYDkOI6+l1RqyoKG0SXlBG/HJ5DJ7LMWbiXNdkhBpcvPVKXfftT9J8GioX1x6PiZrw5LFVN5pwfGHGLQbRgDGE2fbWVTbtAUR/zbzfWlk4HNHCPgaLl2/tBxBz2Di0Z/80VStQarQxuGwvl2POaZ2WPLw26LnA8TZmJVR1hW38xcVB2xl9mi4ECIqdp3zbEAtz+4kvSudcJ8L2yIU+gWBorqtmzYidpHssdORAVTRD6EwUzL7/Tic/qimsUUQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CdLGIXfL5j0vcTKVDzlibj/CmrO4+IxIzNbAaO3Gdz1S7qmU45W+3a/gy0sGRUeandYubQQL7QMPhJh7e3ASi8pvhxiZfiOtstGJJZuzJFMZOnsNzfjDc4wmSVpV/w2SJYSRuBmMH7N4cVWeaBihZQbJu9BdpNuPK3ngVlCn1sWAV2lNh4yURecGnjjwZgV8ZP6i5iN2fownXVYXgThnVzFyvxMINDeDLz5+0GUqwuUxQiULTbgqT9CnRdvHa2N/CiJAVVcWvaP7QJzLIODnfPtTzscm1EXSaeRYrbstm11aeVFwAs42f3+1MCMcrO4bXVeXkxsWtC3S/cfnqf5sHw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Maximilian Heyne <mheyne@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Colin Ian King <colin.king@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 18 Jul 2022 08:56:25 +0000
  • Ironport-data: A9a23:gG/Jg66kY2j+nwvayCwlUAxRtBbHchMFZxGqfqrLsTDasY5as4F+v mUcWmGPa/6IZ2Kne9t/b4u0/UwHvJ/dyddhSwJvrC43Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yM6jclkf5KkYMbcICd9WAR4fykojBNnioYRj5VhxNO0GGthg /uryyHkEALjimQc3l48sfrZ8ksw5auq4lv0g3RlDRx1lA6G/5UqJMp3yZGZdxPQXoRSF+imc OfPpJnRErTxpkpF5nuNy94XQ2VSKlLgFVHmZkl+AsBOtiNqtC0qupvXAdJHA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zZ3cGIDWucqBJca Z0iPAmmxOQPVAsKuirDHgMWObO4/fRkoj9XBIADxk7rCGTkDKB8tfBYlml9yZbdwkK7aYp8G DDnQC8zL6kqeuHxhjV0HKWx4hKmeHm1sBICKW3+4gow3TX+0WVjbZaKvi/VQMO0aWSAZER4Z 7xSiIbToZOArXqDyeISFXWqlDdOX0VmgLfIBej8AfeSIrCNXwH4oN69PxkmlGy0TtegPhslK 1MxG6XrJxREFfJmzn8/cHBU1VwmlOzumdKq59bs5Vza/poVFZql/1owGpFVJMbWC7q4oEuF+ djSMna+fZNaFufK3TUpHNmztCgVmk6Wk7ueDlIhuWFlzxN2HxpxUoRw8IS2n8G6ZImUpFBo+ DJKL5hmr1CRtIfKah9GOACS82qDXGle2OFDEuCZVD8UK0XMXPErJD6pL0z+eGxYZQNiIA/nZ zQOWkowVLau3iefPFm8Kc7giwlGl/NLAgF4vsulKRRq/n7WKfhNzGFRRQnj9agys9vcPHmZw ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYlToncjhzapb0rEGq8Bkg0N3t9a189b0AgAImuYCAABmhgIAAOBoAgARvxAA=
  • Thread-topic: [PATCH] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector

On 15/07/2022 14:10, Boris Ostrovsky wrote:
>
> On 7/15/22 5:50 AM, Andrew Cooper wrote:
>> On 15/07/2022 09:18, Jane Malalane wrote:
>>> On 14/07/2022 00:27, Boris Ostrovsky wrote:
>>>>>        xen_hvm_smp_init();
>>>>>        WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_hvm,
>>>>> xen_cpu_dead_hvm));
>>>>> diff --git a/arch/x86/xen/suspend_hvm.c b/arch/x86/xen/suspend_hvm.c
>>>>> index 9d548b0c772f..be66e027ef28 100644
>>>>> --- a/arch/x86/xen/suspend_hvm.c
>>>>> +++ b/arch/x86/xen/suspend_hvm.c
>>>>> @@ -5,6 +5,7 @@
>>>>>    #include <xen/hvm.h>
>>>>>    #include <xen/features.h>
>>>>>    #include <xen/interface/features.h>
>>>>> +#include <xen/events.h>
>>>>>    #include "xen-ops.h"
>>>>> @@ -14,6 +15,23 @@ void xen_hvm_post_suspend(int suspend_cancelled)
>>>>>            xen_hvm_init_shared_info();
>>>>>            xen_vcpu_restore();
>>>>>        }
>>>>> -    xen_setup_callback_vector();
>>>>> +    if (xen_ack_upcall) {
>>>>> +        unsigned int cpu;
>>>>> +
>>>>> +        for_each_online_cpu(cpu) {
>>>>> +            xen_hvm_evtchn_upcall_vector_t op = {
>>>>> +                    .vector = HYPERVISOR_CALLBACK_VECTOR,
>>>>> +                    .vcpu = per_cpu(xen_vcpu_id, cpu),
>>>>> +            };
>>>>> +
>>>>> +            BUG_ON(HYPERVISOR_hvm_op(HVMOP_set_evtchn_upcall_vector,
>>>>> +                         &op));
>>>>> +            /* Trick toolstack to think we are enlightened. */
>>>>> +            if (!cpu)
>>>>> +                BUG_ON(xen_set_callback_via(1));
>>>> What are you trying to make the toolstack aware of? That we have *a*
>>>> callback (either global or percpu)?
>>> Yes, specifically for the check in libxl__domain_pvcontrol_available.
>> And others.
>>
>> This is all a giant bodge, but basically a lot of tooling uses the
>> non-zero-ness of the CALLBACK_VIA param to determine whether the VM has
>> Xen-aware drivers loaded or not.
>>
>> The value 1 is a CALLBACK_VIA value which encodes GSI 1, and the only
>> reason this doesn't explode everywhere is because the
>> evtchn_upcall_vector registration takes priority over GSI delivery.
>>
>> This is decades of tech debt piled on top of tech debt.
>
>
> Feels like it (setting the callback parameter) is something that the
> hypervisor should do --- no need to expose guests to this.

Sensible or not, it is the ABI.

Linux still needs to work (nicely) with older Xen's in the world, and we
can't just retrofit a change in the hypervisor which says "btw, this ABI
we've just changed now has a side effect of modifying a field that you
also logically own".

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.