From owner-freebsd-current@FreeBSD.ORG Fri Oct 12 22:54:55 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B5C70B4B; Fri, 12 Oct 2012 22:54:55 +0000 (UTC) (envelope-from hiren.panchasara@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0C73D8FC08; Fri, 12 Oct 2012 22:54:54 +0000 (UTC) Received: by mail-bk0-f54.google.com with SMTP id jf20so1715278bkc.13 for ; Fri, 12 Oct 2012 15:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZT6sQjhVAdHExetF4qnlkEd62oBuER3LKsBuXjQbqSo=; b=MHdiA2UyFG+JFo7NeuXzxEaHC+RMW7NM+SS2Htc2LN0OJtMUr1Oc+UTBBDOvTetImu mixNQlp79StZIQvRYANOB2DQcwWPlh3g2Mh3m7ZOnL3rx8wFrWMxpSHhg0cU7XM9QPxF snx+qzb1nNChUiXqwS2jmWoFR/NzkXwuSFqco9VhyCeb9ceU43xN/K5SXvyXoSr8Jcpc Dov0Sz2CJns1oqe01430VwvLs/VHYSCNZ4Q9k984P7iVwWGXxTv0NNwmgdYyfyfFh9rQ tbeRlgAWnysfEVpbUNQSLTNOY5KUSH5OSf5Q4eB+/kDPeqvOFKG0FRqKYBcrE4dMGW+q 66uw== MIME-Version: 1.0 Received: by 10.204.151.9 with SMTP id a9mr1651870bkw.2.1350082493739; Fri, 12 Oct 2012 15:54:53 -0700 (PDT) Received: by 10.205.36.136 with HTTP; Fri, 12 Oct 2012 15:54:53 -0700 (PDT) In-Reply-To: References: <1349390777.5234.9.camel@powernoodle.corp.yahoo.com> Date: Fri, 12 Oct 2012 15:54:53 -0700 Message-ID: Subject: Re: [CFT]hwpmc update for sandybridge-e From: hiren panchasara To: Fabien Thomas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-current , Davide Italiano X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2012 22:54:55 -0000 On Fri, Oct 5, 2012 at 1:05 AM, Fabien Thomas wro= te: > > Le 5 oct. 2012 =C3=A0 10:00, Fabien Thomas a =C3=A9crit : > > > > > Le 5 oct. 2012 =C3=A0 00:46, Sean Bruno a =C3=A9crit : > > > >> So, I did the bear minimum and kind of hacked things together without > >> understanding precisely what I was doing, and I was able to massage th= e > >> sandybridge-e CPUs into giving me some basic functions. > >> > >> Comments or concerns before I commit this? > >> > >> http://people.freebsd.org/~sbruno/pmc_sandybridge.txt > > > > Hi Sean, > > > > The only modification required is this one > > http://svnweb.freebsd.org/base?view=3Drevision&revision=3D237196 > > > > but davide@ removed it for a problem that need to be looked at. > > Looking at the doc this CPU require a full set of PMC as the list of even= t > are different. > So this mean full manpage, full event list, =E2=80=A6 > > Doc: > " > The events in Table 19-3 apply to > processors with CPUID signature of DisplayFamily_DisplayModel encoding > with the > following values: 06_2AH and 06_2DH. The events in Table 19-4 apply to > processors > with CPUID signature 06_2AH. The events in Table 19-5 apply to processors > with > CPUID signature 06_2DH. > " > > Required change will be the same as this commit if you want to look at it= : > http://svnweb.freebsd.org/base?view=3Drevision&revision=3D240164 > Hi All, With help of Sean, I've prepared another semi-working patch: http://www.strugglingcoder.info/patches/hwpmc_sbx_1.txt I still haven't written the man page. I wanted to get some feedback (bashing/yelling) before spending more time on this. I am not quite sure how to handle uncore events. I've put ugly hack to avoid wrmsr/rdmsr for this particular set of processors. I bet there are better ways to handle this situation. (in hwpmc_uncore.c) Here is the o/p of "pmccontrol -L": http://www.strugglingcoder.info/patches/pmccontrol_1.txt I've run the pmctest.py script (by gnn): http://www.strugglingcoder.info/patches/pmctestpy_1.txt I am seeing "invalid argument" for some events. I've tried to check pmc_events.h to see that those events are listed. Not sure what else I should check. I've also tried to follow the commands Fabien listed for testing on http://freebsd.1045724.n5.nabble.com/CFT-hwpmc-support-for-Intel-Ivy-Bridge= -tp5740299p5740577.html I am getting panic on following: - Soft counter: pmcstat -SPAGE_FAULT.ALL -w4 -T panic details: -bash-4.2$ panic: userret: Returning with with pinned thread cpuid =3D 22 KDB: enter: panic [ thread pid 4084 tid 100302 ] Stopped at kdb_enter+0x3b: movq $0,0xa74122(%rip) db> bt Tracing pid 4084 tid 100302 td 0xfffffe0016dbc000 kdb_enter() at kdb_enter+0x3b panic() at panic+0x1d1 userret() at userret+0x15c trap() at trap+0x200 calltrap() at calltrap+0x8 --- trap 0xc, rip =3D 0x8013d86a0, rsp =3D 0x7fffffffd4b0, rbp =3D 0x801800= b98 --- db> show pcpu cpuid =3D 22 dynamic pcpu =3D 0xffffff807f000280 curthread =3D 0xfffffe0016dbc000: pid 4084 "pmcstat" curpcb =3D 0xffffff86be955b80 fpcurthread =3D 0xfffffe0016dbc000: pid 4084 "pmcstat" idlethread =3D 0xfffffe000a510000: tid 100025 "idle: cpu22" curpmap =3D 0xfffffe00160f6be8 tssp =3D 0xffffffff81531970 commontssp =3D 0xffffffff81531970 rsp0 =3D 0xffffff86be955b80 gs32p =3D 0xffffffff8152faa8 ldt =3D 0xffffffff8152fae8 tss =3D 0xffffffff8152fad8 spin locks held: db> show registers cs 0x20 ds 0x3b es 0x3b003b fs 0x1b0013 gs 0x1b ss 0 rax 0x12 rcx 0x1fc rdx 0 rbx 0xffffffff80ec14ea __func__.3526+0x1c2 rsp 0xffffff86be955770 rbp 0xffffff86be955790 rsi 0x80 rdi 0xffffff86be9555f0 r8 0 r9 0xffffff86be9556a0 r10 0x700 r11 0xffffffff812c2900 txtrndrsw r12 0 r13 0xfffffe0016dbc000 r14 0xffffff86be955ac0 r15 0xc rip 0xffffffff80901f1b kdb_enter+0x3b rflags 0x86 kdb_enter+0x3b: movq $0,0xa74122(%rip) db> Please let me know if anything else I can provide. Thanks a ton, Hiren p.s. I don't know how computers work.