xen-netback: remove unconditional pull_skb_tail in guest Tx path
Subsystems (3)
PATCH 1/1 xen-netback: remove unconditional pull_skb_tail in guest Tx path
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
--- drivers/net/xen-netback/netback.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/net/xen-netback/netback.c +12 -14
@@ -82,6 +82,16 @@ MODULE_PARM_DESC(max_queues,static unsigned int fatal_skb_slots =FATAL_SKB_SLOTS_DEFAULT ;module_param (fatal_skb_slots, uint,0444 ); +/* The amount to copy out of the first guest Tx slot into the skb's +* linear area. If the first slot has more data, it will be mapped +* and put into the first frag. +* +* This is sized to avoid pulling headers from the frags for most +* TCP/IP packets. +*/ +#define XEN_NETBACK_TX_COPY_LEN 128 + +static void xenvif_idx_release (struct xenvif_queue *queue,u16 pending_idx,u8 status);
@@ -125,13 +135,6 @@ static inline struct xenvif_queue *ubuf_to_queue(const struct ubuf_info *ubuf) pending_tx_info[0]); } -/* This is a miniumum size for the linear area to avoid lots of -* calls to __pskb_pull_tail() as we set up checksum offsets. The -* value 128 was chosen as it covers all IPv4 and most likely -* IPv6 headers. -*/ -#define PKT_PROT_LEN 128 -static u16 frag_get_pending_idx (skb_frag_t *frag) {return (u16 )frag->page_offset;
@@ -1446,9 +1449,9 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, index =pending_index (queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size >PKT_PROT_LEN && + data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN && ret <XEN_NETBK_LEGACY_SLOTS_MAX ) ? -PKT_PROT_LEN : txreq.size; +XEN_NETBACK_TX_COPY_LEN : txreq.size; skb =xenvif_alloc_skb (data_len);if (unlikely (skb ==NULL )) {
@@ -1653,11 +1656,6 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) } } -if (skb_is_nonlinear (skb) &&skb_headlen (skb) <PKT_PROT_LEN ) { -int target =min_t (int, skb->len,PKT_PROT_LEN ); -__pskb_pull_tail (skb, target -skb_headlen (skb)); - } - skb->dev = queue->vif->dev; skb->protocol =eth_type_trans (skb, skb->dev);skb_reset_network_header (skb);
Signature · 1 line
1.7.10.4
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
Quoted 20 lines
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>--- drivers/net/xen-netback/netback.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)drivers/net/xen-netback/netback.c +0
-0@@ -82,6 +82,16 @@ MODULE_PARM_DESC(max_queues,static unsigned int fatal_skb_slots =FATAL_SKB_SLOTS_DEFAULT ;
drivers/net/xen-netback/netback.c MODULE_PARM_DESC(max_queues, · line 92
Quoted 10 lines
drivers/net/xen-netback/netback.c +8
-0module_param (fatal_skb_slots, uint,0444 ); +/* The amount to copy out of the first guest Tx slot into the skb's +* linear area. If the first slot has more data, it will be mapped +* and put into the first frag. +* +* This is sized to avoid pulling headers from the frags for most +* TCP/IP packets. +*/ +#define XEN_NETBACK_TX_COPY_LEN 128
Was it strictly necessary to both move and rename this? I can see why the comment needed to change.
Quoted 41 lines
drivers/net/xen-netback/netback.c +2
-14static void xenvif_idx_release (struct xenvif_queue *queue,u16 pending_idx,u8 status);@@ -125,13 +135,6 @@ static inline struct xenvif_queue *ubuf_to_queue(const struct ubuf_info *ubuf) pending_tx_info[0]); } -/* This is a miniumum size for the linear area to avoid lots of -* calls to __pskb_pull_tail() as we set up checksum offsets. The -* value 128 was chosen as it covers all IPv4 and most likely -* IPv6 headers. -*/ -#define PKT_PROT_LEN 128 -static u16 frag_get_pending_idx (skb_frag_t *frag) {return (u16 )frag->page_offset;@@ -1446,9 +1449,9 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, index =pending_index (queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size >PKT_PROT_LEN && + data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN && ret <XEN_NETBK_LEGACY_SLOTS_MAX ) ? -PKT_PROT_LEN : txreq.size; +XEN_NETBACK_TX_COPY_LEN : txreq.size; skb =xenvif_alloc_skb (data_len);if (unlikely (skb ==NULL )) {@@ -1653,11 +1656,6 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) } } -if (skb_is_nonlinear (skb) &&skb_headlen (skb) <PKT_PROT_LEN ) { -int target =min_t (int, skb->len,PKT_PROT_LEN ); -__pskb_pull_tail (skb, target -skb_headlen (skb)); - } - skb->dev = queue->vif->dev; skb->protocol =eth_type_trans (skb, skb->dev);skb_reset_network_header (skb);
Quoted 10 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
e.g., see skb_checksum_setup() called slightly later on in netback.
Quoted 6 lines
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
The grant copy only copies from the first frag which may be less than 128 bytes in length.
David
Quoted 9 lines · David Vrabel
Quoted 8 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
Quoted 6 lines
Quoted 2 lines
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
I don't believe it will, unless something changed since I last looked. The kernel assumes that it has been sensible enough to put the headers in the linear area, since it is the one which generates them in most cases. In other cases its up to the relevant driver to make sure this is true.
Quoted 1 line
e.g., see
skb_checksum_setup()called slightly later on in netback.
This however is what will make things safe for us (note that this is only used by xen-net* in practice), it is this which should be mentioned in the commit message I think.
Quoted 11 lines
Quoted 6 lines
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
The grant copy only copies from the first frag which may be less than 128 bytes in length.
David
Quoted 9 lines · David Vrabel
Quoted 8 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
Quoted 6 lines
Quoted 2 lines
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
I don't believe it will, unless something changed since I last looked. The kernel assumes that it has been sensible enough to put the headers in the linear area, since it is the one which generates them in most cases. In other cases its up to the relevant driver to make sure this is true.
Quoted 1 line
e.g., see
skb_checksum_setup()called slightly later on in netback.
This however is what will make things safe for us (note that this is only used by xen-net* in practice), it is this which should be mentioned in the commit message I think.
Quoted 11 lines
Quoted 6 lines
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
The grant copy only copies from the first frag which may be less than 128 bytes in length.
David
Quoted 9 lines · David Vrabel
Quoted 8 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
Quoted 6 lines
Quoted 2 lines
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
I wouldn't bet my life on this, but indeed it should always happen.
Quoted 2 lines
e.g., see
skb_checksum_setup()called slightly later on in netback.
Fortunately the call to checksum_setup a bit later makes sure that at least the TCP/UDP headers are in the linear area, which is quite the same as blindly pulling 128 bytes. With any other protocol we rely on the network stack that it will enforce packet header in the linear buffer.
Regards,
Zoli
David Miller
maintainerFrom: Zoltan Kiss <[email protected]>
Date: Mon, 03 Nov 2014 18:23:03 +0000
Quoted 16 lines · David Vrabel
Quoted 13 lines · Ian Campbell
Quoted 11 lines · David Vrabel
Quoted 6 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which
would be bad.
Quoted 5 lines
Quoted 4 lines
The network stack will always pull any headers it needs to inspect (the
frag may be a userspace page which has the same security issues as a frag with a foreign page).I wouldn't bet my life on this, but indeed it should always happen.
I would bet my life on it.
Every protocol demux starts with pskb_may_pull() to pull frag data into the linear area, if necessary, before looking at headers.
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen() might be relevant as well, to perform a single copy of exactly all headers.
This is known to help a bit.
Quoted 9 lines · Eric Dumazet
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen()might be relevant as well, to perform a single copy of exactly all headers.
In netback's case we need an estimate of the header length before reading any of the packet, since peeking at any frag would prevent any TLB flush avoidance.
It might be useful to use eth_get_headlen() to adjust the estimate at runtime, but for now the fixed amount of 128 bytes is simple and seems good enough.
David
Quoted 11 lines · David Vrabel
Quoted 9 lines · Eric Dumazet
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen()might be relevant as well, to perform a single copy of exactly all headers.
Quoted 7 lines
In netback's case we need an estimate of the header length before reading any of the packet, since peeking at any frag would prevent any TLB flush avoidance.
It might be useful to use
eth_get_headlen()to adjust the estimate at runtime, but for now the fixed amount of 128 bytes is simple and seems good enough.
I think what Eric meant was that having done the 128 copy you could call eth_get_headlen which in the common case should be a nop but would ensure you always had the headers in the linear area for the uncommon case.
It looks like the difference compared with skb_checksum_setup is that eth_get_headlen deals with L4 too whereas skb_checksum_setup only goes to L3 (and then only for some subset of protocols with checksums).
Ian.
Quoted 11 lines · David Vrabel
Quoted 9 lines · Eric Dumazet
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen()might be relevant as well, to perform a single copy of exactly all headers.
Quoted 7 lines
In netback's case we need an estimate of the header length before reading any of the packet, since peeking at any frag would prevent any TLB flush avoidance.
It might be useful to use
eth_get_headlen()to adjust the estimate at runtime, but for now the fixed amount of 128 bytes is simple and seems good enough.
I think what Eric meant was that having done the 128 copy you could call eth_get_headlen which in the common case should be a nop but would ensure you always had the headers in the linear area for the uncommon case.
It looks like the difference compared with skb_checksum_setup is that eth_get_headlen deals with L4 too whereas skb_checksum_setup only goes to L3 (and then only for some subset of protocols with checksums).
Ian.
Quoted 9 lines · Eric Dumazet
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen()might be relevant as well, to perform a single copy of exactly all headers.
In netback's case we need an estimate of the header length before reading any of the packet, since peeking at any frag would prevent any TLB flush avoidance.
It might be useful to use eth_get_headlen() to adjust the estimate at runtime, but for now the fixed amount of 128 bytes is simple and seems good enough.
David
Quoted 3 lines · David Miller
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
eth_get_headlen() might be relevant as well, to perform a single copy of exactly all headers.
This is known to help a bit.
Quoted 23 lines · David Miller
From: Zoltan Kiss <[email protected]>
Date: Mon, 03 Nov 2014 18:23:03 +0000Quoted 20 lines · David Vrabel
Quoted 17 lines · Ian Campbell
Quoted 11 lines · David Vrabel
Quoted 6 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which
would be bad.The network stack will always pull any headers it needs to inspect (the
frag may be a userspace page which has the same security issues as a frag with a foreign page).
Quoted 6 lines
Quoted 1 line
I wouldn't bet my life on this, but indeed it should always happen.
I would bet my life on it.
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
Then I stand corrected, I was sure this wasn't the case (but my information could well be a decade out of date...).
Is this also true for things which hit the iptables paths? I suppose they must necessarily have already been through the protocol demux stage before iptables would even be able to interpret them as e.g. an IP packet.
Ian.
David Miller
maintainerFrom: Ian Campbell <[email protected]>
Date: Wed, 5 Nov 2014 09:51:20 +0000
Quoted 4 lines
Is this also true for things which hit the iptables paths? I suppose they must necessarily have already been through the protocol demux stage before iptables would even be able to interpret them as e.g. an IP packet.
Netfilter often takes a different approach, by using skb_header_pointer() which returns a direct pointer if the linear area contains the requested range already, or alternatively copies from the frags into a user supplied on-stack header buffer if not.
David Miller
maintainerFrom: Ian Campbell <[email protected]>
Date: Wed, 5 Nov 2014 09:51:20 +0000
Quoted 4 lines
Is this also true for things which hit the iptables paths? I suppose they must necessarily have already been through the protocol demux stage before iptables would even be able to interpret them as e.g. an IP packet.
Netfilter often takes a different approach, by using skb_header_pointer() which returns a direct pointer if the linear area contains the requested range already, or alternatively copies from the frags into a user supplied on-stack header buffer if not.
Quoted 23 lines · David Miller
From: Zoltan Kiss <[email protected]>
Date: Mon, 03 Nov 2014 18:23:03 +0000Quoted 20 lines · David Vrabel
Quoted 17 lines · Ian Campbell
Quoted 11 lines · David Vrabel
Quoted 6 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which
would be bad.The network stack will always pull any headers it needs to inspect (the
frag may be a userspace page which has the same security issues as a frag with a foreign page).
Quoted 6 lines
Quoted 1 line
I wouldn't bet my life on this, but indeed it should always happen.
I would bet my life on it.
Every protocol demux starts with
pskb_may_pull()to pull frag data into the linear area, if necessary, before looking at headers.
Then I stand corrected, I was sure this wasn't the case (but my information could well be a decade out of date...).
Is this also true for things which hit the iptables paths? I suppose they must necessarily have already been through the protocol demux stage before iptables would even be able to interpret them as e.g. an IP packet.
Ian.
David Miller
maintainerFrom: Zoltan Kiss <[email protected]>
Date: Mon, 03 Nov 2014 18:23:03 +0000
Quoted 16 lines · David Vrabel
Quoted 13 lines · Ian Campbell
Quoted 11 lines · David Vrabel
Quoted 6 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which
would be bad.
Quoted 5 lines
Quoted 4 lines
The network stack will always pull any headers it needs to inspect (the
frag may be a userspace page which has the same security issues as a frag with a foreign page).I wouldn't bet my life on this, but indeed it should always happen.
I would bet my life on it.
Every protocol demux starts with pskb_may_pull() to pull frag data into the linear area, if necessary, before looking at headers.
Quoted 9 lines · David Vrabel
Quoted 8 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
Quoted 6 lines
Quoted 2 lines
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
I wouldn't bet my life on this, but indeed it should always happen.
Quoted 2 lines
e.g., see
skb_checksum_setup()called slightly later on in netback.
Fortunately the call to checksum_setup a bit later makes sure that at least the TCP/UDP headers are in the linear area, which is quite the same as blindly pulling 128 bytes. With any other protocol we rely on the network stack that it will enforce packet header in the linear buffer.
Regards,
Zoli
Quoted 10 lines · Ian Campbell
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
The network stack will always pull any headers it needs to inspect (the frag may be a userspace page which has the same security issues as a frag with a foreign page).
e.g., see skb_checksum_setup() called slightly later on in netback.
Quoted 6 lines
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
The grant copy only copies from the first frag which may be less than 128 bytes in length.
David
Quoted 6 lines · David Vrabel
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
What about when it doesn't? It sounds as if we now won't pull up, which would be bad.
To avoid the pull up the code would need to grant copy up-to 128 bytes from as many slots as needed, not only the first.
Also, if the grant copy has already placed 128 bytes in the linear area, why is the pull up touching anything in the first place? Shouldn't it be a nop in that case?
Quoted 20 lines
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>--- drivers/net/xen-netback/netback.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)drivers/net/xen-netback/netback.c +0
-0@@ -82,6 +82,16 @@ MODULE_PARM_DESC(max_queues,static unsigned int fatal_skb_slots =FATAL_SKB_SLOTS_DEFAULT ;
drivers/net/xen-netback/netback.c MODULE_PARM_DESC(max_queues, · line 92
Quoted 10 lines
drivers/net/xen-netback/netback.c +8
-0module_param (fatal_skb_slots, uint,0444 ); +/* The amount to copy out of the first guest Tx slot into the skb's +* linear area. If the first slot has more data, it will be mapped +* and put into the first frag. +* +* This is sized to avoid pulling headers from the frags for most +* TCP/IP packets. +*/ +#define XEN_NETBACK_TX_COPY_LEN 128
Was it strictly necessary to both move and rename this? I can see why the comment needed to change.
Quoted 41 lines
drivers/net/xen-netback/netback.c +2
-14static void xenvif_idx_release (struct xenvif_queue *queue,u16 pending_idx,u8 status);@@ -125,13 +135,6 @@ static inline struct xenvif_queue *ubuf_to_queue(const struct ubuf_info *ubuf) pending_tx_info[0]); } -/* This is a miniumum size for the linear area to avoid lots of -* calls to __pskb_pull_tail() as we set up checksum offsets. The -* value 128 was chosen as it covers all IPv4 and most likely -* IPv6 headers. -*/ -#define PKT_PROT_LEN 128 -static u16 frag_get_pending_idx (skb_frag_t *frag) {return (u16 )frag->page_offset;@@ -1446,9 +1449,9 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, index =pending_index (queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size >PKT_PROT_LEN && + data_len = (txreq.size >XEN_NETBACK_TX_COPY_LEN && ret <XEN_NETBK_LEGACY_SLOTS_MAX ) ? -PKT_PROT_LEN : txreq.size; +XEN_NETBACK_TX_COPY_LEN : txreq.size; skb =xenvif_alloc_skb (data_len);if (unlikely (skb ==NULL )) {@@ -1653,11 +1656,6 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) } } -if (skb_is_nonlinear (skb) &&skb_headlen (skb) <PKT_PROT_LEN ) { -int target =min_t (int, skb->len,PKT_PROT_LEN ); -__pskb_pull_tail (skb, target -skb_headlen (skb)); - } - skb->dev = queue->vif->dev; skb->protocol =eth_type_trans (skb, skb->dev);skb_reset_network_header (skb);
David Miller
maintainerFrom: David Vrabel <[email protected]>
Date: Mon, 3 Nov 2014 17:23:51 +0000
Quoted 12 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Quoted 5 lines
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>
Now that this has been discussed a bit, it is possible to get an ack or two?
Thanks.
Quoted 15 lines · David Miller
From: David Vrabel <[email protected]>
Date: Mon, 3 Nov 2014 17:23:51 +0000Quoted 12 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Quoted 7 lines
Quoted 5 lines
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>Now that this has been discussed a bit, it is possible to get an ack or two?
I'd like to see the commit message expanded to explain why this isn't introducing a (security) bug by not pulling enough stuff into the header (IOW the conclusion of the discussion).
Ian.
David Miller
maintainerFrom: Ian Campbell <[email protected]>
Date: Wed, 5 Nov 2014 09:53:05 +0000
Quoted 3 lines
I'd like to see the commit message expanded to explain why this isn't introducing a (security) bug by not pulling enough stuff into the header (IOW the conclusion of the discussion).
Just because a fundamental aspect of how we handle packets isn't clear to some people, doesn't mean that every commit that depends upon that invariant has to explain it in the commit message. :-)
David Miller
maintainerFrom: Ian Campbell <[email protected]>
Date: Wed, 5 Nov 2014 09:53:05 +0000
Quoted 3 lines
I'd like to see the commit message expanded to explain why this isn't introducing a (security) bug by not pulling enough stuff into the header (IOW the conclusion of the discussion).
Just because a fundamental aspect of how we handle packets isn't clear to some people, doesn't mean that every commit that depends upon that invariant has to explain it in the commit message. :-)
Quoted 15 lines · David Miller
From: David Vrabel <[email protected]>
Date: Mon, 3 Nov 2014 17:23:51 +0000Quoted 12 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Quoted 7 lines
Quoted 5 lines
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>Now that this has been discussed a bit, it is possible to get an ack or two?
I'd like to see the commit message expanded to explain why this isn't introducing a (security) bug by not pulling enough stuff into the header (IOW the conclusion of the discussion).
Ian.
David Miller
maintainerFrom: David Vrabel <[email protected]>
Date: Mon, 3 Nov 2014 17:23:51 +0000
Quoted 12 lines
From: Malcolm Crossley <[email protected]>
Unconditionally pulling 128 bytes into the linear buffer is not required. Netback has already grant copied up-to 128 bytes from the first slot of a packet into the linear buffer. The first slot normally contain all the IPv4/IPv6 and TCP/UDP headers.
The unconditional pull would often copy frag data unnecessarily. This is a performance problem when running on a version of Xen where grant unmap avoids TLB flushes for pages which are not accessed. TLB flushes can now be avoided for > 99% of unmaps (it was 0% before).
Quoted 5 lines
Grant unmap TLB flush avoidance will be available in a future version of Xen (probably 4.6).
Signed-off-by Malcolm Crossley <[email protected]>Signed-off-by David Vrabel <[email protected]>
Now that this has been discussed a bit, it is possible to get an ack or two?
Thanks.