Re: [PATCH 2/2] arm64: dts: allwinner: h6: Introduce Tanix TX6 board

2019-09-02 Thread Rong Chen

Hi,

On 8/19/19 2:59 AM, Jernej Škrabec wrote:

Dne nedelja, 18. avgust 2019 ob 20:42:49 CEST je kbuild test robot napisal(a):

Hi Jernej,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc4 next-20190816]
[if your patch is applied to the wrong git tree, please drop us a note to
help improve the system]

url:
https://github.com/0day-ci/linux/commits/Jernej-Skrabec/dt-bindings-arm-sun
xi-Add-compatible-for-Tanix-TX6-board/20190819-002034 config:
arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.4.0
reproduce:
 wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross chmod +x ~/bin/make.cross
 # save the attached .config to linux build tree
 GCC_VERSION=7.4.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

Error: arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts:83.1-6 Label
or path r_ir not found FATAL ERROR: Syntax error parsing input tree

Strange, Allwinner tree has commit, which introduces r_ir node:
https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/commit/?
h=sunxi/dt-for-5.4&id=9267811aad3524c857cf2e16bbadd8c569e15ab9

Maybe kbuild test robot tree doesn't have it?


The tree is in our list. 
https://github.com/intel/lkp-tests/blob/master/repo/linux/sunxi
Robot also tries to apply patches to a git tree to test. Maybe your 
patch was applied to a wrong git tree.


Best Regards,
Rong Chen



Re: [PATCH v4 03/10] device property: Add functions for accessing node's parents

2019-09-02 Thread Sakari Ailus
On Fri, Aug 30, 2019 at 03:42:35PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:44:01PM +0300, Sakari Ailus wrote:
> > Add two convenience functions for accessing node's parents:
> > 
> > fwnode_count_parents() returns the number of parent nodes a given node
> > has. fwnode_get_nth_parent() returns node's parent at a given distance
> > from the node itself.
> > 
> > Also reorder fwnode_get_parent() in property.c according to the same order
> > as in property.h.
> 
> Same comment as per previous version.

Same answer as on previous version. :^)

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH] Add support for Macronix NAND randomizer

