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

Re: [Xen-devel] [PATCH RFC v3 2/2] x86/emulate: Send vm_event from emulate

>>> On 07.05.19 at 13:45, <aisaila@xxxxxxxxxxxxxxx> wrote:
> On 08.04.2019 18:32, Jan Beulich wrote:
>>>>> On 06.02.19 at 13:53, <aisaila@xxxxxxxxxxxxxxx> wrote:
>>> First we try to send a vm event and if the event is sent then emulation
>>> returns X86EMUL_ACCESS_EXCEPTION. If the event is not sent then the
>>> emulation goes on as expected.
>> The meaning of this new emulator return value needs explanation.
>> I notice its #define is also not accompanied by any comment. And
>> any addition of a new emulator return code should come with a
>> discussion of how existing users are affected. I'm not going to
>> exclude that indeed no other adjustments are necessary, but that's
>> far from obvious. You may recall that it had taken several iterations
>> to get the addition of X86EMUL_UNIMPLEMENTED right throughout
>> the code base.
> This new feature is activated by "bool send_event" when calling 
> hvm_emulate_one_vm_event(). Events will be sent in specific moments and 
> only if it's an intention for that.

That's understood. But the various emulation code paths _all_
need to be aware of this potential new return value nevertheless.
Even if some may not be reachable today in the specific case of
the new feature being active, they may become reachable eventually,
and no-one would notice the omission at that point.

>>> @@ -530,6 +532,55 @@ static int hvmemul_do_mmio_addr(paddr_t mmio_gpa,
>>>       return hvmemul_do_io_addr(1, mmio_gpa, reps, size, dir, df, ram_gpa);
>>>   }
>>> +static bool hvmemul_send_vm_event(paddr_t gpa, unsigned long gla, gfn_t 
>>> gfn,
>>> +                                  uint32_t pfec, struct hvm_emulate_ctxt 
>>> *ctxt)
>> Why both gpa and gfn?
> If the gpa can be calculated from gfn then the code will be simplified.
> Is this what you had in mind?
> gpa = gfn_to_gaddr(gfn);

The other way around actually, as the calculation you suggest
discards bits (the low 12 ones).


Xen-devel mailing list



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