public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Matheus Castanho <msc@linux.ibm.com>
To: DJ Delorie <dj@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [patch/idea] Add register scrambling to testsuite
Date: Mon, 13 Jun 2022 15:41:53 -0300	[thread overview]
Message-ID: <87ilp4tmzk.fsf@linux.ibm.com> (raw)
In-Reply-To: <xnleu0o6fh.fsf@greed.delorie.com>


Hi DJ,

DJ Delorie via Libc-alpha <libc-alpha@sourceware.org> writes:

> Florian Weimer <fweimer@redhat.com> writes:
>> This funcationality is likely more easily written as an assembler
>> routine that expects a function pointer and closure argument, performs
>> the register clobbers, and then calls the function with the closure
>> argument.
>
> I thought of putting the scramble just before the do_test calls, but
> there were more than one of those, and for the cases I'm trying to
> avoid, it doesn't matter when the regs are clobbered.
>

I was actually working on a patch similar to this one, but looks like
you beat me to it =). And you version seems cleaner.

You could embed your call to support_scramble_registers() in the CALL
macro on test-string.h:

#define CALL(impl, ...) \
  ({ support_scramble_registers (); (* (proto_t) (impl)->fn) (__VA_ARGS__); })

This way it would apply for all optimized function calls without
requiring many more changes. It also wouldn't affect the string
benchtests, since they use a separate CALL definition from
bench-string.h

> Calling scramble once is enough to more accurately simulate a "busy app"
> where gcc would have eventually filled all the registers with something,
> which is what happened in the bug I referenced.  A closure-based asm
> routine would make the work much more complicated, for no real benefit.
>
> I've seen testsuites where each call-under-test was wrapped in a routine
> that called it multiple times, permuting the "untouched" registers each
> time.  I don't think we need to go that far.

--
Matheus Castanho

  reply	other threads:[~2022-06-13 18:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11  3:52 DJ Delorie
2022-06-11 21:18 ` Noah Goldstein
2022-06-13  7:13   ` Florian Weimer
2022-06-13 16:48     ` DJ Delorie
2022-06-13 18:41       ` Matheus Castanho [this message]
2022-06-13 19:36         ` DJ Delorie
2022-06-13 16:44   ` DJ Delorie
2022-06-13  4:48 ` Jeff Law
2022-06-13 16:43   ` DJ Delorie
2022-06-16  7:46     ` Fangrui Song
2022-06-13  7:42 ` Siddhesh Poyarekar
2022-06-13 16:52   ` DJ Delorie
2022-06-14  5:43     ` Siddhesh Poyarekar
2022-06-14 16:11       ` DJ Delorie
2022-06-14  3:42 ` H.J. Lu
2022-06-14  4:01   ` Noah Goldstein
2022-06-14  4:07     ` DJ Delorie
2022-06-14  4:03   ` DJ Delorie
2022-06-13 12:04 Wilco Dijkstra
2022-06-13 13:33 ` Florian Weimer
2022-06-16 10:29   ` Wilco Dijkstra
2022-06-18  3:54 ` DJ Delorie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilp4tmzk.fsf@linux.ibm.com \
    --to=msc@linux.ibm.com \
    --cc=dj@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).