Re: [PATCH v2 08/17] x86/hyperv: handling hypercall page setup for root

From: Vitaly Kuznetsov
Date: Fri Nov 13 2020 - 11:16:32 EST


Wei Liu <wei.liu@xxxxxxxxxx> writes:

> On Fri, Nov 13, 2020 at 03:33:33PM +0000, Wei Liu wrote:
>> On Thu, Nov 12, 2020 at 04:51:09PM +0100, Vitaly Kuznetsov wrote:
>> > Wei Liu <wei.liu@xxxxxxxxxx> writes:
>> >
>> > > When Linux is running as the root partition, the hypercall page will
>> > > have already been setup by Hyper-V. Copy the content over to the
>> > > allocated page.
>> > >
>> > > The suspend, resume and cleanup paths remain untouched because they are
>> > > not supported in this setup yet.
>> >
>> > What about adding BUG_ONs there then?
>>
>> I generally avoid cluttering code if I'm sure it definitely does not
>> work.
>>
>> In any case, adding BUG_ONs is not the right answer. Both hv_suspend and
>> hv_resume can return an error code. I would rather just do
>>
>> if (hv_root_partition)
>> return -EPERM;
>>
>> in both places.
>
> Correction: hv_resume is void, so I won't add that code snippet. But we
> should still be fine because hv_suspend will have already failed in the
> first place.
>

Works for me. I just very much prefer to get reports like "system
doesn't go to sleep" instead of "something crashes when I put my system
to sleep")

--
Vitaly