[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28cd06ca-3bd4-87e1-6d52-504cd00e1adb@gmail.com>
Date: Tue, 18 Jun 2019 21:34:08 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Jon Hunter <jonathanh@...dia.com>,
Bitan Biswas <bbiswas@...dia.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Thierry Reding <treding@...dia.com>, linux-i2c@...r.kernel.org,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
Peter Rosin <peda@...ntia.se>, Wolfram Sang <wsa@...-dreams.de>
Cc: Shardar Mohammed <smohammed@...dia.com>,
Sowjanya Komatineni <skomatineni@...dia.com>,
Mantravadi Karthik <mkarthik@...dia.com>
Subject: Re: [PATCH V2] i2c: tegra: disable irq in tegra_i2c_xfer_msg
18.06.2019 12:13, Jon Hunter пишет:
>
> On 18/06/2019 09:42, Bitan Biswas wrote:
>> tegra_i2c_xfer_msg initiates the I2C transfer in DMA
>> or PIO mode. It involves steps that need FIFO register
>> access, DMA API calls like dma_sync_single_for_device, etc.
>> Tegra I2C ISR has calls to tegra_i2c_empty_rx_fifo in PIO mode
>> and in DMA/PIO mode writes different I2C registers including
>> I2C interrupt status. ISR cannot start processing
>> before the preparation step at tegra_i2c_xfer_msg is complete.
>> Hence, a synchronization between ISR and tegra_i2c_xfer_msg
>> is in place today using spinlock.
>>
>> Spinlock busy waits and can add avoidable delays.
>>
>> In this patch needed synchronization is achieved by disabling
>> I2C interrupt during preparation step and enabling interrupt
>> once preparation is over and spinlock is no longer needed.
> Sorry but I still don't understand the problem you are trying to solve.
> Yes spinlocks are busy waits but is this busy wait an actual problem? If
> so what is the problem with this?
There is no real problem here, the intent is to clean up the code more and that should
be mentioned in the commit message for clarity. This was actually my suggestion that
Bitan is now started to implement, which is very nice! It should be a good result in
the end.
> It appears that the spinlock was added to prevent error interrupts
> occurring until the transfer has started. If this is for error cases,
> then probably it is not often that the CPU is stuck busy waiting on the
> spinlock.
>
> Furthermore, in addition to the spinlock we also have calls to
> tegra_i2c_unmask_irq/tegra_i2c_mask_irq. Therefore, if we are going to
> change this it would seem like a good idea to consolidate the
> masking/unmasking of IRQs and the spinlock, if possible.
>
> Finally, I still see that we have a spinlock in the downstream kernels
> we are shipping and so I would prefer to see such a change also be
> tested in the downstream kernels we are releasing.
Powered by blists - more mailing lists