* [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
@ 2016-05-24 14:30 Peter Lieven
2016-05-24 15:07 ` Kevin Wolf
2016-05-26 6:50 ` Fam Zheng
0 siblings, 2 replies; 16+ messages in thread
From: Peter Lieven @ 2016-05-24 14:30 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, famz, kwolf, stefanha, mreitz, Peter Lieven
in a read-modify-write cycle a small request might cause
head and tail to fall into the same aligned block. Currently
QEMU reads the same block twice in this case which is
not necessary.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
v1->v2: following Paolos suggestions to simplify the if condition and
adjusting the comment
block/io.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block/io.c b/block/io.c
index 60a6bd8..7459dfb 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1430,6 +1430,14 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs,
bytes += offset & (align - 1);
offset = offset & ~(align - 1);
+
+ /* We have read the tail already if the request is smaller
+ * than one aligned block.
+ */
+ if (bytes < align) {
+ qemu_iovec_add(&local_qiov, head_buf + bytes, align - bytes);
+ bytes = align;
+ }
}
if ((offset + bytes) & (align - 1)) {
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-24 14:30 [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests Peter Lieven
@ 2016-05-24 15:07 ` Kevin Wolf
2016-05-26 6:50 ` Fam Zheng
1 sibling, 0 replies; 16+ messages in thread
From: Kevin Wolf @ 2016-05-24 15:07 UTC (permalink / raw)
To: Peter Lieven; +Cc: qemu-block, qemu-devel, famz, stefanha, mreitz
Am 24.05.2016 um 16:30 hat Peter Lieven geschrieben:
> in a read-modify-write cycle a small request might cause
> head and tail to fall into the same aligned block. Currently
> QEMU reads the same block twice in this case which is
> not necessary.
>
> Signed-off-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-24 14:30 [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests Peter Lieven
2016-05-24 15:07 ` Kevin Wolf
@ 2016-05-26 6:50 ` Fam Zheng
2016-05-26 7:10 ` Fam Zheng
1 sibling, 1 reply; 16+ messages in thread
From: Fam Zheng @ 2016-05-26 6:50 UTC (permalink / raw)
To: Peter Lieven; +Cc: qemu-block, qemu-devel, kwolf, stefanha, mreitz
On Tue, 05/24 16:30, Peter Lieven wrote:
> in a read-modify-write cycle a small request might cause
> head and tail to fall into the same aligned block. Currently
> QEMU reads the same block twice in this case which is
> not necessary.
>
> Signed-off-by: Peter Lieven <pl@kamp.de>
Thanks, applied to my block branch:
https://github.com/famz/qemu/tree/block
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-26 6:50 ` Fam Zheng
@ 2016-05-26 7:10 ` Fam Zheng
2016-05-26 7:55 ` Paolo Bonzini
0 siblings, 1 reply; 16+ messages in thread
From: Fam Zheng @ 2016-05-26 7:10 UTC (permalink / raw)
To: Peter Lieven; +Cc: kwolf, stefanha, qemu-devel, qemu-block, mreitz
On Thu, 05/26 14:50, Fam Zheng wrote:
> On Tue, 05/24 16:30, Peter Lieven wrote:
> > in a read-modify-write cycle a small request might cause
> > head and tail to fall into the same aligned block. Currently
> > QEMU reads the same block twice in this case which is
> > not necessary.
> >
> > Signed-off-by: Peter Lieven <pl@kamp.de>
>
> Thanks, applied to my block branch:
>
> https://github.com/famz/qemu/tree/block
>
Looks like this breaks iotests 077 (hang), the blkdebug break points expected
by the script are not hit now. While squashing in below patch fixes the case, I
think it is more appropriate to keep the patch as is and fix the case itself.
Dropped from my queue, please send another version with test case update so I
can apply together.
diff --git a/block/io.c b/block/io.c
index d480097..a6523cf 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1435,8 +1435,10 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs,
* than one aligned block.
*/
if (bytes < align) {
+ bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL);
qemu_iovec_add(&local_qiov, head_buf + bytes, align - bytes);
bytes = align;
+ bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL);
}
}
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-26 7:10 ` Fam Zheng
@ 2016-05-26 7:55 ` Paolo Bonzini
2016-05-26 8:30 ` Fam Zheng
0 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2016-05-26 7:55 UTC (permalink / raw)
To: Fam Zheng, Peter Lieven; +Cc: kwolf, qemu-block, qemu-devel, stefanha, mreitz
On 26/05/2016 09:10, Fam Zheng wrote:
>
> diff --git a/block/io.c b/block/io.c
> index d480097..a6523cf 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -1435,8 +1435,10 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs,
> * than one aligned block.
> */
> if (bytes < align) {
> + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL);
> qemu_iovec_add(&local_qiov, head_buf + bytes, align - bytes);
> bytes = align;
> + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL);
> }
> }
This doesn't look too wrong... Should the right sequence of events be
head/after_head or head/after_tail? It's probably simplest to just emit
all four events.
Paolo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-26 7:55 ` Paolo Bonzini
@ 2016-05-26 8:30 ` Fam Zheng
2016-05-26 9:20 ` Paolo Bonzini
0 siblings, 1 reply; 16+ messages in thread
From: Fam Zheng @ 2016-05-26 8:30 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Peter Lieven, kwolf, qemu-block, qemu-devel, stefanha, mreitz
On Thu, 05/26 09:55, Paolo Bonzini wrote:
>
>
> On 26/05/2016 09:10, Fam Zheng wrote:
> >
> > diff --git a/block/io.c b/block/io.c
> > index d480097..a6523cf 100644
> > --- a/block/io.c
> > +++ b/block/io.c
> > @@ -1435,8 +1435,10 @@ int coroutine_fn bdrv_co_pwritev(BlockDriverState *bs,
> > * than one aligned block.
> > */
> > if (bytes < align) {
> > + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_TAIL);
> > qemu_iovec_add(&local_qiov, head_buf + bytes, align - bytes);
> > bytes = align;
> > + bdrv_debug_event(bs, BLKDBG_PWRITEV_RMW_AFTER_TAIL);
> > }
> > }
>
> This doesn't look too wrong... Should the right sequence of events be
> head/after_head or head/after_tail? It's probably simplest to just emit
> all four events.
I've no idea. (That's why I leaned towards fixing the test case). But if Kevin
can ack, I'd be happy with this way.
Fam
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-26 8:30 ` Fam Zheng
@ 2016-05-26 9:20 ` Paolo Bonzini
2016-05-27 0:36 ` Fam Zheng
0 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2016-05-26 9:20 UTC (permalink / raw)
To: Fam Zheng; +Cc: Peter Lieven, kwolf, qemu-block, qemu-devel, stefanha, mreitz
On 26/05/2016 10:30, Fam Zheng wrote:
>> >
>> > This doesn't look too wrong... Should the right sequence of events be
>> > head/after_head or head/after_tail? It's probably simplest to just emit
>> > all four events.
> I've no idea. (That's why I leaned towards fixing the test case).
Well, fixing the testcase means knowing what events should be emitted.
QEMU with Peter's patch emits head/after_head. If the right one is
head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
patch keeps the backwards-compatible route.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-26 9:20 ` Paolo Bonzini
@ 2016-05-27 0:36 ` Fam Zheng
2016-05-27 8:55 ` Kevin Wolf
0 siblings, 1 reply; 16+ messages in thread
From: Fam Zheng @ 2016-05-27 0:36 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Peter Lieven, kwolf, qemu-block, qemu-devel, stefanha, mreitz
On Thu, 05/26 11:20, Paolo Bonzini wrote:
>
>
> On 26/05/2016 10:30, Fam Zheng wrote:
> >> >
> >> > This doesn't look too wrong... Should the right sequence of events be
> >> > head/after_head or head/after_tail? It's probably simplest to just emit
> >> > all four events.
> > I've no idea. (That's why I leaned towards fixing the test case).
>
> Well, fixing the testcase means knowing what events should be emitted.
>
> QEMU with Peter's patch emits head/after_head. If the right one is
> head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
> patch keeps the backwards-compatible route.
Yes, I mean I was not very convinced in tweaking the events at all: each pair
of them has been emitted around bdrv_aligned_preadv(), and the new branch
doesn't do it anymore. So I don't see a reason to add events here.
Fam
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-27 0:36 ` Fam Zheng
@ 2016-05-27 8:55 ` Kevin Wolf
2016-05-30 6:25 ` Peter Lieven
0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2016-05-27 8:55 UTC (permalink / raw)
To: Fam Zheng
Cc: Paolo Bonzini, Peter Lieven, qemu-block, qemu-devel, stefanha,
mreitz
Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
> On Thu, 05/26 11:20, Paolo Bonzini wrote:
> > On 26/05/2016 10:30, Fam Zheng wrote:
> > >> >
> > >> > This doesn't look too wrong... Should the right sequence of events be
> > >> > head/after_head or head/after_tail? It's probably simplest to just emit
> > >> > all four events.
> > > I've no idea. (That's why I leaned towards fixing the test case).
> >
> > Well, fixing the testcase means knowing what events should be emitted.
> >
> > QEMU with Peter's patch emits head/after_head. If the right one is
> > head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
> > patch keeps the backwards-compatible route.
>
> Yes, I mean I was not very convinced in tweaking the events at all: each pair
> of them has been emitted around bdrv_aligned_preadv(), and the new branch
> doesn't do it anymore. So I don't see a reason to add events here.
Yes, if you can assume that anyone who uses the debug events know
exactly what the code looks like, adding the events here is pointless
because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
essentially the same then.
Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
make any difference, they could (and should) be called immediately one
after another if we wanted to keep the behaviour.
I would agree that we should take a look at the test case and what it
actually wants to achieve before we can decide whether AFTER_HEAD and
TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
there are two requests and only one is unaligned at the tail). Maybe we
even need to extend the test case now so that both paths (explicit read
of the tail and the shortcut) are covered.
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-27 8:55 ` Kevin Wolf
@ 2016-05-30 6:25 ` Peter Lieven
2016-05-30 8:24 ` Kevin Wolf
0 siblings, 1 reply; 16+ messages in thread
From: Peter Lieven @ 2016-05-30 6:25 UTC (permalink / raw)
To: Kevin Wolf, Fam Zheng
Cc: Paolo Bonzini, qemu-block, qemu-devel, stefanha, mreitz
Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
> Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
>> On Thu, 05/26 11:20, Paolo Bonzini wrote:
>>> On 26/05/2016 10:30, Fam Zheng wrote:
>>>>>> This doesn't look too wrong... Should the right sequence of events be
>>>>>> head/after_head or head/after_tail? It's probably simplest to just emit
>>>>>> all four events.
>>>> I've no idea. (That's why I leaned towards fixing the test case).
>>> Well, fixing the testcase means knowing what events should be emitted.
>>>
>>> QEMU with Peter's patch emits head/after_head. If the right one is
>>> head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
>>> patch keeps the backwards-compatible route.
>> Yes, I mean I was not very convinced in tweaking the events at all: each pair
>> of them has been emitted around bdrv_aligned_preadv(), and the new branch
>> doesn't do it anymore. So I don't see a reason to add events here.
> Yes, if you can assume that anyone who uses the debug events know
> exactly what the code looks like, adding the events here is pointless
> because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
> essentially the same then.
>
> Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
> make any difference, they could (and should) be called immediately one
> after another if we wanted to keep the behaviour.
>
> I would agree that we should take a look at the test case and what it
> actually wants to achieve before we can decide whether AFTER_HEAD and
> TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
> there are two requests and only one is unaligned at the tail). Maybe we
> even need to extend the test case now so that both paths (explicit read
> of the tail and the shortcut) are covered.
The part that actually blocks in 077 is
# Sequential RMW requests on the same physical sector
its expecting all 4 events around the RMW cycle.
However, it seems that also other parts of 077 would need an adjustment
and the output might differ depending on the alignment. So I guess we
have to emit the events if we don't want to recode the whole 077 and make
it aware of the alignment.
Peter
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 6:25 ` Peter Lieven
@ 2016-05-30 8:24 ` Kevin Wolf
2016-05-30 9:30 ` Peter Lieven
0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2016-05-30 8:24 UTC (permalink / raw)
To: Peter Lieven
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
> Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
> >Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
> >>On Thu, 05/26 11:20, Paolo Bonzini wrote:
> >>>On 26/05/2016 10:30, Fam Zheng wrote:
> >>>>>>This doesn't look too wrong... Should the right sequence of events be
> >>>>>>head/after_head or head/after_tail? It's probably simplest to just emit
> >>>>>>all four events.
> >>>>I've no idea. (That's why I leaned towards fixing the test case).
> >>>Well, fixing the testcase means knowing what events should be emitted.
> >>>
> >>>QEMU with Peter's patch emits head/after_head. If the right one is
> >>>head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
> >>>patch keeps the backwards-compatible route.
> >>Yes, I mean I was not very convinced in tweaking the events at all: each pair
> >>of them has been emitted around bdrv_aligned_preadv(), and the new branch
> >>doesn't do it anymore. So I don't see a reason to add events here.
> >Yes, if you can assume that anyone who uses the debug events know
> >exactly what the code looks like, adding the events here is pointless
> >because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
> >essentially the same then.
> >
> >Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
> >make any difference, they could (and should) be called immediately one
> >after another if we wanted to keep the behaviour.
> >
> >I would agree that we should take a look at the test case and what it
> >actually wants to achieve before we can decide whether AFTER_HEAD and
> >TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
> >there are two requests and only one is unaligned at the tail). Maybe we
> >even need to extend the test case now so that both paths (explicit read
> >of the tail and the shortcut) are covered.
>
> The part that actually blocks in 077 is
>
> # Sequential RMW requests on the same physical sector
>
> its expecting all 4 events around the RMW cycle.
>
> However, it seems that also other parts of 077 would need an adjustment
> and the output might differ depending on the alignment. So I guess we
> have to emit the events if we don't want to recode the whole 077 and make
> it aware of the alignment.
Yes, but my point is that we may need to rework 077 anyway if we don't
only want to make it pass again, but to cover all relevant paths, too.
We got a new code path and it's unlikely that the existing tests covered
both the old code path and the new one.
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 8:24 ` Kevin Wolf
@ 2016-05-30 9:30 ` Peter Lieven
2016-05-30 9:47 ` Kevin Wolf
0 siblings, 1 reply; 16+ messages in thread
From: Peter Lieven @ 2016-05-30 9:30 UTC (permalink / raw)
To: Kevin Wolf
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 10:24 schrieb Kevin Wolf:
> Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
>> Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
>>> Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
>>>> On Thu, 05/26 11:20, Paolo Bonzini wrote:
>>>>> On 26/05/2016 10:30, Fam Zheng wrote:
>>>>>>>> This doesn't look too wrong... Should the right sequence of events be
>>>>>>>> head/after_head or head/after_tail? It's probably simplest to just emit
>>>>>>>> all four events.
>>>>>> I've no idea. (That's why I leaned towards fixing the test case).
>>>>> Well, fixing the testcase means knowing what events should be emitted.
>>>>>
>>>>> QEMU with Peter's patch emits head/after_head. If the right one is
>>>>> head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
>>>>> patch keeps the backwards-compatible route.
>>>> Yes, I mean I was not very convinced in tweaking the events at all: each pair
>>>> of them has been emitted around bdrv_aligned_preadv(), and the new branch
>>>> doesn't do it anymore. So I don't see a reason to add events here.
>>> Yes, if you can assume that anyone who uses the debug events know
>>> exactly what the code looks like, adding the events here is pointless
>>> because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
>>> essentially the same then.
>>>
>>> Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
>>> make any difference, they could (and should) be called immediately one
>>> after another if we wanted to keep the behaviour.
>>>
>>> I would agree that we should take a look at the test case and what it
>>> actually wants to achieve before we can decide whether AFTER_HEAD and
>>> TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
>>> there are two requests and only one is unaligned at the tail). Maybe we
>>> even need to extend the test case now so that both paths (explicit read
>>> of the tail and the shortcut) are covered.
>> The part that actually blocks in 077 is
>>
>> # Sequential RMW requests on the same physical sector
>>
>> its expecting all 4 events around the RMW cycle.
>>
>> However, it seems that also other parts of 077 would need an adjustment
>> and the output might differ depending on the alignment. So I guess we
>> have to emit the events if we don't want to recode the whole 077 and make
>> it aware of the alignment.
> Yes, but my point is that we may need to rework 077 anyway if we don't
> only want to make it pass again, but to cover all relevant paths, too.
> We got a new code path and it's unlikely that the existing tests covered
> both the old code path and the new one.
So you would postpone this patch until 077 is reworked?
I found this one a nice improvement and 077 might take some time.
Peter
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 9:30 ` Peter Lieven
@ 2016-05-30 9:47 ` Kevin Wolf
2016-05-30 9:53 ` Peter Lieven
0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2016-05-30 9:47 UTC (permalink / raw)
To: Peter Lieven
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 11:30 hat Peter Lieven geschrieben:
> Am 30.05.2016 um 10:24 schrieb Kevin Wolf:
> >Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
> >>Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
> >>>Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
> >>>>On Thu, 05/26 11:20, Paolo Bonzini wrote:
> >>>>>On 26/05/2016 10:30, Fam Zheng wrote:
> >>>>>>>>This doesn't look too wrong... Should the right sequence of events be
> >>>>>>>>head/after_head or head/after_tail? It's probably simplest to just emit
> >>>>>>>>all four events.
> >>>>>>I've no idea. (That's why I leaned towards fixing the test case).
> >>>>>Well, fixing the testcase means knowing what events should be emitted.
> >>>>>
> >>>>>QEMU with Peter's patch emits head/after_head. If the right one is
> >>>>>head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
> >>>>>patch keeps the backwards-compatible route.
> >>>>Yes, I mean I was not very convinced in tweaking the events at all: each pair
> >>>>of them has been emitted around bdrv_aligned_preadv(), and the new branch
> >>>>doesn't do it anymore. So I don't see a reason to add events here.
> >>>Yes, if you can assume that anyone who uses the debug events know
> >>>exactly what the code looks like, adding the events here is pointless
> >>>because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
> >>>essentially the same then.
> >>>
> >>>Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
> >>>make any difference, they could (and should) be called immediately one
> >>>after another if we wanted to keep the behaviour.
> >>>
> >>>I would agree that we should take a look at the test case and what it
> >>>actually wants to achieve before we can decide whether AFTER_HEAD and
> >>>TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
> >>>there are two requests and only one is unaligned at the tail). Maybe we
> >>>even need to extend the test case now so that both paths (explicit read
> >>>of the tail and the shortcut) are covered.
> >>The part that actually blocks in 077 is
> >>
> >># Sequential RMW requests on the same physical sector
> >>
> >>its expecting all 4 events around the RMW cycle.
> >>
> >>However, it seems that also other parts of 077 would need an adjustment
> >>and the output might differ depending on the alignment. So I guess we
> >>have to emit the events if we don't want to recode the whole 077 and make
> >>it aware of the alignment.
> >Yes, but my point is that we may need to rework 077 anyway if we don't
> >only want to make it pass again, but to cover all relevant paths, too.
> >We got a new code path and it's unlikely that the existing tests covered
> >both the old code path and the new one.
>
> So you would postpone this patch until 077 is reworked?
> I found this one a nice improvement and 077 might take some time.
The problem with "we'll rework the tests later" is always that it
doesn't happen if the patches for the functional parts and a workaround
for the test case are merged.
I don't think that making 077 cover both cases should be hard or take
much time, it just needs to be done. If all the time for writing emails
in this thread had been used to work on the test case, it would already
be done.
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 9:47 ` Kevin Wolf
@ 2016-05-30 9:53 ` Peter Lieven
2016-05-30 10:06 ` Kevin Wolf
0 siblings, 1 reply; 16+ messages in thread
From: Peter Lieven @ 2016-05-30 9:53 UTC (permalink / raw)
To: Kevin Wolf
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 11:47 schrieb Kevin Wolf:
> Am 30.05.2016 um 11:30 hat Peter Lieven geschrieben:
>> Am 30.05.2016 um 10:24 schrieb Kevin Wolf:
>>> Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
>>>> Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
>>>>> Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
>>>>>> On Thu, 05/26 11:20, Paolo Bonzini wrote:
>>>>>>> On 26/05/2016 10:30, Fam Zheng wrote:
>>>>>>>>>> This doesn't look too wrong... Should the right sequence of events be
>>>>>>>>>> head/after_head or head/after_tail? It's probably simplest to just emit
>>>>>>>>>> all four events.
>>>>>>>> I've no idea. (That's why I leaned towards fixing the test case).
>>>>>>> Well, fixing the testcase means knowing what events should be emitted.
>>>>>>>
>>>>>>> QEMU with Peter's patch emits head/after_head. If the right one is
>>>>>>> head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
>>>>>>> patch keeps the backwards-compatible route.
>>>>>> Yes, I mean I was not very convinced in tweaking the events at all: each pair
>>>>>> of them has been emitted around bdrv_aligned_preadv(), and the new branch
>>>>>> doesn't do it anymore. So I don't see a reason to add events here.
>>>>> Yes, if you can assume that anyone who uses the debug events know
>>>>> exactly what the code looks like, adding the events here is pointless
>>>>> because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
>>>>> essentially the same then.
>>>>>
>>>>> Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
>>>>> make any difference, they could (and should) be called immediately one
>>>>> after another if we wanted to keep the behaviour.
>>>>>
>>>>> I would agree that we should take a look at the test case and what it
>>>>> actually wants to achieve before we can decide whether AFTER_HEAD and
>>>>> TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
>>>>> there are two requests and only one is unaligned at the tail). Maybe we
>>>>> even need to extend the test case now so that both paths (explicit read
>>>>> of the tail and the shortcut) are covered.
>>>> The part that actually blocks in 077 is
>>>>
>>>> # Sequential RMW requests on the same physical sector
>>>>
>>>> its expecting all 4 events around the RMW cycle.
>>>>
>>>> However, it seems that also other parts of 077 would need an adjustment
>>>> and the output might differ depending on the alignment. So I guess we
>>>> have to emit the events if we don't want to recode the whole 077 and make
>>>> it aware of the alignment.
>>> Yes, but my point is that we may need to rework 077 anyway if we don't
>>> only want to make it pass again, but to cover all relevant paths, too.
>>> We got a new code path and it's unlikely that the existing tests covered
>>> both the old code path and the new one.
>> So you would postpone this patch until 077 is reworked?
>> I found this one a nice improvement and 077 might take some time.
> The problem with "we'll rework the tests later" is always that it
> doesn't happen if the patches for the functional parts and a workaround
> for the test case are merged.
>
> I don't think that making 077 cover both cases should be hard or take
> much time, it just needs to be done. If all the time for writing emails
> in this thread had been used to work on the test case, it would already
> be done.
Understood. If you can give a hint how to get the value of the align
parameter into the test script I can try. Otherwise the test will fail
also if any block driver has an align value that is not equal to 512.
Peter
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 9:53 ` Peter Lieven
@ 2016-05-30 10:06 ` Kevin Wolf
2016-05-30 10:10 ` Peter Lieven
0 siblings, 1 reply; 16+ messages in thread
From: Kevin Wolf @ 2016-05-30 10:06 UTC (permalink / raw)
To: Peter Lieven
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 11:53 hat Peter Lieven geschrieben:
> Am 30.05.2016 um 11:47 schrieb Kevin Wolf:
> >Am 30.05.2016 um 11:30 hat Peter Lieven geschrieben:
> >>Am 30.05.2016 um 10:24 schrieb Kevin Wolf:
> >>>Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
> >>>>Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
> >>>>>Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
> >>>>>>On Thu, 05/26 11:20, Paolo Bonzini wrote:
> >>>>>>>On 26/05/2016 10:30, Fam Zheng wrote:
> >>>>>>>>>>This doesn't look too wrong... Should the right sequence of events be
> >>>>>>>>>>head/after_head or head/after_tail? It's probably simplest to just emit
> >>>>>>>>>>all four events.
> >>>>>>>>I've no idea. (That's why I leaned towards fixing the test case).
> >>>>>>>Well, fixing the testcase means knowing what events should be emitted.
> >>>>>>>
> >>>>>>>QEMU with Peter's patch emits head/after_head. If the right one is
> >>>>>>>head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
> >>>>>>>patch keeps the backwards-compatible route.
> >>>>>>Yes, I mean I was not very convinced in tweaking the events at all: each pair
> >>>>>>of them has been emitted around bdrv_aligned_preadv(), and the new branch
> >>>>>>doesn't do it anymore. So I don't see a reason to add events here.
> >>>>>Yes, if you can assume that anyone who uses the debug events know
> >>>>>exactly what the code looks like, adding the events here is pointless
> >>>>>because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
> >>>>>essentially the same then.
> >>>>>
> >>>>>Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
> >>>>>make any difference, they could (and should) be called immediately one
> >>>>>after another if we wanted to keep the behaviour.
> >>>>>
> >>>>>I would agree that we should take a look at the test case and what it
> >>>>>actually wants to achieve before we can decide whether AFTER_HEAD and
> >>>>>TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
> >>>>>there are two requests and only one is unaligned at the tail). Maybe we
> >>>>>even need to extend the test case now so that both paths (explicit read
> >>>>>of the tail and the shortcut) are covered.
> >>>>The part that actually blocks in 077 is
> >>>>
> >>>># Sequential RMW requests on the same physical sector
> >>>>
> >>>>its expecting all 4 events around the RMW cycle.
> >>>>
> >>>>However, it seems that also other parts of 077 would need an adjustment
> >>>>and the output might differ depending on the alignment. So I guess we
> >>>>have to emit the events if we don't want to recode the whole 077 and make
> >>>>it aware of the alignment.
> >>>Yes, but my point is that we may need to rework 077 anyway if we don't
> >>>only want to make it pass again, but to cover all relevant paths, too.
> >>>We got a new code path and it's unlikely that the existing tests covered
> >>>both the old code path and the new one.
> >>So you would postpone this patch until 077 is reworked?
> >>I found this one a nice improvement and 077 might take some time.
> >The problem with "we'll rework the tests later" is always that it
> >doesn't happen if the patches for the functional parts and a workaround
> >for the test case are merged.
> >
> >I don't think that making 077 cover both cases should be hard or take
> >much time, it just needs to be done. If all the time for writing emails
> >in this thread had been used to work on the test case, it would already
> >be done.
>
> Understood. If you can give a hint how to get the value of the align
> parameter into the test script I can try. Otherwise the test will fail
> also if any block driver has an align value that is not equal to 512.
The test case already uses blkdebug to enforce a specific align value
(which is 4096 in this test case, not 512):
echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests
2016-05-30 10:06 ` Kevin Wolf
@ 2016-05-30 10:10 ` Peter Lieven
0 siblings, 0 replies; 16+ messages in thread
From: Peter Lieven @ 2016-05-30 10:10 UTC (permalink / raw)
To: Kevin Wolf
Cc: Fam Zheng, Paolo Bonzini, qemu-block, qemu-devel, stefanha,
mreitz
Am 30.05.2016 um 12:06 schrieb Kevin Wolf:
> Am 30.05.2016 um 11:53 hat Peter Lieven geschrieben:
>> Am 30.05.2016 um 11:47 schrieb Kevin Wolf:
>>> Am 30.05.2016 um 11:30 hat Peter Lieven geschrieben:
>>>> Am 30.05.2016 um 10:24 schrieb Kevin Wolf:
>>>>> Am 30.05.2016 um 08:25 hat Peter Lieven geschrieben:
>>>>>> Am 27.05.2016 um 10:55 schrieb Kevin Wolf:
>>>>>>> Am 27.05.2016 um 02:36 hat Fam Zheng geschrieben:
>>>>>>>> On Thu, 05/26 11:20, Paolo Bonzini wrote:
>>>>>>>>> On 26/05/2016 10:30, Fam Zheng wrote:
>>>>>>>>>>>> This doesn't look too wrong... Should the right sequence of events be
>>>>>>>>>>>> head/after_head or head/after_tail? It's probably simplest to just emit
>>>>>>>>>>>> all four events.
>>>>>>>>>> I've no idea. (That's why I leaned towards fixing the test case).
>>>>>>>>> Well, fixing the testcase means knowing what events should be emitted.
>>>>>>>>>
>>>>>>>>> QEMU with Peter's patch emits head/after_head. If the right one is
>>>>>>>>> head/after_tail, _both QEMU and the testcase_ need to be adjusted. Your
>>>>>>>>> patch keeps the backwards-compatible route.
>>>>>>>> Yes, I mean I was not very convinced in tweaking the events at all: each pair
>>>>>>>> of them has been emitted around bdrv_aligned_preadv(), and the new branch
>>>>>>>> doesn't do it anymore. So I don't see a reason to add events here.
>>>>>>> Yes, if you can assume that anyone who uses the debug events know
>>>>>>> exactly what the code looks like, adding the events here is pointless
>>>>>>> because TAIL, AFTER_TAIL and for the greatest part also AFTER_HEAD are
>>>>>>> essentially the same then.
>>>>>>>
>>>>>>> Having TAIL before the qiov change and AFTER_TAIL afterwards doesn't
>>>>>>> make any difference, they could (and should) be called immediately one
>>>>>>> after another if we wanted to keep the behaviour.
>>>>>>>
>>>>>>> I would agree that we should take a look at the test case and what it
>>>>>>> actually wants to achieve before we can decide whether AFTER_HEAD and
>>>>>>> TAIL/AFTER_TAIL would be the same (the former could trigger earlier if
>>>>>>> there are two requests and only one is unaligned at the tail). Maybe we
>>>>>>> even need to extend the test case now so that both paths (explicit read
>>>>>>> of the tail and the shortcut) are covered.
>>>>>> The part that actually blocks in 077 is
>>>>>>
>>>>>> # Sequential RMW requests on the same physical sector
>>>>>>
>>>>>> its expecting all 4 events around the RMW cycle.
>>>>>>
>>>>>> However, it seems that also other parts of 077 would need an adjustment
>>>>>> and the output might differ depending on the alignment. So I guess we
>>>>>> have to emit the events if we don't want to recode the whole 077 and make
>>>>>> it aware of the alignment.
>>>>> Yes, but my point is that we may need to rework 077 anyway if we don't
>>>>> only want to make it pass again, but to cover all relevant paths, too.
>>>>> We got a new code path and it's unlikely that the existing tests covered
>>>>> both the old code path and the new one.
>>>> So you would postpone this patch until 077 is reworked?
>>>> I found this one a nice improvement and 077 might take some time.
>>> The problem with "we'll rework the tests later" is always that it
>>> doesn't happen if the patches for the functional parts and a workaround
>>> for the test case are merged.
>>>
>>> I don't think that making 077 cover both cases should be hard or take
>>> much time, it just needs to be done. If all the time for writing emails
>>> in this thread had been used to work on the test case, it would already
>>> be done.
>> Understood. If you can give a hint how to get the value of the align
>> parameter into the test script I can try. Otherwise the test will fail
>> also if any block driver has an align value that is not equal to 512.
> The test case already uses blkdebug to enforce a specific align value
> (which is 4096 in this test case, not 512):
>
> echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
Sorry, I missed that. Then I will try to fix 077.
Peter
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-05-30 10:10 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-24 14:30 [Qemu-devel] [PATCH V2] block/io: optimize bdrv_co_pwritev for small requests Peter Lieven
2016-05-24 15:07 ` Kevin Wolf
2016-05-26 6:50 ` Fam Zheng
2016-05-26 7:10 ` Fam Zheng
2016-05-26 7:55 ` Paolo Bonzini
2016-05-26 8:30 ` Fam Zheng
2016-05-26 9:20 ` Paolo Bonzini
2016-05-27 0:36 ` Fam Zheng
2016-05-27 8:55 ` Kevin Wolf
2016-05-30 6:25 ` Peter Lieven
2016-05-30 8:24 ` Kevin Wolf
2016-05-30 9:30 ` Peter Lieven
2016-05-30 9:47 ` Kevin Wolf
2016-05-30 9:53 ` Peter Lieven
2016-05-30 10:06 ` Kevin Wolf
2016-05-30 10:10 ` Peter Lieven
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).