Skip to contentSkip to conversation

trouble with the new mmap-batch interface

DISCUSSION Brendan Cully 3 participants 8 messages Jan 20, 2010 – Jan 21, 2010

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm having some trouble with the new mmap-batch ioctl. With ioemu revision a0066d "use new (replacement) mmap-batch ioctl" applied, my HVM domain dies as soon as it is unpaused. The first suspicious line in xm dmesg is

(XEN) HVM3: - REP INSB across page boundaries ... Bad value at 0x005ffffc: saw 00000000 e (XEN) HVM3: xpected ff000000
(XEN) HVM3: Bad value at 0x00601000: saw 00000000 expected 000000ff
(XEN) HVM3: failed

and the qemu log ends at
cirrus vga map change while on lfb mode

If I revert to ioemu 3b531c "passthrough: fix a printf format specifier" then the INSB test passes and the domain runs fine.

I'm running 32-bit 2.6.18.8 dom0 (984:0bec29c94ce9), 32-bit HVM guest, and 64-bit xen (Tue Jan 19 15:44:54 2010 +0000 20824:07f95839e431)

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

Thanks,
Brendan

#1 lore raw
Quoted 5 lines · Brendan Cully

(XEN) HVM3: - REP INSB across page boundaries ... Bad value at 0x005ffffc:
saw 00000000 e
(XEN) HVM3: xpected ff000000
(XEN) HVM3: Bad value at 0x00601000: saw 00000000 expected 000000ff (XEN) HVM3: failed

Failing during hvmloader early regression tests. You could comment out hvmloader.c:perform_tests() to see whether this problem is at least somewhat specific to the test, or whether things are much more generally broken.

Quoted 2 lines

I'm running 32-bit 2.6.18.8 dom0 (984:0bec29c94ce9), 32-bit HVM guest, and 64-bit xen (Tue Jan 19 15:44:54 2010 +0000 20824:07f95839e431)

It's working for me, albeit running 64-bit 2.6.18.8 dom0.

-- Keir

#2 lore raw
In reply to Brendan Cully
Quoted 18 lines · Brendan Cully

Hi all,

I'm having some trouble with the new mmap-batch ioctl. With ioemu revision a0066d "use new (replacement) mmap-batch ioctl" applied, my HVM domain dies as soon as it is unpaused. The first suspicious line in xm dmesg is

(XEN) HVM3: - REP INSB across page boundaries ... Bad value at 0x005ffffc: saw 00000000 e (XEN) HVM3: xpected ff000000
(XEN) HVM3: Bad value at 0x00601000: saw 00000000 expected 000000ff
(XEN) HVM3: failed

and the qemu log ends at
cirrus vga map change while on lfb mode

If I revert to ioemu 3b531c "passthrough: fix a printf format specifier" then the INSB test passes and the domain runs fine.

Quoted 6 lines

I'm running 32-bit 2.6.18.8 dom0 (984:0bec29c94ce9), 32-bit HVM guest, and 64-bit xen (Tue Jan 19 15:44:54 2010 +0000 20824:07f95839e431)

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

The attached patch fixes ioemu for me.

# HG changeset patch
# User Brendan Cully <[email protected]>
# Date 1264023273 28800
# Node ID fe58c98dd43f370b5461e3ad451b2520dd6b9e2e # Parent b0b41e735575ec6fc1d7d56f3cffa9246058881a
xc_map_foreign_bulk: unconditionally prezero error array

MMAPBATCH_V2 does not touch the array unless a mapping fails, so it is up to the caller to zero it before making the ioctl.

tools/libxc/xc_linux.c +3 -0
@@ -159,6 +159,9 @@
     ioctlx.arr = arr;
     ioctlx.err = err;
 
+    if (num > 0)
+        memset(err, 0, sizeof(*err) * num);
+
     rc = ioctl(xc_handle, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
 
     if ( rc < 0 && errno == ENOENT )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 5 lines · Brendan Cully
Quoted 3 lines

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

The attached patch fixes ioemu for me.

So the issue is that the kernel only writes back the err array if there was at least one failure in the batch. Given the alternative is pre-zeroing the array, shouldn't we just unconditionally copy back the array, even if it is all zeroes?

Jan: Is it in fact a bug, because IOCTL_PRIVCMD_MMAPBATCH is similarly structured (but legitimately, in that case)?

-- Keir

#4 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Keir Fraser <[email protected]> 20.01.10 22:54 >>>

Quoted 5 lines · Brendan Cully
Quoted 3 lines

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

The attached patch fixes ioemu for me.

Quoted 7 lines

So the issue is that the kernel only writes back the err array if there was at least one failure in the batch. Given the alternative is pre-zeroing the array, shouldn't we just unconditionally copy back the array, even if it is all zeroes?

Jan: Is it in fact a bug, because IOCTL_PRIVCMD_MMAPBATCH is similarly structured (but legitimately, in that case)?

Generally I intended the caller to zero the array. If that's not a good idea, I can certainly put together patches (linux and libxc) that remove that assumption. If you'd like to leave the assumption in, then c/s 20822 (fixing domain save) will also need another adjustment (using realloc() inside the loop doesn't seem very nice anyway - allocating the array where the other two arrays get allocated would be more consistent).

Jan

#5 lore raw
Quoted 6 lines · Jan Beulich
Quoted 2 lines

Jan: Is it in fact a bug, because IOCTL_PRIVCMD_MMAPBATCH is similarly structured (but legitimately, in that case)?

Generally I intended the caller to zero the array. If that's not a good idea, I can certainly put together patches (linux and libxc) that remove that assumption.

Well I think it's a bad idea. I can't imagine the saved copy_to_user() is significantly expensive, and it makes the interface a bit confusing but in a way that sometimes still works and then sometimes fails. So please make some patches.

Quoted 4 lines

If you'd like to leave the assumption in, then c/s 20822 (fixing domain save) will also need another adjustment (using realloc() inside the loop doesn't seem very nice anyway - allocating the array where the other two arrays get allocated would be more consistent).

You can make this consistent in a separate patch, if you like.

-- Keir

#6 lore raw
In reply to Brendan Cully
Quoted 5 lines · Brendan Cully
Quoted 3 lines

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

The attached patch fixes ioemu for me.

Hopefully Jan's patch to dom0 kernel (now applied to linux-2.6.18-xen.hg) should also fix your problem.

-- Keir

#7 lore raw
Quoted 10 lines · Keir Fraser
Quoted 5 lines · Brendan Cully
Quoted 3 lines

It seems unlikely to me that this is actual breakage, but I've built world a couple of times. Before I put printfs everywhere I thought I'd ask if anyone else had seen this or had any ideas.

The attached patch fixes ioemu for me.

Hopefully Jan's patch to dom0 kernel (now applied to linux-2.6.18-xen.hg) should also fix your problem.

Yes, with that and the other two patches from me (also applied), HVM migration is working again.