[PATCH 7/7] btrace: Add support for UINTR and UIRET events.

Willgerodt, Felix felix.willgerodt@intel.com
Wed Sep 11 14:49:42 GMT 2024


> -----Original Message-----
> From: Metzger, Markus T <markus.t.metzger@intel.com>
> Sent: Dienstag, 10. September 2024 17:12
> To: Willgerodt, Felix <felix.willgerodt@intel.com>
> Cc: gdb-patches@sourceware.org
> Subject: RE: [PATCH 7/7] btrace: Add support for UINTR and UIRET events.
> 
> Hello Felix,
> 
> >+#define UINTR_HANDLER_REG_SYSCALL 471
> >+#define UINTR_HANDLER_UNREG_SYSCALL 472
> >+#define UINTR_CREATE_FD_SYSCALL 473
> >+#define UINTR_SEND_REG_SYSCALL 474
> >+#define UINTR_SEND_UNREG_SYSCALL 475
> 
> Shouldn't those be defined in syscall.h (or unistd.h)?
> 
> If they are not defined, the system likely does not support user
> interrupts and we should skip this test.
> 
> >+int
> >+uintr_register_handler (void *ui_handler, unsigned int flags)
> >+{
> >+  return syscall (UINTR_HANDLER_REG_SYSCALL, ui_handler, flags);
> >+}
> 
> On systems that define those syscalls, there probably also is a glibc
> wrapper.  If there is, we should use it.
> 
> 
> >+  /* Do some other work */
> >+  while (!uintr_received); /* bp3 */
> 
> Could we set a limit to avoid waiting indefinitely if something goes
> wrong?  Maybe sleep inside a loop for a fixed number of iterations.
> 
> >+set opts [list debug "additional_flags=-muintr -mgeneral-regs-only -minline-
> >all-stringops"]
> >+
> >+standard_testfile uli.c
> >+if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" "$binfile" executable
> >$opts] != ""} {
> >+    return -1
> >+}
> >+clean_restart $testfile
> 
> Can't we use prepare_for_testing?  We could use the pthreads option.
> 
> >+# Test function call history.
> >+# ui_handler can be preceded by any function depending on the scheduling.
> >+gdb_test_sequence "record function-call-history" "function-call-history" {
> >+    "\\\[uintr: vector = 0x\[0-9a-fA-F\]+( \\\(#\[a-z\]+\\\))?, ip = 0x\[0-9a-fA-
> >F\]+\\\]"
> 
> Can we use $hex?
> 
> What does '( \\\(#\[a-z\]+\\\))?' mean?  There is no mnemonic for user interrupts.
> 
> Regards,
> Markus.

Hi Markus,

Thanks for the feedback. As a lot of these comments are about dependencies,
I researched the state of user interrupts a bit. It seems like there hasn't been much
movement on the LKML for 2-3 years, there is only this archived repo:
https://github.com/intel/uintr-linux-kernel
GCC support is upstream, I didn't check glibc.

But that leads me to conclude that we probably shouldn't merge these tests to
GDB for now, as no one can run them without using these kernel patches.
And as I don't know if the tests would ever work like they do now, if the feature
ever lands in upstream Linux.

Therefore I will remove the test and merge the btrace.c bits of this commit with
the previous commit, which has all the events that lack tests.

Regards,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


More information about the Gdb-patches mailing list