From: Soeren Moch <smoch@web.de>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH] media: dvb_ringbuffer: Add memory barriers
Date: Wed, 11 May 2016 00:03:35 +0200 [thread overview]
Message-ID: <57325AB7.7020304@web.de> (raw)
In-Reply-To: <20160507102606.73e86c0d@recife.lan>
On 05/07/16 15:26, Mauro Carvalho Chehab wrote:
> Em Sat, 7 May 2016 10:22:35 -0300
> Mauro Carvalho Chehab <mchehab@osg.samsung.com> escreveu:
>
>> Hi Soeren,
>>
>> Em Sun, 7 Feb 2016 20:22:36 +0100
>> Soeren Moch <smoch@web.de> escreveu:
>>
>>> On 27.12.2015 21:41, Soeren Moch wrote:
>>>> Implement memory barriers according to Documentation/circular-buffers.txt:
>>>> - use smp_store_release() to update ringbuffer read/write pointers
>>>> - use smp_load_acquire() to load write pointer on reader side
>>>> - use ACCESS_ONCE() to load read pointer on writer side
>>>>
>>>> This fixes data stream corruptions observed e.g. on an ARM Cortex-A9
>>>> quad core system with different types (PCI, USB) of DVB tuners.
>>>>
>>>> Signed-off-by: Soeren Moch <smoch@web.de>
>>>> Cc: stable@vger.kernel.org # 3.14+
>>>
>>> Mauro,
>>>
>>> any news or comments on this?
>>> Since this is a real fix for broken behaviour, can you pick this up, please?
>>
>> The problem here is that I'm very reluctant to touch at the DVB core
>> without doing some tests myself, as things like locking can be
>> very sensible.
>
> In addition, it is good if other DVB developers could also test it.
> Even being sent for some time, until now, nobody else tested it.
I know that people from the german vdrportal.de also use this patch
for quite some time now. Unfortunately they are not active on the
linux-media mailing list.
>>
>> I'll try to find some time to take a look on it for Kernel 4.8,
>> but I'd like to reproduce the bug locally.
>>
>> Could you please provide me enough info to reproduce it (and
>> eventually some test MPEG-TS where you know this would happen)?
>>
>> I have two DekTek RF generators here, so I should be able to
>> play such TS and see what happens with and without the patch
>> on x86, arm32 and arm64.
>
> Ah, forgot to mention, but checkpatch.pl wants comments for the memory
> barriers:
>
OK, when I wrote this patch (linux-4.4-rc6) checkpatch.pl did not
complain about missing comments. I will send a version 2 of this
patch to address these warnings.
Regards,
Soeren
> WARNING: memory barrier without comment
> #52: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:58:
> + return (rbuf->pread == smp_load_acquire(&rbuf->pwrite));
>
> WARNING: memory barrier without comment
> #70: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:79:
> + avail = smp_load_acquire(&rbuf->pwrite) - rbuf->pread;
>
> WARNING: memory barrier without comment
> #79: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:89:
> + smp_store_release(&rbuf->pread, smp_load_acquire(&rbuf->pwrite));
>
> WARNING: memory barrier without comment
> #87: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:96:
> + smp_store_release(&rbuf->pread, 0);
>
> WARNING: memory barrier without comment
> #88: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:97:
> + smp_store_release(&rbuf->pwrite, 0);
>
> WARNING: memory barrier without comment
> #97: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:123:
> + smp_store_release(&rbuf->pread, 0);
>
> WARNING: memory barrier without comment
> #103: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:128:
> + smp_store_release(&rbuf->pread, (rbuf->pread + todo) % rbuf->size);
>
> WARNING: memory barrier without comment
> #112: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:143:
> + smp_store_release(&rbuf->pread, 0);
>
> WARNING: memory barrier without comment
> #117: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:147:
> + smp_store_release(&rbuf->pread, (rbuf->pread + todo) % rbuf->size);
>
> WARNING: memory barrier without comment
> #126: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:162:
> + smp_store_release(&rbuf->pwrite, 0);
>
> WARNING: memory barrier without comment
> #130: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:165:
> + smp_store_release(&rbuf->pwrite, (rbuf->pwrite + todo) % rbuf->size);
>
> WARNING: memory barrier without comment
> #139: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:185:
> + smp_store_release(&rbuf->pwrite, 0);
>
> WARNING: memory barrier without comment
> #145: FILE: drivers/media/dvb-core/dvb_ringbuffer.c:190:
> + smp_store_release(&rbuf->pwrite, (rbuf->pwrite + todo) % rbuf->size);
>
> Thanks,
> Mauro
>
next prev parent reply other threads:[~2016-05-10 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-27 20:41 [PATCH] media: dvb_ringbuffer: Add memory barriers Soeren Moch
2016-02-07 19:22 ` Soeren Moch
2016-05-07 13:22 ` Mauro Carvalho Chehab
2016-05-07 13:26 ` Mauro Carvalho Chehab
2016-05-10 22:03 ` Soeren Moch [this message]
2016-05-10 22:03 ` Soeren Moch
2016-03-16 13:42 ` [PATCH RESEND] " Soeren Moch
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=57325AB7.7020304@web.de \
--to=smoch@web.de \
--cc=crope@iki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
/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).