Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
Cheers, Nathan
From: Matthias Kaehlcke mka@chromium.org
commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a upstream.
The clang option -Oz enables *aggressive* optimization for size, which doesn't necessarily result in smaller images, but can have negative impact on performance. Switch back to the less aggressive -Os.
This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
Suggested-by: Peter Zijlstra peterz@infradead.org Signed-off-by: Matthias Kaehlcke mka@chromium.org Reviewed-by: Nick Desaulniers ndesaulniers@google.com Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Nathan Chancellor natechancellor@gmail.com --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index fcfef30ca9a6..d36e66ff60aa 100644 --- a/Makefile +++ b/Makefile @@ -653,8 +653,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) -KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) +KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) else ifdef CONFIG_PROFILE_ALL_BRANCHES KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
From: Matthias Kaehlcke mka@chromium.org
commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a upstream.
The clang option -Oz enables *aggressive* optimization for size, which doesn't necessarily result in smaller images, but can have negative impact on performance. Switch back to the less aggressive -Os.
This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
Suggested-by: Peter Zijlstra peterz@infradead.org Signed-off-by: Matthias Kaehlcke mka@chromium.org Reviewed-by: Nick Desaulniers ndesaulniers@google.com Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Nathan Chancellor natechancellor@gmail.com --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index 3fac08f6a11e..91e265ca0ca5 100644 --- a/Makefile +++ b/Makefile @@ -661,8 +661,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) -KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) +KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) else ifdef CONFIG_PROFILE_ALL_BRANCHES KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
From: Matthias Kaehlcke mka@chromium.org
commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a upstream.
The clang option -Oz enables *aggressive* optimization for size, which doesn't necessarily result in smaller images, but can have negative impact on performance. Switch back to the less aggressive -Os.
This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
Suggested-by: Peter Zijlstra peterz@infradead.org Signed-off-by: Matthias Kaehlcke mka@chromium.org Reviewed-by: Nick Desaulniers ndesaulniers@google.com Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Nathan Chancellor natechancellor@gmail.com --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 35be7983ef2d..0b7d9fb13fcc 100644 --- a/Makefile +++ b/Makefile @@ -639,7 +639,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) +KBUILD_CFLAGS += -Os else ifdef CONFIG_PROFILE_ALL_BRANCHES KBUILD_CFLAGS += -O2
From: Matthias Kaehlcke mka@chromium.org
commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a upstream.
The clang option -Oz enables *aggressive* optimization for size, which doesn't necessarily result in smaller images, but can have negative impact on performance. Switch back to the less aggressive -Os.
This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
Suggested-by: Peter Zijlstra peterz@infradead.org Signed-off-by: Matthias Kaehlcke mka@chromium.org Reviewed-by: Nick Desaulniers ndesaulniers@google.com Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Nathan Chancellor natechancellor@gmail.com --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index 966069dab768..994e52be8685 100644 --- a/Makefile +++ b/Makefile @@ -655,8 +655,7 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) endif
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) -KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) +KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) else ifdef CONFIG_PROFILE_ALL_BRANCHES KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
From: Matthias Kaehlcke mka@chromium.org
commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a upstream.
The clang option -Oz enables *aggressive* optimization for size, which doesn't necessarily result in smaller images, but can have negative impact on performance. Switch back to the less aggressive -Os.
This reverts commit 6748cb3c299de1ffbe56733647b01dbcc398c419.
Suggested-by: Peter Zijlstra peterz@infradead.org Signed-off-by: Matthias Kaehlcke mka@chromium.org Reviewed-by: Nick Desaulniers ndesaulniers@google.com Signed-off-by: Masahiro Yamada yamada.masahiro@socionext.com Signed-off-by: Nathan Chancellor natechancellor@gmail.com --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index ef192ca04330..807ae0e3ff6e 100644 --- a/Makefile +++ b/Makefile @@ -678,8 +678,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE -KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) -KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) +KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) else ifdef CONFIG_PROFILE_ALL_BRANCHES KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
This patch looks simple enough, and seeing peterz on it suggests to me that this was significant enough for someone to notice. Is this really the case, or is this just one of those %0.01 performance regression things?
-- Thanks, Sasha
On Tue, Apr 23, 2019 at 12:35 PM Sasha Levin sashal@kernel.org wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
This patch looks simple enough, and seeing peterz on it suggests to me that this was significant enough for someone to notice. Is this really the case, or is this just one of those %0.01 performance regression things?
I don't recall specific measurements, but when I tried Peter's suggestion and measured it, I wondered to myself how the initial patch was ever correct. The revert (what Nathan sent) should really be applied for folks building w/ Clang+CONFIG_CC_OPTIMIZE_FOR_SIZE=y, which is what some CrOS devices (and some Qualcomm BSPs) are doing. Rather than cherry pick this patch around to a bunch of different trees, it would be much better for this to land in -stable and for those trees not to diverge over this.
Nathan, thank you for sending.
On Tue, Apr 23, 2019 at 03:35:12PM -0400, Sasha Levin wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
Yes and no. The original reason for the revert was because of the compiler runtime functions:
https://lore.kernel.org/lkml/CAG5bF+S6OvBnsaR6UpMCqjDR9_hMo6qRMHGiW+iCaRYQW4...
The Chromium guys hit this [1] and have applied the patch for their kernels, I think it should be applied for everyone.
This patch looks simple enough, and seeing peterz on it suggests to me that this was significant enough for someone to notice. Is this really the case, or is this just one of those %0.01 performance regression things?
I don't know of anyone else who has hit this but Qualcomm enabled CONFIG_CC_OPTIMIZE_FOR_SIZE in their 4.9 kernels with clang [2] so it would be nice to have this to avoid any further issues down the road.
[1]: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/8bb957d781... [2]: https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=e828e50380a3...
Thanks for the quick reply! Nathan
-- Thanks, Sasha
On Tue, Apr 23, 2019 at 12:45:12PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 03:35:12PM -0400, Sasha Levin wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
Yes and no. The original reason for the revert was because of the compiler runtime functions:
https://lore.kernel.org/lkml/CAG5bF+S6OvBnsaR6UpMCqjDR9_hMo6qRMHGiW+iCaRYQW4...
The Chromium guys hit this [1] and have applied the patch for their kernels, I think it should be applied for everyone.
We picked it into our kernels because we needed a fix *now* to unbreak our builds, but I agree it should be fixed at least in relevant LTS versions.
This patch looks simple enough, and seeing peterz on it suggests to me that this was significant enough for someone to notice. Is this really the case, or is this just one of those %0.01 performance regression things?
I don't know of anyone else who has hit this but Qualcomm enabled CONFIG_CC_OPTIMIZE_FOR_SIZE in their 4.9 kernels with clang [2] so it would be nice to have this to avoid any further issues down the road.
I suspect the Qualcomm tree would hit the VDSO issue if they use a sufficiently recent version of clang.
Thanks Nathan for posting this to -stable, I should have cc-ed them in the first place.
On Tue, Apr 23, 2019 at 12:56:28PM -0700, Matthias Kaehlcke wrote:
On Tue, Apr 23, 2019 at 12:45:12PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 03:35:12PM -0400, Sasha Levin wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
Yes and no. The original reason for the revert was because of the compiler runtime functions:
https://lore.kernel.org/lkml/CAG5bF+S6OvBnsaR6UpMCqjDR9_hMo6qRMHGiW+iCaRYQW4...
The Chromium guys hit this [1] and have applied the patch for their kernels, I think it should be applied for everyone.
We picked it into our kernels because we needed a fix *now* to unbreak our builds, but I agree it should be fixed at least in relevant LTS versions.
Of course, I wasn't implying that was a bad thing :) it's further justification for this being a stable worthy patch as it fixes a real world issue and could fix more.
This patch looks simple enough, and seeing peterz on it suggests to me that this was significant enough for someone to notice. Is this really the case, or is this just one of those %0.01 performance regression things?
I don't know of anyone else who has hit this but Qualcomm enabled CONFIG_CC_OPTIMIZE_FOR_SIZE in their 4.9 kernels with clang [2] so it would be nice to have this to avoid any further issues down the road.
I suspect the Qualcomm tree would hit the VDSO issue if they use a sufficiently recent version of clang.
Thanks Nathan for posting this to -stable, I should have cc-ed them in the first place.
Sure thing, thanks for the reply and input!
Nathan
On Tue, Apr 23, 2019 at 01:03:55PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 12:56:28PM -0700, Matthias Kaehlcke wrote:
On Tue, Apr 23, 2019 at 12:45:12PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 03:35:12PM -0400, Sasha Levin wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
Yes and no. The original reason for the revert was because of the compiler runtime functions:
https://lore.kernel.org/lkml/CAG5bF+S6OvBnsaR6UpMCqjDR9_hMo6qRMHGiW+iCaRYQW4...
The Chromium guys hit this [1] and have applied the patch for their kernels, I think it should be applied for everyone.
We picked it into our kernels because we needed a fix *now* to unbreak our builds, but I agree it should be fixed at least in relevant LTS versions.
Of course, I wasn't implying that was a bad thing :) it's further justification for this being a stable worthy patch as it fixes a real world issue and could fix more.
Okay, this makes more sense. The upstream commit message failed to mention this.
I've queued it up.
-- Thanks, Sasha
On Wed, Apr 24, 2019 at 1:46 AM Sasha Levin sashal@kernel.org wrote:
On Tue, Apr 23, 2019 at 01:03:55PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 12:56:28PM -0700, Matthias Kaehlcke wrote:
On Tue, Apr 23, 2019 at 12:45:12PM -0700, Nathan Chancellor wrote:
On Tue, Apr 23, 2019 at 03:35:12PM -0400, Sasha Levin wrote:
On Tue, Apr 23, 2019 at 12:04:21PM -0700, Nathan Chancellor wrote:
Hi Greg and Sasha,
Please apply this commit to 4.4 through 5.0 (patches are threaded in reply to this one), which will prevent Clang from emitting references to compiler runtime functions and doing some performance-killing optimization when using CONFIG_CC_OPTIMIZE_FOR_SIZE.
Please let me know if I did something wrong or if there are any objections.
This looks like a fix for a performance regression, which don't usually end up in stable unless they are severe enough.
Yes and no. The original reason for the revert was because of the compiler runtime functions:
https://lore.kernel.org/lkml/CAG5bF+S6OvBnsaR6UpMCqjDR9_hMo6qRMHGiW+iCaRYQW4...
The Chromium guys hit this [1] and have applied the patch for their kernels, I think it should be applied for everyone.
We picked it into our kernels because we needed a fix *now* to unbreak our builds, but I agree it should be fixed at least in relevant LTS versions.
Of course, I wasn't implying that was a bad thing :) it's further justification for this being a stable worthy patch as it fixes a real world issue and could fix more.
Okay, this makes more sense. The upstream commit message failed to mention this.
I've queued it up.
Dropped my private for-5.0/kbuild-cc-optimization Git branch. One less patch to carry with me...
Thanks.
- Sedat -
linux-stable-mirror@lists.linaro.org