mbox series

[0/2] Fix misuse of blk_rq_stats in blk-iolatency

Message ID cover.1560510935.git.asml.silence@gmail.com (mailing list archive)
Headers show
Series Fix misuse of blk_rq_stats in blk-iolatency | expand

Message

Pavel Begunkov June 14, 2019, 11:44 a.m. UTC
From: Pavel Begunkov <asml.silence@gmail.com>

There are implicit assumptions about struct blk_rq_stats, which make
it's very easy to misuse. The first patch fixes consequences, and the
second employs type-system to prevent recurrences.


Pavel Begunkov (2):
  blk-iolatency: Fix zero mean in previous stats
  blk-stats: Introduce explicit stat staging buffers

 block/blk-iolatency.c     | 60 ++++++++++++++++++++++++++++++---------
 block/blk-stat.c          | 48 +++++++++++++++++++++++--------
 block/blk-stat.h          |  9 ++++--
 include/linux/blk_types.h |  6 ++++
 4 files changed, 94 insertions(+), 29 deletions(-)

Comments

Josef Bacik June 14, 2019, 1:40 p.m. UTC | #1
On Fri, Jun 14, 2019 at 02:44:11PM +0300, Pavel Begunkov (Silence) wrote:
> From: Pavel Begunkov <asml.silence@gmail.com>
> 
> There are implicit assumptions about struct blk_rq_stats, which make
> it's very easy to misuse. The first patch fixes consequences, and the
> second employs type-system to prevent recurrences.
> 
> 
> Pavel Begunkov (2):
>   blk-iolatency: Fix zero mean in previous stats
>   blk-stats: Introduce explicit stat staging buffers
> 

I don't have a problem with this, but it's up to Jens I suppose

Acked-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
Pavel Begunkov June 20, 2019, 5:18 p.m. UTC | #2
Hi,

Josef, thanks for taking a look.


Although, there is nothing critical yet -- just a not working / disabled
optimisation, but changes in stats could sublty break it. E.g. grouping
@batch and @mean into a union will increase estimated average by several
orders of magnitude.

Jens, what do you think?



On 14/06/2019 16:40, Josef Bacik wrote:
> On Fri, Jun 14, 2019 at 02:44:11PM +0300, Pavel Begunkov (Silence) wrote:
>> From: Pavel Begunkov <asml.silence@gmail.com>
>>
>> There are implicit assumptions about struct blk_rq_stats, which make
>> it's very easy to misuse. The first patch fixes consequences, and the
>> second employs type-system to prevent recurrences.
>>
>>
>> Pavel Begunkov (2):
>>   blk-iolatency: Fix zero mean in previous stats
>>   blk-stats: Introduce explicit stat staging buffers
>>
> 
> I don't have a problem with this, but it's up to Jens I suppose
> 
> Acked-by: Josef Bacik <josef@toxicpanda.com>
> 
> Thanks,
> 
> Josef
>
Pavel Begunkov June 29, 2019, 3:37 p.m. UTC | #3
Ping?

On 20/06/2019 10:18, Pavel Begunkov wrote:
> Hi,
> 
> Josef, thanks for taking a look.
> 
> 
> Although, there is nothing critical yet -- just a not working / disabled
> optimisation, but changes in stats could sublty break it. E.g. grouping
> @batch and @mean into a union will increase estimated average by several
> orders of magnitude.
> 
> Jens, what do you think?
> 
> 
> 
> On 14/06/2019 16:40, Josef Bacik wrote:
>> On Fri, Jun 14, 2019 at 02:44:11PM +0300, Pavel Begunkov (Silence) wrote:
>>> From: Pavel Begunkov <asml.silence@gmail.com>
>>>
>>> There are implicit assumptions about struct blk_rq_stats, which make
>>> it's very easy to misuse. The first patch fixes consequences, and the
>>> second employs type-system to prevent recurrences.
>>>
>>>
>>> Pavel Begunkov (2):
>>>   blk-iolatency: Fix zero mean in previous stats
>>>   blk-stats: Introduce explicit stat staging buffers
>>>
>>
>> I don't have a problem with this, but it's up to Jens I suppose
>>
>> Acked-by: Josef Bacik <josef@toxicpanda.com>
>>
>> Thanks,
>>
>> Josef
>>
>
Pavel Begunkov July 11, 2019, 1:17 a.m. UTC | #4
Hi,

Any thoughts? Is there something wrong with the patchset?


On 29/06/2019 18:37, Pavel Begunkov wrote:
> Ping?
> 
> On 20/06/2019 10:18, Pavel Begunkov wrote:
>> Hi,
>>
>> Josef, thanks for taking a look.
>>
>>
>> Although, there is nothing critical yet -- just a not working / disabled
>> optimisation, but changes in stats could sublty break it. E.g. grouping
>> @batch and @mean into a union will increase estimated average by several
>> orders of magnitude.
>>
>> Jens, what do you think?
>>
>>
>>
>> On 14/06/2019 16:40, Josef Bacik wrote:
>>> On Fri, Jun 14, 2019 at 02:44:11PM +0300, Pavel Begunkov (Silence) wrote:
>>>> From: Pavel Begunkov <asml.silence@gmail.com>
>>>>
>>>> There are implicit assumptions about struct blk_rq_stats, which make
>>>> it's very easy to misuse. The first patch fixes consequences, and the
>>>> second employs type-system to prevent recurrences.
>>>>
>>>>
>>>> Pavel Begunkov (2):
>>>>   blk-iolatency: Fix zero mean in previous stats
>>>>   blk-stats: Introduce explicit stat staging buffers
>>>>
>>>
>>> I don't have a problem with this, but it's up to Jens I suppose
>>>
>>> Acked-by: Josef Bacik <josef@toxicpanda.com>
>>>
>>> Thanks,
>>>
>>> Josef
>>>
>>
>
Pavel Begunkov Sept. 30, 2019, 8:29 a.m. UTC | #5
Hi,

I claim, that there is a bug, that hopefully doesn't show itself apart
from a minor disabled optimisation. It's _too_ easy to misuse, and if
somebody try to reuse, this could lead to quite interesting issues.

Could somebody at last take a look?
Thanks

On 25/07/2019 00:35, Pavel Begunkov (Silence) wrote:
> From: Pavel Begunkov <asml.silence@gmail.com>
> 
> There are implicit assumptions about struct blk_rq_stats, which make
> it's very easy to misuse. The first patch fixes consequences, and the
> second employs type-system to prevent recurrences.
> 
> Acked-by: Josef Bacik <josef@toxicpanda.com>
> 
> Pavel Begunkov (2):
>   blk-iolatency: Fix zero mean in previous stats
>   blk-stats: Introduce explicit stat staging buffers
> 
>  block/blk-iolatency.c     | 60 ++++++++++++++++++++++++++++++---------
>  block/blk-stat.c          | 48 +++++++++++++++++++++++--------
>  block/blk-stat.h          |  9 ++++--
>  include/linux/blk_types.h |  6 ++++
>  4 files changed, 94 insertions(+), 29 deletions(-)
>