Skip to contentSkip to conversation

bug disabling guest interface

DISCUSSION Steven Haigh 9 participants 31 messages Mar 8, 2013 – Mar 13, 2013 Networking

lore
Share & tools
lore
#0 lore raw

Hi all,

I've been following this with some interest - as I've been getting numerous reports of this happening recently.

As Jacek Milewicz posted recently:
http://lists.xen.org/archives/html/xen-devel/2013-03/msg00404.html

It seems to affect both linux and windows DomUs.

Is there any further information on a possible fix for this? Thoughts? Ideas? As it seems to be hitting multiple sites, I'd like to get it fixed asap...

Signature · 6 lines
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

Hi All

Quoted 3 lines

Is there any further information on a possible fix for this? Thoughts? Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS))
-add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
  * Since GRO uses frags we allocate at least 16 regardless of page
  * size.
  */
-#if (65536/PAGE_SIZE + 1) < 16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1) < 19
+#define MAX_SKB_FRAGS 19UL
 #else
 #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
 #endif
#2 lore raw

Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 13 lines · Jacek Milewicz

Hi All

Quoted 3 lines

Is there any further information on a possible fix for this? Thoughts? Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS))
-add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 23 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
  * Since GRO uses frags we allocate at least 16 regardless of page
  * size.
  */
-#if (65536/PAGE_SIZE + 1) < 16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1) < 19
+#define MAX_SKB_FRAGS 19UL
 #else
 #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

#4 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

For what its worth, I've increased the value of MAX_SKB_FRAGS to 19 on my Dom0 kernel and pushed out new packages... I'll see if I get any further reports...

Signature · 6 lines
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Konrad Rzeszutek Wilk
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

If necessary netback could even allocate a larger order head in order to accommodate very large packets, but I don't expect that to be required to fix the immediate issue we are seeing (but gives flexibility)

This should get us past the immediate issue of the upstream change from 18->16 frags thing. Longer term the negotiation will allow us to avoid future incompatible changes in guest and host network stacks, as well as allowing frontends on other OSes (in particular Windows) to havea better chance of to DTRT.

Quoted 26 lines

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 23 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
  * Since GRO uses frags we allocate at least 16 regardless of page
  * size.
  */
-#if (65536/PAGE_SIZE + 1) < 16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1) < 19
+#define MAX_SKB_FRAGS 19UL
 #else
 #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 4 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

I agree. Its a hack that seems to work until we have something else to offer though. I'll be honest, the internals of the kernel interactions like this is a bit beyond my knowledge - but I get quite a few emails of stuff going strange. This one has increased dramatically in the past week.

Quoted 9 lines
Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

I did see some talk about it on the xen-devel lists quite some time ago - however it seemed to die with no outcome that I could find. Maybe its a good time for a nudge on the matter :)

Quoted 9 lines

If necessary netback could even allocate a larger order head in order to accommodate very large packets, but I don't expect that to be required to fix the immediate issue we are seeing (but gives flexibility)

This should get us past the immediate issue of the upstream change from 18->16 frags thing. Longer term the negotiation will allow us to avoid future incompatible changes in guest and host network stacks, as well as allowing frontends on other OSes (in particular Windows) to havea better chance of to DTRT.

Whatever the fix, it has to be on the Dom0 kernel - as stated by others in the past, it isn't a feasible fix to include changes on the client. There would be too many different guest OSes that would make implementation a nightmare - or in fact impossible.

Quoted 2 lines
Quoted 2 lines

Annie, Wei, Ian - were there some RFC patches floating around for this?

I didn't stumble across any in the list archives that I hunted for. Not to say they don't exist, but I didn't find them if they do exist.

Signature · 6 lines
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Ian Campbell
Quoted 15 lines · you
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

Quoted 5 lines

If necessary netback could even allocate a larger order head in order to accommodate very large packets, but I don't expect that to be required to fix the immediate issue we are seeing (but gives flexibility)

This should get us past the immediate issue of the upstream change from

18->>16 frags thing. Longer term the negotiation will allow us to avoid

Quoted 6 lines

future incompatible changes in guest and host network stacks, as well as allowing frontends on other OSes (in particular Windows) to havea better chance of to DTRT.

Quoted 2 lines

Annie, Wei, Ian - were there some RFC patches floating around for this?

I think you refer to this thread ?

http://lists.xen.org/archives/html/xen-devel/2013-01/msg00198.html

