Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp5750ima; Sat, 20 Oct 2018 01:20:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV62i5zGQJPEVnoGTFzhaZbWZvfcFf1L5CA68tpze+sxHatUAmS9S/p9Ov79jzlBD+99+zx/0 X-Received: by 2002:a63:141:: with SMTP id 62-v6mr34531398pgb.406.1540023638311; Sat, 20 Oct 2018 01:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540023638; cv=none; d=google.com; s=arc-20160816; b=bZ6OXVzya7teKSwgZOSWG9jJtbwXp5Iw+wCoO8ecWoi4/EcAB5weRpfUXwFmUAKkdV aXpUprlvlyYT33s8GfaaAiFo3K871DZ0oUtwBcJ7daugVfzit/YDaxtT7dwo9n7Z5KB1 50DyBNTraK3dubKVJN2Oa8XtOqnj8cN5w81Xx18INoh3ADApoLTXH7T6mm71HFMnC2GG hbFWqv6DFc2KbvUl88vTox+ObmJOX0x8toGnlrFHoum4uaRkXyNk1IvOaOAP8dq4AhEV x4NBHys450VJ9+sloDlHV0T5a3tieFEWOSVlpqm11tElid0WCGsZal8fXqsJ5JiZ35TV YeUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=0aUX2dtci3RbqmZdQD6Sn6Tf9b41rS2iYAGBixfRGrs=; b=Ij2ezjl+ldof1PQnGGQyxGfd5s/ge+VqFGlOLBvXTzcAykSSORGDK+vQVgyxL1FuJ6 oSZ6GPx/zQ8sAIj9OvrPorz+4XWJgHpuAXLEfaX18gqxqq1dsyTrV5cCJihtAAliFgEs qQU0ye5DXC0xgdVYiPWOO3MNBFcFRTEgpsYei8pZJmvtqDBbZiWafp0BuvkW16P/4hnT qKMwIajFb6dB53Ga2XmwuM7gxM+oRa+ynjLugy/rdb4dxl+wnd8h3ssL4H3zuFSJIf/e T1uk6Gc75F103BXN6bfO+MYcSO+3CpDMCouq0cSMs7TBLmMbBoKm56vkR0VNp9CkzWcX wcKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a80-v6si27620950pfj.195.2018.10.20.01.20.20; Sat, 20 Oct 2018 01:20:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbeJTQ3e (ORCPT + 99 others); Sat, 20 Oct 2018 12:29:34 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40556 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726516AbeJTQ3e (ORCPT ); Sat, 20 Oct 2018 12:29:34 -0400 Received: from p5492fe24.dip0.t-ipconnect.de ([84.146.254.36] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gDmTy-0002nZ-Ap; Sat, 20 Oct 2018 10:19:38 +0200 Date: Sat, 20 Oct 2018 10:19:37 +0200 (CEST) From: Thomas Gleixner To: Andi Kleen cc: Andi Kleen , 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 In-Reply-To: <20181019234743.GA27951@tassilo.jf.intel.com> Message-ID: References: <20181010162608.23899-1-andi@firstfloor.org> <20181019234743.GA27951@tassilo.jf.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 19 Oct 2018, Andi Kleen wrote: > > > + 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. There is no point to return the pointer because it's not a compound structure. If you want to provide the possibility to use the index then return the index and an error code if it does not match. > > > > > +{ > > > + 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. That's debatable because it's more easy to miss the terminator than getting the ARRAY_SIZE() argument wrong. But it doesn't matter much. Thanks, tglx