qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org, yi.l.liu@intel.com,
	yi.y.sun@linux.intel.com
Subject: Re: [PATCH V3 4/4] intel-iommu: PASID support
Date: Mon, 17 Oct 2022 11:13:15 -0400	[thread overview]
Message-ID: <Y01xC/44lITmJtpu@x1n> (raw)
In-Reply-To: <CACGkMEt2c5jjEMJjpdRawi_L-rrgq3VWQ=DjQojFf1z6OPMLqQ@mail.gmail.com>

On Mon, Oct 17, 2022 at 03:52:46PM +0800, Jason Wang wrote:

[...]

> > > +struct vtd_iotlb_key {
> > > +    uint16_t sid;
> > > +    uint32_t pasid;
> > > +    uint64_t gfn;
> > > +    uint32_t level;
> > >  };
> >
> > Nit: maybe re-arrange it a bit?
> >
> >    struct vtd_iotlb_key {
> >        uint64_t gfn;
> >        uint32_t pasid;
> >        uint32_t level;
> >        uint16_t sid;
> >    } __attribute__((__packed__));
> >
> > "packed" should save us 6 bytes for each in this case, maybe also
> > worthwhile but not strongly as we have a limit of 1k objs.
> 
> I think it should be fine to rearrange but for 'packed', would this
> cause alignment issues that may cause troubles on some arches?

Do you mean the gfn reading can be split into 2 * 4 bytes?  Would that
still work as long as we're protected with a lock when accessing iotlb
(even though it may be slower than aligned access)?

But at least I think you're right it's not always a benefit, so no strong
opinion here to have it packed.

> 
> >
> > The name "gfn" seems a bit unfortunate - would "iova" be more suitable?  I
> > do see we used it elsewhere too, so we can also leave that for later.
> 
> Right, it has been used for VTDIOTLBEntry before this patch. If
> possible I would leave it to be done on top with a separate patch.

Definitely.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2022-10-17 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09  5:48 [PATCH V3 0/4] PASID support for Intel IOMMU Jason Wang
2022-10-09  5:48 ` [PATCH V3 1/4] intel-iommu: don't warn guest errors when getting rid2pasid entry Jason Wang
2022-10-14 15:05   ` Peter Xu
2022-10-09  5:48 ` [PATCH V3 2/4] intel-iommu: drop VTDBus Jason Wang
2022-10-09  5:48 ` [PATCH V3 3/4] intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function Jason Wang
2022-10-14 15:06   ` Peter Xu
2022-10-09  5:48 ` [PATCH V3 4/4] intel-iommu: PASID support Jason Wang
2022-10-14 16:17   ` Peter Xu
2022-10-17  7:52     ` Jason Wang
2022-10-17 15:13       ` Peter Xu [this message]
2022-10-18  6:24         ` Jason Wang

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=Y01xC/44lITmJtpu@x1n \
    --to=peterx@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yi.l.liu@intel.com \
    --cc=yi.y.sun@linux.intel.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).