[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] xen/pv: allow pmu msr accesses to cause GP


  • To: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, x86@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Mon, 26 Sep 2022 16:09:15 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hRnBlewc2lAS7P5loXEiLEevIB2bbEGGk7sp/0MSKeI=; b=EaLP/HttTQETQOF/dKczsursKRhTkjSKqd7x/euQq/5ABVgZrEai4UudN9qa6BnL+MqbxDKzqcgCT+vewaMTuN1H5rkdWuNfDGAmkMo2o04h2tm90HEQ68j8C7KoZbpr4apDTJgxuFFDwvcWRsbWxHGFt5j9PS9jOpuWD2YO4g4q/hOpZacOqyOBEB2Ib25SebuU0WRasgnsdU6j7dQf+piKOK9euN0gQSZQNy3Vgeb/h6MaEQ2Fww46sH0kAfaRp6W2TCn5z7s0vhtrUG8zfDBIg9uLsoCIYLs8RNYxT9w5qoSHzdtpyzDTym8i/M2Hj18Nlpe6eYVLpfw9UxcbWg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JqLDVqFCOlmTGkfb0rPdETFnx+4XRXSXSxA68i86ElvZjerV6rqeqcjMKuJHx2+9V0S6PLlfcmO4eJ3aw9O1wJ5g8sUGZAPPQ62cnsfjSHARLHLzfeuQ+MwsDUbJe1LWehdo1oaT4giXCv6GUetIniFSD1cSwkDcTOGJq/JFYDAAIkr5yw7jXou/DWZsLvFxM8ogDtKeygYAfksMV0tUmhwuss/Rbav5clodPwW93KdUuMdjAYzGc2w3HA7vkenVCXpsvJKdCI4+gNbOhFLc+Yn7TfkbCZ08QF+v723v8SIcRTCpyKcoYckAZRdycxREHXQcZpf832yY+AtgFkJvjA==
  • Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>
  • Delivery-date: Mon, 26 Sep 2022 20:10:14 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 9/26/22 10:18 AM, Juergen Gross wrote:
  bool pmu_msr_read(unsigned int msr, uint64_t *val, int *err)
  {
        if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) {
-               if (is_amd_pmu_msr(msr)) {
-                       if (!xen_amd_pmu_emulate(msr, val, 1))
-                               *val = native_read_msr_safe(msr, err);
-                       return true;
+               if (!is_amd_pmu_msr(msr))


You should be able to move vendor check inside is_<vendor>_pmu_msr().


-boris


+                       return false;
+               if (!xen_amd_pmu_emulate(msr, val, 1)) {
+                       *val = err ? native_read_msr_safe(msr, err)
+                                  : native_read_msr(msr);
                }
+               return true;
        } else {



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.