All of lore.kernel.org
 help / color / mirror / Atom feed
* Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
@ 2019-04-23 19:04 Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.14] Revert "kbuild: use -Oz instead of -Os when using clang" Nathan Chancellor
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux

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



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

* [PATCH 4.14] Revert "kbuild: use -Oz instead of -Os when using clang"
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
@ 2019-04-23 19:04 ` Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.19] " Nathan Chancellor
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux, Matthias Kaehlcke,
	Peter Zijlstra, Masahiro Yamada, Nathan Chancellor

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,)
-- 
2.21.0


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

* [PATCH 4.19] Revert "kbuild: use -Oz instead of -Os when using clang"
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.14] Revert "kbuild: use -Oz instead of -Os when using clang" Nathan Chancellor
@ 2019-04-23 19:04 ` Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.4] " Nathan Chancellor
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux, Matthias Kaehlcke,
	Peter Zijlstra, Masahiro Yamada, Nathan Chancellor

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,)
-- 
2.21.0


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

* [PATCH 4.4] Revert "kbuild: use -Oz instead of -Os when using clang"
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.14] Revert "kbuild: use -Oz instead of -Os when using clang" Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.19] " Nathan Chancellor
@ 2019-04-23 19:04 ` Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 4.9] " Nathan Chancellor
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux, Matthias Kaehlcke,
	Peter Zijlstra, Masahiro Yamada, Nathan Chancellor

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
-- 
2.21.0


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

* [PATCH 4.9] Revert "kbuild: use -Oz instead of -Os when using clang"
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
                   ` (2 preceding siblings ...)
  2019-04-23 19:04 ` [PATCH 4.4] " Nathan Chancellor
@ 2019-04-23 19:04 ` Nathan Chancellor
  2019-04-23 19:04 ` [PATCH 5.0] " Nathan Chancellor
  2019-04-23 19:35 ` Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Sasha Levin
  5 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux, Matthias Kaehlcke,
	Peter Zijlstra, Masahiro Yamada, Nathan Chancellor

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,)
-- 
2.21.0


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

* [PATCH 5.0] Revert "kbuild: use -Oz instead of -Os when using clang"
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
                   ` (3 preceding siblings ...)
  2019-04-23 19:04 ` [PATCH 4.9] " Nathan Chancellor
@ 2019-04-23 19:04 ` Nathan Chancellor
  2019-04-23 19:35 ` Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Sasha Levin
  5 siblings, 0 replies; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin, stable
  Cc: Nick Desaulniers, clang-built-linux, Matthias Kaehlcke,
	Peter Zijlstra, Masahiro Yamada, Nathan Chancellor

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,)
-- 
2.21.0


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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
                   ` (4 preceding siblings ...)
  2019-04-23 19:04 ` [PATCH 5.0] " Nathan Chancellor
@ 2019-04-23 19:35 ` Sasha Levin
  2019-04-23 19:42   ` Nick Desaulniers
  2019-04-23 19:45   ` Nathan Chancellor
  5 siblings, 2 replies; 13+ messages in thread
From: Sasha Levin @ 2019-04-23 19:35 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Greg Kroah-Hartman, stable, Nick Desaulniers, clang-built-linux

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

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 19:35 ` Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Sasha Levin
@ 2019-04-23 19:42   ` Nick Desaulniers
  2019-04-23 19:45   ` Nathan Chancellor
  1 sibling, 0 replies; 13+ messages in thread
From: Nick Desaulniers @ 2019-04-23 19:42 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Nathan Chancellor, Greg Kroah-Hartman, # 3.4.x, clang-built-linux

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.
-- 
Thanks,
~Nick Desaulniers

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 19:35 ` Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Sasha Levin
  2019-04-23 19:42   ` Nick Desaulniers
@ 2019-04-23 19:45   ` Nathan Chancellor
  2019-04-23 19:56     ` Matthias Kaehlcke
  1 sibling, 1 reply; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 19:45 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Greg Kroah-Hartman, stable, Nick Desaulniers, clang-built-linux

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+iCaRYQW4C3YA@mail.gmail.com/

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/+/8bb957d781e2350515c7cffd7e7dc0dfc1777f3b
[2]: https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=e828e50380a34533c37eff98345847fd74667ddd

Thanks for the quick reply!
Nathan

> --
> Thanks,
> Sasha

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 19:45   ` Nathan Chancellor
@ 2019-04-23 19:56     ` Matthias Kaehlcke
  2019-04-23 20:03       ` Nathan Chancellor
  0 siblings, 1 reply; 13+ messages in thread
From: Matthias Kaehlcke @ 2019-04-23 19:56 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sasha Levin, Greg Kroah-Hartman, stable, Nick Desaulniers,
	clang-built-linux

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+iCaRYQW4C3YA@mail.gmail.com/
> 
> 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.
> 
> [1]: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/8bb957d781e2350515c7cffd7e7dc0dfc1777f3b
> [2]: https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=e828e50380a34533c37eff98345847fd74667ddd

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.

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 19:56     ` Matthias Kaehlcke
@ 2019-04-23 20:03       ` Nathan Chancellor
  2019-04-23 23:46         ` Sasha Levin
  0 siblings, 1 reply; 13+ messages in thread
From: Nathan Chancellor @ 2019-04-23 20:03 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Sasha Levin, Greg Kroah-Hartman, stable, Nick Desaulniers,
	clang-built-linux

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+iCaRYQW4C3YA@mail.gmail.com/
> > 
> > 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.
> > 
> > [1]: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/8bb957d781e2350515c7cffd7e7dc0dfc1777f3b
> > [2]: https://source.codeaurora.org/quic/la/kernel/msm-4.9/commit/?id=e828e50380a34533c37eff98345847fd74667ddd
> 
> 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

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 20:03       ` Nathan Chancellor
@ 2019-04-23 23:46         ` Sasha Levin
  2019-04-24  5:58           ` Sedat Dilek
  0 siblings, 1 reply; 13+ messages in thread
From: Sasha Levin @ 2019-04-23 23:46 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Matthias Kaehlcke, Greg Kroah-Hartman, stable, Nick Desaulniers,
	clang-built-linux

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+iCaRYQW4C3YA@mail.gmail.com/
>> >
>> > 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

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

* Re: Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a
  2019-04-23 23:46         ` Sasha Levin
@ 2019-04-24  5:58           ` Sedat Dilek
  0 siblings, 0 replies; 13+ messages in thread
From: Sedat Dilek @ 2019-04-24  5:58 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Nathan Chancellor, Matthias Kaehlcke, Greg Kroah-Hartman, stable,
	Nick Desaulniers, Clang-Built-Linux ML

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+iCaRYQW4C3YA@mail.gmail.com/
> >> >
> >> > 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 -

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

end of thread, other threads:[~2019-04-24  5:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 19:04 Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Nathan Chancellor
2019-04-23 19:04 ` [PATCH 4.14] Revert "kbuild: use -Oz instead of -Os when using clang" Nathan Chancellor
2019-04-23 19:04 ` [PATCH 4.19] " Nathan Chancellor
2019-04-23 19:04 ` [PATCH 4.4] " Nathan Chancellor
2019-04-23 19:04 ` [PATCH 4.9] " Nathan Chancellor
2019-04-23 19:04 ` [PATCH 5.0] " Nathan Chancellor
2019-04-23 19:35 ` Backport of commit a75bb4eb9e565b9f5115e2e8c07377ce32cbe69a Sasha Levin
2019-04-23 19:42   ` Nick Desaulniers
2019-04-23 19:45   ` Nathan Chancellor
2019-04-23 19:56     ` Matthias Kaehlcke
2019-04-23 20:03       ` Nathan Chancellor
2019-04-23 23:46         ` Sasha Levin
2019-04-24  5:58           ` Sedat Dilek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.