All of lore.kernel.org
 help / color / mirror / Atom feed
From: nsaenzju@redhat.com
To: Peter Xu <peterx@redhat.com>
Cc: linux-rt-users@vger.kernel.org, williams@redhat.com, jkacur@redhat.com
Subject: Re: [PATCH 2/3] oslat: Add aarch64 support
Date: Fri, 10 Sep 2021 16:27:05 +0200	[thread overview]
Message-ID: <1f3916ebd3bb9d886dee56404127308a7be8098e.camel@redhat.com> (raw)
In-Reply-To: <YTtekExun9GoaFvc@t490s>

On Fri, 2021-09-10 at 09:33 -0400, Peter Xu wrote:
> On Fri, Sep 10, 2021 at 02:19:40PM +0200, nsaenzju@redhat.com wrote:
> > > I also don't understand why you explicitly removed the compiler barrier.  IIUC
> > > when without it the compiler could move these instructions to be before/after
> > > other instructions generated in the c code.  That may not really happen in
> > > practise, but just curious why the explicit removal.
> > 
> > I removed it too as I see no justification for it. There is nothing, except for
> > the actual timestamp values (which are safe as they come from an mrs), that
> > could suffer from the compiler prefetching the value, or reordering accesses.
> > I'll add a comment on the commit message.
> 
> Again I have no solid example, but wondering whether when without compiler
> barrier the compiler would be legal to compile this code clip:
> 
>   t1 = frc();
>   a = 1;
>   t2 = frc();
> 
> into something like:
> 
>   t1 = frc();
>   t2 = frc();
>   a = 1;
> 
> It's just that iiuc compiler barrier has 0 overhead to us.  No strong opinion
> anyways.

My understanding is that can only happen when the expression to right of 'a'
has no dependencies with t2. And at that stage, do we really care? Well, yes,
for example if you're measuring how long it took to assign a, which is similar
to what we do:

	workload_fn workload = g.workload->w_fn;
	frc(&t1)
	workload()
	frc(&t2)

But in that case the compiler is forced to handle the indirect function call
and IIUC there is little optimization todo, so we're safe without barriers.

That said, I don't feel overly confident about all this, and there is little
downside to the compiler barriers, so I'll just add them.

-- 
Nicolás Sáenz


  reply	other threads:[~2021-09-10 14:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 10:02 [PATCH 1/3] oslat: rename cpu_mhz/cpu_hz to timer_mhz/cpu_hz Nicolas Saenz Julienne
2021-09-08 10:02 ` [PATCH 2/3] oslat: Add aarch64 support Nicolas Saenz Julienne
2021-09-08 18:09   ` Peter Xu
2021-09-09 10:10     ` nsaenzju
2021-09-09 18:03       ` Peter Xu
2021-09-10 12:19         ` nsaenzju
2021-09-10 13:33           ` Peter Xu
2021-09-10 14:27             ` nsaenzju [this message]
2021-09-10 17:00               ` Peter Xu
2021-09-08 10:02 ` [PATCH 3/3] oslat: Allow for arch specific timer frequency measurements Nicolas Saenz Julienne
2021-09-08 18:16   ` Peter Xu
2021-09-09 10:29     ` nsaenzju
2021-09-09 18:04       ` Peter Xu
2021-09-08 14:40 ` [PATCH 1/3] oslat: rename cpu_mhz/cpu_hz to timer_mhz/cpu_hz Peter Xu
2021-09-08 16:30   ` nsaenzju
2021-09-08 17:51     ` Peter Xu
2021-09-09  9:41       ` nsaenzju
2021-09-09 18:05         ` Peter Xu

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=1f3916ebd3bb9d886dee56404127308a7be8098e.camel@redhat.com \
    --to=nsaenzju@redhat.com \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=williams@redhat.com \
    /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 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.