* [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-05 11:17 ` sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w
0 siblings, 0 replies; 8+ messages in thread
From: sunil.kovvuri @ 2017-05-05 11:17 UTC (permalink / raw)
To: will.deacon, robin.murphy, iommu
Cc: linux-kernel, linux-arm-kernel, robert.richter, jcm, Sunil Goutham
From: Sunil Goutham <sgoutham@cavium.com>
Processing queue full of TLB invalidation commands might
take more time on some platforms than current timeout
of 100us. So increased drain timeout value.
Also now udelay time is increased exponentially for each poll.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
v2
- Addressed Will's and Robin's comments i.e
increased poll timeout only for drain case and removed spin loop
whose logic anyway is screwed up.
- Also changed commit subject and message as this patch no longer
exactly reflects what is done in SMMU driver i.e
8513c8930069 iommu/arm-smmu: Poll for TLB sync completion more effectively
drivers/iommu/arm-smmu-v3.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index d412bdd..cbc8309 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -379,6 +379,8 @@
#define CMDQ_SYNC_0_CS_NONE (0UL << CMDQ_SYNC_0_CS_SHIFT)
#define CMDQ_SYNC_0_CS_SEV (2UL << CMDQ_SYNC_0_CS_SHIFT)
+#define CMDQ_DRAIN_TIMEOUT_US 1000
+
/* Event queue */
#define EVTQ_ENT_DWORDS 4
#define EVTQ_MAX_SZ_SHIFT 7
@@ -737,7 +739,12 @@ static void queue_inc_prod(struct arm_smmu_queue *q)
*/
static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
{
- ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US);
+ ktime_t timeout;
+ unsigned int delay = 1;
+
+ /* Wait longer if it's queue drain */
+ timeout = ktime_add_us(ktime_get(), drain ? CMDQ_DRAIN_TIMEOUT_US :
+ ARM_SMMU_POLL_TIMEOUT_US);
while (queue_sync_cons(q), (drain ? !queue_empty(q) : queue_full(q))) {
if (ktime_compare(ktime_get(), timeout) > 0)
@@ -747,7 +754,11 @@ static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
wfe();
} else {
cpu_relax();
- udelay(1);
+ udelay(delay);
+ /* No point in sleeping for fixed time,
+ * if cons isn't moving fast.
+ */
+ delay *= 2;
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-05 11:17 ` sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w
0 siblings, 0 replies; 8+ messages in thread
From: sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w @ 2017-05-05 11:17 UTC (permalink / raw)
To: will.deacon-5wv7dgnIgG8, robin.murphy-5wv7dgnIgG8,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: jcm-H+wXaHxf7aLQT0dZR+AlfA,
robert.richter-YGCgFSpz5w/QT0dZR+AlfA, Sunil Goutham,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
From: Sunil Goutham <sgoutham-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Processing queue full of TLB invalidation commands might
take more time on some platforms than current timeout
of 100us. So increased drain timeout value.
Also now udelay time is increased exponentially for each poll.
Signed-off-by: Sunil Goutham <sgoutham-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
v2
- Addressed Will's and Robin's comments i.e
increased poll timeout only for drain case and removed spin loop
whose logic anyway is screwed up.
- Also changed commit subject and message as this patch no longer
exactly reflects what is done in SMMU driver i.e
8513c8930069 iommu/arm-smmu: Poll for TLB sync completion more effectively
drivers/iommu/arm-smmu-v3.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index d412bdd..cbc8309 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -379,6 +379,8 @@
#define CMDQ_SYNC_0_CS_NONE (0UL << CMDQ_SYNC_0_CS_SHIFT)
#define CMDQ_SYNC_0_CS_SEV (2UL << CMDQ_SYNC_0_CS_SHIFT)
+#define CMDQ_DRAIN_TIMEOUT_US 1000
+
/* Event queue */
#define EVTQ_ENT_DWORDS 4
#define EVTQ_MAX_SZ_SHIFT 7
@@ -737,7 +739,12 @@ static void queue_inc_prod(struct arm_smmu_queue *q)
*/
static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
{
- ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US);
+ ktime_t timeout;
+ unsigned int delay = 1;
+
+ /* Wait longer if it's queue drain */
+ timeout = ktime_add_us(ktime_get(), drain ? CMDQ_DRAIN_TIMEOUT_US :
+ ARM_SMMU_POLL_TIMEOUT_US);
while (queue_sync_cons(q), (drain ? !queue_empty(q) : queue_full(q))) {
if (ktime_compare(ktime_get(), timeout) > 0)
@@ -747,7 +754,11 @@ static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
wfe();
} else {
cpu_relax();
- udelay(1);
+ udelay(delay);
+ /* No point in sleeping for fixed time,
+ * if cons isn't moving fast.
+ */
+ delay *= 2;
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-05 11:17 ` sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w
0 siblings, 0 replies; 8+ messages in thread
From: sunil.kovvuri at gmail.com @ 2017-05-05 11:17 UTC (permalink / raw)
To: linux-arm-kernel
From: Sunil Goutham <sgoutham@cavium.com>
Processing queue full of TLB invalidation commands might
take more time on some platforms than current timeout
of 100us. So increased drain timeout value.
Also now udelay time is increased exponentially for each poll.
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
v2
- Addressed Will's and Robin's comments i.e
increased poll timeout only for drain case and removed spin loop
whose logic anyway is screwed up.
- Also changed commit subject and message as this patch no longer
exactly reflects what is done in SMMU driver i.e
8513c8930069 iommu/arm-smmu: Poll for TLB sync completion more effectively
drivers/iommu/arm-smmu-v3.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index d412bdd..cbc8309 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -379,6 +379,8 @@
#define CMDQ_SYNC_0_CS_NONE (0UL << CMDQ_SYNC_0_CS_SHIFT)
#define CMDQ_SYNC_0_CS_SEV (2UL << CMDQ_SYNC_0_CS_SHIFT)
+#define CMDQ_DRAIN_TIMEOUT_US 1000
+
/* Event queue */
#define EVTQ_ENT_DWORDS 4
#define EVTQ_MAX_SZ_SHIFT 7
@@ -737,7 +739,12 @@ static void queue_inc_prod(struct arm_smmu_queue *q)
*/
static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
{
- ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US);
+ ktime_t timeout;
+ unsigned int delay = 1;
+
+ /* Wait longer if it's queue drain */
+ timeout = ktime_add_us(ktime_get(), drain ? CMDQ_DRAIN_TIMEOUT_US :
+ ARM_SMMU_POLL_TIMEOUT_US);
while (queue_sync_cons(q), (drain ? !queue_empty(q) : queue_full(q))) {
if (ktime_compare(ktime_get(), timeout) > 0)
@@ -747,7 +754,11 @@ static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
wfe();
} else {
cpu_relax();
- udelay(1);
+ udelay(delay);
+ /* No point in sleeping for fixed time,
+ * if cons isn't moving fast.
+ */
+ delay *= 2;
}
}
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
2017-05-05 11:17 ` sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w
@ 2017-05-29 9:11 ` Sunil Kovvuri
-1 siblings, 0 replies; 8+ messages in thread
From: Sunil Kovvuri @ 2017-05-29 9:11 UTC (permalink / raw)
To: Will Deacon, Robin Murphy, iommu
Cc: LKML, LAKML, Robert Richter, jcm, Sunil Goutham
On Fri, May 5, 2017 at 4:47 PM, <sunil.kovvuri@gmail.com> wrote:
> From: Sunil Goutham <sgoutham@cavium.com>
>
> Processing queue full of TLB invalidation commands might
> take more time on some platforms than current timeout
> of 100us. So increased drain timeout value.
>
> Also now udelay time is increased exponentially for each poll.
>
> Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
> ---
>
> v2
> - Addressed Will's and Robin's comments i.e
> increased poll timeout only for drain case and removed spin loop
> whose logic anyway is screwed up.
> - Also changed commit subject and message as this patch no longer
> exactly reflects what is done in SMMU driver i.e
> 8513c8930069 iommu/arm-smmu: Poll for TLB sync completion more effectively
>
> drivers/iommu/arm-smmu-v3.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index d412bdd..cbc8309 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -379,6 +379,8 @@
> #define CMDQ_SYNC_0_CS_NONE (0UL << CMDQ_SYNC_0_CS_SHIFT)
> #define CMDQ_SYNC_0_CS_SEV (2UL << CMDQ_SYNC_0_CS_SHIFT)
>
> +#define CMDQ_DRAIN_TIMEOUT_US 1000
> +
> /* Event queue */
> #define EVTQ_ENT_DWORDS 4
> #define EVTQ_MAX_SZ_SHIFT 7
> @@ -737,7 +739,12 @@ static void queue_inc_prod(struct arm_smmu_queue *q)
> */
> static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
> {
> - ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US);
> + ktime_t timeout;
> + unsigned int delay = 1;
> +
> + /* Wait longer if it's queue drain */
> + timeout = ktime_add_us(ktime_get(), drain ? CMDQ_DRAIN_TIMEOUT_US :
> + ARM_SMMU_POLL_TIMEOUT_US);
>
> while (queue_sync_cons(q), (drain ? !queue_empty(q) : queue_full(q))) {
> if (ktime_compare(ktime_get(), timeout) > 0)
> @@ -747,7 +754,11 @@ static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
> wfe();
> } else {
> cpu_relax();
> - udelay(1);
> + udelay(delay);
> + /* No point in sleeping for fixed time,
> + * if cons isn't moving fast.
> + */
> + delay *= 2;
> }
> }
>
> --
> 2.7.4
>
Gentle reminder for patch review.
Thanks,
Sunil.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-29 9:11 ` Sunil Kovvuri
0 siblings, 0 replies; 8+ messages in thread
From: Sunil Kovvuri @ 2017-05-29 9:11 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, May 5, 2017 at 4:47 PM, <sunil.kovvuri@gmail.com> wrote:
> From: Sunil Goutham <sgoutham@cavium.com>
>
> Processing queue full of TLB invalidation commands might
> take more time on some platforms than current timeout
> of 100us. So increased drain timeout value.
>
> Also now udelay time is increased exponentially for each poll.
>
> Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
> ---
>
> v2
> - Addressed Will's and Robin's comments i.e
> increased poll timeout only for drain case and removed spin loop
> whose logic anyway is screwed up.
> - Also changed commit subject and message as this patch no longer
> exactly reflects what is done in SMMU driver i.e
> 8513c8930069 iommu/arm-smmu: Poll for TLB sync completion more effectively
>
> drivers/iommu/arm-smmu-v3.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index d412bdd..cbc8309 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -379,6 +379,8 @@
> #define CMDQ_SYNC_0_CS_NONE (0UL << CMDQ_SYNC_0_CS_SHIFT)
> #define CMDQ_SYNC_0_CS_SEV (2UL << CMDQ_SYNC_0_CS_SHIFT)
>
> +#define CMDQ_DRAIN_TIMEOUT_US 1000
> +
> /* Event queue */
> #define EVTQ_ENT_DWORDS 4
> #define EVTQ_MAX_SZ_SHIFT 7
> @@ -737,7 +739,12 @@ static void queue_inc_prod(struct arm_smmu_queue *q)
> */
> static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
> {
> - ktime_t timeout = ktime_add_us(ktime_get(), ARM_SMMU_POLL_TIMEOUT_US);
> + ktime_t timeout;
> + unsigned int delay = 1;
> +
> + /* Wait longer if it's queue drain */
> + timeout = ktime_add_us(ktime_get(), drain ? CMDQ_DRAIN_TIMEOUT_US :
> + ARM_SMMU_POLL_TIMEOUT_US);
>
> while (queue_sync_cons(q), (drain ? !queue_empty(q) : queue_full(q))) {
> if (ktime_compare(ktime_get(), timeout) > 0)
> @@ -747,7 +754,11 @@ static int queue_poll_cons(struct arm_smmu_queue *q, bool drain, bool wfe)
> wfe();
> } else {
> cpu_relax();
> - udelay(1);
> + udelay(delay);
> + /* No point in sleeping for fixed time,
> + * if cons isn't moving fast.
> + */
> + delay *= 2;
> }
> }
>
> --
> 2.7.4
>
Gentle reminder for patch review.
Thanks,
Sunil.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-30 11:18 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2017-05-30 11:18 UTC (permalink / raw)
To: Sunil Kovvuri
Cc: Robin Murphy, iommu, LKML, LAKML, Robert Richter, jcm, Sunil Goutham
Hi Sunil,
On Mon, May 29, 2017 at 02:41:59PM +0530, Sunil Kovvuri wrote:
> On Fri, May 5, 2017 at 4:47 PM, <sunil.kovvuri@gmail.com> wrote:
> > From: Sunil Goutham <sgoutham@cavium.com>
> >
> > Processing queue full of TLB invalidation commands might
> > take more time on some platforms than current timeout
> > of 100us. So increased drain timeout value.
> >
> > Also now udelay time is increased exponentially for each poll.
> >
> > Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
[...]
> Gentle reminder for patch review.
Sorry, I forgot to push this out. Should be on my iommu/devel branch now.
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-30 11:18 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2017-05-30 11:18 UTC (permalink / raw)
To: Sunil Kovvuri
Cc: jcm-H+wXaHxf7aLQT0dZR+AlfA, LKML, Robert Richter,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Sunil Goutham,
LAKML
Hi Sunil,
On Mon, May 29, 2017 at 02:41:59PM +0530, Sunil Kovvuri wrote:
> On Fri, May 5, 2017 at 4:47 PM, <sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > From: Sunil Goutham <sgoutham-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
> >
> > Processing queue full of TLB invalidation commands might
> > take more time on some platforms than current timeout
> > of 100us. So increased drain timeout value.
> >
> > Also now udelay time is increased exponentially for each poll.
> >
> > Signed-off-by: Sunil Goutham <sgoutham-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
[...]
> Gentle reminder for patch review.
Sorry, I forgot to push this out. Should be on my iommu/devel branch now.
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value
@ 2017-05-30 11:18 ` Will Deacon
0 siblings, 0 replies; 8+ messages in thread
From: Will Deacon @ 2017-05-30 11:18 UTC (permalink / raw)
To: linux-arm-kernel
Hi Sunil,
On Mon, May 29, 2017 at 02:41:59PM +0530, Sunil Kovvuri wrote:
> On Fri, May 5, 2017 at 4:47 PM, <sunil.kovvuri@gmail.com> wrote:
> > From: Sunil Goutham <sgoutham@cavium.com>
> >
> > Processing queue full of TLB invalidation commands might
> > take more time on some platforms than current timeout
> > of 100us. So increased drain timeout value.
> >
> > Also now udelay time is increased exponentially for each poll.
> >
> > Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
[...]
> Gentle reminder for patch review.
Sorry, I forgot to push this out. Should be on my iommu/devel branch now.
Will
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-05-30 11:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 11:17 [PATCH v2] iommu/arm-smmu-v3: Increase CMDQ drain timeout value sunil.kovvuri
2017-05-05 11:17 ` sunil.kovvuri at gmail.com
2017-05-05 11:17 ` sunil.kovvuri-Re5JQEeQqe8AvxtiuMwx3w
2017-05-29 9:11 ` Sunil Kovvuri
2017-05-29 9:11 ` Sunil Kovvuri
2017-05-30 11:18 ` Will Deacon
2017-05-30 11:18 ` Will Deacon
2017-05-30 11:18 ` Will Deacon
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.