From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPzEu-0005Jh-FL for qemu-devel@nongnu.org; Fri, 27 May 2011 11:46:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPzEt-0002X6-Jl for qemu-devel@nongnu.org; Fri, 27 May 2011 11:46:16 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:58204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPzEt-0002WK-BH for qemu-devel@nongnu.org; Fri, 27 May 2011 11:46:15 -0400 Date: Fri, 27 May 2011 08:46:09 -0700 From: Josh Triplett Message-ID: <20110527154609.GD10016@leaf> References: <20110526090804.GA32647@leaf> <59EA76FC-950D-4397-962C-338CBAE71E33@suse.de> <20110527151330.GA10016@leaf> <6EDC8540-BB72-4016-9680-23121D614084@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6EDC8540-BB72-4016-9680-23121D614084@suse.de> Subject: Re: [Qemu-devel] [PATCH] target-i386: GPF on invalid MSRs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: qemu-devel@nongnu.org On Fri, May 27, 2011 at 05:16:56PM +0200, Alexander Graf wrote: > > On 27.05.2011, at 17:13, Josh Triplett wrote: > > > On Thu, May 26, 2011 at 11:12:12AM +0200, Alexander Graf wrote: > >> On 26.05.2011, at 11:08, Josh Triplett wrote: > >>> qemu currently returns 0 for rdmsr on invalid MSRs, and ignores wrmsr on > >>> invalid MSRs. Real x86 processors GPF on invalid MSRs, which allows > >>> software to detect unavailable MSRs. Emulate this behavior correctly in > >>> qemu. > >>> > >>> Bug discovered via the BIOS Implementation Test Suite > >>> ; fix tested the same way, for both 32-bit and > >>> 64-bit x86. > >> > >> This would break a _lot_ of guests that work just fine today, as qemu doesn't handle all the necessary MSRs. > > > > It also fixes guests that rely on the GPF to indicate the absence of an > > MSR, and assume that the lack of GPF means the availability of that MSR. > > Silently returning 0 for unknown MSRs means silent breakage. > > It's not about guests triggereing MSRs that they shouldn't. It's that qemu doesn't implement all MSRs that all the respective CPUs implement. > > > What (buggy) guests expect to use random model-specific registers > > without either handling GPFs or checking the CPU model first? > > Mac OS X for example :). It even breaks on KVM today due to MSR checks. Ah, of course, since they only run on their own hardware. Fair enough. > > What MSRs do those guests expect that qemu doesn't currently implement? > > > > If this represents a workaround for buggy guests, then may I add an > > option to control this behavior? > > I'm not against this change per-se, but it should definitely have an option to disable/enable it and you need to do very extensive testing to make sure that all MSRs for most OSs are actually handled. Fair enough. Expect PATCHv2 with an option in the near future. - Josh Triplett