Re: [PATCH] arc: perf: Enable generic "cache-references" and "cache-misses" events

2016-09-01 Thread Peter Zijlstra
On Wed, Aug 31, 2016 at 12:05:14PM -0700, Vineet Gupta wrote:
> On 08/26/2016 10:31 AM, Vineet Gupta wrote:
> > On 08/25/2016 04:49 AM, Alexey Brodkin wrote:
> >> ...
> >>[PERF_COUNT_ARC_EDTLB] = "edtlb",   /* D-TLB Miss */
> >>[PERF_COUNT_ARC_EITLB] = "eitlb",   /* I-TLB Miss */
> >> +
> >> +  [PERF_COUNT_HW_CACHE_REFERENCES] = "imemrdc",   /* Instr: mem read 
> >> cached */
> >> +  [PERF_COUNT_HW_CACHE_MISSES] = "dclm",  /* D-cache Load Miss */
> > I think this is duplicating a mistake we already have. I vaguely remember 
> > when
> > doing some hackbench profiling last year with range based profiling 
> > confined to
> > memset routine and saw that L1-dcache-misses was counting zero. This is 
> > because it
> > only counts LD misses while memset only does ST.
> >
> > Performance counter stats for '/sbin/hackbench':
> >
> >  0 L1-dcache-misses
> >  0 L1-dcache-load-misses
> >  1846082 L1-dcache-store-misses
> >
> >
> > @PeterZ do you concur that is wrong and we ought to setup 2 counters to do 
> > this
> > correctly ?
> 
> Hi Peter / Will,
> 
> Can you provide some guidance here. So I looked at what others do -
> ARMV7_PERFCTR_L1_DCACHE_REFILL counts both load and store misses, while ARC 
> has 2
> separate conditions for load or stores. Is there an existing mechanism to 
> "group"
> / "add" them to give a cumulative PERF_COUNT_HW_CACHE_MISSES 

Nope. So I would not try and use these generic events. In other news, it
seems like there's finally some progress on the JSON patches:

  https://lkml.kernel.org/r/20160831114254.GA9001@krava

Which would make using non-standard events easier.

> - is that what perf event grouping is ?

Again, nope. Perf event groups are single counter (so no implicit
addition) that are co-scheduled on the PMU.

> Quoting from perf wiki @ https://perf.wiki.kernel.org/index.php/Tutorial
> 
> "It can be interesting to try and pack events in a way that guarantees that 
> event
> A and B are always measured together. Although the perf_events kernel 
> interface
> provides support for event grouping, the current perf tool does *not*."

That seems out-dated, Jiri added grouping support to perf-tool quite a
while back.

You can do it like:

perf stat -e '{cycles,instructions}'

Which will place the cycles event and the instructions event in a group
and thereby guarantee they're co-scheduled.



___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/9] constify uart_ops structures

2016-09-01 Thread Julia Lawall
Constify uart_ops structures.

---

 drivers/tty/serial/altera_jtaguart.c |2 +-
 drivers/tty/serial/altera_uart.c |2 +-
 drivers/tty/serial/arc_uart.c|2 +-
 drivers/tty/serial/atmel_serial.c|2 +-
 drivers/tty/serial/bcm63xx_uart.c|2 +-
 drivers/tty/serial/fsl_lpuart.c  |4 ++--
 drivers/tty/serial/imx.c |2 +-
 drivers/tty/serial/jsm/jsm_tty.c |2 +-
 drivers/tty/serial/max3100.c |2 +-
 drivers/tty/serial/men_z135_uart.c   |2 +-
 drivers/tty/serial/mxs-auart.c   |2 +-
 drivers/tty/serial/pch_uart.c|2 +-
 drivers/tty/serial/sh-sci.c  |2 +-
 drivers/tty/serial/st-asc.c  |2 +-
 drivers/tty/serial/timbuart.c|2 +-
 drivers/tty/serial/uartlite.c|2 +-
 drivers/tty/serial/xilinx_uartps.c   |2 +-
 17 files changed, 18 insertions(+), 18 deletions(-)

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 9/9] serial/arc: constify uart_ops structures

2016-09-01 Thread Julia Lawall
Check for uart_ops structures that are only stored in the ops field of a
uart_port structure.  This field is declared const, so uart_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// 
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct uart_ops i@p = { ... };

@ok@
identifier r.i;
struct uart_port e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct uart_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct uart_ops i = { ... };
// 

Signed-off-by: Julia Lawall 

---
 drivers/tty/serial/arc_uart.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 3a1de5c..5ac06fc 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -464,7 +464,7 @@ static int arc_serial_poll_getchar(struct uart_port *port)
 }
 #endif
 
-static struct uart_ops arc_serial_pops = {
+static const struct uart_ops arc_serial_pops = {
.tx_empty   = arc_serial_tx_empty,
.set_mctrl  = arc_serial_set_mctrl,
.get_mctrl  = arc_serial_get_mctrl,


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] perf tools: Fix static building

2016-09-01 Thread Vineet Gupta
On 08/31/2016 12:21 AM, Jiri Olsa wrote:
> On Mon, Aug 22, 2016 at 08:33:42PM +0300, Alexey Brodkin wrote:
>> With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
>> used by traceevent plugins") we started to add "--dynamic-list" in
>> LDFLAGS. One side-effect of that was inability to build really
>> statically-linked perf.
> 
> IIRC --dynamic-list forces perf to exports some symbols to
> be used by plugins.. don't see this breaking static build
> 
> also it's working properly for me:
> 
> [jolsa@krava perf]$ make LDFLAGS=-static
> ...
> [jolsa@krava perf]$ ldd ./perf
> not a dynamic executable
> 
> unless I miss what you mean by 'really statically-linked' ;-)

Right - so I tried this as well and indeed I can confirm that it builds for me 
as
static. Atleast the build system doesn;t need changing as -sattic being 
propagated
to fianl link cmd.

There seems to be some weirdness with ARC tools: file reports

| ELF 32-bit LSB executable, *unknown arch 0xc3* version 1 (SYSV),
| dynamically linked, interpreter *empty*, for GNU/Linux 3.9.0, not stripped


That is clearly wrong !

And the static binary as expected doesn't seem to run on target - exits with 
-EACCESS.

-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 9/9] serial/arc: constify uart_ops structures

2016-09-01 Thread Vineet Gupta
On 09/01/2016 10:51 AM, Julia Lawall wrote:
> Check for uart_ops structures that are only stored in the ops field of a
> uart_port structure.  This field is declared const, so uart_ops structures
> that have this property can be declared as const also.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // 
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct uart_ops i@p = { ... };
> 
> @ok@
> identifier r.i;
> struct uart_port e;
> position p;
> @@
> e.ops = &i@p;
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct uart_ops e;
> @@
> e@i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct uart_ops i = { ... };
> // 
> 
> Signed-off-by: Julia Lawall 

Acked-by: Vineet Gupta 

Thx for making it better Julia !
-Vineet

> 
> ---
>  drivers/tty/serial/arc_uart.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
> index 3a1de5c..5ac06fc 100644
> --- a/drivers/tty/serial/arc_uart.c
> +++ b/drivers/tty/serial/arc_uart.c
> @@ -464,7 +464,7 @@ static int arc_serial_poll_getchar(struct uart_port *port)
>  }
>  #endif
>  
> -static struct uart_ops arc_serial_pops = {
> +static const struct uart_ops arc_serial_pops = {
>   .tx_empty   = arc_serial_tx_empty,
>   .set_mctrl  = arc_serial_set_mctrl,
>   .get_mctrl  = arc_serial_get_mctrl,
> 


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc