From: "Michael S. Tsirkin" <mst@redhat.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-kernel@vger.kernel.org,
"Cong Wang" <xiyou.wangcong@gmail.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Olivia Mackall" <olivia@selenic.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"Jason Wang" <jasowang@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Robin Murphy" <robin.murphy@arm.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Petr Tesarik" <ptesarik@suse.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org,
virtualization@lists.linux.dev, linux-scsi@vger.kernel.org,
iommu@lists.linux.dev, kvm@vger.kernel.org,
netdev@vger.kernel.org, "Enrico Weigelt,
metux IT consult" <info@metux.net>,
"Viresh Kumar" <vireshk@kernel.org>,
"Linus Walleij" <linusw@kernel.org>,
linux-gpio@vger.kernel.org
Subject: Re: [PATCH RFC 15/13] gpio: virtio: reorder fields to reduce struct padding
Date: Fri, 2 Jan 2026 08:02:36 -0500 [thread overview]
Message-ID: <20260102080135-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAMRc=MfWX5CZ6GL0ph1g-KupBS3gaztk=VxTnfC1QwUvQmuZrg@mail.gmail.com>
On Fri, Jan 02, 2026 at 12:47:04PM +0000, Bartosz Golaszewski wrote:
> On Tue, 30 Dec 2025 17:40:33 +0100, "Michael S. Tsirkin" <mst@redhat.com> said:
> > Reorder struct virtio_gpio_line fields to place the DMA buffers (req/res)
> > last. This eliminates the need for __dma_from_device_aligned_end padding
> > after the DMA buffer, since struct tail padding naturally protects it,
> > making the struct a bit smaller.
> >
> > Size reduction estimation when ARCH_DMA_MINALIGN=128:
> > - request is 8 bytes
> > - response is 2 bytes
> > - removing _end saves up to 128-6=122 bytes padding to align rxlen field
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/gpio/gpio-virtio.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-virtio.c b/drivers/gpio/gpio-virtio.c
> > index 32b578b46df8..8b30a94e4625 100644
> > --- a/drivers/gpio/gpio-virtio.c
> > +++ b/drivers/gpio/gpio-virtio.c
> > @@ -26,12 +26,11 @@ struct virtio_gpio_line {
> > struct mutex lock; /* Protects line operation */
> > struct completion completion;
> >
> > + unsigned int rxlen;
> > +
> > __dma_from_device_aligned_begin
> > struct virtio_gpio_request req;
> > struct virtio_gpio_response res;
> > -
> > - __dma_from_device_aligned_end
> > - unsigned int rxlen;
> > };
> >
> > struct vgpio_irq_line {
> > --
> > MST
> >
> >
>
> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thanks! There's a new API as suggested by Petr so these patches got changed,
but the same idea. Do you want me to carry your ack or you prefer to
re-review?
--
MST
next prev parent reply other threads:[~2026-01-02 13:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 10:15 [PATCH RFC 00/13] fix DMA aligment issues around virtio Michael S. Tsirkin
2025-12-30 10:15 ` [PATCH RFC 01/13] dma-mapping: add __dma_from_device_align_begin/end Michael S. Tsirkin
2025-12-31 14:01 ` Petr Tesarik
2025-12-31 14:40 ` Michael S. Tsirkin
2025-12-31 20:48 ` Michael S. Tsirkin
2026-01-02 8:14 ` Petr Tesarik
2025-12-30 10:15 ` [PATCH RFC 02/13] docs: dma-api: document __dma_align_begin/end Michael S. Tsirkin
2025-12-30 10:15 ` [PATCH RFC 03/13] dma-mapping: add DMA_ATTR_CPU_CACHE_CLEAN Michael S. Tsirkin
2025-12-30 10:15 ` [PATCH RFC 04/13] docs: dma-api: document DMA_ATTR_CPU_CACHE_CLEAN Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 05/13] dma-debug: track cache clean flag in entries Michael S. Tsirkin
2026-01-02 7:59 ` Petr Tesarik
2026-01-02 11:17 ` Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 06/13] virtio: add virtqueue_add_inbuf_cache_clean API Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 07/13] vsock/virtio: fix DMA alignment for event_list Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 08/13] vsock/virtio: use virtqueue_add_inbuf_cache_clean for events Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 09/13] virtio_input: fix DMA alignment for evts Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 10/13] virtio_scsi: fix DMA cacheline issues for events Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 11/13] virtio-rng: fix DMA alignment for data buffer Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 12/13] virtio_input: use virtqueue_add_inbuf_cache_clean for events Michael S. Tsirkin
2025-12-30 10:16 ` [PATCH RFC 13/13] vsock/virtio: reorder fields to reduce struct padding Michael S. Tsirkin
2025-12-30 16:40 ` [PATCH RFC 14/13] gpio: virtio: fix DMA alignment Michael S. Tsirkin
2026-01-02 12:46 ` Bartosz Golaszewski
2025-12-30 16:40 ` [PATCH RFC 15/13] gpio: virtio: reorder fields to reduce struct padding Michael S. Tsirkin
2026-01-02 12:47 ` Bartosz Golaszewski
2026-01-02 13:02 ` Michael S. Tsirkin [this message]
2026-01-02 13:27 ` Bartosz Golaszewski
2025-12-31 13:12 ` [PATCH RFC 00/13] fix DMA aligment issues around virtio Petr Tesarik
2025-12-31 14:42 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260102080135-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=brgl@kernel.org \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=info@metux.net \
--cc=iommu@lists.linux.dev \
--cc=jasowang@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kraxel@redhat.com \
--cc=kuba@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=martin.petersen@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=olivia@selenic.com \
--cc=pabeni@redhat.com \
--cc=pbonzini@redhat.com \
--cc=ptesarik@suse.com \
--cc=robin.murphy@arm.com \
--cc=sgarzare@redhat.com \
--cc=stefanha@redhat.com \
--cc=vireshk@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xiyou.wangcong@gmail.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).