Re: [PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-09-02 Thread John Garry

On 01/09/2020 06:56, kajoljain wrote:

+#define min(x, y) ({    \
+    typeof(x) _min1 = (x);    \
+    typeof(y) _min2 = (y);    \
+    (void)(&_min1 == &_min2);    \
+    _min1 < _min2 ? _min1 : _min2; })
+#endif

Wondering what is special about this definition of min that it's required? 
Compiled ok for me without it.

Hi John,
  You are right, for me also in power it compiled without any issues, but 
not sure if somewhere we have dependency,
that's why I didn't remove it.


If it builds for x86, then that's main thing ;) But seriously, Arnaldo 
has lots of bots to test builds also.


BTW, I got this from your patchset:

pmu-events/jevents.c:98:29: warning: no previous prototype for 
‘get_cpu_str’ [-Wmissing-prototypes]

__attribute__((weak)) char *get_cpu_str(void)
^~~
pmu-events/jevents.c:529:5: warning: no previous prototype for 
‘json_events’ [-Wmissing-prototypes]

int json_events(const char *fn,
^~~

But I think that you will remove this.

Finally, generated pmu-events.c looks ok for arm64, which I am 
interested in.


Thanks,
John


Re: [PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-08-31 Thread kajoljain



On 8/31/20 2:31 PM, John Garry wrote:
> On 31/08/2020 09:43, Jiri Olsa wrote:
>> On Thu, Aug 27, 2020 at 06:39:54PM +0530, Kajol Jain wrote:
>>> This patch removes jevents.h file and add its data inside
>>> jevents.c as this file is only included there.
>>>
>>> Signed-off-by: Kajol Jain 
>>> ---
>>>   tools/perf/pmu-events/jevents.c |  9 -
>>>   tools/perf/pmu-events/jevents.h | 23 ---
>>>   2 files changed, 8 insertions(+), 24 deletions(-)
>>>   delete mode 100644 tools/perf/pmu-events/jevents.h
>>>
>>> diff --git a/tools/perf/pmu-events/jevents.c 
>>> b/tools/perf/pmu-events/jevents.c
>>> index fa86c5f997cc..1c55cc754b5a 100644
>>> --- a/tools/perf/pmu-events/jevents.c
>>> +++ b/tools/perf/pmu-events/jevents.c
>>> @@ -48,11 +48,18 @@
>>>   #include 
>>>   #include "jsmn.h"
>>>   #include "json.h"
>>> -#include "jevents.h"
>>>     int verbose;
>>>   char *prog;
>>>   +#ifndef min
>>> +#define min(x, y) ({    \
>>> +    typeof(x) _min1 = (x);    \
>>> +    typeof(y) _min2 = (y);    \
>>> +    (void)(&_min1 == &_min2);    \
>>> +    _min1 < _min2 ? _min1 : _min2; })
>>> +#endif
> 
> Wondering what is special about this definition of min that it's required? 
> Compiled ok for me without it.

Hi John,
 You are right, for me also in power it compiled without any issues, but 
not sure if somewhere we have dependency,
that's why I didn't remove it. 

