Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754643AbcLaLJt (ORCPT ); Sat, 31 Dec 2016 06:09:49 -0500 Received: from mail.skyhub.de ([78.46.96.112]:46481 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752481AbcLaLJs (ORCPT ); Sat, 31 Dec 2016 06:09:48 -0500 Date: Sat, 31 Dec 2016 12:09:46 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: Junichi Nomura , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" Subject: Re: [PATCH 1/2] x86/CPU: Add native CPUID variants returning a single datum Message-ID: <20161231110946.GA4789@nazgul.tnic> References: <2f771739-a617-0870-2f68-2a8ebba0bc46@ce.jp.nec.com> <20161228111830.GA21788@nazgul.tnic> <20161228112023.GB21788@nazgul.tnic> <20161229093012.GA11221@nazgul.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 624 Lines: 23 On Fri, Dec 30, 2016 at 06:13:24PM -0800, Andy Lutomirski wrote: > Now you call it and ignore the return value and the compiler optimizes > it out :) Does it, really? It is an inlined asm volatile. I checked all call sites and the CPUID call is there. gcc 6 simply issues the CPUID and then later code overwrites rAX. I.e., it looks ok to me. Or what example scenario do you have in mind? > Also, someone reading the code might scratch their head and > wonder why you picked eax and not ebx, ecx, or edx. We have comments for her/him :-) -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --