[LTP] [PATCH 2/2] perf_event_open02: make test more reliable on -rt kernels

Jan Stancek jstancek@redhat.com
Wed Oct 16 14:42:40 CEST 2019


----- Original Message -----
> Hi!
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  .../kernel/syscalls/perf_event_open/perf_event_open02.c   | 15
> >  +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> > b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> > index 1cfe29bb3d8a..6fc6f4afa119 100644
> > --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> > +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c
> > @@ -52,6 +52,7 @@ Usage is: ./performance_counter02  [-v]
> >  The -v flag makes it print out the values of each counter.
> >  */
> >  
> > +#define _GNU_SOURCE
> >  #include <stdio.h>
> >  #include <stddef.h>
> >  #include <stdlib.h>
> > @@ -222,6 +223,20 @@ static void setup(void)
> >  	int i;
> >  	struct perf_event_attr tsk_event, hw_event;
> >  
> > +#ifdef HAVE_SCHED_GETCPU
> > +	cpu_set_t mask;
> 
> Don't we have to allocate the mask dynamically so that we do not fail on
> systems with more than CPU_SETSIZE (1024) CPUs?
> 
> We already have fallback macros for older libc in include/lapi/cpuset.h
> so that we can use CPU_ALLOC() unconditionally.

Haven't thought of that. I'll look into adding that for v2.


More information about the ltp mailing list