All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Chuck Ebbert <cebbert@redhat.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Kirill Korotaev <dev@openvz.org>, Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devel@openvz.org
Subject: Re: [PATCH] mark read_crX() asm code as volatile
Date: Wed, 3 Oct 2007 10:45:05 +0200	[thread overview]
Message-ID: <200710031045.05234.ak@suse.de> (raw)
In-Reply-To: <200710030149.24914.nickpiggin@yahoo.com.au>


> 
> How does the compiler know it doesn't depend on memory?

When it has no m (or equivalent like g) constrained argument 
and no memory clobber.
 
> How do you say it depends on memory?

You add any of the above.

> You really need something as heavy as volatile?

You could do a memory clobber, but it would be heavier than the volatile
because the memory clobber clobbers all cached variables. volatile essentially 
just says "don't remove; has side effects". Normally gcc does that automatically
for something without outputs, but this one has.

Besides a CRx access does not actually clobber memory.

-Andi

  reply	other threads:[~2007-10-03  8:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-02 14:08 [PATCH] mark read_crX() asm code as volatile Kirill Korotaev
2007-10-02 14:17 ` Andi Kleen
2007-10-02 15:28 ` Arjan van de Ven
2007-10-02 18:27   ` Chuck Ebbert
2007-10-02 12:14     ` Nick Piggin
2007-10-03  6:18       ` H. Peter Anvin
2007-10-02 15:49         ` Nick Piggin
2007-10-03  8:45           ` Andi Kleen [this message]
2007-10-02 19:21   ` H. Peter Anvin
2007-10-03  8:25   ` Kirill Korotaev

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=200710031045.05234.ak@suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=cebbert@redhat.com \
    --cc=dev@openvz.org \
    --cc=devel@openvz.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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.