* [Qemu-devel] [PATCH for-2.0 v2] configure: add workaround for SystemTap PR13296
@ 2014-03-21 15:28 Stefan Hajnoczi
2014-03-21 16:39 ` Frank Ch. Eigler
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-03-21 15:28 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Frank Ch. Eigler, Stefan Hajnoczi, Peter Maydell
SystemTap sdt.h sometimes results in compiled probes without sufficient
information to extract arguments. See code comment for details on this
workaround.
This patch fixes the apic_reset_irq_delivered() trace event on Fedora 20
with gcc-4.8.2-7.fc20 and systemtap-sdt-devel-2.4-2.fc20 on x86_64.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
configure | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/configure b/configure
index aae617e..6c86431 100755
--- a/configure
+++ b/configure
@@ -3635,6 +3635,22 @@ if test "$trace_backend" = "dtrace"; then
trace_backend_stap="no"
if has 'stap' ; then
trace_backend_stap="yes"
+
+ # Sometimes sdt.h probes produce insufficient information to access probe
+ # arguments. The compiler can be forced to place probe arguments in
+ # registers to avoid the issue. This workaround has a performance cost so
+ # it should be dropped if SystemTap is able to resolve the underlying
+ # issue.
+ #
+ # On host architectures that are starved for registers, it may not be
+ # possible to force arguments into registers and this causes a compiler
+ # error. Only apply this workaround on x86_64 where the problem has been
+ # observed.
+ #
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=13296
+ if test "$ARCH" = "x86_64"; then
+ QEMU_CFLAGS="-DSTAP_SDT_ARG_CONSTRAINT=r $QEMU_CFLAGS"
+ fi
fi
fi
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.0 v2] configure: add workaround for SystemTap PR13296
2014-03-21 15:28 [Qemu-devel] [PATCH for-2.0 v2] configure: add workaround for SystemTap PR13296 Stefan Hajnoczi
@ 2014-03-21 16:39 ` Frank Ch. Eigler
2014-03-24 12:55 ` Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Frank Ch. Eigler @ 2014-03-21 16:39 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: Paolo Bonzini, qemu-devel, Peter Maydell
Hi -
On Fri, Mar 21, 2014 at 04:28:24PM +0100, Stefan Hajnoczi wrote:
> SystemTap sdt.h sometimes results in compiled probes without sufficient
> information to extract arguments. See code comment for details on this
> workaround.
>
> This patch fixes the apic_reset_irq_delivered() trace event on Fedora 20
> with gcc-4.8.2-7.fc20 and systemtap-sdt-devel-2.4-2.fc20 on x86_64.
An alternate solution would focus on this particular trace site.
(It's peculiar because the surrounding code doesn't read the value
being passed to the tracers at all, so the value is not already
available in a register.)
The benefit of this solution is that the hundreds of other trace sites
are not affected at all. 230 of them (on my qemu-system-X86 builds)
use register-indirect operand expressions currently, and your patch
would force all of those to be turned into actual loads -- i.e., slow
down qemu.
Please consider whether that performance is worth it, over a
patch as dreadful :-) as the following.
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index c623fcc6d813..e7bbac1be48b 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -117,7 +117,10 @@ void apic_report_irq_delivered(int delivered)
void apic_reset_irq_delivered(void)
{
- trace_apic_reset_irq_delivered(apic_irq_delivered);
+ /* Copy this into a local variable to encourage gcc to emit a plain
+ register for a sys/sdt.h marker. */
+ volatile int a_i_d = apic_irq_delivered;
+ trace_apic_reset_irq_delivered(a_i_d);
apic_irq_delivered = 0;
}
- FChE
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for-2.0 v2] configure: add workaround for SystemTap PR13296
2014-03-21 16:39 ` Frank Ch. Eigler
@ 2014-03-24 12:55 ` Stefan Hajnoczi
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-03-24 12:55 UTC (permalink / raw)
To: Frank Ch. Eigler; +Cc: Paolo Bonzini, qemu-devel, Peter Maydell
On Fri, Mar 21, 2014 at 12:39:54PM -0400, Frank Ch. Eigler wrote:
> Hi -
>
> On Fri, Mar 21, 2014 at 04:28:24PM +0100, Stefan Hajnoczi wrote:
> > SystemTap sdt.h sometimes results in compiled probes without sufficient
> > information to extract arguments. See code comment for details on this
> > workaround.
> >
> > This patch fixes the apic_reset_irq_delivered() trace event on Fedora 20
> > with gcc-4.8.2-7.fc20 and systemtap-sdt-devel-2.4-2.fc20 on x86_64.
>
> An alternate solution would focus on this particular trace site.
> (It's peculiar because the surrounding code doesn't read the value
> being passed to the tracers at all, so the value is not already
> available in a register.)
>
> The benefit of this solution is that the hundreds of other trace sites
> are not affected at all. 230 of them (on my qemu-system-X86 builds)
> use register-indirect operand expressions currently, and your patch
> would force all of those to be turned into actual loads -- i.e., slow
> down qemu.
>
> Please consider whether that performance is worth it, over a
> patch as dreadful :-) as the following.
>
>
>
> diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
> index c623fcc6d813..e7bbac1be48b 100644
> --- a/hw/intc/apic_common.c
> +++ b/hw/intc/apic_common.c
> @@ -117,7 +117,10 @@ void apic_report_irq_delivered(int delivered)
>
> void apic_reset_irq_delivered(void)
> {
> - trace_apic_reset_irq_delivered(apic_irq_delivered);
> + /* Copy this into a local variable to encourage gcc to emit a plain
> + register for a sys/sdt.h marker. */
> + volatile int a_i_d = apic_irq_delivered;
> + trace_apic_reset_irq_delivered(a_i_d);
>
> apic_irq_delivered = 0;
> }
This is not too bad either. Can I add your Signed-off-by:?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-24 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 15:28 [Qemu-devel] [PATCH for-2.0 v2] configure: add workaround for SystemTap PR13296 Stefan Hajnoczi
2014-03-21 16:39 ` Frank Ch. Eigler
2014-03-24 12:55 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).