[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, 25 Jul 2022 10:08:44 +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=kqItF+M2OU5sj85TVLt33ajlOHQoYByO3WX7XoCmzRM=; b=L3HxC5I4H0XpqXYpt4MfPH5d2TkHDxbwzxWja9B1Kn5TrosGzV2xQHm0qn1vEiLXh6pV65BdoBl9pP9kPpg/N31Wc8ygWiJgsI5Qi2QhRk/5nFBtWDMb8yw2DFJ5WOFtEwYnoAct6p47VQJ5JX8rUK78ZzqhNNslg/2bPlGW6uGnLqHI+/3YGEx2qKGtmO1r0IMQwhaEGq48VspD30qrHdrmCE79wTGmYon8b+LxUzbvFRJI6Plh0N+Zhxem5M1OKDSB2jD8KEHEDoacmRE/jKVFKN+Q5cI3hiOYQWBgJSXpjiHcBIEXXqCAX2uA+9vDyFqOQUQXuz9hxkWMywfjRA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LsLLPZJ38NBz+/6y+kU3QOR7VzsLR2172wwiGFGmnFRFcUVBKp/NVto0zH+JwNg8G651VKR/KIuQPVYbHHolTqNWoCbUhEvMfpVTlNUWMU4dbjsZE5gzGQAWgfEh1V6Hix45H5nPjNRDrTDmfNcyy3LHF8LF36EGc7iYTO/l9BVx6HyhTkDD4HqeZdWR5+OOQovFZgSugp2MDiz6QLLt5FBZb+fRd0byRaLhMt3v5dBmwQJnh1RimTYAT7GMcv4wQ2rKUGGaddnPihqroyRowycjSlR5sEP6Mk4YlskcOeehDMNLX8fOmNcp/1A3OefJMgHor7HYBDC6JIENIyyMMQ==
  • 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, 25 Jul 2022 10:08:55 +0000
  • Ironport-data: A9a23:/8UdA623NOLNzwVcK/bDix16xcyv+3FdZeh4A8V8DSJ0REvO9WDO3PKurZDyZGxZPOn4GStR26+fTktD0PdbNrls31Zn9NXzy/QiOsJtSRd74WGFBWcTQ9A+bv0Cw37+Nnr9lfD/IFbu2NC/edcIEQpxJrffToxuii9dqj0tfQ3QX1JvQptL27O95WOUI6kmzki68iPiwla1DT52pSSzN1PL6FFhohbynfVNOdSMN3Rn+vSxX9SMqMf36cBsfa7lM242Ftacw4mOxNPGSGODY97vpCB03QiHsAdt4Z+JEtwTsHtXPLnk2XLS7h6VCT6UggYk+kNwSu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DVgh5boRvswcda0BN2FOTtGOmkhZ0NWTHETu+ogOMxZ7mjq6tDyigejn3Qy2OhkfMevdP5RDNHkEy7hMQivgCeTH2T7A+RqRPB3CCGcx8C5yFeDVuDUelKZaKKwpyjGRHC92UMafohsqaJNeaT4d7zB66vtPazHgkn9S+I0sMb6GD3cck79kTQ+JeU2uYbCYpPs6u/X/XCsQDo2NFetJ1dPKzvwMSUeYct/gInkbia2foCDy8eI8NmpO9ejYXTkgDdIrBralqWF9QTvm1UbE1b1Qlhttf7s3B9DO29bhF25s+HwbeyhE5N27FmAb8JM6+/7UWL7zMOToY93zt1q2i9RqjGdpsSc7o+A4eQOr7zS4PHMDosEEL2+KKfdIPfdm9PPJewUGTVS9d7Z0iIizjNw625nAy5pZnp3MQtdnx5R2HWzcckdfKwf+qAe1/gsNPcPPUqPM1mf2QbLFBeTdrrslxIv3ummLzj7asNQDgz342llK+iyLTdLsLrZAXE0SkwhmhBGM/h2hlPWpcVyzP+qquLQV9VIGSGx2VqyW5dOKzub8fscDsOakPpVDc4fGYxZlL50nxX+LutNdNnVfSF+2JMzLlTEetfnfp3Mv0IwyATg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYlToncjhzapb0rEGq8Bkg0N3t9a189b0AgAImuYCAABmhgIAAOBoAgARvxACAAFS4gIAKv+oA
  • Thread-topic: [PATCH] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector

On 18/07/2022 14:59, Boris Ostrovsky wrote:
>
> On 7/18/22 4:56 AM, Andrew Cooper wrote:
>> 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".
>
>
> The hypercall has been around for a while so I understand ABI concerns
> there but XEN_HVM_CPUID_UPCALL_VECTOR was introduced only a month ago.
> Why not tie presence of this bit to no longer having to explicitly set
> the callback field?

Because that's a breaking change for ~5 years of windows drivers.

~Andrew

 


Rackspace

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