2019-09-02 Thread Richard Weinberger
On Mon, Sep 2, 2019 at 8:54 AM  wrote:
> > > nand@0 {
> > > reg = <0>;
> > > nand-reliability = "randomizer";
> >
> >   mxic,enable-randomizer-otp;
> >
> > Would be better (with the proper documentation in the bindings).
> >
>
> okay, thanks for your opinions.

Please document also when/why one wants to enable the randomizer.

-- 
Thanks,
//richard


Re: [PATCH v3 06/10] lib/vsprintf: Remove support for %pF and %pf in favour of %pS and %ps

2019-09-02 Thread Sakari Ailus
On Fri, Aug 30, 2019 at 03:48:17PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:39PM +0300, Sakari Ailus wrote:
> > %pS and %ps are now the preferred conversion specifiers to print function
> > %names. The functionality is equivalent; remove the old, deprecated %pF
> > %and %pf support.
> > 
> 
> > Depends-on: ("treewide: Switch printk users from %pf and %pF to %ps and
> >   %pS, respectively")
> 
> Same comment for multi-line tags, besides that it misses hash, and since it's
> in upstream, no need for it anymore?

Yes, I forgot to remove it when posting v3.

> FWIW,
> Reviewed-by: Andy Shevchenko 

Thanks!

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH v3 06/10] lib/vsprintf: Remove support for %pF and %pf in favour of %pS and %ps

2019-09-02 Thread Sakari Ailus
On Fri, Aug 30, 2019 at 03:55:32PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:39PM +0300, Sakari Ailus wrote:
> > %pS and %ps are now the preferred conversion specifiers to print function
> > %names. The functionality is equivalent; remove the old, deprecated %pF
> > %and %pf support.
> 
> Btw, too many % in the commit message.

Will fix for v4.

Joe sometimes does that if the first letter of the paragraph is some sort
of a special character.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: linux-next: Fixes tag needs some work in the battery tree

2019-09-02 Thread Sebastian Reichel
Hi Stephen,

On Mon, Sep 02, 2019 at 09:31:31AM +1000, Stephen Rothwell wrote:
> In commit
> 
> b19aca4eb2d2 ("power: supply: sbs-battery: only return health when battery 
> present")
> 
> [...]
> 
> Please do not split Fixes tags over more than one line.

I have fixed this and rebased the branch, so the issue should be
gone tomororw. Thanks for the notice,

-- Sebastian


signature.asc
Description: PGP signature


Re: [PATCH v3 07/10] lib/vsprintf: Make use of fwnode API to obtain node names and separators

2019-09-02 Thread Sakari Ailus
Hi Andy,

On Fri, Aug 30, 2019 at 03:53:14PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:40PM +0300, Sakari Ailus wrote:
> > Instead of implementing our own means of discovering parent nodes, node
> > names or counting how many parents a node has, use the newly added
> > functions in the fwnode API to obtain that information.
> > 
> 
> Some style comments below.
> Nevertheless,
> Reviewed-by: Andy Shevchenko 

Thanks!

> 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  lib/vsprintf.c | 38 --
> >  1 file changed, 16 insertions(+), 22 deletions(-)
> > 
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > index b00b57f9f911f..a04a2167101ef 100644
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -38,6 +38,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #ifdef CONFIG_BLOCK
> >  #include 
> >  #endif
> > @@ -1863,32 +1864,24 @@ char *flags_string(char *buf, char *end, void 
> > *flags_ptr,
> > return format_flags(buf, end, flags, names);
> >  }
> >  
> > -static const char *device_node_name_for_depth(const struct device_node 
> > *np, int depth)
> > -{
> > -   for ( ; np && depth; depth--)
> > -   np = np->parent;
> > -
> > -   return kbasename(np->full_name);
> > -}
> > -
> >  static noinline_for_stack
> > -char *device_node_gen_full_name(const struct device_node *np, char *buf, 
> > char *end)
> 
> > +char *fwnode_full_name_string(struct fwnode_handle *fwnode, char *buf,
> > + char *end)
> 
> I would leave it on one line.
> 
> >  {
> > int depth;
> > -   const struct device_node *parent = np->parent;
> >  
> > -   /* special case for root node */
> > -   if (!parent)
> > -   return string_nocheck(buf, end, "/", default_str_spec);
> > +   for (depth = fwnode_count_parents(fwnode); depth >= 0; depth--) {
> > +   struct fwnode_handle *__fwnode =
> > +   fwnode_get_nth_parent(fwnode, depth);
> 
> Ditto if you name temporary variable like fw / fh / fn / etc.
> 
> >  
> > -   for (depth = 0; parent->parent; depth++)
> > -   parent = parent->parent;
> > -
> > -   for ( ; depth >= 0; depth--) {
> > -   buf = string_nocheck(buf, end, "/", default_str_spec);
> > -   buf = string(buf, end, device_node_name_for_depth(np, depth),
> 
> > +   buf = string(buf, end, fwnode_get_name_prefix(__fwnode),
> > +default_str_spec);
> > +   buf = string(buf, end, fwnode_get_name(__fwnode),
> >  default_str_spec);
> 
> Ditto.
> 
> > +
> > +   fwnode_handle_put(__fwnode);
> > }
> > +
> > return buf;
> >  }
> >  
> > @@ -1933,10 +1926,11 @@ char *device_node_string(char *buf, char *end, 
> > struct device_node *dn,
> >  
> > switch (*fmt) {
> > case 'f':   /* full_name */
> > -   buf = device_node_gen_full_name(dn, buf, end);
> 
> > +   buf = fwnode_full_name_string(of_fwnode_handle(dn), buf,
> > + end);
> 
> Ditto, disregard checkpatch.

Why? I see no reason to avoid wrapping here; in fact, if I'd review a patch
that contained such code, I'd ask the submitter to wrap the lines.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [GIT PULL] perf/core improvements and fixes

2019-09-02 Thread Ingo Molnar


* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo/Thomas,
> 
>   Please consider pulling,
> 
> Best regards,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 39c2ca43465e0f52ebba3ee96fd03436367c1880:
> 
>   Merge tag 'perf-core-for-mingo-5.4-20190829' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core 
> (2019-08-29 20:56:32 +0200)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
> tags/perf-core-for-mingo-5.4-20190901
> 
> for you to fetch changes up to ae31a514a134d9e4ca1d7b0f0a19b5934747d79f:
> 
>   objtool: Ignore intentional differences for the x86 insn decoder 
> (2019-08-31 22:27:52 -0300)
> 
> 
> perf/core improvements and fixes:
> 
> objtool:
> 
>   Josh Poimboeuf:
> 
>   - Move x86 insn decoder to a common location.
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Ignore intentional differences for the x86 insn decoder.
> 
> build:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Ignore intentional differences for the x86 insn decoder.
> 
> Intel PT:
> 
>   Josh Poimboeuf:
> 
>   - Use shared x86 insn decoder.
> 
> metric groups:
> 
>   Jin Yao:
> 
>   - Scale the metric result.
> 
>   - Support multiple events.
> 
> perf c2c:
> 
>   Jiri Olsa:
> 
>   - Display proper cpu count in nodes column.
> 
> Miscellaneous:
> 
>   Kyle Meyer:
> 
>   - Replace MAX_NR_CPUS with perf_env::nr_cpus_online, i.e. with
> the number of online CPUs as detected at tool start and/or
> recorded in the perf.data file.
> 
> libtraceevent:
> 
>   Tzvetomir Stoyanov:
> 
>   - Simplify the tep_print_event_* APIs.
> 
>   - Remove tep_register_trace_clock().
> 
>   - Change users plugin directory.
> 
> Cleanups:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Continue taming the includes hell: remove needless include directives, fix
> the fallout, rinse, repeat.
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Arnaldo Carvalho de Melo (29):
>   perf tools: Remove needless libtraceevent include directives
>   perf header: Move CPUINFO_PROC to the only file where it is used
>   perf tools: Move everything related to sys_perf_event_open() to 
> perf-sys.h
>   perf time-utils: Adopt rdclock() from perf.h
>   perf tools: Remove needless perf.h include directive from headers
>   perf tools: Remove perf.h from source files not needing it
>   perf tools: Remove debug.h from header files not needing it
>   perf debug: Remove needless include directives from debug.h
>   perf env: Remove env.h from other headers where just a fwd decl is 
> needed
>   perf event: Remove needless include directives from event.h
>   perf dso: Adopt DSO related macros from symbol.h
>   perf symbol: Move C++ demangle defines to the only file using it
>   perf symbols: Add missing linux/refcount.h to symbol.h
>   perf symbols: Move symsrc prototypes to a separate header
>   perf dsos: Move the dsos struct and its methods to separate source files
>   perf hist: Remove needless ui/progress.h from hist.h
>   perf tools: Move 'struct events_stats' and prototypes to separate header
>   perf tools: Remove needless sort.h include directives
>   perf probe: No need for symbol.h, symbol_conf is enough
>   perf tools: Remove needless map.h include directives
>   perf tools: Remove needless thread.h include directives
>   perf tools: Remove needless thread_map.h include directives
>   perf tools: Remove needless evlist.h include directives
>   perf tools: Remove needless evlist.h include directives
>   perf auxtrace: Uninline functions that touch perf_session
>   perf symbols: Move mem_info and branch_info out of symbol.h
>   perf build: Ignore intentional differences for the x86 insn decoder
>   objtool: Update sync-check.sh from perf's check-headers.sh
>   objtool: Ignore intentional differences for the x86 insn decoder
> 
> Jin Yao (3):
>   perf pmu: Change convert_scale from static to global
>   perf metricgroup: Scale the metric result
>   perf metricgroup: Support multiple events for metricgroup
> 
> Jiri Olsa (1):
>   perf c2c: Display proper cpu count in nodes column
> 
> Josh Poimboeuf (4):
>   objtool: Move x86 insn decoder to a common location
>   perf: Update .gitignore file
>   perf intel-pt: Remove inat.c from build dependency list
>   perf intel-pt: Use shared x86 insn decoder
> 
> Kyle Meyer (7):
>   perf timechart: Refactor svg_build_topology_map()
>   perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online
>   perf stat: Replace MAX_NR_CPUS with cpu__max_cpu()
>   perf session: Replace MAX_NR_CPUS with perf_env::nr_cpus_online
>   perf machine: Replace MAX_NR_CPUS with perf_env::nr_cpus_online
>   

Re: Oops (request_key_auth_describe) while running cve-2016-7042 from LTP

2019-09-02 Thread David Howells
Hi Hillf,

Would you like to me to put you down as the author of this patch?  If so, I'll
need a Signed-off-by from you.

David
---
commit df882ad6d4e24a3763719c1798ea58e87d56c2d7
Author: Hillf Danton 
Date:   Fri Aug 30 15:54:33 2019 +0100

keys: Fix missing null pointer check in request_key_auth_describe()

If a request_key authentication token key gets revoked, there's a window in
which request_key_auth_describe() can see it with a NULL payload - but it
makes no check for this and something like the following oops may occur:

BUG: Kernel NULL pointer dereference at 0x0038
Faulting instruction address: 0xc04ddf30
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP [...] request_key_auth_describe+0x90/0xd0
LR [...] request_key_auth_describe+0x54/0xd0
Call Trace:
[...] request_key_auth_describe+0x54/0xd0 (unreliable)
[...] proc_keys_show+0x308/0x4c0
[...] seq_read+0x3d0/0x540
[...] proc_reg_read+0x90/0x110
[...] __vfs_read+0x3c/0x70
[...] vfs_read+0xb4/0x1b0
[...] ksys_read+0x7c/0x130
[...] system_call+0x5c/0x70

Fix this by checking for a NULL pointer when describing such a key.

Also make the read routine check for a NULL pointer to be on the safe side.

Fixes: 04c567d9313e ("[PATCH] Keys: Fix race between two instantiators of a 
key")
Reported-by: Sachin Sant 
Signed-off-by: David Howells 
Tested-by: Sachin Sant 

diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index e73ec040e250..ecba39c93fd9 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -66,6 +66,9 @@ static void request_key_auth_describe(const struct key *key,
 {
struct request_key_auth *rka = dereference_key_rcu(key);
 
+   if (!rka)
+   return;
+
seq_puts(m, "key:");
seq_puts(m, key->description);
if (key_is_positive(key))
@@ -83,6 +86,9 @@ static long request_key_auth_read(const struct key *key,
size_t datalen;
long ret;
 
+   if (!rka)
+   return -EKEYREVOKED;
+
datalen = rka->callout_len;
ret = datalen;
 


Re: [PATCH v3 09/10] lib/vsprintf: Add %pfw conversion specifier for printing fwnode names

2019-09-02 Thread Sakari Ailus
Hi Andy,

Thanks for the review.

On Fri, Aug 30, 2019 at 04:03:49PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:42PM +0300, Sakari Ailus wrote:
> > Add support for %pfw conversion specifier (with "f" and "P" modifiers) to
> > support printing full path of the node, including its name ("f") and only
> > the node's name ("P") in the printk family of functions. The two flags
> > have equivalent functionality to existing %pOF with the same two modifiers
> > ("f" and "P") on OF based systems. The ability to do the same on ACPI
> > based systems is added by this patch.
> > 
> > On ACPI based systems the resulting strings look like
> > 
> > \_SB.PCI0.CIO2.port@1.endpoint@0
> > 
> > where the nodes are separated by a dot (".") and the first three are
> > ACPI device nodes and the latter two ACPI data nodes.
> 
> Couple of comments below, FWIW,
> Reviewed-by: Andy Shevchenko 

Thanks!

> 
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  Documentation/core-api/printk-formats.rst | 24 +++
> >  lib/vsprintf.c| 37 +++
> >  scripts/checkpatch.pl |  3 +-
> >  3 files changed, 63 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/core-api/printk-formats.rst 
> > b/Documentation/core-api/printk-formats.rst
> > index 922a29eb70e6c..abba210f67567 100644
> > --- a/Documentation/core-api/printk-formats.rst
> > +++ b/Documentation/core-api/printk-formats.rst
> > @@ -418,6 +418,30 @@ Examples::
> >  
> >  Passed by reference.
> >  
> > +Fwnode handles
> > +--
> > +
> > +::
> > +
> > +   %pfw[fP]
> 
> I'm not familiar with all flavours of the OF case, the question is do we use
> same letters for analogues?

Yes. There are some that may be unworkable to be extended, but in general
this helps folks who are familiar with the OF conversion specifiers.

> 
> > +
> > +For printing information on fwnode handles. The default is to print the 
> > full
> > +node name, including the path. The modifiers are functionally equivalent to
> > +%pOF above.
> > +
> > +   - f - full name of the node, including the path
> > +   - P - the name of the node including an address (if there is one)
> > +
> > +Examples (ACPI):
> > +
> > +   %pfwf   \_SB.PCI0.CIO2.port@1.endpoint@0- Full node name
> > +   %pfwP   endpoint@0  - Node name
> > +
> > +Examples (OF):
> > +
> > +   %pfwf   /ocp@6800/i2c@48072000/camera@10/port/endpoint - Full name
> > +   %pfwP   endpoint- Node name
> > +
> >  Time and date (struct rtc_time)
> >  ---
> >  
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > index 19f9b3f30623e..79dacd0b9e124 100644
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -1978,6 +1978,37 @@ char *device_node_string(char *buf, char *end, 
> > struct device_node *dn,
> > return widen_string(buf, buf - buf_start, end, spec);
> >  }
> >  
> > +static noinline_for_stack
> > +char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode,
> > +   struct printf_spec spec, const char *fmt)
> > +{
> > +   struct printf_spec str_spec = spec;
> > +   char *buf_start = buf;
> > +
> > +   str_spec.field_width = -1;
> > +
> > +   if (*fmt != 'w')
> > +   return error_string(buf, end, "(%pfw?)", spec);
> > +
> > +   if (check_pointer(&buf, end, fwnode, spec))
> > +   return buf;
> > +
> > +   fmt++;
> > +
> > +   switch (*fmt) {
> > +   case 'f':   /* full_name */
> > +   default:
> > +   buf = fwnode_full_name_string(fwnode, buf, end);
> > +   break;
> > +   case 'P':   /* name */
> 
> > +   buf = string(buf, end, fwnode_get_name(fwnode),
> > +str_spec);
> 
> Perfectly one line.

Fixed.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH V2] x86/boot: Fix regression--secure boot info loss from bootparam sanitizing

2019-09-02 Thread Borislav Petkov
On Mon, Sep 02, 2019 at 12:00:54AM +0200, John S Gruber wrote:
> From: "John S. Gruber" 
> 
> commit a90118c445cc ("x86/boot: Save fields explicitly, zero out everything
> else") now zeros the secure boot information passed by the boot loader or
> by the kernel's efi handover mechanism.  Include boot-params.secure_boot
> in the preserve field list.
> 
> I noted a change in my computers between running signed 5.3-rc4 and 5.3-rc6
> with signed kernels using the efi handoff protocol with grub. The kernel
> log message "Secure boot enabled" becomes "Secure boot could not be
> determined". The efi_main function in arch/x86/boot/compressed/eboot.c sets
> this field early but it is subsequently zeroed by the above referenced
> commit in the file arch/x86/include/asm/bootparam_utils.h
> 
> Fixes: commit a90118c445cc ("x86/boot: Save fields explicitly, zero
> out everything else")
> Signed-off-by: John S. Gruber 
> ---
> 
> Adjusted the patch for John Hubbard's comments.
> 
>  arch/x86/include/asm/bootparam_utils.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/include/asm/bootparam_utils.h
> b/arch/x86/include/asm/bootparam_utils.h
> index 9e5f3c7..981fe92 100644
> --- a/arch/x86/include/asm/bootparam_utils.h
> +++ b/arch/x86/include/asm/bootparam_utils.h
> @@ -70,6 +70,7 @@ static void sanitize_boot_params(struct boot_params
> *boot_params)

gmail has managed to chew this patch:

checking file arch/x86/include/asm/bootparam_utils.h
patch:  malformed patch at line 48: *boot_params)

See: 
https://www.kernel.org/doc/html/latest/process/email-clients.html#gmail-web-gui

You might find a better client in there if you wanna send more patches
in the future.

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH] Parallel microcode update in Linux

2019-09-02 Thread Mihai Carabas



> On 1 Sep 2019, at 20:25, Pavel Machek  wrote:
> 
> Hi!
> 
>> +   u64 p0, p1;
>>int ret;
>> 
>>atomic_set(&late_cpus_in,  0);
>>atomic_set(&late_cpus_out, 0);
>> 
>> +   p0 = rdtsc_ordered();
>> +
>>ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
>> +
>> +   p1 = rdtsc_ordered();
>> +
>>if (ret > 0)
>>microcode_check();
>> 
>>pr_info("Reload completed, microcode revision: 0x%x\n", 
>> boot_cpu_data.microcode);
>> 
>> +   pr_info("p0: %lld, p1: %lld, diff: %lld\n", p0, p1, p1 - p0);
>> +
>>return ret;
>> }
>> 
>> We have used a machine with a broken microcode in BIOS and no microcode in
>> initramfs (to bypass early loading).
>> 
>> Here are the results for parallel loading (we made two measurements):
> 
>> [   18.197760] microcode: updated to revision 0x25e, date = 2019-04-02
>> [   18.201225] x86/CPU: CPU features have changed after loading microcode, 
>> but might not take effect.
>> [   18.201230] microcode: Reload completed, microcode revision: 0x25e
>> [   18.201232] microcode: p0: 118138123843052, p1: 118138153732656, diff: 
>> 29889604
> 
>> Here are the results of serial loading:
>> 
>> [   17.542518] microcode: updated to revision 0x25e, date = 2019-04-02
>> [   17.898365] x86/CPU: CPU features have changed after loading microcode, 
>> but might not take effect.
>> [   17.898370] microcode: Reload completed, microcode revision: 0x25e
>> [   17.898372] microcode: p0: 149220216047388, p1: 149221058945422, diff: 
>> 842898034
>> 
>> One can see that the difference is an order magnitude.
> 
> Well, that's impressive, but it seems to finish 300 msec later? Where does 
> that difference
> come from / how much real time do you gain by this?

The difference comes from the large amount of cores/threads the machine has: 72 
in this case, but there are machines with more. As the commit message says 
initially the microcode was applied serially one by one and now the microcode 
is updated in parallel on all cores.

300ms seems nothing but it is enough to cause disruption in some critical 
services (e.g. storage) - 300ms in which we do not execute anything on CPUs. 
Also this 300ms is increasing when the machine is fully loaded with guests.

Thanks,
Mihai

> 
> Best regards,
>Pavel
> 
> -- 
> (english) 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.livejournal.com_-7Epavelmachek&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=IOMTUEJr06tE0LeEzvwr_907ba6u9S5iDf7M8ZYjbGY&m=cz26YweqnHS4QvZBi-1jNR8t7o3n04-8UsSBZqEQHgA&s=-nEQbDyJrDjKxyrt496frey_aMJHXmgMcm-hH0ewO7M&e=
>  
> (cesky, pictures) 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__atrey.karlin.mff.cuni.cz_-7Epavel_picture_horses_blog.html&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=IOMTUEJr06tE0LeEzvwr_907ba6u9S5iDf7M8ZYjbGY&m=cz26YweqnHS4QvZBi-1jNR8t7o3n04-8UsSBZqEQHgA&s=0L72IdzqTDn_8PmDVcNxLAFbcYG1jRDN9ob8SZ18XTE&e=
>  



Re: [PATCH v5 00/18] add thermal driver for h6

2019-09-02 Thread Maxime Ripard
Hi,

On Sun, Sep 01, 2019 at 11:52:14PM +0200, Ondřej Jirman wrote:
> Hello Yangtao,
>
> On Sat, Aug 10, 2019 at 05:28:11AM +, Yangtao Li wrote:
> > This patchset add support for A64, H3, H5, H6 and R40 thermal sensor.
> >
> > Thx to Icenowy and Vasily.
> >
> > BTY, do a cleanup in thermal makfile.
>
> I've added support for A83T and also some cleanups, according to my
> feedback:
>
> https://megous.com/git/linux/log/?h=ths-5.3
>
> Feel free to pick up whatever you like from that tree.
>
> For others, there are also DTS patches in that tree for H3, H5, A83T, and H6, 
> so
> that shoul make testing of this driver easier.

I'm not convinced that always expanding the number of SoC supported is
the best strategy to get this merged. Usually, keeping the same
feature set across version, consolidating that, and then once it's in
sending the new SoC support works best.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH v3 08/10] lib/vsprintf: OF nodes are first and foremost, struct device_nodes

2019-09-02 Thread Sakari Ailus
On Fri, Aug 30, 2019 at 03:57:49PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:41PM +0300, Sakari Ailus wrote:
> > Factor out static kobject_string() function that simply calls
> > device_node_string(), and thus remove references to kobjects (as these are
> > struct device_node).
> 
> Not sure. This removes "(%pO?)" error string.

Indeed. I'll add it back for v4.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH] powerpc: Perform a bounds check in arch_add_memory

2019-09-02 Thread David Hildenbrand
On 02.09.19 01:54, Alastair D'Silva wrote:
> On Tue, 2019-08-27 at 09:13 +0200, David Hildenbrand wrote:
>> On 27.08.19 08:39, Alastair D'Silva wrote:
>>> On Tue, 2019-08-27 at 08:28 +0200, Michal Hocko wrote:
 On Tue 27-08-19 15:20:46, Alastair D'Silva wrote:
> From: Alastair D'Silva 
>
> It is possible for firmware to allocate memory ranges outside
> the range of physical memory that we support
> (MAX_PHYSMEM_BITS).

 Doesn't that count as a FW bug? Do you have any evidence of that
 in
 the
 field? Just wondering...

>>>
>>> Not outside our lab, but OpenCAPI attached LPC memory is assigned
>>> addresses based on the slot/NPU it is connected to. These addresses
>>> prior to:
>>> 4ffe713b7587 ("powerpc/mm: Increase the max addressable memory to
>>> 2PB")
>>> were inaccessible and resulted in bogus sections - see our
>>> discussion
>>> on 'mm: Trigger bug on if a section is not found in __section_nr'.
>>> Doing this check here was your suggestion :)
>>>
>>> It's entirely possible that a similar problem will occur in the
>>> future,
>>> and it's cheap to guard against, which is why I've added this.
>>>
>>
>> If you keep it here, I guess this should be wrapped by a
>> WARN_ON_ONCE().
>>
>> If we move it to common code (e.g., __add_pages() or add_memory()),
>> then
>> probably not. I can see that s390x allows to configure
>> MAX_PHYSMEM_BITS,
>> so the check could actually make sense.
>>
> 
> I couldn't see a nice platform indepedent way to determine the
> allowable address range, but if there is, then I'll move this to the
> generic code instead.
> 

At least on the !ZONE_DEVICE path we have

__add_memory() -> register_memory_resource() ...

return ERR_PTR(-E2BIG);


I was thinking about something like

int add_pages()
{
if ((start + size - 1) >> MAX_PHYSMEM_BITS)
return -E2BIG;  

return arch_add_memory(...)
}

And switching users of arch_add_memory() to add_pages(). However, x86
already has an add_pages() function, so that would need some more thought.

Maybe simply renaming the existing add_pages() to arch_add_pages().

add_pages(): Create virtual mapping
__add_pages(): Don't create virtual mapping

arch_add_memory(): Arch backend for add_pages()
arch_add_pages(): Arch backend for __add_pages()

It would be even more consistent if we would have arch_add_pages() vs.
__arch_add_pages().

-- 

Thanks,

David / dhildenb


Re: [PATCH v3 05/10] device property: Add a function to obtain a node's prefix

2019-09-02 Thread Sakari Ailus
Hi Andy,

On Fri, Aug 30, 2019 at 03:46:57PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:38PM +0300, Sakari Ailus wrote:
> > The prefix is used for printing purpose before a node, and it also works
> > as a separator between two nodes.
> 
> > +   /* Is this the root node? */
> > +   parent = fwnode_get_parent(fwnode);
> > +   if (!parent)
> > +   return "";
> > +
> > +   /* Is this 2nd node from the root? */
> > +   parent = fwnode_get_next_parent(parent);
> > +   if (!parent)
> 
> Can we theoretically have a case when we got parent != NULL and thus taken
> reference, while the 2nd one is NULL and we leak reference here (and in all
> similar places)?

fwnode_get_next_parent() releases that reference unconditionally.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


Re: [PATCH v3 03/10] device property: Add functions for accessing node's parents

2019-09-02 Thread Sakari Ailus
On Fri, Aug 30, 2019 at 03:34:48PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 29, 2019 at 01:10:36PM +0300, Sakari Ailus wrote:
> > Add two convenience functions for accessing node's parents:
> > 
> > fwnode_count_parents() returns the number of parent nodes a given node
> > has. fwnode_get_nth_parent() returns node's parent at a given distance
> > from the node itself.
> > 
> > Also reorder fwnode_get_parent() in property.c according to the same order
> > as in property.h.
> 
> > +/**
> > + * fwnode_get_parent - Return parent firwmare node
> > + * @fwnode: Firmware whose parent is retrieved
> 
> I guess you may leave this in the same location. The change will be more clear
> to review and smaller.

I added a separate patch that just moves it up.

-- 
Sakari Ailus
sakari.ai...@linux.intel.com


linux-next: manual merge of the tip tree with Linus' tree

2019-09-02 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the tip tree got a conflict in:

  tools/power/x86/turbostat/turbostat.c

between commit:

  cd188af5282d ("tools/power turbostat: Fix Haswell Core systems")
  b62b3184576b ("tools/power turbostat: add Jacobsville support")
  d93ea567fc4e ("tools/power turbostat: Add Ice Lake NNPI support")

from Linus' tree and commit:

  c66f78a6de4d ("x86/intel: Aggregate big core client naming")
  af239c44e3f9 ("x86/intel: Aggregate big core mobile naming")
  5e741407eab7 ("x86/intel: Aggregate big core graphics naming")
  5ebb34edbefa ("x86/intel: Aggregate microserver naming")

from the tip tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/power/x86/turbostat/turbostat.c
index b2a86438f074,6eef0cee6d75..
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@@ -3234,15 -3207,14 +3234,15 @@@ int probe_nhm_msrs(unsigned int family
pkg_cstate_limits = snb_pkg_cstate_limits;
has_misc_feature_control = 1;
break;
-   case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+   case INTEL_FAM6_HASWELL:/* HSW */
case INTEL_FAM6_HASWELL_X:  /* HSX */
-   case INTEL_FAM6_HASWELL_ULT:/* HSW */
-   case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
-   case INTEL_FAM6_BROADWELL_CORE: /* BDW */
-   case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
++  case INTEL_FAM6_HASWELL_L:  /* HSW */
+   case INTEL_FAM6_HASWELL_G:  /* HSW */
+   case INTEL_FAM6_BROADWELL:  /* BDW */
+   case INTEL_FAM6_BROADWELL_G:/* BDW */
case INTEL_FAM6_BROADWELL_X:/* BDX */
-   case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-   case INTEL_FAM6_CANNONLAKE_MOBILE:  /* CNL */
+   case INTEL_FAM6_SKYLAKE_L:  /* SKL */
+   case INTEL_FAM6_CANNONLAKE_L:   /* CNL */
pkg_cstate_limits = hsw_pkg_cstate_limits;
has_misc_feature_control = 1;
break;
@@@ -3431,15 -3403,14 +3431,15 @@@ int has_config_tdp(unsigned int family
  
switch (model) {
case INTEL_FAM6_IVYBRIDGE:  /* IVB */
-   case INTEL_FAM6_HASWELL_CORE:   /* HSW */
+   case INTEL_FAM6_HASWELL:/* HSW */
case INTEL_FAM6_HASWELL_X:  /* HSX */
-   case INTEL_FAM6_HASWELL_ULT:/* HSW */
-   case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
-   case INTEL_FAM6_BROADWELL_CORE: /* BDW */
-   case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
++  case INTEL_FAM6_HASWELL_L:  /* HSW */
+   case INTEL_FAM6_HASWELL_G:  /* HSW */
+   case INTEL_FAM6_BROADWELL:  /* BDW */
+   case INTEL_FAM6_BROADWELL_G:/* BDW */
case INTEL_FAM6_BROADWELL_X:/* BDX */
-   case INTEL_FAM6_SKYLAKE_MOBILE: /* SKL */
-   case INTEL_FAM6_CANNONLAKE_MOBILE:  /* CNL */
+   case INTEL_FAM6_SKYLAKE_L:  /* SKL */
+   case INTEL_FAM6_CANNONLAKE_L:   /* CNL */
case INTEL_FAM6_SKYLAKE_X:  /* SKX */
  
case INTEL_FAM6_XEON_PHI_KNL:   /* Knights Landing */
@@@ -3870,11 -3840,10 +3870,11 @@@ void rapl_probe_intel(unsigned int fami
switch (model) {
case INTEL_FAM6_SANDYBRIDGE:
case INTEL_FAM6_IVYBRIDGE:
-   case INTEL_FAM6_HASWELL_CORE:   /* HSW */
-   case INTEL_FAM6_HASWELL_ULT:/* HSW */
-   case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
-   case INTEL_FAM6_BROADWELL_CORE: /* BDW */
-   case INTEL_FAM6_BROADWELL_GT3E: /* BDW */
+   case INTEL_FAM6_HASWELL:/* HSW */
++  case INTEL_FAM6_HASWELL_L:  /* HSW */
+   case INTEL_FAM6_HASWELL_G:  /* HSW */
+   case INTEL_FAM6_BROADWELL:  /* BDW */
+   case INTEL_FAM6_BROADWELL_G:/* BDW */
do_rapl = RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | 
RAPL_PKG_POWER_INFO;
if (rapl_joules) {
BIC_PRESENT(BIC_Pkg_J);
@@@ -4063,9 -4031,8 +4063,9 @@@ void perf_limit_reasons_probe(unsigned 
return;
  
switch (model) {
-   case INTEL_FAM6_HASWELL_CORE:   /* HSW */
-   case INTEL_FAM6_HASWELL_ULT:/* HSW */
-   case INTEL_FAM6_HASWELL_GT3E:   /* HSW */
+   case INTEL_FAM6_HASWELL:/* HSW */
++  case INTEL_FAM6_HASWELL_L:  /* HSW */
+   case INTEL_FAM6_HASWELL_G:  /* HSW */
do_gfx_perf_limit_reasons = 1;
case INTEL_FAM6_HASWELL_X:  /* HSX */
do_core_perf_limit_reasons = 1;
@@@ -4282,15 -4249,14 +4282,15 @@@ int has_snb_msrs(unsigned int family, u
case INTEL_FAM6_SANDYBRIDGE_X:
case INTEL_FAM6_IVYBRIDGE

Re: [RFC 1/9] dt-bindings: arm: samsung: Convert Samsung board/soc bindings to json-schema

2019-09-02 Thread Krzysztof Kozlowski
On Mon, 26 Aug 2019 at 13:38, Rob Herring  wrote:
>
> On Fri, Aug 23, 2019 at 9:54 AM Krzysztof Kozlowski  wrote:
> >
> > Convert Samsung S5P and Exynos SoC bindings to DT schema format using
> > json-schema.  This is purely conversion of already documented bindings
> > so it does not cover all of DTS in the Linux kernel (few S5P/Exynos and
> > all S3C are missing).
> >
> > Signed-off-by: Krzysztof Kozlowski 
> >
> > ---
> >
> > If the schema looks sensible, I will continue on converting other
> > SoC and driver bindings and later adding missing schemas (S3C
> > SoCs).
>
> Looks pretty good.
>
> > ---
> >  .../bindings/arm/samsung/samsung-boards.txt   |  83 
> >  .../bindings/arm/samsung/samsung-boards.yaml  | 188 ++
> >  2 files changed, 188 insertions(+), 83 deletions(-)
> >  delete mode 100644 
> > Documentation/devicetree/bindings/arm/samsung/samsung-boards.txt
> >  create mode 100644 
> > Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml
>
>
> > diff --git 
> > a/Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml 
> > b/Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml
> > new file mode 100644
> > index ..e963fd70c436
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/arm/samsung/samsung-boards.yaml
> > @@ -0,0 +1,188 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/arm/samsung/samsung-boards.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Samsung Exynos and S5P SoC based boards
> > +
> > +maintainers:
> > +  - Krzysztof Kozlowski 
> > +
> > +properties:
> > +  $nodename:
> > +const: '/'
> > +  compatible:
> > +oneOf:
> > +  - description: S5PV210 based Aries boards
> > +items:
> > +  - enum:
> > +  - samsung,fascinate4g # Samsung Galaxy S 
> > Fascinate 4G (SGH-T959P)
> > +  - samsung,galaxys # Samsung Galaxy S (i9000)
> > +  - const: samsung,aries
> > +  - const: samsung,s5pv210
> > +
> > +  - description: Exynos3250 based boards
> > +items:
> > +  - enum:
> > +  - samsung,monk# Samsung Simband
> > +  - samsung,rinato  # Samsung Gear2
> > +  - const: samsung,exynos3250
> > +  - const: samsung,exynos3
> > +
> > +  - description: Samsung ARTIK5 boards
> > +items:
> > +  - enum:
> > +  - samsung,artik5-eval # Samsung ARTIK5 eval board
> > +  - const: samsung,artik5   # Samsung ARTIK5 module
> > +  - const: samsung,exynos3250
> > +  - const: samsung,exynos3
> > +
> > +  - description: Exynos4210 based boards
> > +items:
> > +  - enum:
> > +  - insignal,origen # Insignal Origen
> > +  - samsung,smdkv310# Samsung SMDKV310 eval
> > +  - samsung,trats   # Samsung Tizen Reference
> > +  - samsung,universal_c210  # Samsung C210
> > +  - const: samsung,exynos4210
> > +  - const: samsung,exynos4
> > +
> > +  - description: Exynos4412 based boards
> > +items:
> > +  - enum:
> > +  - friendlyarm,tiny4412# FriendlyARM TINY4412
> > +  - hardkernel,odroid-u3# Hardkernel Odroid U3
> > +  - hardkernel,odroid-x # Hardkernel Odroid X
> > +  - hardkernel,odroid-x2# Hardkernel Odroid X2
> > +  - insignal,origen4412 # Insignal Origen
> > +  - samsung,smdk4412# Samsung SMDK4412 eval
> > +  - topeet,itop4412-elite   # TOPEET Elite base
> > +  - const: samsung,exynos4412
> > +  - const: samsung,exynos4
> > +
> > +  - description: Samsung Midas family boards
> > +items:
> > +  - enum:
> > +  - samsung,i9300   # Samsung GT-I9300
> > +  - samsung,i9305   # Samsung GT-I9305
> > +  - samsung,n710x   # Samsung GT-N7100/GT-N7105
> > +  - samsung,trats2  # Samsung Tizen Reference
> > +  - const: samsung,midas
> > +  - const: samsung,exynos4412
> > +  - const: samsung,exynos4
> > +
> > +  - description: Exynos5250 based boards
> > +items:
> > +  - enum:
> > +  - google,snow-rev5# Google Snow Rev 5+
> > +  - google,spring   # Google Spring
> > +  - insignal,arndale# Insignal Arndale
> > +  - samsung,smdk5250# Samsung SMDK5250 eval
> > +  - const: samsung,exynos5250
> > +  - const: samsung,exynos5
> > +
> > +  - description: Google Snow Boards (R

Re: [PATCH] drivers/staging/exfat - by default, prohibit mount of fat/vfat

2019-09-02 Thread Christoph Hellwig
On Sat, Aug 31, 2019 at 06:25:21AM -0400, Valdis Klētnieks wrote:
> On Fri, 30 Aug 2019 23:46:16 -0700, Christoph Hellwig said:
> 
> > Since when did Linux kernel submissions become "show me a better patch"
> > to reject something obviously bad?
> 
> Well, do you even have a *suggestion* for a better idea?  Other than "just rip
> it out"?  Keeping in mind that:

The right approach in my opinion is to start submitting patches to fs/fat
to add exfat support.  But more importantly it is to first coordinate
with other stakeholder most importantly the fs/fat/ maintainer and the
dosfstools maintainers as our local experts for fat-like file systems
instead of shooting from the hip.

> I think at that point, we can safely say that if it mounts a vfat filesystem,
> it's because the person building the kernel has gone out of their way to
> request that it do so.

Especially with boot time automounting it could happen.  Never mind that
we do not add duplicate file system drivers (or drivers in general) to
the kernel.

> Now, if what you want is "Please make it so the fat16/fat32 code is in 
> separate
> files that aren't built unless requested", that's in fact doable and a
> reasonable request, and one that both doesn't conflict with anything other
> directions we might want to go, and also prepares the code for more easy
> separation if it's decided we really do want an exfat-only module.

No.  Assuming we even want the current codebase (which only you and
Greg seem to think so), that fat16/32 code simply has to go.

> And by the way, it seems like other filesystems rely on "others" to help out.
> Let's look at the non-merge commit for fs/ext4. And these are actual patches,
> not just reviewer comments
> 
> (For those who don't feel like scrolling - 77.6% of the non-merge ext4 commits
> are from a total of 463 somebodies other than Ted Ts'o)
> 
> Even some guy named Christoph Hellwig gave Ted Ts'o a bunch of help.

That isn't the point.  Everyone who submitted a file system had a clear
plan where they wanted to go.  You just took someone elses out of tree
code, apparently didn't even try to understand it and are not able to
come up with what your plan for it is.  And even after repeated
questions on what that plan is duck the question and instead attack the
people asking for it.


Re: [PATCH] drivers/staging/exfat - by default, prohibit mount of fat/vfat

2019-09-02 Thread Christoph Hellwig
On Sun, Sep 01, 2019 at 07:13:54PM -0400, Valdis Klētnieks wrote:
> Any recommendations on how to approach that?   Clone the current fs/fat code
> and develop on top of that, or create a branch of it and on occasion do the
> merging needed to track further fs/fat development?
> 
> Mostly asking for workflow suggestions - what's known to work well for this
> sort of situation, where we know we won't be merging until we have several
> thousand lines of new code?  And any "don't do  or you'll regret it
> later" advice is also appreciated. :)

Just try to hack it in in your local tree and see if it works at all.
Normally you should have a feeling of where this is heading at this
point and start iterating.  One it looks somewhat presentable send it
out to the list and ask for comments.


Re: [PATCH v14 5/6] sched/core: uclamp: Update CPU's refcount on TG's clamp changes

2019-09-02 Thread Peter Zijlstra
On Mon, Sep 02, 2019 at 07:44:40AM +0100, Patrick Bellasi wrote:
> On Fri, Aug 30, 2019 at 09:48:34 +, Peter Zijlstra wrote...
> > On Thu, Aug 22, 2019 at 02:28:10PM +0100, Patrick Bellasi wrote:

> >> +  rq = task_rq_lock(p, &rf);
> >
> > Since modifying cgroup parameters is priv only, this should be OK I
> > suppose. Priv can already DoS the system anyway.
> 
> Are you referring to the possibility to DoS the scheduler by keep
> writing cgroup attributes?

Yep.

> Because, in that case I think cgroup attributes could be written also by
> non priv users. It all depends on how they are mounted and permissions
> are set. Isn't it?
> 
> Anyway, I'm not sure we can fix that here... and in principle we could
> have that DoS by setting CPUs affinities, which is user exposed.
> Isn't it?

Only for a single task; by using the cgroup thing we have that in-kernel
iteration of tasks.

The thing I worry about is bouncing rq->lock around the system; but
yeah, I suppose a normal user could achieve something similar with
enough tasks.

> >> +  /*
> >> +   * Setting the clamp bucket is serialized by task_rq_lock().
> >> +   * If the task is not yet RUNNABLE and its task_struct is not
> >> +   * affecting a valid clamp bucket, the next time it's enqueued,
> >> +   * it will already see the updated clamp bucket value.
> >> +   */
> >> +  if (!p->uclamp[clamp_id].active)
> >> +  goto done;
> >> +
> >> +  uclamp_rq_dec_id(rq, p, clamp_id);
> >> +  uclamp_rq_inc_id(rq, p, clamp_id);
> >> +
> >> +done:
> >
> > I'm thinking that:
> >
> > if (p->uclamp[clamp_id].active) {
> > uclamp_rq_dec_id(rq, p, clamp_id);
> > uclamp_rq_inc_id(rq, p, clamp_id);
> > }
> >
> > was too obvious? ;-)
> 
> Yep, right... I think there was some more code in prev versions but I
> forgot to get rid of that "goto" pattern after some change.

OK, already fixed that.


Re: [PATCH] Add support for Macronix NAND randomizer

2019-09-02 Thread masonccyang


Hi Richard,
 
> Subject
> 
> Re: [PATCH] Add support for Macronix NAND randomizer
> 
> On Mon, Sep 2, 2019 at 8:54 AM  wrote:
> > > > nand@0 {
> > > > reg = <0>;
> > > > nand-reliability = "randomizer";
> > >
> > >   mxic,enable-randomizer-otp;
> > >
> > > Would be better (with the proper documentation in the bindings).
> > >
> >
> > okay, thanks for your opinions.
> 
> Please document also when/why one wants to enable the randomizer.

okay, sure.

> 
> -- 
> Thanks,
> //richard

best regards,
Mason

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=





CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or 
personal data, which is protected by applicable laws. Please be reminded that 
duplication, disclosure, distribution, or use of this e-mail (and/or its 
attachments) or any part thereof is prohibited. If you receive this e-mail in 
error, please notify us immediately and delete this mail as well as its 
attachment(s) from your system. In addition, please be informed that 
collection, processing, and/or use of personal data is prohibited unless 
expressly permitted by personal data protection laws. Thank you for your 
attention and cooperation.

Macronix International Co., Ltd.

=



Re: [PATCH] Parallel microcode update in Linux

2019-09-02 Thread Pavel Machek
Hi!

> >> +   u64 p0, p1;
> >>int ret;
> >> 
> >>atomic_set(&late_cpus_in,  0);
> >>atomic_set(&late_cpus_out, 0);
> >> 
> >> +   p0 = rdtsc_ordered();
> >> +
> >>ret = stop_machine_cpuslocked(__reload_late, NULL, cpu_online_mask);
> >> +
> >> +   p1 = rdtsc_ordered();
> >> +
> >>if (ret > 0)
> >>microcode_check();
> >> 
> >>pr_info("Reload completed, microcode revision: 0x%x\n", 
> >> boot_cpu_data.microcode);
> >> 
> >> +   pr_info("p0: %lld, p1: %lld, diff: %lld\n", p0, p1, p1 - p0);
> >> +
> >>return ret;
> >> }
> >> 
> >> We have used a machine with a broken microcode in BIOS and no microcode in
> >> initramfs (to bypass early loading).
> >> 
> >> Here are the results for parallel loading (we made two measurements):
> > 
> >> [   18.197760] microcode: updated to revision 0x25e, date = 2019-04-02
> >> [   18.201225] x86/CPU: CPU features have changed after loading microcode, 
> >> but might not take effect.
> >> [   18.201230] microcode: Reload completed, microcode revision: 0x25e
> >> [   18.201232] microcode: p0: 118138123843052, p1: 118138153732656, diff: 
> >> 29889604
> > 
> >> Here are the results of serial loading:
> >> 
> >> [   17.542518] microcode: updated to revision 0x25e, date = 2019-04-02
> >> [   17.898365] x86/CPU: CPU features have changed after loading microcode, 
> >> but might not take effect.
> >> [   17.898370] microcode: Reload completed, microcode revision: 0x25e
> >> [   17.898372] microcode: p0: 149220216047388, p1: 149221058945422, diff: 
> >> 842898034
> >> 
> >> One can see that the difference is an order magnitude.
> > 
> > Well, that's impressive, but it seems to finish 300 msec later? Where does 
> > that difference
> > come from / how much real time do you gain by this?
> 
> The difference comes from the large amount of cores/threads the machine has: 
> 72 in this case, but there are machines with more. As the commit message says 
> initially the microcode was applied serially one by one and now the microcode 
> is updated in parallel on all cores.
> 
> 300ms seems nothing but it is enough to cause disruption in some critical 
> services (e.g. storage) - 300ms in which we do not execute anything on CPUs. 
> Also this 300ms is increasing when the machine is fully loaded with guests.
> 

Yes, but if you look at the dmesgs I quoted, paralel microcode update
actually finished 300msec _later_.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: linux-next: Fixes tag needs some work in the battery tree

2019-09-02 Thread Michael Nosthoff
Hi Sebastian,

I think you missed that the second commit

38fa8b9f75ea ("power: supply: sbs-battery: use correct flags field")

also needs this fix.


Regards,
Michael

On Monday, September 02, 2019 09:10 CEST, Sebastian Reichel  
wrote:

> Hi Stephen,
>
> On Mon, Sep 02, 2019 at 09:31:31AM +1000, Stephen Rothwell wrote:
> > In commit
> >
> > b19aca4eb2d2 ("power: supply: sbs-battery: only return health when battery 
> > present")
> >
> > [...]
> >
> > Please do not split Fixes tags over more than one line.
>
> I have fixed this and rebased the branch, so the issue should be
> gone tomororw. Thanks for the notice,
>
> -- Sebastian



Re: [PATCH] riscv: add arch/riscv/Kbuild

2019-09-02 Thread Christoph Hellwig
On Sat, Aug 31, 2019 at 10:04:53PM +0900, Masahiro Yamada wrote:
> Kbuild support two file names, "Makefile" and "Kbuild"
> for describing obj-y, obj-m, etc.



> Similarly, arch/$(SRCARCH)/Makefile is very special
> in that it is included from the top-level Makefile,
> and specify arch-specific compiler flags etc.
> 
> We can use arch/$(SRCARCH)/Kbuild
> to specify obj-y, obj-m.
> The top-level Makefile does not need to know
> the directory structure under arch/$(SRCARCH)/.
> 
> This is logical separation.

But only if we document this specific split and eventually stop allowing 
to build objects from arch/$(SRCARCH)/Makefile.  And in my perfect world
we'd eventually phase out the magic arch/$(SRCARCH)/Makefile entireŀy.
In addition to the normal Kbuild file we'd then have say (names entirely
made up and probably not the best idea)

  arch/$(SRCARCH)/flags.mk to set the various compiler flags and co
  arch/$(SRCARCH)/targets.mk for extra arch-specific targets


Re: [PATCH v1 1/2] clk: intel: Add CGU clock driver for a new SoC

2019-09-02 Thread Tanwar, Rahul



Hi Andy,

Thanks for your review comments.

On 28/8/2019 11:09 PM, Andy Shevchenko wrote:

On Wed, Aug 28, 2019 at 03:00:17PM +0800, Rahul Tanwar wrote:

From: rtanwar 

Clock Generation Unit(CGU) is a new clock controller IP of a forthcoming
Intel network processor SoC. It provides programming interfaces to control
& configure all CPU & peripheral clocks. Add common clock framework based
clock controller driver for CGU.
  drivers/clk/intel/Kconfig   |  13 +
  drivers/clk/intel/Makefile  |   4 +

Any plans what to do with existing x86 folder there?



I checked the x86 folder. This driver's clock controller IP is totally

different than other clock drivers inside x86. So having a common

driver source is not a option. It is of course possible to move this

driver inside x86 folder. Please let me know if you think moving

this driver inside x86 folder makes more sense.


+++ b/drivers/clk/intel/Kconfig
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0
+config INTEL_LGM_CGU_CLK
+   depends on COMMON_CLK
+   select MFD_SYSCON
+   select OF_EARLY_FLATTREE
+   bool "Intel Clock Genration Unit support"

Is it for X86? Don't you need a dependency?



Yes agree, will update in v2.


+/*
+ * Calculate formula:
+ * rate = (prate * mult + (prate * frac) / frac_div) / div
+ */
+static unsigned long
+intel_pll_calc_rate(unsigned long prate, unsigned int mult,
+   unsigned int div, unsigned int frac, unsigned int frac_div)
+{
+   u64 crate, frate, rate64;
+
+   rate64 = prate;
+   crate = rate64 * mult;
+
+   if (frac) {

This seems unnecessary.
I think you would like to check for frac_div instead?
Though I would rather to use frac = 0, frac_div = 1 and drop this conditional
completely.



frac_div value is fixed to BIT(24) i.e. always a non zero value. mult & div

are directly read from registers and by design the register values for

mult & div is also always a non zero value. However, frac can logically

be zero. So, I still find if (frac) condition most suitable here.


+   frate = rate64 * frac;
+   do_div(frate, frac_div);
+   crate += frate;
+   }
+   do_div(crate, div);
+
+   return (unsigned long)crate;
+}
+static struct clk_hw
+*intel_clk_register_pll(struct intel_clk_provider *ctx,

* is part of type.



Yes, will update in v2.


+   const struct intel_pll_clk_data *list)
+{
+   struct clk_init_data init;
+   struct intel_clk_pll *pll;
+   struct device *dev = ctx->dev;
+   struct clk_hw *hw;
+   int ret;
+
+   init.ops = &intel_lgm_pll_ops;
+   init.name = list->name;
+   init.parent_names = list->parent_names;
+   init.num_parents = list->num_parents;
+
+   pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL);
+   if (!pll)
+   return ERR_PTR(-ENOMEM);
+
+   pll->map = ctx->map;
+   pll->dev = ctx->dev;
+   pll->reg = list->reg;
+   pll->flags = list->flags;
+   pll->type = list->type;
+   pll->hw.init = &init;
+
+   hw = &pll->hw;

Seems redundant temporary variable.



Agree, will update in v2.


+   ret = clk_hw_register(dev, hw);
+   if (ret)
+   return ERR_PTR(ret);
+
+   return hw;
+}
+void intel_clk_register_plls(struct intel_clk_provider *ctx,
+const struct intel_pll_clk_data *list,
+   unsigned int nr_clk)

Indentation issues.



Will fix in v2.


+{
+   struct clk_hw *hw;
+   int i;
+
+   for (i = 0; i < nr_clk; i++, list++) {
+   hw = intel_clk_register_pll(ctx, list);
+   if (IS_ERR(hw)) {
+   dev_err(ctx->dev, "failed to register pll: %s\n",
+   list->name);

Is it fatal or not?



Agree that its fatal if PLL registration fails, just that its highly 
unlikely.


I will modify it to return error & make probe fail in failure cases.


+   continue;
+   }
+
+   intel_clk_add_lookup(ctx, hw, list->id);
+   }

No error to return? Are all PLLs optional?



Will change it to return error code.


+}
+#endif /* __INTEL_CLK_PLL_H */

One TAB is enough.



Will fix in v2.


+/*
+ *  Copyright (C) 2018 Intel Corporation.
+ *  Zhu YiXin 

On space after asterisk is enough.



Will fix in v2.


+ */
+#define to_intel_clk_divider(_hw) \
+   container_of(_hw, struct intel_clk_divider, hw)

One TAB is enough.



Will fix in v2.


+   pr_debug("Add clk: %s, id: %u\n", clk_hw_get_name(hw), id);

Is this useful?



Yes, IMO, this proves very useful for system wide clock issues

debugging during bootup.


+/*
+ * Below table defines the pair's of regval & effective dividers.
+ * It's more efficient to provide an explicit table due to non-linear
+ * relation between values.
+ */
+static const struct clk_div_table pll_div[] = {

Does val == 0 follows the t

Re: [PATCH 1/4] regulator: provide regulator_bulk_set_supply_names()

2019-09-02 Thread kbuild test robot
Hi Bartosz,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/regulator-add-and-use-a-helper-for-setting-supply-names/20190901-140224
config: c6x-evmc6678_defconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=c6x 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   drivers/of/platform.o: In function `regulator_bulk_set_supply_names':
>> platform.c:(.text+0xc80): multiple definition of 
>> `regulator_bulk_set_supply_names'
   drivers/usb/phy/of.o:of.c:(.text+0xa8): first defined here

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


RE: [PATCH 1/2] habanalabs: add uapi to retrieve device utilization

2019-09-02 Thread Omer Shpigelman
From: Oded Gabbay 
Sent: Friday, 30 August 2019 13:57

> Users and sysadmins usually want to know what is the device utilization as a
> level 0 indication if they are efficiently using the device.
> 
> Add a new opcode to the INFO IOCTL that will return the device utilization
> over the last period of 100-1000ms. The return value is 0-100, representing as
> percentage the total utilization rate.
> 
> Signed-off-by: Oded Gabbay 

Reviewed-by: Omer Shpigelman 


Re: [PATCH v14 1/6] sched/core: uclamp: Extend CPU's cgroup controller

2019-09-02 Thread Peter Zijlstra
On Mon, Sep 02, 2019 at 07:38:53AM +0100, Patrick Bellasi wrote:
> 
> On Fri, Aug 30, 2019 at 09:45:05 +, Peter Zijlstra wrote...
> 
> > On Thu, Aug 22, 2019 at 02:28:06PM +0100, Patrick Bellasi wrote:
> >> +#define _POW10(exp) ((unsigned int)1e##exp)
> >> +#define POW10(exp) _POW10(exp)
> >
> > What is this magic? You're forcing a float literal into an integer.
> > Surely that deserves a comment!
> 
> Yes, I'm introducing the two constants:
>   UCLAMP_PERCENT_SHIFT,
>   UCLAMP_PERCENT_SCALE
> similar to what we have for CAPACITY. Moreover, I need both 100*100 (for
> the scale) and 100 further down in the code for the: 

Ooh, right you are. I clearly was in need of weekend. Somehow I read
that code as if you were forcing the float representation into an
integer, which is not what you do.

>   percent = div_u64_rem(percent, POW10(UCLAMP_PERCENT_SHIFT), &rem);
> 
> used in cpu_uclamp_print().
> 
> That's why adding a compile time support to compute a 10^N is useful.
> 
> C provides the "1eN" literal, I just convert it to integer and to do
> that at compile time I need a two level macros.
> 
> What if I add this comment just above the macro definitions:
> 
> /*
>  * Integer 10^N with a given N exponent by casting to integer the literal 
> "1eN"
>  * C expression. Since there is no way to convert a macro argument (N) into a
>  * character constant, use two levels of macros.
>  */
> 
> is this clear enough?

Yeah, let me go add that.

> >
> >> +struct uclamp_request {
> >> +#define UCLAMP_PERCENT_SHIFT  2
> >> +#define UCLAMP_PERCENT_SCALE  (100 * POW10(UCLAMP_PERCENT_SHIFT))
> >> +  s64 percent;
> >> +  u64 util;
> >> +  int ret;
> >> +};
> >> +
> >> +static inline struct uclamp_request
> >> +capacity_from_percent(char *buf)
> >> +{
> >> +  struct uclamp_request req = {
> >> +  .percent = UCLAMP_PERCENT_SCALE,
> >> +  .util = SCHED_CAPACITY_SCALE,
> >> +  .ret = 0,
> >> +  };
> >> +
> >> +  buf = strim(buf);
> >> +  if (strncmp("max", buf, 4)) {
> >
> > That is either a bug, and you meant to write: strncmp(buf, "max", 3),
> > or it is not, and then you could've written: strcmp(buf, "max")
> 
> I don't think it's a bug.
> 
> The usage of 4 is intentional, to force a '\0' check while using
> strncmp(). Otherwise, strncmp(buf, "max", 3) would accept also strings
> starting by "max", which we don't want.

Right; I figured.

> > But as written it doesn't make sense.
> 
> The code is safe but I agree that strcmp() does just the same and it
> does not generate confusion. That's actually a pretty good example
> on how it's not always better to use strncmp() instead of strcmp().

OK, I made it strcmp(), because that is what I figured was the intended
semantics.


Re: [PATCH] phy: tegra: xusb: remove unused variable

2019-09-02 Thread Thierry Reding
On Mon, Sep 02, 2019 at 11:15:59AM +0800, Chunfeng Yun wrote:
> The local variable @priv is set but not used, can be removed
> 
> Signed-off-by: Chunfeng Yun 
> ---
>  drivers/phy/tegra/xusb-tegra210.c | 3 ---
>  1 file changed, 3 deletions(-)

Acked-by: Thierry Reding 


signature.asc
Description: PGP signature


RE: [PATCH 2/2] habanalabs: add uapi to retrieve aggregate H/W events

2019-09-02 Thread Omer Shpigelman
From: Oded Gabbay 
Sent: Friday, 30 August 2019 13:57

> Add a new opcode to INFO IOCTL to retrieve aggregate H/W events. i.e. the
> events counters are NOT cleared upon device reset, but count from the
> loading of the driver.
> 
> Add the code to support it in the device event handling function.
> 
> Signed-off-by: Oded Gabbay 

Reviewed-by: Omer Shpigelman 


RE: [PATCH] habanalabs: display card name as sensors header

2019-09-02 Thread Omer Shpigelman
From: Oded Gabbay 
Sent: Friday, 30 August 2019 16:34

> To allow the user to use a custom file for the HWMON lm-sensors library per
> card type, the driver needs to register the HWMON sensors with the specific
> card type name.
> 
> The card name is supplied by the F/W running on the device. If the F/W is old
> and doesn't supply a card name, a default card name is displayed as the
> sensors group name.
> 
> Signed-off-by: Oded Gabbay 

Reviewed-by: Omer Shpigelman 


Re: Problem when function alarmtimer_suspend returns 0 if time delta is zero

2019-09-02 Thread Alexandre Belloni
Hello Michael,

This code is maintained by the timekeeping maintainers, now in Cc and I
think John will be able to answer.

On 31/08/2019 20:32:06+0200, Michael wrote:
> Dear members of the linux-rtc list,
> 
> currently I have a problem with the alarmtimer i'm using to cyclically wake
> up my i.MX6 ULL board from suspend to RAM.
> 
> The problem is that in principle the timer wake ups work fine but seem to be
> not 100% stable. In about 1 percent the wake up alarm from suspend is
> missing.
> 
> When I look at the code of alarmtimer in function alarmtimer_suspend
> (kernel/time/alarmtimer.c)
> I find the following:
> 
> 
> 
> /* Find the soonest timer to expire*/
> 
>     for (i = 0; i < ALARM_NUMTYPE; i++) {
>         struct alarm_base *base = &alarm_bases[i];
>         struct timerqueue_node *next;
>         ktime_t delta;
> 
>         spin_lock_irqsave(&base->lock, flags);
>         next = timerqueue_getnext(&base->timerqueue);
>         spin_unlock_irqrestore(&base->lock, flags);
>         if (!next)
>             continue;
>         delta = ktime_sub(next->expires, base->gettime());
>         if (!min || (delta < min)) {
>             expires = next->expires;
>             min = delta;
>             type = i;
>         }
>     }
>     if (min == 0)
>         return 0;
> 
>     if (ktime_to_ns(min) < 2 * NSEC_PER_SEC) {
>         __pm_wakeup_event(ws, 2 * MSEC_PER_SEC);
>         return -EBUSY;
>     }
> 
> In my error case the alarm wake up always fails if the path "if(min==0)" is
> entered. If I understand this code correctly that means that
> when ever one of the timers in the list has a remaining tick time of zero,
> the function just returns 0 and continues the suspend process until
> it reaches suspend mode.
> 
> If I implement a hack here "if(min == 0) {min = 1;}" and do not return, my
> system runs 100% ok, as the following -EBUSY path is hit.
> 
> So my question to you is: Why is there a check if min < 2 seconds and do a
> return -EBUSY here, but handle (min==0) differently?
> Could there be some race condition here, where the function
> alarmtimer_suspend just returns 0 and shortly after this the alarmtimer
> expires
> right before the RTC driver was able to allow the wake up interrupt?
> 
> If I look through the kernel versions I found the alarmtimer_suspend to be a
> very stable function, so I don't think there is anything wrong here.
> 
> But do you have a hint for me where else I could have a look to encircle the
> error?
> 
> Thank you very much!
> 
> Br,
> Michael
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH -next] PCI: Use GFP_ATOMIC in resource_alignment_store()

2019-09-02 Thread Christoph Hellwig
On Sat, Aug 31, 2019 at 12:49:32PM +, YueHaibing wrote:
> When allocating memory, the GFP_KERNEL cannot be used during the
> spin_lock period. It may cause scheduling when holding spin_lock.
> 
> Fixes: f13755318675 ("PCI: Move pci_[get|set]_resource_alignment_param() into 
> their callers")
> Signed-off-by: YueHaibing 
> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 484e35349565..0b5fc6736f3f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -6148,7 +6148,7 @@ static ssize_t resource_alignment_store(struct bus_type 
> *bus,
>   spin_lock(&resource_alignment_lock);
>  
>   kfree(resource_alignment_param);
> - resource_alignment_param = kstrndup(buf, count, GFP_KERNEL);
> + resource_alignment_param = kstrndup(buf, count, GFP_ATOMIC);
>  
>   spin_unlock(&resource_alignment_lock);

Why not move the allocation outside the lock? Something like this
seems much more sensible:


diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 484e35349565..fe205829f676 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6145,14 +6145,16 @@ static ssize_t resource_alignment_show(struct bus_type 
*bus, char *buf)
 static ssize_t resource_alignment_store(struct bus_type *bus,
const char *buf, size_t count)
 {
-   spin_lock(&resource_alignment_lock);
+   char *param = kstrndup(buf, count, GFP_KERNEL);
 
-   kfree(resource_alignment_param);
-   resource_alignment_param = kstrndup(buf, count, GFP_KERNEL);
+   if (!param)
+   return -ENOMEM;
 
+   spin_lock(&resource_alignment_lock);
+   kfree(resource_alignment_param);
+   resource_alignment_param = param;
spin_unlock(&resource_alignment_lock);
-
-   return resource_alignment_param ? count : -ENOMEM;
+   return count;
 }
 
 static BUS_ATTR_RW(resource_alignment);


[PATCH 1/2] habanalabs: stop using the acronym KMD

2019-09-02 Thread Oded Gabbay
We want to stop using the acronym KMD. Therefore, replace all locations
(except for register names we can't modify) where KMD is written to other
terms such as "Linux kernel driver" or "Host kernel driver", etc.

Signed-off-by: Oded Gabbay 
---
 drivers/misc/habanalabs/asid.c   |  2 +-
 drivers/misc/habanalabs/command_buffer.c |  3 +-
 drivers/misc/habanalabs/command_submission.c |  5 +-
 drivers/misc/habanalabs/context.c|  2 +-
 drivers/misc/habanalabs/goya/goya.c  | 22 +++---
 drivers/misc/habanalabs/goya/goyaP.h | 14 ++--
 drivers/misc/habanalabs/habanalabs.h | 32 -
 drivers/misc/habanalabs/include/armcp_if.h   | 70 ++--
 include/uapi/misc/habanalabs.h   | 22 +++---
 9 files changed, 88 insertions(+), 84 deletions(-)

diff --git a/drivers/misc/habanalabs/asid.c b/drivers/misc/habanalabs/asid.c
index 2c01461701a3..a2fdf31cf27c 100644
--- a/drivers/misc/habanalabs/asid.c
+++ b/drivers/misc/habanalabs/asid.c
@@ -18,7 +18,7 @@ int hl_asid_init(struct hl_device *hdev)
 
mutex_init(&hdev->asid_mutex);
 
-   /* ASID 0 is reserved for KMD and device CPU */
+   /* ASID 0 is reserved for the kernel driver and device CPU */
set_bit(0, hdev->asid_bitmap);
 
return 0;
diff --git a/drivers/misc/habanalabs/command_buffer.c 
b/drivers/misc/habanalabs/command_buffer.c
index e495f44064fa..53fddbd8e693 100644
--- a/drivers/misc/habanalabs/command_buffer.c
+++ b/drivers/misc/habanalabs/command_buffer.c
@@ -397,7 +397,8 @@ struct hl_cb *hl_cb_kernel_create(struct hl_device *hdev, 
u32 cb_size)
rc = hl_cb_create(hdev, &hdev->kernel_cb_mgr, cb_size, &cb_handle,
HL_KERNEL_ASID_ID);
if (rc) {
-   dev_err(hdev->dev, "Failed to allocate CB for KMD %d\n", rc);
+   dev_err(hdev->dev,
+   "Failed to allocate CB for the kernel driver %d\n", rc);
return NULL;
}
 
diff --git a/drivers/misc/habanalabs/command_submission.c 
b/drivers/misc/habanalabs/command_submission.c
index 4777ec4c2b55..a9ac045dcfde 100644
--- a/drivers/misc/habanalabs/command_submission.c
+++ b/drivers/misc/habanalabs/command_submission.c
@@ -409,8 +409,9 @@ static struct hl_cb *validate_queue_index(struct hl_device 
*hdev,
return NULL;
}
 
-   if (hw_queue_prop->kmd_only) {
-   dev_err(hdev->dev, "Queue index %d is restricted for KMD\n",
+   if (hw_queue_prop->driver_only) {
+   dev_err(hdev->dev,
+   "Queue index %d is restricted for the kernel driver\n",
chunk->queue_index);
return NULL;
} else if (hw_queue_prop->type == QUEUE_TYPE_INT) {
diff --git a/drivers/misc/habanalabs/context.c 
b/drivers/misc/habanalabs/context.c
index bc0dec57a983..17db7b3dfb4c 100644
--- a/drivers/misc/habanalabs/context.c
+++ b/drivers/misc/habanalabs/context.c
@@ -128,7 +128,7 @@ int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, 
bool is_kernel_ctx)
ctx->thread_ctx_switch_wait_token = 0;
 
if (is_kernel_ctx) {
-   ctx->asid = HL_KERNEL_ASID_ID; /* KMD gets ASID 0 */
+   ctx->asid = HL_KERNEL_ASID_ID; /* Kernel driver gets ASID 0 */
rc = hl_mmu_ctx_init(ctx);
if (rc) {
dev_err(hdev->dev, "Failed to init mmu ctx module\n");
diff --git a/drivers/misc/habanalabs/goya/goya.c 
b/drivers/misc/habanalabs/goya/goya.c
index c88c2fea97b9..6fba14b81f90 100644
--- a/drivers/misc/habanalabs/goya/goya.c
+++ b/drivers/misc/habanalabs/goya/goya.c
@@ -42,8 +42,8 @@
  * PQ, CQ and CP are not secured.
  * PQ, CB and the data are on the SRAM/DRAM.
  *
- * Since QMAN DMA is secured, KMD is parsing the DMA CB:
- * - KMD checks DMA pointer
+ * Since QMAN DMA is secured, the driver is parsing the DMA CB:
+ * - checks DMA pointer
  * - WREG, MSG_PROT are not allowed.
  * - MSG_LONG/SHORT are allowed.
  *
@@ -56,15 +56,15 @@
  * QMAN DMA: PQ, CQ and CP are secured.
  * MMU is set to bypass on the Secure props register of the QMAN.
  * The reasons we don't enable MMU for PQ, CQ and CP are:
- * - PQ entry is in kernel address space and KMD doesn't map it.
+ * - PQ entry is in kernel address space and the driver doesn't map it.
  * - CP writes to MSIX register and to kernel address space (completion
  *   queue).
  *
- * DMA is not secured but because CP is secured, KMD still needs to parse the
- * CB, but doesn't need to check the DMA addresses.
+ * DMA is not secured but because CP is secured, the driver still needs to 
parse
+ * the CB, but doesn't need to check the DMA addresses.
  *
- * For QMAN DMA 0, DMA is also secured because only KMD uses this DMA and KMD
- * doesn't map memory in MMU.
+ * For QMAN DMA 0, DMA is also secured because only the driver uses this DMA 
and
+ * the driver doesn't map memory in MMU.
  *
  * QMAN TPC

[PATCH 2/2] habanalabs: show correct id in error print

2019-09-02 Thread Oded Gabbay
If the initialization of a device failed, the driver prints an error
message with the id of the device. The device index on the file system is
that id divided by 2.

Signed-off-by: Oded Gabbay 
---
 drivers/misc/habanalabs/device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c
index bc98032cc4ec..e9f5a0e45183 100644
--- a/drivers/misc/habanalabs/device.c
+++ b/drivers/misc/habanalabs/device.c
@@ -1290,10 +1290,10 @@ int hl_device_init(struct hl_device *hdev, struct class 
*hclass)
if (hdev->pdev)
dev_err(&hdev->pdev->dev,
"Failed to initialize hl%d. Device is NOT usable !\n",
-   hdev->id);
+   hdev->id / 2);
else
pr_err("Failed to initialize hl%d. Device is NOT usable !\n",
-   hdev->id);
+   hdev->id / 2);
 
return rc;
 }
-- 
2.17.1



Re: [PATCH 08/15] sched,fair: simplify timeslice length code

2019-09-02 Thread Vincent Guittot
On Fri, 30 Aug 2019 at 17:02, Rik van Riel  wrote:
>
> On Fri, 2019-08-30 at 08:41 +0200, Vincent Guittot wrote:
>
> > > When tasks get their timeslice rounded up, that will increase
> > > the total sched period in a similar way the old code did by
> > > returning a longer period from __sched_period.
> >
> > sched_slice is not a strict value and scheduler will not schedule out
> > the task after the sched_slice (unless you enable HRTICK which is
> > disable by default). Instead it will wait for next tick to change the
> > running task
> >
> > sched_slice is mainly use to ensure a minimum running time in a row.
> > With this change, the running time of the high priority task will
> > most
> > probably be split in several slice instead of one
>
> I would be more than happy to drop this patch if you
> prefer. Just let me know.

If i'm  not wrong, this change is not mandatory to flatten the
runqueue and because of the possible impact if you would prefer to
drop it from this serie

Regards,
Vincent

>
> --
> All Rights Reversed.


Re: [PATCH 3/3] pmbus: ibm-cffps: Add support for version 2 of the PSU

2019-09-02 Thread kbuild test robot
Hi Eddie,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Eddie-James/pmbus-ibm-cffps-Add-support-for-version-2-of-PSU/20190901-151755
config: x86_64-randconfig-s0-09021304 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All warnings (new ones prefixed by >>):

   drivers/hwmon/pmbus/ibm-cffps.c: In function 'ibm_cffps_probe':
>> drivers/hwmon/pmbus/ibm-cffps.c:404:8: warning: cast from pointer to integer 
>> of different size [-Wpointer-to-int-cast]
  vs = (int)md;
   ^

vim +404 drivers/hwmon/pmbus/ibm-cffps.c

   393  
   394  static int ibm_cffps_probe(struct i2c_client *client,
   395 const struct i2c_device_id *id)
   396  {
   397  int i, rc, vs;
   398  struct dentry *debugfs;
   399  struct dentry *ibm_cffps_dir;
   400  struct ibm_cffps *psu;
   401  const void *md = of_device_get_match_data(&client->dev);
   402  
   403  if (md)
 > 404  vs = (int)md;
   405  else if (id)
   406  vs = (int)id->driver_data;
   407  else
   408  vs = 1;
   409  
   410  client->dev.platform_data = &ibm_cffps_pdata;
   411  rc = pmbus_do_probe(client, id, &ibm_cffps_info[vs - 1]);
   412  if (rc)
   413  return rc;
   414  
   415  /*
   416   * Don't fail the probe if there isn't enough memory for leds 
and
   417   * debugfs.
   418   */
   419  psu = devm_kzalloc(&client->dev, sizeof(*psu), GFP_KERNEL);
   420  if (!psu)
   421  return 0;
   422  
   423  psu->version = vs;
   424  psu->client = client;
   425  mutex_init(&psu->input_history.update_lock);
   426  psu->input_history.last_update = jiffies - HZ;
   427  
   428  ibm_cffps_create_led_class(psu);
   429  
   430  /* Don't fail the probe if we can't create debugfs */
   431  debugfs = pmbus_get_debugfs_dir(client);
   432  if (!debugfs)
   433  return 0;
   434  
   435  ibm_cffps_dir = debugfs_create_dir(client->name, debugfs);
   436  if (!ibm_cffps_dir)
   437  return 0;
   438  
   439  for (i = 0; i < CFFPS_DEBUGFS_NUM_ENTRIES; ++i)
   440  psu->debugfs_entries[i] = i;
   441  
   442  debugfs_create_file("input_history", 0444, ibm_cffps_dir,
   443  
&psu->debugfs_entries[CFFPS_DEBUGFS_INPUT_HISTORY],
   444  &ibm_cffps_fops);
   445  debugfs_create_file("fru", 0444, ibm_cffps_dir,
   446  &psu->debugfs_entries[CFFPS_DEBUGFS_FRU],
   447  &ibm_cffps_fops);
   448  debugfs_create_file("part_number", 0444, ibm_cffps_dir,
   449  &psu->debugfs_entries[CFFPS_DEBUGFS_PN],
   450  &ibm_cffps_fops);
   451  debugfs_create_file("serial_number", 0444, ibm_cffps_dir,
   452  &psu->debugfs_entries[CFFPS_DEBUGFS_SN],
   453  &ibm_cffps_fops);
   454  debugfs_create_file("ccin", 0444, ibm_cffps_dir,
   455  &psu->debugfs_entries[CFFPS_DEBUGFS_CCIN],
   456  &ibm_cffps_fops);
   457  debugfs_create_file("fw_version", 0444, ibm_cffps_dir,
   458  &psu->debugfs_entries[CFFPS_DEBUGFS_FW],
   459  &ibm_cffps_fops);
   460  
   461  return 0;
   462  }
   463  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] iwlwifi: mvm: Move static keyword to the front of declarations

2019-09-02 Thread Luca Coelho
On Sun, 2019-09-01 at 00:01 +0200, Krzysztof Wilczynski wrote:
> Move the static keyword to the front of declarations of
> he_if_types_ext_capa_sta and he_iftypes_ext_capa, and
> resolve the following compiler warnings that can be seen
> when building with warnings enabled (W=1):
> 
> drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:427:1: warning:
>   ‘static’ is not at beginning of declaration [-Wold-style-declaration]
> 
> drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:434:1: warning:
>   ‘static’ is not at beginning of declaration [-Wold-style-declaration]
> 
> Signed-off-by: Krzysztof Wilczynski 
> ---
> Related: https://lore.kernel.org/r/20190827233017.gk9...@google.com
> 
>  drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c 
> b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> index d6499763f0dd..937a843fed56 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
> @@ -424,14 +424,14 @@ int iwl_mvm_init_fw_regd(struct iwl_mvm *mvm)
>   return ret;
>  }
>  
> -const static u8 he_if_types_ext_capa_sta[] = {
> +static const u8 he_if_types_ext_capa_sta[] = {
>[0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
>[2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
>[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
>[9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
>  };
>  
> -const static struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
> +static const struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
>   {
>   .iftype = NL80211_IFTYPE_STATION,
>   .extended_capabilities = he_if_types_ext_capa_sta,

Thanks for your patch! Though we already have this change in our
internal tree (submitted by YueHaibing) and it will reach the mainline
soon.

--
Cheers,
Luca.



Re: [Xen-devel] [PATCH] x86/xen/efi: Fix EFI variable 'name' type conversion

2019-09-02 Thread Jan Beulich
On 01.09.2019 08:58, Adam Zerella wrote:
> This resolves a type conversion from 'char *' to 'unsigned short'.

Could you explain this? There's no ...

> --- a/arch/x86/xen/efi.c
> +++ b/arch/x86/xen/efi.c
> @@ -118,8 +118,8 @@ static enum efi_secureboot_mode 
> xen_efi_get_secureboot(void)
>   unsigned long size;
>  
>   size = sizeof(secboot);
> - status = efi.get_variable(L"SecureBoot", &efi_variable_guid,
> -   NULL, &size, &secboot);
> + status = efi.get_variable((efi_char16_t *)L"SecureBoot",
> +   &efi_variable_guid, NULL, &size, &secboot);

... "char *" resulting as type for L"" type strings, hence there
should be no need for a cast: In fact I consider such casts
dangerous, as they may hide actual problems. To me this looks
more like something that wants fixing in sparse; the compilers,
after all, have no issue with such wide character string literals.

> @@ -158,7 +158,7 @@ static enum efi_secureboot_mode 
> xen_efi_get_secureboot(void)
>   return efi_secureboot_mode_unknown;
>  }
>  
> -void __init xen_efi_init(struct boot_params *boot_params)
> +static void __init xen_efi_init(struct boot_params *boot_params)
>  {
>   efi_system_table_t *efi_systab_xen;

If I was a maintainer of this code, I'd request this not be part
of a patch with a title being entirely unrelated to the change.

Jan


Re: ioremap cleanups

2019-09-02 Thread Geert Uytterhoeven
Hi Christoph,

On Fri, Aug 30, 2019 at 6:12 PM Christoph Hellwig  wrote:
> these are three cleanups from my generic ioremap series that needed
> a few edits, and which I'd like you to pick up through your respective
> arch trees for 5.4 if possible.

Thanks, [1/3] applied and queued for v5.4 in the m68k tree.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: linux-next: Tree for Aug 30

2019-09-02 Thread Christoph Hellwig
On Sun, Sep 01, 2019 at 11:22:26AM -0700, Guenter Roeck wrote:
> On Sat, Aug 31, 2019 at 12:36:13AM +1000, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Changes since 20190829:
> > 
> > The compiler-attributes tree gained a build failure for which I reverted
> > a commit.
> > 
> > The arm-soc tree gained a conflict against the arm tree.
> > 
> > The csky tree gained a conflict against the dma-mapping tree.
> > 
> > The fuse tree gained a conflict against the fsverity tree.
> > 
> > The vfs tree gained conflicts against the fuse tree.
> > 
> > The pci tree gained a build failure for which I revereted a commit.
> > 
> > The net-next tree still had its build failure for which I applied a patch.
> > It also gained a conflict against the net tree.
> > 
> > The regulator tree still has its build failure for which I reverted
> > a commit.
> > 
> > The keys tree still has its build failure so I used the version from
> > next-20190828.
> > 
> > The driver-core tree lost its build failure.
> > 
> > The staging tree got conflicts against the net-next and usb trees.
> > 
> > The akpm-current tree gained a build failure due to an interaction with
> > the hmm tree for which I applied a patch.
> > 
> 
> Something in the fixup patch seems to be wrong. I get the following
> error with sh4 boot tests when booting from usb.
> 
> sm501-usb sm501-usb: OHCI Unrecoverable Error, disabled
> sm501-usb sm501-usb: HC died; cleaning up
> 
> Unfortunately, bisect doesn't help much (see below). Reverting the fixup
> patch as well as the offending patch (plus a context patch) alone does
> not help either. Further analysis shows that the problem exists since
> at least next-20190823. Another round of bisect on next-20190827 suggests
> another culprit (see second bisect below). Reverting all the offending
> patches doesn't help either, though, only result in a different error.
> 
> usb 1-1: new full-speed USB device number 2 using sm501-usb
> sm501-usb sm501-usb: DMA map on device without dma_mask
> 
> With that, I am giving up. Copying Christoph as he appears to be heavily
> involved in the patch series causing the problems.

What was the last tree you tested that works perfectly?


Re: [PATCH 2/3] pagewalk: separate function pointers from iterator data

2019-09-02 Thread Christoph Hellwig
On Mon, Sep 02, 2019 at 05:51:58AM +, Jason Gunthorpe wrote:
> On Sun, Sep 01, 2019 at 01:35:16PM -0700, Guenter Roeck wrote:
> > > I belive the macros above are missing brackets.. Can you confirm the
> > > below takes care of things? I'll add a patch if so
> > > 
> > 
> > Good catch. Yes, that fixes the build problem.
> 
> I added this to the hmm tree to fix it:

This looks good.  Although I still haven't figure out how this is
related to the pagewalk changes to start with..


Re: [PATCH] MAINTAINERS: N900: Remove isp1704_charger.h record

2019-09-02 Thread Sebastian Reichel
Hi,

On Tue, Aug 13, 2019 at 09:13:58AM +0300, Denis Efremov wrote:
> Update MAINTAINERS to reflect that isp1704_charger.h file was removed.
> 
> Cc: Linus Walleij 
> Cc: Pavel Machek 
> Cc: Pali Rohár 
> Cc: Sebastian Reichel 
> Cc: linux...@vger.kernel.org
> Fixes: f5d782d46aa5 ("power: supply: isp1704: switch to gpiod API")
> Signed-off-by: Denis Efremov 
> ---

Thanks, queued.

-- Sebastian

>  MAINTAINERS | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 29514fc19b01..2776e0797ae3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11400,7 +11400,6 @@ NOKIA N900 POWER SUPPLY DRIVERS
>  R:   Pali Rohár 
>  F:   include/linux/power/bq2415x_charger.h
>  F:   include/linux/power/bq27xxx_battery.h
> -F:   include/linux/power/isp1704_charger.h
>  F:   drivers/power/supply/bq2415x_charger.c
>  F:   drivers/power/supply/bq27xxx_battery.c
>  F:   drivers/power/supply/bq27xxx_battery_i2c.c
> -- 
> 2.21.0
> 


signature.asc
Description: PGP signature


Re: [RFC 2/5] media: v4l2-ctrl: Document V4L2_CID_LOCATION

2019-09-02 Thread Laurent Pinchart
Hi Pavel,

On Sun, Sep 01, 2019 at 07:24:57PM +0200, Pavel Machek wrote:
> >> @@ -510,6 +510,29 @@ enum v4l2_scene_mode -
> >>  value down. A value of zero stops the motion if one is in progress
> >>  and has no effect otherwise.
> >>
> >> +``V4L2_CID_LOCATION (integer)``
> >
> > Maybe V4L2_CID_CAMERA_SENSOR_LOCATION ? Same for the values below.
> 
>  Probably a better name, if a bit long. But we might need other location
>  controls in the future (e.g. flash location), so CID_LOCATION is just too
>  generic.
> >>>
> >> 
> >> Thanks for the feedback.
> >> 
> >>> Note that the location defines themselves can most likely be used with any
> >>> LOCATION control, so V4L2_LOCATION_FRONT would be fine with any control.
> >>>
> >> 
> >> What do you think instead of the control type? Would a single integer
> >> control do or an integer menu one would be better? I see merit in both
> >> proposals actually...
> > 
> > Single integer. It's read-only, so it just reports the location.
> > 
> > It would be different if this was a writable control: then you need to
> > know which locations are possible to set, and that requires a menu type.
> > 
> > But it doesn't make sense to set the location from software. However, the
> > location might change as a result of other changes: e.g. if the camera
> > has motor control of the tilt and the tilt changes from forward facing to
> > downward facing, then the driver might change the location from FRONT
> > to DOWN. A convoluted example perhaps, but this is just brainstorming.
> 
> There are phones with exactly such camera setup. And yes, it makes
> sense to be writable in that case, as software can move the camera in
> such case.

Out of curiosity, what phones are those ?

-- 
Regards,

Laurent Pinchart


Re: [PATCH] power: supply: ab8500_charger: Mark expected switch fall-through

2019-09-02 Thread Sebastian Reichel
Hi,

On Mon, Aug 05, 2019 at 02:44:18PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warning (Building: allmodconfig arm):
> 
> drivers/power/supply/ab8500_charger.c:738:6: warning: this statement may fall 
> through [-Wimplicit-fallthrough=]
> 
> Signed-off-by: Gustavo A. R. Silva 
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/ab8500_charger.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/power/supply/ab8500_charger.c 
> b/drivers/power/supply/ab8500_charger.c
> index 30de448de802..1be75a2fed9b 100644
> --- a/drivers/power/supply/ab8500_charger.c
> +++ b/drivers/power/supply/ab8500_charger.c
> @@ -742,6 +742,7 @@ static int ab8500_charger_max_usb_curr(struct 
> ab8500_charger *di,
>   USB_CH_IP_CUR_LVL_1P5;
>   break;
>   }
> + /* else, fall through */
>   case USB_STAT_HM_IDGND:
>   dev_err(di->dev, "USB Type - Charging not allowed\n");
>   di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
> -- 
> 2.22.0
> 


signature.asc
Description: PGP signature


Re: [PATCH] power: supply: Init device wakeup after device_add()

2019-09-02 Thread Sebastian Reichel
Hi,

On Thu, Aug 01, 2019 at 02:33:30PM -0700, Stephen Boyd wrote:
> We may want to use the device pointer in device_init_wakeup() with
> functions that expect the device to already be added with device_add().
> For example, if we were to link the device initializing wakeup to
> something in sysfs such as a class for wakeups we'll run into an error.
> It looks like this code was written with the assumption that the device
> would be added before initializing wakeup due to the order of operations
> in power_supply_unregister().
> 
> Let's change the order of operations so we don't run into problems here.
> 
> Fixes: 948dcf966228 ("power_supply: Prevent suspend until power supply events 
> are processed")
> Cc: Greg Kroah-Hartman
>   
>  
> Cc: Tri Vo 
>   
>
> Cc: Kalesh Singh   
> Cc: Ravi Chandra Sadineni 
> Cc: "Rafael J. Wysocki" 
> Cc: Viresh Kumar 
> Signed-off-by: Stephen Boyd 
> ---

Thanks, queued.

-- Sebastian

> 
> See this thread[1] for more information on how this will be necessary.
> 
> [1] https://lkml.kernel.org/r/20190731215514.212215-1-tr...@android.com
> 
> 
>  drivers/power/supply/power_supply_core.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c 
> b/drivers/power/supply/power_supply_core.c
> index 82e84801264c..5c36c430ce8b 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -1051,14 +1051,14 @@ __power_supply_register(struct device *parent,
>   }
>  
>   spin_lock_init(&psy->changed_lock);
> - rc = device_init_wakeup(dev, ws);
> - if (rc)
> - goto wakeup_init_failed;
> -
>   rc = device_add(dev);
>   if (rc)
>   goto device_add_failed;
>  
> + rc = device_init_wakeup(dev, ws);
> + if (rc)
> + goto wakeup_init_failed;
> +
>   rc = psy_register_thermal(psy);
>   if (rc)
>   goto register_thermal_failed;
> @@ -1101,8 +1101,8 @@ __power_supply_register(struct device *parent,
>   psy_unregister_thermal(psy);
>  register_thermal_failed:
>   device_del(dev);
> -device_add_failed:
>  wakeup_init_failed:
> +device_add_failed:
>  check_supplies_failed:
>  dev_set_name_failed:
>   put_device(dev);
> -- 
> Sent by a computer through tubes
> 


signature.asc
Description: PGP signature


Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-09-02 Thread Michal Hocko
On Fri 30-08-19 15:35:06, Khalid Aziz wrote:
[...]
> - Kernel is not self-tuning and is dependent upon a userspace tool to
> perform well in a fundamental area of memory management.

You keep bringing this up without an actual analysis of a wider range of
workloads that would prove that the default behavior is really
suboptimal. You are making some assumptions based on a very specific DB
workload which might benefit from a more aggressive background workload.
If you really want to sell any changes to auto tuning then you really
need to come up with more workloads and an actual theory why an early
and more aggressive reclaim pays off.
-- 
Michal Hocko
SUSE Labs


[PATCH net-next 11/13] net: stmmac: Correctly assing MAX MTU in XGMAC cores case

2019-09-02 Thread Jose Abreu
Maximum MTU for XGMAC cores is 16k thus the check for presence of XGMAC
shall be done first in order to assign correct value.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5271c6129f0e..c3baca9f587b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4542,10 +4542,10 @@ int stmmac_dvr_probe(struct device *device,
 
/* MTU range: 46 - hw-specific max */
ndev->min_mtu = ETH_ZLEN - ETH_HLEN;
-   if ((priv->plat->enh_desc) || (priv->synopsys_id >= DWMAC_CORE_4_00))
-   ndev->max_mtu = JUMBO_LEN;
-   else if (priv->plat->has_xgmac)
+   if (priv->plat->has_xgmac)
ndev->max_mtu = XGMAC_JUMBO_LEN;
+   else if ((priv->plat->enh_desc) || (priv->synopsys_id >= 
DWMAC_CORE_4_00))
+   ndev->max_mtu = JUMBO_LEN;
else
ndev->max_mtu = SKB_MAX_HEAD(NET_SKB_PAD + NET_IP_ALIGN);
/* Will not overwrite ndev->max_mtu if plat->maxmtu > ndev->max_mtu
-- 
2.7.4



[PATCH net-next 00/13] net: stmmac: Improvements for -next

2019-09-02 Thread Jose Abreu
Couple of improvements for -next tree. More info in commit logs. Some of them
includes fixes for features that are only in -next tree.

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---

Jose Abreu (13):
  net: stmmac: selftests: Return proper error code to userspace
  net: stmmac: xgmac: Add RBU handling in DMA interrupt
  net: stmmac: Do not return error code in TC Initialization
  net: stmmac: Implement L3/L4 Filters using TC Flower
  net: stmmac: selftests: Add selftest for L3/L4 Filters
  net: stmmac: xgmac: Implement ARP Offload
  net: stmmac: selftests: Implement the ARP Offload test
  net: stmmac: Only consider RX error when HW Timestamping is not
enabled
  net: stmmac: ethtool: Let user configure TX coalesce without RIWT
  net: stmmac: xgmac: Correct RAVSEL field interpretation
  net: stmmac: Correctly assing MAX MTU in XGMAC cores case
  net: stmmac: xgmac: Enable RX Jumbo frame support
  net: stmmac: selftests: Add Jumbo Frame tests

 drivers/net/ethernet/stmicro/stmmac/common.h   |   2 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h |  33 +-
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c| 205 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |   8 +-
 drivers/net/ethernet/stmicro/stmmac/hwif.h |  19 +
 drivers/net/ethernet/stmicro/stmmac/stmmac.h   |  12 +
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c   |  21 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  18 +-
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 451 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c| 247 ++-
 10 files changed, 969 insertions(+), 47 deletions(-)

-- 
2.7.4



[PATCH net-next 08/13] net: stmmac: Only consider RX error when HW Timestamping is not enabled

2019-09-02 Thread Jose Abreu
Only consider that we have an error when HW Timestamping is not enabled
as this can give false positives due to the fact the RX Timestamping in
XGMAC and GMAC cores comes from context descriptors.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c59c232aca64..5271c6129f0e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3511,9 +3511,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int 
limit, u32 queue)
&priv->xstats, rx_q->dma_erx + entry);
if (unlikely(status == discard_frame)) {
page_pool_recycle_direct(rx_q->page_pool, buf->page);
-   priv->dev->stats.rx_errors++;
buf->page = NULL;
error = 1;
+   if (!priv->hwts_rx_en)
+   priv->dev->stats.rx_errors++;
}
 
if (unlikely(error && (status & rx_not_ls)))
-- 
2.7.4



[PATCH net-next 10/13] net: stmmac: xgmac: Correct RAVSEL field interpretation

2019-09-02 Thread Jose Abreu
RAVSEL means that only RX side is available for AVB features. As we use
both TX and RX features we need to check if RAVSEL is selected and
disable AVB if only RX side is available.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index fd60bf5e0a72..53c4a40d8386 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -369,7 +369,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
dma_cap->eee = (hw_cap & XGMAC_HWFEAT_EEESEL) >> 13;
dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;
dma_cap->av = (hw_cap & XGMAC_HWFEAT_AVSEL) >> 11;
-   dma_cap->av &= (hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10;
+   dma_cap->av &= !(hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10;
dma_cap->arpoffsel = (hw_cap & XGMAC_HWFEAT_ARPOFFSEL) >> 9;
dma_cap->rmon = (hw_cap & XGMAC_HWFEAT_MMCSEL) >> 8;
dma_cap->pmt_magic_frame = (hw_cap & XGMAC_HWFEAT_MGKSEL) >> 7;
-- 
2.7.4



Re: [RFC 1/5] media: dt-bindings: Document 'location' property

2019-09-02 Thread Laurent Pinchart
Hi Pavel,

On Sun, Sep 01, 2019 at 07:24:15PM +0200, Pavel Machek wrote:
> > > +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> > > @@ -89,6 +89,10 @@ Optional properties
> > >but a number of degrees counter clockwise. Typical values are 0 and 180
> > >(upside down).
> > > 
> > > +- location: The camera device mounting position, relative to the device
> > > +  usage orientation. Possible values are:
> > > +  0 - Front camera. The image sensor is mounted on the front side of the 
> > > device.
> > > +  1 - Back camera. The image sensor is mounted on the back side of the 
> > > device.
> > 
> > Would it make sense to make this a little more generic? Such as s/image
> > sensor/ device/, for instance?
> > 
> > Is this also relevant for flash or lens devices?
> > 
> > Flash (torch) devices could be present, at least principle, without a
> > camera. There once was even such a Nokia phone, 1100 unless I'm mistaken.
> > :-)
> 
> Well, I'd call them LEDs, not camera flashes ... if there's no camera. And 
> IIRC 
> these devices had LEDs on top of the phone... so neither front nor back side.

I would go for the name "torch" in that case. It really depends on the
device, but in any case, the torch LEDs would have a location (and we
would possibly need to expand this property to
include the top, bottom, left and right sides).

-- 
Regards,

Laurent Pinchart


[PATCH net-next 03/13] net: stmmac: Do not return error code in TC Initialization

2019-09-02 Thread Jose Abreu
As we can still use the remaining TC callbacks, e.g. CBS. We should not
fail in the initialization only because RX Parser is not available.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 6c305b6ecad0..8dbbbf181ada 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -243,8 +243,9 @@ static int tc_init(struct stmmac_priv *priv)
struct dma_features *dma_cap = &priv->dma_cap;
unsigned int count;
 
+   /* Fail silently as we can still use remaining features, e.g. CBS */
if (!dma_cap->frpsel)
-   return -EINVAL;
+   return 0;
 
switch (dma_cap->frpbs) {
case 0x0:
-- 
2.7.4



[PATCH net-next 02/13] net: stmmac: xgmac: Add RBU handling in DMA interrupt

2019-09-02 Thread Jose Abreu
Add the handling of Receive Buffer Unavailable interrupt in the DMA
handler of XGMAC cores.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index 64956465c030..e77eb0ddf9b5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -322,6 +322,10 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr,
 
/* ABNORMAL interrupts */
if (unlikely(intr_status & XGMAC_AIS)) {
+   if (unlikely(intr_status & XGMAC_RBU)) {
+   x->rx_buf_unav_irq++;
+   ret |= handle_rx;
+   }
if (unlikely(intr_status & XGMAC_TPS)) {
x->tx_process_stopped_irq++;
ret |= tx_hard_error;
-- 
2.7.4



[PATCH net-next 09/13] net: stmmac: ethtool: Let user configure TX coalesce without RIWT

2019-09-02 Thread Jose Abreu
When RX Watchdog is disabled its currently not possible to configure TX
coalesce settings. Let user configure it anyway.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c| 21 +
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 1c450105e5a6..1a768837ca72 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -746,8 +746,15 @@ static int stmmac_set_coalesce(struct net_device *dev,
(ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval))
return -EOPNOTSUPP;
 
-   if (ec->rx_coalesce_usecs == 0)
-   return -EINVAL;
+   if (priv->use_riwt && (ec->rx_coalesce_usecs > 0)) {
+   rx_riwt = stmmac_usec2riwt(ec->rx_coalesce_usecs, priv);
+
+   if ((rx_riwt > MAX_DMA_RIWT) || (rx_riwt < MIN_DMA_RIWT))
+   return -EINVAL;
+
+   priv->rx_riwt = rx_riwt;
+   stmmac_rx_watchdog(priv, priv->ioaddr, priv->rx_riwt, rx_cnt);
+   }
 
if ((ec->tx_coalesce_usecs == 0) &&
(ec->tx_max_coalesced_frames == 0))
@@ -757,20 +764,10 @@ static int stmmac_set_coalesce(struct net_device *dev,
(ec->tx_max_coalesced_frames > STMMAC_TX_MAX_FRAMES))
return -EINVAL;
 
-   rx_riwt = stmmac_usec2riwt(ec->rx_coalesce_usecs, priv);
-
-   if ((rx_riwt > MAX_DMA_RIWT) || (rx_riwt < MIN_DMA_RIWT))
-   return -EINVAL;
-   else if (!priv->use_riwt)
-   return -EOPNOTSUPP;
-
/* Only copy relevant parameters, ignore all others. */
priv->tx_coal_frames = ec->tx_max_coalesced_frames;
priv->tx_coal_timer = ec->tx_coalesce_usecs;
priv->rx_coal_frames = ec->rx_max_coalesced_frames;
-   priv->rx_riwt = rx_riwt;
-   stmmac_rx_watchdog(priv, priv->ioaddr, priv->rx_riwt, rx_cnt);
-
return 0;
 }
 
-- 
2.7.4



[PATCH net-next 13/13] net: stmmac: selftests: Add Jumbo Frame tests

2019-09-02 Thread Jose Abreu
Add a test to validate the Jumbo Frame support in stmmac in single
channel and multichannel mode.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 65 +-
 1 file changed, 62 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index f531dbe038df..ff499b91ea9f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -43,9 +43,11 @@ struct stmmac_packet_attrs {
int dont_wait;
int timeout;
int size;
+   int max_size;
int remove_sa;
u8 id;
int sarc;
+   u16 queue_mapping;
 };
 
 static u8 stmmac_test_next_id;
@@ -73,12 +75,14 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
else
size += sizeof(struct udphdr);
 
-   skb = netdev_alloc_skb(priv->dev, size);
+   if (attr->max_size && (attr->max_size > size))
+   size = attr->max_size;
+
+   skb = netdev_alloc_skb_ip_align(priv->dev, size);
if (!skb)
return NULL;
 
prefetchw(skb->data);
-   skb_reserve(skb, NET_IP_ALIGN);
 
if (attr->vlan > 1)
ehdr = skb_push(skb, ETH_HLEN + 8);
@@ -147,6 +151,9 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
uhdr->source = htons(attr->sport);
uhdr->dest = htons(attr->dport);
uhdr->len = htons(sizeof(*shdr) + sizeof(*uhdr) + attr->size);
+   if (attr->max_size)
+   uhdr->len = htons(attr->max_size -
+ (sizeof(*ihdr) + sizeof(*ehdr)));
uhdr->check = 0;
}
 
@@ -162,6 +169,10 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
iplen += sizeof(*thdr);
else
iplen += sizeof(*uhdr);
+
+   if (attr->max_size)
+   iplen = attr->max_size - sizeof(*ehdr);
+
ihdr->tot_len = htons(iplen);
ihdr->frag_off = 0;
ihdr->saddr = htonl(attr->ip_src);
@@ -178,6 +189,8 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
 
if (attr->size)
skb_put(skb, attr->size);
+   if (attr->max_size && (attr->max_size > skb->len))
+   skb_put(skb, attr->max_size - skb->len);
 
skb->csum = 0;
skb->ip_summed = CHECKSUM_PARTIAL;
@@ -324,7 +337,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv,
goto cleanup;
}
 
-   skb_set_queue_mapping(skb, 0);
+   skb_set_queue_mapping(skb, attr->queue_mapping);
ret = dev_queue_xmit(skb);
if (ret)
goto cleanup;
@@ -1502,6 +1515,44 @@ static int stmmac_test_arpoffload(struct stmmac_priv 
*priv)
return ret;
 }
 
+static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue)
+{
+   struct stmmac_packet_attrs attr = { };
+   int size = priv->dma_buf_sz;
+
+   /* Only XGMAC has SW support for multiple RX descs in same packet */
+   if (priv->plat->has_xgmac)
+   size = priv->dev->max_mtu;
+
+   attr.dst = priv->dev->dev_addr;
+   attr.max_size = size - ETH_FCS_LEN;
+   attr.queue_mapping = queue;
+
+   return __stmmac_test_loopback(priv, &attr);
+}
+
+static int stmmac_test_jumbo(struct stmmac_priv *priv)
+{
+   return __stmmac_test_jumbo(priv, 0);
+}
+
+static int stmmac_test_mjumbo(struct stmmac_priv *priv)
+{
+   u32 chan, tx_cnt = priv->plat->tx_queues_to_use;
+   int ret;
+
+   if (tx_cnt <= 1)
+   return -EOPNOTSUPP;
+
+   for (chan = 0; chan < tx_cnt; chan++) {
+   ret = __stmmac_test_jumbo(priv, chan);
+   if (ret)
+   return ret;
+   }
+
+   return 0;
+}
+
 #define STMMAC_LOOPBACK_NONE   0
 #define STMMAC_LOOPBACK_MAC1
 #define STMMAC_LOOPBACK_PHY2
@@ -1615,6 +1666,14 @@ static const struct stmmac_test {
.name = "ARP Offload ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_arpoffload,
+   }, {
+   .name = "Jumbo Frame ",
+   .lb = STMMAC_LOOPBACK_PHY,
+   .fn = stmmac_test_jumbo,
+   }, {
+   .name = "Multichannel Jumbo  ",
+   .lb = STMMAC_LOOPBACK_PHY,
+   .fn = stmmac_test_mjumbo,
},
 };
 
-- 
2.7.4



[PATCH net-next 04/13] net: stmmac: Implement L3/L4 Filters using TC Flower

2019-09-02 Thread Jose Abreu
Implement filters for Layer 3 and Layer 4 using TC Flower API. Add the
corresponding callbacks in XGMAC core.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/common.h   |   1 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h |  30 +++
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c| 177 +++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |   1 +
 drivers/net/ethernet/stmicro/stmmac/hwif.h |  16 ++
 drivers/net/ethernet/stmicro/stmmac/stmmac.h   |  12 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   9 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c| 244 +
 8 files changed, 488 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h 
b/drivers/net/ethernet/stmicro/stmmac/common.h
index 49aa56ca09cc..19538057c24e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -360,6 +360,7 @@ struct dma_features {
unsigned int sphen;
unsigned int vlins;
unsigned int dvlan;
+   unsigned int l3l4fnum;
 };
 
 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 7357b8bdc128..f942ac975c29 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -47,6 +47,7 @@
 #define XGMAC_CORE_INIT_RX 0
 #define XGMAC_PACKET_FILTER0x0008
 #define XGMAC_FILTER_RABIT(31)
+#define XGMAC_FILTER_IPFE  BIT(20)
 #define XGMAC_FILTER_VTFE  BIT(16)
 #define XGMAC_FILTER_HPF   BIT(10)
 #define XGMAC_FILTER_PCF   BIT(7)
@@ -119,6 +120,7 @@
 #define XGMAC_HWFEAT_VLHASHBIT(4)
 #define XGMAC_HWFEAT_GMIISEL   BIT(1)
 #define XGMAC_HW_FEATURE1  0x0120
+#define XGMAC_HWFEAT_L3L4FNUM  GENMASK(30, 27)
 #define XGMAC_HWFEAT_RSSEN BIT(20)
 #define XGMAC_HWFEAT_TSOEN BIT(18)
 #define XGMAC_HWFEAT_SPHEN BIT(17)
@@ -150,6 +152,34 @@
 #define XGMAC_DCS  GENMASK(19, 16)
 #define XGMAC_DCS_SHIFT16
 #define XGMAC_ADDRx_LOW(x) (0x0304 + (x) * 0x8)
+#define XGMAC_L3L4_ADDR_CTRL   0x0c00
+#define XGMAC_IDDR GENMASK(15, 8)
+#define XGMAC_IDDR_SHIFT   8
+#define XGMAC_IDDR_FNUM4
+#define XGMAC_TT   BIT(1)
+#define XGMAC_XB   BIT(0)
+#define XGMAC_L3L4_DATA0x0c04
+#define XGMAC_L3L4_CTRL0x0
+#define XGMAC_L4DPIM0  BIT(21)
+#define XGMAC_L4DPM0   BIT(20)
+#define XGMAC_L4SPIM0  BIT(19)
+#define XGMAC_L4SPM0   BIT(18)
+#define XGMAC_L4PEN0   BIT(16)
+#define XGMAC_L3HDBM0  GENMASK(15, 11)
+#define XGMAC_L3HSBM0  GENMASK(10, 6)
+#define XGMAC_L3DAIM0  BIT(5)
+#define XGMAC_L3DAM0   BIT(4)
+#define XGMAC_L3SAIM0  BIT(3)
+#define XGMAC_L3SAM0   BIT(2)
+#define XGMAC_L3PEN0   BIT(0)
+#define XGMAC_L4_ADDR  0x1
+#define XGMAC_L4DP0GENMASK(31, 16)
+#define XGMAC_L4DP0_SHIFT  16
+#define XGMAC_L4SP0GENMASK(15, 0)
+#define XGMAC_L3_ADDR0 0x4
+#define XGMAC_L3_ADDR1 0x5
+#define XGMAC_L3_ADDR2 0x6
+#define XMGAC_L3_ADDR3 0x7
 #define XGMAC_ARP_ADDR 0x0c10
 #define XGMAC_RSS_CTRL 0x0c80
 #define XGMAC_UDP4TE   BIT(3)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index e534a3aaf4a3..9f568b54b339 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1163,6 +1163,181 @@ static void dwxgmac2_enable_vlan(struct mac_device_info 
*hw, u32 type)
writel(value, ioaddr + XGMAC_VLAN_INCL);
 }
 
+static int dwxgmac2_filter_wait(struct mac_device_info *hw)
+{
+   void __iomem *ioaddr = hw->pcsr;
+   u32 value;
+
+   if (readl_poll_timeout(ioaddr + XGMAC_L3L4_ADDR_CTRL, value,
+  !(value & XGMAC_XB), 100, 1))
+   return -EBUSY;
+   return 0;
+}
+
+static int dwxgmac2_filter_read(struct mac_device_info *hw, u32 filter_no,
+   u8 reg, u32 *data)
+{
+   void __iomem *

[PATCH net-next 01/13] net: stmmac: selftests: Return proper error code to userspace

2019-09-02 Thread Jose Abreu
We can do better than just return 1 to userspace. Lets return a proper
Linux error code.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index ecc8602c6799..d3234338a0ca 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -318,7 +318,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv,
attr->timeout = STMMAC_LB_TIMEOUT;
 
wait_for_completion_timeout(&tpriv->comp, attr->timeout);
-   ret = !tpriv->ok;
+   ret = tpriv->ok ? 0 : -ETIMEDOUT;
 
 cleanup:
if (!attr->dont_wait)
@@ -480,7 +480,7 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv)
 
/* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr);
-   ret = !ret;
+   ret = ret ? 0 : -EINVAL;
 
 cleanup:
dev_mc_del(priv->dev, gd_addr);
@@ -512,7 +512,7 @@ static int stmmac_test_pfilt(struct stmmac_priv *priv)
 
/* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr);
-   ret = !ret;
+   ret = ret ? 0 : -EINVAL;
 
 cleanup:
dev_uc_del(priv->dev, gd_addr);
@@ -562,7 +562,7 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv)
 
/* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr);
-   ret = !ret;
+   ret = ret ? 0 : -EINVAL;
 
 cleanup:
dev_uc_del(priv->dev, uc_addr);
@@ -600,7 +600,7 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv)
 
/* Shall NOT receive packet */
ret = __stmmac_test_loopback(priv, &attr);
-   ret = !ret;
+   ret = ret ? 0 : -EINVAL;
 
 cleanup:
dev_mc_del(priv->dev, mc_addr);
@@ -699,7 +699,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
}
 
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
-   ret = !tpriv->ok;
+   ret = tpriv->ok ? 0 : -ETIMEDOUT;
 
 cleanup:
dev_mc_del(priv->dev, paddr);
@@ -833,11 +833,11 @@ static int stmmac_test_vlanfilt(struct stmmac_priv *priv)
goto vlan_del;
 
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
-   ret = !tpriv->ok;
+   ret = tpriv->ok ? 0 : -ETIMEDOUT;
if (ret && !i) {
goto vlan_del;
} else if (!ret && i) {
-   ret = -1;
+   ret = -EINVAL;
goto vlan_del;
} else {
ret = 0;
@@ -909,11 +909,11 @@ static int stmmac_test_dvlanfilt(struct stmmac_priv *priv)
goto vlan_del;
 
wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
-   ret = !tpriv->ok;
+   ret = tpriv->ok ? 0 : -ETIMEDOUT;
if (ret && !i) {
goto vlan_del;
} else if (!ret && i) {
-   ret = -1;
+   ret = -EINVAL;
goto vlan_del;
} else {
ret = 0;
@@ -998,7 +998,7 @@ static int stmmac_test_rxp(struct stmmac_priv *priv)
attr.src = addr;
 
ret = __stmmac_test_loopback(priv, &attr);
-   ret = !ret; /* Shall NOT receive packet */
+   ret = ret ? 0 : -EINVAL; /* Shall NOT receive packet */
 
cls_u32.command = TC_CLSU32_DELETE_KNODE;
stmmac_tc_setup_cls_u32(priv, priv, &cls_u32);
-- 
2.7.4



[PATCH net-next 06/13] net: stmmac: xgmac: Implement ARP Offload

2019-09-02 Thread Jose Abreu
Implement the ARP Offload feature in XGMAC cores.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/common.h|  1 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 17 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c  |  1 +
 drivers/net/ethernet/stmicro/stmmac/hwif.h  |  3 +++
 4 files changed, 22 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h 
b/drivers/net/ethernet/stmicro/stmmac/common.h
index 19538057c24e..912bbb6515b2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -361,6 +361,7 @@ struct dma_features {
unsigned int vlins;
unsigned int dvlan;
unsigned int l3l4fnum;
+   unsigned int arpoffsel;
 };
 
 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 9f568b54b339..36262ef8b70a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1338,6 +1338,22 @@ static int dwxgmac2_config_l4_filter(struct 
mac_device_info *hw, u32 filter_no,
return 0;
 }
 
+static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en,
+u32 addr)
+{
+   void __iomem *ioaddr = hw->pcsr;
+   u32 value;
+
+   writel(addr, ioaddr + XGMAC_ARP_ADDR);
+
+   value = readl(ioaddr + XGMAC_RX_CONFIG);
+   if (en)
+   value |= XGMAC_CONFIG_ARPEN;
+   else
+   value &= ~XGMAC_CONFIG_ARPEN;
+   writel(value, ioaddr + XGMAC_RX_CONFIG);
+}
+
 const struct stmmac_ops dwxgmac210_ops = {
.core_init = dwxgmac2_core_init,
.set_mac = dwxgmac2_set_mac,
@@ -1380,6 +1396,7 @@ const struct stmmac_ops dwxgmac210_ops = {
.enable_vlan = dwxgmac2_enable_vlan,
.config_l3_filter = dwxgmac2_config_l3_filter,
.config_l4_filter = dwxgmac2_config_l4_filter,
+   .set_arp_offload = dwxgmac2_set_arp_offload,
 };
 
 int dwxgmac2_setup(struct stmmac_priv *priv)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
index fb0283b15c77..fd60bf5e0a72 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c
@@ -370,6 +370,7 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
dma_cap->atime_stamp = (hw_cap & XGMAC_HWFEAT_TSSEL) >> 12;
dma_cap->av = (hw_cap & XGMAC_HWFEAT_AVSEL) >> 11;
dma_cap->av &= (hw_cap & XGMAC_HWFEAT_RAVSEL) >> 10;
+   dma_cap->arpoffsel = (hw_cap & XGMAC_HWFEAT_ARPOFFSEL) >> 9;
dma_cap->rmon = (hw_cap & XGMAC_HWFEAT_MMCSEL) >> 8;
dma_cap->pmt_magic_frame = (hw_cap & XGMAC_HWFEAT_MGKSEL) >> 7;
dma_cap->pmt_remote_wake_up = (hw_cap & XGMAC_HWFEAT_RWKSEL) >> 6;
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h 
b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 47c8ad9ec671..ddb851d99618 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -370,6 +370,7 @@ struct stmmac_ops {
int (*config_l4_filter)(struct mac_device_info *hw, u32 filter_no,
bool en, bool udp, bool sa, bool inv,
u32 match);
+   void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr);
 };
 
 #define stmmac_core_init(__priv, __args...) \
@@ -454,6 +455,8 @@ struct stmmac_ops {
stmmac_do_callback(__priv, mac, config_l3_filter, __args)
 #define stmmac_config_l4_filter(__priv, __args...) \
stmmac_do_callback(__priv, mac, config_l4_filter, __args)
+#define stmmac_set_arp_offload(__priv, __args...) \
+   stmmac_do_void_callback(__priv, mac, set_arp_offload, __args)
 
 /* PTP and HW Timer helpers */
 struct stmmac_hwtimestamp {
-- 
2.7.4



Re: [PATCH v5] hid-logitech-hidpp: read battery voltage from newer devices

2019-09-02 Thread Filipe Laíns
On Sat, 2019-08-31 at 13:56 -0400, Pedro Vanzella wrote:
> Newer Logitech mice report their battery voltage through feature
> 0x1001
> instead of the battery levels through feature 0x1000.
> 
> When the device is brought up and we try to query the battery, figure
> out if it supports the old or the new feature. If it supports the new
> feature, record the feature index and read the battery voltage and
> its status.
> 
> If everything went correctly, record the fact that we're capable
> of querying battery voltage.
> 
> Note that the protocol only gives us the current voltage in
> millivolts.
> 
> Like we do for other ways of interacting with the battery for other
> devices, refresh the battery status and notify the power supply
> subsystem of the changes in voltage and status.
> 
> Since there are no known devices which implement both the old and the
> new battery feature, we make sure to try the newer feature first and
> only fall back to the old one if that fails.
> 
> Signed-off-by: Pedro Vanzella 
> ---
>  drivers/hid/hid-logitech-hidpp.c | 141
> ++-
>  1 file changed, 137 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-
> logitech-hidpp.c
> index 0179f7ed77e5..2f215e5be001 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -87,6 +87,7 @@ MODULE_PARM_DESC(disable_tap_to_click,
>  #define HIDPP_CAPABILITY_HIDPP20_BATTERY BIT(1)
>  #define HIDPP_CAPABILITY_BATTERY_MILEAGE BIT(2)
>  #define HIDPP_CAPABILITY_BATTERY_LEVEL_STATUSBIT(3)
> +#define HIDPP_CAPABILITY_BATTERY_VOLTAGE BIT(4)
>  
>  /*
>   * There are two hidpp protocols in use, the first version hidpp10
> is known
> @@ -135,12 +136,14 @@ struct hidpp_report {
>  struct hidpp_battery {
>   u8 feature_index;
>   u8 solar_feature_index;
> + u8 voltage_feature_index;
>   struct power_supply_desc desc;
>   struct power_supply *ps;
>   char name[64];
>   int status;
>   int capacity;
>   int level;
> + int voltage; /* in millivolts */
>   bool online;
>  };
>  
> @@ -1219,6 +1222,118 @@ static int hidpp20_battery_event(struct
> hidpp_device *hidpp,
>   return 0;
>  }
>  
> +/* ---
> --- */
> +/* 0x1001: Battery
> voltage*/
> +/* ---
> --- */
> +
> +#define HIDPP_PAGE_BATTERY_VOLTAGE 0x1001
> +
> +#define CMD_BATTERY_VOLTAGE_GET_BATTERY_VOLTAGE 0x00
> +
> +#define EVENT_BATTERY_VOLTAGE_STATUS_BROADCAST 0x00
> +
> +static int hidpp20_battery_map_status_voltage(u8 data[3], int
> *voltage)
> +{
> + int status;
> +
> + switch (data[2]) {
> + case 0x00: /* discharging */
> + status = POWER_SUPPLY_STATUS_DISCHARGING;
> + break;
> + case 0x10: /* wireless charging */
> + case 0x80: /* charging */
> + status = POWER_SUPPLY_STATUS_CHARGING;
> + break;
> + case 0x81: /* fully charged */
> + status = POWER_SUPPLY_STATUS_FULL;
> + break;
> + default:
> + status = POWER_SUPPLY_STATUS_NOT_CHARGING;
> + }
> +
> + *voltage = get_unaligned_be16(data);
> +
> + return status;
> +}
> +
> +static int hidpp20_battery_get_battery_voltage(struct hidpp_device
> *hidpp,
> +u8 feature_index,
> +int *status, int
> *voltage)
> +{
> + struct hidpp_report response;
> + int ret;
> + u8 *params = (u8 *)response.fap.params;
> +
> + ret = hidpp_send_fap_command_sync(hidpp, feature_index,
> +   CMD_BATTERY_VOLTAGE_GET_BATTE
> RY_VOLTAGE,
> +   NULL, 0, &response);
> +
> + if (ret > 0) {
> + hid_err(hidpp->hid_dev, "%s: received protocol error
> 0x%02x\n",
> + __func__, ret);
> + return -EPROTO;
> + }
> + if (ret)
> + return ret;
> +
> + hidpp->capabilities |= HIDPP_CAPABILITY_BATTERY_VOLTAGE;
> +
> + *status = hidpp20_battery_map_status_voltage(params, voltage);
> +
> + return 0;
> +}
> +
> +static int hidpp20_query_battery_voltage_info(struct hidpp_device
> *hidpp)
> +{
> + u8 feature_type;
> + int ret;
> + int status, voltage;
> +
> + if (hidpp->battery.voltage_feature_index == 0xff) {
> + ret = hidpp_root_get_feature(hidpp,
> HIDPP_PAGE_BATTERY_VOLTAGE,
> +  &hidpp-
> >battery.voltage_feature_index,
> +  &feature_type);
> + if (ret)
> + return ret;
> + }
> +
> + ret = hidpp20_battery_get_battery_voltage(hidpp,
> +   hidpp-
> >battery.voltage_feature_inde

[PATCH net-next 12/13] net: stmmac: xgmac: Enable RX Jumbo frame support

2019-09-02 Thread Jose Abreu
We are already doing it by default in the TX path so we can also enable
Jumbo Frame support in the RX path independently of MTU value.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h  |  3 ++-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 11 ---
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index f942ac975c29..5923ca62d793 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -44,7 +44,8 @@
 #define XGMAC_CONFIG_CST   BIT(2)
 #define XGMAC_CONFIG_ACS   BIT(1)
 #define XGMAC_CONFIG_REBIT(0)
-#define XGMAC_CORE_INIT_RX 0
+#define XGMAC_CORE_INIT_RX (XGMAC_CONFIG_GPSLCE | XGMAC_CONFIG_WD 
| \
+(XGMAC_JUMBO_LEN << 
XGMAC_CONFIG_GPSL_SHIFT))
 #define XGMAC_PACKET_FILTER0x0008
 #define XGMAC_FILTER_RABIT(31)
 #define XGMAC_FILTER_IPFE  BIT(20)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c 
b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 36262ef8b70a..78ac659da279 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -15,7 +15,6 @@ static void dwxgmac2_core_init(struct mac_device_info *hw,
   struct net_device *dev)
 {
void __iomem *ioaddr = hw->pcsr;
-   int mtu = dev->mtu;
u32 tx, rx;
 
tx = readl(ioaddr + XGMAC_TX_CONFIG);
@@ -24,16 +23,6 @@ static void dwxgmac2_core_init(struct mac_device_info *hw,
tx |= XGMAC_CORE_INIT_TX;
rx |= XGMAC_CORE_INIT_RX;
 
-   if (mtu >= 9000) {
-   rx |= XGMAC_CONFIG_GPSLCE;
-   rx |= XGMAC_JUMBO_LEN << XGMAC_CONFIG_GPSL_SHIFT;
-   rx |= XGMAC_CONFIG_WD;
-   } else if (mtu > 2000) {
-   rx |= XGMAC_CONFIG_JE;
-   } else if (mtu > 1500) {
-   rx |= XGMAC_CONFIG_S2KP;
-   }
-
if (hw->ps) {
tx |= XGMAC_CONFIG_TE;
tx &= ~hw->link.speed_mask;
-- 
2.7.4



[PATCH net-next 07/13] net: stmmac: selftests: Implement the ARP Offload test

2019-09-02 Thread Jose Abreu
Implement a test for ARP Offload feature.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 110 +
 1 file changed, 110 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index 8e9d0aeda817..f531dbe038df 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -196,6 +196,24 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
return skb;
 }
 
+static struct sk_buff *stmmac_test_get_arp_skb(struct stmmac_priv *priv,
+  struct stmmac_packet_attrs *attr)
+{
+   __be32 ip_src = htonl(attr->ip_src);
+   __be32 ip_dst = htonl(attr->ip_dst);
+   struct sk_buff *skb = NULL;
+
+   skb = arp_create(ARPOP_REQUEST, ETH_P_ARP, ip_dst, priv->dev, ip_src,
+NULL, attr->src, attr->dst);
+   if (!skb)
+   return NULL;
+
+   skb->pkt_type = PACKET_HOST;
+   skb->dev = priv->dev;
+
+   return skb;
+}
+
 struct stmmac_test_priv {
struct stmmac_packet_attrs *packet;
struct packet_type pt;
@@ -1396,6 +1414,94 @@ static int stmmac_test_l4filt_sa_udp(struct stmmac_priv 
*priv)
return __stmmac_test_l4filt(priv, 0, dummy_port, 0, ~0, true);
 }
 
+static int stmmac_test_arp_validate(struct sk_buff *skb,
+   struct net_device *ndev,
+   struct packet_type *pt,
+   struct net_device *orig_ndev)
+{
+   struct stmmac_test_priv *tpriv = pt->af_packet_priv;
+   struct ethhdr *ehdr;
+   struct arphdr *ahdr;
+
+   ehdr = (struct ethhdr *)skb_mac_header(skb);
+   if (!ether_addr_equal(ehdr->h_dest, tpriv->packet->src))
+   goto out;
+
+   ahdr = arp_hdr(skb);
+   if (ahdr->ar_op != htons(ARPOP_REPLY))
+   goto out;
+
+   tpriv->ok = true;
+   complete(&tpriv->comp);
+out:
+   kfree_skb(skb);
+   return 0;
+}
+
+static int stmmac_test_arpoffload(struct stmmac_priv *priv)
+{
+   unsigned char src[ETH_ALEN] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
+   unsigned char dst[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+   struct stmmac_packet_attrs attr = { };
+   struct stmmac_test_priv *tpriv;
+   struct sk_buff *skb = NULL;
+   u32 ip_addr = 0xdeadcafe;
+   u32 ip_src = 0xdeadbeef;
+   int ret;
+
+   if (!priv->dma_cap.arpoffsel)
+   return -EOPNOTSUPP;
+
+   tpriv = kzalloc(sizeof(*tpriv), GFP_KERNEL);
+   if (!tpriv)
+   return -ENOMEM;
+
+   tpriv->ok = false;
+   init_completion(&tpriv->comp);
+
+   tpriv->pt.type = htons(ETH_P_ARP);
+   tpriv->pt.func = stmmac_test_arp_validate;
+   tpriv->pt.dev = priv->dev;
+   tpriv->pt.af_packet_priv = tpriv;
+   tpriv->packet = &attr;
+   dev_add_pack(&tpriv->pt);
+
+   attr.src = src;
+   attr.ip_src = ip_src;
+   attr.dst = dst;
+   attr.ip_dst = ip_addr;
+
+   skb = stmmac_test_get_arp_skb(priv, &attr);
+   if (!skb) {
+   ret = -ENOMEM;
+   goto cleanup;
+   }
+
+   ret = stmmac_set_arp_offload(priv, priv->hw, true, ip_addr);
+   if (ret)
+   goto cleanup;
+
+   ret = dev_set_promiscuity(priv->dev, 1);
+   if (ret)
+   goto cleanup;
+
+   skb_set_queue_mapping(skb, 0);
+   ret = dev_queue_xmit(skb);
+   if (ret)
+   goto cleanup_promisc;
+
+   wait_for_completion_timeout(&tpriv->comp, STMMAC_LB_TIMEOUT);
+   ret = tpriv->ok ? 0 : -ETIMEDOUT;
+
+cleanup_promisc:
+   dev_set_promiscuity(priv->dev, -1);
+cleanup:
+   stmmac_set_arp_offload(priv, priv->hw, false, 0x0);
+   dev_remove_pack(&tpriv->pt);
+   kfree(tpriv);
+   return ret;
+}
+
 #define STMMAC_LOOPBACK_NONE   0
 #define STMMAC_LOOPBACK_MAC1
 #define STMMAC_LOOPBACK_PHY2
@@ -1505,6 +1611,10 @@ static const struct stmmac_test {
.name = "L4 SA UDP Filtering ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_l4filt_sa_udp,
+   }, {
+   .name = "ARP Offload ",
+   .lb = STMMAC_LOOPBACK_PHY,
+   .fn = stmmac_test_arpoffload,
},
 };
 
-- 
2.7.4



[PATCH net-next 05/13] net: stmmac: selftests: Add selftest for L3/L4 Filters

2019-09-02 Thread Jose Abreu
Adds the selftests for L3 and L4 filters with DA/SA/DP/SP support.

Signed-off-by: Jose Abreu 

---
Cc: Giuseppe Cavallaro 
Cc: Alexandre Torgue 
Cc: Jose Abreu 
Cc: "David S. Miller" 
Cc: Maxime Coquelin 
Cc: net...@vger.kernel.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 .../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 254 -
 1 file changed, 253 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index d3234338a0ca..8e9d0aeda817 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -164,7 +164,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct 
stmmac_priv *priv,
iplen += sizeof(*uhdr);
ihdr->tot_len = htons(iplen);
ihdr->frag_off = 0;
-   ihdr->saddr = 0;
+   ihdr->saddr = htonl(attr->ip_src);
ihdr->daddr = htonl(attr->ip_dst);
ihdr->tos = 0;
ihdr->id = 0;
@@ -1168,6 +1168,234 @@ static int stmmac_test_svlanoff(struct stmmac_priv 
*priv)
return stmmac_test_vlanoff_common(priv, true);
 }
 
+#ifdef CONFIG_NET_CLS_ACT
+static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
+   u32 dst_mask, u32 src_mask)
+{
+   struct flow_dissector_key_ipv4_addrs key, mask;
+   unsigned long dummy_cookie = 0xdeadbeef;
+   struct flow_dissector dissector = { };
+   struct stmmac_packet_attrs attr = { };
+   struct flow_cls_offload cls = { };
+   struct flow_rule *rule;
+   int ret;
+
+   if (!tc_can_offload(priv->dev))
+   return -EOPNOTSUPP;
+   if (!priv->dma_cap.l3l4fnum)
+   return -EOPNOTSUPP;
+   if (priv->rss.enable) {
+   struct stmmac_rss rss = { .enable = false, };
+
+   stmmac_rss_configure(priv, priv->hw, &rss,
+priv->plat->rx_queues_to_use);
+   }
+
+   dissector.used_keys |= (1 << FLOW_DISSECTOR_KEY_IPV4_ADDRS);
+   dissector.offset[FLOW_DISSECTOR_KEY_IPV4_ADDRS] = 0;
+
+   cls.common.chain_index = 0;
+   cls.command = FLOW_CLS_REPLACE;
+   cls.cookie = dummy_cookie;
+
+   rule = kzalloc(struct_size(rule, action.entries, 1), GFP_KERNEL);
+   if (!rule) {
+   ret = -ENOMEM;
+   goto cleanup_rss;
+   }
+
+   rule->match.dissector = &dissector;
+   rule->match.key = (void *)&key;
+   rule->match.mask = (void *)&mask;
+
+   key.src = htonl(src);
+   key.dst = htonl(dst);
+   mask.src = src_mask;
+   mask.dst = dst_mask;
+
+   cls.rule = rule;
+
+   rule->action.entries[0].id = FLOW_ACTION_DROP;
+   rule->action.num_entries = 1;
+
+   attr.dst = priv->dev->dev_addr;
+   attr.ip_dst = dst;
+   attr.ip_src = src;
+
+   /* Shall receive packet */
+   ret = __stmmac_test_loopback(priv, &attr);
+   if (ret)
+   goto cleanup_rule;
+
+   ret = stmmac_tc_setup_cls(priv, priv, &cls);
+   if (ret)
+   goto cleanup_rule;
+
+   /* Shall NOT receive packet */
+   ret = __stmmac_test_loopback(priv, &attr);
+   ret = ret ? 0 : -EINVAL;
+
+   cls.command = FLOW_CLS_DESTROY;
+   stmmac_tc_setup_cls(priv, priv, &cls);
+cleanup_rule:
+   kfree(rule);
+cleanup_rss:
+   if (priv->rss.enable) {
+   stmmac_rss_configure(priv, priv->hw, &priv->rss,
+priv->plat->rx_queues_to_use);
+   }
+
+   return ret;
+}
+#else
+static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
+   u32 dst_mask, u32 src_mask)
+{
+   return -EOPNOTSUPP;
+}
+#endif
+
+static int stmmac_test_l3filt_da(struct stmmac_priv *priv)
+{
+   u32 addr = 0x10203040;
+
+   return __stmmac_test_l3filt(priv, addr, 0, ~0, 0);
+}
+
+static int stmmac_test_l3filt_sa(struct stmmac_priv *priv)
+{
+   u32 addr = 0x10203040;
+
+   return __stmmac_test_l3filt(priv, 0, addr, 0, ~0);
+}
+
+#ifdef CONFIG_NET_CLS_ACT
+static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
+   u32 dst_mask, u32 src_mask, bool udp)
+{
+   struct {
+   struct flow_dissector_key_basic bkey;
+   struct flow_dissector_key_ports key;
+   } __aligned(BITS_PER_LONG / 8) keys;
+   struct {
+   struct flow_dissector_key_basic bmask;
+   struct flow_dissector_key_ports mask;
+   } __aligned(BITS_PER_LONG / 8) masks;
+   unsigned long dummy_cookie = 0xdeadbeef;
+   struct flow_dissector dissector = { };
+   struct stmmac_packet_attrs attr = { };
+   struct flow_cls_offload cls = { };
+   struct flow_rule *rule;
+   int ret;
+
+   if (!tc_can_offloa

Re: [RFC 2/5] media: v4l2-ctrl: Document V4L2_CID_LOCATION

2019-09-02 Thread Pavel Machek
Hi!

> > > Single integer. It's read-only, so it just reports the location.
> > > 
> > > It would be different if this was a writable control: then you need to
> > > know which locations are possible to set, and that requires a menu type.
> > > 
> > > But it doesn't make sense to set the location from software. However, the
> > > location might change as a result of other changes: e.g. if the camera
> > > has motor control of the tilt and the tilt changes from forward facing to
> > > downward facing, then the driver might change the location from FRONT
> > > to DOWN. A convoluted example perhaps, but this is just brainstorming.
> > 
> > There are phones with exactly such camera setup. And yes, it makes
> > sense to be writable in that case, as software can move the camera in
> > such case.
> 
> Out of curiosity, what phones are those ?

This one:

https://www.samsung.com/global/galaxy/galaxy-a80/

Best regards,
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH v2] vfio/type1: avoid redundant PageReserved checking

2019-09-02 Thread Ben Luo



在 2019/8/30 上午1:06, Alex Williamson 写道:

On Fri, 30 Aug 2019 00:58:22 +0800
Ben Luo  wrote:


在 2019/8/28 下午11:55, Alex Williamson 写道:

On Wed, 28 Aug 2019 12:28:04 +0800
Ben Luo  wrote:
  

currently, if the page is not a tail of compound page, it will be
checked twice for the same thing.

Signed-off-by: Ben Luo 
---
   drivers/vfio/vfio_iommu_type1.c | 3 +--
   1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 054391f..d0f7346 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -291,11 +291,10 @@ static int vfio_lock_acct(struct vfio_dma *dma, long 
npage, bool async)
   static bool is_invalid_reserved_pfn(unsigned long pfn)
   {
if (pfn_valid(pfn)) {
-   bool reserved;
struct page *tail = pfn_to_page(pfn);
struct page *head = compound_head(tail);
-   reserved = !!(PageReserved(head));
if (head != tail) {
+   bool reserved = PageReserved(head);
/*
 * "head" is not a dangling pointer
 * (compound_head takes care of that)

Thinking more about this, the code here was originally just a copy of
kvm_is_mmio_pfn() which was simplified in v3.12 with the commit below.
Should we instead do the same thing here?  Thanks,

Alex

ok, and kvm_is_mmio_pfn() has also been updated since then, I will take
a look at that and compose a new patch

I'm not sure if the further updates are quite as relevant for vfio, but
appreciate your review of them.  Thanks,

Alex

After studying the related code, my personal understandings are:

kvm_is_mmio_pfn() is used to find out whether a memory range is MMIO 
mapped so

that to set the proper MTRR TYPE to spte.

is_invalid_reserved_pfn() is used in two scenarios:
1, to tell whether a page should be counted against user's mlock limits, as
the function's name implies, all 'invalid' PFNs who are not backed by struct
page and those reserved pages (including zero page and those from NVDIMM 
DAX)

should be excluded.
2, to check if we have got a valid and pinned pfn for the vma with VM_PFNMAP
flag. So, for the zero page and 'RAM' backed PFNs without 'struct page',
kvm_is_mmio_pfn() should return false because they are not MMIO and are
cacheable, but is_invalid_reserved_pfn() should return true since they are
truely reserved or invalid and should not be counted against user's mlock
limits.

For fsdax-page, current get_user_pages() returns -EOPNOTSUPP, and VFIO also
returns this error code to user, seems not support fsdax for now, so 
there is
no chance to call into is_invalid_reserved_pfn() currently, if fsdax is 
to be

supported, not only this function needs to be updated, vaddr_get_pfn() also
needs some changes.

Now, with the assumption that PFNs of compound pages with reserved bit 
set in

head will not be passed to is_invalid_reserved_pfn(), we can simplify this
function to:

static bool is_invalid_reserved_pfn(unsigned long pfn)
{
    if (pfn_valid(pfn))
    return PageReserved(pfn_to_page(pfn));

    return true;
}

But, I am not sure if the assumption above is true, if not, we still need to
check the reserved bit of head for a tail page as this PATCH v2 does.

Thanks,

    Ben



Re: [RFC 1/5] media: dt-bindings: Document 'location' property

2019-09-02 Thread Pavel Machek
On Mon 2019-09-02 11:02:11, Laurent Pinchart wrote:
> Hi Pavel,
> 
> On Sun, Sep 01, 2019 at 07:24:15PM +0200, Pavel Machek wrote:
> > > > +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> > > > @@ -89,6 +89,10 @@ Optional properties
> > > >but a number of degrees counter clockwise. Typical values are 0 and 
> > > > 180
> > > >(upside down).
> > > > 
> > > > +- location: The camera device mounting position, relative to the device
> > > > +  usage orientation. Possible values are:
> > > > +  0 - Front camera. The image sensor is mounted on the front side of 
> > > > the device.
> > > > +  1 - Back camera. The image sensor is mounted on the back side of the 
> > > > device.
> > > 
> > > Would it make sense to make this a little more generic? Such as s/image
> > > sensor/ device/, for instance?
> > > 
> > > Is this also relevant for flash or lens devices?
> > > 
> > > Flash (torch) devices could be present, at least principle, without a
> > > camera. There once was even such a Nokia phone, 1100 unless I'm mistaken.
> > > :-)
> > 
> > Well, I'd call them LEDs, not camera flashes ... if there's no camera. And 
> > IIRC 
> > these devices had LEDs on top of the phone... so neither front nor back 
> > side.
> 
> I would go for the name "torch" in that case. It really depends on the
> device, but in any case, the torch LEDs would have a location (and we
> would possibly need to expand this property to
> include the top, bottom, left and right sides).

Yes, but please let the torch devices be handled by LED subsystem
(/sys/class/leds). media/ subsystem is a bit too big and complex for
toggling LEDs on and off...

Thanks,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


signature.asc
Description: Digital signature


Re: [PATCH v3 13/16] ARM: mmp: move cputype.h to include/linux/soc/

2019-09-02 Thread kbuild test robot
Hi Lubomir,

I love your patch! Yet something to improve:

[auto build test ERROR on arm/for-next]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Lubomir-Rintel/Initial-support-for-Marvell-MMP3-SoC/20190901-110305
base:   git://git.armlinux.org.uk/~rmk/linux-arm.git for-next
config: x86_64-randconfig-s2-09021304 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   In file included from :0:0:
>> include/linux/soc/mmp/cputype.h:5:10: fatal error: asm/cputype.h: No such 
>> file or directory
#include 
 ^~~
   compilation terminated.

vim +5 include/linux/soc/mmp/cputype.h

49cbe78637eb05 arch/arm/mach-mmp/include/mach/cputype.h Eric Miao 2009-01-20  4 
 
49cbe78637eb05 arch/arm/mach-mmp/include/mach/cputype.h Eric Miao 2009-01-20 @5 
 #include 
49cbe78637eb05 arch/arm/mach-mmp/include/mach/cputype.h Eric Miao 2009-01-20  6 
 

:: The code at line 5 was first introduced by commit
:: 49cbe78637eb0503f45fc9b556ec08918a616534 [ARM] pxa: add base support for 
Marvell's PXA168 processor line

:: TO: Eric Miao 
:: CC: Eric Miao 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[tip: perf/core] perf c2c: Display proper cpu count in nodes column

2019-09-02 Thread tip-bot2 for Jiri Olsa
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 67260e8c0e681a9bb9ed861514b4c80c2d0eb2e5
Gitweb:
https://git.kernel.org/tip/67260e8c0e681a9bb9ed861514b4c80c2d0eb2e5
Author:Jiri Olsa 
AuthorDate:Tue, 20 Aug 2019 16:02:19 +02:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Thu, 29 Aug 2019 17:38:31 -03:00

perf c2c: Display proper cpu count in nodes column

There's wrong bitmap considered when checking for cpu count of specific
node.

We do the needed computation for 'set' variable, but at the end we use
the 'c2c_he->cpuset' weight, which shows misleading numbers.

Fixes: 1e181b92a2da ("perf c2c report: Add 'node' sort key")
Reported-by: Joe Mario 
Signed-off-by: Jiri Olsa 
Cc: Alexander Shishkin 
Cc: Michael Petlan 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lore.kernel.org/lkml/20190820140219.28338-1-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-c2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 73782d9..8335a40 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -1107,7 +1107,7 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, 
struct perf_hpp *hpp,
break;
case 1:
{
-   int num = bitmap_weight(c2c_he->cpuset, c2c.cpus_cnt);
+   int num = bitmap_weight(set, c2c.cpus_cnt);
struct c2c_stats *stats = &c2c_he->node_stats[node];
 
ret = scnprintf(hpp->buf, hpp->size, "%2d{%2d ", node, 
num);


[tip: perf/core] perf tools: Remove debug.h from header files not needing it

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: b42090256fba05dce1a0482a4ccd9bb6464cc499
Gitweb:
https://git.kernel.org/tip/b42090256fba05dce1a0482a4ccd9bb6464cc499
Author:Arnaldo Carvalho de Melo 
AuthorDate:Thu, 29 Aug 2019 15:56:40 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Thu, 29 Aug 2019 17:38:32 -03:00

perf tools: Remove debug.h from header files not needing it

And fix the fallout, adding it to places that must have it since they
use its definitions.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-1s3jel4i26chq2g0lydoz...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm/util/auxtrace.c  | 1 +
 tools/perf/arch/arm/util/cs-etm.c| 1 +
 tools/perf/arch/x86/tests/perf-time-to-tsc.c | 1 +
 tools/perf/tests/code-reading.c  | 1 +
 tools/perf/tests/keep-tracking.c | 1 +
 tools/perf/tests/mmap-basic.c| 1 +
 tools/perf/tests/sw-clock.c  | 2 ++
 tools/perf/tests/switch-tracking.c   | 1 +
 tools/perf/tests/task-exit.c | 1 +
 tools/perf/ui/browsers/annotate.c| 1 +
 tools/perf/ui/browsers/hists.c   | 1 +
 tools/perf/ui/hist.c | 1 +
 tools/perf/util/auxtrace.h   | 2 +-
 tools/perf/util/config.c | 1 +
 tools/perf/util/hist.c   | 1 +
 tools/perf/util/llvm-utils.h | 2 +-
 tools/perf/util/metricgroup.c| 2 ++
 tools/perf/util/python.c | 1 +
 tools/perf/util/record.c | 1 +
 tools/perf/util/session.c| 1 +
 tools/perf/util/sort.c   | 1 +
 tools/perf/util/stat.c   | 1 +
 tools/perf/util/trigger.h| 1 -
 23 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/arm/util/auxtrace.c 
b/tools/perf/arch/arm/util/auxtrace.c
index 41b78f7..0a6e75b 100644
--- a/tools/perf/arch/arm/util/auxtrace.c
+++ b/tools/perf/arch/arm/util/auxtrace.c
@@ -9,6 +9,7 @@
 #include 
 
 #include "../../util/auxtrace.h"
+#include "../../util/debug.h"
 #include "../../util/evlist.h"
 #include "../../util/pmu.h"
 #include "cs-etm.h"
diff --git a/tools/perf/arch/arm/util/cs-etm.c 
b/tools/perf/arch/arm/util/cs-etm.c
index 9644e2d..b74fd40 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -15,6 +15,7 @@
 #include 
 
 #include "cs-etm.h"
+#include "../../util/debug.h"
 #include "../../util/record.h"
 #include "../../util/auxtrace.h"
 #include "../../util/cpumap.h"
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c 
b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index 0277610..2d1f471 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index fe671b8..c4b73bb 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
diff --git a/tools/perf/tests/keep-tracking.c b/tools/perf/tests/keep-tracking.c
index 2af6faf..c758798 100644
--- a/tools/perf/tests/keep-tracking.c
+++ b/tools/perf/tests/keep-tracking.c
@@ -5,6 +5,7 @@
 #include 
 #include 
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 7327694..fe91350 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -5,6 +5,7 @@
 #include 
 #include 
 
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #include "thread_map.h"
diff --git a/tools/perf/tests/sw-clock.c b/tools/perf/tests/sw-clock.c
index c5f1a9f..97694a0 100644
--- a/tools/perf/tests/sw-clock.c
+++ b/tools/perf/tests/sw-clock.c
@@ -5,8 +5,10 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "tests.h"
+#include "util/debug.h"
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/cpumap.h"
diff --git a/tools/perf/tests/switch-tracking.c 
b/tools/perf/tests/switch-tracking.c
index b63f027..4bed15a 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 
+#include "debug.h"
 #include "parse-events.h"
 #include "evlist.h"
 #include "evsel.h"
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c
index d79a22e..0e0e062 100644
--- a/tools/perf/tests/task-exit.c
+++ b/tools/perf/tests/task-exit.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "debug.h"
 #include "evlist.h"
 #include "evsel.h"
 #includ

[tip: perf/core] perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online

2019-09-02 Thread tip-bot2 for Kyle Meyer
The following commit has been merged into the perf/core branch of tip:

Commit-ID: f78f96676a256d7fa171a54b271a2ad2c6555c9c
Gitweb:
https://git.kernel.org/tip/f78f96676a256d7fa171a54b271a2ad2c6555c9c
Author:Kyle Meyer 
AuthorDate:Tue, 27 Aug 2019 16:43:47 -05:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Thu, 29 Aug 2019 17:38:32 -03:00

perf svghelper: Replace MAX_NR_CPUS with perf_env::nr_cpus_online

'nr_cpus', the number of CPUs online during a record session bound by
MAX_NR_CPUS, can be used as a dynamic alternative for MAX_NR_CPUS in
svg_build_topology_map().

The value of nr_cpus can be passed into str_to_bitmap(),
scan_core_topology(), and svg_build_topology_map() to replace
MAX_NR_CPUS as well.

Signed-off-by: Kyle Meyer 
Reviewed-by: Jiri Olsa 
Cc: Alexander Shishkin 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Russ Anderson 
Link: 
http://lore.kernel.org/lkml/20190827214352.94272-3-mey...@stormcage.eag.rdlabs.hpecorp.net
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/svghelper.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 2e99715..fef0f8a 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -697,7 +697,8 @@ struct topology {
int sib_thr_nr;
 };
 
-static void scan_thread_topology(int *map, struct topology *t, int cpu, int 
*pos)
+static void scan_thread_topology(int *map, struct topology *t, int cpu,
+int *pos, int nr_cpus)
 {
int i;
int thr;
@@ -706,28 +707,24 @@ static void scan_thread_topology(int *map, struct 
topology *t, int cpu, int *pos
if (!test_bit(cpu, cpumask_bits(&t->sib_thr[i])))
continue;
 
-   for_each_set_bit(thr,
-cpumask_bits(&t->sib_thr[i]),
-MAX_NR_CPUS)
+   for_each_set_bit(thr, cpumask_bits(&t->sib_thr[i]), nr_cpus)
if (map[thr] == -1)
map[thr] = (*pos)++;
}
 }
 
-static void scan_core_topology(int *map, struct topology *t)
+static void scan_core_topology(int *map, struct topology *t, int nr_cpus)
 {
int pos = 0;
int i;
int cpu;
 
for (i = 0; i < t->sib_core_nr; i++)
-   for_each_set_bit(cpu,
-cpumask_bits(&t->sib_core[i]),
-MAX_NR_CPUS)
-   scan_thread_topology(map, t, cpu, &pos);
+   for_each_set_bit(cpu, cpumask_bits(&t->sib_core[i]), nr_cpus)
+   scan_thread_topology(map, t, cpu, &pos, nr_cpus);
 }
 
-static int str_to_bitmap(char *s, cpumask_t *b)
+static int str_to_bitmap(char *s, cpumask_t *b, int nr_cpus)
 {
int i;
int ret = 0;
@@ -740,7 +737,7 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 
for (i = 0; i < m->nr; i++) {
c = m->map[i];
-   if (c >= MAX_NR_CPUS) {
+   if (c >= nr_cpus) {
ret = -1;
break;
}
@@ -755,10 +752,12 @@ static int str_to_bitmap(char *s, cpumask_t *b)
 
 int svg_build_topology_map(struct perf_env *env)
 {
-   int i;
+   int i, nr_cpus;
struct topology t;
char *sib_core, *sib_thr;
 
+   nr_cpus = min(env->nr_cpus_online, MAX_NR_CPUS);
+
t.sib_core_nr = env->nr_sibling_cores;
t.sib_thr_nr = env->nr_sibling_threads;
t.sib_core = calloc(env->nr_sibling_cores, sizeof(cpumask_t));
@@ -773,7 +772,7 @@ int svg_build_topology_map(struct perf_env *env)
}
 
for (i = 0; i < env->nr_sibling_cores; i++) {
-   if (str_to_bitmap(sib_core, &t.sib_core[i])) {
+   if (str_to_bitmap(sib_core, &t.sib_core[i], nr_cpus)) {
fprintf(stderr, "topology: can't parse siblings map\n");
goto exit;
}
@@ -782,7 +781,7 @@ int svg_build_topology_map(struct perf_env *env)
}
 
for (i = 0; i < env->nr_sibling_threads; i++) {
-   if (str_to_bitmap(sib_thr, &t.sib_thr[i])) {
+   if (str_to_bitmap(sib_thr, &t.sib_thr[i], nr_cpus)) {
fprintf(stderr, "topology: can't parse siblings map\n");
goto exit;
}
@@ -790,16 +789,16 @@ int svg_build_topology_map(struct perf_env *env)
sib_thr += strlen(sib_thr) + 1;
}
 
-   topology_map = malloc(sizeof(int) * MAX_NR_CPUS);
+   topology_map = malloc(sizeof(int) * nr_cpus);
if (!topology_map) {
fprintf(stderr, "topology: no memory\n");
goto exit;
}
 
-   for (i = 0; i < MAX_NR_CPUS; i++)
+   for (i = 0; i < nr_cpus; i++)
topology_map[i] = -1;
 
-   scan_core_top

[tip: perf/core] perf tools: Remove needless libtraceevent include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 108a1bb9d1d88bff47d5eccd2cf18dc09a04fb9f
Gitweb:
https://git.kernel.org/tip/108a1bb9d1d88bff47d5eccd2cf18dc09a04fb9f
Author:Arnaldo Carvalho de Melo 
AuthorDate:Thu, 29 Aug 2019 13:00:28 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Thu, 29 Aug 2019 17:38:32 -03:00

perf tools: Remove needless libtraceevent include directives

Remove traceevent/event-parse.h and traceevent/trace-seq.h from places
where it is not needed.

Should avoid rebuilding those files when these traceevent headers get
changed.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt (VMware) 
Cc: Tzvetomir Stoyanov 
Link: https://lkml.kernel.org/n/tip-26hn75jn9rdealn4uqtze...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-timechart.c | 1 -
 tools/perf/util/session.c  | 1 -
 tools/perf/util/trace-event.h  | 1 -
 3 files changed, 3 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 1ff81a7..1a74499 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -10,7 +10,6 @@
 
 #include 
 #include 
-#include 
 
 #include "builtin.h"
 #include "util/color.h"
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 13486bc..9eb843e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -4,7 +4,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 258d790..2e15838 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -3,7 +3,6 @@
 #define _PERF_UTIL_TRACE_EVENT_H
 
 #include 
-#include 
 #include "parse-events.h"
 
 struct machine;


[tip: perf/core] perf dsos: Move the dsos struct and its methods to separate source files

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 4a3cec84949d14dc3ef7fb8a51b8949af93cac13
Gitweb:
https://git.kernel.org/tip/4a3cec84949d14dc3ef7fb8a51b8949af93cac13
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 11:11:01 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf dsos: Move the dsos struct and its methods to separate source files

So that we can reduce the header dependency tree further, in the process
noticed that lots of places were getting even things like build-id
routines and 'struct perf_tool' definition indirectly, so fix all those
too.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-ti0btma9ow5ndrytyoqdk...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-annotate.c  |   1 +-
 tools/perf/builtin-buildid-cache.c |   1 +-
 tools/perf/builtin-buildid-list.c  |   1 +-
 tools/perf/builtin-inject.c|   1 +-
 tools/perf/builtin-kallsyms.c  |   1 +-
 tools/perf/builtin-kmem.c  |   1 +-
 tools/perf/builtin-kvm.c   |   1 +-
 tools/perf/builtin-mem.c   |   1 +-
 tools/perf/builtin-report.c|   1 +-
 tools/perf/builtin-script.c|   1 +-
 tools/perf/builtin-top.c   |   1 +-
 tools/perf/builtin-trace.c |   2 +-
 tools/perf/tests/code-reading.c|   1 +-
 tools/perf/tests/dso-data.c|   1 +-
 tools/perf/tests/dwarf-unwind.c|   1 +-
 tools/perf/tests/event_update.c|   1 +-
 tools/perf/tests/hists_common.c|   1 +-
 tools/perf/tests/hists_cumulate.c  |   1 +-
 tools/perf/tests/hists_output.c|   1 +-
 tools/perf/tests/vmlinux-kallsyms.c|   1 +-
 tools/perf/ui/browsers/annotate.c  |   1 +-
 tools/perf/ui/browsers/hists.c |   1 +-
 tools/perf/util/Build  |   1 +-
 tools/perf/util/bpf-event.c|   1 +-
 tools/perf/util/callchain.c|   1 +-
 tools/perf/util/cs-etm.c   |   2 +-
 tools/perf/util/db-export.c|   1 +-
 tools/perf/util/dso.c  | 235 +
 tools/perf/util/dso.h  |  25 +-
 tools/perf/util/dsos.c | 232 -
 tools/perf/util/dsos.h |  44 +-
 tools/perf/util/event.c|   2 +-
 tools/perf/util/header.c   |   1 +-
 tools/perf/util/hist.c |   1 +-
 tools/perf/util/intel-bts.c|   1 +-
 tools/perf/util/jitdump.c  |   1 +-
 tools/perf/util/machine.c  |   1 +-
 tools/perf/util/machine.h  |   3 +-
 tools/perf/util/map.c  |   1 +-
 tools/perf/util/parse-events.c |   1 +-
 tools/perf/util/probe-event.c  |   2 +-
 tools/perf/util/s390-cpumsf.c  |   1 +-
 tools/perf/util/scripting-engines/trace-event-perl.c   |   1 +-
 tools/perf/util/scripting-engines/trace-event-python.c |   2 +-
 tools/perf/util/sort.c |   1 +-
 tools/perf/util/thread.c   |   1 +-
 tools/perf/util/unwind-libdw.c |   1 +-
 tools/perf/util/unwind-libunwind.c |   1 +-
 tools/perf/util/vdso.c |   1 +-
 49 files changed, 331 insertions(+), 257 deletions(-)
 create mode 100644 tools/perf/util/dsos.c
 create mode 100644 tools/perf/util/dsos.h

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 9bb6371..738471a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -27,6 +27,7 @@
 #include "util/thread.h"
 #include "util/sort.h"
 #include "util/hist.h"
+#include "util/dso.h"
 #include "util/map.h"
 #include "util/session.h"
 #include "util/tool.h"
diff --git a/tools/perf/builtin-buildid-cache.c 
b/tools/perf/builtin-buildid-cache.c
index 9e75600..b035911 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -22,6 +22,7 @@
 #include "util/strlist.h"
 #include "util/build-id.h"
 #include "util/session.h"
+#include "util/dso.h"
 #include "util/symbol.h"
 #include "util/time-utils.h"
 #include "util/util.h"
diff --git a/tools/perf/builtin-bui

[tip: perf/core] perf symbols: Add missing linux/refcount.h to symbol.h

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: c38fa94d188234f40fe3911b1a7650e056ef42ea
Gitweb:
https://git.kernel.org/tip/c38fa94d188234f40fe3911b1a7650e056ef42ea
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 10:19:19 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:19:28 -03:00

perf symbols: Add missing linux/refcount.h to symbol.h

We use refcount_t there, so we need that header or else it'll break when
we remove dso.h, that is from where it is getting that definition now...

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-5albrk0uve6x9cf6x3ebw...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index bcc0d84..22660c7 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -3,6 +3,7 @@
 #define __PERF_SYMBOL 1
 
 #include 
+#include 
 #include 
 #include 
 #include 


[tip: perf/core] perf tools: Remove needless evlist.h include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: fa0d98462fae5d4951f22f3ac1090d48c53396d1
Gitweb:
https://git.kernel.org/tip/fa0d98462fae5d4951f22f3ac1090d48c53396d1
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 12:52:25 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf tools: Remove needless evlist.h include directives

Remove the last unneeded use of cache.h in a header, we can check where
it is really needed, i.e. we can remove it and be sure that it isn't
being obtained indirectly.

This is an old file, used by now incorrectly in many places, so it was
providing includes needed indirectly, fixup this fallout.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-3x3l8gihoaeh7714os861...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-buildid-cache.c  | 3 ++-
 tools/perf/builtin-buildid-list.c   | 2 +-
 tools/perf/builtin-kvm.c| 4 +++-
 tools/perf/builtin-list.c   | 2 +-
 tools/perf/builtin-lock.c   | 2 +-
 tools/perf/builtin-sched.c  | 2 +-
 tools/perf/builtin-script.c | 2 +-
 tools/perf/builtin-timechart.c  | 2 +-
 tools/perf/perf.c   | 2 +-
 tools/perf/tests/llvm.c | 2 +-
 tools/perf/ui/browsers/header.c | 1 -
 tools/perf/ui/gtk/browser.c | 1 -
 tools/perf/ui/gtk/hists.c   | 1 -
 tools/perf/ui/gtk/setup.c   | 1 -
 tools/perf/ui/helpline.h| 2 --
 tools/perf/ui/progress.c| 1 -
 tools/perf/ui/setup.c   | 3 ++-
 tools/perf/ui/tui/helpline.c| 1 +
 tools/perf/ui/tui/progress.c| 1 -
 tools/perf/ui/tui/setup.c   | 2 --
 tools/perf/ui/tui/util.c| 1 -
 tools/perf/util/annotate.c  | 1 -
 tools/perf/util/color.c | 3 ++-
 tools/perf/util/color_config.c  | 3 ++-
 tools/perf/util/debug.c | 2 +-
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 +-
 tools/perf/util/parse-events.c  | 2 +-
 tools/perf/util/path.c  | 3 ++-
 tools/perf/util/path.h  | 3 +++
 tools/perf/util/pmu.c   | 3 ++-
 tools/perf/util/probe-event.c   | 3 ++-
 tools/perf/util/probe-file.c| 2 +-
 32 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/tools/perf/builtin-buildid-cache.c 
b/tools/perf/builtin-buildid-cache.c
index b035911..1a69eb5 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -15,9 +15,9 @@
 #include 
 #include "builtin.h"
 #include "namespaces.h"
-#include "util/cache.h"
 #include "util/debug.h"
 #include "util/header.h"
+#include 
 #include 
 #include "util/strlist.h"
 #include "util/build-id.h"
@@ -27,6 +27,7 @@
 #include "util/time-utils.h"
 #include "util/util.h"
 #include "util/probe-file.h"
+#include 
 
 static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
 {
diff --git a/tools/perf/builtin-buildid-list.c 
b/tools/perf/builtin-buildid-list.c
index 38b2ec6..5a0d8b3 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -10,9 +10,9 @@
 #include "builtin.h"
 #include "perf.h"
 #include "util/build-id.h"
-#include "util/cache.h"
 #include "util/debug.h"
 #include "util/dso.h"
+#include 
 #include 
 #include "util/session.h"
 #include "util/symbol.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 474c479..0a4fcbe 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -6,12 +6,12 @@
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/term.h"
-#include "util/cache.h"
 #include "util/symbol.h"
 #include "util/thread.h"
 #include "util/header.h"
 #include "util/session.h"
 #include "util/intlist.h"
+#include 
 #include 
 #include "util/trace-event.h"
 #include "util/debug.h"
@@ -20,6 +20,7 @@
 #include "util/top.h"
 #include "util/data.h"
 #include "util/ordered-events.h"
+#include "ui/ui.h"
 
 #include 
 #ifdef HAVE_TIMERFD_SUPPORT
@@ -31,6 +32,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 11afb76..e290f6b 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -11,10 +11,10 @@
 #include "builtin.h"
 
 #include "util/parse-events.h"
-#include "util/cache.h"
 #include "util/pmu.h"
 #include "util/debug.h"
 #includ

[tip: perf/core] libtraceevent: Remove tep_register_trace_clock()

2019-09-02 Thread tip-bot2 for Tzvetomir Stoyanov
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 5d6552ab3b71fac48a9c7452c7014d37ca80b17f
Gitweb:
https://git.kernel.org/tip/5d6552ab3b71fac48a9c7452c7014d37ca80b17f
Author:Tzvetomir Stoyanov 
AuthorDate:Mon, 05 Aug 2019 16:43:14 -04:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:19:28 -03:00

libtraceevent: Remove tep_register_trace_clock()

The tep_register_trace_clock() API is used to instruct the traceevent
library how to print the event time stamps. As event print interface if
redesigned, this API is not needed any more.  The new event print API is
flexible and the user can specify how the time stamps are printed.

Signed-off-by: Tzvetomir Stoyanov 
Cc: Andrew Morton 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Patrick McLean 
Cc: linux-trace-de...@vger.kernel.org
Link: 
http://lore.kernel.org/linux-trace-devel/20190801074959.22023-3-tz.stoya...@gmail.com
Link: http://lore.kernel.org/lkml/20190805204355.195042...@goodmis.org
Signed-off-by: Steven Rostedt (VMware) 
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/traceevent/event-parse-local.h |  2 --
 tools/lib/traceevent/event-parse.c   | 11 ---
 tools/lib/traceevent/event-parse.h   |  1 -
 3 files changed, 14 deletions(-)

diff --git a/tools/lib/traceevent/event-parse-local.h 
b/tools/lib/traceevent/event-parse-local.h
index 6e58ee1..cee4698 100644
--- a/tools/lib/traceevent/event-parse-local.h
+++ b/tools/lib/traceevent/event-parse-local.h
@@ -81,8 +81,6 @@ struct tep_handle {
 
/* cache */
struct tep_event *last_event;
-
-   char *trace_clock;
 };
 
 void tep_free_event(struct tep_event *event);
diff --git a/tools/lib/traceevent/event-parse.c 
b/tools/lib/traceevent/event-parse.c
index d1085aa..bb22238 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -393,16 +393,6 @@ int tep_override_comm(struct tep_handle *tep, const char 
*comm, int pid)
return _tep_register_comm(tep, comm, pid, true);
 }
 
-int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock)
-{
-   tep->trace_clock = strdup(trace_clock);
-   if (!tep->trace_clock) {
-   errno = ENOMEM;
-   return -1;
-   }
-   return 0;
-}
-
 struct func_map {
unsigned long long  addr;
char*func;
@@ -7057,7 +7047,6 @@ void tep_free(struct tep_handle *tep)
free_handler(handle);
}
 
-   free(tep->trace_clock);
free(tep->events);
free(tep->sort_events);
free(tep->func_resolver);
diff --git a/tools/lib/traceevent/event-parse.h 
b/tools/lib/traceevent/event-parse.h
index cf7f302..d438ee4 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -435,7 +435,6 @@ int tep_set_function_resolver(struct tep_handle *tep,
 void tep_reset_function_resolver(struct tep_handle *tep);
 int tep_register_comm(struct tep_handle *tep, const char *comm, int pid);
 int tep_override_comm(struct tep_handle *tep, const char *comm, int pid);
-int tep_register_trace_clock(struct tep_handle *tep, const char *trace_clock);
 int tep_register_function(struct tep_handle *tep, char *name,
  unsigned long long addr, char *mod);
 int tep_register_print_string(struct tep_handle *tep, const char *fmt,


[tip: perf/core] libtraceevent: Change users plugin directory

2019-09-02 Thread tip-bot2 for Tzvetomir Stoyanov
The following commit has been merged into the perf/core branch of tip:

Commit-ID: e97fd1383cd77c467d2aed7fa4e596789df83977
Gitweb:
https://git.kernel.org/tip/e97fd1383cd77c467d2aed7fa4e596789df83977
Author:Tzvetomir Stoyanov 
AuthorDate:Mon, 05 Aug 2019 16:43:15 -04:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:19:28 -03:00

libtraceevent: Change users plugin directory

To be compliant with XDG user directory layout, the user's plugin
directory is changed from ~/.traceevent/plugins to
~/.local/lib/traceevent/plugins/

Suggested-by: Patrick McLean 
Signed-off-by: Tzvetomir Stoyanov 
Cc: Andrew Morton 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Patrick McLean 
Cc: linux-trace-de...@vger.kernel.org
Link: 
https://lore.kernel.org/linux-trace-devel/20190313144206.41e75cf8@patrickm/
Link: 
http://lore.kernel.org/linux-trace-devel/20190801074959.22023-4-tz.stoya...@gmail.com
Link: http://lore.kernel.org/lkml/20190805204355.344622...@goodmis.org
Signed-off-by: Steven Rostedt (VMware) 
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/traceevent/Makefile   | 6 +++---
 tools/lib/traceevent/event-plugin.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 8352d53..a39cdd0 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -62,15 +62,15 @@ set_plugin_dir := 1
 
 # Set plugin_dir to preffered global plugin location
 # If we install under $HOME directory we go under
-# $(HOME)/.traceevent/plugins
+# $(HOME)/.local/lib/traceevent/plugins
 #
 # We dont set PLUGIN_DIR in case we install under $HOME
 # directory, because by default the code looks under:
-# $(HOME)/.traceevent/plugins by default.
+# $(HOME)/.local/lib/traceevent/plugins by default.
 #
 ifeq ($(plugin_dir),)
 ifeq ($(prefix),$(HOME))
-override plugin_dir = $(HOME)/.traceevent/plugins
+override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
 set_plugin_dir := 0
 else
 override plugin_dir = $(libdir)/traceevent/plugins
diff --git a/tools/lib/traceevent/event-plugin.c 
b/tools/lib/traceevent/event-plugin.c
index 8ca28de..e1f7ddd 100644
--- a/tools/lib/traceevent/event-plugin.c
+++ b/tools/lib/traceevent/event-plugin.c
@@ -18,7 +18,7 @@
 #include "event-utils.h"
 #include "trace-seq.h"
 
-#define LOCAL_PLUGIN_DIR ".traceevent/plugins"
+#define LOCAL_PLUGIN_DIR ".local/lib/traceevent/plugins/"
 
 static struct registered_plugin_options {
struct registered_plugin_options*next;


[tip: perf/core] perf metricgroup: Support multiple events for metricgroup

2019-09-02 Thread tip-bot2 for Jin Yao
The following commit has been merged into the perf/core branch of tip:

Commit-ID: f01642e4912bb80a01d693f4cc6fb0897207a090
Gitweb:
https://git.kernel.org/tip/f01642e4912bb80a01d693f4cc6fb0897207a090
Author:Jin Yao 
AuthorDate:Wed, 28 Aug 2019 13:59:32 +08:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf metricgroup: Support multiple events for metricgroup

Some uncore metrics don't work as expected. For example, on
cascadelakex:

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

   Performance counter stats for 'system wide':

   1841092  unc_m_pmm_rpq_inserts
   3680816  unc_m_pmm_wpq_inserts

   1.001775055 seconds time elapsed

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

   Performance counter stats for 'system wide':

 860649746  unc_m_pmm_rpq_occupancy.all
   1840557  unc_m_pmm_rpq_inserts
   12790627455  unc_m_clockticks

   1.001773348 seconds time elapsed

No metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' or 'UNC_M_PMM_READ_LATENCY' are
reported.

The issue is, the case of an alias expanding to mulitple events is not
supported, typically the uncore events.  (see comments in
find_evsel_group()).

For UNC_M_PMM_BANDWIDTH.TOTAL in above example, the expanded event group
is '{unc_m_pmm_rpq_inserts,unc_m_pmm_wpq_inserts}:W', but the actual
events passed to find_evsel_group are:

  unc_m_pmm_rpq_inserts
  unc_m_pmm_rpq_inserts
  unc_m_pmm_rpq_inserts
  unc_m_pmm_rpq_inserts
  unc_m_pmm_rpq_inserts
  unc_m_pmm_rpq_inserts
  unc_m_pmm_wpq_inserts
  unc_m_pmm_wpq_inserts
  unc_m_pmm_wpq_inserts
  unc_m_pmm_wpq_inserts
  unc_m_pmm_wpq_inserts
  unc_m_pmm_wpq_inserts

For this multiple events case, it's not supported well.

This patch introduces a new field 'metric_leader' in struct evsel. The
first event is considered as a metric leader. For the rest of same
events, they point to the first event via it's metric_leader field in
struct evsel.

This design is for adding the counting results of all same events to the
first event in group (the metric_leader).

With this patch,

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_BANDWIDTH.TOTAL -a -- sleep 1

   Performance counter stats for 'system wide':

   1842108  unc_m_pmm_rpq_inserts #337.2 MB/sec  
UNC_M_PMM_BANDWIDTH.TOTAL
   3682209  unc_m_pmm_wpq_inserts

   1.001819706 seconds time elapsed

  root@lkp-csl-2sp2:~# perf stat -M UNC_M_PMM_READ_LATENCY -a -- sleep 1

   Performance counter stats for 'system wide':

 861970685  unc_m_pmm_rpq_occupancy.all #219.4 ns  
UNC_M_PMM_READ_LATENCY
   1842772  unc_m_pmm_rpq_inserts
   12790196356  unc_m_clockticks

   1.001749103 seconds time elapsed

Now we can see the correct metrics 'UNC_M_PMM_BANDWIDTH.TOTAL' and
'UNC_M_PMM_READ_LATENCY'.

Signed-off-by: Jin Yao 
Cc: Alexander Shishkin 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Peter Zijlstra 
Link: http://lore.kernel.org/lkml/20190828055932.8269-5-yao@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/evsel.h   |  1 +-
 tools/perf/util/metricgroup.c | 84 +-
 tools/perf/util/stat-shadow.c | 27 +--
 3 files changed, 68 insertions(+), 44 deletions(-)

diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index fd60cac..68321d1 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -168,6 +168,7 @@ struct evsel {
const char *metric_expr;
const char *metric_name;
struct evsel**metric_events;
+   struct evsel*metric_leader;
boolcollect_stat;
boolweak_group;
boolpercore;
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index f474a29..a7c0424 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -90,57 +90,61 @@ struct egroup {
const char *metric_unit;
 };
 
-static bool record_evsel(int *ind, struct evsel **start,
-int idnum,
-struct evsel **metric_events,
-struct evsel *ev)
-{
-   metric_events[*ind] = ev;
-   if (*ind == 0)
-   *start = ev;
-   if (++*ind == idnum) {
-   metric_events[*ind] = NULL;
-   return true;
-   }
-   return false;
-}
-
 static struct evsel *find_evsel_group(struct evlist *perf_evlist,
  const char **ids,
  int idnum,
  struct evsel **metric_events)
 {
-   struct evsel *ev, *start = NULL;
-   int ind = 0;
+   struct evsel *ev;
+   int i = 0;
+   bool leader_found;
 
evlist__for_each_entry (perf_evlist, ev) {
- 

[tip: perf/core] perf symbols: Move mem_info and branch_info out of symbol.h

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: d3300a3c4e76ccecf4daa889327e340a870c550b
Gitweb:
https://git.kernel.org/tip/d3300a3c4e76ccecf4daa889327e340a870c550b
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 15:09:54 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:48 -03:00

perf symbols: Move mem_info and branch_info out of symbol.h

The mem_info struct goes to mem-events.h and branch_info goes to
branch.h, where they belong, this way we can remove several headers from
symbols.h and trim the include dependency tree more.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-aupw71xnravcsu2xoabfm...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/powerpc/util/mem-events.c |  1 +
 tools/perf/builtin-annotate.c |  2 ++
 tools/perf/builtin-c2c.c  |  1 +
 tools/perf/builtin-mem.c  |  1 +
 tools/perf/builtin-report.c   |  3 +++
 tools/perf/builtin-version.c  |  2 +-
 tools/perf/tests/mem.c|  1 +
 tools/perf/tests/sample-parsing.c |  1 +
 tools/perf/ui/browsers/hists.c|  2 ++
 tools/perf/util/branch.c  |  1 +
 tools/perf/util/branch.h  |  8 
 tools/perf/util/cs-etm.c  |  2 ++
 tools/perf/util/hist.c|  3 +++
 tools/perf/util/machine.c |  3 +++
 tools/perf/util/map.c |  1 +
 tools/perf/util/mem-events.c  |  1 +
 tools/perf/util/mem-events.h  |  9 +
 tools/perf/util/s390-sample-raw.c |  1 -
 tools/perf/util/session.c |  2 ++
 tools/perf/util/sort.c|  2 ++
 tools/perf/util/symbol.c  |  2 ++
 tools/perf/util/symbol.h  | 17 -
 22 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/tools/perf/arch/powerpc/util/mem-events.c 
b/tools/perf/arch/powerpc/util/mem-events.c
index d08311f..07fb5e0 100644
--- a/tools/perf/arch/powerpc/util/mem-events.c
+++ b/tools/perf/arch/powerpc/util/mem-events.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "map_symbol.h"
 #include "mem-events.h"
 
 /* PowerPC does not support 'ldlat' parameter. */
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 7135b77..4e4d2e7 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -33,6 +33,8 @@
 #include "util/data.h"
 #include "arch/common.h"
 #include "util/block-range.h"
+#include "util/map_symbol.h"
+#include "util/branch.h"
 
 #include 
 #include 
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 0d76b2c..b09b12e 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -22,6 +22,7 @@
 #include "builtin.h"
 #include 
 #include 
+#include "map_symbol.h"
 #include "mem-events.h"
 #include "session.h"
 #include "hist.h"
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index c5f3b9e..27d2bde 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -11,6 +11,7 @@
 #include "util/tool.h"
 #include "util/session.h"
 #include "util/data.h"
+#include "util/map_symbol.h"
 #include "util/mem-events.h"
 #include "util/debug.h"
 #include "util/dso.h"
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d7a3456..b18fab9 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -19,6 +19,9 @@
 #include 
 #include "util/map.h"
 #include "util/symbol.h"
+#include "util/map_symbol.h"
+#include "util/mem-events.h"
+#include "util/branch.h"
 #include "util/callchain.h"
 #include "util/values.h"
 
diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c
index bf114ca..05cf2af 100644
--- a/tools/perf/builtin-version.c
+++ b/tools/perf/builtin-version.c
@@ -2,8 +2,8 @@
 #include "builtin.h"
 #include "perf.h"
 #include "color.h"
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/tests/mem.c b/tools/perf/tests/mem.c
index efe3397..673a11a 100644
--- a/tools/perf/tests/mem.c
+++ b/tools/perf/tests/mem.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "util/map_symbol.h"
 #include "util/mem-events.h"
 #include "util/symbol.h"
 #include "linux/perf_event.h"
diff --git a/tools/perf/tests/sample-parsing.c 
b/tools/perf/tests/sample-parsing.c
index 0c09dc1..5fcc068 100644
--- a/tools/perf/tests/sample-parsing.c
+++ b/tools/perf/tests/sample-parsing.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 
+#include "map_symbol.h"
 #include "branch.h"
 #include "util.h"
 #include "event.h"
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index f7e54c1..589168c 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -20,6 +20,8 @@
 #include "../../util/hist.h"
 #inc

[tip: perf/core] objtool: Ignore intentional differences for the x86 insn decoder

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: ae31a514a134d9e4ca1d7b0f0a19b5934747d79f
Gitweb:
https://git.kernel.org/tip/ae31a514a134d9e4ca1d7b0f0a19b5934747d79f
Author:Arnaldo Carvalho de Melo 
AuthorDate:Sat, 31 Aug 2019 17:35:53 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

objtool: Ignore intentional differences for the x86 insn decoder

Since we need to build this in !x86, we need to explicitely use the x86
files, not things like asm/insn.h, so we intentionally differ from the
master copy in the kernel sources, add -I diff directives to ignore just
these differences when checking for drift.

Acked-by: Josh Poimboeuf 
Link: http://lore.kernel.org/lkml/20190830193109.p7jagidsrahoa4pn@treble
Acked-by: Masami Hiramatsu 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra (Intel) 
Link: https://lkml.kernel.org/n/tip-j965m9b7xtdc83em3twfk...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/objtool/sync-check.sh |  9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
index 6fa87de..0a832e2 100755
--- a/tools/objtool/sync-check.sh
+++ b/tools/objtool/sync-check.sh
@@ -2,12 +2,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 FILES='
-arch/x86/include/asm/inat.h
 arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/insn.h
 arch/x86/include/asm/orc_types.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 '
@@ -47,4 +43,9 @@ for i in $FILES; do
   check $i
 done
 
+check arch/x86/include/asm/inat.h '-I "^#include 
[\"<]\(asm/\)*inat_types.h[\">]"'
+check arch/x86/include/asm/insn.h '-I "^#include 
[\"<]\(asm/\)*inat.h[\">]"'
+check arch/x86/lib/inat.c '-I "^#include 
[\"<]\(../include/\)*asm/insn.h[\">]"'
+check arch/x86/lib/insn.c '-I "^#include 
[\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
+
 cd -


[tip: perf/core] objtool: Update sync-check.sh from perf's check-headers.sh

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 2ffd84ae973b5ad16be96840574bb1142fda268a
Gitweb:
https://git.kernel.org/tip/2ffd84ae973b5ad16be96840574bb1142fda268a
Author:Arnaldo Carvalho de Melo 
AuthorDate:Sat, 31 Aug 2019 17:29:47 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

objtool: Update sync-check.sh from perf's check-headers.sh

To allow using the -I trick that will be needed for checking the x86
insn decoder files.

Without the specific -I lines we still get the same warnings as before:

  $ make -C tools/objtool/ clean ; make -C tools/objtool/
  make: Entering directory '/home/acme/git/perf/tools/objtool'
CLEANobjtool
  find  -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
  rm -f arch/x86/inat-tables.c fixdep
  
LD   objtool-in.o
  make[1]: Leaving directory '/home/acme/git/perf/tools/objtool'
  Warning: Kernel ABI header at 'tools/arch/x86/include/asm/inat.h' differs 
from latest version at 'arch/x86/include/asm/inat.h'
  diff -u tools/arch/x86/include/asm/inat.h arch/x86/include/asm/inat.h
  Warning: Kernel ABI header at 'tools/arch/x86/include/asm/insn.h' differs 
from latest version at 'arch/x86/include/asm/insn.h'
  diff -u tools/arch/x86/include/asm/insn.h arch/x86/include/asm/insn.h
  Warning: Kernel ABI header at 'tools/arch/x86/lib/inat.c' differs from latest 
version at 'arch/x86/lib/inat.c'
  diff -u tools/arch/x86/lib/inat.c arch/x86/lib/inat.c
  Warning: Kernel ABI header at 'tools/arch/x86/lib/insn.c' differs from latest 
version at 'arch/x86/lib/insn.c'
  diff -u tools/arch/x86/lib/insn.c arch/x86/lib/insn.c
  /home/acme/git/perf/tools/objtool
LINK objtool
  make: Leaving directory '/home/acme/git/perf/tools/objtool'
  $

The next patch will add the -I lines for those files.

Acked-by: Josh Poimboeuf 
Link: http://lore.kernel.org/lkml/20190830193109.p7jagidsrahoa4pn@treble
Acked-by: Masami Hiramatsu 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra (Intel) 
Link: https://lkml.kernel.org/n/tip-vu3p38mnxlwd80rlsnjkq...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/objtool/sync-check.sh | 31 ++-
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/tools/objtool/sync-check.sh b/tools/objtool/sync-check.sh
index 66f1575..6fa87de 100755
--- a/tools/objtool/sync-check.sh
+++ b/tools/objtool/sync-check.sh
@@ -12,18 +12,39 @@ arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 '
 
-check()
-{
-   local file=$1
+check_2 () {
+  file1=$1
+  file2=$2
 
-   diff ../$file ../../$file > /dev/null ||
-   echo "Warning: synced file at 'tools/objtool/$file' differs 
from latest kernel version at '$file'"
+  shift
+  shift
+
+  cmd="diff $* $file1 $file2 > /dev/null"
+
+  test -f $file2 && {
+eval $cmd || {
+  echo "Warning: Kernel ABI header at '$file1' differs from latest version 
at '$file2'" >&2
+  echo diff -u $file1 $file2
+}
+  }
+}
+
+check () {
+  file=$1
+
+  shift
+
+  check_2 tools/$file $file $*
 }
 
 if [ ! -d ../../kernel ] || [ ! -d ../../tools ] || [ ! -d ../objtool ]; then
exit 0
 fi
 
+cd ../..
+
 for i in $FILES; do
   check $i
 done
+
+cd -


[tip: perf/core] perf metricgroup: Scale the metric result

2019-09-02 Thread tip-bot2 for Jin Yao
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 287f2649f791819dd2d8f32f0213c8c521d6dfa0
Gitweb:
https://git.kernel.org/tip/287f2649f791819dd2d8f32f0213c8c521d6dfa0
Author:Jin Yao 
AuthorDate:Wed, 28 Aug 2019 13:59:31 +08:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf metricgroup: Scale the metric result

Some metrics define the scale unit, such as

{
"BriefDescription": "Intel Optane DC persistent memory read latency 
(ns). Derived from unc_m_pmm_rpq_occupancy.all",
"Counter": "0,1,2,3",
"EventCode": "0xE0",
"EventName": "UNC_M_PMM_READ_LATENCY",
"MetricExpr": "UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / 
UNC_M_CLOCKTICKS",
"MetricName": "UNC_M_PMM_READ_LATENCY",
"PerPkg": "1",
"ScaleUnit": "60ns",
"UMask": "0x1",
"Unit": "iMC"
},

For above example, the ratio should be,

ratio = (UNC_M_PMM_RPQ_OCCUPANCY.ALL / UNC_M_PMM_RPQ_INSERTS / 
UNC_M_CLOCKTICKS) * 60

But in current code, the ratio is not scaled ( * 60)

With this patch, the ratio is scaled and the unit (ns) is printed.

For example,
  #219.4 ns  UNC_M_PMM_READ_LATENCY

Signed-off-by: Jin Yao 
Cc: Alexander Shishkin 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Peter Zijlstra 
Link: http://lore.kernel.org/lkml/20190828055932.8269-4-yao@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/metricgroup.c |  3 +++-
 tools/perf/util/metricgroup.h |  1 +-
 tools/perf/util/stat-shadow.c | 38 --
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 33f5e21..f474a29 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -87,6 +87,7 @@ struct egroup {
const char **ids;
const char *metric_name;
const char *metric_expr;
+   const char *metric_unit;
 };
 
 static bool record_evsel(int *ind, struct evsel **start,
@@ -182,6 +183,7 @@ static int metricgroup__setup_events(struct list_head 
*groups,
}
expr->metric_expr = eg->metric_expr;
expr->metric_name = eg->metric_name;
+   expr->metric_unit = eg->metric_unit;
expr->metric_events = metric_events;
list_add(&expr->nd, &me->head);
}
@@ -453,6 +455,7 @@ static int metricgroup__add_metric(const char *metric, 
struct strbuf *events,
eg->idnum = idnum;
eg->metric_name = pe->metric_name;
eg->metric_expr = pe->metric_expr;
+   eg->metric_unit = pe->unit;
list_add_tail(&eg->nd, group_list);
ret = 0;
}
diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h
index e5092f6..475c7f9 100644
--- a/tools/perf/util/metricgroup.h
+++ b/tools/perf/util/metricgroup.h
@@ -20,6 +20,7 @@ struct metric_expr {
struct list_head nd;
const char *metric_expr;
const char *metric_name;
+   const char *metric_unit;
struct evsel **metric_events;
 };
 
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 2ed5e00..696d263 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -715,6 +715,7 @@ static void generic_metric(struct perf_stat_config *config,
   struct evsel **metric_events,
   char *name,
   const char *metric_name,
+  const char *metric_unit,
   double avg,
   int cpu,
   struct perf_stat_output_ctx *out,
@@ -722,7 +723,7 @@ static void generic_metric(struct perf_stat_config *config,
 {
print_metric_t print_metric = out->print_metric;
struct parse_ctx pctx;
-   double ratio;
+   double ratio, scale;
int i;
void *ctxp = out->ctx;
char *n, *pn;
@@ -732,7 +733,6 @@ static void generic_metric(struct perf_stat_config *config,
for (i = 0; metric_events[i]; i++) {
struct saved_value *v;
struct stats *stats;
-   double scale;
 
if (!strcmp(metric_events[i]->name, "duration_time")) {
stats = &walltime_nsecs_stats;
@@ -762,16 +762,32 @@ static void generic_metric(struct perf_stat_config 
*config,
if (!metric_events[i]) {
const char *p = metric_expr;
 
-   if (expr__parse(&ratio, &pctx, &p) == 0)
-   print_metric(config, ctxp, NULL, "%8.1f",
-   metric_name ?
-   metric_name :
-   out->force_header ?  name : "",
-   

[tip: perf/core] perf auxtrace: Uninline functions that touch perf_session

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: f2a39fe84901df2b3d1bec3459b65cee3e8db57c
Gitweb:
https://git.kernel.org/tip/f2a39fe84901df2b3d1bec3459b65cee3e8db57c
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 14:45:20 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf auxtrace: Uninline functions that touch perf_session

So that we don't carry the session.h include directive in auxtrace.h,
which in turn opens a can of worms of files that were getting all sorts
of things via that include, fix them all.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-d2d83aovpgri2z75wlitq...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm/annotate/instructions.c   |  1 +-
 tools/perf/arch/arm/util/cs-etm.c |  1 +-
 tools/perf/arch/arm64/annotate/instructions.c |  1 +-
 tools/perf/arch/x86/tests/perf-time-to-tsc.c  |  1 +-
 tools/perf/builtin-ftrace.c   |  1 +-
 tools/perf/tests/backward-ring-buffer.c   |  1 +-
 tools/perf/tests/bpf.c|  1 +-
 tools/perf/tests/builtin-test.c   |  1 +-
 tools/perf/tests/code-reading.c   |  6 +++-
 tools/perf/tests/event-times.c|  1 +-
 tools/perf/tests/event_update.c   |  2 +-
 tools/perf/tests/keep-tracking.c  |  1 +-
 tools/perf/tests/mmap-basic.c |  1 +-
 tools/perf/tests/parse-events.c   |  1 +-
 tools/perf/tests/switch-tracking.c|  1 +-
 tools/perf/ui/browsers/hists.c|  1 +-
 tools/perf/ui/browsers/res_sample.c   |  2 +-
 tools/perf/ui/browsers/scripts.c  |  1 +-
 tools/perf/ui/hist.c  |  2 +-
 tools/perf/ui/stdio/hist.c|  1 +-
 tools/perf/util/annotate.c|  3 +-
 tools/perf/util/auxtrace.c| 33 ++-
 tools/perf/util/auxtrace.h| 43 ++
 tools/perf/util/bpf-loader.c  |  1 +-
 tools/perf/util/cgroup.c  |  2 +-
 tools/perf/util/config.c  |  1 +-
 tools/perf/util/cs-etm.c  |  1 +-
 tools/perf/util/cs-etm.h  |  3 +-
 tools/perf/util/dso.c |  2 +-
 tools/perf/util/evlist.c  |  1 +-
 tools/perf/util/evsel.c   |  1 +-
 tools/perf/util/machine.c |  2 +-
 tools/perf/util/mmap.c|  3 +-
 tools/perf/util/mmap.h|  1 +-
 tools/perf/util/python.c  |  2 +-
 tools/perf/util/record.c  |  2 +-
 tools/perf/util/s390-sample-raw.c |  1 +-
 tools/perf/util/sort.c|  1 +-
 tools/perf/util/stat-display.c|  1 +-
 tools/perf/util/stat.c|  3 +-
 tools/perf/util/top.h |  1 +-
 41 files changed, 98 insertions(+), 38 deletions(-)

diff --git a/tools/perf/arch/arm/annotate/instructions.c 
b/tools/perf/arch/arm/annotate/instructions.c
index c7d1a69..e1d4b48 100644
--- a/tools/perf/arch/arm/annotate/instructions.c
+++ b/tools/perf/arch/arm/annotate/instructions.c
@@ -3,6 +3,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct arm_annotate {
regex_t call_insn,
diff --git a/tools/perf/arch/arm/util/cs-etm.c 
b/tools/perf/arch/arm/util/cs-etm.c
index 59e44f9..c32db09 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -26,6 +26,7 @@
 #include "../../util/pmu.h"
 #include "../../util/cs-etm.h"
 #include "../../util/util.h"
+#include "../../util/session.h"
 
 #include 
 #include 
diff --git a/tools/perf/arch/arm64/annotate/instructions.c 
b/tools/perf/arch/arm64/annotate/instructions.c
index 8f70a1b..43aa93e 100644
--- a/tools/perf/arch/arm64/annotate/instructions.c
+++ b/tools/perf/arch/arm64/annotate/instructions.c
@@ -2,6 +2,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct arm64_annotate {
regex_t call_insn,
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c 
b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index 2d1f471..eb36359 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index 2f8ea44..d5adc41 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/tests/backward-ring-buffer.c 
b/tools/perf/tests/backward-ring-buffer.c
index 512288e..a637a4a 100644
--- a/tools/perf/tests/backward-ring-buffe

[tip: perf/core] perf intel-pt: Use shared x86 insn decoder

2019-09-02 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 00a263902ac3da886cf275663a938f503a853f68
Gitweb:
https://git.kernel.org/tip/00a263902ac3da886cf275663a938f503a853f68
Author:Josh Poimboeuf 
AuthorDate:Thu, 29 Aug 2019 17:41:21 -05:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf intel-pt: Use shared x86 insn decoder

Now that there's a common version of the decoder for all tools, use it
instead of the local copy.

Also use perf's check-headers.sh script to diff the decoder files to
make sure they remain in sync with the kernel version.  Objtool has a
similar check.

Committer notes:

Had to keep this all pointing explicitely to x86 headers/files, i.e.
instead of asm/isnn.h we had to use ../include/asm/insn.h when the files
were in differemt dirs, or just replace "" with "foo.h".

This way we continue to be able to process perf.data files with Intel PT
traces in distros other than x86.

Also fixed up the awk script paths to use $(srcdir)/tools/arch instead
or relative directories so that we keep detached tarballs (make help |
grep perf) working.

For now the include lines in these headers are being ignored so as not
to flag false reports of kernel/tools out of sync.

Signed-off-by: Josh Poimboeuf 
Reviewed-by: Masami Hiramatsu 
Acked-by: Peter Zijlstra (Intel) 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: x...@kernel.org
Link: 
http://lore.kernel.org/lkml/8a37e615d2880f039505d693d1e068a009358a2b.1567118001.git.jpoim...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/arch/x86/include/asm/inat.h|2 +-
 tools/arch/x86/include/asm/insn.h|2 +-
 tools/arch/x86/lib/inat.c|2 +-
 tools/arch/x86/lib/insn.c|4 +-
 tools/perf/arch/x86/tests/insn-x86.c |2 +-
 tools/perf/arch/x86/util/archinsn.c  |2 +-
 tools/perf/check-headers.sh  |   11 +-
 tools/perf/util/intel-pt-decoder/Build   |   20 +-
 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk   |  392 +---
 tools/perf/util/intel-pt-decoder/inat.c  |   82 +-
 tools/perf/util/intel-pt-decoder/inat.h  |  230 +--
 tools/perf/util/intel-pt-decoder/inat_types.h|   15 +-
 tools/perf/util/intel-pt-decoder/insn.c  |  593 +
 tools/perf/util/intel-pt-decoder/insn.h  |  216 +-
 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c |   10 +-
 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt  | 1072 +---
 16 files changed, 23 insertions(+), 2632 deletions(-)
 delete mode 100644 tools/perf/util/intel-pt-decoder/gen-insn-attr-x86.awk
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/inat_types.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/insn.c
 delete mode 100644 tools/perf/util/intel-pt-decoder/insn.h
 delete mode 100644 tools/perf/util/intel-pt-decoder/x86-opcode-map.txt

diff --git a/tools/arch/x86/include/asm/inat.h 
b/tools/arch/x86/include/asm/inat.h
index 4cf2ad5..877827b 100644
--- a/tools/arch/x86/include/asm/inat.h
+++ b/tools/arch/x86/include/asm/inat.h
@@ -6,7 +6,7 @@
  *
  * Written by Masami Hiramatsu 
  */
-#include 
+#include "inat_types.h"
 
 /*
  * Internal bits. Don't use bitmasks directly, because these bits are
diff --git a/tools/arch/x86/include/asm/insn.h 
b/tools/arch/x86/include/asm/insn.h
index 154f27b..37a4c39 100644
--- a/tools/arch/x86/include/asm/insn.h
+++ b/tools/arch/x86/include/asm/insn.h
@@ -8,7 +8,7 @@
  */
 
 /* insn_attr_t is defined in inat.h */
-#include 
+#include "inat.h"
 
 struct insn_field {
union {
diff --git a/tools/arch/x86/lib/inat.c b/tools/arch/x86/lib/inat.c
index 12539fc..4f5ed49 100644
--- a/tools/arch/x86/lib/inat.c
+++ b/tools/arch/x86/lib/inat.c
@@ -4,7 +4,7 @@
  *
  * Written by Masami Hiramatsu 
  */
-#include 
+#include "../include/asm/insn.h"
 
 /* Attribute tables are generated from opcode map */
 #include "inat-tables.c"
diff --git a/tools/arch/x86/lib/insn.c b/tools/arch/x86/lib/insn.c
index 0b5862b..79e048f 100644
--- a/tools/arch/x86/lib/insn.c
+++ b/tools/arch/x86/lib/insn.c
@@ -10,8 +10,8 @@
 #else
 #include 
 #endif
-#include 
-#include 
+#include "../include/asm/inat.h"
+#include "../include/asm/insn.h"
 
 /* Verify next sizeof(t) bytes can be on the same instruction */
 #define validate_next(t, insn, n)  \
diff --git a/tools/perf/arch/x86/tests/insn-x86.c 
b/tools/perf/arch/x86/tests/insn-x86.c
index d67bc0f..745f29a 100644
--- a/tools/perf/arch/x86/tests/insn-x86.c
+++ b/tools/perf/arch/x86/tests/insn-x86.c
@@ -1,12 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
+#include "../../../../arch/x86/include/asm/insn.h"
 #include 
 
 #include "deb

[tip: x86/urgent] x86/boot: Preserve boot_params.secure_boot from sanitizing

2019-09-02 Thread tip-bot2 for John S. Gruber
The following commit has been merged into the x86/urgent branch of tip:

Commit-ID: 29d9a0b50736768f042752070e5cdf4e4d4c00df
Gitweb:
https://git.kernel.org/tip/29d9a0b50736768f042752070e5cdf4e4d4c00df
Author:John S. Gruber 
AuthorDate:Mon, 02 Sep 2019 00:00:54 +02:00
Committer: Borislav Petkov 
CommitterDate: Mon, 02 Sep 2019 09:17:45 +02:00

x86/boot: Preserve boot_params.secure_boot from sanitizing

Commit

  a90118c445cc ("x86/boot: Save fields explicitly, zero out everything else")

now zeroes the secure boot setting information (enabled/disabled/...)
passed by the boot loader or by the kernel's EFI handover mechanism.

The problem manifests itself with signed kernels using the EFI handoff
protocol with grub and the kernel loses the information whether secure
boot is enabled in the firmware, i.e., the log message "Secure boot
enabled" becomes "Secure boot could not be determined".

efi_main() arch/x86/boot/compressed/eboot.c sets this field early but it
is subsequently zeroed by the above referenced commit.

Include boot_params.secure_boot in the preserve field list.

 [ bp: restructure commit message and massage. ]

Fixes: a90118c445cc ("x86/boot: Save fields explicitly, zero out everything 
else")
Signed-off-by: John S. Gruber 
Signed-off-by: Borislav Petkov 
Reviewed-by: John Hubbard 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: Juergen Gross 
Cc: Mark Brown 
Cc: stable 
Cc: Thomas Gleixner 
Cc: x86-ml 
Link: 
https://lkml.kernel.org/r/capotdmspexauqcy9iahqx3js_fc4mmlqotr5rbgvizycopc...@mail.gmail.com
---
 arch/x86/include/asm/bootparam_utils.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/include/asm/bootparam_utils.h 
b/arch/x86/include/asm/bootparam_utils.h
index 9e5f3c7..981fe92 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -70,6 +70,7 @@ static void sanitize_boot_params(struct boot_params 
*boot_params)
BOOT_PARAM_PRESERVE(eddbuf_entries),
BOOT_PARAM_PRESERVE(edd_mbr_sig_buf_entries),
BOOT_PARAM_PRESERVE(edd_mbr_sig_buffer),
+   BOOT_PARAM_PRESERVE(secure_boot),
BOOT_PARAM_PRESERVE(hdr),
BOOT_PARAM_PRESERVE(e820_table),
BOOT_PARAM_PRESERVE(eddbuf),


[tip: perf/core] perf build: Ignore intentional differences for the x86 insn decoder

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 87a682a7c4e719d238d1839098375470b55e2097
Gitweb:
https://git.kernel.org/tip/87a682a7c4e719d238d1839098375470b55e2097
Author:Arnaldo Carvalho de Melo 
AuthorDate:Sat, 31 Aug 2019 17:14:19 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf build: Ignore intentional differences for the x86 insn decoder

Since we need to build this in !x86, we need to explicitely use the x86
files, not things like asm/insn.h, so we intentionally differ from the
master copy in the kernel sources, add -I diff directives to ignore just
these differences when checking for drift.

Acked-by: Josh Poimboeuf 
Acked-by: Masami Hiramatsu 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra (Intel) 
Link: https://lkml.kernel.org/n/tip-9qziqjjt120mmz6kyepka...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/check-headers.sh | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index cbcc359..e2e0f06 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -26,12 +26,8 @@ include/uapi/linux/hw_breakpoint.h
 arch/x86/include/asm/disabled-features.h
 arch/x86/include/asm/required-features.h
 arch/x86/include/asm/cpufeatures.h
-arch/x86/include/asm/inat.h
 arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/insn.h
 arch/x86/include/uapi/asm/prctl.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
 arch/x86/lib/x86-opcode-map.txt
 arch/x86/tools/gen-insn-attr-x86.awk
 arch/arm/include/uapi/asm/perf_regs.h
@@ -116,6 +112,10 @@ check include/uapi/asm-generic/mman.h '-I "^#include 
<\(uapi/\)*asm-generic/mman
 check include/uapi/linux/mman.h   '-I "^#include <\(uapi/\)*asm/mman.h>"'
 check include/linux/ctype.h  '-I "isdigit("'
 check lib/ctype.c'-I "^EXPORT_SYMBOL" -I "^#include 
" -B'
+check arch/x86/include/asm/inat.h '-I "^#include 
[\"<]\(asm/\)*inat_types.h[\">]"'
+check arch/x86/include/asm/insn.h '-I "^#include 
[\"<]\(asm/\)*inat.h[\">]"'
+check arch/x86/lib/inat.c'-I "^#include 
[\"<]\(../include/\)*asm/insn.h[\">]"'
+check arch/x86/lib/insn.c'-I "^#include 
[\"<]\(../include/\)*asm/in\(at\|sn\).h[\">]"'
 
 # diff non-symmetric files
 check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl 
arch/x86/entry/syscalls/syscall_64.tbl


[tip: perf/core] perf probe: No need for symbol.h, symbol_conf is enough

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: afce8c482c48e2c42c155eeae4cd048c2b5fbb99
Gitweb:
https://git.kernel.org/tip/afce8c482c48e2c42c155eeae4cd048c2b5fbb99
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 11:56:47 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf probe: No need for symbol.h, symbol_conf is enough

Remove one more unneeded use of symbol.h

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-vrda1tuem1o8pk82t2kfj...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 6dce172..26bc592 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -21,7 +21,7 @@
 #include "util/build-id.h"
 #include "util/strlist.h"
 #include "util/strfilter.h"
-#include "util/symbol.h"
+#include "util/symbol_conf.h"
 #include "util/debug.h"
 #include 
 #include "util/probe-finder.h"


[tip: perf/core] perf tools: Remove needless perf.h include directive from headers

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: c1a604dff486399ae0be95e6396e0158df95ad5d
Gitweb:
https://git.kernel.org/tip/c1a604dff486399ae0be95e6396e0158df95ad5d
Author:Arnaldo Carvalho de Melo 
AuthorDate:Thu, 29 Aug 2019 15:20:59 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Thu, 29 Aug 2019 17:38:32 -03:00

perf tools: Remove needless perf.h include directive from headers

Its not needed there, add it to the places that need it and were getting
it via those headers.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-5yulx1u16vyd0zmrbg1tj...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-c2c.c| 1 +
 tools/perf/builtin-diff.c   | 1 +
 tools/perf/builtin-record.c | 1 +
 tools/perf/builtin-script.c | 1 +
 tools/perf/builtin-stat.c   | 1 +
 tools/perf/builtin-trace.c  | 1 +
 tools/perf/perf.c   | 1 +
 tools/perf/ui/browsers/hists.c  | 1 +
 tools/perf/ui/browsers/res_sample.c | 1 +
 tools/perf/ui/browsers/scripts.c| 1 +
 tools/perf/ui/hist.c| 1 +
 tools/perf/ui/tui/setup.c   | 1 +
 tools/perf/util/auxtrace.h  | 1 -
 tools/perf/util/callchain.c | 1 +
 tools/perf/util/event.c | 1 +
 tools/perf/util/event.h | 1 -
 tools/perf/util/evlist.c| 1 +
 tools/perf/util/evlist.h| 1 -
 tools/perf/util/mmap.c  | 1 +
 tools/perf/util/session.c   | 1 +
 tools/perf/util/top.c   | 1 +
 21 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 8335a40..25a5f18 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -35,6 +35,7 @@
 #include "thread.h"
 #include "mem2node.h"
 #include "symbol.h"
+#include "../perf.h"
 
 struct c2c_hists {
struct histshists;
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 51c37e5..ae4a8eb 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -6,6 +6,7 @@
  * DSOs and symbol information, sort them and produce a diff.
  */
 #include "builtin.h"
+#include "perf.h"
 
 #include "util/debug.h"
 #include "util/event.h"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bd2a0cc..56705d2 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -42,6 +42,7 @@
 #include "util/units.h"
 #include "util/bpf-event.h"
 #include "asm/bug.h"
+#include "perf.h"
 
 #include 
 #include 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 37297b6..f3b31c6 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -53,6 +53,7 @@
 #include 
 #include "util/record.h"
 #include "util/util.h"
+#include "perf.h"
 
 #include 
 
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2741bcb..fa4212d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -41,6 +41,7 @@
  */
 
 #include "builtin.h"
+#include "perf.h"
 #include "util/cgroup.h"
 #include 
 #include "util/parse-events.h"
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 6d9805a..1056950 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -51,6 +51,7 @@
 #include "string2.h"
 #include "syscalltbl.h"
 #include "rb_resort.h"
+#include "../perf.h"
 
 #include 
 #include 
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index a95a248..237b9b3 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -8,6 +8,7 @@
  * perf top, perf record, perf report, etc.) are started.
  */
 #include "builtin.h"
+#include "perf.h"
 
 #include "util/env.h"
 #include 
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 30547fd..ccc3728 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -22,6 +22,7 @@
 #include "../../util/top.h"
 #include "../../util/thread.h"
 #include "../../arch/common.h"
+#include "../../perf.h"
 
 #include "../browsers/hists.h"
 #include "../helpline.h"
diff --git a/tools/perf/ui/browsers/res_sample.c 
b/tools/perf/ui/browsers/res_sample.c
index 41a9d89..db3954f 100644
--- a/tools/perf/ui/browsers/res_sample.c
+++ b/tools/perf/ui/browsers/res_sample.c
@@ -8,6 +8,7 @@
 #include "time-utils.h"
 #include "../util.h"
 #include "../../util/util.h"
+#include "../../perf.h"
 #include 
 #include 
 
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 50e0c03..e63f377 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "../../builtin.h"
+#include "../../perf.h"
 #include "../../util/sort.h"
 #include "../../util/util.h"
 #include "../../util/hist.h"
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index e5fb643..ae29f16

[tip: perf/core] perf tools: Remove needless sort.h include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 5c9dbe6da13398d09efc9ec479194afa6d9ec9e6
Gitweb:
https://git.kernel.org/tip/5c9dbe6da13398d09efc9ec479194afa6d9ec9e6
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 11:54:00 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf tools: Remove needless sort.h include directives

Now that sort.h isn't included by any other header, we can check where
it is really needed, i.e. we can remove it and be sure that it isn't
being obtained indirectly.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-tom8k0lbsxd9joprr8zpu...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-top.c | 1 +
 tools/perf/ui/browsers/scripts.c | 1 -
 tools/perf/util/hist.c   | 1 +
 tools/perf/util/mem-events.c | 1 -
 tools/perf/util/session.c| 1 -
 5 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0b7b12c..0f0d962 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include "util/parse-events.h"
+#include "util/callchain.h"
 #include "util/cpumap.h"
 #include "util/sort.h"
 #include "util/string2.h"
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 77809c0..bf1d9f9 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "../../builtin.h"
 #include "../../perf.h"
-#include "../../util/sort.h"
 #include "../../util/util.h"
 #include "../../util/hist.h"
 #include "../../util/debug.h"
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b526ef3..0978dc4 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 42c3e5a..3a8d38c 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -11,7 +11,6 @@
 #include "mem-events.h"
 #include "debug.h"
 #include "symbol.h"
-#include "sort.h"
 
 unsigned int perf_mem_events__loads_ldlat = 30;
 
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f166da7..e5ac5f3 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -20,7 +20,6 @@
 #include "symbol.h"
 #include "session.h"
 #include "tool.h"
-#include "sort.h"
 #include "cpumap.h"
 #include "perf_regs.h"
 #include "asm/bug.h"


[tip: perf/core] perf env: Remove env.h from other headers where just a fwd decl is needed

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: b6b5574b80d6ce6ca87ae3ea1e97cff1bf730f2e
Gitweb:
https://git.kernel.org/tip/b6b5574b80d6ce6ca87ae3ea1e97cff1bf730f2e
Author:Arnaldo Carvalho de Melo 
AuthorDate:Thu, 29 Aug 2019 17:10:59 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 19:10:40 -03:00

perf env: Remove env.h from other headers where just a fwd decl is needed

And fixup the fallout of c files not building due to now missing
headers.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-sw8k3kpla98pr3rqypbjk...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/common.h| 4 +++-
 tools/perf/tests/mem2node.c | 2 ++
 tools/perf/util/cputopo.h   | 1 -
 tools/perf/util/mem2node.c  | 2 ++
 tools/perf/util/mem2node.h  | 3 ++-
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/common.h b/tools/perf/arch/common.h
index c298a44..e965ed8 100644
--- a/tools/perf/arch/common.h
+++ b/tools/perf/arch/common.h
@@ -2,7 +2,9 @@
 #ifndef ARCH_PERF_COMMON_H
 #define ARCH_PERF_COMMON_H
 
-#include "../util/env.h"
+#include 
+
+struct perf_env;
 
 int perf_env__lookup_objdump(struct perf_env *env, const char **path);
 bool perf_env__single_address_space(struct perf_env *env);
diff --git a/tools/perf/tests/mem2node.c b/tools/perf/tests/mem2node.c
index 73b2855..7672ade 100644
--- a/tools/perf/tests/mem2node.c
+++ b/tools/perf/tests/mem2node.c
@@ -1,10 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "cpumap.h"
 #include "debug.h"
+#include "env.h"
 #include "mem2node.h"
 #include "tests.h"
 
diff --git a/tools/perf/util/cputopo.h b/tools/perf/util/cputopo.h
index bae2f1d..7bf6b81 100644
--- a/tools/perf/util/cputopo.h
+++ b/tools/perf/util/cputopo.h
@@ -3,7 +3,6 @@
 #define __PERF_CPUTOPO_H
 
 #include 
-#include "env.h"
 
 struct cpu_topology {
u32   core_sib;
diff --git a/tools/perf/util/mem2node.c b/tools/perf/util/mem2node.c
index 14fb9e7..797d86a 100644
--- a/tools/perf/util/mem2node.c
+++ b/tools/perf/util/mem2node.c
@@ -1,8 +1,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "debug.h"
+#include "env.h"
 #include "mem2node.h"
 
 struct phys_entry {
diff --git a/tools/perf/util/mem2node.h b/tools/perf/util/mem2node.h
index 59c4752..8dfa2b5 100644
--- a/tools/perf/util/mem2node.h
+++ b/tools/perf/util/mem2node.h
@@ -2,8 +2,9 @@
 #define __MEM2NODE_H
 
 #include 
-#include "env.h"
+#include 
 
+struct perf_env;
 struct phys_entry;
 
 struct mem2node {


[tip: perf/core] perf intel-pt: Remove inat.c from build dependency list

2019-09-02 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the perf/core branch of tip:

Commit-ID: f1da0a6c136542b9571b30af27bc1e84254f7a47
Gitweb:
https://git.kernel.org/tip/f1da0a6c136542b9571b30af27bc1e84254f7a47
Author:Josh Poimboeuf 
AuthorDate:Thu, 29 Aug 2019 17:41:20 -05:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf intel-pt: Remove inat.c from build dependency list

intel-pt-insn-decoder.c includes inat.c directly, so it already has an
implicit dependency on inat.c.  The Build file dependency is redundant.

Signed-off-by: Josh Poimboeuf 
Reviewed-by: Masami Hiramatsu 
Acked-by: Peter Zijlstra 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: x...@kernel.org
Link: 
http://lore.kernel.org/lkml/53776d6d29bc9eceb571d52df8fa32250c58a0f3.1567118001.git.jpoim...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/intel-pt-decoder/Build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 23bf788..acb18a3 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -9,7 +9,7 @@ $(OUTPUT)util/intel-pt-decoder/inat-tables.c: 
$(inat_tables_script) $(inat_table
 
 # Busybox's diff doesn't have -I, avoid warning in the case
 
-$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
util/intel-pt-decoder/intel-pt-insn-decoder.c util/intel-pt-decoder/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
+$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
util/intel-pt-decoder/intel-pt-insn-decoder.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
@(diff -I 2>&1 | grep -q 'option requires an argument' && \
test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \
((diff -B -I'^#include' util/intel-pt-decoder/insn.c 
../../arch/x86/lib/insn.c >/dev/null) || \


[tip: perf/core] perf tools: Remove needless thread_map.h include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: ef7d95661d046eddf2cf33847278781404679a2f
Gitweb:
https://git.kernel.org/tip/ef7d95661d046eddf2cf33847278781404679a2f
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 12:18:50 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf tools: Remove needless thread_map.h include directives

Now that thread_map.h isn't included by any other header, we can check where
it is really needed, i.e. we can remove it and be sure that it isn't
being obtained indirectly.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-fyzvg64cz1ikvyxp8d6nr...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm/util/cs-etm.c | 1 -
 tools/perf/builtin-top.c  | 1 -
 tools/perf/util/cs-etm.c  | 1 -
 3 files changed, 3 deletions(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c 
b/tools/perf/arch/arm/util/cs-etm.c
index 197041f..59e44f9 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -24,7 +24,6 @@
 #include "../../util/evlist.h"
 #include "../../util/evsel.h"
 #include "../../util/pmu.h"
-#include "../../util/thread_map.h"
 #include "../../util/cs-etm.h"
 #include "../../util/util.h"
 
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index eb94121..726e3f2 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -32,7 +32,6 @@
 #include "util/map.h"
 #include "util/session.h"
 #include "util/symbol.h"
-#include "util/thread_map.h"
 #include "util/top.h"
 #include "util/util.h"
 #include 
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 3ed1d3b..30c2048 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -30,7 +30,6 @@
 #include "symbol.h"
 #include "tool.h"
 #include "thread.h"
-#include "thread_map.h"
 #include "thread-stack.h"
 #include 
 #include "util.h"


[tip: perf/core] perf: Update .gitignore file

2019-09-02 Thread tip-bot2 for Josh Poimboeuf
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 58993fb2c5115e93c52058e25f9b2ff289374870
Gitweb:
https://git.kernel.org/tip/58993fb2c5115e93c52058e25f9b2ff289374870
Author:Josh Poimboeuf 
AuthorDate:Thu, 29 Aug 2019 17:41:19 -05:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:52 -03:00

perf: Update .gitignore file

After a "make tools/perf", git reports the following untracked files:

  tools/perf/feature/
  tools/perf/fixdep
  tools/perf/libtraceevent-dynamic-list

Add these generated files to perf's .gitignore file.

Signed-off-by: Josh Poimboeuf 
Reviewed-by: Masami Hiramatsu 
Acked-by: Peter Zijlstra 
Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: x...@kernel.org
Link: 
http://lore.kernel.org/lkml/03acbc6c2fbc72054861f6c301875db75db33030.1567118001.git.jpoim...@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/.gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 3e5135d..bf1252d 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -34,3 +34,6 @@ arch/*/include/generated/
 trace/beauty/generated/
 pmu-events/pmu-events.c
 pmu-events/jevents
+feature/
+fixdep
+libtraceevent-dynamic-list


[tip: perf/core] libtraceevent, perf tools: Changes in tep_print_event_* APIs

2019-09-02 Thread tip-bot2 for Tzvetomir Stoyanov
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 38847db9740a984e8538ce2573cbc0fc7edf22b3
Gitweb:
https://git.kernel.org/tip/38847db9740a984e8538ce2573cbc0fc7edf22b3
Author:Tzvetomir Stoyanov 
AuthorDate:Mon, 05 Aug 2019 16:43:13 -04:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:19:28 -03:00

libtraceevent, perf tools: Changes in tep_print_event_* APIs

Libtraceevent APIs for printing various trace events information are
complicated, there are complex extra parameters. To control the way
event information is printed, the user should call a set of functions in
a specific sequence.

These APIs are reimplemented to provide a more simple interface for
printing event information.

Removed APIs:

tep_print_event_task()
tep_print_event_time()
tep_print_event_data()
tep_event_info()
tep_is_latency_format()
tep_set_latency_format()
tep_data_latency_format()
tep_set_print_raw()

A new API for printing event information is introduced:
   void tep_print_event(struct tep_handle *tep, struct trace_seq *s,
struct tep_record *record, const char *fmt, ...);
where "fmt" is a printf-like format string, followed by the event
fields to be printed. Supported fields:
 TEP_PRINT_PID, "%d" - event PID
 TEP_PRINT_CPU, "%d" - event CPU
 TEP_PRINT_COMM, "%s" - event command string
 TEP_PRINT_NAME, "%s" - event name
 TEP_PRINT_LATENCY, "%s" - event latency
 TEP_PRINT_TIME, %d - event time stamp. A divisor and precision
   can be specified as part of this format string:
   "%precision.divisord". Example:
   "%3.1000d" - divide the time by 1000 and print the first 3 digits
   before the dot. Thus, the time stamp "123456000" will be printed as
   "123.456"
 TEP_PRINT_INFO, "%s" - event information.
 TEP_PRINT_INFO_RAW, "%s" - event information, in raw format.

Example:
  tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s",
  TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU,
  TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME, 
TEP_PRINT_INFO);
Output:
ls-11314 [005] d.h. 185207.366383 function __wake_up

Signed-off-by: Tzvetomir Stoyanov 
Cc: Andrew Morton 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: linux-trace-de...@vger.kernel.org
Cc: Patrick McLean 
Link: 
http://lore.kernel.org/linux-trace-devel/20190801074959.22023-2-tz.stoya...@gmail.com
Link: http://lore.kernel.org/lkml/20190805204355.041132...@goodmis.org
Signed-off-by: Steven Rostedt (VMware) 
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/lib/traceevent/event-parse-api.c   |  40 +---
 tools/lib/traceevent/event-parse-local.h |   4 +-
 tools/lib/traceevent/event-parse.c   | 322 --
 tools/lib/traceevent/event-parse.h   |  29 +--
 tools/perf/builtin-kmem.c|   3 +-
 tools/perf/util/sort.c   |   3 +-
 tools/perf/util/trace-event-parse.c  |   2 +-
 7 files changed, 203 insertions(+), 200 deletions(-)

diff --git a/tools/lib/traceevent/event-parse-api.c 
b/tools/lib/traceevent/event-parse-api.c
index 9885878..4faf52a 100644
--- a/tools/lib/traceevent/event-parse-api.c
+++ b/tools/lib/traceevent/event-parse-api.c
@@ -303,33 +303,6 @@ void tep_set_local_bigendian(struct tep_handle *tep, enum 
tep_endian endian)
 }
 
 /**
- * tep_is_latency_format - get if the latency output format is configured
- * @tep: a handle to the tep_handle
- *
- * This returns true if the latency output format is configured
- * If @tep is NULL, false is returned.
- */
-bool tep_is_latency_format(struct tep_handle *tep)
-{
-   if (tep)
-   return (tep->latency_format);
-   return false;
-}
-
-/**
- * tep_set_latency_format - set the latency output format
- * @tep: a handle to the tep_handle
- * @lat: non zero for latency output format
- *
- * This sets the latency output format
-  */
-void tep_set_latency_format(struct tep_handle *tep, int lat)
-{
-   if (tep)
-   tep->latency_format = lat;
-}
-
-/**
  * tep_is_old_format - get if an old kernel is used
  * @tep: a handle to the tep_handle
  *
@@ -345,19 +318,6 @@ bool tep_is_old_format(struct tep_handle *tep)
 }
 
 /**
- * tep_set_print_raw - set a flag to force print in raw format
- * @tep: a handle to the tep_handle
- * @print_raw: the new value of the print_raw flag
- *
- * This sets a flag to force print in raw format
- */
-void tep_set_print_raw(struct tep_handle *tep, int print_raw)
-{
-   if (tep)
-   tep->print_raw = print_raw;
-}
-
-/**
  * tep_set_test_filters - set a flag to test a filter string
  * @tep: a handle to the tep_handle
  * @test_filters: the new value of the test_filters flag
diff --git a/tools/lib/traceevent/event-parse-local.h 
b/tools/lib/traceevent/event-parse-local.h
index 09aa142..6e58ee1 100644
--- a/tools/lib/traceevent/event-parse-local.h
+++ b/tools/lib/traceevent/event-parse-local.h
@@ -2

[tip: perf/core] perf pmu: Change convert_scale from static to global

2019-09-02 Thread tip-bot2 for Jin Yao
The following commit has been merged into the perf/core branch of tip:

Commit-ID: a55ab7c4ca6986a542d313b02043a39ebf712a39
Gitweb:
https://git.kernel.org/tip/a55ab7c4ca6986a542d313b02043a39ebf712a39
Author:Jin Yao 
AuthorDate:Wed, 28 Aug 2019 13:59:29 +08:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:27:51 -03:00

perf pmu: Change convert_scale from static to global

The function convert_scale() can be used to convert string to unit and
scale. For example,

  s = "60ns";
  convert_scale(s, &unit, &scale);

unit = "ns", scale = 60.

Currently this function is static. This patch renames the function to
perf_pmu__convert_scale and changes the function to global.  No
functional change.

Signed-off-by: Jin Yao 
Cc: Alexander Shishkin 
Cc: Andi Kleen 
Cc: Jiri Olsa 
Cc: Kan Liang 
Cc: Peter Zijlstra 
Link: http://lore.kernel.org/lkml/20190828055932.8269-2-yao@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/pmu.c | 6 +++---
 tools/perf/util/pmu.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 6b3448f..fb597fa 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -102,7 +102,7 @@ static int pmu_format(const char *name, struct list_head 
*format)
return 0;
 }
 
-static int convert_scale(const char *scale, char **end, double *sval)
+int perf_pmu__convert_scale(const char *scale, char **end, double *sval)
 {
char *lc;
int ret = 0;
@@ -165,7 +165,7 @@ static int perf_pmu__parse_scale(struct perf_pmu_alias 
*alias, char *dir, char *
else
scale[sret] = '\0';
 
-   ret = convert_scale(scale, NULL, &alias->scale);
+   ret = perf_pmu__convert_scale(scale, NULL, &alias->scale);
 error:
close(fd);
return ret;
@@ -373,7 +373,7 @@ static int __perf_pmu__new_alias(struct list_head *list, 
char *dir, char *name,
desc ? strdup(desc) : NULL;
alias->topic = topic ? strdup(topic) : NULL;
if (unit) {
-   if (convert_scale(unit, &unit, &alias->scale) < 0)
+   if (perf_pmu__convert_scale(unit, &unit, &alias->scale) < 0)
return -1;
snprintf(alias->unit, sizeof(alias->unit), "%s", unit);
}
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 3f8b79b..f36ade6 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -96,4 +96,6 @@ struct perf_event_attr *perf_pmu__get_default_config(struct 
perf_pmu *pmu);
 
 struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);
 
+int perf_pmu__convert_scale(const char *scale, char **end, double *sval);
+
 #endif /* __PMU_H */


[tip: perf/core] perf tools: Remove needless thread.h include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 4becb2395f9166b11d68817ed4af8fc06b840908
Gitweb:
https://git.kernel.org/tip/4becb2395f9166b11d68817ed4af8fc06b840908
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 12:13:45 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf tools: Remove needless thread.h include directives

Now that thread.h isn't included by any other header, we can check where
it is really needed, i.e. we can remove it and be sure that it isn't
being obtained indirectly.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-kh333ivjbw05wsggckpzi...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-annotate.c   | 1 -
 tools/perf/builtin-stat.c   | 1 -
 tools/perf/builtin-top.c| 1 -
 tools/perf/tests/hists_filter.c | 1 -
 tools/perf/tests/hists_link.c   | 1 -
 tools/perf/util/arm-spe.c   | 1 -
 tools/perf/util/probe-event.c   | 1 -
 tools/perf/util/probe-file.c| 1 -
 tools/perf/util/s390-cpumsf.c   | 1 -
 9 files changed, 9 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 738471a..7135b77 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -24,7 +24,6 @@
 #include "util/event.h"
 #include 
 #include "util/parse-events.h"
-#include "util/thread.h"
 #include "util/sort.h"
 #include "util/hist.h"
 #include "util/dso.h"
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index fa4212d..7e17bf9 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -54,7 +54,6 @@
 #include "util/stat.h"
 #include "util/header.h"
 #include "util/cpumap.h"
-#include "util/thread.h"
 #include "util/thread_map.h"
 #include "util/counts.h"
 #include "util/group.h"
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0f0d962..eb94121 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -32,7 +32,6 @@
 #include "util/map.h"
 #include "util/session.h"
 #include "util/symbol.h"
-#include "util/thread.h"
 #include "util/thread_map.h"
 #include "util/top.h"
 #include "util/util.h"
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 41dede2..618b51f 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -7,7 +7,6 @@
 #include "util/event.h"
 #include "util/evlist.h"
 #include "util/machine.h"
-#include "util/thread.h"
 #include "util/parse-events.h"
 #include "tests/tests.h"
 #include "tests/hists_common.h"
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 012fe8a..8be4d0b 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -6,7 +6,6 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "machine.h"
-#include "thread.h"
 #include "parse-events.h"
 #include "hists_common.h"
 #include 
diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index d7c3fbb..6bee599 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -20,7 +20,6 @@
 #include "evlist.h"
 #include "machine.h"
 #include "session.h"
-#include "thread.h"
 #include "debug.h"
 #include "auxtrace.h"
 #include "arm-spe.h"
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 5d12a78..e90faa6 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -31,7 +31,6 @@
 #include "map.h"
 #include "map_groups.h"
 #include "symbol.h"
-#include "thread.h"
 #include 
 #include "trace-event.h"   /* For __maybe_unused */
 #include "probe-event.h"
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 10d2ab1..adc949e 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -20,7 +20,6 @@
 #include "cache.h"
 #include "color.h"
 #include "symbol.h"
-#include "thread.h"
 #include 
 #include "probe-event.h"
 #include "probe-file.h"
diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c
index 2ba4baa..24a9990 100644
--- a/tools/perf/util/s390-cpumsf.c
+++ b/tools/perf/util/s390-cpumsf.c
@@ -158,7 +158,6 @@
 #include "machine.h"
 #include "session.h"
 #include "tool.h"
-#include "thread.h"
 #include "debug.h"
 #include "auxtrace.h"
 #include "s390-cpumsf.h"


[tip: perf/core] perf debug: Remove needless include directives from debug.h

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 8520a98dbab61e9e340cdfb72dd17ccc8a98961e
Gitweb:
https://git.kernel.org/tip/8520a98dbab61e9e340cdfb72dd17ccc8a98961e
Author:Arnaldo Carvalho de Melo 
AuthorDate:Thu, 29 Aug 2019 16:18:59 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 19:10:19 -03:00

perf debug: Remove needless include directives from debug.h

All we need there is a forward declaration for 'union perf_event', so
remove it from there and add missing header directives in places using
things from this indirect include.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-7ftk0ztstqub1tirjj8o8...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm/util/cs-etm.c   | 1 +
 tools/perf/arch/common.c| 2 ++
 tools/perf/arch/x86/tests/bp-modify.c   | 1 +
 tools/perf/arch/x86/tests/insn-x86.c| 1 +
 tools/perf/arch/x86/tests/rdpmc.c   | 2 ++
 tools/perf/arch/x86/util/perf_regs.c| 1 +
 tools/perf/builtin-c2c.c| 2 ++
 tools/perf/builtin-config.c | 1 +
 tools/perf/builtin-data.c   | 2 ++
 tools/perf/builtin-diff.c   | 1 +
 tools/perf/builtin-ftrace.c | 3 ++-
 tools/perf/builtin-help.c   | 4 
 tools/perf/builtin-kmem.c   | 1 +
 tools/perf/builtin-list.c   | 1 +
 tools/perf/builtin-probe.c  | 1 +
 tools/perf/builtin-record.c | 1 +
 tools/perf/builtin-report.c | 2 ++
 tools/perf/builtin-top.c| 1 +
 tools/perf/builtin-trace.c  | 1 +
 tools/perf/perf.c   | 2 ++
 tools/perf/tests/attr.c | 1 +
 tools/perf/tests/backward-ring-buffer.c | 1 +
 tools/perf/tests/bp_account.c   | 1 +
 tools/perf/tests/bp_signal.c| 1 +
 tools/perf/tests/bp_signal_overflow.c   | 1 +
 tools/perf/tests/bpf.c  | 1 +
 tools/perf/tests/event-times.c  | 1 +
 tools/perf/tests/expr.c | 1 +
 tools/perf/tests/kmod-path.c| 2 ++
 tools/perf/tests/mmap-basic.c   | 1 +
 tools/perf/tests/openat-syscall-all-cpus.c  | 1 +
 tools/perf/tests/openat-syscall-tp-fields.c | 1 +
 tools/perf/tests/openat-syscall.c   | 1 +
 tools/perf/tests/perf-record.c  | 1 +
 tools/perf/tests/sample-parsing.c   | 1 +
 tools/perf/tests/task-exit.c| 1 +
 tools/perf/tests/thread-map.c   | 7 +++
 tools/perf/tests/unit_number__scnprintf.c   | 1 +
 tools/perf/tests/wp.c   | 3 +++
 tools/perf/ui/browsers/scripts.c| 1 +
 tools/perf/ui/gtk/helpline.c| 1 +
 tools/perf/ui/gtk/util.c| 1 +
 tools/perf/ui/tui/helpline.c| 1 +
 tools/perf/ui/util.c| 2 +-
 tools/perf/util/bpf-prologue.c  | 1 +
 tools/perf/util/branch.c| 1 +
 tools/perf/util/callchain.c | 1 +
 tools/perf/util/cloexec.c   | 2 ++
 tools/perf/util/data.c  | 1 +
 tools/perf/util/debug.c | 1 +
 tools/perf/util/debug.h | 6 ++
 tools/perf/util/dwarf-aux.c | 1 +
 tools/perf/util/dwarf-aux.h | 2 ++
 tools/perf/util/env.c   | 1 +
 tools/perf/util/evlist.c| 1 +
 tools/perf/util/expr.y  | 2 ++
 tools/perf/util/hist.c  | 1 +
 tools/perf/util/intel-pt.c  | 1 +
 tools/perf/util/llvm-utils.c| 1 +
 tools/perf/util/lzma.c  | 1 +
 tools/perf/util/machine.c   | 1 +
 tools/perf/util/map.c   | 1 +
 tools/perf/util/ordered-events.c| 1 +
 tools/perf/util/parse-branch-options.c  | 2 ++
 tools/perf/util/perf-hooks.c| 1 +
 tools/perf/util/probe-finder.c  | 1 +
 tools/perf/util/pstack.c| 1 +
 tools/perf/util/sort.c  | 1 +
 tools/perf/util/strbuf.c| 4 
 tools/perf/util/symbol.c| 1 +
 tools/perf/util/target.c| 3 +++
 tools/perf/util/thread-stack.c  | 1 +
 tools/perf/util/util.c  | 1 +
 tools/perf/util/values.c| 1 +
 tools/perf/util/zlib.c  | 1 +
 75 files changed, 104 insertions(+), 6 deletions(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c 
b/tools/perf/arch/arm/util/cs-etm.c
index b74fd40..197041f 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
dif

[tip: perf/core] perf tools: Remove needless map.h include directives

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: df1a0a110c2c0138665f6d8ec96812ea14c2d818
Gitweb:
https://git.kernel.org/tip/df1a0a110c2c0138665f6d8ec96812ea14c2d818
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 12:07:23 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:24:10 -03:00

perf tools: Remove needless map.h include directives

Now that map.h isn't included by any other header, we can check where
it is really needed, i.e. we can remove it and be sure that it isn't
being obtained indirectly.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-iu8ylqky7g1i9i54v3y7q...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm64/util/sym-handling.c | 8 +++-
 tools/perf/tests/thread-mg-share.c| 1 -
 tools/perf/util/intel-bts.c   | 1 -
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/tools/perf/arch/arm64/util/sym-handling.c 
b/tools/perf/arch/arm64/util/sym-handling.c
index 27fcf24..5df7889 100644
--- a/tools/perf/arch/arm64/util/sym-handling.c
+++ b/tools/perf/arch/arm64/util/sym-handling.c
@@ -4,11 +4,9 @@
  * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
  */
 
-#include "debug.h"
-#include "symbol.h"
-#include "map.h"
-#include "probe-event.h"
-#include "probe-file.h"
+#include "symbol.h" // for the elf__needs_adjust_symbols() prototype
+#include 
+#include 
 
 #ifdef HAVE_LIBELF_SUPPORT
 bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
diff --git a/tools/perf/tests/thread-mg-share.c 
b/tools/perf/tests/thread-mg-share.c
index b1d1bba..cbac717 100644
--- a/tools/perf/tests/thread-mg-share.c
+++ b/tools/perf/tests/thread-mg-share.c
@@ -2,7 +2,6 @@
 #include "tests.h"
 #include "machine.h"
 #include "thread.h"
-#include "map.h"
 #include "debug.h"
 
 int test__thread_mg_share(struct test *test __maybe_unused, int subtest 
__maybe_unused)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index a30427a..aacffa2 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -19,7 +19,6 @@
 #include "evsel.h"
 #include "evlist.h"
 #include "machine.h"
-#include "map.h"
 #include "symbol.h"
 #include "session.h"
 #include "tool.h"


[tip: perf/core] perf symbol: Move C++ demangle defines to the only file using it

2019-09-02 Thread tip-bot2 for Arnaldo Carvalho de Melo
The following commit has been merged into the perf/core branch of tip:

Commit-ID: 9bea81b36a8d7d23c9bb7f4d63a9a842eec134a0
Gitweb:
https://git.kernel.org/tip/9bea81b36a8d7d23c9bb7f4d63a9a842eec134a0
Author:Arnaldo Carvalho de Melo 
AuthorDate:Fri, 30 Aug 2019 10:01:50 -03:00
Committer: Arnaldo Carvalho de Melo 
CommitterDate: Sat, 31 Aug 2019 22:19:28 -03:00

perf symbol: Move C++ demangle defines to the only file using it

No need to have it generally available in such a critical header as
symbol.h.

Cc: Adrian Hunter 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Link: https://lkml.kernel.org/n/tip-es1ufxv7bihiumytn5dm3...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c | 6 ++
 tools/perf/util/symbol.h | 6 --
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 7d504dc..6d22437 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -40,6 +40,12 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
+#ifndef DMGL_PARAMS
+#define DMGL_NO_OPTS 0  /* For readability... */
+#define DMGL_PARAMS  (1 << 0)   /* Include function args */
+#define DMGL_ANSI(1 << 1)   /* Include const, volatile, etc */
+#endif
+
 #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
 extern char *cplus_demangle(const char *, int);
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 159c596..bcc0d84 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -40,12 +40,6 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
 GElf_Shdr *shp, const char *name, size_t *idx);
 #endif
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS 0  /* For readability... */
-#define DMGL_PARAMS  (1 << 0)   /* Include function args */
-#define DMGL_ANSI(1 << 1)   /* Include const, volatile, etc */
-#endif
-
 /** struct symbol - symtab entry
  *
  * @ignore - resolvable but tools ignore it (e.g. idle routines)


  1   2   3   4   5   6   7   8   9   >