netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
@ 2010-06-30  4:38 Jeff Kirsher
  2010-06-30 21:28 ` David Miller
  2010-07-01 11:28 ` Andi Kleen
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Kirsher @ 2010-06-30  4:38 UTC (permalink / raw)
  To: davem
  Cc: netdev, gospo, bphilips, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Alexander Duyck, Jeff Kirsher

From: Alexander Duyck <alexander.h.duyck@intel.com>

x86 architectures can handle unaligned accesses in hardware, and it has
been shown that unaligned DMA accesses can be expensive on Nehalem
architectures.  As such we should overwrite NET_IP_ALIGN to resolve
this issue.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 arch/x86/include/asm/system.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index b8fe48e..b4293fc 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -457,4 +457,13 @@ static inline void rdtsc_barrier(void)
 	alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
 }
 
+#ifdef CONFIG_MCORE2
+/*
+ * We handle most unaligned accesses in hardware.  On the other hand
+ * unaligned DMA can be quite expensive on some Nehalem processors.
+ *
+ * Based on this we disable the IP header alignment in network drivers.
+ */
+#define NET_IP_ALIGN	0
+#endif
 #endif /* _ASM_X86_SYSTEM_H */


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-06-30  4:38 [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch Jeff Kirsher
@ 2010-06-30 21:28 ` David Miller
  2010-06-30 21:32   ` H. Peter Anvin
  2010-07-01 11:28 ` Andi Kleen
  1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2010-06-30 21:28 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: netdev, gospo, bphilips, tglx, mingo, hpa, x86, alexander.h.duyck

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 29 Jun 2010 21:38:00 -0700

> From: Alexander Duyck <alexander.h.duyck@intel.com>
> 
> x86 architectures can handle unaligned accesses in hardware, and it has
> been shown that unaligned DMA accesses can be expensive on Nehalem
> architectures.  As such we should overwrite NET_IP_ALIGN to resolve
> this issue.
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Can I get an x86'er ACK on this?  I can merge it in via net-next-2.6
which is probably most convenient for people who want to see the
networking performance effects of this change.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-06-30 21:28 ` David Miller
@ 2010-06-30 21:32   ` H. Peter Anvin
  2010-06-30 21:34     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2010-06-30 21:32 UTC (permalink / raw)
  To: David Miller
  Cc: jeffrey.t.kirsher, netdev, gospo, bphilips, tglx, mingo, x86,
	alexander.h.duyck

On 06/30/2010 02:28 PM, David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Tue, 29 Jun 2010 21:38:00 -0700
> 
>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>>
>> x86 architectures can handle unaligned accesses in hardware, and it has
>> been shown that unaligned DMA accesses can be expensive on Nehalem
>> architectures.  As such we should overwrite NET_IP_ALIGN to resolve
>> this issue.
>>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: x86@kernel.org
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> 
> Can I get an x86'er ACK on this?  I can merge it in via net-next-2.6
> which is probably most convenient for people who want to see the
> networking performance effects of this change.

Acked-by: H. Peter Anvin <hpa@zytor.com>

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-06-30 21:32   ` H. Peter Anvin
@ 2010-06-30 21:34     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2010-06-30 21:34 UTC (permalink / raw)
  To: hpa
  Cc: jeffrey.t.kirsher, netdev, gospo, bphilips, tglx, mingo, x86,
	alexander.h.duyck

From: "H. Peter Anvin" <hpa@zytor.com>
Date: Wed, 30 Jun 2010 14:32:33 -0700

> On 06/30/2010 02:28 PM, David Miller wrote:
>> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> Date: Tue, 29 Jun 2010 21:38:00 -0700
>> 
>>> From: Alexander Duyck <alexander.h.duyck@intel.com>
>>>
>>> x86 architectures can handle unaligned accesses in hardware, and it has
>>> been shown that unaligned DMA accesses can be expensive on Nehalem
>>> architectures.  As such we should overwrite NET_IP_ALIGN to resolve
>>> this issue.
>>>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> Cc: Ingo Molnar <mingo@redhat.com>
>>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>>> Cc: x86@kernel.org
>>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> 
>> Can I get an x86'er ACK on this?  I can merge it in via net-next-2.6
>> which is probably most convenient for people who want to see the
>> networking performance effects of this change.
> 
> Acked-by: H. Peter Anvin <hpa@zytor.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-06-30  4:38 [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch Jeff Kirsher
  2010-06-30 21:28 ` David Miller
@ 2010-07-01 11:28 ` Andi Kleen
  2010-07-01 20:37   ` Alexander Duyck
  1 sibling, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2010-07-01 11:28 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: davem, netdev, gospo, bphilips, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, Alexander Duyck

Jeff Kirsher <jeffrey.t.kirsher@intel.com> writes:


Sorry for the late comment.

>  
> +#ifdef CONFIG_MCORE2
> +/*
> + * We handle most unaligned accesses in hardware.  On the other hand
> + * unaligned DMA can be quite expensive on some Nehalem processors.
> + *
> + * Based on this we disable the IP header alignment in network drivers.
> + */
> +#define NET_IP_ALIGN	0
> +#endif
>  #endif /* _ASM_X86_SYSTEM_H */

The ifdef should be imho dropped and the option be made unconditional
for all x86. I am not aware of any x86 core where unalignment is really
slow. This would increase the chance of it actually working on many
configurations which do not necessarily optimize for Core2.

-Andi
-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-07-01 11:28 ` Andi Kleen
@ 2010-07-01 20:37   ` Alexander Duyck
  2010-07-01 20:41     ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Duyck @ 2010-07-01 20:37 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Kirsher, Jeffrey T, davem@davemloft.net, netdev@vger.kernel.org,
	gospo@redhat.com, bphilips@novell.com, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86@kernel.org

Andi Kleen wrote:
> Jeff Kirsher <jeffrey.t.kirsher@intel.com> writes:
> 
> 
> Sorry for the late comment.
> 
>>  
>> +#ifdef CONFIG_MCORE2
>> +/*
>> + * We handle most unaligned accesses in hardware.  On the other hand
>> + * unaligned DMA can be quite expensive on some Nehalem processors.
>> + *
>> + * Based on this we disable the IP header alignment in network drivers.
>> + */
>> +#define NET_IP_ALIGN	0
>> +#endif
>>  #endif /* _ASM_X86_SYSTEM_H */
> 
> The ifdef should be imho dropped and the option be made unconditional
> for all x86. I am not aware of any x86 core where unalignment is really
> slow. This would increase the chance of it actually working on many
> configurations which do not necessarily optimize for Core2.
> 
> -Andi

Seems to make sense to me.  I will see about generating a patch that 
drops the check for CONFIG_MCORE2.

Thanks,

Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch
  2010-07-01 20:37   ` Alexander Duyck
@ 2010-07-01 20:41     ` H. Peter Anvin
  0 siblings, 0 replies; 7+ messages in thread
From: H. Peter Anvin @ 2010-07-01 20:41 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Andi Kleen, Kirsher, Jeffrey T, davem@davemloft.net,
	netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com,
	Thomas Gleixner, Ingo Molnar, x86@kernel.org

On 07/01/2010 01:37 PM, Alexander Duyck wrote:
> Andi Kleen wrote:
>> Jeff Kirsher <jeffrey.t.kirsher@intel.com> writes:
>>
>>
>> Sorry for the late comment.
>>
>>>  
>>> +#ifdef CONFIG_MCORE2
>>> +/*
>>> + * We handle most unaligned accesses in hardware.  On the other hand
>>> + * unaligned DMA can be quite expensive on some Nehalem processors.
>>> + *
>>> + * Based on this we disable the IP header alignment in network drivers.
>>> + */
>>> +#define NET_IP_ALIGN	0
>>> +#endif
>>>  #endif /* _ASM_X86_SYSTEM_H */
>>
>> The ifdef should be imho dropped and the option be made unconditional
>> for all x86. I am not aware of any x86 core where unalignment is really
>> slow. This would increase the chance of it actually working on many
>> configurations which do not necessarily optimize for Core2.
>>
>> -Andi
> 
> Seems to make sense to me.  I will see about generating a patch that 
> drops the check for CONFIG_MCORE2.
> 

Just drop the #ifdef ... #endif.

	-hpa

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-01 20:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30  4:38 [net-next-2.6 PATCH v2] x86: Align skb w/ start of cacheline on newer core 2/Xeon Arch Jeff Kirsher
2010-06-30 21:28 ` David Miller
2010-06-30 21:32   ` H. Peter Anvin
2010-06-30 21:34     ` David Miller
2010-07-01 11:28 ` Andi Kleen
2010-07-01 20:37   ` Alexander Duyck
2010-07-01 20:41     ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).