Re: [PATCH] KVM x86: Handle hypercalls for assigned PCI devices

Muli Ben-Yehuda
2008-04-30T06:05:13Z

On Wed, Apr 30, 2008 at 01:48:38AM +0300, Avi Kivity wrote:
> Amit Shah wrote:
>>
>>>> + if (is_error_page(host_page)) {
>>>> + printk(KERN_INFO "%s: gfn %p not valid\n",
>>>> + __func__, (void *)page_gfn);
>>>> + r = -1;
>>>>
>>> r = -1 is not really informative. Better use some meaningful error.
>>>
>>
>> The error's going to the guest. The guest, as we know, has already
>> done a successful DMA allocation. Something went wrong in the
>> hypercall, and we don't know why (bad page). Any kind of error here
>> isn't going to be intelligible to the guest anyway. It's mostly a
>> host thing if we ever hit this.
>>
>
> If the guest is not able to handle it, why bother returning an
> error? Better to kill it.
>
> But in any case, -1 is not a good error number.

The guest should be able to deal with transient DMA mapping errors,
either by retrying, or quiescing the device. This is in line with how
HW IOMMUs work - they may run out of mappings for example and the
driver should be able to cope with it. Killing the guest is a last
resort.

Cheers,
Muli

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.