Thanks,
Kajol Jain
> 
>>> +
>>>   int eprintf(int level, int var, const char *fmt, ...)
>>>   {
>>>   diff --git a/tools/perf/pmu-events/jevents.h 
>>> b/tools/perf/pmu-events/jevents.h
>>> deleted file mode 100644
>>> index 2afc8304529e..
>>> --- a/tools/perf/pmu-events/jevents.h
>>> +++ /dev/null
>>> @@ -1,23 +0,0 @@
>>> -/* SPDX-License-Identifier: GPL-2.0 */
>>> -#ifndef JEVENTS_H
>>> -#define JEVENTS_H 1
>>> -
>>> -int json_events(const char *fn,
>>> -    int (*func)(void *data, char *name, char *event, char *desc,
>>> -    char *long_desc,
>>> -    char *pmu,
>>> -    char *unit, char *perpkg, char *metric_expr,
>>> -    char *metric_name, char *metric_group,
>>> -    char *deprecated, char *metric_constraint),
>>> -    void *data);
>>> -char *get_cpu_str(void);
>>
>> I think you can also remove get_cpu_str from jevents.c
>>
>> thanks,
>> jirka
>>
>> .
>>
> 


Re: [PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-08-31 Thread kajoljain



On 8/31/20 2:13 PM, Jiri Olsa wrote:
> On Thu, Aug 27, 2020 at 06:39:54PM +0530, Kajol Jain wrote:
>> This patch removes jevents.h file and add its data inside
>> jevents.c as this file is only included there.
>>
>> Signed-off-by: Kajol Jain 
>> ---
>>  tools/perf/pmu-events/jevents.c |  9 -
>>  tools/perf/pmu-events/jevents.h | 23 ---
>>  2 files changed, 8 insertions(+), 24 deletions(-)
>>  delete mode 100644 tools/perf/pmu-events/jevents.h
>>
>> diff --git a/tools/perf/pmu-events/jevents.c 
>> b/tools/perf/pmu-events/jevents.c
>> index fa86c5f997cc..1c55cc754b5a 100644
>> --- a/tools/perf/pmu-events/jevents.c
>> +++ b/tools/perf/pmu-events/jevents.c
>> @@ -48,11 +48,18 @@
>>  #include 
>>  #include "jsmn.h"
>>  #include "json.h"
>> -#include "jevents.h"
>>  
>>  int verbose;
>>  char *prog;
>>  
>> +#ifndef min
>> +#define min(x, y) ({\
>> +typeof(x) _min1 = (x);  \
>> +typeof(y) _min2 = (y);  \
>> +(void)(&_min1 == &_min2);   \
>> +_min1 < _min2 ? _min1 : _min2; })
>> +#endif
>> +
>>  int eprintf(int level, int var, const char *fmt, ...)
>>  {
>>  
>> diff --git a/tools/perf/pmu-events/jevents.h 
>> b/tools/perf/pmu-events/jevents.h
>> deleted file mode 100644
>> index 2afc8304529e..
>> --- a/tools/perf/pmu-events/jevents.h
>> +++ /dev/null
>> @@ -1,23 +0,0 @@
>> -/* SPDX-License-Identifier: GPL-2.0 */
>> -#ifndef JEVENTS_H
>> -#define JEVENTS_H 1
>> -
>> -int json_events(const char *fn,
>> -int (*func)(void *data, char *name, char *event, char *desc,
>> -char *long_desc,
>> -char *pmu,
>> -char *unit, char *perpkg, char *metric_expr,
>> -char *metric_name, char *metric_group,
>> -char *deprecated, char *metric_constraint),
>> -void *data);
>> -char *get_cpu_str(void);
> 
> I think you can also remove get_cpu_str from jevents.c

Hi Jiri,
 Yes, I will check that part.

Thanks,
Kajol Jain
> 
> thanks,
> jirka
> 


Re: [PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-08-31 Thread John Garry

On 31/08/2020 09:43, Jiri Olsa wrote:

On Thu, Aug 27, 2020 at 06:39:54PM +0530, Kajol Jain wrote:

This patch removes jevents.h file and add its data inside
jevents.c as this file is only included there.

Signed-off-by: Kajol Jain 
---
  tools/perf/pmu-events/jevents.c |  9 -
  tools/perf/pmu-events/jevents.h | 23 ---
  2 files changed, 8 insertions(+), 24 deletions(-)
  delete mode 100644 tools/perf/pmu-events/jevents.h

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index fa86c5f997cc..1c55cc754b5a 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -48,11 +48,18 @@
  #include 
  #include "jsmn.h"
  #include "json.h"
-#include "jevents.h"
  
  int verbose;

  char *prog;
  
+#ifndef min

+#define min(x, y) ({   \
+   typeof(x) _min1 = (x);  \
+   typeof(y) _min2 = (y);  \
+   (void)(&_min1 == &_min2);   \
+   _min1 < _min2 ? _min1 : _min2; })
+#endif


Wondering what is special about this definition of min that it's 
required? Compiled ok for me without it.



