On 16/08/15 13:08, Antti Kantee wrote:
> On 16/08/15 00:40, Robert Millan wrote:
>>
>> Hi,
>>
>> Currently the intrthread loop just checks the number of bytes read, but
>> a quick peek at the Linux source shows that /dev/uioX has a few failure
>> conditions. Attached patch tries to do a better job at detecting and
>> reporting them.
>
> The hypercalls shouldn't include that level of policy. Can you adjust the
> patch to return an error instead of the hypercall deciding to nuke the entire
> program?
I figured you might say that ;-)
Here. Keep in mind, though, when this message pops up it becomes _very_ verbose.
--
Robert Millan
Index: rumpkernel-0~20150715/pci-userspace/src-linux-uio/pci_user-uio_linux.c
===================================================================
--- rumpkernel-0~20150715.orig/pci-userspace/src-linux-uio/pci_user-uio_linux.c 2015-07-23 22:57:29.000000000 +0200
+++ rumpkernel-0~20150715/pci-userspace/src-linux-uio/pci_user-uio_linux.c 2015-08-16 02:25:40.778896737 +0200
@@ -187,6 +187,7 @@
struct irq *irq = arg;
const unsigned device = irq->device;
int val;
+ int ret;
rumpuser_component_kthread();
for (;;) {
@@ -196,7 +197,10 @@
val &= ~0x400;
rumpcomp_pci_confwrite(0, device, 0, 0x04, val);
}
- if (read(irq->fd, &val, sizeof(val)) > 0) {
+ ret = read(irq->fd, &val, sizeof(val));
+ if (ret == -1) {
+ warn("read from UIO device %d", irq->device);
+ } else if (ret > 0) {
//printf("INTERRUPT!\n");
rumpuser_component_schedule(NULL);
irq->handler(irq->data);