From: Antti Palosaari <crope@iki.fi>
To: Adam Baker <linux@baker-net.org.uk>, linux-media@vger.kernel.org
Subject: Re: [PATCH 1/2] si2168: Implement own I2C adapter locking
Date: Mon, 01 Jun 2015 10:47:59 +0300 [thread overview]
Message-ID: <556C0E2F.3050702@iki.fi> (raw)
In-Reply-To: <556B3D4E.6090509@baker-net.org.uk>
On 05/31/2015 07:56 PM, Adam Baker wrote:
> On 29/05/15 22:05, Antti Palosaari wrote:
>> We need own I2C locking because of tuner I2C adapter/repeater.
>> Firmware command is executed using I2C send + reply message. Default
>> I2C adapter locking protects only single I2C operation, not whole
>> send + reply sequence as needed. Due to that, it was possible tuner
>> I2C message interrupts firmware command sequence.
>>
>> Reported-by: Adam Baker <linux@baker-net.org.uk>
>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>> ---
>
> Reviewed-by: Adam Baker <linux@baker-net.org.uk>
>
> Having looked over this I can't see any remaining deadlocks or failures
> to provide adequate locking.
>
> Without a detailed device datasheet (the public datasheet is only the
> short version) it is impossible to say
>
> 1) If accessing the I2C gate in between a read and write cycle would
> actually cause a problem, if it doesn't then a simpler solution would be
> possible but it seems reasonable to assume that it does.
Hey, you could very very easily make test and see what happens. Just add
dummy I2C gate open / close request to si2168_cmd_execute_unlocked() and
see what happens.
I suspect it will fail as I cannot see how firmware could even report
status of multiple operations happening same time. Firmware status is
always first byte of read operation, there is no flag to say which
operation status is for. OK, currently I2C gate status is not checked at
all, but still.
i2c_master_send("download firmware packet");
i2c_master_send("open I2C gate");
i2c_master_recv("read status"); <-- which operation status it will be?
Many fw operations are pretty fast and reply is always "firmware ready".
But there is some operations that will take up to 70ms.
> 2) How effective the retry mechanism is. The current behaviour that
> retries the read cycle without retrying the preceding write means that
> it isn't possible to pass the read and write messages as multiple
> messages to i2c_transfer and let that handle the locking for us.
Passing multiple messages to i2c_transfer() is different that multiple
i2c_master_send() / i2c_master_recv(). Look what means "repeated start
condition" from some I2C documentation to understand the difference.
> Do you know how likely it is for this issue to be triggered without the
> signal stats patch applied? My suspicion is that it could only happen if
> user space deliberately tried changing parameters on the tuner and
> frontend at the same time from different threads and hence the fix isn't
> worth pushing to stable.
Those callbacks are driven be DVB core which serializes all operations.
So it could not happen (without that statistics polling kernel thread).
regards
Antti
--
http://palosaari.fi/
prev parent reply other threads:[~2015-06-01 7:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 21:05 [PATCH 1/2] si2168: Implement own I2C adapter locking Antti Palosaari
2015-05-29 21:05 ` [PATCH 2/2] si2157: implement signal strength stats Antti Palosaari
2015-05-31 22:30 ` Adam Baker
2015-05-31 16:56 ` [PATCH 1/2] si2168: Implement own I2C adapter locking Adam Baker
2015-06-01 7:47 ` Antti Palosaari [this message]
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=556C0E2F.3050702@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=linux@baker-net.org.uk \
/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