+
  int eprintf(int level, int var, const char *fmt, ...)
  {
  
diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h

deleted file mode 100644
index 2afc8304529e..
--- a/tools/perf/pmu-events/jevents.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef JEVENTS_H
-#define JEVENTS_H 1
-
-int json_events(const char *fn,
-   int (*func)(void *data, char *name, char *event, char *desc,
-   char *long_desc,
-   char *pmu,
-   char *unit, char *perpkg, char *metric_expr,
-   char *metric_name, char *metric_group,
-   char *deprecated, char *metric_constraint),
-   void *data);
-char *get_cpu_str(void);


I think you can also remove get_cpu_str from jevents.c

thanks,
jirka

.





Re: [PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-08-31 Thread Jiri Olsa
On Thu, Aug 27, 2020 at 06:39:54PM +0530, Kajol Jain wrote:
> This patch removes jevents.h file and add its data inside
> jevents.c as this file is only included there.
> 
> Signed-off-by: Kajol Jain 
> ---
>  tools/perf/pmu-events/jevents.c |  9 -
>  tools/perf/pmu-events/jevents.h | 23 ---
>  2 files changed, 8 insertions(+), 24 deletions(-)
>  delete mode 100644 tools/perf/pmu-events/jevents.h
> 
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index fa86c5f997cc..1c55cc754b5a 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -48,11 +48,18 @@
>  #include 
>  #include "jsmn.h"
>  #include "json.h"
> -#include "jevents.h"
>  
>  int verbose;
>  char *prog;
>  
> +#ifndef min
> +#define min(x, y) ({ \
> + typeof(x) _min1 = (x);  \
> + typeof(y) _min2 = (y);  \
> + (void)(&_min1 == &_min2);   \
> + _min1 < _min2 ? _min1 : _min2; })
> +#endif
> +
>  int eprintf(int level, int var, const char *fmt, ...)
>  {
>  
> diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h
> deleted file mode 100644
> index 2afc8304529e..
> --- a/tools/perf/pmu-events/jevents.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -#ifndef JEVENTS_H
> -#define JEVENTS_H 1
> -
> -int json_events(const char *fn,
> - int (*func)(void *data, char *name, char *event, char *desc,
> - char *long_desc,
> - char *pmu,
> - char *unit, char *perpkg, char *metric_expr,
> - char *metric_name, char *metric_group,
> - char *deprecated, char *metric_constraint),
> - void *data);
> -char *get_cpu_str(void);

I think you can also remove get_cpu_str from jevents.c

thanks,
jirka



[PATCH v6 1/5] perf/jevents: Remove jevents.h file

2020-08-27 Thread Kajol Jain
This patch removes jevents.h file and add its data inside
jevents.c as this file is only included there.

Signed-off-by: Kajol Jain 
---
 tools/perf/pmu-events/jevents.c |  9 -
 tools/perf/pmu-events/jevents.h | 23 ---
 2 files changed, 8 insertions(+), 24 deletions(-)
 delete mode 100644 tools/perf/pmu-events/jevents.h

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index fa86c5f997cc..1c55cc754b5a 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -48,11 +48,18 @@
 #include 
 #include "jsmn.h"
 #include "json.h"
-#include "jevents.h"
 
 int verbose;
 char *prog;
 
+#ifndef min
+#define min(x, y) ({   \
+   typeof(x) _min1 = (x);  \
+   typeof(y) _min2 = (y);  \
+   (void)(&_min1 == &_min2);   \
+   _min1 < _min2 ? _min1 : _min2; })
+#endif
+
 int eprintf(int level, int var, const char *fmt, ...)
 {
 
diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h
deleted file mode 100644
index 2afc8304529e..
--- a/tools/perf/pmu-events/jevents.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef JEVENTS_H
-#define JEVENTS_H 1
-
-int json_events(const char *fn,
-   int (*func)(void *data, char *name, char *event, char *desc,
-   char *long_desc,
-   char *pmu,
-   char *unit, char *perpkg, char *metric_expr,
-   char *metric_name, char *metric_group,
-   char *deprecated, char *metric_constraint),
-   void *data);
-char *get_cpu_str(void);
-
-#ifndef min
-#define min(x, y) ({\
-   typeof(x) _min1 = (x);  \
-   typeof(y) _min2 = (y);  \
-   (void) (&_min1 == &_min2);  \
-   _min1 < _min2 ? _min1 : _min2; })
-#endif
-
-#endif
-- 
2.26.2