Re: Some support for VirtIO when running NetBSD/alpha in Qemu

Jason Thorpe <[email protected]> Mon, 20 Nov 2023 05:44:01 -0800
Newsgroups gmane.os.netbsd.ports.alpha
Message-ID <[email protected]>
> On Nov 19, 2023, at 11:46 PM, Andreas Gustafsson <[email protected]> wrote:
> 
> Jason Thorpe wrote:
>> I’m hoping that this will avoid the issues that releng has seen
>> trying to use NetBSD/alpha in Qemu in the automated test machinery
>> (issues with cmdide that I haven’t been able to reproduce).
> 
> That's http://gnats.netbsd.org/56434, in case someone wants to look
> into it.  I would really rather see this fixed than worked around.

Looking at the analysis you did:

<quote>
   (gdb) print prd
$19 = {addr = 2209223277, size = 3475}
[...]
(gdb) print prd
$20 = {addr = 2210054144, size = 2147488365}

where the latter size is 4717 ORed with a flag bit in the MSB.

The segments do sum to the right size (3475 + 4717 = 8192), but
since their sizes are odd and rounded down to even in

len = prd.size & 0xfffe;

the resulting total size is 2 bytes short.
</quote>

What this is a DMA segment that starts at an odd boundary (0x83ae126d) and has an odd number of bytes (0xd93) to reach the end of the page (0x83ae2000).  The remainder of the 8K buffer (in virtual space) starts on a different physical page (0x83bac000).

Whether or not Qemu is correct in forcing the length to be even, it’s pretty clear that “someone” is playing fast and loose with buffer alignment and physio … In any case, I should be able to write a simple reproducer … but ultimately the result of that is going to be “return a rational error from the IDE driver rather than let the chip flake out”.  I guess someone is going to have to track down the real problem in sysinst (from the logs it looks like something is going on with disk partitioning).

-- thorpej