* [PATCH] Revert "arm64: Increase the max granular size"
@ 2016-03-16 9:32 Ganesh Mahendran
2016-03-16 10:07 ` Will Deacon
2016-03-18 21:05 ` Chalamarla, Tirumalesh
0 siblings, 2 replies; 23+ messages in thread
From: Ganesh Mahendran @ 2016-03-16 9:32 UTC (permalink / raw)
To: catalin.marinas, will.deacon
Cc: linux-kernel, linux-arm-kernel, Ganesh Mahendran, stable
Reverts commit 97303480753e ("arm64: Increase the max granular size").
The commit 97303480753e ("arm64: Increase the max granular size") will
degrade system performente in some cpus.
We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
----------------
run on host:
# iperf -s
run on device:
# iperf -c <device-ip-addr> -t 100 -i 1
----------------
Test result:
----------------
with commit 97303480753e ("arm64: Increase the max granular size"):
172MBits/sec
without commit 97303480753e ("arm64: Increase the max granular size"):
230MBits/sec
----------------
Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
set the parameter correctly, it may affect the system performance.
So revert the commit.
Cc: stable@vger.kernel.org
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
---
arch/arm64/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 5082b30..bde4499 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -18,7 +18,7 @@
#include <asm/cachetype.h>
-#define L1_CACHE_SHIFT 7
+#define L1_CACHE_SHIFT 6
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 9:32 [PATCH] Revert "arm64: Increase the max granular size" Ganesh Mahendran
@ 2016-03-16 10:07 ` Will Deacon
2016-03-16 13:06 ` Timur Tabi
2016-03-18 21:05 ` Chalamarla, Tirumalesh
1 sibling, 1 reply; 23+ messages in thread
From: Will Deacon @ 2016-03-16 10:07 UTC (permalink / raw)
To: Ganesh Mahendran
Cc: catalin.marinas, stable, linux-kernel, linux-arm-kernel,
tchalamarla, rrichter, apinski, timur
[adding Cavium folk and Timur]
On Wed, Mar 16, 2016 at 05:32:23PM +0800, Ganesh Mahendran wrote:
> Reverts commit 97303480753e ("arm64: Increase the max granular size").
>
> The commit 97303480753e ("arm64: Increase the max granular size") will
> degrade system performente in some cpus.
>
> We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
> ----------------
> run on host:
> # iperf -s
> run on device:
> # iperf -c <device-ip-addr> -t 100 -i 1
> ----------------
>
> Test result:
> ----------------
> with commit 97303480753e ("arm64: Increase the max granular size"):
> 172MBits/sec
>
> without commit 97303480753e ("arm64: Increase the max granular size"):
> 230MBits/sec
> ----------------
>
> Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
> set the parameter correctly, it may affect the system performance.
>
> So revert the commit.
Unfortunately, the original patch is required to support the 128-byte L1
cache lines of Cavium ThunderX, so we can't simply revert it like this.
Similarly, the desire for a single, multiplatform kernel image prevents
us from reasonably fixing this at compile time to anything other than
the expected maximum value.
Furthermore, Timur previously said that the change is also required
"on our [Qualcomm] silicon", but I'm not sure if this is msm9886 or not:
http://lkml.kernel.org/r/CAOZdJXUiRMAguDV+HEJqPg57MyBNqEcTyaH+ya=U93NHb-pdJA@mail.gmail.com
You could look into making ARCH_DMA_MINALIGN a runtime value, but that
looks like an uphill struggle to me. Alternatively, we could only warn
if the CWG is bigger than L1_CACHE_BYTES *and* we have a non-coherent
DMA master, but that doesn't solve any performance issues from having
things like locks sharing cachelines, not that I think we ever got any
data on that (afaik, we don't pad locks to cacheline boundaries anyway).
I'm also not sure what it would mean for PCI NoSnoop transactions.
Will
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 10:07 ` Will Deacon
@ 2016-03-16 13:06 ` Timur Tabi
2016-03-16 14:03 ` Mark Rutland
2016-03-16 14:18 ` Catalin Marinas
0 siblings, 2 replies; 23+ messages in thread
From: Timur Tabi @ 2016-03-16 13:06 UTC (permalink / raw)
To: Will Deacon, Ganesh Mahendran
Cc: catalin.marinas, stable, linux-kernel, linux-arm-kernel,
tchalamarla, rrichter, apinski, Shanker Donthineni
Will Deacon wrote:
> [adding Cavium folk and Timur]
>
> On Wed, Mar 16, 2016 at 05:32:23PM +0800, Ganesh Mahendran wrote:
>> Reverts commit 97303480753e ("arm64: Increase the max granular size").
>>
>> The commit 97303480753e ("arm64: Increase the max granular size") will
>> degrade system performente in some cpus.
>>
>> We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
>> ----------------
>> run on host:
>> # iperf -s
>> run on device:
>> # iperf -c <device-ip-addr> -t 100 -i 1
>> ----------------
>>
>> Test result:
>> ----------------
>> with commit 97303480753e ("arm64: Increase the max granular size"):
>> 172MBits/sec
>>
>> without commit 97303480753e ("arm64: Increase the max granular size"):
>> 230MBits/sec
>> ----------------
>>
>> Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
>> set the parameter correctly, it may affect the system performance.
>>
>> So revert the commit.
>
> Unfortunately, the original patch is required to support the 128-byte L1
> cache lines of Cavium ThunderX, so we can't simply revert it like this.
> Similarly, the desire for a single, multiplatform kernel image prevents
> us from reasonably fixing this at compile time to anything other than
> the expected maximum value.
>
> Furthermore, Timur previously said that the change is also required
> "on our [Qualcomm] silicon", but I'm not sure if this is msm9886 or not:
>
> http://lkml.kernel.org/r/CAOZdJXUiRMAguDV+HEJqPg57MyBNqEcTyaH+ya=U93NHb-pdJA@mail.gmail.com
I was talking about our server part, the QDF2432. At the time, I wasn't
allowed to mention it by name.
> You could look into making ARCH_DMA_MINALIGN a runtime value, but that
> looks like an uphill struggle to me. Alternatively, we could only warn
> if the CWG is bigger than L1_CACHE_BYTES *and* we have a non-coherent
> DMA master, but that doesn't solve any performance issues from having
> things like locks sharing cachelines, not that I think we ever got any
> data on that (afaik, we don't pad locks to cacheline boundaries anyway).
> I'm also not sure what it would mean for PCI NoSnoop transactions.
Our internal version of this patch made it a Kconfig option. Perhaps
that would at least be an improvement over just reverting it? We
already have to have our own defconfig for the QDF2432.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 13:06 ` Timur Tabi
@ 2016-03-16 14:03 ` Mark Rutland
2016-03-16 14:35 ` Will Deacon
2016-03-16 14:18 ` Catalin Marinas
1 sibling, 1 reply; 23+ messages in thread
From: Mark Rutland @ 2016-03-16 14:03 UTC (permalink / raw)
To: Timur Tabi
Cc: Will Deacon, Ganesh Mahendran, catalin.marinas, linux-kernel,
stable, rrichter, tchalamarla, Shanker Donthineni, apinski,
linux-arm-kernel
On Wed, Mar 16, 2016 at 08:06:22AM -0500, Timur Tabi wrote:
> Will Deacon wrote:
> >Unfortunately, the original patch is required to support the 128-byte L1
> >cache lines of Cavium ThunderX, so we can't simply revert it like this.
> >Similarly, the desire for a single, multiplatform kernel image prevents
> >us from reasonably fixing this at compile time to anything other than
> >the expected maximum value.
> >
> >Furthermore, Timur previously said that the change is also required
> >"on our [Qualcomm] silicon", but I'm not sure if this is msm9886 or not:
> >
> >http://lkml.kernel.org/r/CAOZdJXUiRMAguDV+HEJqPg57MyBNqEcTyaH+ya=U93NHb-pdJA@mail.gmail.com
>
> I was talking about our server part, the QDF2432. At the time, I
> wasn't allowed to mention it by name.
>
> >You could look into making ARCH_DMA_MINALIGN a runtime value, but that
> >looks like an uphill struggle to me. Alternatively, we could only warn
> >if the CWG is bigger than L1_CACHE_BYTES *and* we have a non-coherent
> >DMA master, but that doesn't solve any performance issues from having
> >things like locks sharing cachelines, not that I think we ever got any
> >data on that (afaik, we don't pad locks to cacheline boundaries anyway).
> >I'm also not sure what it would mean for PCI NoSnoop transactions.
>
> Our internal version of this patch made it a Kconfig option.
> Perhaps that would at least be an improvement over just reverting
> it? We already have to have our own defconfig for the QDF2432.
While having an option for producing a less-portable, performance tuned kernel
might not be the end of the world, the defconfig is intended to function
correctly on all platforms (assuming LE and 4K page support).
Even if we were to add the option, the default would have to be the maximum
size known to be implemented.
If I understand correctly, the main reason that we need this for correctness is
non-coherent DMA to/from SLAB caches.
A more general approach (and more invasive, but perhaps less so than making
ARCH_DMA_MINALIGN usage completely dynamic) would be to determine at runtime
whether the CWG is larger than the configured ARCH_DMA_MINALIGN, and if so,
force the use of bounce buffers (which could be padded to the architectural
maximum of 2K) for non-coherent DMA. That nicely degrades to not mattering for
the case of coherent DMA.
I would consider NoSnoop a separate case. It's closer to "negatively coherent",
and always required page-aligned buffer anyway due to MMU behaviour.
Thanks,
Mark.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 14:03 ` Mark Rutland
@ 2016-03-16 14:35 ` Will Deacon
2016-03-16 14:54 ` Mark Rutland
0 siblings, 1 reply; 23+ messages in thread
From: Will Deacon @ 2016-03-16 14:35 UTC (permalink / raw)
To: Mark Rutland
Cc: Timur Tabi, Ganesh Mahendran, catalin.marinas, linux-kernel,
stable, rrichter, tchalamarla, Shanker Donthineni, apinski,
linux-arm-kernel
On Wed, Mar 16, 2016 at 02:03:35PM +0000, Mark Rutland wrote:
> If I understand correctly, the main reason that we need this for correctness is
> non-coherent DMA to/from SLAB caches.
>
> A more general approach (and more invasive, but perhaps less so than making
> ARCH_DMA_MINALIGN usage completely dynamic) would be to determine at runtime
> whether the CWG is larger than the configured ARCH_DMA_MINALIGN, and if so,
> force the use of bounce buffers (which could be padded to the architectural
> maximum of 2K) for non-coherent DMA. That nicely degrades to not mattering for
> the case of coherent DMA.
>
> I would consider NoSnoop a separate case. It's closer to "negatively coherent",
> and always required page-aligned buffer anyway due to MMU behaviour.
What makes you say that? There are no such alignment requirements for
buffers that may be accessed with a NoSnoop transaction. On ARM, we'll
have a mismatched alias, but we'd need to solve that with explicit
cache maintenance (and my understanding is that's what things like GPU
drivers already do on x86).
Will
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 14:35 ` Will Deacon
@ 2016-03-16 14:54 ` Mark Rutland
0 siblings, 0 replies; 23+ messages in thread
From: Mark Rutland @ 2016-03-16 14:54 UTC (permalink / raw)
To: Will Deacon
Cc: Timur Tabi, Ganesh Mahendran, catalin.marinas, linux-kernel,
stable, rrichter, tchalamarla, Shanker Donthineni, apinski,
linux-arm-kernel
On Wed, Mar 16, 2016 at 02:35:35PM +0000, Will Deacon wrote:
> On Wed, Mar 16, 2016 at 02:03:35PM +0000, Mark Rutland wrote:
> > If I understand correctly, the main reason that we need this for correctness is
> > non-coherent DMA to/from SLAB caches.
> >
> > A more general approach (and more invasive, but perhaps less so than making
> > ARCH_DMA_MINALIGN usage completely dynamic) would be to determine at runtime
> > whether the CWG is larger than the configured ARCH_DMA_MINALIGN, and if so,
> > force the use of bounce buffers (which could be padded to the architectural
> > maximum of 2K) for non-coherent DMA. That nicely degrades to not mattering for
> > the case of coherent DMA.
> >
> > I would consider NoSnoop a separate case. It's closer to "negatively coherent",
> > and always required page-aligned buffer anyway due to MMU behaviour.
>
> What makes you say that? There are no such alignment requirements for
> buffers that may be accessed with a NoSnoop transaction. On ARM, we'll
> have a mismatched alias, but we'd need to solve that with explicit
> cache maintenance (and my understanding is that's what things like GPU
> drivers already do on x86).
I was under the impression that NoSnoop transactions were permitted to be
Cacheable, even if non-snooping (e.g. allowing them to allocate and hit in a
system cache).
If that is permitted, then data corruption could potentially occur in the
presence of another cacheable alias due to things like line migration (e.g. a
CPU making a speculative fetch and taking ownership of a line that was in the
system cache). To avoid that, you'd have to remove any cachable alias, for
which we only have page-granular control.
If that is not permitted, then no-snoop is effectively non-cacheable and
non-coherent, and my comment doesn't hold.
Thanks,
Mark.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 13:06 ` Timur Tabi
2016-03-16 14:03 ` Mark Rutland
@ 2016-03-16 14:18 ` Catalin Marinas
2016-03-16 15:26 ` Timur Tabi
1 sibling, 1 reply; 23+ messages in thread
From: Catalin Marinas @ 2016-03-16 14:18 UTC (permalink / raw)
To: Timur Tabi
Cc: Will Deacon, Ganesh Mahendran, linux-kernel, stable, rrichter,
tchalamarla, Shanker Donthineni, apinski, linux-arm-kernel
On Wed, Mar 16, 2016 at 08:06:22AM -0500, Timur Tabi wrote:
> Will Deacon wrote:
> >You could look into making ARCH_DMA_MINALIGN a runtime value, but that
> >looks like an uphill struggle to me. Alternatively, we could only warn
> >if the CWG is bigger than L1_CACHE_BYTES *and* we have a non-coherent
> >DMA master, but that doesn't solve any performance issues from having
> >things like locks sharing cachelines, not that I think we ever got any
> >data on that (afaik, we don't pad locks to cacheline boundaries anyway).
> >I'm also not sure what it would mean for PCI NoSnoop transactions.
>
> Our internal version of this patch made it a Kconfig option. Perhaps that
> would at least be an improvement over just reverting it? We already have to
> have our own defconfig for the QDF2432.
Why do you need your own defconfig? If it's just on the short term until
all your code is upstream, that's fine, but this goes against the single
Image aim. I would like defconfig to cover all supported SoCs (and yes,
ACPI on by default once we deem it !EXPERT anymore), though at some
point we may need a server/mobile split (if the generated image is too
large, maybe more stuff being built as modules).
--
Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 14:18 ` Catalin Marinas
@ 2016-03-16 15:26 ` Timur Tabi
2016-03-17 14:27 ` Catalin Marinas
0 siblings, 1 reply; 23+ messages in thread
From: Timur Tabi @ 2016-03-16 15:26 UTC (permalink / raw)
To: Catalin Marinas
Cc: Will Deacon, Ganesh Mahendran, linux-kernel, stable, rrichter,
tchalamarla, Shanker Donthineni, apinski, linux-arm-kernel
Catalin Marinas wrote:
> Why do you need your own defconfig? If it's just on the short term until
> all your code is upstream, that's fine, but this goes against the single
> Image aim. I would like defconfig to cover all supported SoCs (and yes,
> ACPI on by default once we deem it !EXPERT anymore), though at some
> point we may need a server/mobile split (if the generated image is too
> large, maybe more stuff being built as modules).
Yes, that's exactly it. Ours is an ACPI system, and so we have to have
our own defconfig for now. We're holding off on pushing our own
defconfig changes (enabling drivers, etc) until ACPI is enabled in
arch/arm64/configs/defconfig.
My understanding is that ACPI won't be enabled by default until at least
after the GIC driver is fully ACPI-enabled.
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 15:26 ` Timur Tabi
@ 2016-03-17 14:27 ` Catalin Marinas
2016-03-17 14:49 ` Timur Tabi
2016-03-17 18:07 ` Andrew Pinski
0 siblings, 2 replies; 23+ messages in thread
From: Catalin Marinas @ 2016-03-17 14:27 UTC (permalink / raw)
To: Timur Tabi
Cc: linux-arm-kernel, Ganesh Mahendran, Will Deacon, linux-kernel,
stable, rrichter, tchalamarla, apinski, Shanker Donthineni
On Wed, Mar 16, 2016 at 10:26:08AM -0500, Timur Tabi wrote:
> Catalin Marinas wrote:
> >Why do you need your own defconfig? If it's just on the short term until
> >all your code is upstream, that's fine, but this goes against the single
> >Image aim. I would like defconfig to cover all supported SoCs (and yes,
> >ACPI on by default once we deem it !EXPERT anymore), though at some
> >point we may need a server/mobile split (if the generated image is too
> >large, maybe more stuff being built as modules).
>
> Yes, that's exactly it. Ours is an ACPI system, and so we have to have our
> own defconfig for now. We're holding off on pushing our own defconfig
> changes (enabling drivers, etc) until ACPI is enabled in
> arch/arm64/configs/defconfig.
Is there anything that prevents you from providing a dtb/dts for this
SoC?
--
Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 14:27 ` Catalin Marinas
@ 2016-03-17 14:49 ` Timur Tabi
2016-03-17 15:37 ` Catalin Marinas
2016-03-17 18:07 ` Andrew Pinski
1 sibling, 1 reply; 23+ messages in thread
From: Timur Tabi @ 2016-03-17 14:49 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-arm-kernel, Ganesh Mahendran, Will Deacon, linux-kernel,
stable, rrichter, tchalamarla, apinski, Shanker Donthineni
Catalin Marinas wrote:
>> >Yes, that's exactly it. Ours is an ACPI system, and so we have to have our
>> >own defconfig for now. We're holding off on pushing our own defconfig
>> >changes (enabling drivers, etc) until ACPI is enabled in
>> >arch/arm64/configs/defconfig.
> Is there anything that prevents you from providing a dtb/dts for this
> SoC?
We don't have a boot loader capable of passing a device tree to the
kernel. It's an ARM Server chip. It doesn't do device tree. It's 100%
ACPI. We boot with UEFI that configures the system and generates ACPI
tables.
I just want to make this crystal clear, because it comes up every now
and then. The QDF2432 is an ACPI-only SOC with no device tree support
whatsoever. Zero. Zip. Nada. It's not an option.
Keep in mind that on an ACPI system like ours, the boot loader (UEFI in
our case) configures the system extensively. It does a lot of things
that the kernel would normally do on a device tree system. For example,
pin control is handled completely by UEFI. The kernel does not set the
pin muxes or GPIO directions. That means we don't support dynamic pin
muxing. Before the kernel is booted, the GPIO pins are fixed.
We're not going to create an entire device tree from scratch for this
chip, and then make the extensive modifications necessary to our boot
loader for parsing and modifying that device tree. That would take
months of work, and it would be all throw-away code.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 14:49 ` Timur Tabi
@ 2016-03-17 15:37 ` Catalin Marinas
2016-03-17 16:03 ` Marc Zyngier
0 siblings, 1 reply; 23+ messages in thread
From: Catalin Marinas @ 2016-03-17 15:37 UTC (permalink / raw)
To: Timur Tabi
Cc: Ganesh Mahendran, Will Deacon, linux-kernel, stable, rrichter,
tchalamarla, Shanker Donthineni, apinski, linux-arm-kernel
On Thu, Mar 17, 2016 at 09:49:51AM -0500, Timur Tabi wrote:
> Catalin Marinas wrote:
> >>>Yes, that's exactly it. Ours is an ACPI system, and so we have to have our
> >>>own defconfig for now. We're holding off on pushing our own defconfig
> >>>changes (enabling drivers, etc) until ACPI is enabled in
> >>>arch/arm64/configs/defconfig.
>
> >Is there anything that prevents you from providing a dtb/dts for this
> >SoC?
>
> We don't have a boot loader capable of passing a device tree to the kernel.
> It's an ARM Server chip. It doesn't do device tree. It's 100% ACPI. We
> boot with UEFI that configures the system and generates ACPI tables.
Well, I disagree with the idea that server == ACPI. But I guess you knew
this already.
> I just want to make this crystal clear, because it comes up every now and
> then. The QDF2432 is an ACPI-only SOC with no device tree support
> whatsoever. Zero. Zip. Nada. It's not an option.
That's your choice really, I don't care much (as long as current ACPI
support has all the features you need; if it doesn't, there is a good
chance that your SoC won't be supported in mainline until it's sorted).
> Keep in mind that on an ACPI system like ours, the boot loader (UEFI in our
> case) configures the system extensively. It does a lot of things that the
> kernel would normally do on a device tree system. For example, pin control
> is handled completely by UEFI. The kernel does not set the pin muxes or
> GPIO directions. That means we don't support dynamic pin muxing. Before
> the kernel is booted, the GPIO pins are fixed.
And that's great. But you are mistaken in thinking that DT requires lots
of drivers in the kernel and prevents the firmware from doing sane
stuff. DT rather gained additional features out of necessity since the
firmware was not always doing a proper job at hardware initialisation.
A DT-enabled kernel does not impose restrictions on such firmware
features. With ACPI, the choice is not as wide and forces vendors to
look into their firmware story from a different angle (until they figure
the _DSD+PRP0001 out and we end up with DT emulated in ACPI).
If the GPIO pins are fixed at boot-time, they don't even need to be
described in the DT, just let the firmware configure them. However, if
they need to be changed at run-time (which does not seem to be your
case), that's where you have a choice of either kernel driver (DT) or
AML code (ACPI) (or both). Otherwise, without this run-time aspect, both
DT and ACPI are just slightly different ways to provide a static
platform description.
> We're not going to create an entire device tree from scratch for this chip,
> and then make the extensive modifications necessary to our boot loader for
> parsing and modifying that device tree. That would take months of work, and
> it would be all throw-away code.
As I said above, that's your choice and it depends on your timeline and
mainline support requirements. I however disagree with this being
"throw-away code" (or even taking "months of work").
--
Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 15:37 ` Catalin Marinas
@ 2016-03-17 16:03 ` Marc Zyngier
0 siblings, 0 replies; 23+ messages in thread
From: Marc Zyngier @ 2016-03-17 16:03 UTC (permalink / raw)
To: Catalin Marinas, Timur Tabi
Cc: Ganesh Mahendran, Will Deacon, linux-kernel, stable, rrichter,
tchalamarla, Shanker Donthineni, apinski, linux-arm-kernel
On 17/03/16 15:37, Catalin Marinas wrote:
> On Thu, Mar 17, 2016 at 09:49:51AM -0500, Timur Tabi wrote:
[...]
>> Keep in mind that on an ACPI system like ours, the boot loader (UEFI in our
>> case) configures the system extensively. It does a lot of things that the
>> kernel would normally do on a device tree system. For example, pin control
>> is handled completely by UEFI. The kernel does not set the pin muxes or
>> GPIO directions. That means we don't support dynamic pin muxing. Before
>> the kernel is booted, the GPIO pins are fixed.
>
> And that's great. But you are mistaken in thinking that DT requires lots
> of drivers in the kernel and prevents the firmware from doing sane
> stuff. DT rather gained additional features out of necessity since the
> firmware was not always doing a proper job at hardware initialisation.
> A DT-enabled kernel does not impose restrictions on such firmware
> features. With ACPI, the choice is not as wide and forces vendors to
> look into their firmware story from a different angle (until they figure
> the _DSD+PRP0001 out and we end up with DT emulated in ACPI).
Or even worse, perverting the couple of things that were actually OK in
ACPI by inventing a new layer of broken stuff:
http://thread.gmane.org/gmane.linux.ports.arm.msm/17828
Once we've reached that level, _DSD fells all nice and cuddly.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 14:27 ` Catalin Marinas
2016-03-17 14:49 ` Timur Tabi
@ 2016-03-17 18:07 ` Andrew Pinski
2016-03-17 18:34 ` Timur Tabi
2016-03-17 18:37 ` Catalin Marinas
1 sibling, 2 replies; 23+ messages in thread
From: Andrew Pinski @ 2016-03-17 18:07 UTC (permalink / raw)
To: Catalin Marinas, Timur Tabi
Cc: linux-arm-kernel, Ganesh Mahendran, Will Deacon, linux-kernel,
stable, rrichter, tchalamarla, apinski, Shanker Donthineni
On 3/17/2016 7:27 AM, Catalin Marinas wrote:
> On Wed, Mar 16, 2016 at 10:26:08AM -0500, Timur Tabi wrote:
>> Catalin Marinas wrote:
>>> Why do you need your own defconfig? If it's just on the short term until
>>> all your code is upstream, that's fine, but this goes against the single
>>> Image aim. I would like defconfig to cover all supported SoCs (and yes,
>>> ACPI on by default once we deem it !EXPERT anymore), though at some
>>> point we may need a server/mobile split (if the generated image is too
>>> large, maybe more stuff being built as modules).
>> Yes, that's exactly it. Ours is an ACPI system, and so we have to have our
>> own defconfig for now. We're holding off on pushing our own defconfig
>> changes (enabling drivers, etc) until ACPI is enabled in
>> arch/arm64/configs/defconfig.
> Is there anything that prevents you from providing a dtb/dts for this
> SoC?
Note ThunderX's SOC have customers where some are embedded users
(uboot) and server users (UEFI). The cores always have 128 byte
cacheline size. So please don't make this dependent on ACPI. Note the
defconfig works correctly on T88.
Thanks,
Andrew
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 18:07 ` Andrew Pinski
@ 2016-03-17 18:34 ` Timur Tabi
2016-03-17 18:37 ` Catalin Marinas
1 sibling, 0 replies; 23+ messages in thread
From: Timur Tabi @ 2016-03-17 18:34 UTC (permalink / raw)
To: Andrew Pinski, Catalin Marinas
Cc: linux-arm-kernel, Ganesh Mahendran, Will Deacon, linux-kernel,
stable, rrichter, tchalamarla, apinski, Shanker Donthineni
Andrew Pinski wrote:
>>
>
> Note ThunderX's SOC have customers where some are embedded users
> (uboot) and server users (UEFI). The cores always have 128 byte
> cacheline size. So please don't make this dependent on ACPI. Note the
> defconfig works correctly on T88.
This thread is getting off-topic. There's nothing about the cacheline
size that is dependent on ACPI or DT. Catalin was wondering why we have
our own defconfig for our ARM64 SOC, and I replied that it's because
ACPI is not enabled yet in the upstream defconfig.
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-17 18:07 ` Andrew Pinski
2016-03-17 18:34 ` Timur Tabi
@ 2016-03-17 18:37 ` Catalin Marinas
1 sibling, 0 replies; 23+ messages in thread
From: Catalin Marinas @ 2016-03-17 18:37 UTC (permalink / raw)
To: Andrew Pinski
Cc: Timur Tabi, Ganesh Mahendran, Will Deacon, linux-kernel, stable,
rrichter, tchalamarla, Shanker Donthineni, apinski,
linux-arm-kernel
On Thu, Mar 17, 2016 at 11:07:00AM -0700, Andrew Pinski wrote:
> On 3/17/2016 7:27 AM, Catalin Marinas wrote:
> >On Wed, Mar 16, 2016 at 10:26:08AM -0500, Timur Tabi wrote:
> >>Catalin Marinas wrote:
> >>>Why do you need your own defconfig? If it's just on the short term until
> >>>all your code is upstream, that's fine, but this goes against the single
> >>>Image aim. I would like defconfig to cover all supported SoCs (and yes,
> >>>ACPI on by default once we deem it !EXPERT anymore), though at some
> >>>point we may need a server/mobile split (if the generated image is too
> >>>large, maybe more stuff being built as modules).
> >>Yes, that's exactly it. Ours is an ACPI system, and so we have to have our
> >>own defconfig for now. We're holding off on pushing our own defconfig
> >>changes (enabling drivers, etc) until ACPI is enabled in
> >>arch/arm64/configs/defconfig.
> >Is there anything that prevents you from providing a dtb/dts for this
> >SoC?
>
> Note ThunderX's SOC have customers where some are embedded users (uboot)
> and server users (UEFI). The cores always have 128 byte cacheline size. So
> please don't make this dependent on ACPI.
Definitely not, this has nothing to do with ACPI or servers. My comment
on different defconfig was more about things like 64K pages vs 4K, if
the former ever prove useful in practice. Who knows, we may even see
ACPI for IoT ;) (with MS involvement in Raspberry Pi)
> Note the defconfig works correctly on T88.
We have two aspects to address: one is correctness and the other is
performance. But we bundle everything under L1_CACHE_BYTES which affects
platforms that don't have such large cache lines (actually, it may even
affect those that do; has anyone done actual benchmarks?)
As Will suggested, we could try to revert L1_CACHE_BYTES back to 64 and
make ARCH_DMA_MINALIGN run-time based on CWG for correctness. Would this
work on the Cavium hardware?
--
Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-16 9:32 [PATCH] Revert "arm64: Increase the max granular size" Ganesh Mahendran
2016-03-16 10:07 ` Will Deacon
@ 2016-03-18 21:05 ` Chalamarla, Tirumalesh
2016-03-21 1:56 ` Ganesh Mahendran
2016-03-21 17:14 ` Catalin Marinas
1 sibling, 2 replies; 23+ messages in thread
From: Chalamarla, Tirumalesh @ 2016-03-18 21:05 UTC (permalink / raw)
To: Ganesh Mahendran, catalin.marinas@arm.com, will.deacon@arm.com
Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
On 3/16/16, 2:32 AM, "linux-arm-kernel on behalf of Ganesh Mahendran" <linux-arm-kernel-bounces@lists.infradead.org on behalf of opensource.ganesh@gmail.com> wrote:
>Reverts commit 97303480753e ("arm64: Increase the max granular size").
>
>The commit 97303480753e ("arm64: Increase the max granular size") will
>degrade system performente in some cpus.
>
>We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
>----------------
>run on host:
> # iperf -s
>run on device:
> # iperf -c <device-ip-addr> -t 100 -i 1
>----------------
>
>Test result:
>----------------
>with commit 97303480753e ("arm64: Increase the max granular size"):
> 172MBits/sec
>
>without commit 97303480753e ("arm64: Increase the max granular size"):
> 230MBits/sec
>----------------
>
>Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
>set the parameter correctly, it may affect the system performance.
>
>So revert the commit.
Is there any explanation why is this so? May be there is an alternative to this, apart from reverting the commit.
Until now it seems L1_CACHE_SHIFT is the max of supported chips. But now we are making it 64byte, is there any reason why not 32.
Thanks,
Tirumalesh.
>
>Cc: stable@vger.kernel.org
>Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
>---
> arch/arm64/include/asm/cache.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
>index 5082b30..bde4499 100644
>--- a/arch/arm64/include/asm/cache.h
>+++ b/arch/arm64/include/asm/cache.h
>@@ -18,7 +18,7 @@
>
> #include <asm/cachetype.h>
>
>-#define L1_CACHE_SHIFT 7
>+#define L1_CACHE_SHIFT 6
> #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
>
> /*
>--
>1.7.9.5
>
>
>_______________________________________________
>linux-arm-kernel mailing list
>linux-arm-kernel@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-18 21:05 ` Chalamarla, Tirumalesh
@ 2016-03-21 1:56 ` Ganesh Mahendran
2016-03-21 17:14 ` Catalin Marinas
1 sibling, 0 replies; 23+ messages in thread
From: Ganesh Mahendran @ 2016-03-21 1:56 UTC (permalink / raw)
To: Chalamarla, Tirumalesh
Cc: catalin.marinas@arm.com, will.deacon@arm.com,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Hello, Tirumalesh:
2016-03-19 5:05 GMT+08:00 Chalamarla, Tirumalesh
<Tirumalesh.Chalamarla@caviumnetworks.com>:
>
>
>
>
>
> On 3/16/16, 2:32 AM, "linux-arm-kernel on behalf of Ganesh Mahendran" <linux-arm-kernel-bounces@lists.infradead.org on behalf of opensource.ganesh@gmail.com> wrote:
>
>>Reverts commit 97303480753e ("arm64: Increase the max granular size").
>>
>>The commit 97303480753e ("arm64: Increase the max granular size") will
>>degrade system performente in some cpus.
>>
>>We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
>>----------------
>>run on host:
>> # iperf -s
>>run on device:
>> # iperf -c <device-ip-addr> -t 100 -i 1
>>----------------
>>
>>Test result:
>>----------------
>>with commit 97303480753e ("arm64: Increase the max granular size"):
>> 172MBits/sec
>>
>>without commit 97303480753e ("arm64: Increase the max granular size"):
>> 230MBits/sec
>>----------------
>>
>>Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
>>set the parameter correctly, it may affect the system performance.
>>
>>So revert the commit.
>
> Is there any explanation why is this so? May be there is an alternative to this, apart from reverting the commit.
>
I just think the commit 97303480753e ("arm64: Increase the max
granular size") introduced new problem for other Socs which
the L1 cache line size is not 128 Bytes. So I wanted to revert this commit.
> Until now it seems L1_CACHE_SHIFT is the max of supported chips. But now we are making it 64byte, is there any reason why not 32.
>
We could not simply set the L1_CACHE_SHIFT to max. There are other
places which use L1 cache line size.
If we just set the L1 cache line size to the max, the memory footprint
and the system performance will be affected.
For example:
------
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#define SKB_DATA_ALIGN(X) ALIGN(X, SMP_CACHE_BYTES)
------
Thanks.
> Thanks,
> Tirumalesh.
>>
>>Cc: stable@vger.kernel.org
>>Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
>>---
>> arch/arm64/include/asm/cache.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
>>index 5082b30..bde4499 100644
>>--- a/arch/arm64/include/asm/cache.h
>>+++ b/arch/arm64/include/asm/cache.h
>>@@ -18,7 +18,7 @@
>>
>> #include <asm/cachetype.h>
>>
>>-#define L1_CACHE_SHIFT 7
>>+#define L1_CACHE_SHIFT 6
>> #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
>>
>> /*
>>--
>>1.7.9.5
>>
>>
>>_______________________________________________
>>linux-arm-kernel mailing list
>>linux-arm-kernel@lists.infradead.org
>>http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-18 21:05 ` Chalamarla, Tirumalesh
2016-03-21 1:56 ` Ganesh Mahendran
@ 2016-03-21 17:14 ` Catalin Marinas
2016-03-21 17:23 ` Will Deacon
1 sibling, 1 reply; 23+ messages in thread
From: Catalin Marinas @ 2016-03-21 17:14 UTC (permalink / raw)
To: Chalamarla, Tirumalesh
Cc: Ganesh Mahendran, will.deacon@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
On Fri, Mar 18, 2016 at 09:05:37PM +0000, Chalamarla, Tirumalesh wrote:
> On 3/16/16, 2:32 AM, "linux-arm-kernel on behalf of Ganesh Mahendran" <linux-arm-kernel-bounces@lists.infradead.org on behalf of opensource.ganesh@gmail.com> wrote:
> >Reverts commit 97303480753e ("arm64: Increase the max granular size").
> >
> >The commit 97303480753e ("arm64: Increase the max granular size") will
> >degrade system performente in some cpus.
> >
> >We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
> >----------------
> >run on host:
> > # iperf -s
> >run on device:
> > # iperf -c <device-ip-addr> -t 100 -i 1
> >----------------
> >
> >Test result:
> >----------------
> >with commit 97303480753e ("arm64: Increase the max granular size"):
> > 172MBits/sec
> >
> >without commit 97303480753e ("arm64: Increase the max granular size"):
> > 230MBits/sec
> >----------------
> >
> >Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
> >set the parameter correctly, it may affect the system performance.
> >
> >So revert the commit.
>
> Is there any explanation why is this so? May be there is an
> alternative to this, apart from reverting the commit.
I agree we need an explanation but in the meantime, this patch has
caused a regression on certain systems.
> Until now it seems L1_CACHE_SHIFT is the max of supported chips. But
> now we are making it 64byte, is there any reason why not 32.
We may have to revisit this logic and consider L1_CACHE_BYTES the
_minimum_ of cache line sizes in arm64 systems supported by the kernel.
Do you have any benchmarks on Cavium boards that would show significant
degradation with 64-byte L1_CACHE_BYTES vs 128?
For non-coherent DMA, the simplest is to make ARCH_DMA_MINALIGN the
_maximum_ of the supported systems:
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 5082b30bc2c0..4b5d7b27edaf 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -18,17 +18,17 @@
#include <asm/cachetype.h>
-#define L1_CACHE_SHIFT 7
+#define L1_CACHE_SHIFT 6
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
* Memory returned by kmalloc() may be used for DMA, so we must make
- * sure that all such allocations are cache aligned. Otherwise,
- * unrelated code may cause parts of the buffer to be read into the
- * cache before the transfer is done, causing old data to be seen by
- * the CPU.
+ * sure that all such allocations are aligned to the maximum *known*
+ * cache line size on ARMv8 systems. Otherwise, unrelated code may cause
+ * parts of the buffer to be read into the cache before the transfer is
+ * done, causing old data to be seen by the CPU.
*/
-#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
+#define ARCH_DMA_MINALIGN (128)
#ifndef __ASSEMBLY__
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 392c67eb9fa6..30bafca1aebf 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -976,9 +976,9 @@ void __init setup_cpu_features(void)
if (!cwg)
pr_warn("No Cache Writeback Granule information, assuming cache line size %d\n",
cls);
- if (L1_CACHE_BYTES < cls)
- pr_warn("L1_CACHE_BYTES smaller than the Cache Writeback Granule (%d < %d)\n",
- L1_CACHE_BYTES, cls);
+ if (ARCH_DMA_MINALIGN < cls)
+ pr_warn("ARCH_DMA_MINALIGN smaller than the Cache Writeback Granule (%d < %d)\n",
+ ARCH_DMA_MINALIGN, cls);
}
static bool __maybe_unused
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-21 17:14 ` Catalin Marinas
@ 2016-03-21 17:23 ` Will Deacon
2016-03-21 17:33 ` Catalin Marinas
0 siblings, 1 reply; 23+ messages in thread
From: Will Deacon @ 2016-03-21 17:23 UTC (permalink / raw)
To: Catalin Marinas
Cc: Chalamarla, Tirumalesh, Ganesh Mahendran,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
On Mon, Mar 21, 2016 at 05:14:03PM +0000, Catalin Marinas wrote:
> On Fri, Mar 18, 2016 at 09:05:37PM +0000, Chalamarla, Tirumalesh wrote:
> > On 3/16/16, 2:32 AM, "linux-arm-kernel on behalf of Ganesh Mahendran" <linux-arm-kernel-bounces@lists.infradead.org on behalf of opensource.ganesh@gmail.com> wrote:
> > >Reverts commit 97303480753e ("arm64: Increase the max granular size").
> > >
> > >The commit 97303480753e ("arm64: Increase the max granular size") will
> > >degrade system performente in some cpus.
> > >
> > >We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
> > >----------------
> > >run on host:
> > > # iperf -s
> > >run on device:
> > > # iperf -c <device-ip-addr> -t 100 -i 1
> > >----------------
> > >
> > >Test result:
> > >----------------
> > >with commit 97303480753e ("arm64: Increase the max granular size"):
> > > 172MBits/sec
> > >
> > >without commit 97303480753e ("arm64: Increase the max granular size"):
> > > 230MBits/sec
> > >----------------
> > >
> > >Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
> > >set the parameter correctly, it may affect the system performance.
> > >
> > >So revert the commit.
> >
> > Is there any explanation why is this so? May be there is an
> > alternative to this, apart from reverting the commit.
>
> I agree we need an explanation but in the meantime, this patch has
> caused a regression on certain systems.
>
> > Until now it seems L1_CACHE_SHIFT is the max of supported chips. But
> > now we are making it 64byte, is there any reason why not 32.
>
> We may have to revisit this logic and consider L1_CACHE_BYTES the
> _minimum_ of cache line sizes in arm64 systems supported by the kernel.
> Do you have any benchmarks on Cavium boards that would show significant
> degradation with 64-byte L1_CACHE_BYTES vs 128?
>
> For non-coherent DMA, the simplest is to make ARCH_DMA_MINALIGN the
> _maximum_ of the supported systems:
>
> diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
> index 5082b30bc2c0..4b5d7b27edaf 100644
> --- a/arch/arm64/include/asm/cache.h
> +++ b/arch/arm64/include/asm/cache.h
> @@ -18,17 +18,17 @@
>
> #include <asm/cachetype.h>
>
> -#define L1_CACHE_SHIFT 7
> +#define L1_CACHE_SHIFT 6
> #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
>
> /*
> * Memory returned by kmalloc() may be used for DMA, so we must make
> - * sure that all such allocations are cache aligned. Otherwise,
> - * unrelated code may cause parts of the buffer to be read into the
> - * cache before the transfer is done, causing old data to be seen by
> - * the CPU.
> + * sure that all such allocations are aligned to the maximum *known*
> + * cache line size on ARMv8 systems. Otherwise, unrelated code may cause
> + * parts of the buffer to be read into the cache before the transfer is
> + * done, causing old data to be seen by the CPU.
> */
> -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
> +#define ARCH_DMA_MINALIGN (128)
Does this actually fix the reported iperf regression? My assumption was
that ARCH_DMA_MINALIGN is the problem, but I could be wrong.
Will
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-21 17:23 ` Will Deacon
@ 2016-03-21 17:33 ` Catalin Marinas
2016-03-21 17:39 ` Chalamarla, Tirumalesh
0 siblings, 1 reply; 23+ messages in thread
From: Catalin Marinas @ 2016-03-21 17:33 UTC (permalink / raw)
To: Will Deacon
Cc: Ganesh Mahendran, stable@vger.kernel.org, Chalamarla, Tirumalesh,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
On Mon, Mar 21, 2016 at 05:23:01PM +0000, Will Deacon wrote:
> On Mon, Mar 21, 2016 at 05:14:03PM +0000, Catalin Marinas wrote:
> > diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
> > index 5082b30bc2c0..4b5d7b27edaf 100644
> > --- a/arch/arm64/include/asm/cache.h
> > +++ b/arch/arm64/include/asm/cache.h
> > @@ -18,17 +18,17 @@
> >
> > #include <asm/cachetype.h>
> >
> > -#define L1_CACHE_SHIFT 7
> > +#define L1_CACHE_SHIFT 6
> > #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
> >
> > /*
> > * Memory returned by kmalloc() may be used for DMA, so we must make
> > - * sure that all such allocations are cache aligned. Otherwise,
> > - * unrelated code may cause parts of the buffer to be read into the
> > - * cache before the transfer is done, causing old data to be seen by
> > - * the CPU.
> > + * sure that all such allocations are aligned to the maximum *known*
> > + * cache line size on ARMv8 systems. Otherwise, unrelated code may cause
> > + * parts of the buffer to be read into the cache before the transfer is
> > + * done, causing old data to be seen by the CPU.
> > */
> > -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
> > +#define ARCH_DMA_MINALIGN (128)
>
> Does this actually fix the reported iperf regression? My assumption was
> that ARCH_DMA_MINALIGN is the problem, but I could be wrong.
I can't tell. But since I haven't seen any better explanation in this
thread yet, I hope that at least someone would try this patch and come
back with numbers.
For networking, SKB_DATA_ALIGN() uses SMP_CACHE_BYTES (== L1_CACHE_BYTES).
I think (hope) this alignment is not meant for non-coherent DMA,
otherwise using SMP_CACHE_BYTES wouldn't make sense.
--
Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] Revert "arm64: Increase the max granular size"
2016-03-21 17:33 ` Catalin Marinas
@ 2016-03-21 17:39 ` Chalamarla, Tirumalesh
0 siblings, 0 replies; 23+ messages in thread
From: Chalamarla, Tirumalesh @ 2016-03-21 17:39 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon
Cc: Ganesh Mahendran, stable@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
On 3/21/16, 10:33 AM, "Catalin Marinas" <catalin.marinas@arm.com> wrote:
>On Mon, Mar 21, 2016 at 05:23:01PM +0000, Will Deacon wrote:
>> On Mon, Mar 21, 2016 at 05:14:03PM +0000, Catalin Marinas wrote:
>> > diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
>> > index 5082b30bc2c0..4b5d7b27edaf 100644
>> > --- a/arch/arm64/include/asm/cache.h
>> > +++ b/arch/arm64/include/asm/cache.h
>> > @@ -18,17 +18,17 @@
>> >
>> > #include <asm/cachetype.h>
>> >
>> > -#define L1_CACHE_SHIFT 7
>> > +#define L1_CACHE_SHIFT 6
>> > #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
>> >
>> > /*
>> > * Memory returned by kmalloc() may be used for DMA, so we must make
>> > - * sure that all such allocations are cache aligned. Otherwise,
>> > - * unrelated code may cause parts of the buffer to be read into the
>> > - * cache before the transfer is done, causing old data to be seen by
>> > - * the CPU.
>> > + * sure that all such allocations are aligned to the maximum *known*
>> > + * cache line size on ARMv8 systems. Otherwise, unrelated code may cause
>> > + * parts of the buffer to be read into the cache before the transfer is
>> > + * done, causing old data to be seen by the CPU.
>> > */
>> > -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
>> > +#define ARCH_DMA_MINALIGN (128)
>>
>> Does this actually fix the reported iperf regression? My assumption was
>> that ARCH_DMA_MINALIGN is the problem, but I could be wrong.
>
>I can't tell. But since I haven't seen any better explanation in this
>thread yet, I hope that at least someone would try this patch and come
>back with numbers.
>
>For networking, SKB_DATA_ALIGN() uses SMP_CACHE_BYTES (== L1_CACHE_BYTES).
>I think (hope) this alignment is not meant for non-coherent DMA,
>otherwise using SMP_CACHE_BYTES wouldn't make sense.
As I see the problem, may be it is because of fewer number of buffers available because of this alignment requirement.
But that should be fixed by making slab alignment a run time thing. I may be totally wrong.
We are still coming up with a decent benchmark that shows degradation.
>
>--
>Catalin
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH] Revert "arm64: Increase the max granular size"
@ 2016-03-16 9:37 Ganesh Mahendran
0 siblings, 0 replies; 23+ messages in thread
From: Ganesh Mahendran @ 2016-03-16 9:37 UTC (permalink / raw)
To: liucai1123; +Cc: Ganesh Mahendran, stable
Reverts commit 97303480753e ("arm64: Increase the max granular size").
The commit 97303480753e ("arm64: Increase the max granular size") will
degrade system performente in some cpus.
We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
----------------
run on host:
# iperf -s
run on device:
# iperf -c <device-ip-addr> -t 100 -i 1
----------------
Test result:
----------------
with commit 97303480753e ("arm64: Increase the max granular size"):
172MBits/sec
without commit 97303480753e ("arm64: Increase the max granular size"):
230MBits/sec
----------------
Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
set the parameter correctly, it may affect the system performance.
So revert the commit.
Cc: stable@vger.kernel.org
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
---
arch/arm64/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 5082b30..bde4499 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -18,7 +18,7 @@
#include <asm/cachetype.h>
-#define L1_CACHE_SHIFT 7
+#define L1_CACHE_SHIFT 6
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH] Revert "arm64: Increase the max granular size"
@ 2016-03-16 9:27 Ganesh Mahendran
0 siblings, 0 replies; 23+ messages in thread
From: Ganesh Mahendran @ 2016-03-16 9:27 UTC (permalink / raw)
To: liucai1123; +Cc: 59089403, Ganesh Mahendran, stable
Reverts commit 97303480753e ("arm64: Increase the max granular size").
The commit 97303480753e ("arm64: Increase the max granular size") will
degrade system performente in some cpus.
We test wifi network throughput with iperf on Qualcomm msm8996 CPU:
----------------
run on host:
# iperf -s
run on device:
# iperf -c <device-ip-addr> -t 100 -i 1
----------------
Test result:
----------------
with commit 97303480753e ("arm64: Increase the max granular size"):
172MBits/sec
without commit 97303480753e ("arm64: Increase the max granular size"):
230MBits/sec
----------------
Some module like slab/net will use the L1_CACHE_SHIFT, so if we do not
set the parameter correctly, it may affect the system performance.
So revert the commit.
Cc: stable@vger.kernel.org
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
---
arch/arm64/include/asm/cache.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 5082b30..bde4499 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -18,7 +18,7 @@
#include <asm/cachetype.h>
-#define L1_CACHE_SHIFT 7
+#define L1_CACHE_SHIFT 6
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 23+ messages in thread
end of thread, other threads:[~2016-03-21 17:39 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16 9:32 [PATCH] Revert "arm64: Increase the max granular size" Ganesh Mahendran
2016-03-16 10:07 ` Will Deacon
2016-03-16 13:06 ` Timur Tabi
2016-03-16 14:03 ` Mark Rutland
2016-03-16 14:35 ` Will Deacon
2016-03-16 14:54 ` Mark Rutland
2016-03-16 14:18 ` Catalin Marinas
2016-03-16 15:26 ` Timur Tabi
2016-03-17 14:27 ` Catalin Marinas
2016-03-17 14:49 ` Timur Tabi
2016-03-17 15:37 ` Catalin Marinas
2016-03-17 16:03 ` Marc Zyngier
2016-03-17 18:07 ` Andrew Pinski
2016-03-17 18:34 ` Timur Tabi
2016-03-17 18:37 ` Catalin Marinas
2016-03-18 21:05 ` Chalamarla, Tirumalesh
2016-03-21 1:56 ` Ganesh Mahendran
2016-03-21 17:14 ` Catalin Marinas
2016-03-21 17:23 ` Will Deacon
2016-03-21 17:33 ` Catalin Marinas
2016-03-21 17:39 ` Chalamarla, Tirumalesh
-- strict thread matches above, loose matches on Subject: below --
2016-03-16 9:37 Ganesh Mahendran
2016-03-16 9:27 Ganesh Mahendran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox