Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 2026 10:52:58 +0000
From:      Sarah Walker <Sarah.Walker2@arm.com>
To:        Jessica Clarke <jrtc27@freebsd.org>, Andrew Turner <andrew@FreeBSD.org>
Cc:        "src-committers@FreeBSD.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@FreeBSD.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@FreeBSD.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 1d13d938fe6c - main - virtio: Ensure power-of-two alignment for indirect queue
Message-ID:  <AS1PR08MB7636583C512ACE4769EA10F5B84BA@AS1PR08MB7636.eurprd08.prod.outlook.com>
In-Reply-To: <52B83EF2-4427-44ED-8486-B513189DA4AA@freebsd.org>
References:  <69b939d7.26113.1aca36de@gitrepo.freebsd.org> <8F587FE2-CF54-4605-9CD6-581FC1D98D34@freebsd.org> <52B83EF2-4427-44ED-8486-B513189DA4AA@freebsd.org>

index | next in thread | previous in thread | raw e-mail

On 17 Mar 2026, at 11:34, Jessica Clarke <jrtc27@freebsd.org> wrote:
>
> On 17 Mar 2026, at 11:24, Andrew Turner <andrew@freebsd.org> wrote:
>>
>> The branch main has been updated by andrew:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=1d13d938fe6c7639d2bb4cb5248a1f81275b6891
>>
>> commit 1d13d938fe6c7639d2bb4cb5248a1f81275b6891
>> Author:     Sarah Walker <sarah.walker2@arm.com>
>> AuthorDate: 2026-03-17 10:54:30 +0000
>> Commit:     Andrew Turner <andrew@FreeBSD.org>
>> CommitDate: 2026-03-17 10:56:27 +0000
>>
>>   virtio: Ensure power-of-two alignment for indirect queue
>>
>>   Some platforms enforce power-of-two alignment for bus_dma tags. Rounding up
>>   the natural size may result in over-alignment, but should be safe.
>>
>>   PR:             293770
>>   Reviewed by:    andrew
>>   Fixes:          c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations")
>>   Sponsored by:   Arm Ltd
>>   Differential Revision:  https://reviews.freebsd.org/D55843
>> ---
>> sys/dev/virtio/virtqueue.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c
>> index b7fdb4703ccb..10b5179bd3d5 100644
>> --- a/sys/dev/virtio/virtqueue.c
>> +++ b/sys/dev/virtio/virtqueue.c
>> @@ -341,7 +341,7 @@ virtqueue_init_indirect(struct virtqueue *vq, int indirect_size)
>> align = size;
>
> Why is this the alignment in the first place? Pre-busdma it just used
> malloc with no explicit alignment. Given:
>
>  size = indirect_size * sizeof(struct vring_desc);
>
> can’t this get quite large? Except VIRTIO_MAX_INDIRECT looks to be
> rather stale, tied to the malloc rather than busdma world…

Apologies, I was playing safe with the alignment. I've opened a review at https://reviews.freebsd.org/D56038 to change it to align to a single descriptor (16 bytes).

Sarah
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AS1PR08MB7636583C512ACE4769EA10F5B84BA>