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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1449146475-15335-18-git-send-email-vgupta@synopsys.com>
Date:	Thu, 3 Dec 2015 18:11:15 +0530
From:	Vineet Gupta <Vineet.Gupta1@...opsys.com>
To:	<linux-snps-arc@...ts.infradead.org>
CC:	<JBeulich@...e.com>, <Alexey.Brodkin@...opsys.com>,
	<linux-kernel@...r.kernel.org>,
	Vineet Gupta <Vineet.Gupta1@...opsys.com>
Subject: [PATCH 17/17] xxx: instrument

Signed-off-by: Vineet Gupta <vgupta@...opsys.com>
---
 arch/arc/kernel/unwind.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index d5ffb4a78104..91f310465970 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -889,6 +889,19 @@ static int cie_validate(const u32 *cie, struct cie *t_cie)
 	return end - (const u8 *)cie;
 }
 
+#define UNWIND_INSTRUMENT
+
+#ifdef UNWIND_INSTRUMENT
+u32 unw_t_min = 0xffffff, unw_t_max, unw_t_n;
+u64 unw_t_avg;
+
+static unsigned int get_c(void)
+{
+       write_aux_reg(0x600, 0x42);             // ARC_REG_MCIP_CMD
+       return read_aux_reg(0x602);     // ARC_REG_MCIP_READBACK
+}
+#endif
+
 /* Unwind to previous to frame.  Returns 0 if successful, negative
  * number in case of an error. */
 int arc_unwind(struct unwind_frame_info *frame)
@@ -907,7 +920,9 @@ int arc_unwind(struct unwind_frame_info *frame)
 	unsigned long addr;
 	struct eh_frame_header *hdr;
 	int ret = -EINVAL;
-
+#ifdef UNWIND_INSTRUMENT
+	unsigned int t0 = get_c(), t1, delta;
+#endif
 	unw_debug("\nUNWIND FRAME: -------------------------------------\n");
 	unw_debug("PC\t\t: 0x%lx %pS\nr31 [BLINK]\t: 0x%lx %pS\nr28 [SP]\t: 0x%lx\nr27 [FP]\t: 0x%lx\n",
 		  UNW_PC(frame), (void *)UNW_PC(frame),
@@ -1072,6 +1087,15 @@ int arc_unwind(struct unwind_frame_info *frame)
 	ret = 0;
 bad_unw:
 
+#ifdef UNWIND_INSTRUMENT
+	t1 = get_c();
+	delta = t1 - t0;
+	unw_t_min = min(unw_t_min, delta);
+	unw_t_max = max(unw_t_max, delta);
+	unw_t_n++;
+	unw_t_avg += delta;
+	printk("unw %d %s %lx\n", delta, !ret ? "O K":"nok", pc);
+#endif
 	return ret;
 #undef FRAME_REG
 }
-- 
1.9.1

--
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