linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Jaewon Kim <jaewon02.kim@samsung.com>,
	Mark Brown <broonie@kernel.org>, Andi Shyti <andi@etezian.org>,
	Alim Akhtar <alim.akhtar@samsung.com>
Cc: linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Chanho Park <chanho61.park@samsung.com>
Subject: Re: [PATCH v2 2/4] spi: s3c64xx: add cpu_relax in polling loop
Date: Thu, 20 Apr 2023 17:39:06 +0200	[thread overview]
Message-ID: <01d22e48-40f0-b1dd-aa00-cf484c4364ee@linaro.org> (raw)
In-Reply-To: <abbf5608-dbe7-af39-e555-d76ffe65dea4@samsung.com>

On 19/04/2023 13:13, Jaewon Kim wrote:
> 
> On 23. 4. 19. 17:14, Krzysztof Kozlowski wrote:
>> On 19/04/2023 08:06, Jaewon Kim wrote:
>>> Adds cpu_relax() to prevent long busy-wait.
>> How cpu_relax prevents long waiting?
> 
> As I know, cpu_relax() can be converted to yield. This can prevent 
> excessive use of the CPU in busy-loop.

That's ok, you just wrote that it will prevent long waiting, so I assume
it will shorten the wait time.

> 
> I'll replace poor sentence like below in v3.
> 
> ("Adds cpu_relax() to allow CPU relaxation in busy-loop")
> 
>>> There is busy-wait loop to check data transfer completion in polling mode.
>>>
>>> Signed-off-by: Jaewon Kim<jaewon02.kim@samsung.com>
>>> ---
>>>   drivers/spi/spi-s3c64xx.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>>> index 273aa02322d9..886722fb40ea 100644
>>> --- a/drivers/spi/spi-s3c64xx.c
>>> +++ b/drivers/spi/spi-s3c64xx.c
>>> @@ -568,6 +568,7 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd,
>>>   
>>>   	val = msecs_to_loops(ms);
>>>   	do {
>>> +		cpu_relax();
>> Shouldn't this be just readl_poll_timeout()? Or the syntax would be too
>> complicated?
> 
> I think we can replace this while() loop to readl_poll_timeout().
> 
> However, we should use 0 value as 'delay_us' parameter. Because delay 
> can affect throughput.
> 
> 
> My purpose is add relax to this busy-loop.
> 
> we cannot give relax if we change to readl_poll_timeout().

readl_poll_timeout() will know to do the best. You do not need to add
cpu_relax there.


Best regards,
Krzysztof


  reply	other threads:[~2023-04-20 15:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230419062755epcas2p4c3c7c1e0d58e964f6e884f75ae120d91@epcas2p4.samsung.com>
2023-04-19  6:06 ` [PATCH v2 0/4] Improves polling mode of s3c64xx driver Jaewon Kim
     [not found]   ` <CGME20230419062755epcas2p1370c1ca60d88d6b114a7c7c1de3f15c0@epcas2p1.samsung.com>
2023-04-19  6:06     ` [PATCH v2 1/4] spi: s3c64xx: changed to PIO mode if there is no DMA Jaewon Kim
2023-04-19  8:03       ` Krzysztof Kozlowski
2023-04-19  8:31         ` Jaewon Kim
2023-04-19  8:36           ` Krzysztof Kozlowski
2023-04-19 15:46       ` Andi Shyti
2023-04-21  1:43         ` Jaewon Kim
2023-04-20 15:40       ` Krzysztof Kozlowski
2023-04-21  1:45         ` Jaewon Kim
     [not found]   ` <CGME20230419062755epcas2p43a646bbae5f01e3120331407ad873318@epcas2p4.samsung.com>
2023-04-19  6:06     ` [PATCH v2 2/4] spi: s3c64xx: add cpu_relax in polling loop Jaewon Kim
2023-04-19  8:14       ` Krzysztof Kozlowski
2023-04-19 11:13         ` Jaewon Kim
2023-04-20 15:39           ` Krzysztof Kozlowski [this message]
2023-04-21  1:45             ` Jaewon Kim
     [not found]   ` <CGME20230419062755epcas2p1bca14bbd5200ebe5241780d2d7ec1596@epcas2p1.samsung.com>
2023-04-19  6:06     ` [PATCH v2 3/4] spi: s3c64xx: add sleep during transfer Jaewon Kim
2023-04-19  8:19       ` Krzysztof Kozlowski
2023-04-19  9:41         ` Jaewon Kim
2023-04-19 15:56           ` Andi Shyti
2023-04-21  2:53             ` Jaewon Kim
     [not found]   ` <CGME20230419062755epcas2p43a1127f4bb28cf1cf3f42e5d3cc597cd@epcas2p4.samsung.com>
2023-04-19  6:06     ` [PATCH v2 4/4] spi: s3c64xx: support interrupt based pio mode Jaewon Kim
2023-04-19  8:21       ` Krzysztof Kozlowski
2023-04-19  9:45         ` Jaewon Kim
2023-04-20 15:37           ` Krzysztof Kozlowski
2023-04-19 16:03       ` Andi Shyti
2023-04-21  3:05         ` Jaewon Kim
2023-04-19  7:59   ` [PATCH v2 0/4] Improves polling mode of s3c64xx driver Krzysztof Kozlowski
2023-04-19  8:29     ` Jaewon Kim

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=01d22e48-40f0-b1dd-aa00-cf484c4364ee@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andi@etezian.org \
    --cc=broonie@kernel.org \
    --cc=chanho61.park@samsung.com \
    --cc=jaewon02.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-spi@vger.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;
as well as URLs for NNTP newsgroup(s).