From: Pranjal Shrivastava <praan@google.com>
To: Daniel Mentz <danielmentz@google.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Mostafa Saleh <smostafa@google.com>,
Nicolin Chen <nicolinc@nvidia.com>,
iommu@lists.linux.dev, Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v4 1/3] iommu/arm-smmu-v3: Introduce struct arm_smmu_event
Date: Tue, 12 Nov 2024 00:52:06 +0000 [thread overview]
Message-ID: <ZzKmth5__xVUme1P@google.com> (raw)
In-Reply-To: <CAE2F3rAL=a43NNK30omCyfKZR=_Gp2cNxHuUMcDd-xHN-Kvv=A@mail.gmail.com>
On Mon, Nov 11, 2024 at 02:20:46PM -0800, Daniel Mentz wrote:
> On Thu, Nov 7, 2024 at 6:57 AM Pranjal Shrivastava <praan@google.com> wrote:
> >
> > On Wed, Nov 06, 2024 at 04:16:19PM -0800, Daniel Mentz wrote:
> > > On Fri, Oct 18, 2024 at 11:00 AM Pranjal Shrivastava <praan@google.com> wrote:
> > > >
> > > > Introduce `struct arm_smmu_event` to represent event records.
> > > > Parse out relevant fields from raw event records for ease and
> > > > use the new `struct arm_smmu_event` instead.
> > > >
> > > > Signed-off-by: Daniel Mentz <danielmentz@google.com>
> > > > Signed-off-by: Pranjal Shrivastava <praan@google.com>
> > > > ---
> > >
> > > > +struct arm_smmu_event {
> > > > + struct arm_smmu_device *smmu;
> > > > + u8 id;
> > > > + u8 class;
> > > > + u16 stag;
> > > > + u32 sid;
> > > > + u32 ssid;
> > > > + u64 iova;
> > > > + u64 ipa;
> > > > + u64 raw[EVTQ_ENT_DWORDS];
> > >
> > > Consider removing the member named raw from struct arm_smmu_event.
> > > Compare this with struct arm_smmu_cmdq_ent and
> > > arm_smmu_cmdq_build_cmd() which keep the encoded and decoded versions
> > > separate.
> >
> > I had a similar implemntation in v3 [1] but it was decided [2]
> > to keep the "raw" event array within arm_smmu_event itself. Since
> > otherwise we'd have two variables, one pointing to the other when they
> > have the exact same scope and lifetime anyway.
>
> I understand that the concern in [2] was that "one [is] pointing to
> the other". At the time, I think you had a pointer in struct
> arm_smmu_event named raw, and the feedback was to embed the raw event
> data in the structure instead of having a pointer. What I'm proposing
> is to neither have a pointer nor embed it in the struct.
>
> >
> > Do we have a strong preference here?
>
> Not a strong preference, but I'd prefer to have the raw event and the
> decoded event separate.
>
I see. So, do you suggest that we should have the raw print as it is and
then the pretty print separately like the following:
---------------------------------------->8------------------------------------
while (!queue_remove_raw(q, raw_evt)) {
arm_smmu_decode_event(raw_evt, &evt);
if (arm_smmu_handle_evt(smmu, &evt)) {
dev_err(smmu->dev, "event 0x%02x received:\n", event->id);
for (i = 0; i < EVTQ_ENT_DWORDS; ++i)
dev_err(smmu->dev, "\t0x%016llx\n", raw_evt[i]);
arm_smmu_dump_event(smmu, &evt, &rs);
}
put_device(evt.dev);
cond_resched();
}
---------------------------------------->8------------------------------------
OR should we pass the raw event to the dump_event function which, I
believe, is a little duplicative:
---------------------------------->8-----------------------------
while (!queue_remove_raw(q, raw_evt)) {
arm_smmu_decode_event(raw_evt, &evt);
if (arm_smmu_handle_evt(smmu, &evt))
arm_smmu_dump_event(smmu, &evt, raw_evt, &rs);
put_device(evt.dev);
cond_resched();
}
---------------------------------->8-----------------------------
> >
> > >
> > > > + bool stall;
> > > > + bool ssid_valid;
> > > > + bool privileged;
> > > > + bool instruction;
> > > > + bool s2;
> > > > + bool read;
> > > > +};
> >
> > Thanks,
> > Praan
> >
> > [1] https://lore.kernel.org/all/20240928005143.2378938-2-praan@google.com/
> > [2] https://lore.kernel.org/all/5eda3ba6-c35a-432b-be87-48bd8a0a3bf1@arm.com/
next prev parent reply other threads:[~2024-11-12 0:52 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 18:00 [PATCH v4 0/3] iommu/arm-smmu-v3: Parse out event records Pranjal Shrivastava
2024-10-18 18:00 ` [PATCH v4 1/3] iommu/arm-smmu-v3: Introduce struct arm_smmu_event Pranjal Shrivastava
2024-10-19 1:56 ` Nicolin Chen
2024-10-21 6:20 ` Pranjal Shrivastava
2024-10-24 13:11 ` Will Deacon
2024-10-24 14:20 ` Pranjal Shrivastava
2024-10-24 17:02 ` Pranjal Shrivastava
2024-10-24 17:03 ` Jason Gunthorpe
2024-10-24 17:37 ` Pranjal Shrivastava
2024-10-28 12:23 ` Jason Gunthorpe
2024-10-28 14:46 ` Pranjal Shrivastava
2024-11-04 17:23 ` Daniel Mentz
2024-11-04 18:16 ` Pranjal Shrivastava
2024-11-04 18:19 ` Pranjal Shrivastava
2024-11-01 14:41 ` Robin Murphy
2024-11-01 15:08 ` Pranjal Shrivastava
2024-11-04 5:25 ` Daniel Mentz
2024-11-04 8:31 ` Pranjal Shrivastava
2024-11-07 0:10 ` Daniel Mentz
2024-11-07 14:33 ` Pranjal Shrivastava
2024-11-07 0:16 ` Daniel Mentz
2024-11-07 14:57 ` Pranjal Shrivastava
2024-11-11 22:20 ` Daniel Mentz
2024-11-12 0:52 ` Pranjal Shrivastava [this message]
2024-11-12 4:01 ` Daniel Mentz
2024-11-12 8:12 ` Pranjal Shrivastava
2024-10-18 18:00 ` [PATCH v4 2/3] iommu/arm-smmu-v3: Log better event records Pranjal Shrivastava
2024-10-19 2:06 ` Nicolin Chen
2024-10-19 4:51 ` Nicolin Chen
2024-10-21 6:29 ` Pranjal Shrivastava
2024-10-21 6:26 ` Pranjal Shrivastava
2024-10-21 22:53 ` Nicolin Chen
2024-10-24 13:15 ` Will Deacon
2024-10-24 14:14 ` Pranjal Shrivastava
2024-10-29 18:53 ` Will Deacon
2024-10-29 19:59 ` Pranjal Shrivastava
2024-10-24 19:00 ` Nicolin Chen
2024-10-29 18:49 ` Will Deacon
2024-11-01 15:05 ` Robin Murphy
2024-11-01 16:06 ` Pranjal Shrivastava
2024-11-04 6:36 ` Daniel Mentz
2024-11-04 10:51 ` Pranjal Shrivastava
2024-10-18 18:00 ` [PATCH v4 3/3] iommu/arm-smmu-v3: Avoid redundant master lookup in events Pranjal Shrivastava
2024-10-19 2:08 ` Nicolin Chen
2024-10-19 1:45 ` [PATCH v4 0/3] iommu/arm-smmu-v3: Parse out event records Nicolin Chen
2024-10-21 6:33 ` Pranjal Shrivastava
2024-10-21 22:51 ` Nicolin Chen
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=ZzKmth5__xVUme1P@google.com \
--to=praan@google.com \
--cc=danielmentz@google.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=smostafa@google.com \
--cc=will@kernel.org \
/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