All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sieber, Fernand via iommu" <iommu@lists.linux-foundation.org>
To: John Garry <john.garry@huawei.com>,
	"will@kernel.org" <will@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>
Cc: "iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space
Date: Tue, 21 Sep 2021 17:12:25 +0000	[thread overview]
Message-ID: <1632244345526.44611@amazon.com> (raw)
In-Reply-To: <c1c10203-ffd3-25f9-f2c6-9cee3458aac9@huawei.com>

Hi John,

> But is the polarity really correct? That is, if we don't have space,
> then exit with success (the function to check for space).

You are absolutely correct, this is a mistake that I made as I was resolving conflicts while porting this patch to iommu/next from 5.4 where I implemented and tested it.
It should be:

> -             if (!queue_full(llq))
> +             if (queue_has_space(llq, n))


> what is llq->state->val?

This is an other oversight for the same reason, llq->state->val has since then been renamed llq->val

Will fix both of these in the next revision.
Thanks and kind regards,

--Fernand

________________________________________
From: John Garry <john.garry@huawei.com>
Sent: Tuesday, September 21, 2021 18:22
To: Sieber, Fernand; will@kernel.org; robin.murphy@arm.com
Cc: linux-arm-kernel@lists.infradead.org; iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
Subject: RE: [EXTERNAL] [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



On 21/09/2021 12:43, Fernand Sieber wrote:
>       do {

I didn't follow the full logic of this change yet ...

>               llq->val = READ_ONCE(cmdq->q.llq.val);
> -             if (!queue_full(llq))
> +             if (!queue_has_space(llq, n))

But is the polarity really correct? That is, if we don't have space,
then exit with success (the function to check for space).

>                       break;
>
> +             /*
> +              * We must return here even if there's no space, because the producer
> +              * having moved forward could mean that the last thread observing the
> +              * SMMU progress has allocated space in the cmdq and moved on, leaving
> +              * us in this waiting loop with no other thread updating
> +              * llq->state->val.

what is llq->state->val?

> +              */
> +             if (llq->prod != prod)
> +                     return -EAGAIN;
> +
>               ret = queue_poll(&qp);

Thanks,
John
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: "Sieber, Fernand" <sieberf@amazon.com>
To: John Garry <john.garry@huawei.com>,
	"will@kernel.org" <will@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space
Date: Tue, 21 Sep 2021 17:12:25 +0000	[thread overview]
Message-ID: <1632244345526.44611@amazon.com> (raw)
In-Reply-To: <c1c10203-ffd3-25f9-f2c6-9cee3458aac9@huawei.com>

Hi John,

> But is the polarity really correct? That is, if we don't have space,
> then exit with success (the function to check for space).

You are absolutely correct, this is a mistake that I made as I was resolving conflicts while porting this patch to iommu/next from 5.4 where I implemented and tested it.
It should be:

> -             if (!queue_full(llq))
> +             if (queue_has_space(llq, n))


> what is llq->state->val?

This is an other oversight for the same reason, llq->state->val has since then been renamed llq->val

Will fix both of these in the next revision.
Thanks and kind regards,

--Fernand

________________________________________
From: John Garry <john.garry@huawei.com>
Sent: Tuesday, September 21, 2021 18:22
To: Sieber, Fernand; will@kernel.org; robin.murphy@arm.com
Cc: linux-arm-kernel@lists.infradead.org; iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
Subject: RE: [EXTERNAL] [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



On 21/09/2021 12:43, Fernand Sieber wrote:
>       do {

I didn't follow the full logic of this change yet ...

>               llq->val = READ_ONCE(cmdq->q.llq.val);
> -             if (!queue_full(llq))
> +             if (!queue_has_space(llq, n))

But is the polarity really correct? That is, if we don't have space,
then exit with success (the function to check for space).

>                       break;
>
> +             /*
> +              * We must return here even if there's no space, because the producer
> +              * having moved forward could mean that the last thread observing the
> +              * SMMU progress has allocated space in the cmdq and moved on, leaving
> +              * us in this waiting loop with no other thread updating
> +              * llq->state->val.

what is llq->state->val?

> +              */
> +             if (llq->prod != prod)
> +                     return -EAGAIN;
> +
>               ret = queue_poll(&qp);

Thanks,
John

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "Sieber, Fernand" <sieberf@amazon.com>
To: John Garry <john.garry@huawei.com>,
	"will@kernel.org" <will@kernel.org>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space
Date: Tue, 21 Sep 2021 17:12:25 +0000	[thread overview]
Message-ID: <1632244345526.44611@amazon.com> (raw)
In-Reply-To: <c1c10203-ffd3-25f9-f2c6-9cee3458aac9@huawei.com>

Hi John,

> But is the polarity really correct? That is, if we don't have space,
> then exit with success (the function to check for space).

You are absolutely correct, this is a mistake that I made as I was resolving conflicts while porting this patch to iommu/next from 5.4 where I implemented and tested it.
It should be:

> -             if (!queue_full(llq))
> +             if (queue_has_space(llq, n))


> what is llq->state->val?

This is an other oversight for the same reason, llq->state->val has since then been renamed llq->val

Will fix both of these in the next revision.
Thanks and kind regards,

--Fernand

________________________________________
From: John Garry <john.garry@huawei.com>
Sent: Tuesday, September 21, 2021 18:22
To: Sieber, Fernand; will@kernel.org; robin.murphy@arm.com
Cc: linux-arm-kernel@lists.infradead.org; iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
Subject: RE: [EXTERNAL] [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.



On 21/09/2021 12:43, Fernand Sieber wrote:
>       do {

I didn't follow the full logic of this change yet ...

>               llq->val = READ_ONCE(cmdq->q.llq.val);
> -             if (!queue_full(llq))
> +             if (!queue_has_space(llq, n))

But is the polarity really correct? That is, if we don't have space,
then exit with success (the function to check for space).

>                       break;
>
> +             /*
> +              * We must return here even if there's no space, because the producer
> +              * having moved forward could mean that the last thread observing the
> +              * SMMU progress has allocated space in the cmdq and moved on, leaving
> +              * us in this waiting loop with no other thread updating
> +              * llq->state->val.

what is llq->state->val?

> +              */
> +             if (llq->prod != prod)
> +                     return -EAGAIN;
> +
>               ret = queue_poll(&qp);

Thanks,
John

  reply	other threads:[~2021-09-21 17:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 11:43 [PATCH] iommu/arm-smmu-v3: poll cmdq until it has space Fernand Sieber via iommu
2021-09-21 11:43 ` Fernand Sieber
2021-09-21 11:43 ` Fernand Sieber
2021-09-21 16:22 ` John Garry
2021-09-21 16:22   ` John Garry
2021-09-21 16:22   ` John Garry
2021-09-21 17:12   ` Sieber, Fernand via iommu [this message]
2021-09-21 17:12     ` Sieber, Fernand
2021-09-21 17:12     ` Sieber, Fernand

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=1632244345526.44611@amazon.com \
    --to=iommu@lists.linux-foundation.org \
    --cc=john.garry@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sieberf@amazon.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 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.