All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Rishi Chhibber <rishi.chhibber@broadcom.com>,
	arnd@arndb.de, linux-kernel@vger.kernel.org,
	ajay.kaher@broadcom.com, alexey.makhalov@broadcom.com,
	vamsi-krishna.brahmajosyula@broadcom.com, yin.ding@broadcom.com,
	tapas.kundu@broadcom.com
Subject: Re: [PATCH v2] misc: vmw_zerocopy: Add VMware zero-copy buffer sharing driver
Date: Fri, 19 Jun 2026 16:12:45 +0100	[thread overview]
Message-ID: <20260619161245.031681e5@pumpkin> (raw)
In-Reply-To: <2026061913-reattach-prowling-503a@gregkh>

On Fri, 19 Jun 2026 07:10:33 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:

> On Thu, Jun 18, 2026 at 11:10:34AM -0700, Rishi Chhibber wrote:
> > +/*
> > + * Used for sending user buffer.
> > + * Either is optional but not both.
> > + *
> > + * Pointers are __u64 so the struct layout is identical on 32-bit and 64-bit
> > + * userspace, avoiding a compat_ioctl handler. Use u64_to_user_ptr() in the
> > + * driver to convert back to a __user pointer.
> > + */
> > +struct vmw_zc_guest_data {
> > +	__u64 buffer;
> > +	__u32 buffer_length;
> > +	__u64 metadata;
> > +	__u32 metadata_length;
> > +} __packed;  
> 
> You have an unaligned metadata pointer here in the structure, are you
> sure that's a good idea?  Or can you not change that anymore?

The compiler is going to assume the whole thing can be misaligned.

Possibly:

> > +struct vmw_zc_guest_data {
> > +	__u64 buffer;
> > +	__u32 buffer_length;
> > +	__u64 metadata __packed;
> > +	__u32 metadata_length;
> > +};  

which just removes the pad before 'metadata' while leaving
the structure itself aligned.
The compiler will then only use two 32bit accesses for metadata
instead of byte accesses for all the structure members.

-- David

  reply	other threads:[~2026-06-19 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 20:31 [PATCH] misc: vmw_zerocopy: Add VMware zero-copy buffer sharing driver Rishi Chhibber
2026-06-18 10:26 ` Greg KH
2026-06-18 18:10 ` [PATCH v2] " Rishi Chhibber
2026-06-19  5:08   ` Greg KH
2026-06-19  5:10   ` Greg KH
2026-06-19 15:12     ` David Laight [this message]
2026-06-19 18:27 ` [PATCH] " Rishi Chhibber
2026-06-20  5:04   ` Greg KH
2026-06-20  5:06     ` Greg KH

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=20260619161245.031681e5@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=ajay.kaher@broadcom.com \
    --cc=alexey.makhalov@broadcom.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rishi.chhibber@broadcom.com \
    --cc=tapas.kundu@broadcom.com \
    --cc=vamsi-krishna.brahmajosyula@broadcom.com \
    --cc=yin.ding@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.