From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815AbYIQOET (ORCPT ); Wed, 17 Sep 2008 10:04:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752068AbYIQOEK (ORCPT ); Wed, 17 Sep 2008 10:04:10 -0400 Received: from ti-out-0910.google.com ([209.85.142.190]:30425 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875AbYIQOEI (ORCPT ); Wed, 17 Sep 2008 10:04:08 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=tc7kPClJetrJkP76cFjZ4mtEMosNdJ0rW76D4CSxmhseTGkQaGai/L385JkkjIvKFG UgFXREVjtyduct15KVdif5OZSVUdpOIReGgd+rrqNM3ltFJ27NbF4/aXRiA5PAMlYf93 9SLgMkyUBHRrOSWOcd4BOnY9hWZOzZgn0AqFg= Date: Wed, 17 Sep 2008 22:03:57 +0800 From: Yan Li To: Ingo Molnar Cc: Yan Li , "H. Peter Anvin" , linux-kernel@vger.kernel.org, joerg.roedel@amd.com, rjmaomao@gmail.com, Yinghai Lu , Thomas Gleixner , nancydreaming@gmail.com Subject: Re: [PATCH 1/2] VMware detection support for x86 and x86-64 Message-ID: <20080917140357.GA23523@yantp.cn.ibm.com> References: <20080221115452.GB13948@elte.hu> <20080907234510.GA24133@yantp.cn.ibm.com> <20080908140423.GG11993@elte.hu> <20080909002055.GA8573@yantp.cn.ibm.com> <48C5C47F.5040004@zytor.com> <20080916133239.GA17456@yantp.cn.ibm.com> <20080917105238.GF18764@elte.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080917105238.GF18764@elte.hu> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 17, 2008 at 12:52:38PM +0200, Ingo Molnar wrote: > > This code is from mtrr_trim_uncached_memory(), and used by > > setup_arch(), which is used far before PCI is ready. > > > > Therefore I think we can only use DMI here. Any idea? > > PCI quirks can be used almost arbitrarily early stage, see: > arch/x86/kernel/early-quirks.c. > > Adding a VM identification callback to early-quirks.c would be fine. But > if there's a reliable and specific enough DMI string that's fine as > well. (but PCI is better, since it's a generally more stable enumeration > interface) The problem here is that mtrr_trim_uncached_memory() is called 108 lines before the invocation of early_quirks(), and 48 lines before that of dmi_scan_machine(). That's quite early. The only thing ran before that is the initialization of CPU, so we have nearly nothing to use to check the fingerprint of the underlying machine. I feel It's also unfit to touch the whole PCI or DMI thing before CPU registers and memory are settled. A simple solution here is to only issue a KERN_INFO when we detected mtrr is empty and later, when we can be sure that the OS is not running as a VM, issue a warning. The later part can be done in early_quirks(). -- Li, Yan