All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
@ 2016-11-21 14:49 Alexey Brodkin
  2016-11-21 14:54 ` Thomas Petazzoni
  2016-12-17 16:22 ` Thomas Petazzoni
  0 siblings, 2 replies; 6+ messages in thread
From: Alexey Brodkin @ 2016-11-21 14:49 UTC (permalink / raw)
  To: buildroot

After quite some time trying this and that we seem to have no
better solution than proposed by Thomas back in the day [1].

The solution in question is to check [during jack2 configuration]
if NGREG is exposed via ucontext.h and then use its value in
source code later on. This replaces long and still growing list
of architectures for which we explicitly escape usage of NGREG.

Just for reference [2] is my attempt to fix in in the other
supposedly better way but with no luck because of the mess in
kernel's UAPI headers.

[1] http://lists.busybox.net/pipermail/buildroot/2016-May/161785.html
[2] http://lists.busybox.net/pipermail/buildroot/2016-June/162461.html

Still not sure if that works for every other architectures, so testing
and Acks from all interested parties are much appreciated.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Waldemar Brodkorb <wbx@openadk.org>
---
 package/jack2/0001-Add-support-for-nios2.patch     | 34 --------------
 .../jack2/0004-Add-check-for-the-NGREG-macro.patch | 52 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 34 deletions(-)
 delete mode 100644 package/jack2/0001-Add-support-for-nios2.patch
 create mode 100644 package/jack2/0004-Add-check-for-the-NGREG-macro.patch

diff --git a/package/jack2/0001-Add-support-for-nios2.patch b/package/jack2/0001-Add-support-for-nios2.patch
deleted file mode 100644
index f6d60af..0000000
--- a/package/jack2/0001-Add-support-for-nios2.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 3651f95d0433c84d2b67e30e68dd6140585535b0 Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd.kuhls@t-online.de>
-Date: Tue, 19 Apr 2016 19:32:35 +0200
-Subject: [PATCH 1/1] Add support for nios2
-
-When compiling jack on nios2, compilation fails because NGREGS is not
-defined. Since this is only for debug output on segmentation faults, stub
-the debug print out like it's been done for other platforms before.
-
-Inspired by
-https://github.com/jackaudio/jack2/commit/d11bb095291d8880508c87adfe625bf2bcab1456
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
-[Patch sent upstream: https://github.com/jackaudio/jack2/pull/199]
----
- dbus/sigsegv.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
-index 64c3986..ee12f91 100644
---- a/dbus/sigsegv.c
-+++ b/dbus/sigsegv.c
-@@ -104,7 +104,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
-     jack_error("info.si_errno = %d", info->si_errno);
-     jack_error("info.si_code  = %d (%s)", info->si_code, si_code_str);
-     jack_error("info.si_addr  = %p", info->si_addr);
--#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__)
-+#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__) && !defined(nios2)
-     for(i = 0; i < NGREG; i++)
-         jack_error("reg[%02d]       = 0x" REGFORMAT, i, 
- #if defined(__powerpc64__)
--- 
-2.8.0.rc3
-
diff --git a/package/jack2/0004-Add-check-for-the-NGREG-macro.patch b/package/jack2/0004-Add-check-for-the-NGREG-macro.patch
new file mode 100644
index 0000000..36190ce
--- /dev/null
+++ b/package/jack2/0004-Add-check-for-the-NGREG-macro.patch
@@ -0,0 +1,52 @@
+From 754205cfccc7b28732c2a952a14d1434b67eb074 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Mon, 23 May 2016 22:28:12 +0200
+Subject: [PATCH] Add check for the NGREG macro
+
+The NGREG macro is not available on all CPU architectures. Rather than
+making a long list of exclusions longer and longer, add a waf check to
+test for its functionality.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ dbus/sigsegv.c | 4 ++--
+ wscript        | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
+index df2c42c..35c5151 100644
+--- a/dbus/sigsegv.c
++++ b/dbus/sigsegv.c
+@@ -106,7 +106,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
+     jack_error("info.si_errno = %d", info->si_errno);
+     jack_error("info.si_code  = %d (%s)", info->si_code, si_code_str);
+     jack_error("info.si_addr  = %p", info->si_addr);
+-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__)
++#if HAVE_NGREG
+     for(i = 0; i < NGREG; i++)
+         jack_error("reg[%02d]       = 0x" REGFORMAT, i, 
+ #if defined(__powerpc64__)
+@@ -119,7 +119,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
+                 ucontext->uc_mcontext.gregs[i]
+ #endif
+                 );
+-#endif /* alpha, ia64, kFreeBSD, arm, hppa */
++#endif /* NGREG */
+ 
+ #if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
+ # if defined(SIGSEGV_STACK_IA64)
+diff --git a/wscript b/wscript
+index 63ba3aa..a0838b0 100644
+--- a/wscript
++++ b/wscript
+@@ -168,6 +168,8 @@ def configure(conf):
+ 
+     conf.check_cc(header_name='execinfo.h', define_name="HAVE_EXECINFO_H", mandatory=False)
+     conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
++    conf.check_cc(fragment="#include <ucontext.h>\nint main() { return NGREG; }\n",
++                  define_name="HAVE_NGREG", mandatory=False)
+ 
+     if conf.is_defined('HAVE_SAMPLERATE'):
+         conf.env['LIB_SAMPLERATE'] = ['samplerate']
+-- 
+2.7.4
-- 
2.6.3

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

* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
  2016-11-21 14:49 [Buildroot] [PATCH] jack2: Try better fix for NGREG problem Alexey Brodkin
@ 2016-11-21 14:54 ` Thomas Petazzoni
  2016-11-21 14:58   ` Alexey Brodkin
  2016-12-17 16:22 ` Thomas Petazzoni
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2016-11-21 14:54 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 21 Nov 2016 17:49:55 +0300, Alexey Brodkin wrote:
> After quite some time trying this and that we seem to have no
> better solution than proposed by Thomas back in the day [1].
> 
> The solution in question is to check [during jack2 configuration]
> if NGREG is exposed via ucontext.h and then use its value in
> source code later on. This replaces long and still growing list
> of architectures for which we explicitly escape usage of NGREG.
> 
> Just for reference [2] is my attempt to fix in in the other
> supposedly better way but with no luck because of the mess in
> kernel's UAPI headers.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-May/161785.html
> [2] http://lists.busybox.net/pipermail/buildroot/2016-June/162461.html
> 
> Still not sure if that works for every other architectures, so testing
> and Acks from all interested parties are much appreciated.

Unfortunately, I experimented with something like this some time ago,
and IIRC, it didn't work all architectures, because NGREG is not always
defined in <ucontext.h>, but can be defined in other header files (if I
recall). In the end, I think I ended up with something like the below,
but I don't remember if I tested it in all cases:

(As you can see, it dates back from May 2016...)

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

* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
  2016-11-21 14:54 ` Thomas Petazzoni
@ 2016-11-21 14:58   ` Alexey Brodkin
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Brodkin @ 2016-11-21 14:58 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Mon, 2016-11-21 at 15:54 +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Mon, 21 Nov 2016 17:49:55 +0300, Alexey Brodkin wrote:
> > 
> > After quite some time trying this and that we seem to have no
> > better solution than proposed by Thomas back in the day [1].
> > 
> > The solution in question is to check [during jack2 configuration]
> > if NGREG is exposed via ucontext.h and then use its value in
> > source code later on. This replaces long and still growing list
> > of architectures for which we explicitly escape usage of NGREG.
> > 
> > Just for reference [2] is my attempt to fix in in the other
> > supposedly better way but with no luck because of the mess in
> > kernel's UAPI headers.
> > 
> > [1] http://lists.busybox.net/pipermail/buildroot/2016-May/161785.html
> > [2] http://lists.busybox.net/pipermail/buildroot/2016-June/162461.html
> > 
> > Still not sure if that works for every other architectures, so testing
> > and Acks from all interested parties are much appreciated.
> 
> Unfortunately, I experimented with something like this some time ago,
> and IIRC, it didn't work all architectures, because NGREG is not always
> defined in <ucontext.h>, but can be defined in other header files (if I
> recall). In the end, I think I ended up with something like the below,
> but I don't remember if I tested it in all cases:
> 
> (As you can see, it dates back from May 2016...)
> 
> From 15685fd4409486e7059bb480193d1086c5634910 Mon Sep 17 00:00:00 2001
> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Date: Mon, 23 May 2016 22:28:12 +0200
> Subject: [PATCH] Improve check for ucontext
> 
> The ucontext functionality is not available on all CPUs with all C
> libraries. Instead of making just assumptions based on the CPU
> architecture, this commit adds the necessary checks in wscript to verify
> the availability of the ucontext functionality, before using it in
> dbus/sigsegv.c.
> 
> This avoids the long list of architecture exclusions, and make it more
> robust when building jack2 for new CPU architectures.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> ?dbus/sigsegv.c | 12 ++++++------
> ?wscript????????| 11 ++++++++++-
> ?2 files changed, 16 insertions(+), 7 deletions(-)

That now looks really scary.
Maybe we follow much cleaner path and will remove that damned check where
NGREG is used all together? Anyways it was used let's say "not always" so
that might be not that bad solution.

What do you think?

Not sure if that corner case really requires more time from us.

-Alexey

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

* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
  2016-11-21 14:49 [Buildroot] [PATCH] jack2: Try better fix for NGREG problem Alexey Brodkin
  2016-11-21 14:54 ` Thomas Petazzoni
@ 2016-12-17 16:22 ` Thomas Petazzoni
  2016-12-19 15:57   ` Alexey Brodkin
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2016-12-17 16:22 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 21 Nov 2016 17:49:55 +0300, Alexey Brodkin wrote:
> After quite some time trying this and that we seem to have no
> better solution than proposed by Thomas back in the day [1].
> 
> The solution in question is to check [during jack2 configuration]
> if NGREG is exposed via ucontext.h and then use its value in
> source code later on. This replaces long and still growing list
> of architectures for which we explicitly escape usage of NGREG.
> 
> Just for reference [2] is my attempt to fix in in the other
> supposedly better way but with no luck because of the mess in
> kernel's UAPI headers.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-May/161785.html
> [2] http://lists.busybox.net/pipermail/buildroot/2016-June/162461.html
> 
> Still not sure if that works for every other architectures, so testing
> and Acks from all interested parties are much appreciated.

I have submitted an improved version of this:

  https://patchwork.ozlabs.org/patch/706714/

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
  2016-12-17 16:22 ` Thomas Petazzoni
@ 2016-12-19 15:57   ` Alexey Brodkin
  2016-12-19 16:23     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Brodkin @ 2016-12-19 15:57 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Sat, 2016-12-17 at 17:22 +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Mon, 21 Nov 2016 17:49:55 +0300, Alexey Brodkin wrote:
> > 
> > After quite some time trying this and that we seem to have no
> > better solution than proposed by Thomas back in the day [1].
> > 
> > The solution in question is to check [during jack2 configuration]
> > if NGREG is exposed via ucontext.h and then use its value in
> > source code later on. This replaces long and still growing list
> > of architectures for which we explicitly escape usage of NGREG.
> > 
> > Just for reference [2] is my attempt to fix in in the other
> > supposedly better way but with no luck because of the mess in
> > kernel's UAPI headers.
> > 
> > [1] https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.busybox.net_pipermail_buildroot_2016-2DMay_161785.html
> > &d=DgICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=lO-
> > pWm8TsFCI8LpRpFt8VMDAaoxteVHDKeXx2lKUc6M&s=nQ80Ho3tQdAjjk76kuGcuhh_PBE9EAEFNOpYeQIryrk&e=?
> > [2] https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.busybox.net_pipermail_buildroot_2016-2DJune_162461.htm
> > l&d=DgICAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=lO-
> > pWm8TsFCI8LpRpFt8VMDAaoxteVHDKeXx2lKUc6M&s=37fBEUzi8Cri1lFd5OsOcCvWM_MYPDctH0kR9fYlTRM&e=?
> > 
> > Still not sure if that works for every other architectures, so testing
> > and Acks from all interested parties are much appreciated.
> 
> I have submitted an improved version of this:

Thanks for doing that!
Let's see if Jack2 appears in Autobuilder failures again now.

-Alexey

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

* [Buildroot] [PATCH] jack2: Try better fix for NGREG problem
  2016-12-19 15:57   ` Alexey Brodkin
@ 2016-12-19 16:23     ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2016-12-19 16:23 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 19 Dec 2016 15:57:09 +0000, Alexey Brodkin wrote:

> > > Still not sure if that works for every other architectures, so testing
> > > and Acks from all interested parties are much appreciated.  
> > 
> > I have submitted an improved version of this:  
> 
> Thanks for doing that!
> Let's see if Jack2 appears in Autobuilder failures again now.

I haven't applied the patch yet, so it's not going to fix autobuilder
issues for the moment.

I was waiting for some review before applying the patch.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-12-19 16:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 14:49 [Buildroot] [PATCH] jack2: Try better fix for NGREG problem Alexey Brodkin
2016-11-21 14:54 ` Thomas Petazzoni
2016-11-21 14:58   ` Alexey Brodkin
2016-12-17 16:22 ` Thomas Petazzoni
2016-12-19 15:57   ` Alexey Brodkin
2016-12-19 16:23     ` Thomas Petazzoni

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.