lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y509u02h.fsf@sejong.aot.lge.com>
Date:	Mon, 17 Mar 2014 09:43:18 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	acme@...radead.org, mingo@...nel.org, linux-kernel@...r.kernel.org,
	peterz@...radead.org, eranian@...gle.com, jolsa@...hat.com,
	Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf, tools: Add script to easily decode addresses

Hi Andi,

On Thu, 13 Mar 2014 12:53:58 -0700, Andi Kleen wrote:
> +def MASK(bits):
> +    return (1 << bits) - 1
> +
> +def decode_bits(val, names, bits, shift):
> +    v = (val >> shift) & MASK(bits)
> +    s = ""
> +    for name, index in zip(names, range(0, len(names))):
> +        if v & (1 << index):
> +            s += " " + name
> +    return s
> +
> +#        __u64   mem_op:5,       /* type of opcode */
> +#                mem_lvl:14,     /* memory hierarchy level */
> +#                mem_snoop:5,    /* snoop mode */
> +#                mem_lock:2,     /* lock instr */
> +#                mem_dtlb:7,     /* tlb access */
> +#                mem_rsvd:31;
> +
> +def decode_datasrc(d):
> +    s = ""
> +    s += decode_bits(d, ['', 'LOAD', 'STORE?', 'PREFETCH', 'EXEC'], 5, 0)
> +    s += decode_bits(d, ['', 'HIT', 'MISS', 'L1', 'LFB', 'L2', 'L3',
> +                         'LOC_RAM', 'REM-RAM-1', 'REM-RAM-2', 'REM-CACHE-1'
> +                         'REM-CACHE-2', 'REM-IO', 'REM-UNCACHED'], 14, 5)
> +    s += decode_bits(d, ['', 'NONE', 'MISS', 'HITM'], 19, 5)
> +    s += decode_bits(d, ['', 'LOCKED'], 24, 2)
> +    s += decode_bits(d, ['', 'L1', 'L2', 'WK', 'OS'], 26, 7)

Shouldn't it be like below (bits and shift exchanged)?

	s += decode_bits(d, ['', 'NONE', 'MISS', 'HITM'], 5, 19)
	s += decode_bits(d, ['', 'LOCKED'], 2, 24)
	s += decode_bits(d, ['', 'L1', 'L2', 'WK', 'OS'], 7, 26)

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