[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>
- From: Jane Malalane <Jane.Malalane@xxxxxxxxxx>
- Date: Tue, 26 Jul 2022 12:54:00 +0000
- Accept-language: 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=dFaRabSKndev9DC9KfboEKdbF9TpCd7ahiXeOQrGxsk=; b=U+Uk173QCwfYckb+DCxESdr2vUbQ1+V1Sx7/a5oYYIHwiI5kjIFrsXoE971cVGE6qeTeTgvyrwO0xk/xXIH0bKZsuwDh2gbotlj9Wbz0MngT/UG+kuu2JCpGVxlLK2roqBWS9i5ICiUkTVb5P+eoAi8ESw4DtDg0Lw4V+k8WfXu2e0P+6OEP8fqv8vFyqllRcdLQVlYGuJL4h2sWgMMxl45IYWBT2mZjTzVpm1Pguv6LaTVaumwR5tSveFKPSWeYpybcd0D4JaO+WgmcugSVe/nbBB6xVs6+j8Vl3aUL+klJSpbWGPfkFKTc9SSJp0nozbOFmRddicTXZyHttRTbHQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AqknwbAQx3Nz1DAKkG5TZQaYNDcgKQ63lC8i3kPP1vftDQrvPjqOIKQLMwWkvmM1OIjMnM4A/K8nHRyUAu/RgfUrKpKfl2v/OwbBEW6dHSHCBkmSyNrUwbJQm1FwmX64WzuMJ8bmZRnrcoybPXkRVFEDr2br+FSs0WsAj6ueUsndh3apVBsthuHYryb8R8V+y0JoEN9uSaY5k+tUAUWQwu4qGUh9pThbOFuR/NAvbPQhM2v2+NoWSWmkiswhX4DJtXcAdl+7dof0ZRKpF4AF3xBms6d3q6xq83Gz/9JsdOsMR/LCxe9quCPpEsIqgnP2/TltC6Cy5+BZqgVuTlAxIA==
- 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>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 26 Jul 2022 12:54:25 +0000
- Ironport-data: A9a23:kGEYoKu2DWOwSwSvhNlrJ3A/h+fnOphVZqnMB8mfNqXej3nJ3QvKv2leTKMbkwGeOzwh8WQpuxkUZlUow8LJOHL7U+NTZM7qJn8VHBlAg2A48ibQR3P6SI370Km1TSmZBW3y2k3ZCnoXK1cNFikj83MAtXxxo8+Y4up2pc+6+s4zPv8AG+C1OfKjAOt5z5f9fvgUpZumOr9CtYNSASi8cNTQOhJABq/qblXiaTWknx6JFtSlN6bSgbYvlBnN3YQacKHDSj9ImolLw3WqSWQyzOTbStNuO+Q578XZLFE4g8dXKo8dfDUvaXErAc2G1SGQ6y5cJj6TTKxdRPDDr7IjIx2PUCy9V5KLXWB/gaxuReT5fe4NBGpLWYSCzOLer8dRexH2wL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PHwBt2zw3HCtqzkn+TjVcs1c/FRdOdQ1Ixpz1EuRJW0DEwxux0+jUWfJD0nMPg06BRlWKpSqsr9HeqI1eZqlsokDtH/9twoGhmofuIeVYU3aWbrxq/fMDngrkhUOt771WCc3RrVS/ESdKu2zpMLavm26jMSv/tTbjrXrsJGZnBEuQ5HTFwzAm8EhfbJOGEtG1ShIwR2DVYYLg9RKj95iBZcf100cE+tFWjz3pVeHvv3buEMoRn8F7S6HXYySn34bcAL8XrwC3e7XQu+v5Zc6nGVV0en8BVMrRqc73TBGCcvLSp40yJubTSX7GkdBeADo0dM4gc16tyCitCbG6OLysgdjOmg+UU81+n39KGQrGwwVtqi8LbWsOQE9EUzEVc7qU96J8o0bPse/RUTBHRb+c07cNC1DIAH+x6TomI2Vo/2dOtiK8PJdhTuspdcvwStwyIxDgDsvJEQ3mDBUlNWnUzrk9kmNcw5J5avQdHcn7Y54+u8cvHI/GcTyOcaVVaDfj0T1B8pich8nOrXtAY7FwRxxoLUw==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYlTod5hgtPAUSGEuMopkQlGVYGq189b0AgAImowCAABm4gIAAOBkAgARvxACAAFS4gIAKvnyAgACzuoCAAQ4ygA==
- Thread-topic: [PATCH] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector
On 25/07/2022 21:46, Boris Ostrovsky wrote:
>
> On 7/25/22 6:03 AM, Jane Malalane wrote:
>> 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?
>>>
>> Any other opinions on this?
>>
>> (i.e., calling xen_set_callback_via(1) after
>> HVMOP_set_evtchn_upcall_vector OR not exposing this to guests and
>> instead having Xen call this function (in hvmop_set_evtchn_upcall_vector
>> maybe) and tieing its presense to XEN_HVM_CPUID_UPCALL_VECTOR which was
>> recently added)
>
>
> CPUID won't help here, I wasn't thinking clearly.
>
>
> Can we wrap the HVMOP_set_evtchn_upcall_vector hypercall in a function
> that will decide whether or not to also do xen_set_callback_via(1)?
>
Okay. Will do this in a v2.
Thanks,
Jane.
|