All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: davej@codemonkey.org.uk,
	Stephan Diestelhorst <langer_mann@web.de>,
	linux-kernel@vger.kernel.org, cpufreq@lists.linux.org.uk
Subject: Re: [PATCH 1/1] Speedfreq-SMI call clobbers ECX
Date: Wed, 05 Mar 2008 08:02:16 -0800	[thread overview]
Message-ID: <47CEC408.2070604@zytor.com> (raw)
In-Reply-To: <20080305153520.GB19300@elte.hu>

Ingo Molnar wrote:
> * Stephan Diestelhorst <langer_mann@web.de> wrote:
> 
>> @@ -184,7 +184,7 @@ static void speedstep_set_state (unsigne
>>  		__asm__ __volatile__(
>>  			"movl $0, %%edi\n"
>>  			"out %%al, (%%dx)\n"
>> -			: "=b" (new_state), "=D" (result)
>> +			: "=b" (new_state), "=D" (result), "=c" (ecx_clobber)
>>  			: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
>>  			);
> 
> stupid suggestion: why not do a pusha/popa around those instructions, to 
> make sure everything is restored? This isnt a fastpath and being 
> conservative about SMI side-effects cannot hurt ...
> 

You can't pusha/popa if you expect a result.  You can, of course, push 
and pop individual registers.

It's also kind of odd to do "movl $0,%%edi" instead of just setting EDI 
as an input.

	-hpa

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Stephan Diestelhorst <langer_mann@web.de>,
	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: Wed, 05 Mar 2008 08:02:16 -0800	[thread overview]
Message-ID: <47CEC408.2070604@zytor.com> (raw)
In-Reply-To: <20080305153520.GB19300@elte.hu>

Ingo Molnar wrote:
> * Stephan Diestelhorst <langer_mann@web.de> wrote:
> 
>> @@ -184,7 +184,7 @@ static void speedstep_set_state (unsigne
>>  		__asm__ __volatile__(
>>  			"movl $0, %%edi\n"
>>  			"out %%al, (%%dx)\n"
>> -			: "=b" (new_state), "=D" (result)
>> +			: "=b" (new_state), "=D" (result), "=c" (ecx_clobber)
>>  			: "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
>>  			);
> 
> stupid suggestion: why not do a pusha/popa around those instructions, to 
> make sure everything is restored? This isnt a fastpath and being 
> conservative about SMI side-effects cannot hurt ...
> 

You can't pusha/popa if you expect a result.  You can, of course, push 
and pop individual registers.

It's also kind of odd to do "movl $0,%%edi" instead of just setting EDI 
as an input.

	-hpa

  reply	other threads:[~2008-03-05 16:02 UTC|newest]

Thread overview: 18+ 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 15:35   ` Ingo Molnar
2008-03-05 16:02   ` H. Peter Anvin [this message]
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-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
2008-03-10 21:51               ` Andi Kleen
2008-03-10 21:51                 ` Andi Kleen
2008-03-10 23:14               ` Stephan Diestelhorst
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=47CEC408.2070604@zytor.com \
    --to=hpa@zytor.com \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=davej@codemonkey.org.uk \
    --cc=langer_mann@web.de \
    --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 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.