[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>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jane Malalane <Jane.Malalane@xxxxxxxxxx>
- Date: Mon, 25 Jul 2022 10:03:39 +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=6Lt2GgxNPsKiOQY6yDwIBYB4wb+bQmMpmZwN5uWlm2Q=; b=bCDQjsunsU8HtuxF+AAYxy+Wj5LfTEgx0DDQpB+rlooNqMqlcbSIaaaKQuEQjjrMAXktU3Y+i5YoUBWvIYD8rpXipPx3aXgBP8ouRCl03fHn4W0IpQJ7thtwYTOOAAogm6CZkQngAnb27wyZ8YB77j8WlmibuvSZEBpS2RjsvnHSY1AzwwdOflK464TkO7PblZwtJL/NoVI1HuqRNHAmI0d+3hAXhx5yds+TzeS7GYN7cLMxkXJVuJw6EtujVy3CBe5oUSoYltuZ6YnFLAkwdCh+H8nTZ6GEUvpSOoxYdf1wvYJNxKjCkHKfnDsILaNExnbFj9Mdkjf/yxpJb24+ow==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEXdpcaoJisglOJeG5MBQHtJq3pnd8UBLNMNXZmIdBp4qsvJnUh2FtlDhWKEnh1kAlfdNWyve8bYsclb1DzXR7NCqXWXpgThbFnLZ1gZmZmAOcDZ/8c9A0IVCVtcOtN7s2scjiW7l0pj2D8Ldys1gzD1PEXxohlhEZQSrjZgk7BJGTWPSOkHEt79g9w34Rbhg9AIg7bs7X0ReOJ/46EIBEErAyRCHpeIkWgpql7wsrH715wzGwg9S+7h4gprrwGn/hDlhHytq5dAokA4eRjxmxf0FRqA4pI6bV1hWK/IyOLfUcqYJ18+wiJ4gselplxYEQptxYBvCJs0XuW6KJLSDQ==
- 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>
- Delivery-date: Mon, 25 Jul 2022 10:04:05 +0000
- Ironport-data: A9a23:T64oFK3G0IIG9H55q/bD5f9xkn2cJEfYwER7XKvMYLTBsI5bpzIBn GMZW22POavfYzakfo1za9njp04H78PdytA2TlY5pC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOKn9RGQ7InQLpLkEunIJyttcgFtTSYlmHpLlvUwx4VlmrBVOSvU0 T/Ji5CZaQTNNwJcaDpOsfrc8k435ZwehRtD1rAATaET1LPhvyF94KI3fcmZM3b+S49IKe+2L 86rIGaRpz6xE78FU7tJo56jGqE4aue60Tum0xK6b5OKkBlazhHe545gXBYqheW7vB3S9zx54 I0lWZVd0m7FNIWU8AgWe0Ew/y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yRu19b/TCXGjr1kjegIK5Y1n3X nOkgT/6Knmmeq80AXg22ja6IkTsMf9y+FEGNeHhqEuW3TRY0eTFcRcso+5zXIISdKUmRMXeR 730lMd1vFImjDsl6eO0FzQMkfboXATAjTZuCKlaDPY0LDErXQBeoV8bMtiA2Tkwltls9dm3K 1R2WWF85JREBPbhSz4o8PFThdwiyOP0AwfeMMo/ghiuLElGchshJ1a+FkQHIYLHSr85oxiGO 5yDNvE7PITdV+BdXjWsmRm3dTpBx0Ib1+7a1lHvtbQ3yldnXh/wUddzMsDnm0Y/JZ4T5Vf/e zLPqlhibkLRM4LaqB2AvsHXKKMeyXwaAOJNHjXLUXsFakBNX6Io5nr4K8t7OXvY5AMxItaou W1bLqZjx9BR6vDM7z+4HQQyGGyfIyUZ0Wc9uhOo55kp7b7WL3ndSWeVVFGqbrSn8ki
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYlTod5hgtPAUSGEuMopkQlGVYGq189b0AgAImowCAABm4gIAAOBkAgARvxACAAFS4gIAKvnyA
- 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?
>
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)
Thank you,
Jane.
|