From: Nicolin Chen <nicolinc@nvidia.com>
To: Pranjal Shrivastava <praan@google.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
"Robin Murphy" <robin.murphy@arm.com>,
Mostafa Saleh <smostafa@google.com>, <iommu@lists.linux.dev>
Subject: Re: [PATCH v3 2/2] iommu/arm-smmu-v3: Adopt arm_smmu_event in handlers
Date: Tue, 1 Oct 2024 15:59:54 -0700 [thread overview]
Message-ID: <Zvx+6qBY3og8lRWe@Asurada-Nvidia> (raw)
In-Reply-To: <ZvxjcpQCFM5SU9P-@google.com>
On Tue, Oct 01, 2024 at 09:02:42PM +0000, Pranjal Shrivastava wrote:
> On Mon, Sep 30, 2024 at 12:32:21PM -0700, Nicolin Chen wrote:
> > On Sat, Sep 28, 2024 at 12:51:43AM +0000, Pranjal Shrivastava wrote:
> > > mutex_lock(&smmu->streams_mutex);
> > > - master = arm_smmu_find_master(smmu, sid);
> > > - if (!master) {
> > > + event->master = arm_smmu_find_master(smmu, event->sid);
> > > + if (!event->master) {
> > > ret = -EINVAL;
> > > + event->master_name = "(unassigned sid)";
> > > goto out_unlock;
> > > }
> >
> > The PATCH-1 already did arm_smmu_find_master() to event->master in
> > arm_smmu_get_evt_info()?
> >
> > Maybe we still need a wider mutex to lock arm_smmu_get_evt_info and
> > arm_smmu_handle_evt.
> >
>
> Yea, we did, I'm wondering if we really need to read the master_name in
> arm_smmu_get_evt_info ? I mean, we can find and populate the name here
> itself under the safety of this mutex and entirely remove that lock from
> arm_smmu_get_evt_info as we anyway will dump the event after this line.
We could. I guess the two patches organized in the slightly odd
way that the arm_smmu_dump_event() gets moved around in the 2nd
patch, so things look a bit redundant after all.
I think we could do two patches like:
PATCH-1: Add struct arm_smmu_event and swap all FIELD_GETs with
the structure members.
PATCH-2: Add arm_smmu_dump_event() and put in arm_smmu_handle_evt
directly.
The master and master_name are not that necessary to be in the
arm_smmu_event. I would keep both of them as local variables in
arm_smmu_handle_evt and pass master_name in to dump().
The dev_name() returns "const char *init_name", so it'd likely
be safe to put the arm_smmu_dump_event(&event, master_name) call
outside the mutex.
> I'm not too sure if we should hold this lock for the entire duration of
> get_evt_info and handle_evt ?
It should be fine for being a mutex. Yet, shrinking its scope is
always optimal.
> Also, shall we rename it to `arm_smmu_read_evt_info` ?
I'd probably use arm_smmu_event_get_from_raw()? Trying to high-
light struct arm_smmu_event v.s. u64 evt[EVTQ_ENT_DWORDS]. Yet,
no strong feeling about that.
Thanks
Nicolin
next prev parent reply other threads:[~2024-10-01 23:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-28 0:51 [PATCH v3 0/2] Parse out event records Pranjal Shrivastava
2024-09-28 0:51 ` [PATCH v3 1/2] iommu/arm-smmu-v3: Print better events records Pranjal Shrivastava
2024-09-30 19:15 ` Nicolin Chen
2024-10-01 20:52 ` Pranjal Shrivastava
2024-10-01 23:04 ` Nicolin Chen
2024-10-02 13:57 ` Jason Gunthorpe
2024-10-02 16:55 ` Nicolin Chen
2024-10-02 17:10 ` Jason Gunthorpe
2024-10-02 17:22 ` Nicolin Chen
2024-10-03 21:26 ` Pranjal Shrivastava
2024-10-03 22:50 ` Nicolin Chen
2024-10-11 7:53 ` Pranjal Shrivastava
2024-10-11 10:02 ` Pranjal Shrivastava
2024-09-28 0:51 ` [PATCH v3 2/2] iommu/arm-smmu-v3: Adopt arm_smmu_event in handlers Pranjal Shrivastava
2024-09-30 19:32 ` Nicolin Chen
2024-10-01 21:02 ` Pranjal Shrivastava
2024-10-01 22:59 ` Nicolin Chen [this message]
2024-10-03 21:34 ` Pranjal Shrivastava
2024-10-03 22:53 ` Nicolin Chen
2024-10-11 7:55 ` Pranjal Shrivastava
2024-10-11 10:21 ` Robin Murphy
2024-10-11 10:45 ` Pranjal Shrivastava
2024-10-11 11:06 ` Pranjal Shrivastava
2024-10-11 12:59 ` Robin Murphy
2024-10-11 20:31 ` Pranjal Shrivastava
2024-10-15 18:34 ` Pranjal Shrivastava
2024-10-15 20:03 ` Robin Murphy
2024-10-17 8:06 ` Pranjal Shrivastava
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=Zvx+6qBY3og8lRWe@Asurada-Nvidia \
--to=nicolinc@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=praan@google.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