WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH v3] VPMU issue on Nehalem cpus

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH v3] VPMU issue on Nehalem cpus
From: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>
Date: Mon, 22 Nov 2010 10:59:44 +0100
Cc: "Shan, Haitao" <haitao.shan@xxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Mon, 22 Nov 2010 02:01:43 -0800
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=dietmar.hahn@xxxxxxxxxxxxxx; q=dns/txt; s=s1536b; t=1290419988; x=1321955988; h=from:to:subject:date:cc:references:in-reply-to: mime-version:message-id; z=From:=20Dietmar=20Hahn=20<dietmar.hahn@xxxxxxxxxxxxxx> |To:=20xen-devel@xxxxxxxxxxxxxxxxxxx|Subject:=20Re:=20[Xe n-devel]=20[PATCH=20v3]=20VPMU=20issue=20on=20Nehalem=20c pus|Date:=20Mon,=2022=20Nov=202010=2010:59:44=20+0100|Cc: =20"Shan,=20Haitao"=20<haitao.shan@xxxxxxxxx>,=0D=0A=20Ja n=20Beulich=20<JBeulich@xxxxxxxxxx>|References:=20<201011 221043.22815.dietmar.hahn@xxxxxxxxxxxxxx>|In-Reply-To:=20 <201011221043.22815.dietmar.hahn@xxxxxxxxxxxxxx> |MIME-Version:=201.0|Message-Id:=20<201011221059.44801.di etmar.hahn@xxxxxxxxxxxxxx>; bh=eAYvE7bD1EmeLC6ez+pIoCQDmfslQiZbg4ip+a9r5Fw=; b=EMy/cxuG/Xt4VEGkwyuIsgM90EAET1RghZwicIeq12fuClKxM+7/hu3J jQtnLX1OfQ/ugv5DbplXuAX+QTYsdWbOKCkd1Riiyv8BG6aqkgmOVC+HQ HstHN04DcDNjT3xj/CyRvGLQZriOr4gX5gJ7CPsOb9n70mG9tdIA+yv/R gX9n6iayYrIHI6iIEz0mBxIzSTg+20F/PRNSsjDY0OyStHOYLDbszL+tY HvS5RNEANAsINFZz2MzcH6dMANvCP;
Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:From:To:Subject:Date:User-Agent:Cc: References:In-Reply-To:X-KMail-Markup:MIME-Version: Content-Type:Message-Id; b=jAojCcILOFl+gCAysrCQyHauAuxuuciwHnJSH5CigY+zB44FRcoNwC5E 5HzYes/joOSxgOCz3UE7XhJeBVX0/RdR9Ui9P+owD8IQGyokHjSuDeQfE BlSzJpaUfLvI/axQJ57SivVGQNqOiMMujkRhPYYuYGO3BF+0O29xcqpKB WU2lUnzXirY1ciSTVdUH4q9vWcKWc+ApiBBmmfYLN8EAmifo6VmL41bYr e/+DZK8PEOLPkYhLub/MPlReMl5VM;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <201011221043.22815.dietmar.hahn@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <201011221043.22815.dietmar.hahn@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.13.5 (Linux/2.6.34.7-0.5-xen; KDE/4.5.3; x86_64; ; )

Hi,

third version, forgot the "bool_t __read_mostly" :-(

Sorry!

Dietmar.

Fix an issue on Nehalem cpus where performance counter overflows may lead to

endless interrupt loops on this cpu.

Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>

diff -r 117d82dcd6ba -r fd44750b3134 xen/arch/x86/hvm/vmx/vpmu_core2.c

--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Fri Nov 19 18:55:18 2010 +0000

+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Nov 22 10:56:08 2010 +0100

@@ -36,6 +36,68 @@

#include <asm/hvm/vpmu.h>

#include <asm/hvm/vmx/vpmu_core2.h>

+/*

+ * QUIRK to workaround an issue on Nehalem processors currently seen

+ * on family 6 cpus E5520 (model 26) and X7542 (model 46).

+ * The issue leads to endless PMC interrupt loops on the processor.

+ * If the interrupt handler is running and a pmc reaches the value 0, this

+ * value remains forever and it triggers immediately a new interrupt after

+ * finishing the handler.

+ * A workaround is to read all flagged counters and if the value is 0 write

+ * 1 (or another value != 0) into it.

+ * There exist no errata and the real cause of this behaviour is unknown.

+ */

+bool_t __read_mostly is_pmc_quirk;

+

+static void check_pmc_quirk(void)

+{

+ u8 family = current_cpu_data.x86;

+ u8 cpu_model = current_cpu_data.x86_model;

+ is_pmc_quirk = 0;

+ if ( family == 6 )

+ {

+ if ( cpu_model == 46 || cpu_model == 26 )

+ is_pmc_quirk = 1;

+ }

+}

+

+static int core2_get_pmc_count(void);

+static void handle_pmc_quirk(u64 msr_content)

+{

+ int num_gen_pmc = core2_get_pmc_count();

+ int num_fix_pmc = 3;

+ int i;

+ u64 val;

+

+ if ( !is_pmc_quirk )

+ return;

+

+ val = msr_content;

+ for ( i = 0; i < num_gen_pmc; i++ )

+ {

+ if ( val & 0x1 )

+ {

+ u64 cnt;

+ rdmsrl(MSR_P6_PERFCTR0 + i, cnt);

+ if ( cnt == 0 )

+ wrmsrl(MSR_P6_PERFCTR0 + i, 1);

+ }

+ val >>= 1;

+ }

+ val = msr_content >> 32;

+ for ( i = 0; i < num_fix_pmc; i++ )

+ {

+ if ( val & 0x1 )

+ {

+ u64 cnt;

+ rdmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, cnt);

+ if ( cnt == 0 )

+ wrmsrl(MSR_CORE_PERF_FIXED_CTR0 + i, 1);

+ }

+ val >>= 1;

+ }

+}

+

u32 core2_counters_msr[] = {

MSR_CORE_PERF_FIXED_CTR0,

MSR_CORE_PERF_FIXED_CTR1,

@@ -494,6 +556,10 @@

rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, msr_content);

if ( !msr_content )

return 0;

+

+ if ( is_pmc_quirk )

+ handle_pmc_quirk(msr_content);

+

core2_vpmu_cxt->global_ovf_status |= msr_content;

msr_content = 0xC000000700000000 | ((1 << core2_get_pmc_count()) - 1);

wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, msr_content);

@@ -515,6 +581,7 @@

static void core2_vpmu_initialise(struct vcpu *v)

{

+ check_pmc_quirk();

}

static void core2_vpmu_destroy(struct vcpu *v)

--

Company details: http://ts.fujitsu.com/imprint.html

Attachment: vpmu_pmc_quirk-v3.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>