linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <andi@firstfloor.org>,
	peterz@infradead.org, x86@kernel.org, eranian@google.com,
	kan.liang@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions
Date: Fri, 19 Oct 2018 16:47:43 -0700	[thread overview]
Message-ID: <20181019234743.GA27951@tassilo.jf.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1810171151010.6000@nanos.tec.linutronix.de>

> > +	u32 min_ucode;
> > +};
> > +
> > +const struct x86_ucode_id *x86_match_ucode(const struct x86_ucode_id *match)
> 
> What's the point of returning the struct pointer? Shouldn't it be enough to
> make it return bool? Also the function name really should reflect that this
> checks whether the minimal required microcode revision is active.

This allows the user to find the table entry to tie something to it
(e.g. use the index to match some other table)

Same pattern as pci discovery etc. use.

Given the current caller doesn't need it, but we still follow standard
conventions.

> 
> > +{
> > +	struct cpuinfo_x86 *c = &boot_cpu_data;
> > +	const struct x86_ucode_id *m;
> > +
> > +	for (m = match; m->vendor | m->family | m->model; m++) {
> 
> VENDOR_INTEL = 0, so this check is obscure to begin with. Either you chose
> a explicit condition to put at the end of the table, e.g. vendor = U8_MAX
> or you hand in the array size to the function.

That would both be awkward. It's the same as match_cpu, and 0 terminators
are standard practice in practical all similar code. I removed
the or with the family.

-Andi

  reply	other threads:[~2018-10-19 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 16:26 [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions Andi Kleen
2018-10-10 16:26 ` [PATCH v2 2/2] perf/x86/kvm: Avoid unnecessary work in guest filtering Andi Kleen
2018-10-10 16:37 ` [PATCH v2 1/2] x86/cpufeature: Add facility to match microcode revisions Borislav Petkov
2018-10-11 11:43 ` Henrique de Moraes Holschuh
2018-10-17  9:59 ` Thomas Gleixner
2018-10-19 23:47   ` Andi Kleen [this message]
2018-10-20  8:19     ` Thomas Gleixner
2018-10-20 14:38       ` Andi Kleen
2018-10-21 10:20         ` Thomas Gleixner
2018-10-21 15:13           ` Borislav Petkov
2018-10-25 23:23           ` Andi Kleen

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=20181019234743.GA27951@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).