linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: hpa@zytor.com
Cc: linux-tip-commits@vger.kernel.org,
	tip-bot for Borislav Petkov <tipbot@zytor.com>,
	mingo@kernel.org, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Subject: Re: [tip:x86/urgent] x86/CPU: Add native CPUID variants returning a single datum
Date: Tue, 10 Jan 2017 18:09:36 +0100	[thread overview]
Message-ID: <20170110170936.uvdgvfqr5j5c4ntu@pd.tnic> (raw)
In-Reply-To: <691CAE2B-2FDC-44CA-8731-D70C91E94320@zytor.com>

On Tue, Jan 10, 2017 at 08:40:39AM -0800, hpa@zytor.com wrote:
> You are introducing a new API; makes more sense to do it right from
> the start. The only reason not to have a subleaf for the non-native
> variants is that they may decay into a function call so there is an
> extra cost.

The "do it right" is what I'm not sure of. Do you see any use cases for
the subleaf != 0 *native* variant at all?

Most if not all users of native_cpuid() in the tree set ecx to 0.

> C doesn't allow function name overloading ;) (Well, except the C11
> type hacks; to the best of my knowledge that doesn't in any way
> support argument *count* overloading.)

Grr, I forgot to change the function name. I didn't mean that.

>From looking at it again, what I mean would be ugly too :-)

I guess *if* the need arises - and again, I'm really sceptical about it
- we should simply add the respective native version of cpuid_count():

/* Some CPUID calls want 'count' to be placed in ecx */
static inline void native_cpuid_count(unsigned int op, int count,
	                               unsigned int *eax, unsigned int *ebx,
	                               unsigned int *ecx, unsigned int *edx)
{
        *eax = op;
        *ecx = count;
        native_cpuid(eax, ebx, ecx, edx);
}

Because this way you have both native and non-native versions nicely
comparable wrt arguments and retvals. And there won't be any confusion
wrt to "oh, the native version takes different args". This was my main
intent wrt the native_cpuid_<reg>() versions - to be consistent with the
cpuid_<reg>() ones.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

  reply	other threads:[~2017-01-10 17:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 11:41 [PATCH 0/5] x86/microcode: More urgent fixes Borislav Petkov
2017-01-09 11:41 ` [PATCH 1/5] x86/CPU: Add native CPUID variants returning a single datum Borislav Petkov
2017-01-09 22:16   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-01-10  0:19     ` hpa
2017-01-10  9:04       ` Borislav Petkov
2017-01-10 16:40         ` hpa
2017-01-10 17:09           ` Borislav Petkov [this message]
2017-01-09 11:41 ` [PATCH 2/5] x86/microcode: Use native CPUID to tickle out microcode revision Borislav Petkov
2017-01-09 22:16   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-01-09 11:41 ` [PATCH 3/5] x86/microcode/intel: Add a helper which gives the " Borislav Petkov
2017-01-09 22:17   ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2017-01-09 11:41 ` [PATCH 4/5] x86/microcode/intel: Fix allocation size of struct ucode_patch Borislav Petkov
2017-01-09 11:41 ` [PATCH 5/5] x86/microcode/intel: Use correct buffer size for saving microcode data Borislav Petkov

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=20170110170936.uvdgvfqr5j5c4ntu@pd.tnic \
    --to=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tipbot@zytor.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 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 NNTP newsgroup(s).