From: John Garry <john.garry@huawei.com>
To: Robin Murphy <robin.murphy@arm.com>,
kernel test robot <lkp@intel.com>,
"will@kernel.org" <will@kernel.org>,
"rikard.falkeborn@gmail.com" <rikard.falkeborn@gmail.com>
Cc: "trivial@kernel.org" <trivial@kernel.org>,
"maz@kernel.org" <maz@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linuxarm <linuxarm@huawei.com>,
"iommu@lists.linux-foundation.org"
<iommu@lists.linux-foundation.org>,
"kbuild-all@lists.01.org" <kbuild-all@lists.01.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist()
Date: Wed, 24 Jun 2020 09:15:16 +0100 [thread overview]
Message-ID: <87f00fa4-c3f0-e057-08ba-56488d9aa34d@huawei.com> (raw)
In-Reply-To: <693bfa60-82cf-bcbb-5745-0d001f7d9f9e@arm.com>
>>
>> I'd say that GENMASK_INPUT_CHECK() should be able to handle a l=0 and
>> h=unsigned value, so I doubt this warn.
>>
>> Using GENMASK((int)cmdq->q.llq.max_n_shift, 0) resolves it, but it looks
>> like GENMASK_INPUT_CHECK() could be improved.
>
> That said, I think this particular case might be even better off dodging
> GENMASK() entirely, by doing something like this first. Untested...
>
> Robin.
>
> ----->8-----
> Subject: [PATCH] iommu/arm-smmu-v3: Streamline queue calculations
>
> Beyond the initial queue setup based on the log2 values from ID
> registers, the log2 queue size is only ever used in the form of
> (1 << max_n_shift) to repeatedly recalculate the number of queue
> elements. Simply storing it in that form leads to slightly more
> efficient code, particularly in the low-level queue accessors
> where it counts most:
>
> add/remove: 0/0 grow/shrink: 1/7 up/down: 4/-120 (-116)
> Function old new delta
> arm_smmu_init_one_queue 360 364 +4
> arm_smmu_priq_thread 512 508 -4
> arm_smmu_evtq_thread 300 292 -8
> __arm_smmu_cmdq_poll_set_valid_map.isra 296 288 -8
> queue_remove_raw 180 164 -16
> arm_smmu_gerror_handler 732 716 -16
> arm_smmu_device_probe 4312 4284 -28
> arm_smmu_cmdq_issue_cmdlist 1892 1852 -40
> Total: Before=20135, After=20019, chg -0.58%
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
[...]
> }
>
> - smmu->evtq.q.llq.max_n_shift = min_t(u32, EVTQ_MAX_SZ_SHIFT,
> - FIELD_GET(IDR1_EVTQS, reg));
> - smmu->priq.q.llq.max_n_shift = min_t(u32, PRIQ_MAX_SZ_SHIFT,
> - FIELD_GET(IDR1_PRIQS, reg));
> + max_n_shift = min_t(u32, EVTQ_MAX_SZ_SHIFT, FIELD_GET(IDR1_EVTQS, reg));
> + smmu->evtq.q.llq.max_n = 1 << max_n_shift;
So I require the bitmask of this for the prod, which would be (max_n <<
1) - 1.
I don't feel too strongly either way, and the other big changes in this
series need to be considered first...
Thanks,
John
> +
> + max_n_shift = min_t(u32, PRIQ_MAX_SZ_SHIFT, FIELD_GET(IDR1_PRIQS, reg));
> + smmu->priq.q.llq.max_n = 1 << max_n_shift;
>
> /* SID/SSID sizes */
> smmu->ssid_bits = FIELD_GET(IDR1_SSIDSIZE, reg);
>
next prev parent reply other threads:[~2020-06-24 8:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-22 17:28 [PATCH 0/4] iommu/arm-smmu-v3: Improve cmdq lock efficiency John Garry
2020-06-22 17:28 ` [PATCH 1/4] iommu/arm-smmu-v3: Fix trivial typo John Garry
2020-06-22 17:28 ` [PATCH 2/4] iommu/arm-smmu-v3: Calculate bits for prod and owner John Garry
2020-06-22 17:28 ` [PATCH 3/4] iommu/arm-smmu-v3: Always issue a CMD_SYNC per batch John Garry
2020-06-22 17:28 ` [PATCH 4/4] iommu/arm-smmu-v3: Remove cmpxchg() in arm_smmu_cmdq_issue_cmdlist() John Garry
2020-06-23 1:07 ` kernel test robot
2020-06-23 9:21 ` John Garry
[not found] ` <CADRDgG4=uD3Ni6r7D3kHdSo=ketaXKGririHfFvPYq4qz8KjfQ@mail.gmail.com>
2020-06-23 10:19 ` John Garry
[not found] ` <CADRDgG5pOstGK=fm8s3Be_v8+vc-EyRYmpiMsTCeK-rMk2ZRQQ@mail.gmail.com>
2020-06-26 10:05 ` John Garry
2020-06-23 16:22 ` Robin Murphy
2020-06-24 8:15 ` John Garry [this message]
2020-07-16 10:20 ` Will Deacon
2020-07-16 10:26 ` John Garry
2020-07-08 13:00 ` [PATCH 0/4] iommu/arm-smmu-v3: Improve cmdq lock efficiency John Garry
2020-07-16 10:19 ` Will Deacon
2020-07-16 10:22 ` Will Deacon
2020-07-16 10:28 ` Will Deacon
2020-07-16 10:56 ` John Garry
2020-07-16 11:22 ` Robin Murphy
2020-07-16 11:30 ` John Garry
2020-07-16 11:32 ` Will Deacon
2020-07-16 16:50 ` John Garry
2020-07-16 13:31 ` John Garry
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=87f00fa4-c3f0-e057-08ba-56488d9aa34d@huawei.com \
--to=john.garry@huawei.com \
--cc=iommu@lists.linux-foundation.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=lkp@intel.com \
--cc=maz@kernel.org \
--cc=rikard.falkeborn@gmail.com \
--cc=robin.murphy@arm.com \
--cc=trivial@kernel.org \
--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