Re: [PATCH] QEMU-KVM: MCE: Relay UCR MCE to guest

Anthony Liguori
2009-09-08T13:07:56Z

Huang Ying wrote:
> I find there is already a function named qemu_ram_addr_from_host which
> translate from user space virtual address into qemu RAM address. But I
> need function to return a error code instead of abort in case of no RAM
> address corresponding specified user space virtual address. So I plan to
> use following code to deal with that.
>
> int do_qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr);
> ram_addr_t qemu_ram_addr_from_host(void *ptr);
>
> Does this follow the coding style of qemu?
>

I don't like the do_ prefix much but I don't have a better suggestion.

>> If the instruction gets skipped, we may be leaking host memory because
>> the access never happened.
>>
>
> There are two kinds of recoverable MCE named SRAO (Software Recoverable
> Action Optional) and SRAR (Software Recoverable Action Required). For
> your example, it is a SRAR error. Where kernel will munmap the error
> page and send SIGBUS to qemu via force_sig_info, which will unblock
> SIGBUS and reset its action to SIG_DFL, so qemu will be terminated.
>
> If the guest mode is interrupted, because signal mask processing of KVM
> kernel part, SIGBUS can be captured by qemu.
>
Ah, I didn't realize this path just worked.

--
Regards,

Anthony Liguori