xen-netback: fix xenvif_count_skb_slots()
Subsystems (3)
PATCH 1/1 xen-netback: fix xenvif_count_skb_slots()
Commit 4f0581d25827d5e864bcf07b05d73d0d12a20a5c introduced an error into xenvif_count_skb_slots() for skbs with a linear area spanning a page boundary. The alignment of skb->data needs to be taken into account, not just the head length. This patch fixes the issue by dry-running the code from xenvif_gop_skb() (and adjusting the comment above the function to note that).
--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/net/xen-netback/netback.c +15 -2
@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;
Signature · 1 line
1.7.10.4
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
Quoted 6 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Paul, can you reconcile this change with the one made by Simon in cs 8f985b4f7a5394c8f8725a5109451a541ddb9eea?
--msw
Quoted 39 lines
--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
Quoted 6 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Paul, can you reconcile this change with the one made by Simon in cs 8f985b4f7a5394c8f8725a5109451a541ddb9eea?
--msw
Quoted 39 lines
--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;
Quoted 15 lines · Matt Wilson
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).Quoted 6 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Quoted 2 lines
Paul, can you reconcile this change with the one made by Simon in cs
8f985b4f7a5394c8f8725a5109451a541ddb9eea?
Correction: e26b203ede31fffd52571a5ba607a26c79dc5c0d
Quoted 41 lines
--msw
Quoted 39 lines
--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;
Quoted 15 lines · Matt Wilson
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).Quoted 6 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Quoted 2 lines
Paul, can you reconcile this change with the one made by Simon in cs
8f985b4f7a5394c8f8725a5109451a541ddb9eea?
Correction: e26b203ede31fffd52571a5ba607a26c79dc5c0d
Quoted 41 lines
--msw
Quoted 39 lines
--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;
Quoted 6 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
If 4f0581d2582 is causing the skb->data to be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb)) is correct.
I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
David
Quoted 6 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
If 4f0581d2582 is causing the skb->data to be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb)) is correct.
I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
David
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
If I'm not mistaken the change in commit 4f0581d2 is correct because we changed the way that the ring is packed. Now you seem to fall back to the original scheme (or something in between without reverting later other changes in that commit).
Do you have instruction to reproduce the bug? Can you paste some detailed oops message?
Wei.
Quoted 48 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;Signature · 1 line
1.7.10.4
Quoted 7 lines · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
If I'm not mistaken the change in commit 4f0581d2 is correct because we changed the way that the ring is packed. Now you seem to fall back to the original scheme (or something in between without reverting later other changes in that commit).
Do you have instruction to reproduce the bug? Can you paste some detailed oops message?
Wei.
Quoted 48 lines
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>--- drivers/net/xen-netback/netback.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)drivers/net/xen-netback/netback.c +15
-2@@ -223,15 +223,28 @@ static bool start_new_rx_buffer(int offset, unsigned long size, int head)/* * Figure out how many ring slots we're going to need to send @skb to * the guest. This function is essentially a dry run of -* xenvif_gop_frag_copy. +* xenvif_gop_skb. */ unsigned int xenvif_count_skb_slots (struct xenvif *vif,struct sk_buff *skb) { +unsigned char *data;unsigned int count;int i, copy_off;struct skb_cb_overlay *sco; - count =DIV_ROUND_UP (skb_headlen (skb),PAGE_SIZE ); + count =0 ; + + data = skb->data; +while (data <skb_tail_pointer (skb)) { +unsigned int offset =offset_in_page (data); +unsigned int len =PAGE_SIZE - offset; + +if (data + len >skb_tail_pointer (skb)) + len =skb_tail_pointer (skb) - data; + + count++; + data += len; + } copy_off =skb_headlen (skb) %PAGE_SIZE ;Signature · 1 line
1.7.10.4
Quoted 15 lines
-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 07 October 2013 11:02
To: Paul Durrant
Cc: [email protected]; [email protected]; Xi Xiong; Matt Wilson; Annie Li; Wei Liu; Ian Campbell
Subject: Re: [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an errorinto
Quoted 4 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to
Quoted 9 lines
note
Quoted 2 lines
that).
If I'm not mistaken the change in commit
4f0581d2is correct because we changed the way that the ring is packed. Now you seem to fall back to the original scheme (or something in between without reverting later other changes in that commit).
It's not possible to use a single grant copy to copy to even a 2-byte linear area that spans a page boundary so you have to take into account the alignment of skb->data. How the ring is packed is not relevant.
Quoted 3 lines
Do you have instruction to reproduce the bug? Can you paste some detailed oops message?
I don't have the message to hand, but it's this BUG_ON that I hit:
BUG_ON(npo.copy_prod > ARRAY_SIZE(vif->grant_copy_op));
I.e. we blow the grant copy op array.
Paul
Quoted 15 lines
-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 07 October 2013 11:02
To: Paul Durrant
Cc: [email protected]; [email protected]; Xi Xiong; Matt Wilson; Annie Li; Wei Liu; Ian Campbell
Subject: Re: [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an errorinto
Quoted 4 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to
Quoted 9 lines
note
Quoted 2 lines
that).
If I'm not mistaken the change in commit
4f0581d2is correct because we changed the way that the ring is packed. Now you seem to fall back to the original scheme (or something in between without reverting later other changes in that commit).
It's not possible to use a single grant copy to copy to even a 2-byte linear area that spans a page boundary so you have to take into account the alignment of skb->data. How the ring is packed is not relevant.
Quoted 3 lines
Do you have instruction to reproduce the bug? Can you paste some detailed oops message?
I don't have the message to hand, but it's this BUG_ON that I hit:
BUG_ON(npo.copy_prod > ARRAY_SIZE(vif->grant_copy_op));
I.e. we blow the grant copy op array.
Paul
Quoted 27 lines
-----Original Message-----
From: Matt Wilson [mailto:[email protected]] On Behalf Of Matt Wilson
Sent: 07 October 2013 01:08
To: Paul Durrant
Cc: [email protected]; [email protected]; Xi Xiong; Matt Wilson; Annie Li; Wei Liu; Ian Campbell; Simon Graham
Subject: Re: [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 2 lines · Matt Wilson
Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror into
Quoted 2 lines
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto note
Quoted 9 lines
Quoted 8 lines
that).
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Quoted 5 lines
Quoted 2 lines
Paul, can you reconcile this change with the one made by Simon in cs
8f985b4f7a5394c8f8725a5109451a541ddb9eea?Correction:
e26b203ede31fffd52571a5ba607a26c79dc5c0d
The comment is possibly correct with modified ring packing but the problem is that by reducing that count netback now tries to handle more skbs than it has grant copy slots for. Maybe it would be more appropriate to simply revert 4f0581d25827d5e864bcf07b05d73d0d12a20a5c. I see no problem before that patch was applied.
Paul
Quoted 27 lines
-----Original Message-----
From: Matt Wilson [mailto:[email protected]] On Behalf Of Matt Wilson
Sent: 07 October 2013 01:08
To: Paul Durrant
Cc: [email protected]; [email protected]; Xi Xiong; Matt Wilson; Annie Li; Wei Liu; Ian Campbell; Simon Graham
Subject: Re: [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 2 lines · Matt Wilson
Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror into
Quoted 2 lines
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto note
Quoted 9 lines
Quoted 8 lines
that).
Signed-off-by Paul Durrant <[email protected]>Cc Xi Xiong <[email protected]>Cc Matt Wilson <[email protected]>Cc Annie Li <[email protected]>Cc Wei Liu <[email protected]>Cc Ian Campbell <[email protected]>
Quoted 5 lines
Quoted 2 lines
Paul, can you reconcile this change with the one made by Simon in cs
8f985b4f7a5394c8f8725a5109451a541ddb9eea?Correction:
e26b203ede31fffd52571a5ba607a26c79dc5c0d
The comment is possibly correct with modified ring packing but the problem is that by reducing that count netback now tries to handle more skbs than it has grant copy slots for. Maybe it would be more appropriate to simply revert 4f0581d25827d5e864bcf07b05d73d0d12a20a5c. I see no problem before that patch was applied.
Paul
Quoted 24 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; Ian Campbell; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an errorinto
Quoted 4 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function tonote
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.
Quoted 7 lines
I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
Quoted 4 lines
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
I'd be happy with a reversion.
Quoted 4 lines
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
Yes, that would be much better.
Paul
Quoted 24 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; Ian Campbell; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an errorinto
Quoted 4 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function tonote
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.
Quoted 7 lines
I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
Quoted 4 lines
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
I'd be happy with a reversion.
Quoted 4 lines
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
Yes, that would be much better.
Paul
Quoted 42 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 07 October 2013 11:24
To: David Vrabel
Cc: Wei Liu; Ian Campbell; [email protected]; [email protected]; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 5 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; IanCampbell;
Quoted 6 lines
Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror
Quoted 3 lines
into
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto
Quoted 12 lines
note
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Quoted 7 lines
Quoted 3 lines
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
To be clear; I believe that, with the packing change, a third grant copy may be used for the initial slot and that is why we blow the array.
Paul
Quoted 20 lines
Quoted 4 lines
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
I'd be happy with a reversion.
Quoted 4 lines
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
Yes, that would be much better.
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 42 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 07 October 2013 11:24
To: David Vrabel
Cc: Wei Liu; Ian Campbell; [email protected]; [email protected]; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 5 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; IanCampbell;
Quoted 6 lines
Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror
Quoted 3 lines
into
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto
Quoted 12 lines
note
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Quoted 7 lines
Quoted 3 lines
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
To be clear; I believe that, with the packing change, a third grant copy may be used for the initial slot and that is why we blow the array.
Paul
Quoted 20 lines
Quoted 4 lines
I didn't think there was any real merit in the problematic commit (or at least there was no evidence that it was better) so I would suggest just reverting it instead of trying to fix it up.
I'd be happy with a reversion.
Quoted 4 lines
If we do want to change how netback fills the ring then netback needs some redesign (i.e., change it so it doesn't have to this counting in advance) to make it much less fragile to changes in this area.
Yes, that would be much better.
Paul
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 46 lines · Paul Durrant
Quoted 46 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 07 October 2013 11:24
To: David Vrabel
Cc: Wei Liu; Ian Campbell; [email protected]; [email protected]; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 5 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; IanCampbell;
Quoted 6 lines
Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror
Quoted 3 lines
into
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto
Quoted 15 lines
note
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Quoted 6 lines
Quoted 3 lines
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
To be clear; I believe that, with the packing change, a third grant copy may be used for the initial slot and that is why we blow the array.
OK, thanks for the explanation. I'm fine with reverting the problematic changeset as that part of code is quite fragile now. Looking at the git history we've tripped over this many times, sigh.
Wei.
Quoted 46 lines · Paul Durrant
Quoted 46 lines
-----Original Message-----
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 07 October 2013 11:24
To: David Vrabel
Cc: Wei Liu; Ian Campbell; [email protected]; [email protected]; Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 5 lines
-----Original Message-----
From: David Vrabel
Sent: 07 October 2013 10:50
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu; IanCampbell;
Quoted 6 lines
Annie Li; Matt Wilson; Xi Xiong
Subject: Re: [Xen-devel] [PATCH net-next] xen-netback: fixxenvif_count_skb_slots()Quoted 1 line · Paul Durrant
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced anerror
Quoted 3 lines
into
Quoted 2 lines
xenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account,not
Quoted 2 lines
Quoted 2 lines
just the head length. This patch fixes the issue by dry-running the code from
xenvif_gop_skb()(and adjusting the comment above the functionto
Quoted 15 lines
note
Quoted 1 line
that).
If
4f0581d2582is causing theskb->datato be fully packed into a minimal number of slots then the simple DIV_ROUND_UP(skb_headlen(skb))
is correct.I think this change will miscount in the number of slots, over-estimating the count which I think will eventually cause netback to think the ring has no space when it has some.
Is the problem here not the miscounting of slots but running out of space in the grant table op array because we know use more copy ops?
Quoted 6 lines
Quoted 3 lines
Essentially yes. Netback is built on the assumption of no more than two grant copies per ring slot.
To be clear; I believe that, with the packing change, a third grant copy may be used for the initial slot and that is why we blow the array.
OK, thanks for the explanation. I'm fine with reverting the problematic changeset as that part of code is quite fragile now. Looking at the git history we've tripped over this many times, sigh.
Wei.
David Miller
maintainerFrom: Paul Durrant <[email protected]>
Date: Fri, 4 Oct 2013 17:26:23 +0100
Quoted 8 lines
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).Signed-off-by Paul Durrant <[email protected]>
There seems to be a lot of back and forth about what is the most desirable way forward wrt. this commit and another similar one.
Please advise.
David Miller
maintainerFrom: Paul Durrant <[email protected]>
Date: Fri, 4 Oct 2013 17:26:23 +0100
Quoted 8 lines
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).Signed-off-by Paul Durrant <[email protected]>
There seems to be a lot of back and forth about what is the most desirable way forward wrt. this commit and another similar one.
Please advise.
Quoted 10 lines · David Miller
From: Paul Durrant <[email protected]>
Date: Fri, 4 Oct 2013 17:26:23 +0100Quoted 7 lines
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
Quoted 6 lines
Quoted 1 line
Signed-off-by Paul Durrant <[email protected]>There seems to be a lot of back and forth about what is the most desirable way forward wrt. this commit and another similar one.
Please advise.
Lets revert 4f0581d25827d5e864bcf07b05d73d0d12a20a5c and see about making this stuff less fragile in the future.
Thanks,
Ian.
Quoted 10 lines · David Miller
From: Paul Durrant <[email protected]>
Date: Fri, 4 Oct 2013 17:26:23 +0100Quoted 7 lines
Commit
4f0581d25827d5e864bcf07b05d73d0d12a20a5cintroduced an error intoxenvif_count_skb_slots()for skbs with a linear area spanning a page boundary. The alignment ofskb->dataneeds to be taken into account, not just the head length. This patch fixes the issue by dry-running the code fromxenvif_gop_skb()(and adjusting the comment above the function to note that).
Quoted 6 lines
Quoted 1 line
Signed-off-by Paul Durrant <[email protected]>There seems to be a lot of back and forth about what is the most desirable way forward wrt. this commit and another similar one.
Please advise.
Lets revert 4f0581d25827d5e864bcf07b05d73d0d12a20a5c and see about making this stuff less fragile in the future.
Thanks,
Ian.