Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BBBBC433E0 for ; Mon, 11 Jan 2021 07:48:29 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C387229CA for ; Mon, 11 Jan 2021 07:48:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C387229CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.64622.114183 (Exim 4.92) (envelope-from ) id 1kyrw0-0000G4-3W; Mon, 11 Jan 2021 07:48:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 64622.114183; Mon, 11 Jan 2021 07:48:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kyrw0-0000Fx-0O; Mon, 11 Jan 2021 07:48:16 +0000 Received: by outflank-mailman (input) for mailman id 64622; Mon, 11 Jan 2021 07:48:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kyrvz-0000Fs-6Z for xen-devel@lists.xenproject.org; Mon, 11 Jan 2021 07:48:15 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 88db10e6-16d1-4d43-8391-a5cd2e93c4fc; Mon, 11 Jan 2021 07:48:14 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 712DFAD6A; Mon, 11 Jan 2021 07:48:13 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 88db10e6-16d1-4d43-8391-a5cd2e93c4fc X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610351293; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Y/BuqncvOzki/Xc5Tx4EIy60Lr8ieOGJUrp99ZQHzw=; b=JB6tirM1t4znOldObAFlZCulmObqvJxLfEGOtbaGIBjzrWtP35q1q3i4bHwc4P8Xa1epjW VF5Hlq0b89+UubyxtnOld0q17rv8HAhghJY8yuvyUT88deayrPwvqiGawJo32GUCQfhklw TIU43zTnWXWolmvS4wLVNYeutR6R3Ts= Subject: Re: [PATCH 3/4] x86: Allow non-faulting accesses to non-emulated MSRs if policy permits this To: boris.ostrovsky@oracle.com Cc: iwj@xenproject.org, wl@xen.org, anthony.perard@citrix.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, jun.nakajima@intel.com, kevin.tian@intel.com, xen-devel@lists.xenproject.org References: <1610051698-23675-1-git-send-email-boris.ostrovsky@oracle.com> <1610051698-23675-4-git-send-email-boris.ostrovsky@oracle.com> <0e5c0b85-5e3c-676c-e402-fa06e09cf5cb@suse.com> From: Jan Beulich Message-ID: <9896a1af-e4cc-b171-f7a9-e6b74976770c@suse.com> Date: Mon, 11 Jan 2021 08:48:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 08.01.2021 21:39, boris.ostrovsky@oracle.com wrote: > On 1/8/21 10:18 AM, Jan Beulich wrote: >> On 07.01.2021 21:34, Boris Ostrovsky wrote: >>> Starting with commit 84e848fd7a16 ("x86/hvm: disallow access to unknown MSRs") >>> accesses to unhandled MSRs result in #GP sent to the guest. This caused a >>> regression for Solaris who tries to acccess MSR_RAPL_POWER_UNIT and (unlike, >> Nit: One c too many. >> >>> for example, Linux) does not catch exceptions when accessing MSRs that >>> potentially may not be present. >> Just to re-raise the question raised by Andrew already earlier >> on: Has Solaris been fixed in the meantime, or is this at least >> firmly planned to happen? > > I was told they will open a bug. "Will", not "did"? >> @@ -3319,10 +3319,8 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content) >> is_last_branch_msr(msr) ) >> break; >> >> - gdprintk(XENLOG_WARNING, >> - "WRMSR 0x%08x val 0x%016"PRIx64" unimplemented\n", >> - msr, msr_content); >> - goto gp_fault; >> + if ( guest_unhandled_msr(v, msr, &msr_content, true) ) >> + goto gp_fault; >> } >> >> return X86EMUL_OKAY; >> These functions also get used from the insn emulator, when it >> needs to fetch an MSR value (not necessarily in the context of >> emulating RDMSR or WRMSR). I wonder whether applying this >> behavior in that case is actually correct. It would only be if >> we would settle on it being a requirement that any such MSRs >> have to have emulation present in one of the handlers. > > > Hmm.. Yes, I did not consider this. I am not convinced this will > always result in correct behavior for the emulator so I will > need to pass down a parameter. Unless there is a way to figure > out whether we are running in the emulator (which I don't > immediately see) Passing a parameter for this is sort of ugly, but I presume unavoidable. The more that what you need to know is not "running in emulator", but "guest RDMSR/WRMSR" - this can also happen through the emulator. Jan