Understanding Invalid Argument Errors

66 views
Skip to first unread message

jcmdev0

unread,
Jul 10, 2009, 8:30:41 PM7/10/09
to PMCTools Discuss
Hello,

I csuped to RELENG_7 last night to get Intel Core support for pmc.
I am trying to get statistics on L2 Cache evictions but I have been
having trouble with the L2_Lines_Out event-spec. This seems to be the
right event according to the Intel Software Developer's Manual (3B,
Part 2, Table A-4) for the processor in question (Xeon 5150).

I get similar EINVAL results calling pmc_allocate from my own program.

# pmcstat -s L2_Lines_Out
pmcstat: ERROR: Cannot allocate system-mode pmc with specification
"L2_Lines_Out": Invalid argument

Have I forgotten something?

The following L2* event specs listed under pmccontrol -L do not error
out: L2_LD, L2_LOCK, L2_NO_REQ, L@-RQSTS.SELF.DEMAND.I_STATE,
L2_RQSTS.SELF.DEMAND.MESI. The rest do (L2_ADS, L2_DBUS_BUSY_RD,
L2_IFETCH, L2_LINES_IN, L2_LINES_OUT, L2_REJECT_BUSQ, L2_RQSTS).

The module init print out is:
hwpmc: TSC/1/64/0x20<REA> IAP/
2/40/0x3ff<INT,USR,SYS,EDG,THR,REA,WRI,INV,QUA,PRC> IAF/
0/0/0x61<INT,REA,WRI>

Thanks!
John

Joseph Koshy

unread,
Jul 11, 2009, 3:28:45 AM7/11/09
to pmctools...@googlegroups.com

Does the problem go away with FreeBSD SVN #193809?

Koshy

John McCullough

unread,
Jul 11, 2009, 7:53:19 PM7/11/09
to pmctools...@googlegroups.com
I'm seeing the same problem with the referenced revision.


# pmcstat -s L2_Lines_Out
pmcstat: ERROR: Cannot allocate system-mode pmc with specification "L2_Lines_Out": Invalid argument

# svn info
Path: .
URL: http://svn.freebsd.org/base/head
Repository Root: http://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 193809

Is there anything else i can do to try to help debug the problem?

Thanks,
John

John McCullough

unread,
Jul 17, 2009, 7:43:55 PM7/17/09
to pmctools...@googlegroups.com
So far I've tracked this down to hwpmc_core.c:1396 in iap_allocate_pmc.

When I call pmcstat with L2_Lines_Out, pm_iap_config is set to 0x00 and the != IAP_CORE_ALL && != IAP_CORE_THIS test fails.  If I call it with L2_LD,  pm_iap_config is set to 0xf00.

I'm still reading code and any advice would be appreciated.

-John

John McCullough

unread,
Jul 17, 2009, 10:10:57 PM7/17/09
to pmctools...@googlegroups.com
It turns out that specifying L2_Lines_Out,core=this works.

The pm_iap_config setting for L2_LD was a red herring since the iap_flags doesn't have IAP_M_CORE set (although at least according to the pmc.core manpage, you can specify a core for that event).

It looks like L2_LD is getting its default flags set around libpmc.c:638, but the "this" default specification isn't being set for core-specific CPUs.  I'm attaching a patch that sets the default for "this" on the events listed with "core" parameters from the pmc.{core,core2,atom} manpages.

I haven't done any exhaustive testing, but allocating stand alone L2_Lines_Out counters won't throw EINVAL anymore.

-John
libpmc.diff
Reply all
Reply to author
Forward
0 new messages