public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephan Diestelhorst <langer_mann@web.de>
To: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	davej@codemonkey.org.uk, cpufreq@lists.linux.org.uk,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] Speedfreq-SMI call clobbers ECX
Date: Mon, 10 Mar 2008 22:26:38 +0100	[thread overview]
Message-ID: <200803102226.39044.langer_mann@web.de> (raw)
In-Reply-To: <87iqzu8r2q.fsf@basil.nowhere.org>

Andi Kleen wrote:
> Stephan Diestelhorst <langer_mann@web.de> writes:
> > 
> > New attempt with full clobbers, note that I deliberatly did not change
> > the order of the output registers. Real output operands still preceede
> > outputs used for potential clobbering.
> > 
> > I'm not too sure about the EBP push/pop frame, but as folks pointed
> > out already, we should not trust the SMI code too much.
> 
> Be careful -- older gcc versions tend to abort for inline asm
> that clobbers too many registers. Especially when the register
> is already used (like ebp in a frame pointer enabled kernel) 

AFAIK clobbering ebp is silently ignored on the GCCs I've tried it
on (regardles of frame-pointer ommission). Hence there is a hard-coded
push & pop for that register.

Please also note that these are not clobbers in the strict inline asm
syntax, but rather dummy output values that correspond to actual
input parameters. I'd consider this a serious compiler flaw, if not
bug, if these would not work. But let's not get into GCC vs.
Fancy-inline-asm-hacker flames, like the mplayer folks do ;-)

> Make sure it at least works on the oldest supported gcc version 
> (gcc 3.2) and with frame pointer on.

As I've said, I do not expect this to be problematic, but will test,
just to be sure! 

> For asms with so many clobbers explicit push/pop is usually safer.

Yes, but it is unneccessary overhead as the compiler can (should!)
find more elegant ways to get those registers back if needed.

Regards,
  Stephan

  reply	other threads:[~2008-03-10 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 14:59 [PATCH 1/1] Speedfreq-SMI call clobbers ECX Stephan Diestelhorst
2008-03-05 15:35 ` Ingo Molnar
2008-03-05 16:02   ` H. Peter Anvin
2008-03-06  8:38   ` Stephan Diestelhorst
2008-03-06  8:51     ` Stephan Diestelhorst
2008-03-06 10:56       ` Ingo Molnar
2008-03-10 15:05         ` Stephan Diestelhorst
2008-03-10 16:46           ` Andi Kleen
2008-03-10 21:26             ` Stephan Diestelhorst [this message]
2008-03-10 21:51               ` Andi Kleen
2008-03-10 23:14               ` Stephan Diestelhorst
2008-03-11  9:39               ` Ingo Molnar
2008-03-12 15:04                 ` Stephan Diestelhorst

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=200803102226.39044.langer_mann@web.de \
    --to=langer_mann@web.de \
    --cc=andi@firstfloor.org \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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