And i see the annie's patch and my response haven't made the list because annie dropped xen-devel from the response. I will forward them ..

--
Sander

Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
  * Since GRO uses frags we allocate at least 16 regardless of page
  * size.
  */
-#if (65536/PAGE_SIZE + 1) < 16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1) < 19
+#define MAX_SKB_FRAGS 19UL
 #else
 #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#30 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Konrad Rzeszutek Wilk
Quoted 16 lines · Konrad Rzeszutek Wilk
Quoted 12 lines · Jacek Milewicz

Hi All

Quoted 2 lines

Is there any further information on a possible fix for this? Thoughts? Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS))
-add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Quoted 6 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Actually I did plan to do it, but failed to start it because of windows WHQL things.

Thanks
Annie

Quoted 23 lines
Quoted 23 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
   * Since GRO uses frags we allocate at least 16 regardless of page
   * size.
   */
-#if (65536/PAGE_SIZE + 1)<  16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1)<  19
+#define MAX_SKB_FRAGS 19UL
  #else
  #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
  #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#16 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Ian Campbell
Quoted 4 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 8 lines
Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

Sorry, I have been working on some windows whql thing these days, so did not start it till now.
I did do some patch for netfront before(Sander mentioned later), which did some segment for large skbs in netfront. This is different from what you mentioned. I assume we need to do some work in both netback and netfront.

Thanks
Annie

Quoted 42 lines

If necessary netback could even allocate a larger order head in order to accommodate very large packets, but I don't expect that to be required to fix the immediate issue we are seeing (but gives flexibility)

This should get us past the immediate issue of the upstream change from 18->16 frags thing. Longer term the negotiation will allow us to avoid future incompatible changes in guest and host network stacks, as well as allowing frontends on other OSes (in particular Windows) to havea better chance of to DTRT.

Quoted 20 lines

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 17 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
   * Since GRO uses frags we allocate at least 16 regardless of page
   * size.
   */
-#if (65536/PAGE_SIZE + 1)<  16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1)<  19
+#define MAX_SKB_FRAGS 19UL
  #else
  #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
  #endif
Quoted 5 lines
Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#15 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Sander Eikelenboom
Quoted 22 lines · Sander Eikelenboom
Quoted 6 lines · you
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 9 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)
If necessary netback could even allocate a larger order head in order to accommodate very large packets, but I don't expect that to be required to fix the immediate issue we are seeing (but gives flexibility) This should get us past the immediate issue of the upstream change from

18->>16 frags thing. Longer term the negotiation will allow us to avoid

Quoted 4 lines

future incompatible changes in guest and host network stacks, as well as allowing frontends on other OSes (in particular Windows) to havea better chance of to DTRT.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Annie, Wei, Ian - were there some RFC patches floating around for this?

I think you refer to this thread ?

http://lists.xen.org/archives/html/xen-devel/2013-01/msg00198.html

And i see the annie's patch and my response haven't made the list because annie dropped xen-devel from the response. I will forward them ..

Hi Sander,

This is a patch in which I tried to do some fix in netfront, the thread you mentioned is facing the same issue with this one.

Thanks
Annie

Quoted 39 lines

--
Sander

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
include/linux/skbuff.h +2 -2
index 821c7f4..82de0f5 100644
@@ -143,8 +143,8 @@ struct sk_buff;
   * Since GRO uses frags we allocate at least 16 regardless of page
   * size.
   */
-#if (65536/PAGE_SIZE + 1)<  16
-#define MAX_SKB_FRAGS 16UL
+#if (65536/PAGE_SIZE + 1)<  19
+#define MAX_SKB_FRAGS 19UL
  #else
  #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
  #endif
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#18 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Ian Campbell
Quoted 9 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags >= MAX_SKB_FRAGS?

Wei.

#17 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to ANNIE LI
Quoted 4 lines · ANNIE LI

I did do some patch for netfront before(Sander mentioned later), which did some segment for large skbs in netfront. This is different from what you mentioned. I assume we need to do some work in both netback and netfront.

The fix I'm talking about in <[email protected]> should be netback only.

Ian.

#19 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Wei Liu
Quoted 17 lines · Wei Liu
Quoted 9 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

Quoted 2 lines

As a short term fix, can we use skb_linearize() if skb->nr_frags >= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags >= MAX_SKB_FRAGS in order to pass it to that function.

I'd worry about failing the higher order allocations needed to linearize in this way too -- better to coalesce as much as possible into single page frags.

Ian.

#20 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 21 lines · Ian Campbell
Quoted 17 lines · Wei Liu
Quoted 9 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

Quoted 2 lines

As a short term fix, can we use skb_linearize() if skb->nr_frags >= MAX_SKB_FRAGS?

Quoted 7 lines

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags >= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I wrote some code during weekend and it seemed to work, but I have not verify it extensively.

Wei.

#5 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Jacek Milewicz
Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

Sure. The other option in the xen-netback might be a configurable option to let net-back know that it is running with older guests which expect 18 size MAX_SKB_FRAGS. That way we have the negotiation part, the code to deal with backend MAX_SKB_FRAGS != frontend MAX_SKB_FRAGS and the value that the system admin provides.

What I am saying is that if we get the negotiation protcol figured out properly we can provide a per-guest value that the system admin can over-write to say: "I know that this guest uses _this_ size".

#11 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Jacek Milewicz
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

Quoted 6 lines

Sure. But the other option in the xen-netback might be a configurable option to let net-back know that it is running with older guests which expect 18 size MAX_SKB_FRAGS. That way we have the negotiation part, the code to deal with backend MAX_SKB_FRAGS != frontend MAX_SKB_FRAGS and the value that the system admin provides.

Re-sending as I think it never made it out.

#6 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Konrad Rzeszutek Wilk
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

Quoted 5 lines

Sure. The other option in the xen-netback might be a configurable option to let net-back know that it is running with older guests which expect 18 size MAX_SKB_FRAGS. That way we have the negotiation part, the code to deal with backend MAX_SKB_FRAGS != frontend MAX_SKB_FRAGS and the value that the system admin provides.

I think this is over complicating things. netback can and should be modified to be able to cope with guests using frags == 18 (or larger) even if it only itself supports frags == 16 by coalescing things in the obvious way. This works for all guest supplied frames up to 64K in size, regardless of the number of slots they use to represent that 64K.

The negotiation stuff is pretty orthogonal to this and is more about the MTU of GSO frames. In terms of priority this is a distant second to the above.

Ian.

#7 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 39 lines · Ian Campbell
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

Quoted 5 lines

Sure. The other option in the xen-netback might be a configurable option to let net-back know that it is running with older guests which expect 18 size MAX_SKB_FRAGS. That way we have the negotiation part, the code to deal with backend MAX_SKB_FRAGS != frontend MAX_SKB_FRAGS and the value that the system admin provides.

Quoted 5 lines

I think this is over complicating things. netback can and should be modified to be able to cope with guests using frags == 18 (or larger) even if it only itself supports frags == 16 by coalescing things in the obvious way. This works for all guest supplied frames up to 64K in size, regardless of the number of slots they use to represent that 64K.

On this, while we just hacked this in the kernel source to increase MAX_SKB_FRAGS to 19, I believe Jacek Milewicz tested 18 to work fine on linux guests, but it seems Windows guests would still fail unless it was increased to 19.

Signature · 6 lines
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299
#21 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Wei Liu
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

Coalescing frags before building skb could avoid this issue.

Thanks
Annie

Quoted 12 lines

I wrote some code during weekend and it seemed to work, but I have not verify it extensively.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Steven Haigh
Quoted 46 lines · Steven Haigh
Quoted 39 lines · Ian Campbell
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 24 lines · Jacek Milewicz
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is there any further information on a possible fix for this?

Thoughts?

Quoted 9 lines
Quoted 9 lines
Quoted 1 line

Ideas? As it seems to be hitting multiple sites, I'd like to get it

fixed asap...

There are 3 ways I can see this fixed:
- update guests so all have same MAX_SKB_FRAGS (that includes windows drivers (windows drivers use 19 for MAX_SKB_FRAGS)) -add some sort of negotiation between host and guest
- change MAX_SKB_FRAGS to 19 to accommodate all guests

Quoted 5 lines
Quoted 3 lines

Unfortunately first one requires changes to the guest and most don't have that luxury. So the only way I see it could be fixed without breaking compatibility even more is

Ugh. The negotiations between host and guest is probably the best

choice.

Quoted 1 line

The issues you are going to hit are that you might need to redo the skbs

to

Quoted 4 lines

match what the frontend's max is.

Annie, Wei, Ian - were there some RFC patches floating around for this?

Quoted 6 lines

As much as I agree that negotiation is the best option in long term. It relies on people upgrading their kernels - and this is not the case (only people running kernels from before 2011-12-23 are affected by this bug (I'm not sure about other platforms)).
And in a lot of cases (VPS providers) there is no easy way to upgrade guest kernels.

Quoted 5 lines

Sure. The other option in the xen-netback might be a configurable option to let net-back know that it is running with older guests which expect 18 size MAX_SKB_FRAGS. That way we have the negotiation part, the code to deal with backend MAX_SKB_FRAGS != frontend MAX_SKB_FRAGS and the value that the system admin provides.

Quoted 5 lines

I think this is over complicating things. netback can and should be modified to be able to cope with guests using frags == 18 (or larger) even if it only itself supports frags == 16 by coalescing things in the obvious way. This works for all guest supplied frames up to 64K in size, regardless of the number of slots they use to represent that 64K.

Quoted 4 lines

On this, while we just hacked this in the kernel source to increase MAX_SKB_FRAGS to 19, I believe Jacek Milewicz tested 18 to work fine on linux guests, but it seems Windows guests would still fail unless it was increased to 19.

No netback has TTBOMK ever support 19, so I don't know how those guests ever worked, but regardless doing coalescing in the backend would fix this at least for frames which are <64K in size.

Ian.

#22 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to ANNIE LI
Quoted 41 lines · ANNIE LI
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

Quoted 8 lines

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

So I haven't gone this far to trigger this. :-(

I just double checked with printk, nr_frags has not exceeded backend MAX_SBK_FRAGS even if I have frontend MAX_SKB_FRAGS = 25.

Quoted 2 lines

Coalescing frags before building skb could avoid this issue.

"before building skb" is a bit vague to me. Is it netbk_count_request? Is it xen_netbk_fill_frags? If it is the latter, we are already too late to fix this. If it is the former, we don't even start copying.

Wei

#23 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 56 lines · Wei Liu
Quoted 41 lines · ANNIE LI
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

Quoted 8 lines

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

So I haven't gone this far to trigger this. :-(

I just double checked with printk, nr_frags has not exceeded backend MAX_SBK_FRAGS even if I have frontend MAX_SKB_FRAGS = 25.

Quoted 8 lines
Quoted 2 lines

Coalescing frags before building skb could avoid this issue.

"before building skb" is a bit vague to me. Is it netbk_count_request? Is it xen_netbk_fill_frags? If it is the latter, we are already too late to fix this. If it is the former, we don't even start copying.

Actually the copy is done with Hypervisor, I don't know how it is possible to do coalesce while copying.

FWIW I came up with an idea. Netback maintains a ring of skb_frag_t groups. Each group has NETBK_SKB_MAX_FRAGS frags. So overall the size of this ring is MAX_PENGING_REQS * NETBK_SKB_MAX_FRAGS * sizeof(skb_frag_t). If NETBK_SKB_MAX_FRAGS == 20, skb_frag_t size == 16, this ring is 80K large.

If we detect frontend's frags > backend's SKB_MAX_FRAGS, we switch to use the new ring, and set skb->nr_frags to some specific number (say -1) and has frag[0].page.p set to ring index. Then we copy data as usual. Later in before xen_netbk_fill_frags if we detect this skb is should be constructed via previous skb frag ring, we accommodate those frags to that skb.

if (skb should be constructed via frag ring)
construct_skb()
else /* normal path
xen_netbk_fill_frags

This idea is essentially adding a slow path though, because construct_skb() potentially needs to copy / move data around.

Wei.

#24 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 9 lines · Wei Liu

Actually the copy is done with Hypervisor, I don't know how it is possible to do coalesce while copying.

FWIW I came up with an idea. Netback maintains a ring of skb_frag_t groups. Each group has NETBK_SKB_MAX_FRAGS frags. So overall the size of this ring is MAX_PENGING_REQS * NETBK_SKB_MAX_FRAGS * sizeof(skb_frag_t). If NETBK_SKB_MAX_FRAGS == 20, skb_frag_t size == 16, this ring is 80K large.

Just realized two things: 1. the ring size estimation is wrong; 2. we don't need a extra ring for this. :-)

We can alter how frags are handled inside netback to solve this issue. We can store start of pending_idx and end of pending_idx in skb->frags[0] and skb->frags[1] if frontend's MAX_SKB_FRAGS is larger than backend's.

Wei.

Quoted 19 lines

If we detect frontend's frags > backend's SKB_MAX_FRAGS, we switch to use the new ring, and set skb->nr_frags to some specific number (say -1) and has frag[0].page.p set to ring index. Then we copy data as usual. Later in before xen_netbk_fill_frags if we detect this skb is should be constructed via previous skb frag ring, we accommodate those frags to that skb.

if (skb should be constructed via frag ring)
construct_skb()
else /* normal path
xen_netbk_fill_frags

This idea is essentially adding a slow path though, because construct_skb() potentially needs to copy / move data around.

Wei.

#9 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Ian Campbell
Quoted 10 lines
Quoted 5 lines

On this, while we just hacked this in the kernel source to increase MAX_SKB_FRAGS to 19, I believe Jacek Milewicz tested 18 to work fine on linux guests, but it seems Windows guests would still fail unless it was increased to 19.

No netback has TTBOMK ever support 19, so I don't know how those guests ever worked, but regardless doing coalescing in the backend would fix this at least for frames which are <64K in size.

Well Windows could easily generate a packet with more than 19 buffers, and I have engineered situations where it could be much larger than that, but you aren't going to see such packets during regular usage.

Is there any consensus yet on what form max_buffers negotiation would take? Is it as simple as the frontend and backend each writing the maximum value they can support (without further work) to their respective xenstores?

What backends exist these days? Are BSD and Solaris backends still in existence? What are their respective limitations?

James

#10 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

This seems to create network performance issues. It seems that asterisk under unstable xen and 3.8.2 kernel gives lots of unreachable errors

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#28 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Wei Liu
Quoted 48 lines · Wei Liu
Quoted 39 lines · ANNIE LI
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

Quoted 8 lines

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

Quoted 4 lines

So I haven't gone this far to trigger this. :-(

I just double checked with printk, nr_frags has not exceeded backend MAX_SBK_FRAGS even if I have frontend MAX_SKB_FRAGS = 25.

You mean you changed MAX_SKB_FRAGS to 25 in skbuff.h? Did your frontend send out skbs with 25 frags?

Quoted 6 lines
Quoted 3 lines

Coalescing frags before building skb could avoid this issue.

"before building skb" is a bit vague to me. Is it netbk_count_request? Is it xen_netbk_fill_frags? If it is the latter, we are already too late to fix this. If it is the former, we don't even start copying.

I meant coalescing when doing grant copy after netbk_count_request and before xen_netbk_fill_frags. But we should take care of data offset of per request and merge them into pages.

Thanks
Annie

Quoted 4 lines

Wei

#25 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Wei Liu
Quoted 3 lines · Wei Liu

Actually the copy is done with Hypervisor, I don't know how it is possible to do coalesce while copying.

My understanding is we do coalescing in netback during grant copy. For example,

                 gop->source.u.ref = txreq.gref;
                 gop->source.domid = vif->domid;
                 gop->source.offset = txreq.offset;

                 gop->dest.u.gmfn = virt_to_mfn(page_address(page));  
--  here should be the page where we coalesce data into, it is likely the page is the one which previous request used.
                 gop->dest.domid = DOMID_SELF;
                 gop->dest.offset = txreq.offset;  -- dest.offset 

should be changed to something which represents the offset where we start coalescing data of this request

                 gop->len = txreq.size;  -- len should be the total len 
of data which we coalesce into a page
                 gop->flags = GNTCOPY_source_gref;

With this coalescing, it is possible that we could decrease the total frags number of skb in netback.

Thanks
Annie

#26 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to Wei Liu
Quoted 60 lines · Wei Liu
Quoted 59 lines · Wei Liu
Quoted 41 lines · ANNIE LI
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

Quoted 8 lines

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

So I haven't gone this far to trigger this. :-(

I just double checked with printk, nr_frags has not exceeded backend MAX_SBK_FRAGS even if I have frontend MAX_SKB_FRAGS = 25.

Quoted 2 lines

Coalescing frags before building skb could avoid this issue.

Quoted 8 lines
Quoted 5 lines

"before building skb" is a bit vague to me. Is it netbk_count_request? Is it xen_netbk_fill_frags? If it is the latter, we are already too late to fix this. If it is the former, we don't even start copying.

Actually the copy is done with Hypervisor, I don't know how it is possible to do coalesce while copying.

This can be done trivially by making the appropriate gnttab_copy hypercalls to copy from the guest memory into dom0 buffers, coalescing as you go. IOW you split each ring slot request into multiple (batched) copies in order to fill buffers etc.

Quoted 13 lines

FWIW I came up with an idea. Netback maintains a ring of skb_frag_t groups. Each group has NETBK_SKB_MAX_FRAGS frags. So overall the size of this ring is MAX_PENGING_REQS * NETBK_SKB_MAX_FRAGS * sizeof(skb_frag_t). If NETBK_SKB_MAX_FRAGS == 20, skb_frag_t size == 16, this ring is 80K large.

If we detect frontend's frags > backend's SKB_MAX_FRAGS, we switch to use the new ring, and set skb->nr_frags to some specific number (say -1) and has frag[0].page.p set to ring index. Then we copy data as usual. Later in before xen_netbk_fill_frags if we detect this skb is should be constructed via previous skb frag ring, we accommodate those frags to that skb.

Quoted 7 lines

if (skb should be constructed via frag ring)
construct_skb()
else /* normal path
xen_netbk_fill_frags

This idea is essentially adding a slow path though, because construct_skb() potentially needs to copy / move data around.

This is insanely complex for the problem at hand IMHO.

Ian.

#27 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

Quoted 6 lines · Ian Campbell
Quoted 3 lines

This idea is essentially adding a slow path though, because construct_skb() potentially needs to copy / move data around.

This is insanely complex for the problem at hand IMHO.

Hah, I guess my brain has the ability to overcomplicate things. :-)

Wei.

Quoted 2 lines

Ian.

#29 lore raw

Re: Is: SKB_MAX_LEN bites again. Was: Re: bug disabling guest interface

In reply to annie li
Quoted 49 lines · annie li
Quoted 48 lines · Wei Liu
Quoted 47 lines · ANNIE LI
Quoted 21 lines · Wei Liu
Quoted 20 lines · Ian Campbell
Quoted 8 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 1 line
Quoted 1 line

- change MAX_SKB_FRAGS to 19 to accommodate all guests

Changing MAX_SKB_FRAGS is *not* an option upstream. This might be a useful local hack but we need to drop the idea as a long term fix.

Quoted 3 lines

Ugh. The negotiations between host and guest is probably the best choice. The issues you are going to hit are that you might need to redo the skbs to match what the frontend's max is.

Quoted 8 lines
Quoted 6 lines

IMHO the right fix is for netback to coalesce as it copies from the frontend if it needs to do so, it is copying anyway so it should be cheap enough. I thought we had discussed this and someone was working on implementing it. If not Annie then perhaps it was Matt or Siva (both now CC'd)

As a short term fix, can we use skb_linearize() if skb->nr_frags>= MAX_SKB_FRAGS?

No, because that would require changing the frontend, while this fix needs to be in the backend if older guests are to continue working.

Quoted 8 lines
Quoted 4 lines

You can't use skb_linearize in netback as is because you would first need to be able to build the skb with nr_frags>= MAX_SKB_FRAGS in order to pass it to that function.

Yes, the idea is to define NETBK_MAX_SKB_FRAGS to some bigger number (say 20) to accommodate the possible maximum number of frags in frontend. The thing that truly matters it the skb->len, which should be <64K, nr_frags is not important.

I doubt this would work since you can not build out skb with nr_frags >= MAX_SKB_FRAGS. See following code in skbuff.h,

#if (65536/PAGE_SIZE + 1) < 16
#define MAX_SKB_FRAGS 16UL
#else
#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)
#endif

and every skb contains MAX_SKB_FRAGS frags,

struct skb_shared_info {
....
skb_frag_t frags[MAX_SKB_FRAGS];
...
}

Quoted 6 lines
Quoted 4 lines

So I haven't gone this far to trigger this. :-(

I just double checked with printk, nr_frags has not exceeded backend MAX_SBK_FRAGS even if I have frontend MAX_SKB_FRAGS = 25.

You mean you changed MAX_SKB_FRAGS to 25 in skbuff.h? Did your frontend

Yes. In frontend's kernel.

Quoted 2 lines

send out skbs with 25 frags?

No. The maximum number I see is 17.

I didn't spend much time on this though. It's just a little experiment during my weekend.

Wei.