Page MenuHomeFreeBSD

xen/blk{front,back}: fix usage of sector sizes different than 512b
ClosedPublic

Authored by royger on Sep 23 2024, 8:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 6:58 PM
Unknown Object (File)
Wed, Nov 6, 5:10 PM
Unknown Object (File)
Wed, Nov 6, 12:05 PM
Unknown Object (File)
Tue, Nov 5, 7:55 PM
Unknown Object (File)
Tue, Nov 5, 4:31 AM
Unknown Object (File)
Sat, Nov 2, 2:42 PM
Unknown Object (File)
Sat, Nov 2, 5:42 AM
Unknown Object (File)
Fri, Nov 1, 12:28 PM
Subscribers

Details

Summary

The units of the size reported in the 'sectors' xenbus node is always 512b,
regardless of the value of the 'sector-size' node. The sector offsets in
the ring requests are also always based on 512b sectors, regardless of the
'sector-size' reported in xenbus.

Fix both blkfront and blkback to assume 512b sectors in the required fields.

The blkif.h public header has been recently updated in upstream Xen repository
to fix the regressions in the specification introduced by later modifications,
and clarify the base units of xenstore and shared ring fields.

PR: 280884
Reported by: Christian Kujau
MFC after: 1 week
Sponsored by: Cloud Software Group

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/xen/blkback/blkback.c
1157

Per style(9), the >> should be on the previous line.

3098–3099

In the kernel we typically write %ju and cast to uintmax_t rather than using PRI definitions.

sys/dev/xen/blkfront/blkfront.c
1400

1 << XBD_SECTOR_SHIFT?

royger marked 3 inline comments as done.
sys/dev/xen/blkfront/blkfront.c
367

The >> should be on the preceding line.

1400
1406

Are you missing some cleanup in this path? At a glance it looks like the busdma tag should be freed here.

sys/dev/xen/blkfront/blkfront.c
1406

Should use xenbus_dev_fatal() so the instance is transitioned to the closed state and the resources are freed.

royger marked 3 inline comments as done.
This revision is now accepted and ready to land.Oct 7 2024, 11:41 PM