linux-next: Tree for Feb 10
Hi all, Changes since 20170209: The l2mtd-tree still had ist build failure so I used the version from next-20170208. The kvm tree gained conflicts against the powerpc tree. The akpm-current tree gained conflicts against the xfs tree. The akpm tree gained a conflict against the net tree. Non-merge commits (relative to Linus' tree): 8369 9421 files changed, 356691 insertions(+), 174353 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig (with CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a native build of tools/perf. After the final fixups (if any), I do an x86_64 modules_install followed by builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc and sparc64 defconfig. Below is a summary of the state of the merge. I am currently merging 256 trees (counting Linus' and 37 trees of bug fix patches pending for the current merge release). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwell $ git checkout master $ git reset --hard stable Merging origin/master (55aac6ef53e1 Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending) Merging fixes/master (30066ce675d3 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6) Merging kbuild-current/rc-fixes (c7858bf16c0b asm-prototypes: Clear any CPP defines before declaring the functions) Merging arc-current/for-curr (8ba605b607b7 ARC: [plat-*] ARC_HAS_COH_CACHES no longer relevant) Merging arm-current/fixes (228dbbfb5d77 ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write) Merging m68k-current/for-linus (ad595b77c4a8 m68k/atari: Use seq_puts() in atari_get_hardware_list()) Merging metag-fixes/fixes (35d04077ad96 metag: Only define atomic_dec_if_positive conditionally) Merging powerpc-fixes/fixes (f83e6862047e powerpc/powernv: Properly set "host-ipi" on IPIs) Merging sparc/master (f9a42e0d58cf Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc) Merging fscrypt-current/for-stable (42d97eb0ade3 fscrypt: fix renaming and linking special files) Merging net/master (bb1a619735b4 net: phy: Initialize mdio clock at probe function) Merging ipsec/master (4e5da369df64 Documentation/networking: fix typo in mpls-sysctl) Merging netfilter/master (f95d7a46bc57 netfilter: ctnetlink: Fix regression in CTA_HELP processing) Merging ipvs/master (045169816b31 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6) Merging wireless-drivers/master (52f5631a4c05 rtlwifi: rtl8192ce: Fix loading of incorrect firmware) Merging mac80211/master (fd551bac4795 nl80211: Fix mesh HT operation check) Merging sound-current/for-linus (af677166cf63 ALSA: hda - adding a new NV HDMI/DP codec ID in the driver) Merging pci-current/for-linus (d98e0929071e Revert "PCI: pciehp: Add runtime PM support for PCIe hotplug ports") Merging driver-core.current/driver-core-linus (49def1853334 Linux 4.10-rc4) Merging tty.current/tty-linus (49def1853334 Linux 4.10-rc4) Merging usb.current/usb-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging usb-gadget-fixes/fixes (efe357f4633a usb: dwc2: host: fix Wmaybe-uninitialized warning) Merging usb-serial-fixes/usb-linus (d07830db1bdb USB: serial: pl2303: add ATEN device ID) Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move the lock initialization to core file) Merging phy/fixes (7ce7d89f4883 Linux 4.10-rc1) Merging staging.current/staging-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging char-misc.current/char-misc-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging input-current/for-linus (413d37326700 Input: synaptics-rmi4 - select 'SERIO' when needed) Merging crypto-current/master (7c2cf1c4615c crypto: chcr - Fix key length for RFC4106) Merging ide/master (da095587e6be Revert "ide: Fix interface
Re: [PATCH] proc/sysctl: prune stale dentries during unregistering
On 10.02.2017 10:47, Al Viro wrote: On Fri, Feb 10, 2017 at 10:35:02AM +0300, Konstantin Khlebnikov wrote: # time sysctl -a > /dev/null real1m12.806s user0m0.016s sys 1m12.400s Currently only memory reclaimer could remove this garbage. But without significant memory pressure this never happens. This patch collects sysctl inodes into list on sysctl table header and prunes all their dentries once that table unregisters. I'd probably go for hlist, but that's mostly cosmetic difference; how about the matching stats *after* that patch? dcache size doesn't grow endlessly, so stats are fine # sysctl fs.dentry-state fs.dentry-state = 92712 58376 45 0 0 0 # time sysctl -a &>/dev/null real0m0.013s user0m0.004s sys 0m0.008s
Re: [PATCH] proc/sysctl: prune stale dentries during unregistering
On 10.02.2017 10:47, Al Viro wrote: On Fri, Feb 10, 2017 at 10:35:02AM +0300, Konstantin Khlebnikov wrote: # time sysctl -a > /dev/null real1m12.806s user0m0.016s sys 1m12.400s Currently only memory reclaimer could remove this garbage. But without significant memory pressure this never happens. This patch collects sysctl inodes into list on sysctl table header and prunes all their dentries once that table unregisters. I'd probably go for hlist, but that's mostly cosmetic difference; how about the matching stats *after* that patch? dcache size doesn't grow endlessly, so stats are fine # sysctl fs.dentry-state fs.dentry-state = 92712 58376 45 0 0 0 # time sysctl -a &>/dev/null real0m0.013s user0m0.004s sys 0m0.008s
linux-next: Tree for Feb 10
Hi all, Changes since 20170209: The l2mtd-tree still had ist build failure so I used the version from next-20170208. The kvm tree gained conflicts against the powerpc tree. The akpm-current tree gained conflicts against the xfs tree. The akpm tree gained a conflict against the net tree. Non-merge commits (relative to Linus' tree): 8369 9421 files changed, 356691 insertions(+), 174353 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc and an allmodconfig (with CONFIG_BUILD_DOCSRC=n) for x86_64, a multi_v7_defconfig for arm and a native build of tools/perf. After the final fixups (if any), I do an x86_64 modules_install followed by builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc and sparc64 defconfig. Below is a summary of the state of the merge. I am currently merging 256 trees (counting Linus' and 37 trees of bug fix patches pending for the current merge release). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwell $ git checkout master $ git reset --hard stable Merging origin/master (55aac6ef53e1 Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending) Merging fixes/master (30066ce675d3 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6) Merging kbuild-current/rc-fixes (c7858bf16c0b asm-prototypes: Clear any CPP defines before declaring the functions) Merging arc-current/for-curr (8ba605b607b7 ARC: [plat-*] ARC_HAS_COH_CACHES no longer relevant) Merging arm-current/fixes (228dbbfb5d77 ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write) Merging m68k-current/for-linus (ad595b77c4a8 m68k/atari: Use seq_puts() in atari_get_hardware_list()) Merging metag-fixes/fixes (35d04077ad96 metag: Only define atomic_dec_if_positive conditionally) Merging powerpc-fixes/fixes (f83e6862047e powerpc/powernv: Properly set "host-ipi" on IPIs) Merging sparc/master (f9a42e0d58cf Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc) Merging fscrypt-current/for-stable (42d97eb0ade3 fscrypt: fix renaming and linking special files) Merging net/master (bb1a619735b4 net: phy: Initialize mdio clock at probe function) Merging ipsec/master (4e5da369df64 Documentation/networking: fix typo in mpls-sysctl) Merging netfilter/master (f95d7a46bc57 netfilter: ctnetlink: Fix regression in CTA_HELP processing) Merging ipvs/master (045169816b31 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6) Merging wireless-drivers/master (52f5631a4c05 rtlwifi: rtl8192ce: Fix loading of incorrect firmware) Merging mac80211/master (fd551bac4795 nl80211: Fix mesh HT operation check) Merging sound-current/for-linus (af677166cf63 ALSA: hda - adding a new NV HDMI/DP codec ID in the driver) Merging pci-current/for-linus (d98e0929071e Revert "PCI: pciehp: Add runtime PM support for PCIe hotplug ports") Merging driver-core.current/driver-core-linus (49def1853334 Linux 4.10-rc4) Merging tty.current/tty-linus (49def1853334 Linux 4.10-rc4) Merging usb.current/usb-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging usb-gadget-fixes/fixes (efe357f4633a usb: dwc2: host: fix Wmaybe-uninitialized warning) Merging usb-serial-fixes/usb-linus (d07830db1bdb USB: serial: pl2303: add ATEN device ID) Merging usb-chipidea-fixes/ci-for-usb-stable (c7fbb09b2ea1 usb: chipidea: move the lock initialization to core file) Merging phy/fixes (7ce7d89f4883 Linux 4.10-rc1) Merging staging.current/staging-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging char-misc.current/char-misc-linus (d5adbfcd5f7b Linux 4.10-rc7) Merging input-current/for-linus (413d37326700 Input: synaptics-rmi4 - select 'SERIO' when needed) Merging crypto-current/master (7c2cf1c4615c crypto: chcr - Fix key length for RFC4106) Merging ide/master (da095587e6be Revert "ide: Fix interface
Re: [PATCH 3/3 staging-next] mm: Remove RCU and tasklocks from lmk
On Fri 10-02-17 08:39:11, peter enderborg wrote: > On 02/09/2017 09:05 PM, Michal Hocko wrote: > > On Thu 09-02-17 14:21:52, peter enderborg wrote: > >> Fundamental changes: > >> 1 Does NOT take any RCU lock in shrinker functions. > >> 2 It returns same result for scan and counts, so we dont need to do > >> shinker will know when it is pointless to call scan. > >> 3 It does not lock any other process than the one that is > >> going to be killed. > >> > >> Background. > >> The low memory killer scans for process that can be killed to free > >> memory. This can be cpu consuming when there is a high demand for > >> memory. This can be seen by analysing the kswapd0 task work. > >> The stats function added in earler patch adds a counter for waste work. > >> > >> How it works. > >> This patch create a structure within the lowmemory killer that caches > >> the user spaces processes that it might kill. It is done with a > >> sorted rbtree so we can very easy find the candidate to be killed, > >> and knows its properies as memory usage and sorted by oom_score_adj > >> to look up the task with highest oom_score_adj. To be able to achive > >> this it uses oom_score_notify events. > >> > >> This patch also as a other effect, we are now free to do other > >> lowmemorykiller configurations. Without the patch there is a need > >> for a tradeoff between freed memory and task and rcu locks. This > >> is no longer a concern for tuning lmk. This patch is not intended > >> to do any calculation changes other than we do use the cache for > >> calculate the count values and that makes kswapd0 to shrink other > >> areas. > > I have to admit I really do not understand big part of the above > > paragraph as well as how this all is supposed to work. A quick glance > > over the implementation. __lmk_task_insert seems to be only called from > > the oom_score notifier context. If nobody updates the value then no task > > will get into the tree. Or am I missing something really obvious here? > > Moreover oom scores tend to be mostly same for tasks. That means that > > your sorted tree will become sorted by pids in most cases. I do not see > > any sorting based on the rss nor any updates that would reflect updates > > of rss. How can this possibly work? > > The task tree nodes are created,updated or removed from the notifier when > there is a relevant oom_score_adj change. If no one create a task that > is in the range for the lowmemorykiller the tree will be empty. This is > an android feature so the score will be updated very often. It is > part of activity manager to prioritise tasks. Why should we do sort of > rss? Because the current lmk selects the tasks based on rss. And the patch doesn't explain why this is no longer suitable and a different metric shoult be used. If you also consider that the scale of oom_score_adj is quite small, conllisions when you simply sort based on pids which is more than questionable. I really fail to see how this can work reasonably and why the change of the lmk semantic is even acceptable. -- Michal Hocko SUSE Labs
[tip:perf/core] perf intel-pt: Use __fallthrough
Commit-ID: 7ea6856d6f5629d742edc23b8b76e6263371ef45 Gitweb: http://git.kernel.org/tip/7ea6856d6f5629d742edc23b8b76e6263371ef45 Author: Arnaldo Carvalho de MeloAuthorDate: Thu, 9 Feb 2017 15:22:22 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 16:32:03 -0300 perf intel-pt: Use __fallthrough To address new warnings emmited by gcc 7, e.g.:: CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o CC /tmp/build/perf/tests/parse-events.o util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc': util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=] if (!(packet->count)) ^ util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here case INTEL_PT_CYC: ^~~~ CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o cc1: all warnings being treated as errors Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Shishkin Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-mf0hw789pu9x855us5l32...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 + tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index e4e7dc7..7cf7f7a 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "../cache.h" #include "../util.h" @@ -1746,6 +1747,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: intel_pt_log("ERROR: Unexpected packet\n"); @@ -1799,6 +1801,8 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) decoder->pge = false; decoder->continuous_period = false; intel_pt_clear_tx_flags(decoder); + __fallthrough; + case INTEL_PT_TNT: decoder->have_tma = false; intel_pt_log("ERROR: Unexpected packet\n"); @@ -1839,6 +1843,7 @@ static int intel_pt_walk_to_ip(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: decoder->pge = decoder->packet.type != INTEL_PT_TIP_PGD; diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index 4f7b320..7528ae4 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "intel-pt-pkt-decoder.h" @@ -498,6 +499,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, case INTEL_PT_FUP: if (!(packet->count)) return snprintf(buf, buf_len, "%s no ip", name); + __fallthrough; case INTEL_PT_CYC: case INTEL_PT_VMCS: case INTEL_PT_MTC:
Re: [PATCH 3/3 staging-next] mm: Remove RCU and tasklocks from lmk
On Fri 10-02-17 08:39:11, peter enderborg wrote: > On 02/09/2017 09:05 PM, Michal Hocko wrote: > > On Thu 09-02-17 14:21:52, peter enderborg wrote: > >> Fundamental changes: > >> 1 Does NOT take any RCU lock in shrinker functions. > >> 2 It returns same result for scan and counts, so we dont need to do > >> shinker will know when it is pointless to call scan. > >> 3 It does not lock any other process than the one that is > >> going to be killed. > >> > >> Background. > >> The low memory killer scans for process that can be killed to free > >> memory. This can be cpu consuming when there is a high demand for > >> memory. This can be seen by analysing the kswapd0 task work. > >> The stats function added in earler patch adds a counter for waste work. > >> > >> How it works. > >> This patch create a structure within the lowmemory killer that caches > >> the user spaces processes that it might kill. It is done with a > >> sorted rbtree so we can very easy find the candidate to be killed, > >> and knows its properies as memory usage and sorted by oom_score_adj > >> to look up the task with highest oom_score_adj. To be able to achive > >> this it uses oom_score_notify events. > >> > >> This patch also as a other effect, we are now free to do other > >> lowmemorykiller configurations. Without the patch there is a need > >> for a tradeoff between freed memory and task and rcu locks. This > >> is no longer a concern for tuning lmk. This patch is not intended > >> to do any calculation changes other than we do use the cache for > >> calculate the count values and that makes kswapd0 to shrink other > >> areas. > > I have to admit I really do not understand big part of the above > > paragraph as well as how this all is supposed to work. A quick glance > > over the implementation. __lmk_task_insert seems to be only called from > > the oom_score notifier context. If nobody updates the value then no task > > will get into the tree. Or am I missing something really obvious here? > > Moreover oom scores tend to be mostly same for tasks. That means that > > your sorted tree will become sorted by pids in most cases. I do not see > > any sorting based on the rss nor any updates that would reflect updates > > of rss. How can this possibly work? > > The task tree nodes are created,updated or removed from the notifier when > there is a relevant oom_score_adj change. If no one create a task that > is in the range for the lowmemorykiller the tree will be empty. This is > an android feature so the score will be updated very often. It is > part of activity manager to prioritise tasks. Why should we do sort of > rss? Because the current lmk selects the tasks based on rss. And the patch doesn't explain why this is no longer suitable and a different metric shoult be used. If you also consider that the scale of oom_score_adj is quite small, conllisions when you simply sort based on pids which is more than questionable. I really fail to see how this can work reasonably and why the change of the lmk semantic is even acceptable. -- Michal Hocko SUSE Labs
[tip:perf/core] perf intel-pt: Use __fallthrough
Commit-ID: 7ea6856d6f5629d742edc23b8b76e6263371ef45 Gitweb: http://git.kernel.org/tip/7ea6856d6f5629d742edc23b8b76e6263371ef45 Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 9 Feb 2017 15:22:22 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 16:32:03 -0300 perf intel-pt: Use __fallthrough To address new warnings emmited by gcc 7, e.g.:: CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o CC /tmp/build/perf/tests/parse-events.o util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc': util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=] if (!(packet->count)) ^ util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here case INTEL_PT_CYC: ^~~~ CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o cc1: all warnings being treated as errors Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Shishkin Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-mf0hw789pu9x855us5l32...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 5 + tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c index e4e7dc7..7cf7f7a 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "../cache.h" #include "../util.h" @@ -1746,6 +1747,7 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: intel_pt_log("ERROR: Unexpected packet\n"); @@ -1799,6 +1801,8 @@ static int intel_pt_walk_psb(struct intel_pt_decoder *decoder) decoder->pge = false; decoder->continuous_period = false; intel_pt_clear_tx_flags(decoder); + __fallthrough; + case INTEL_PT_TNT: decoder->have_tma = false; intel_pt_log("ERROR: Unexpected packet\n"); @@ -1839,6 +1843,7 @@ static int intel_pt_walk_to_ip(struct intel_pt_decoder *decoder) switch (decoder->packet.type) { case INTEL_PT_TIP_PGD: decoder->continuous_period = false; + __fallthrough; case INTEL_PT_TIP_PGE: case INTEL_PT_TIP: decoder->pge = decoder->packet.type != INTEL_PT_TIP_PGD; diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index 4f7b320..7528ae4 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "intel-pt-pkt-decoder.h" @@ -498,6 +499,7 @@ int intel_pt_pkt_desc(const struct intel_pt_pkt *packet, char *buf, case INTEL_PT_FUP: if (!(packet->count)) return snprintf(buf, buf_len, "%s no ip", name); + __fallthrough; case INTEL_PT_CYC: case INTEL_PT_VMCS: case INTEL_PT_MTC:
Re: [PATCH] sched: Enhance readability of iterating wake_list
On Fri, Feb 10, 2017 at 01:09:31PM +0900, Byungchul Park wrote: > +#define for_each_wake_list(task, node) \ > + for ((task) = llist_entry((node), struct task_struct, wake_entry); \ > + node; (node) = llist_next(node), \ > + (task) = llist_entry((node), struct task_struct, wake_entry)) > + How about you make that llist_for_each(pos, member) or similar and replace all while (foo) { foo = llist_next(foo); } instances? Because most llist_next() users have the same pattern.
Re: [PATCH] sched: Enhance readability of iterating wake_list
On Fri, Feb 10, 2017 at 01:09:31PM +0900, Byungchul Park wrote: > +#define for_each_wake_list(task, node) \ > + for ((task) = llist_entry((node), struct task_struct, wake_entry); \ > + node; (node) = llist_next(node), \ > + (task) = llist_entry((node), struct task_struct, wake_entry)) > + How about you make that llist_for_each(pos, member) or similar and replace all while (foo) { foo = llist_next(foo); } instances? Because most llist_next() users have the same pattern.
Re: [PATCH v4 1/2] staging: omap4iss: fix multiline comment style
Hi Avraham, Thank you for the patches. On Thursday 09 Feb 2017 18:57:55 Avraham Shukron wrote: > Fixed multi-line comments to their preferred style (First line empty) > > Signed-off-by: Avraham ShukronFor both of them, Acked-by: Laurent Pinchart I've applied the patches to my tree and will send a pull request for v4.12. > --- > drivers/staging/media/omap4iss/iss_video.c | 38 ++- > 1 file changed, 25 insertions(+), 13 deletions(-) > > diff --git a/drivers/staging/media/omap4iss/iss_video.c > b/drivers/staging/media/omap4iss/iss_video.c index bb0e3b4..e21811a 100644 > --- a/drivers/staging/media/omap4iss/iss_video.c > +++ b/drivers/staging/media/omap4iss/iss_video.c > @@ -128,7 +128,8 @@ static unsigned int iss_video_mbus_to_pix(const struct > iss_video *video, pix->width = mbus->width; > pix->height = mbus->height; > > - /* Skip the last format in the loop so that it will be selected if no > + /* > + * Skip the last format in the loop so that it will be selected if no >* match is found. >*/ > for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { > @@ -138,7 +139,8 @@ static unsigned int iss_video_mbus_to_pix(const struct > iss_video *video, > > min_bpl = pix->width * ALIGN(formats[i].bpp, 8) / 8; > > - /* Clamp the requested bytes per line value. If the maximum bytes per > + /* > + * Clamp the requested bytes per line value. If the maximum bytes per >* line value is zero, the module doesn't support user configurable line >* sizes. Override the requested value with the minimum in that case. >*/ > @@ -172,7 +174,8 @@ static void iss_video_pix_to_mbus(const struct > v4l2_pix_format *pix, mbus->width = pix->width; > mbus->height = pix->height; > > - /* Skip the last format in the loop so that it will be selected if no > + /* > + * Skip the last format in the loop so that it will be selected if no >* match is found. >*/ > for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { > @@ -360,7 +363,8 @@ static void iss_video_buf_queue(struct vb2_buffer *vb) > > spin_lock_irqsave(>qlock, flags); > > - /* Mark the buffer is faulty and give it back to the queue immediately > + /* > + * Mark the buffer is faulty and give it back to the queue immediately >* if the video node has registered an error. vb2 will perform the same >* check when preparing the buffer, but that is inherently racy, so we >* need to handle the race condition with an authoritative check here. > @@ -443,7 +447,8 @@ struct iss_buffer *omap4iss_video_buffer_next(struct > iss_video *video) > > buf->vb.vb2_buf.timestamp = ktime_get_ns(); > > - /* Do frame number propagation only if this is the output video node. > + /* > + * Do frame number propagation only if this is the output video node. >* Frame number either comes from the CSI receivers or it gets >* incremented here if H3A is not active. >* Note: There is no guarantee that the output buffer will finish > @@ -605,7 +610,8 @@ iss_video_set_format(struct file *file, void *fh, struct > v4l2_format *format) > > mutex_lock(>mutex); > > - /* Fill the bytesperline and sizeimage fields by converting to media bus > + /* > + * Fill the bytesperline and sizeimage fields by converting to media bus >* format and back to pixel format. >*/ > iss_video_pix_to_mbus(>fmt.pix, ); > @@ -678,8 +684,9 @@ iss_video_get_selection(struct file *file, void *fh, > struct v4l2_selection *sel) if (subdev == NULL) > return -EINVAL; > > - /* Try the get selection operation first and fallback to get format if not > - * implemented. > + /* > + * Try the get selection operation first and fallback to get format if > + * not implemented. >*/ > sdsel.pad = pad; > ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, ); > @@ -867,7 +874,8 @@ iss_video_streamon(struct file *file, void *fh, enum > v4l2_buf_type type) > > mutex_lock(>stream_lock); > > - /* Start streaming on the pipeline. No link touching an entity in the > + /* > + * Start streaming on the pipeline. No link touching an entity in the >* pipeline can be activated or deactivated once streaming is started. >*/ > pipe = entity->pipe > @@ -895,7 +903,8 @@ iss_video_streamon(struct file *file, void *fh, enum > v4l2_buf_type type) while ((entity = media_graph_walk_next())) > media_entity_enum_set(>ent_enum, entity); > > - /* Verify that the currently configured format matches the output of > + /* > + * Verify that the currently configured format matches the output of >* the connected subdev. >*/ > ret = iss_video_check_format(video, vfh); > @@ -905,7 +914,8 @@
Re: [PATCH v4 1/2] staging: omap4iss: fix multiline comment style
Hi Avraham, Thank you for the patches. On Thursday 09 Feb 2017 18:57:55 Avraham Shukron wrote: > Fixed multi-line comments to their preferred style (First line empty) > > Signed-off-by: Avraham Shukron For both of them, Acked-by: Laurent Pinchart I've applied the patches to my tree and will send a pull request for v4.12. > --- > drivers/staging/media/omap4iss/iss_video.c | 38 ++- > 1 file changed, 25 insertions(+), 13 deletions(-) > > diff --git a/drivers/staging/media/omap4iss/iss_video.c > b/drivers/staging/media/omap4iss/iss_video.c index bb0e3b4..e21811a 100644 > --- a/drivers/staging/media/omap4iss/iss_video.c > +++ b/drivers/staging/media/omap4iss/iss_video.c > @@ -128,7 +128,8 @@ static unsigned int iss_video_mbus_to_pix(const struct > iss_video *video, pix->width = mbus->width; > pix->height = mbus->height; > > - /* Skip the last format in the loop so that it will be selected if no > + /* > + * Skip the last format in the loop so that it will be selected if no >* match is found. >*/ > for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { > @@ -138,7 +139,8 @@ static unsigned int iss_video_mbus_to_pix(const struct > iss_video *video, > > min_bpl = pix->width * ALIGN(formats[i].bpp, 8) / 8; > > - /* Clamp the requested bytes per line value. If the maximum bytes per > + /* > + * Clamp the requested bytes per line value. If the maximum bytes per >* line value is zero, the module doesn't support user configurable line >* sizes. Override the requested value with the minimum in that case. >*/ > @@ -172,7 +174,8 @@ static void iss_video_pix_to_mbus(const struct > v4l2_pix_format *pix, mbus->width = pix->width; > mbus->height = pix->height; > > - /* Skip the last format in the loop so that it will be selected if no > + /* > + * Skip the last format in the loop so that it will be selected if no >* match is found. >*/ > for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) { > @@ -360,7 +363,8 @@ static void iss_video_buf_queue(struct vb2_buffer *vb) > > spin_lock_irqsave(>qlock, flags); > > - /* Mark the buffer is faulty and give it back to the queue immediately > + /* > + * Mark the buffer is faulty and give it back to the queue immediately >* if the video node has registered an error. vb2 will perform the same >* check when preparing the buffer, but that is inherently racy, so we >* need to handle the race condition with an authoritative check here. > @@ -443,7 +447,8 @@ struct iss_buffer *omap4iss_video_buffer_next(struct > iss_video *video) > > buf->vb.vb2_buf.timestamp = ktime_get_ns(); > > - /* Do frame number propagation only if this is the output video node. > + /* > + * Do frame number propagation only if this is the output video node. >* Frame number either comes from the CSI receivers or it gets >* incremented here if H3A is not active. >* Note: There is no guarantee that the output buffer will finish > @@ -605,7 +610,8 @@ iss_video_set_format(struct file *file, void *fh, struct > v4l2_format *format) > > mutex_lock(>mutex); > > - /* Fill the bytesperline and sizeimage fields by converting to media bus > + /* > + * Fill the bytesperline and sizeimage fields by converting to media bus >* format and back to pixel format. >*/ > iss_video_pix_to_mbus(>fmt.pix, ); > @@ -678,8 +684,9 @@ iss_video_get_selection(struct file *file, void *fh, > struct v4l2_selection *sel) if (subdev == NULL) > return -EINVAL; > > - /* Try the get selection operation first and fallback to get format if not > - * implemented. > + /* > + * Try the get selection operation first and fallback to get format if > + * not implemented. >*/ > sdsel.pad = pad; > ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, ); > @@ -867,7 +874,8 @@ iss_video_streamon(struct file *file, void *fh, enum > v4l2_buf_type type) > > mutex_lock(>stream_lock); > > - /* Start streaming on the pipeline. No link touching an entity in the > + /* > + * Start streaming on the pipeline. No link touching an entity in the >* pipeline can be activated or deactivated once streaming is started. >*/ > pipe = entity->pipe > @@ -895,7 +903,8 @@ iss_video_streamon(struct file *file, void *fh, enum > v4l2_buf_type type) while ((entity = media_graph_walk_next())) > media_entity_enum_set(>ent_enum, entity); > > - /* Verify that the currently configured format matches the output of > + /* > + * Verify that the currently configured format matches the output of >* the connected subdev. >*/ > ret = iss_video_check_format(video, vfh); > @@ -905,7 +914,8 @@ iss_video_streamon(struct file *file, void *fh, enum > v4l2_buf_type type)
[tip:perf/core] perf tests: Avoid possible truncation with dirent->d_name + snprintf
Commit-ID: 2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 Gitweb: http://git.kernel.org/tip/2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 Author: Arnaldo Carvalho de MeloAuthorDate: Thu, 9 Feb 2017 14:48:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 14:48:46 -0300 perf tests: Avoid possible truncation with dirent->d_name + snprintf Addressing a few cases spotted by a new warning in gcc 7: tests/parse-events.c: In function 'test_pmu_events': tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=] snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); ^~ In file included from /usr/include/stdio.h:939:0, from /git/linux/tools/perf/util/map.h:9, from /git/linux/tools/perf/util/symbol.h:7, from /git/linux/tools/perf/util/evsel.h:10, from tests/parse-events.c:3: /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~ __bos (__s), __fmt, __va_arg_pack ()); ~ tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=] snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Fixes: 945aea220bb8 ("perf tests: Move test objects into 'tests' directory") Link: http://lkml.kernel.org/n/tip-ty4q2p8zp1dp3mskvubxs...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/parse-events.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 20c2e64..aa9276b 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1779,15 +1779,14 @@ static int test_pmu_events(void) } while (!ret && (ent = readdir(dir))) { -#define MAX_NAME 100 struct evlist_test e; - char name[MAX_NAME]; + char name[2 * NAME_MAX + 1 + 12 + 3]; /* Names containing . are special and cannot be used directly */ if (strchr(ent->d_name, '.')) continue; - snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); + snprintf(name, sizeof(name), "cpu/event=%s/u", ent->d_name); e.name = name; e.check = test__checkevent_pmu_events; @@ -1795,11 +1794,10 @@ static int test_pmu_events(void) ret = test_event(); if (ret) break; - snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); + snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); e.name = name; e.check = test__checkevent_pmu_events_mix; ret = test_event(); -#undef MAX_NAME } closedir(dir);
[tip:perf/core] perf tests: Avoid possible truncation with dirent->d_name + snprintf
Commit-ID: 2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 Gitweb: http://git.kernel.org/tip/2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 9 Feb 2017 14:48:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 14:48:46 -0300 perf tests: Avoid possible truncation with dirent->d_name + snprintf Addressing a few cases spotted by a new warning in gcc 7: tests/parse-events.c: In function 'test_pmu_events': tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=] snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); ^~ In file included from /usr/include/stdio.h:939:0, from /git/linux/tools/perf/util/map.h:9, from /git/linux/tools/perf/util/symbol.h:7, from /git/linux/tools/perf/util/evsel.h:10, from tests/parse-events.c:3: /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~ __bos (__s), __fmt, __va_arg_pack ()); ~ tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=] snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Fixes: 945aea220bb8 ("perf tests: Move test objects into 'tests' directory") Link: http://lkml.kernel.org/n/tip-ty4q2p8zp1dp3mskvubxs...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/parse-events.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 20c2e64..aa9276b 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1779,15 +1779,14 @@ static int test_pmu_events(void) } while (!ret && (ent = readdir(dir))) { -#define MAX_NAME 100 struct evlist_test e; - char name[MAX_NAME]; + char name[2 * NAME_MAX + 1 + 12 + 3]; /* Names containing . are special and cannot be used directly */ if (strchr(ent->d_name, '.')) continue; - snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name); + snprintf(name, sizeof(name), "cpu/event=%s/u", ent->d_name); e.name = name; e.check = test__checkevent_pmu_events; @@ -1795,11 +1794,10 @@ static int test_pmu_events(void) ret = test_event(); if (ret) break; - snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); + snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); e.name = name; e.check = test__checkevent_pmu_events_mix; ret = test_event(); -#undef MAX_NAME } closedir(dir);
[tip:perf/core] perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
Commit-ID: 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Gitweb: http://git.kernel.org/tip/8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Author: Arnaldo Carvalho de MeloAuthorDate: Wed, 8 Feb 2017 21:57:22 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 22:06:18 -0300 perf header: Fix handling of PERF_EVENT_UPDATE__SCALE In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a pointer to event_update_event_scale, uses some field from this casted struct and then ends up falling through to the handling of another event type, PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops, fix it by inserting the missing break. Noticed when building perf using gcc 7 on Fedora Rawhide: util/header.c: In function 'perf_event__process_event_update': util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=] evsel->scale = ev_scale->scale; ~^ util/header.c:3208:2: note: here case PERF_EVENT_UPDATE__CPUS: ^~~~ This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map with the correct data. Cc: David Ahern Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: daeecbc0c431 ("perf tools: Add event_update event scale type") Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss9...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/header.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index c567d9f..3d12c16 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3205,6 +3205,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, case PERF_EVENT_UPDATE__SCALE: ev_scale = (struct event_update_event_scale *) ev->data; evsel->scale = ev_scale->scale; + break; case PERF_EVENT_UPDATE__CPUS: ev_cpus = (struct event_update_event_cpus *) ev->data;
[tip:perf/core] perf bench numa: Avoid possible truncation when using snprintf()
Commit-ID: 3aff8ba0a4c9c9191bb788171a1c54778e1246a2 Gitweb: http://git.kernel.org/tip/3aff8ba0a4c9c9191bb788171a1c54778e1246a2 Author: Arnaldo Carvalho de MeloAuthorDate: Thu, 9 Feb 2017 14:39:42 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 14:39:42 -0300 perf bench numa: Avoid possible truncation when using snprintf() Addressing this warning from gcc 7: CC /tmp/build/perf/bench/numa.o bench/numa.c: In function '__bench_numa': bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=] snprintf(tname, 32, "process%d:thread%d", p, t); ^~ bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647] snprintf(tname, 32, "process%d:thread%d", p, t); ^~~~ In file included from /usr/include/stdio.h:939:0, from bench/../util/util.h:47, from bench/../builtin.h:4, from bench/numa.c:11: /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~ __bos (__s), __fmt, __va_arg_pack ()); ~ cc1: all warnings being treated as errors Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Petr Holasek Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-twa37vsfqcie5gwpqwnju...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/bench/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 8efe904..9e5a02d 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -1573,13 +1573,13 @@ static int __bench_numa(const char *name) "GB/sec,", "total-speed", "GB/sec total speed"); if (g->p.show_details >= 2) { - char tname[32]; + char tname[14 + 2 * 10 + 1]; struct thread_data *td; for (p = 0; p < g->p.nr_proc; p++) { for (t = 0; t < g->p.nr_threads; t++) { - memset(tname, 0, 32); + memset(tname, 0, sizeof(tname)); td = g->threads + p*g->p.nr_threads + t; - snprintf(tname, 32, "process%d:thread%d", p, t); + snprintf(tname, sizeof(tname), "process%d:thread%d", p, t); print_res(tname, td->speed_gbs, "GB/sec", "thread-speed", "GB/sec/thread speed"); print_res(tname, td->system_time_ns / NSEC_PER_SEC,
[tip:perf/core] perf header: Fix handling of PERF_EVENT_UPDATE__SCALE
Commit-ID: 8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Gitweb: http://git.kernel.org/tip/8434a2ec13d5c8cb25716950bfbf7c9d7b64628a Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 8 Feb 2017 21:57:22 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 22:06:18 -0300 perf header: Fix handling of PERF_EVENT_UPDATE__SCALE In commit daeecbc0c431 ("perf tools: Add event_update event scale type"), the handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a pointer to event_update_event_scale, uses some field from this casted struct and then ends up falling through to the handling of another event type, PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops, fix it by inserting the missing break. Noticed when building perf using gcc 7 on Fedora Rawhide: util/header.c: In function 'perf_event__process_event_update': util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=] evsel->scale = ev_scale->scale; ~^ util/header.c:3208:2: note: here case PERF_EVENT_UPDATE__CPUS: ^~~~ This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map with the correct data. Cc: David Ahern Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Cc: Peter Zijlstra Fixes: daeecbc0c431 ("perf tools: Add event_update event scale type") Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss9...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/header.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index c567d9f..3d12c16 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3205,6 +3205,7 @@ int perf_event__process_event_update(struct perf_tool *tool __maybe_unused, case PERF_EVENT_UPDATE__SCALE: ev_scale = (struct event_update_event_scale *) ev->data; evsel->scale = ev_scale->scale; + break; case PERF_EVENT_UPDATE__CPUS: ev_cpus = (struct event_update_event_cpus *) ev->data;
[tip:perf/core] perf bench numa: Avoid possible truncation when using snprintf()
Commit-ID: 3aff8ba0a4c9c9191bb788171a1c54778e1246a2 Gitweb: http://git.kernel.org/tip/3aff8ba0a4c9c9191bb788171a1c54778e1246a2 Author: Arnaldo Carvalho de Melo AuthorDate: Thu, 9 Feb 2017 14:39:42 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 9 Feb 2017 14:39:42 -0300 perf bench numa: Avoid possible truncation when using snprintf() Addressing this warning from gcc 7: CC /tmp/build/perf/bench/numa.o bench/numa.c: In function '__bench_numa': bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=] snprintf(tname, 32, "process%d:thread%d", p, t); ^~ bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647] snprintf(tname, 32, "process%d:thread%d", p, t); ^~~~ In file included from /usr/include/stdio.h:939:0, from bench/../util/util.h:47, from bench/../builtin.h:4, from bench/numa.c:11: /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~ __bos (__s), __fmt, __va_arg_pack ()); ~ cc1: all warnings being treated as errors Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Petr Holasek Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-twa37vsfqcie5gwpqwnju...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/bench/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c index 8efe904..9e5a02d 100644 --- a/tools/perf/bench/numa.c +++ b/tools/perf/bench/numa.c @@ -1573,13 +1573,13 @@ static int __bench_numa(const char *name) "GB/sec,", "total-speed", "GB/sec total speed"); if (g->p.show_details >= 2) { - char tname[32]; + char tname[14 + 2 * 10 + 1]; struct thread_data *td; for (p = 0; p < g->p.nr_proc; p++) { for (t = 0; t < g->p.nr_threads; t++) { - memset(tname, 0, 32); + memset(tname, 0, sizeof(tname)); td = g->threads + p*g->p.nr_threads + t; - snprintf(tname, 32, "process%d:thread%d", p, t); + snprintf(tname, sizeof(tname), "process%d:thread%d", p, t); print_res(tname, td->speed_gbs, "GB/sec", "thread-speed", "GB/sec/thread speed"); print_res(tname, td->system_time_ns / NSEC_PER_SEC,
[tip:perf/core] tools string: Use __fallthrough in perf_atoll()
Commit-ID: 94bdd5edb34e472980d1e18b4600d6fb92bd6b0a Gitweb: http://git.kernel.org/tip/94bdd5edb34e472980d1e18b4600d6fb92bd6b0a Author: Arnaldo Carvalho de MeloAuthorDate: Wed, 8 Feb 2017 17:01:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 17:31:01 -0300 tools string: Use __fallthrough in perf_atoll() The implicit fall through case label here is intended, so let us inform that to gcc >= 7: CC /tmp/build/perf/util/string.o util/string.c: In function 'perf_atoll': util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=] if (*p) ^ util/string.c:24:3: note: here case '\0': ^~~~ Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-0ophb30v9apkk6o95el0r...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/string.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index d8dfaf6..bddca51 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -21,6 +21,8 @@ s64 perf_atoll(const char *str) case 'b': case 'B': if (*p) goto out_err; + + __fallthrough; case '\0': return length; default:
[tip:perf/core] tools string: Use __fallthrough in perf_atoll()
Commit-ID: 94bdd5edb34e472980d1e18b4600d6fb92bd6b0a Gitweb: http://git.kernel.org/tip/94bdd5edb34e472980d1e18b4600d6fb92bd6b0a Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 8 Feb 2017 17:01:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 17:31:01 -0300 tools string: Use __fallthrough in perf_atoll() The implicit fall through case label here is intended, so let us inform that to gcc >= 7: CC /tmp/build/perf/util/string.o util/string.c: In function 'perf_atoll': util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=] if (*p) ^ util/string.c:24:3: note: here case '\0': ^~~~ Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-0ophb30v9apkk6o95el0r...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/string.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index d8dfaf6..bddca51 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c @@ -21,6 +21,8 @@ s64 perf_atoll(const char *str) case 'b': case 'B': if (*p) goto out_err; + + __fallthrough; case '\0': return length; default:
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
Im not speaking for google, but I think there is a work ongoing to replace this with user-space code. Until then we have to polish this version as good as we can. It is essential for android as it is now. On 02/09/2017 09:54 PM, Michal Hocko wrote: > On Thu 09-02-17 21:07:37, Greg KH wrote: >> On Thu, Feb 09, 2017 at 08:26:41PM +0100, Michal Hocko wrote: >>> On Thu 09-02-17 14:21:45, peter enderborg wrote: This collects stats for shrinker calls and how much waste work we do within the lowmemorykiller. >>> This doesn't explain why do we need this information and who is going to >>> use it. Not to mention it exports it in /proc which is considered a >>> stable user API. This is a no-go, especially for something that is still >>> lingering in the staging tree without any actuall effort to make it >>> fully supported MM feature. I am actually strongly inclined to simply >>> drop lmk from the tree completely. >> I thought that someone was working to get the "native" mm features to >> work properly with the lmk "feature" Do you recall if that work got >> rejected, or just never happened? > Never happened AFAIR. There were some attempts to tune the current > behavior which has been rejected for one reason or another but I am not > really aware of anybody working on moving the code from staging area. > > I already have this in the to-send queue, just didn't get to post it yet > because I planned to polish the reasoning some more. > --- > From 9f871b54a387e0a7cdfaf0fa256d1440093e427c Mon Sep 17 00:00:00 2001 > From: Michal Hocko> Date: Wed, 1 Feb 2017 10:37:30 +0100 > Subject: [PATCH] staging, android: remove lowmemory killer from the tree > > Lowmemory killer is sitting in the staging tree since 2008 without any > serious interest for fixing issues brought up by the MM folks. The main > objection is that the implementation is basically broken by design: > - it hooks into slab shrinker API which is not suitable for this > purpose. lowmem_count implementation just shows this nicely. > There is no scaling based on the memory pressure and no > feedback to the generic shrinker infrastructure. > - it is not reclaim context aware - no NUMA and/or memcg > awareness. > > As the code stands right now it just adds a maintenance overhead when > core MM changes have to update lowmemorykiller.c as well. > > Signed-off-by: Michal Hocko > --- > drivers/staging/android/Kconfig | 10 -- > drivers/staging/android/Makefile | 1 - > drivers/staging/android/lowmemorykiller.c | 212 > -- > include/linux/sched.h | 4 - > 4 files changed, 227 deletions(-) > delete mode 100644 drivers/staging/android/lowmemorykiller.c > > diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig > index 6c00d6f765c6..71a50b99caff 100644 > --- a/drivers/staging/android/Kconfig > +++ b/drivers/staging/android/Kconfig > @@ -14,16 +14,6 @@ config ASHMEM > It is, in theory, a good memory allocator for low-memory devices, > because it can discard shared memory units when under memory pressure. > > -config ANDROID_LOW_MEMORY_KILLER > - bool "Android Low Memory Killer" > - ---help--- > - Registers processes to be killed when low memory conditions, this is > useful > - as there is no particular swap space on android. > - > - The registered process will kill according to the priorities in > android init > - scripts (/init.rc), and it defines priority values with minimum free > memory size > - for each priority. > - > source "drivers/staging/android/ion/Kconfig" > > endif # if ANDROID > diff --git a/drivers/staging/android/Makefile > b/drivers/staging/android/Makefile > index 7ed1be798909..7cf1564a49a5 100644 > --- a/drivers/staging/android/Makefile > +++ b/drivers/staging/android/Makefile > @@ -3,4 +3,3 @@ ccflags-y += -I$(src) # needed for trace > events > obj-y+= ion/ > > obj-$(CONFIG_ASHMEM) += ashmem.o > -obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o > diff --git a/drivers/staging/android/lowmemorykiller.c > b/drivers/staging/android/lowmemorykiller.c > deleted file mode 100644 > index ec3b66561412.. > --- a/drivers/staging/android/lowmemorykiller.c > +++ /dev/null > @@ -1,212 +0,0 @@ > -/* drivers/misc/lowmemorykiller.c > - * > - * The lowmemorykiller driver lets user-space specify a set of memory > thresholds > - * where processes with a range of oom_score_adj values will get killed. > Specify > - * the minimum oom_score_adj values in > - * /sys/module/lowmemorykiller/parameters/adj and the number of free pages in > - * /sys/module/lowmemorykiller/parameters/minfree. Both files take a comma > - * separated list of numbers in ascending order. > - * > - * For example, write "0,8" to
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
Im not speaking for google, but I think there is a work ongoing to replace this with user-space code. Until then we have to polish this version as good as we can. It is essential for android as it is now. On 02/09/2017 09:54 PM, Michal Hocko wrote: > On Thu 09-02-17 21:07:37, Greg KH wrote: >> On Thu, Feb 09, 2017 at 08:26:41PM +0100, Michal Hocko wrote: >>> On Thu 09-02-17 14:21:45, peter enderborg wrote: This collects stats for shrinker calls and how much waste work we do within the lowmemorykiller. >>> This doesn't explain why do we need this information and who is going to >>> use it. Not to mention it exports it in /proc which is considered a >>> stable user API. This is a no-go, especially for something that is still >>> lingering in the staging tree without any actuall effort to make it >>> fully supported MM feature. I am actually strongly inclined to simply >>> drop lmk from the tree completely. >> I thought that someone was working to get the "native" mm features to >> work properly with the lmk "feature" Do you recall if that work got >> rejected, or just never happened? > Never happened AFAIR. There were some attempts to tune the current > behavior which has been rejected for one reason or another but I am not > really aware of anybody working on moving the code from staging area. > > I already have this in the to-send queue, just didn't get to post it yet > because I planned to polish the reasoning some more. > --- > From 9f871b54a387e0a7cdfaf0fa256d1440093e427c Mon Sep 17 00:00:00 2001 > From: Michal Hocko > Date: Wed, 1 Feb 2017 10:37:30 +0100 > Subject: [PATCH] staging, android: remove lowmemory killer from the tree > > Lowmemory killer is sitting in the staging tree since 2008 without any > serious interest for fixing issues brought up by the MM folks. The main > objection is that the implementation is basically broken by design: > - it hooks into slab shrinker API which is not suitable for this > purpose. lowmem_count implementation just shows this nicely. > There is no scaling based on the memory pressure and no > feedback to the generic shrinker infrastructure. > - it is not reclaim context aware - no NUMA and/or memcg > awareness. > > As the code stands right now it just adds a maintenance overhead when > core MM changes have to update lowmemorykiller.c as well. > > Signed-off-by: Michal Hocko > --- > drivers/staging/android/Kconfig | 10 -- > drivers/staging/android/Makefile | 1 - > drivers/staging/android/lowmemorykiller.c | 212 > -- > include/linux/sched.h | 4 - > 4 files changed, 227 deletions(-) > delete mode 100644 drivers/staging/android/lowmemorykiller.c > > diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig > index 6c00d6f765c6..71a50b99caff 100644 > --- a/drivers/staging/android/Kconfig > +++ b/drivers/staging/android/Kconfig > @@ -14,16 +14,6 @@ config ASHMEM > It is, in theory, a good memory allocator for low-memory devices, > because it can discard shared memory units when under memory pressure. > > -config ANDROID_LOW_MEMORY_KILLER > - bool "Android Low Memory Killer" > - ---help--- > - Registers processes to be killed when low memory conditions, this is > useful > - as there is no particular swap space on android. > - > - The registered process will kill according to the priorities in > android init > - scripts (/init.rc), and it defines priority values with minimum free > memory size > - for each priority. > - > source "drivers/staging/android/ion/Kconfig" > > endif # if ANDROID > diff --git a/drivers/staging/android/Makefile > b/drivers/staging/android/Makefile > index 7ed1be798909..7cf1564a49a5 100644 > --- a/drivers/staging/android/Makefile > +++ b/drivers/staging/android/Makefile > @@ -3,4 +3,3 @@ ccflags-y += -I$(src) # needed for trace > events > obj-y+= ion/ > > obj-$(CONFIG_ASHMEM) += ashmem.o > -obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o > diff --git a/drivers/staging/android/lowmemorykiller.c > b/drivers/staging/android/lowmemorykiller.c > deleted file mode 100644 > index ec3b66561412.. > --- a/drivers/staging/android/lowmemorykiller.c > +++ /dev/null > @@ -1,212 +0,0 @@ > -/* drivers/misc/lowmemorykiller.c > - * > - * The lowmemorykiller driver lets user-space specify a set of memory > thresholds > - * where processes with a range of oom_score_adj values will get killed. > Specify > - * the minimum oom_score_adj values in > - * /sys/module/lowmemorykiller/parameters/adj and the number of free pages in > - * /sys/module/lowmemorykiller/parameters/minfree. Both files take a comma > - * separated list of numbers in ascending order. > - * > - * For example, write "0,8" to /sys/module/lowmemorykiller/parameters/adj and > - *
[tip:perf/core] tools include: Add a __fallthrough statement
Commit-ID: b5bf1733d6a391c4e90ea8f8468d83023be74a2a Gitweb: http://git.kernel.org/tip/b5bf1733d6a391c4e90ea8f8468d83023be74a2a Author: Arnaldo Carvalho de MeloAuthorDate: Wed, 8 Feb 2017 17:01:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 17:30:58 -0300 tools include: Add a __fallthrough statement For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7: CC /tmp/build/perf/util/string.o util/string.c: In function 'perf_atoll': util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=] if (*p) ^ util/string.c:24:3: note: here case '\0': ^~~~ So we introduce: #define __fallthrough __attribute__ ((fallthrough)) And use it in such cases. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Cc: William Cohen Link: http://lkml.kernel.org/n/tip-qnpig0xfop4hwv6k4mv1w...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/compiler.h | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index e33fc1d..d94179f 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -126,4 +126,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s #define WRITE_ONCE(x, val) \ ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) + +#ifndef __fallthrough +# if defined(__GNUC__) && __GNUC__ >= 7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif + #endif /* _TOOLS_LINUX_COMPILER_H */
Re: [RFC][PATCH] tracing: Have traceprobe_probes_write() not access userspace unnecessarily
* Masami Hiramatsuwrote: > On Thu, 9 Feb 2017 18:04:58 -0500 > Steven Rostedt wrote: > > > > > The code in traceprobe_probes_write() reads up to 4096 bytes from userpace > > for each line. If userspace passes in several lines to execute, the code > > will do a large read for each line, even though, it is highly likely that > > the first read from userspace received all of the lines at one. > > > > I changed the logic to do a single read from userspace, and to only read > > from userspace again if not all of the read from userspace made it in. > > > > I tested this by adding printk()s and writing files that would test -1, ==, > > and +1 the buffer size, to make sure that there's no overflows and that if a > > single line is written with +1 the buffer size, that it fails properly. > > > > Thanks Steve! > > Acked-by: Masami Hiramatsu > > BTW, this can conflict with my previous patch. > > https://lkml.org/lkml/2017/2/6/1048 > https://lkml.org/lkml/2017/2/7/203 > > I'll update this. Ingo, Can I send these patch to Steve? Sure, I've not applied your patch yet - mind sending it to Steve on top of Steve's patch? Thanks, Ingo
[tip:perf/core] tools include: Add a __fallthrough statement
Commit-ID: b5bf1733d6a391c4e90ea8f8468d83023be74a2a Gitweb: http://git.kernel.org/tip/b5bf1733d6a391c4e90ea8f8468d83023be74a2a Author: Arnaldo Carvalho de Melo AuthorDate: Wed, 8 Feb 2017 17:01:46 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 17:30:58 -0300 tools include: Add a __fallthrough statement For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7: CC /tmp/build/perf/util/string.o util/string.c: In function 'perf_atoll': util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=] if (*p) ^ util/string.c:24:3: note: here case '\0': ^~~~ So we introduce: #define __fallthrough __attribute__ ((fallthrough)) And use it in such cases. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Cc: William Cohen Link: http://lkml.kernel.org/n/tip-qnpig0xfop4hwv6k4mv1w...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/compiler.h | 9 + 1 file changed, 9 insertions(+) diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index e33fc1d..d94179f 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h @@ -126,4 +126,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s #define WRITE_ONCE(x, val) \ ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) + +#ifndef __fallthrough +# if defined(__GNUC__) && __GNUC__ >= 7 +# define __fallthrough __attribute__ ((fallthrough)) +# else +# define __fallthrough +# endif +#endif + #endif /* _TOOLS_LINUX_COMPILER_H */
Re: [RFC][PATCH] tracing: Have traceprobe_probes_write() not access userspace unnecessarily
* Masami Hiramatsu wrote: > On Thu, 9 Feb 2017 18:04:58 -0500 > Steven Rostedt wrote: > > > > > The code in traceprobe_probes_write() reads up to 4096 bytes from userpace > > for each line. If userspace passes in several lines to execute, the code > > will do a large read for each line, even though, it is highly likely that > > the first read from userspace received all of the lines at one. > > > > I changed the logic to do a single read from userspace, and to only read > > from userspace again if not all of the read from userspace made it in. > > > > I tested this by adding printk()s and writing files that would test -1, ==, > > and +1 the buffer size, to make sure that there's no overflows and that if a > > single line is written with +1 the buffer size, that it fails properly. > > > > Thanks Steve! > > Acked-by: Masami Hiramatsu > > BTW, this can conflict with my previous patch. > > https://lkml.org/lkml/2017/2/6/1048 > https://lkml.org/lkml/2017/2/7/203 > > I'll update this. Ingo, Can I send these patch to Steve? Sure, I've not applied your patch yet - mind sending it to Steve on top of Steve's patch? Thanks, Ingo
[tip:perf/core] perf tools: Fix include of linux/mman.h
Commit-ID: 2f7db55579943cb7723e7567bd9b9927d3777d29 Gitweb: http://git.kernel.org/tip/2f7db55579943cb7723e7567bd9b9927d3777d29 Author: Arnaldo Carvalho de MeloAuthorDate: Tue, 7 Feb 2017 16:15:21 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 16:06:21 -0300 perf tools: Fix include of linux/mman.h It was using uapi/linux/mmap.h which caused for at least one reporter, that hasn't specified in what environment the problem manifests itself: The original error is: In file included from util/event.c:2:0: ...tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h: No such file or directory #include ^ compilation terminated. Test built it on these containers: # dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 debian:experimental-x-arm64: Ok 11 debian:experimental-x-mips: Ok 12 debian:experimental-x-mips64: Ok 13 debian:experimental-x-mipsel: Ok 14 fedora:20: Ok 15 fedora:21: Ok 16 fedora:22: Ok 17 fedora:23: Ok 18 fedora:24: Ok 19 fedora:24-x-ARC-uClibc: Ok 20 fedora:25: Ok 21 fedora:rawhide: Ok 22 mageia:5: Ok 23 opensuse:13.2: Ok 24 opensuse:42.1: Ok 25 opensuse:tumbleweed: Ok 26 ubuntu:12.04.5: Ok 27 ubuntu:14.04.4-x-linaro-arm64: Ok 28 ubuntu:15.10: Ok 29 ubuntu:16.04: Ok 30 ubuntu:16.04-x-arm: Ok 31 ubuntu:16.04-x-arm64: Ok 32 ubuntu:16.04-x-powerpc: Ok 33 ubuntu:16.04-x-powerpc64: Ok 34 ubuntu:16.04-x-powerpc64el: Ok 35 ubuntu:16.04-x-s390: Ok 36 ubuntu:16.10: Ok Reported-by: David Carrillo-Cisneros Cc: Alexander Shishkin Cc: He Kuang Cc: Jiri Olsa Cc: Michal Marek Cc: Paul Turner Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Uwe Kleine-König Cc: Wang Nan Fixes: fbef103fad50 ("perf tools: Do hugetlb handling in more systems") Link: http://lkml.kernel.org/n/tip-4wm5xmjz5wgbq7ucyz4dy...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 8ab0d7d..4ea7ce7 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1,5 +1,5 @@ #include -#include /* To get things like MAP_HUGETLB even on older libc headers */ +#include /* To get things like MAP_HUGETLB even on older libc headers */ #include #include "event.h" #include "debug.h"
Re: [PATCH] media: usb: uvc: add a quirk for Generalplus Technology Inc. 808 Camera
Hi Neil, Thank you for the patch. On Thursday 09 Feb 2017 14:26:46 Neil Armstrong wrote: > As reported on [1], this device needs this quirk to be able to > reliably initialise the webcam. > > [1] https://sourceforge.net/p/linux-uvc/mailman/message/33791098/ > > Signed-off-by: Neil ArmstrongReviewed-by: Laurent Pinchart and applied to my tree. I'll send a pull request for v4.12. > --- > drivers/media/usb/uvc/uvc_driver.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/usb/uvc/uvc_driver.c > b/drivers/media/usb/uvc/uvc_driver.c index 04bf350..6b2d761 100644 > --- a/drivers/media/usb/uvc/uvc_driver.c > +++ b/drivers/media/usb/uvc/uvc_driver.c > @@ -2671,6 +2671,15 @@ static int uvc_clock_param_set(const char *val, > struct kernel_param *kp) .bInterfaceSubClass = 1, > .bInterfaceProtocol = 0, > .driver_info = UVC_QUIRK_PROBE_MINMAX }, > + /* Generalplus Technology Inc. 808 Camera */ > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > + | USB_DEVICE_ID_MATCH_INT_INFO, > + .idVendor = 0x1b3f, > + .idProduct= 0x2002, > + .bInterfaceClass = USB_CLASS_VIDEO, > + .bInterfaceSubClass = 1, > + .bInterfaceProtocol = 0, > + .driver_info = UVC_QUIRK_PROBE_MINMAX }, > /* SiGma Micro USB Web Camera */ > { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > > | USB_DEVICE_ID_MATCH_INT_INFO, -- Regards, Laurent Pinchart
[PATCH 3/4] phy: rockchip-typec: support DP phy switch
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. Signed-off-by: Chris Zhong--- drivers/phy/phy-rockchip-typec.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 7cfb0f8..1604aaa 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -267,6 +267,7 @@ struct rockchip_usb3phy_port_cfg { struct usb3phy_reg usb3tousb2_en; struct usb3phy_reg external_psm; struct usb3phy_reg pipe_status; + struct usb3phy_reg uphy_dp_sel; }; struct rockchip_typec_phy { @@ -736,6 +737,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = { static int rockchip_dp_phy_power_on(struct phy *phy) { struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy); + struct rockchip_usb3phy_port_cfg *cfg = >port_cfgs; int new_mode, ret = 0; u32 val; @@ -766,6 +768,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy) tcphy_phy_init(tcphy, new_mode); } + property_enable(tcphy, >uphy_dp_sel, 1); + ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, val, val & DP_MODE_A2, 1000, PHY_MODE_SET_TIMEOUT); @@ -869,6 +873,11 @@ static int tcphy_parse_dt(struct rockchip_typec_phy *tcphy, if (ret) return ret; + ret = tcphy_get_param(dev, >uphy_dp_sel, + "rockchip,uphy-dp-sel"); + if (ret) + return ret; + tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); if (IS_ERR(tcphy->grf_regs)) { -- 2.6.3
[PATCH 4/4] drm/rockchip: cdn-dp: remove the DP phy switch
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. If the board has 2 Type-C ports, the DP driver get the phy id from devm_of_phy_get_by_index, and then control this switch according to this id. But some others board only has one Type-C port, it may be PHY 0 or PHY 1. The dts node id can not tell us the correct PHY id. Hence move this switch to PHY driver, the PHY driver can distinguish between PHY 0 and PHY 1, and then write the correct register bit. Signed-off-by: Chris Zhong--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 9ab67a6..d3f6e6b 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -43,8 +43,6 @@ #define GRF_SOC_CON9 0x6224 #define DP_SEL_VOP_LIT BIT(12) #define GRF_SOC_CON26 0x6268 -#define UPHY_SEL_BIT 3 -#define UPHY_SEL_MASK BIT(19) #define DPTX_HPD_SEL (3 << 12) #define DPTX_HPD_DEL (2 << 12) #define DPTX_HPD_SEL_MASK (3 << 28) @@ -403,11 +401,6 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) union extcon_property_value property; int ret; - ret = cdn_dp_grf_write(dp, GRF_SOC_CON26, - (port->id << UPHY_SEL_BIT) | UPHY_SEL_MASK); - if (ret) - return ret; - if (!port->phy_enabled) { ret = phy_power_on(port->phy); if (ret) { -- 2.6.3
[PATCH 0/4] Move DP phy switch to PHY driver
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. If the board has 2 Type-C ports, the DP driver get the phy id from devm_of_phy_get_by_index, and then control this switch according to this id. But some others board only has one Type-C port, it may be PHY 0 or PHY 1. The dts node id can not tell us the correct PHY id. Hence move this switch to PHY driver, the PHY driver can distinguish between PHY 0 and PHY 1, and then write the correct register bit. Chris Zhong (4): Documentation: bindings: add uphy-dp-sel for Rockchip USB Type-C PHY arm64: dts: rockchip: add rockchip,uphy-dp-sel for Type-C phy phy: rockchip-typec: support DP phy switch drm/rockchip: cdn-dp: remove the DP phy switch Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 5 + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++ drivers/gpu/drm/rockchip/cdn-dp-core.c | 7 --- drivers/phy/phy-rockchip-typec.c | 9 + 4 files changed, 16 insertions(+), 7 deletions(-) -- 2.6.3
[tip:perf/core] perf tools: Fix include of linux/mman.h
Commit-ID: 2f7db55579943cb7723e7567bd9b9927d3777d29 Gitweb: http://git.kernel.org/tip/2f7db55579943cb7723e7567bd9b9927d3777d29 Author: Arnaldo Carvalho de Melo AuthorDate: Tue, 7 Feb 2017 16:15:21 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 16:06:21 -0300 perf tools: Fix include of linux/mman.h It was using uapi/linux/mmap.h which caused for at least one reporter, that hasn't specified in what environment the problem manifests itself: The original error is: In file included from util/event.c:2:0: ...tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h: No such file or directory #include ^ compilation terminated. Test built it on these containers: # dm 1 alpine:3.4: Ok 2 android-ndk:r12b-arm: Ok 3 archlinux:latest: Ok 4 centos:5: Ok 5 centos:6: Ok 6 centos:7: Ok 7 debian:7: Ok 8 debian:8: Ok 9 debian:experimental: Ok 10 debian:experimental-x-arm64: Ok 11 debian:experimental-x-mips: Ok 12 debian:experimental-x-mips64: Ok 13 debian:experimental-x-mipsel: Ok 14 fedora:20: Ok 15 fedora:21: Ok 16 fedora:22: Ok 17 fedora:23: Ok 18 fedora:24: Ok 19 fedora:24-x-ARC-uClibc: Ok 20 fedora:25: Ok 21 fedora:rawhide: Ok 22 mageia:5: Ok 23 opensuse:13.2: Ok 24 opensuse:42.1: Ok 25 opensuse:tumbleweed: Ok 26 ubuntu:12.04.5: Ok 27 ubuntu:14.04.4-x-linaro-arm64: Ok 28 ubuntu:15.10: Ok 29 ubuntu:16.04: Ok 30 ubuntu:16.04-x-arm: Ok 31 ubuntu:16.04-x-arm64: Ok 32 ubuntu:16.04-x-powerpc: Ok 33 ubuntu:16.04-x-powerpc64: Ok 34 ubuntu:16.04-x-powerpc64el: Ok 35 ubuntu:16.04-x-s390: Ok 36 ubuntu:16.10: Ok Reported-by: David Carrillo-Cisneros Cc: Alexander Shishkin Cc: He Kuang Cc: Jiri Olsa Cc: Michal Marek Cc: Paul Turner Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Uwe Kleine-König Cc: Wang Nan Fixes: fbef103fad50 ("perf tools: Do hugetlb handling in more systems") Link: http://lkml.kernel.org/n/tip-4wm5xmjz5wgbq7ucyz4dy...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 8ab0d7d..4ea7ce7 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1,5 +1,5 @@ #include -#include /* To get things like MAP_HUGETLB even on older libc headers */ +#include /* To get things like MAP_HUGETLB even on older libc headers */ #include #include "event.h" #include "debug.h"
Re: [PATCH] media: usb: uvc: add a quirk for Generalplus Technology Inc. 808 Camera
Hi Neil, Thank you for the patch. On Thursday 09 Feb 2017 14:26:46 Neil Armstrong wrote: > As reported on [1], this device needs this quirk to be able to > reliably initialise the webcam. > > [1] https://sourceforge.net/p/linux-uvc/mailman/message/33791098/ > > Signed-off-by: Neil Armstrong Reviewed-by: Laurent Pinchart and applied to my tree. I'll send a pull request for v4.12. > --- > drivers/media/usb/uvc/uvc_driver.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/usb/uvc/uvc_driver.c > b/drivers/media/usb/uvc/uvc_driver.c index 04bf350..6b2d761 100644 > --- a/drivers/media/usb/uvc/uvc_driver.c > +++ b/drivers/media/usb/uvc/uvc_driver.c > @@ -2671,6 +2671,15 @@ static int uvc_clock_param_set(const char *val, > struct kernel_param *kp) .bInterfaceSubClass = 1, > .bInterfaceProtocol = 0, > .driver_info = UVC_QUIRK_PROBE_MINMAX }, > + /* Generalplus Technology Inc. 808 Camera */ > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > + | USB_DEVICE_ID_MATCH_INT_INFO, > + .idVendor = 0x1b3f, > + .idProduct= 0x2002, > + .bInterfaceClass = USB_CLASS_VIDEO, > + .bInterfaceSubClass = 1, > + .bInterfaceProtocol = 0, > + .driver_info = UVC_QUIRK_PROBE_MINMAX }, > /* SiGma Micro USB Web Camera */ > { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > > | USB_DEVICE_ID_MATCH_INT_INFO, -- Regards, Laurent Pinchart
[PATCH 3/4] phy: rockchip-typec: support DP phy switch
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. Signed-off-by: Chris Zhong --- drivers/phy/phy-rockchip-typec.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 7cfb0f8..1604aaa 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -267,6 +267,7 @@ struct rockchip_usb3phy_port_cfg { struct usb3phy_reg usb3tousb2_en; struct usb3phy_reg external_psm; struct usb3phy_reg pipe_status; + struct usb3phy_reg uphy_dp_sel; }; struct rockchip_typec_phy { @@ -736,6 +737,7 @@ static const struct phy_ops rockchip_usb3_phy_ops = { static int rockchip_dp_phy_power_on(struct phy *phy) { struct rockchip_typec_phy *tcphy = phy_get_drvdata(phy); + struct rockchip_usb3phy_port_cfg *cfg = >port_cfgs; int new_mode, ret = 0; u32 val; @@ -766,6 +768,8 @@ static int rockchip_dp_phy_power_on(struct phy *phy) tcphy_phy_init(tcphy, new_mode); } + property_enable(tcphy, >uphy_dp_sel, 1); + ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, val, val & DP_MODE_A2, 1000, PHY_MODE_SET_TIMEOUT); @@ -869,6 +873,11 @@ static int tcphy_parse_dt(struct rockchip_typec_phy *tcphy, if (ret) return ret; + ret = tcphy_get_param(dev, >uphy_dp_sel, + "rockchip,uphy-dp-sel"); + if (ret) + return ret; + tcphy->grf_regs = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf"); if (IS_ERR(tcphy->grf_regs)) { -- 2.6.3
[PATCH 4/4] drm/rockchip: cdn-dp: remove the DP phy switch
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. If the board has 2 Type-C ports, the DP driver get the phy id from devm_of_phy_get_by_index, and then control this switch according to this id. But some others board only has one Type-C port, it may be PHY 0 or PHY 1. The dts node id can not tell us the correct PHY id. Hence move this switch to PHY driver, the PHY driver can distinguish between PHY 0 and PHY 1, and then write the correct register bit. Signed-off-by: Chris Zhong --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c index 9ab67a6..d3f6e6b 100644 --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -43,8 +43,6 @@ #define GRF_SOC_CON9 0x6224 #define DP_SEL_VOP_LIT BIT(12) #define GRF_SOC_CON26 0x6268 -#define UPHY_SEL_BIT 3 -#define UPHY_SEL_MASK BIT(19) #define DPTX_HPD_SEL (3 << 12) #define DPTX_HPD_DEL (2 << 12) #define DPTX_HPD_SEL_MASK (3 << 28) @@ -403,11 +401,6 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) union extcon_property_value property; int ret; - ret = cdn_dp_grf_write(dp, GRF_SOC_CON26, - (port->id << UPHY_SEL_BIT) | UPHY_SEL_MASK); - if (ret) - return ret; - if (!port->phy_enabled) { ret = phy_power_on(port->phy); if (ret) { -- 2.6.3
[PATCH 0/4] Move DP phy switch to PHY driver
There are 2 Type-c PHYs in RK3399, but only one DP controller. Hence only one PHY can connect to DP controller at one time, the other should be disconnected. The GRF_SOC_CON26 register has a switch bit to do it, set this bit means enable PHY 1, clear this bit means enable PHY 0. If the board has 2 Type-C ports, the DP driver get the phy id from devm_of_phy_get_by_index, and then control this switch according to this id. But some others board only has one Type-C port, it may be PHY 0 or PHY 1. The dts node id can not tell us the correct PHY id. Hence move this switch to PHY driver, the PHY driver can distinguish between PHY 0 and PHY 1, and then write the correct register bit. Chris Zhong (4): Documentation: bindings: add uphy-dp-sel for Rockchip USB Type-C PHY arm64: dts: rockchip: add rockchip,uphy-dp-sel for Type-C phy phy: rockchip-typec: support DP phy switch drm/rockchip: cdn-dp: remove the DP phy switch Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 5 + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 ++ drivers/gpu/drm/rockchip/cdn-dp-core.c | 7 --- drivers/phy/phy-rockchip-typec.c | 9 + 4 files changed, 16 insertions(+), 7 deletions(-) -- 2.6.3
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
On Fri, Feb 10, 2017 at 08:21:32AM +0100, peter enderborg wrote: > Im not speaking for google, but I think there is a work ongoing to > replace this with user-space code. Really? I have not heard this at all, any pointers to whom in Google is doing it? > Until then we have to polish this version as good as we can. It is > essential for android as it is now. But if no one is willing to do the work to fix the reported issues, why should it remain? Can you do the work here? You're already working on fixing some of the issues in a differnt way, why not do the "real work" here instead for everyone to benifit from? thanks, greg k-h
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
On Fri, Feb 10, 2017 at 08:21:32AM +0100, peter enderborg wrote: > Im not speaking for google, but I think there is a work ongoing to > replace this with user-space code. Really? I have not heard this at all, any pointers to whom in Google is doing it? > Until then we have to polish this version as good as we can. It is > essential for android as it is now. But if no one is willing to do the work to fix the reported issues, why should it remain? Can you do the work here? You're already working on fixing some of the issues in a differnt way, why not do the "real work" here instead for everyone to benifit from? thanks, greg k-h
[PATCH 1/4] Documentation: bindings: add uphy-dp-sel for Rockchip USB Type-C PHY
rockchip,uphy-dp-sel is the register of type-c phy enable DP function. Signed-off-by: Chris Zhong--- Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index 6ea867e..c3be83b 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt @@ -33,6 +33,9 @@ offset, enable bit, write mask bit. - rockchip,pipe-status : the register of type-c phy pipe status. for type-c phy0, it must be <0xe5c0 0 0>; for type-c phy1, it must be <0xe5c0 16 16>; + - rockchip,uphy-dp-sel : the register of type-c phy enable DP function + for type-c phy0, it must be <0x6268 19 19>; + for type-c phy1, it must be <0x6268 3 19>; Required nodes : a sub-node is required for each port the phy provides. The sub-node name is used to identify dp or usb3 port, @@ -62,6 +65,7 @@ Example: rockchip,usb3tousb2-en = <0xe580 3 19>; rockchip,external-psm = <0xe588 14 30>; rockchip,pipe-status = <0xe5c0 0 0>; + rockchip,uphy-dp-sel = <0x6268 19 19>; tcphy0_dp: dp-port { #phy-cells = <0>; @@ -90,6 +94,7 @@ Example: rockchip,usb3tousb2-en = <0xe58c 3 19>; rockchip,external-psm = <0xe594 14 30>; rockchip,pipe-status = <0xe5c0 16 16>; + rockchip,uphy-dp-sel = <0x6268 3 19>; tcphy1_dp: dp-port { #phy-cells = <0>; -- 2.6.3
[PATCH 1/4] Documentation: bindings: add uphy-dp-sel for Rockchip USB Type-C PHY
rockchip,uphy-dp-sel is the register of type-c phy enable DP function. Signed-off-by: Chris Zhong --- Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt index 6ea867e..c3be83b 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt @@ -33,6 +33,9 @@ offset, enable bit, write mask bit. - rockchip,pipe-status : the register of type-c phy pipe status. for type-c phy0, it must be <0xe5c0 0 0>; for type-c phy1, it must be <0xe5c0 16 16>; + - rockchip,uphy-dp-sel : the register of type-c phy enable DP function + for type-c phy0, it must be <0x6268 19 19>; + for type-c phy1, it must be <0x6268 3 19>; Required nodes : a sub-node is required for each port the phy provides. The sub-node name is used to identify dp or usb3 port, @@ -62,6 +65,7 @@ Example: rockchip,usb3tousb2-en = <0xe580 3 19>; rockchip,external-psm = <0xe588 14 30>; rockchip,pipe-status = <0xe5c0 0 0>; + rockchip,uphy-dp-sel = <0x6268 19 19>; tcphy0_dp: dp-port { #phy-cells = <0>; @@ -90,6 +94,7 @@ Example: rockchip,usb3tousb2-en = <0xe58c 3 19>; rockchip,external-psm = <0xe594 14 30>; rockchip,pipe-status = <0xe5c0 16 16>; + rockchip,uphy-dp-sel = <0x6268 3 19>; tcphy1_dp: dp-port { #phy-cells = <0>; -- 2.6.3
Re: [PATCH 1/3] kprobes: introduce weak variant of kprobe_exceptions_notify
* Michael Ellermanwrote: > "Naveen N. Rao" writes: > > > kprobe_exceptions_notify() is not used on some of the architectures such > > as arm[64] and powerpc anymore. Introduce a weak variant for such > > architectures. > > I'll merge patch 1 & 3 via the powerpc tree for v4.11. Acked-by: Ingo Molnar Thanks, Ingo
Re: [PATCH 1/3] kprobes: introduce weak variant of kprobe_exceptions_notify
* Michael Ellerman wrote: > "Naveen N. Rao" writes: > > > kprobe_exceptions_notify() is not used on some of the architectures such > > as arm[64] and powerpc anymore. Introduce a weak variant for such > > architectures. > > I'll merge patch 1 & 3 via the powerpc tree for v4.11. Acked-by: Ingo Molnar Thanks, Ingo
[tip:perf/core] perf vendor events intel: Add uncore events for Sandy Bridge Server
Commit-ID: dd32cb5d8fd42316bf8c2b9f7e5c51a38625f755 Gitweb: http://git.kernel.org/tip/dd32cb5d8fd42316bf8c2b9f7e5c51a38625f755 Author: Andi KleenAuthorDate: Sat, 17 Sep 2016 18:10:03 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 16:37:35 -0300 perf vendor events intel: Add uncore events for Sandy Bridge Server This is not a full uncore event list, but a short list of useful and understandable metrics. Signed-off-by: Andi Kleen Cc: Jiri Olsa Link: http://lkml.kernel.org/n/tip-c0cix4eprbldfrx5zf60s...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- .../pmu-events/arch/x86/jaketown/uncore-cache.json | 209 + .../arch/x86/jaketown/uncore-interconnect.json | 46 .../arch/x86/jaketown/uncore-memory.json | 79 +++ .../pmu-events/arch/x86/jaketown/uncore-power.json | 248 + 4 files changed, 582 insertions(+) diff --git a/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json b/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json new file mode 100644 index 000..2f23cf0 --- /dev/null +++ b/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json @@ -0,0 +1,209 @@ +[ +{ +"BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", +"Counter": "0,1,2,3", +"EventName": "UNC_C_CLOCKTICKS", +"PerPkg": "1", +"Unit": "CBO" +}, +{ +"BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", +"Counter": "0,1", +"EventCode": "0x34", +"EventName": "UNC_C_LLC_LOOKUP.ANY", +"Filter": "filter_state=0x1", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x11", +"Unit": "CBO" +}, +{ +"BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", +"Counter": "0,1", +"EventCode": "0x37", +"EventName": "UNC_C_LLC_VICTIMS.M_STATE", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode.demand", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.DATA_READ", +"Filter": "filter_opc=0x182", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses - Uncacheable reads. Derived from unc_c_tor_inserts.miss_opcode.uncacheable", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.UNCACHEABLE", +"Filter": "filter_opc=0x187", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "PCIe allocating writes that miss LLC - DDIO misses. Derived from unc_c_tor_inserts.miss_opcode.ddio_miss", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.PCIE_WRITE", +"Filter": "filter_opc=0x19c", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses for ItoM writes (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.miss_opcode.itom_write", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.ITOM_WRITE", +"Filter": "filter_opc=0x1c8", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode.streaming_full", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.STREAMING_FULL", +"Filter": "filter_opc=0x18c", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode.streaming_partial", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.STREAMING_PARTIAL", +"Filter": "filter_opc=0x18d", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "Partial PCIe reads. Derived from unc_c_tor_inserts.opcode.pcie_partial", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.PCIE_PARTIAL_READ", +"Filter": "filter_opc=0x195", +"PerPkg": "1", +
[tip:perf/core] perf vendor events intel: Add uncore events for Sandy Bridge Server
Commit-ID: dd32cb5d8fd42316bf8c2b9f7e5c51a38625f755 Gitweb: http://git.kernel.org/tip/dd32cb5d8fd42316bf8c2b9f7e5c51a38625f755 Author: Andi Kleen AuthorDate: Sat, 17 Sep 2016 18:10:03 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 16:37:35 -0300 perf vendor events intel: Add uncore events for Sandy Bridge Server This is not a full uncore event list, but a short list of useful and understandable metrics. Signed-off-by: Andi Kleen Cc: Jiri Olsa Link: http://lkml.kernel.org/n/tip-c0cix4eprbldfrx5zf60s...@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- .../pmu-events/arch/x86/jaketown/uncore-cache.json | 209 + .../arch/x86/jaketown/uncore-interconnect.json | 46 .../arch/x86/jaketown/uncore-memory.json | 79 +++ .../pmu-events/arch/x86/jaketown/uncore-power.json | 248 + 4 files changed, 582 insertions(+) diff --git a/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json b/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json new file mode 100644 index 000..2f23cf0 --- /dev/null +++ b/tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json @@ -0,0 +1,209 @@ +[ +{ +"BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", +"Counter": "0,1,2,3", +"EventName": "UNC_C_CLOCKTICKS", +"PerPkg": "1", +"Unit": "CBO" +}, +{ +"BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", +"Counter": "0,1", +"EventCode": "0x34", +"EventName": "UNC_C_LLC_LOOKUP.ANY", +"Filter": "filter_state=0x1", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x11", +"Unit": "CBO" +}, +{ +"BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", +"Counter": "0,1", +"EventCode": "0x37", +"EventName": "UNC_C_LLC_VICTIMS.M_STATE", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses - demand and prefetch data reads - excludes LLC prefetches. Derived from unc_c_tor_inserts.miss_opcode.demand", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.DATA_READ", +"Filter": "filter_opc=0x182", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses - Uncacheable reads. Derived from unc_c_tor_inserts.miss_opcode.uncacheable", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.UNCACHEABLE", +"Filter": "filter_opc=0x187", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "PCIe allocating writes that miss LLC - DDIO misses. Derived from unc_c_tor_inserts.miss_opcode.ddio_miss", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.PCIE_WRITE", +"Filter": "filter_opc=0x19c", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "LLC misses for ItoM writes (as part of fast string memcpy stores). Derived from unc_c_tor_inserts.miss_opcode.itom_write", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_MISSES.ITOM_WRITE", +"Filter": "filter_opc=0x1c8", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x3", +"Unit": "CBO" +}, +{ +"BriefDescription": "Streaming stores (full cache line). Derived from unc_c_tor_inserts.opcode.streaming_full", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.STREAMING_FULL", +"Filter": "filter_opc=0x18c", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "Streaming stores (partial cache line). Derived from unc_c_tor_inserts.opcode.streaming_partial", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.STREAMING_PARTIAL", +"Filter": "filter_opc=0x18d", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +"BriefDescription": "Partial PCIe reads. Derived from unc_c_tor_inserts.opcode.pcie_partial", +"Counter": "0,1", +"EventCode": "0x35", +"EventName": "LLC_REFERENCES.PCIE_PARTIAL_READ", +"Filter": "filter_opc=0x195", +"PerPkg": "1", +"ScaleUnit": "64Bytes", +"UMask": "0x1", +"Unit": "CBO" +}, +{ +
[tip:perf/core] perf tools: Use zfree() instead of ad hoc equivalent
Commit-ID: 506fde11a35f39e1b44478339c41e94dfd278aa2 Gitweb: http://git.kernel.org/tip/506fde11a35f39e1b44478339c41e94dfd278aa2 Author: Taeung SongAuthorDate: Wed, 1 Feb 2017 21:34:06 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:41:11 -0300 perf tools: Use zfree() instead of ad hoc equivalent We have zfree() for this very common pattern: free(ptr); ptr = NULL; So use it in a few more places. Signed-off-by: Taeung Song Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1485952447-7013-4-git-send-email-treeze.tae...@gmail.com [ rewrote commit log ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 1f1f77d..ab1ba22 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name) if (path->system == NULL || path->name == NULL) { zfree(>system); zfree(>name); - free(path); - path = NULL; + zfree(); } return path; @@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void) p = perf_pmu_events_list + i; free(p->symbol); } - free(perf_pmu_events_list); - perf_pmu_events_list = NULL; + zfree(_pmu_events_list); perf_pmu_events_list_num = 0; } }
[tip:perf/core] perf tools: Use zfree() instead of ad hoc equivalent
Commit-ID: 506fde11a35f39e1b44478339c41e94dfd278aa2 Gitweb: http://git.kernel.org/tip/506fde11a35f39e1b44478339c41e94dfd278aa2 Author: Taeung Song AuthorDate: Wed, 1 Feb 2017 21:34:06 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:41:11 -0300 perf tools: Use zfree() instead of ad hoc equivalent We have zfree() for this very common pattern: free(ptr); ptr = NULL; So use it in a few more places. Signed-off-by: Taeung Song Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1485952447-7013-4-git-send-email-treeze.tae...@gmail.com [ rewrote commit log ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 1f1f77d..ab1ba22 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -254,8 +254,7 @@ struct tracepoint_path *tracepoint_name_to_path(const char *name) if (path->system == NULL || path->name == NULL) { zfree(>system); zfree(>name); - free(path); - path = NULL; + zfree(); } return path; @@ -1482,8 +1481,7 @@ static void perf_pmu__parse_cleanup(void) p = perf_pmu_events_list + i; free(p->symbol); } - free(perf_pmu_events_list); - perf_pmu_events_list = NULL; + zfree(_pmu_events_list); perf_pmu_events_list_num = 0; } }
Re: [PATCH] proc/sysctl: prune stale dentries during unregistering
On Fri, Feb 10, 2017 at 10:35:02AM +0300, Konstantin Khlebnikov wrote: > # time sysctl -a > /dev/null > real1m12.806s > user0m0.016s > sys 1m12.400s > > Currently only memory reclaimer could remove this garbage. > But without significant memory pressure this never happens. > > This patch collects sysctl inodes into list on sysctl table header and > prunes all their dentries once that table unregisters. I'd probably go for hlist, but that's mostly cosmetic difference; how about the matching stats *after* that patch?
Re: [PATCH] proc/sysctl: prune stale dentries during unregistering
On Fri, Feb 10, 2017 at 10:35:02AM +0300, Konstantin Khlebnikov wrote: > # time sysctl -a > /dev/null > real1m12.806s > user0m0.016s > sys 1m12.400s > > Currently only memory reclaimer could remove this garbage. > But without significant memory pressure this never happens. > > This patch collects sysctl inodes into list on sysctl table header and > prunes all their dentries once that table unregisters. I'd probably go for hlist, but that's mostly cosmetic difference; how about the matching stats *after* that patch?
RE: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst type
> -Original Message- > From: Changming Huang [mailto:jerry.hu...@nxp.com] > Sent: Wednesday, January 18, 2017 4:12 PM > To: ba...@kernel.org; robh...@kernel.org; mark.rutl...@arm.com; > catalin.mari...@arm.com > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; > devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; Jerry > Huang; Rajesh Bhagat > Subject: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst > type > > Enable the undefined length INCR burst type and set INCRx. > Different platform may has the different burst size type. > In order to get best performance, we need to tune the burst size to one > special value, instead of the default value. > > Signed-off-by: Changming Huang > Signed-off-by: Rajesh Bhagat > --- > Changes in v4: > - Modify the codes according to the definition of this property. > Changes in v3: > - add new property for INCR burst in usb node to reset GSBUSCFG0. > Changes in v2: > - split patch > - create one new function to handle soc bus configuration register. > > drivers/usb/dwc3/core.c | 83 > +++ > drivers/usb/dwc3/core.h |7 > 2 files changed, 90 insertions(+) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index > 369bab1..446aec3 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -650,6 +650,87 @@ static void dwc3_core_setup_global_control(struct > dwc3 *dwc) > dwc3_writel(dwc->regs, DWC3_GCTL, reg); } > > +/* set global soc bus configuration registers */ static void > +dwc3_set_soc_bus_cfg(struct dwc3 *dwc) { > + struct device *dev = dwc->dev; > + u32 *vals; > + u32 cfg; > + int ntype; > + int ret; > + int i; > + > + cfg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0); > + > + /* > + * Handle property "snps,incr-burst-type-adjustment". > + * Get the number of value from this property: > + * result <= 0, means this property is not supported. > + * result = 1, means INCRx burst mode supported. > + * result > 1, means undefined length burst mode supported. > + */ > + ntype = device_property_read_u32_array(dev, > + "snps,incr-burst-type-adjustment", NULL, 0); > + if (ntype > 0) { > + vals = kcalloc(ntype, sizeof(u32), GFP_KERNEL); > + if (!vals) { > + dev_err(dev, "Error to get memory\n"); > + return; > + } > + /* Get INCR burst type, and parse it */ > + ret = device_property_read_u32_array(dev, > + "snps,incr-burst-type-adjustment", vals, ntype); > + if (ret) { > + dev_err(dev, "Error to get property\n"); > + return; > + } > + *(dwc->incrx_type + 1) = vals[0]; > + if (ntype > 1) { > + *dwc->incrx_type = 1; > + for (i = 1; i < ntype; i++) { > + if (vals[i] > *(dwc->incrx_type + 1)) > + *(dwc->incrx_type + 1) = vals[i]; > + } > + } else > + *dwc->incrx_type = 0; > + > + /* Enable Undefined Length INCR Burst and Enable INCRx > Burst */ > + cfg &= ~DWC3_GSBUSCFG0_INCRBRST_MASK; > + if (*dwc->incrx_type) > + cfg |= DWC3_GSBUSCFG0_INCRBRSTENA; > + switch (*(dwc->incrx_type + 1)) { > + case 256: > + cfg |= DWC3_GSBUSCFG0_INCR256BRSTENA; > + break; > + case 128: > + cfg |= DWC3_GSBUSCFG0_INCR128BRSTENA; > + break; > + case 64: > + cfg |= DWC3_GSBUSCFG0_INCR64BRSTENA; > + break; > + case 32: > + cfg |= DWC3_GSBUSCFG0_INCR32BRSTENA; > + break; > + case 16: > + cfg |= DWC3_GSBUSCFG0_INCR16BRSTENA; > + break; > + case 8: > + cfg |= DWC3_GSBUSCFG0_INCR8BRSTENA; > + break; > + case 4: > + cfg |= DWC3_GSBUSCFG0_INCR4BRSTENA; > + break; > + case 1: > + break; > + default: > + dev_err(dev, "Invalid property\n"); > + break; > + } > + } > + > + dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, cfg); } > + > /** > * dwc3_core_init - Low-level initialization of DWC3 Core > * @dwc: Pointer to our controller context structure @@ -698,6 +779,8 @@ > static int dwc3_core_init(struct dwc3 *dwc) > /* Adjust Frame Length */ > dwc3_frame_length_adjustment(dwc); > > +
RE: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst type
> -Original Message- > From: Changming Huang [mailto:jerry.hu...@nxp.com] > Sent: Wednesday, January 18, 2017 4:12 PM > To: ba...@kernel.org; robh...@kernel.org; mark.rutl...@arm.com; > catalin.mari...@arm.com > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; > devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; Jerry > Huang ; Rajesh Bhagat > Subject: [PATCH v4 3/3] USB3/DWC3: Enable undefined length INCR burst > type > > Enable the undefined length INCR burst type and set INCRx. > Different platform may has the different burst size type. > In order to get best performance, we need to tune the burst size to one > special value, instead of the default value. > > Signed-off-by: Changming Huang > Signed-off-by: Rajesh Bhagat > --- > Changes in v4: > - Modify the codes according to the definition of this property. > Changes in v3: > - add new property for INCR burst in usb node to reset GSBUSCFG0. > Changes in v2: > - split patch > - create one new function to handle soc bus configuration register. > > drivers/usb/dwc3/core.c | 83 > +++ > drivers/usb/dwc3/core.h |7 > 2 files changed, 90 insertions(+) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index > 369bab1..446aec3 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -650,6 +650,87 @@ static void dwc3_core_setup_global_control(struct > dwc3 *dwc) > dwc3_writel(dwc->regs, DWC3_GCTL, reg); } > > +/* set global soc bus configuration registers */ static void > +dwc3_set_soc_bus_cfg(struct dwc3 *dwc) { > + struct device *dev = dwc->dev; > + u32 *vals; > + u32 cfg; > + int ntype; > + int ret; > + int i; > + > + cfg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0); > + > + /* > + * Handle property "snps,incr-burst-type-adjustment". > + * Get the number of value from this property: > + * result <= 0, means this property is not supported. > + * result = 1, means INCRx burst mode supported. > + * result > 1, means undefined length burst mode supported. > + */ > + ntype = device_property_read_u32_array(dev, > + "snps,incr-burst-type-adjustment", NULL, 0); > + if (ntype > 0) { > + vals = kcalloc(ntype, sizeof(u32), GFP_KERNEL); > + if (!vals) { > + dev_err(dev, "Error to get memory\n"); > + return; > + } > + /* Get INCR burst type, and parse it */ > + ret = device_property_read_u32_array(dev, > + "snps,incr-burst-type-adjustment", vals, ntype); > + if (ret) { > + dev_err(dev, "Error to get property\n"); > + return; > + } > + *(dwc->incrx_type + 1) = vals[0]; > + if (ntype > 1) { > + *dwc->incrx_type = 1; > + for (i = 1; i < ntype; i++) { > + if (vals[i] > *(dwc->incrx_type + 1)) > + *(dwc->incrx_type + 1) = vals[i]; > + } > + } else > + *dwc->incrx_type = 0; > + > + /* Enable Undefined Length INCR Burst and Enable INCRx > Burst */ > + cfg &= ~DWC3_GSBUSCFG0_INCRBRST_MASK; > + if (*dwc->incrx_type) > + cfg |= DWC3_GSBUSCFG0_INCRBRSTENA; > + switch (*(dwc->incrx_type + 1)) { > + case 256: > + cfg |= DWC3_GSBUSCFG0_INCR256BRSTENA; > + break; > + case 128: > + cfg |= DWC3_GSBUSCFG0_INCR128BRSTENA; > + break; > + case 64: > + cfg |= DWC3_GSBUSCFG0_INCR64BRSTENA; > + break; > + case 32: > + cfg |= DWC3_GSBUSCFG0_INCR32BRSTENA; > + break; > + case 16: > + cfg |= DWC3_GSBUSCFG0_INCR16BRSTENA; > + break; > + case 8: > + cfg |= DWC3_GSBUSCFG0_INCR8BRSTENA; > + break; > + case 4: > + cfg |= DWC3_GSBUSCFG0_INCR4BRSTENA; > + break; > + case 1: > + break; > + default: > + dev_err(dev, "Invalid property\n"); > + break; > + } > + } > + > + dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, cfg); } > + > /** > * dwc3_core_init - Low-level initialization of DWC3 Core > * @dwc: Pointer to our controller context structure @@ -698,6 +779,8 @@ > static int dwc3_core_init(struct dwc3 *dwc) > /* Adjust Frame Length */ > dwc3_frame_length_adjustment(dwc); > > + dwc3_set_soc_bus_cfg(dwc); > + > usb_phy_set_suspend(dwc->usb2_phy, 0); >
Re: [PATCH 2/6] tpm: export tpm2_flush_context_cmd
On Wed, Feb 08, 2017 at 10:58:30AM -0700, Jason Gunthorpe wrote: > > /** > > + * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command > > + * @chip: TPM chip to use > > + * @payload: the key data in clear and encrypted form > > + * @options: authentication values and other options > > + * > > + * Return: same as with tpm_transmit_cmd > > + */ > > +void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, > > + unsigned int flags) > > Why did you move the function in the same file? Adding a prototype > shouldn't require that.. > > Jason To be logically positioned in the same way as it is in the header. It cannot in-between the helper functions for tpm2_seal_trusted(). /Jarkko
Re: [PATCH V3 2/2] Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN
On 02/09/2017 06:20 PM, Scott Bauer wrote: > When CONFIG_KASAN is enabled, compilation fails: > > block/sed-opal.c: In function 'sed_ioctl': > block/sed-opal.c:2447:1: error: the frame size of 2256 bytes is larger than > 2048 bytes [-Werror=frame-larger-than=] > > Moved all the ioctl structures off the stack and dynamically activate > using _IOC_SIZE() > > Fixes: 455a7b238cd6 ("block: Add Sed-opal library") > > Reported-by: Arnd Bergmann> Signed-off-by: Scott Bauer > --- > block/sed-opal.c | 134 > +-- > 1 file changed, 50 insertions(+), 84 deletions(-) > [...] > - if (copy_from_user(, arg, sizeof(session))) > - return -EFAULT; > - return opal_erase_locking_range(dev, ); > + ioctl_ptr = kzalloc(cmd_size, GFP_KERNEL); > + if (!ioctl_ptr) > + return -ENOMEM; > + if (copy_from_user(ioctl_ptr, arg, cmd_size)) { > + ret = -EFAULT; > + goto out; > } Can't we use memdup_user() instead of kzalloc() + copy_from_user()? -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH 2/6] tpm: export tpm2_flush_context_cmd
On Wed, Feb 08, 2017 at 10:58:30AM -0700, Jason Gunthorpe wrote: > > /** > > + * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command > > + * @chip: TPM chip to use > > + * @payload: the key data in clear and encrypted form > > + * @options: authentication values and other options > > + * > > + * Return: same as with tpm_transmit_cmd > > + */ > > +void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, > > + unsigned int flags) > > Why did you move the function in the same file? Adding a prototype > shouldn't require that.. > > Jason To be logically positioned in the same way as it is in the header. It cannot in-between the helper functions for tpm2_seal_trusted(). /Jarkko
Re: [PATCH V3 2/2] Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN
On 02/09/2017 06:20 PM, Scott Bauer wrote: > When CONFIG_KASAN is enabled, compilation fails: > > block/sed-opal.c: In function 'sed_ioctl': > block/sed-opal.c:2447:1: error: the frame size of 2256 bytes is larger than > 2048 bytes [-Werror=frame-larger-than=] > > Moved all the ioctl structures off the stack and dynamically activate > using _IOC_SIZE() > > Fixes: 455a7b238cd6 ("block: Add Sed-opal library") > > Reported-by: Arnd Bergmann > Signed-off-by: Scott Bauer > --- > block/sed-opal.c | 134 > +-- > 1 file changed, 50 insertions(+), 84 deletions(-) > [...] > - if (copy_from_user(, arg, sizeof(session))) > - return -EFAULT; > - return opal_erase_locking_range(dev, ); > + ioctl_ptr = kzalloc(cmd_size, GFP_KERNEL); > + if (!ioctl_ptr) > + return -ENOMEM; > + if (copy_from_user(ioctl_ptr, arg, cmd_size)) { > + ret = -EFAULT; > + goto out; > } Can't we use memdup_user() instead of kzalloc() + copy_from_user()? -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[tip:perf/core] perf sdt: Show proper hint when event not yet in place via 'perf probe'
Commit-ID: 27cf5706a04e53f6844c71be1cbbf1df665f5d19 Gitweb: http://git.kernel.org/tip/27cf5706a04e53f6844c71be1cbbf1df665f5d19 Author: Ravi BangoriaAuthorDate: Fri, 3 Feb 2017 15:56:42 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:28:54 -0300 perf sdt: Show proper hint when event not yet in place via 'perf probe' All events from 'perf list', except SDT events, can be directly recorded with 'perf record'. But, the flow is little different for SDT events. Probe points for SDT event needs to be created using 'perf probe' before recording it using 'perf record'. Perf shows misleading hint when a user tries to record SDT event without first creating a probe point. Show proper hint there. Before patch: $ perf record -a -e sdt_glib:idle__add event syntax error: 'sdt_glib:idle__add' \___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found. Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?. ... After patch: $ perf record -a -e sdt_glib:idle__add event syntax error: 'sdt_glib:idle__add' \___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found. Hint: SDT event cannot be directly recorded on. Please first use 'perf probe sdt_glib:idle__add' before recording it. ... $ perf probe sdt_glib:idle__add Added new event: sdt_glib:idle__add (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2) You can now use it in all perf tools, such as: perf record -e sdt_glib:idle__add -aR sleep 1 $ perf record -a -e sdt_glib:idle__add [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.175 MB perf.data ] Suggested-and-Acked-by: Ingo Molnar Signed-off-by: Ravi Bangoria Tested-by: Arnaldo Carvalho de Melo Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Alexis Berlemont Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Naveen N. Rao Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170203102642.17258-1-ravi.bango...@linux.vnet.ibm.com [ s/Please use/Please first use/ and break the Hint line in two ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/api/fs/tracing_path.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 251b7c3..3e606b9 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -86,9 +86,13 @@ void put_tracing_file(char *file) free(file); } -static int strerror_open(int err, char *buf, size_t size, const char *filename) +int tracing_path__strerror_open_tp(int err, char *buf, size_t size, + const char *sys, const char *name) { char sbuf[128]; + char filename[PATH_MAX]; + + snprintf(filename, PATH_MAX, "%s/%s", sys, name ?: "*"); switch (err) { case ENOENT: @@ -99,10 +103,19 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) * - jirka */ if (debugfs__configured() || tracefs__configured()) { - snprintf(buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", -tracing_events_path, filename); + /* sdt markers */ + if (!strncmp(filename, "sdt_", 4)) { + snprintf(buf, size, + "Error:\tFile %s/%s not found.\n" + "Hint:\tSDT event cannot be directly recorded on.\n" + "\tPlease first use 'perf probe %s:%s' before recording it.\n", + tracing_events_path, filename, sys, name); + } else { + snprintf(buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", +tracing_events_path, filename); + } break; } snprintf(buf, size, "%s", @@ -125,12 +138,3 @@ static int strerror_open(int err, char *buf, size_t size, const char
[tip:perf/core] perf sdt: Show proper hint when event not yet in place via 'perf probe'
Commit-ID: 27cf5706a04e53f6844c71be1cbbf1df665f5d19 Gitweb: http://git.kernel.org/tip/27cf5706a04e53f6844c71be1cbbf1df665f5d19 Author: Ravi Bangoria AuthorDate: Fri, 3 Feb 2017 15:56:42 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:28:54 -0300 perf sdt: Show proper hint when event not yet in place via 'perf probe' All events from 'perf list', except SDT events, can be directly recorded with 'perf record'. But, the flow is little different for SDT events. Probe points for SDT event needs to be created using 'perf probe' before recording it using 'perf record'. Perf shows misleading hint when a user tries to record SDT event without first creating a probe point. Show proper hint there. Before patch: $ perf record -a -e sdt_glib:idle__add event syntax error: 'sdt_glib:idle__add' \___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found. Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?. ... After patch: $ perf record -a -e sdt_glib:idle__add event syntax error: 'sdt_glib:idle__add' \___ unknown tracepoint Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found. Hint: SDT event cannot be directly recorded on. Please first use 'perf probe sdt_glib:idle__add' before recording it. ... $ perf probe sdt_glib:idle__add Added new event: sdt_glib:idle__add (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2) You can now use it in all perf tools, such as: perf record -e sdt_glib:idle__add -aR sleep 1 $ perf record -a -e sdt_glib:idle__add [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.175 MB perf.data ] Suggested-and-Acked-by: Ingo Molnar Signed-off-by: Ravi Bangoria Tested-by: Arnaldo Carvalho de Melo Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Alexis Berlemont Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Naveen N. Rao Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170203102642.17258-1-ravi.bango...@linux.vnet.ibm.com [ s/Please use/Please first use/ and break the Hint line in two ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/api/fs/tracing_path.c | 32 ++-- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c index 251b7c3..3e606b9 100644 --- a/tools/lib/api/fs/tracing_path.c +++ b/tools/lib/api/fs/tracing_path.c @@ -86,9 +86,13 @@ void put_tracing_file(char *file) free(file); } -static int strerror_open(int err, char *buf, size_t size, const char *filename) +int tracing_path__strerror_open_tp(int err, char *buf, size_t size, + const char *sys, const char *name) { char sbuf[128]; + char filename[PATH_MAX]; + + snprintf(filename, PATH_MAX, "%s/%s", sys, name ?: "*"); switch (err) { case ENOENT: @@ -99,10 +103,19 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) * - jirka */ if (debugfs__configured() || tracefs__configured()) { - snprintf(buf, size, -"Error:\tFile %s/%s not found.\n" -"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", -tracing_events_path, filename); + /* sdt markers */ + if (!strncmp(filename, "sdt_", 4)) { + snprintf(buf, size, + "Error:\tFile %s/%s not found.\n" + "Hint:\tSDT event cannot be directly recorded on.\n" + "\tPlease first use 'perf probe %s:%s' before recording it.\n", + tracing_events_path, filename, sys, name); + } else { + snprintf(buf, size, +"Error:\tFile %s/%s not found.\n" +"Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n", +tracing_events_path, filename); + } break; } snprintf(buf, size, "%s", @@ -125,12 +138,3 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename) return 0; } - -int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name) -{ - char path[PATH_MAX]; - - snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*"); - - return strerror_open(err, buf, size, path); -}
[tip:perf/core] perf symbols: Take into account symfs setting when reading file build ID
Commit-ID: 9b200653518ea9ccc331b204c7d555d2440570d1 Gitweb: http://git.kernel.org/tip/9b200653518ea9ccc331b204c7d555d2440570d1 Author: Victor KamenskyAuthorDate: Mon, 6 Feb 2017 15:48:28 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:28:55 -0300 perf symbols: Take into account symfs setting when reading file build ID After commit 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID") and when --symfs option is used perf failed to pick up symbols for file with the same name between host and sysroot specified by --symfs option. One can see message like this: bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols It happens because code added by 5baecbcd9c9a opens files directly by dso->long_name without symbol_conf.symfs consideration, which as result picks one from the host. It reads its build ID and later even code finds another proper file in directory pointed by --symfs perf ignores it because build id mismatches. Fix is to use __symbol__join_symfs to adjust file name according to --symfs setting. If no --symfs passed the operation would noop and picks the same host file as before. Also note in latter tree after 5baecbcd9c9a commit additional check for '!dso->has_build_id' was added, so to observe error condition 'perf record' should run with --no-buildid, so perf.data itself would not have build id for target binary in buildid perf section and 'perf report' will pass '!dso->has_build_id' condition. Or target binary should not have build id, but the same binary on host has build id, again '!dso->has_build_id' will pass in this case and incorrect build id could be read if --symfs is used. Signed-off-by: Victor Kamensky Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Chris Phlipot Cc: Dima Kogan Cc: He Kuang Cc: Kan Liang Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Cc: xe-linux-exter...@cisco.com Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID") Link: http://lkml.kernel.org/r/1486424908-17094-1-git-send-email-kamen...@cisco.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index dc93940..70e389b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1460,9 +1460,11 @@ int dso__load(struct dso *dso, struct map *map) * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work */ if (!dso->has_build_id && - is_regular_file(dso->long_name) && - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) + is_regular_file(dso->long_name)) { + __symbol__join_symfs(name, PATH_MAX, dso->long_name); + if (filename__read_build_id(name, build_id, BUILD_ID_SIZE) > 0) dso__set_build_id(dso, build_id); + } /* * Iterate over candidate debug images.
[tip:perf/core] perf symbols: Take into account symfs setting when reading file build ID
Commit-ID: 9b200653518ea9ccc331b204c7d555d2440570d1 Gitweb: http://git.kernel.org/tip/9b200653518ea9ccc331b204c7d555d2440570d1 Author: Victor Kamensky AuthorDate: Mon, 6 Feb 2017 15:48:28 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 09:28:55 -0300 perf symbols: Take into account symfs setting when reading file build ID After commit 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID") and when --symfs option is used perf failed to pick up symbols for file with the same name between host and sysroot specified by --symfs option. One can see message like this: bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols It happens because code added by 5baecbcd9c9a opens files directly by dso->long_name without symbol_conf.symfs consideration, which as result picks one from the host. It reads its build ID and later even code finds another proper file in directory pointed by --symfs perf ignores it because build id mismatches. Fix is to use __symbol__join_symfs to adjust file name according to --symfs setting. If no --symfs passed the operation would noop and picks the same host file as before. Also note in latter tree after 5baecbcd9c9a commit additional check for '!dso->has_build_id' was added, so to observe error condition 'perf record' should run with --no-buildid, so perf.data itself would not have build id for target binary in buildid perf section and 'perf report' will pass '!dso->has_build_id' condition. Or target binary should not have build id, but the same binary on host has build id, again '!dso->has_build_id' will pass in this case and incorrect build id could be read if --symfs is used. Signed-off-by: Victor Kamensky Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Chris Phlipot Cc: Dima Kogan Cc: He Kuang Cc: Kan Liang Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Cc: xe-linux-exter...@cisco.com Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID") Link: http://lkml.kernel.org/r/1486424908-17094-1-git-send-email-kamen...@cisco.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/symbol.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index dc93940..70e389b 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1460,9 +1460,11 @@ int dso__load(struct dso *dso, struct map *map) * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work */ if (!dso->has_build_id && - is_regular_file(dso->long_name) && - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) + is_regular_file(dso->long_name)) { + __symbol__join_symfs(name, PATH_MAX, dso->long_name); + if (filename__read_build_id(name, build_id, BUILD_ID_SIZE) > 0) dso__set_build_id(dso, build_id); + } /* * Iterate over candidate debug images.
[tip:perf/core] perf pmu: Support per pmu json aliases
Commit-ID: 15b22ed369aa23ef4d083ffb9621650c353d3ddd Gitweb: http://git.kernel.org/tip/15b22ed369aa23ef4d083ffb9621650c353d3ddd Author: Andi KleenAuthorDate: Fri, 27 Jan 2017 18:03:38 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:03 -0300 perf pmu: Support per pmu json aliases Add support for registering json aliases per PMU. Any alias with an unit matching the prefix is registered to the PMU. Uncore has multiple instances of most units, so all these aliases get registered for each individual PMU (this is important later to run the event on every instance of the PMU). To avoid printing the events multiple times in perf list filter out duplicated events during printing. v2: Rely on uncore_ prefix already in unit v3: Document why calls were reordered Signed-off-by: Andi Kleen Cc: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-4-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/pmu.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6dc3cc0..8e9d00f 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -590,14 +590,16 @@ static struct perf_pmu *pmu_lookup(const char *name) if (pmu_format(name, )) return NULL; - if (pmu_aliases(name, )) + /* +* Check the type first to avoid unnecessary work. +*/ + if (pmu_type(name, )) return NULL; - pmu_add_cpu_aliases(, name); - - if (pmu_type(name, )) + if (pmu_aliases(name, )) return NULL; + pmu_add_cpu_aliases(, name); pmu = zalloc(sizeof(*pmu)); if (!pmu) return NULL; @@ -1195,6 +1197,9 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, len = j; qsort(aliases, len, sizeof(struct sevent), cmp_sevent); for (j = 0; j < len; j++) { + /* Skip duplicates */ + if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) + continue; if (name_only) { printf("%s ", aliases[j].name); continue;
[tip:perf/core] perf tools arm64: Add support for generating bpf prologue
Commit-ID: 3bb53c9f124bd9297f18d58a395cff59dfaf8541 Gitweb: http://git.kernel.org/tip/3bb53c9f124bd9297f18d58a395cff59dfaf8541 Author: He KuangAuthorDate: Tue, 7 Feb 2017 07:34:11 + Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:01 -0300 perf tools arm64: Add support for generating bpf prologue Since HAVE_KPROBES can be enabled in arm64, this patch introduces regs_query_register_offset() to convert register name to offset for arm64, so the BPF prologue feature is ready to use. Signed-off-by: He Kuang Reviewed-by: Will Deacon Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Bintian Wang Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Wang Nan Cc: linux-arm-ker...@lists.infradead.org Link: http://lkml.kernel.org/r/20170207073412.26983-1-heku...@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/util/dwarf-regs.c | 15 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 18b1351..eebe1ec 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -2,3 +2,4 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif PERF_HAVE_JITDUMP := 1 +PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c index d49efeb..068b618 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c @@ -10,17 +10,20 @@ #include #include +#include /* for struct user_pt_regs */ +#include "util.h" struct pt_regs_dwarfnum { const char *name; unsigned int dwarfnum; }; -#define STR(s) #s #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} #define GPR_DWARFNUM_NAME(num) \ {.name = STR(%x##num), .dwarfnum = num} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} +#define DWARFNUM2OFFSET(index) \ + (index * sizeof((struct user_pt_regs *)0)->regs[0]) /* * Reference: @@ -78,3 +81,13 @@ const char *get_arch_regstr(unsigned int n) return roff->name; return NULL; } + +int regs_query_register_offset(const char *name) +{ + const struct pt_regs_dwarfnum *roff; + + for (roff = regdwarfnum_table; roff->name != NULL; roff++) + if (!strcmp(roff->name, name)) + return DWARFNUM2OFFSET(roff->dwarfnum); + return -EINVAL; +}
[tip:perf/core] perf pmu: Support per pmu json aliases
Commit-ID: 15b22ed369aa23ef4d083ffb9621650c353d3ddd Gitweb: http://git.kernel.org/tip/15b22ed369aa23ef4d083ffb9621650c353d3ddd Author: Andi Kleen AuthorDate: Fri, 27 Jan 2017 18:03:38 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:03 -0300 perf pmu: Support per pmu json aliases Add support for registering json aliases per PMU. Any alias with an unit matching the prefix is registered to the PMU. Uncore has multiple instances of most units, so all these aliases get registered for each individual PMU (this is important later to run the event on every instance of the PMU). To avoid printing the events multiple times in perf list filter out duplicated events during printing. v2: Rely on uncore_ prefix already in unit v3: Document why calls were reordered Signed-off-by: Andi Kleen Cc: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-4-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/pmu.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6dc3cc0..8e9d00f 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -590,14 +590,16 @@ static struct perf_pmu *pmu_lookup(const char *name) if (pmu_format(name, )) return NULL; - if (pmu_aliases(name, )) + /* +* Check the type first to avoid unnecessary work. +*/ + if (pmu_type(name, )) return NULL; - pmu_add_cpu_aliases(, name); - - if (pmu_type(name, )) + if (pmu_aliases(name, )) return NULL; + pmu_add_cpu_aliases(, name); pmu = zalloc(sizeof(*pmu)); if (!pmu) return NULL; @@ -1195,6 +1197,9 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, len = j; qsort(aliases, len, sizeof(struct sevent), cmp_sevent); for (j = 0; j < len; j++) { + /* Skip duplicates */ + if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) + continue; if (name_only) { printf("%s ", aliases[j].name); continue;
[tip:perf/core] perf tools arm64: Add support for generating bpf prologue
Commit-ID: 3bb53c9f124bd9297f18d58a395cff59dfaf8541 Gitweb: http://git.kernel.org/tip/3bb53c9f124bd9297f18d58a395cff59dfaf8541 Author: He Kuang AuthorDate: Tue, 7 Feb 2017 07:34:11 + Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:01 -0300 perf tools arm64: Add support for generating bpf prologue Since HAVE_KPROBES can be enabled in arm64, this patch introduces regs_query_register_offset() to convert register name to offset for arm64, so the BPF prologue feature is ready to use. Signed-off-by: He Kuang Reviewed-by: Will Deacon Acked-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Bintian Wang Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Wang Nan Cc: linux-arm-ker...@lists.infradead.org Link: http://lkml.kernel.org/r/20170207073412.26983-1-heku...@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/util/dwarf-regs.c | 15 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 18b1351..eebe1ec 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -2,3 +2,4 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif PERF_HAVE_JITDUMP := 1 +PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c index d49efeb..068b618 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c @@ -10,17 +10,20 @@ #include #include +#include /* for struct user_pt_regs */ +#include "util.h" struct pt_regs_dwarfnum { const char *name; unsigned int dwarfnum; }; -#define STR(s) #s #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} #define GPR_DWARFNUM_NAME(num) \ {.name = STR(%x##num), .dwarfnum = num} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} +#define DWARFNUM2OFFSET(index) \ + (index * sizeof((struct user_pt_regs *)0)->regs[0]) /* * Reference: @@ -78,3 +81,13 @@ const char *get_arch_regstr(unsigned int n) return roff->name; return NULL; } + +int regs_query_register_offset(const char *name) +{ + const struct pt_regs_dwarfnum *roff; + + for (roff = regdwarfnum_table; roff->name != NULL; roff++) + if (!strcmp(roff->name, name)) + return DWARFNUM2OFFSET(roff->dwarfnum); + return -EINVAL; +}
[tip:perf/core] perf pmu: Support event aliases for non cpu// pmus
Commit-ID: 231bb2aa32498cbebef1306889a02114e9dfc934 Gitweb: http://git.kernel.org/tip/231bb2aa32498cbebef1306889a02114e9dfc934 Author: Andi KleenAuthorDate: Fri, 27 Jan 2017 18:03:39 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:04 -0300 perf pmu: Support event aliases for non cpu// pmus The code for handling pmu aliases without specifying the PMU hardcoded only supported the cpu PMU. This patch extends it to work for all PMUs. We always duplicate the event for all PMUs that have an matching alias. This allows to automatically expand an alias for all instances of a PMU (so for example you can monitor all cache boxes with a single event) Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-5-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 46 -- tools/perf/util/parse-events.y | 32 ++--- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 3c876b8..6dbcba7 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1504,35 +1504,41 @@ static void perf_pmu__parse_init(void) struct perf_pmu_alias *alias; int len = 0; - pmu = perf_pmu__find("cpu"); - if ((pmu == NULL) || list_empty(>aliases)) { + pmu = NULL; + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + list_for_each_entry(alias, >aliases, list) { + if (strchr(alias->name, '-')) + len++; + len++; + } + } + + if (len == 0) { perf_pmu_events_list_num = -1; return; } - list_for_each_entry(alias, >aliases, list) { - if (strchr(alias->name, '-')) - len++; - len++; - } perf_pmu_events_list = malloc(sizeof(struct perf_pmu_event_symbol) * len); if (!perf_pmu_events_list) return; perf_pmu_events_list_num = len; len = 0; - list_for_each_entry(alias, >aliases, list) { - struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; - char *tmp = strchr(alias->name, '-'); - - if (tmp != NULL) { - SET_SYMBOL(strndup(alias->name, tmp - alias->name), - PMU_EVENT_SYMBOL_PREFIX); - p++; - SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); - len += 2; - } else { - SET_SYMBOL(strdup(alias->name), PMU_EVENT_SYMBOL); - len++; + pmu = NULL; + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + list_for_each_entry(alias, >aliases, list) { + struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; + char *tmp = strchr(alias->name, '-'); + + if (tmp != NULL) { + SET_SYMBOL(strndup(alias->name, tmp - alias->name), + PMU_EVENT_SYMBOL_PREFIX); + p++; + SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); + len += 2; + } else { + SET_SYMBOL(strdup(alias->name), PMU_EVENT_SYMBOL); + len++; + } } } qsort(perf_pmu_events_list, len, diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 879115f..f3b5ec9 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -12,6 +12,7 @@ #include #include #include "util.h" +#include "pmu.h" #include "parse-events.h" #include "parse-events-bison.h" @@ -236,15 +237,32 @@ PE_KERNEL_PMU_EVENT sep_dc struct list_head *head; struct parse_events_term *term; struct list_head *list; + struct perf_pmu *pmu = NULL; + int ok = 0; - ALLOC_LIST(head); - ABORT_ON(parse_events_term__num(, PARSE_EVENTS__TERM_TYPE_USER, - $1, 1, &@1, NULL)); - list_add_tail(>list, head); - + /* Add it for all PMUs that support the alias */ ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); - parse_events_terms__delete(head); + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + struct perf_pmu_alias *alias; + + list_for_each_entry(alias, >aliases, list) { + if (!strcasecmp(alias->name, $1)) { +
[tip:perf/core] perf pmu: Support event aliases for non cpu// pmus
Commit-ID: 231bb2aa32498cbebef1306889a02114e9dfc934 Gitweb: http://git.kernel.org/tip/231bb2aa32498cbebef1306889a02114e9dfc934 Author: Andi Kleen AuthorDate: Fri, 27 Jan 2017 18:03:39 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:04 -0300 perf pmu: Support event aliases for non cpu// pmus The code for handling pmu aliases without specifying the PMU hardcoded only supported the cpu PMU. This patch extends it to work for all PMUs. We always duplicate the event for all PMUs that have an matching alias. This allows to automatically expand an alias for all instances of a PMU (so for example you can monitor all cache boxes with a single event) Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-5-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 46 -- tools/perf/util/parse-events.y | 32 ++--- 2 files changed, 51 insertions(+), 27 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 3c876b8..6dbcba7 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1504,35 +1504,41 @@ static void perf_pmu__parse_init(void) struct perf_pmu_alias *alias; int len = 0; - pmu = perf_pmu__find("cpu"); - if ((pmu == NULL) || list_empty(>aliases)) { + pmu = NULL; + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + list_for_each_entry(alias, >aliases, list) { + if (strchr(alias->name, '-')) + len++; + len++; + } + } + + if (len == 0) { perf_pmu_events_list_num = -1; return; } - list_for_each_entry(alias, >aliases, list) { - if (strchr(alias->name, '-')) - len++; - len++; - } perf_pmu_events_list = malloc(sizeof(struct perf_pmu_event_symbol) * len); if (!perf_pmu_events_list) return; perf_pmu_events_list_num = len; len = 0; - list_for_each_entry(alias, >aliases, list) { - struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; - char *tmp = strchr(alias->name, '-'); - - if (tmp != NULL) { - SET_SYMBOL(strndup(alias->name, tmp - alias->name), - PMU_EVENT_SYMBOL_PREFIX); - p++; - SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); - len += 2; - } else { - SET_SYMBOL(strdup(alias->name), PMU_EVENT_SYMBOL); - len++; + pmu = NULL; + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + list_for_each_entry(alias, >aliases, list) { + struct perf_pmu_event_symbol *p = perf_pmu_events_list + len; + char *tmp = strchr(alias->name, '-'); + + if (tmp != NULL) { + SET_SYMBOL(strndup(alias->name, tmp - alias->name), + PMU_EVENT_SYMBOL_PREFIX); + p++; + SET_SYMBOL(strdup(++tmp), PMU_EVENT_SYMBOL_SUFFIX); + len += 2; + } else { + SET_SYMBOL(strdup(alias->name), PMU_EVENT_SYMBOL); + len++; + } } } qsort(perf_pmu_events_list, len, diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index 879115f..f3b5ec9 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -12,6 +12,7 @@ #include #include #include "util.h" +#include "pmu.h" #include "parse-events.h" #include "parse-events-bison.h" @@ -236,15 +237,32 @@ PE_KERNEL_PMU_EVENT sep_dc struct list_head *head; struct parse_events_term *term; struct list_head *list; + struct perf_pmu *pmu = NULL; + int ok = 0; - ALLOC_LIST(head); - ABORT_ON(parse_events_term__num(, PARSE_EVENTS__TERM_TYPE_USER, - $1, 1, &@1, NULL)); - list_add_tail(>list, head); - + /* Add it for all PMUs that support the alias */ ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); - parse_events_terms__delete(head); + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + struct perf_pmu_alias *alias; + + list_for_each_entry(alias, >aliases, list) { + if (!strcasecmp(alias->name, $1)) { + ALLOC_LIST(head); +
[tip:perf/core] perf jevents: Parse eventcode as number
Commit-ID: d581141970ef3965c1624960fa928d765afd8a3e Gitweb: http://git.kernel.org/tip/d581141970ef3965c1624960fa928d765afd8a3e Author: Andi KleenAuthorDate: Fri, 27 Jan 2017 18:03:36 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:02 -0300 perf jevents: Parse eventcode as number The next patch needs to modify event code. Previously eventcode was just passed through as a string. Now parse it as a number. v2: Don't special case 0 Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-2-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/pmu-events/jevents.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 41611d7..551377b 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -135,7 +135,6 @@ static struct field { const char *field; const char *kernel; } fields[] = { - { "EventCode", "event=" }, { "UMask", "umask=" }, { "CounterMask", "cmask=" }, { "Invert", "inv=" }, @@ -343,6 +342,7 @@ int json_events(const char *fn, jsmntok_t *tokens, *tok; int i, j, len; char *map; + char buf[128]; if (!fn) return -ENOENT; @@ -356,6 +356,7 @@ int json_events(const char *fn, char *event = NULL, *desc = NULL, *name = NULL; char *long_desc = NULL; char *extra_desc = NULL; + unsigned long long eventcode = 0; struct msrmap *msr = NULL; jsmntok_t *msrval = NULL; jsmntok_t *precise = NULL; @@ -376,6 +377,11 @@ int json_events(const char *fn, nz = !json_streq(map, val, "0"); if (match_field(map, field, nz, , val)) { /* ok */ + } else if (json_streq(map, field, "EventCode")) { + char *code = NULL; + addfield(map, , "", "", val); + eventcode |= strtoul(code, NULL, 0); + free(code); } else if (json_streq(map, field, "EventName")) { addfield(map, , "", "", val); } else if (json_streq(map, field, "BriefDescription")) { @@ -410,6 +416,8 @@ int json_events(const char *fn, addfield(map, _desc, " ", "(Precise event)", NULL); } + snprintf(buf, sizeof buf, "event=%#llx", eventcode); + addfield(map, , ",", buf, NULL); if (desc && extra_desc) addfield(map, , " ", extra_desc, NULL); if (long_desc && extra_desc)
[tip:perf/core] perf jevents: Parse eventcode as number
Commit-ID: d581141970ef3965c1624960fa928d765afd8a3e Gitweb: http://git.kernel.org/tip/d581141970ef3965c1624960fa928d765afd8a3e Author: Andi Kleen AuthorDate: Fri, 27 Jan 2017 18:03:36 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 8 Feb 2017 08:55:02 -0300 perf jevents: Parse eventcode as number The next patch needs to modify event code. Previously eventcode was just passed through as a string. Now parse it as a number. v2: Don't special case 0 Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170128020345.19007-2-a...@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/pmu-events/jevents.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 41611d7..551377b 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -135,7 +135,6 @@ static struct field { const char *field; const char *kernel; } fields[] = { - { "EventCode", "event=" }, { "UMask", "umask=" }, { "CounterMask", "cmask=" }, { "Invert", "inv=" }, @@ -343,6 +342,7 @@ int json_events(const char *fn, jsmntok_t *tokens, *tok; int i, j, len; char *map; + char buf[128]; if (!fn) return -ENOENT; @@ -356,6 +356,7 @@ int json_events(const char *fn, char *event = NULL, *desc = NULL, *name = NULL; char *long_desc = NULL; char *extra_desc = NULL; + unsigned long long eventcode = 0; struct msrmap *msr = NULL; jsmntok_t *msrval = NULL; jsmntok_t *precise = NULL; @@ -376,6 +377,11 @@ int json_events(const char *fn, nz = !json_streq(map, val, "0"); if (match_field(map, field, nz, , val)) { /* ok */ + } else if (json_streq(map, field, "EventCode")) { + char *code = NULL; + addfield(map, , "", "", val); + eventcode |= strtoul(code, NULL, 0); + free(code); } else if (json_streq(map, field, "EventName")) { addfield(map, , "", "", val); } else if (json_streq(map, field, "BriefDescription")) { @@ -410,6 +416,8 @@ int json_events(const char *fn, addfield(map, _desc, " ", "(Precise event)", NULL); } + snprintf(buf, sizeof buf, "event=%#llx", eventcode); + addfield(map, , ",", buf, NULL); if (desc && extra_desc) addfield(map, , " ", extra_desc, NULL); if (long_desc && extra_desc)
Re: [PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2)
* Namhyung Kimwrote: > Hello, > > This patchset adds 'delta-abs' compute method to -c/--compute option. > The 'delta-abs' is same as 'delta' but shows entries with bigger > absolute delta first instead of sorting numerically. This is only > useful together with -o option. > > * v2 changes > - rebase onto acme/perf/core > - change default option to '-o 1 -c delta-abs' > > > Below is default output (-c delta): > > $ perf diff -o 1 -c delta | grep -v ^# | head > 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit > 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock > +1.15% [kernel.kallsyms] [k] copy_user_generic_string > 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs > 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk > +0.64% [kernel.kallsyms] [k] kmem_cache_alloc > 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock > +0.45% [kernel.kallsyms] [k] alloc_set_pte > 0.16% +0.45% [kernel.kallsyms] [k] menu_select > +0.41% ld-2.24.so [.] do_lookup_x > > Now with 'delta-abs' it shows entries have bigger delta value either > positive or negative. > > $ perf diff -o 1 -c delta-abs | grep -v ^# | head > 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit > 12.72% -3.01% [kernel.kallsyms] [k] intel_idle > 9.72% -1.31% [unknown] [.] 0x00411343 > 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock > +1.15% [kernel.kallsyms] [k] copy_user_generic_string > 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs > 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk > 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single > +0.64% [kernel.kallsyms] [k] kmem_cache_alloc > 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock Nice! BTW., to me the second output looks a lot more intuitive and useful than the default one. Would it be possible to flip over the default to the 'most useful' options, and see whether anyone complains? Thanks, Ingo
Re: [PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2)
* Namhyung Kim wrote: > Hello, > > This patchset adds 'delta-abs' compute method to -c/--compute option. > The 'delta-abs' is same as 'delta' but shows entries with bigger > absolute delta first instead of sorting numerically. This is only > useful together with -o option. > > * v2 changes > - rebase onto acme/perf/core > - change default option to '-o 1 -c delta-abs' > > > Below is default output (-c delta): > > $ perf diff -o 1 -c delta | grep -v ^# | head > 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit > 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock > +1.15% [kernel.kallsyms] [k] copy_user_generic_string > 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs > 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk > +0.64% [kernel.kallsyms] [k] kmem_cache_alloc > 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock > +0.45% [kernel.kallsyms] [k] alloc_set_pte > 0.16% +0.45% [kernel.kallsyms] [k] menu_select > +0.41% ld-2.24.so [.] do_lookup_x > > Now with 'delta-abs' it shows entries have bigger delta value either > positive or negative. > > $ perf diff -o 1 -c delta-abs | grep -v ^# | head > 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit > 12.72% -3.01% [kernel.kallsyms] [k] intel_idle > 9.72% -1.31% [unknown] [.] 0x00411343 > 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock > +1.15% [kernel.kallsyms] [k] copy_user_generic_string > 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs > 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk > 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single > +0.64% [kernel.kallsyms] [k] kmem_cache_alloc > 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock Nice! BTW., to me the second output looks a lot more intuitive and useful than the default one. Would it be possible to flip over the default to the 'most useful' options, and see whether anyone complains? Thanks, Ingo
[no subject]
Greetings. I think I may have found a bug with the hix5hd2_gmac driver; unless I'm missing something, it appears that somehow the net_device struct is not being initialized properly in the hix5hd2_dev_probe function. Having set up my devicetree properly (I hope, still new to this), I first recieved an error when inserting the module: "(unnamed net_device) (uninitialized): No irq resource" while I very clearly have the interrupts property defined within this node. Removing the phy-handle node for testing purposes, I get a similar message: "(unnamed net_device) (uninitialized): not find phy-handle" So, it seams to my (admittedly inexperienced) mind that the ndev pointer is not being initialized properly, or that the error checking at line is not functioning properly either, for it to have gotten so far along into the function, only to fail at the attempt to access the ndev pointer. If you require more information from me, please let me know. Marty
[no subject]
Greetings. I think I may have found a bug with the hix5hd2_gmac driver; unless I'm missing something, it appears that somehow the net_device struct is not being initialized properly in the hix5hd2_dev_probe function. Having set up my devicetree properly (I hope, still new to this), I first recieved an error when inserting the module: "(unnamed net_device) (uninitialized): No irq resource" while I very clearly have the interrupts property defined within this node. Removing the phy-handle node for testing purposes, I get a similar message: "(unnamed net_device) (uninitialized): not find phy-handle" So, it seams to my (admittedly inexperienced) mind that the ndev pointer is not being initialized properly, or that the error checking at line is not functioning properly either, for it to have gotten so far along into the function, only to fail at the attempt to access the ndev pointer. If you require more information from me, please let me know. Marty
Re: [PATCH 3/3 staging-next] mm: Remove RCU and tasklocks from lmk
On 02/09/2017 09:05 PM, Michal Hocko wrote: > On Thu 09-02-17 14:21:52, peter enderborg wrote: >> Fundamental changes: >> 1 Does NOT take any RCU lock in shrinker functions. >> 2 It returns same result for scan and counts, so we dont need to do >> shinker will know when it is pointless to call scan. >> 3 It does not lock any other process than the one that is >> going to be killed. >> >> Background. >> The low memory killer scans for process that can be killed to free >> memory. This can be cpu consuming when there is a high demand for >> memory. This can be seen by analysing the kswapd0 task work. >> The stats function added in earler patch adds a counter for waste work. >> >> How it works. >> This patch create a structure within the lowmemory killer that caches >> the user spaces processes that it might kill. It is done with a >> sorted rbtree so we can very easy find the candidate to be killed, >> and knows its properies as memory usage and sorted by oom_score_adj >> to look up the task with highest oom_score_adj. To be able to achive >> this it uses oom_score_notify events. >> >> This patch also as a other effect, we are now free to do other >> lowmemorykiller configurations. Without the patch there is a need >> for a tradeoff between freed memory and task and rcu locks. This >> is no longer a concern for tuning lmk. This patch is not intended >> to do any calculation changes other than we do use the cache for >> calculate the count values and that makes kswapd0 to shrink other >> areas. > I have to admit I really do not understand big part of the above > paragraph as well as how this all is supposed to work. A quick glance > over the implementation. __lmk_task_insert seems to be only called from > the oom_score notifier context. If nobody updates the value then no task > will get into the tree. Or am I missing something really obvious here? > Moreover oom scores tend to be mostly same for tasks. That means that > your sorted tree will become sorted by pids in most cases. I do not see > any sorting based on the rss nor any updates that would reflect updates > of rss. How can this possibly work? The task tree nodes are created,updated or removed from the notifier when there is a relevant oom_score_adj change. If no one create a task that is in the range for the lowmemorykiller the tree will be empty. This is an android feature so the score will be updated very often. It is part of activity manager to prioritise tasks. Why should we do sort of rss?
Re: [PATCH 3/3 staging-next] mm: Remove RCU and tasklocks from lmk
On 02/09/2017 09:05 PM, Michal Hocko wrote: > On Thu 09-02-17 14:21:52, peter enderborg wrote: >> Fundamental changes: >> 1 Does NOT take any RCU lock in shrinker functions. >> 2 It returns same result for scan and counts, so we dont need to do >> shinker will know when it is pointless to call scan. >> 3 It does not lock any other process than the one that is >> going to be killed. >> >> Background. >> The low memory killer scans for process that can be killed to free >> memory. This can be cpu consuming when there is a high demand for >> memory. This can be seen by analysing the kswapd0 task work. >> The stats function added in earler patch adds a counter for waste work. >> >> How it works. >> This patch create a structure within the lowmemory killer that caches >> the user spaces processes that it might kill. It is done with a >> sorted rbtree so we can very easy find the candidate to be killed, >> and knows its properies as memory usage and sorted by oom_score_adj >> to look up the task with highest oom_score_adj. To be able to achive >> this it uses oom_score_notify events. >> >> This patch also as a other effect, we are now free to do other >> lowmemorykiller configurations. Without the patch there is a need >> for a tradeoff between freed memory and task and rcu locks. This >> is no longer a concern for tuning lmk. This patch is not intended >> to do any calculation changes other than we do use the cache for >> calculate the count values and that makes kswapd0 to shrink other >> areas. > I have to admit I really do not understand big part of the above > paragraph as well as how this all is supposed to work. A quick glance > over the implementation. __lmk_task_insert seems to be only called from > the oom_score notifier context. If nobody updates the value then no task > will get into the tree. Or am I missing something really obvious here? > Moreover oom scores tend to be mostly same for tasks. That means that > your sorted tree will become sorted by pids in most cases. I do not see > any sorting based on the rss nor any updates that would reflect updates > of rss. How can this possibly work? The task tree nodes are created,updated or removed from the notifier when there is a relevant oom_score_adj change. If no one create a task that is in the range for the lowmemorykiller the tree will be empty. This is an android feature so the score will be updated very often. It is part of activity manager to prioritise tasks. Why should we do sort of rss?
[PATCH v2 2/4] perf diff: Add diff.order config option
In many cases, I need to look at differences between two data so I often used the -o option to sort the result base on the difference first. It'd be nice to have a config option to set it by default. The diff.order config option is to set the default value of -o/--order option. Cc: Taeung SongSigned-off-by: Namhyung Kim --- tools/perf/Documentation/perf-config.txt | 7 +++ tools/perf/Documentation/perf-diff.txt | 6 +- tools/perf/builtin-diff.c| 14 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 9365b75fd04f..5b54d47ef713 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -498,6 +498,13 @@ Variables But if this option is 'no-cache', it will not update the build-id cache. 'skip' skips post-processing and does not update the cache. +diff.*:: + diff.order:: + This option sets the number of column to sort the result. + Default is 0 which means sorting by baseline. + Setting it to 1 will sort the result by delta (or other + compute method selected). + SEE ALSO linkperf:perf[1] diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index af80284cd2f6..6ba3bf582d79 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -99,7 +99,11 @@ OPTIONS -o:: --order:: - Specify compute sorting column number. + Specify compute sorting column number. 0 means sorting by baseline + overhead (default) and 1 means sorting by computed value of column 1 + (data from the first file other base baseline). Values more than 1 + can be used only if enough data files are provided. + Default value can be set using diff.order config option. --percentage:: Determine how to display the overhead percentage of filtered entries. diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 781c9e60bd21..181ff996e039 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -17,6 +17,7 @@ #include "util/symbol.h" #include "util/util.h" #include "util/data.h" +#include "util/config.h" #include #include @@ -1291,6 +1292,17 @@ static int data_init(int argc, const char **argv) return 0; } +static int diff__config(const char *var, const char *value, + void *cb __maybe_unused) +{ + if (!strcmp(var, "diff.order")) { + sort_compute = perf_config_int(var, value); + return 0; + } + + return 0; +} + int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) { int ret = hists__init(); @@ -1298,6 +1310,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) if (ret < 0) return ret; + perf_config(diff__config, NULL); + argc = parse_options(argc, argv, options, diff_usage, 0); if (symbol__init(NULL) < 0) -- 2.11.0
[PATCH v2 2/4] perf diff: Add diff.order config option
In many cases, I need to look at differences between two data so I often used the -o option to sort the result base on the difference first. It'd be nice to have a config option to set it by default. The diff.order config option is to set the default value of -o/--order option. Cc: Taeung Song Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-config.txt | 7 +++ tools/perf/Documentation/perf-diff.txt | 6 +- tools/perf/builtin-diff.c| 14 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 9365b75fd04f..5b54d47ef713 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -498,6 +498,13 @@ Variables But if this option is 'no-cache', it will not update the build-id cache. 'skip' skips post-processing and does not update the cache. +diff.*:: + diff.order:: + This option sets the number of column to sort the result. + Default is 0 which means sorting by baseline. + Setting it to 1 will sort the result by delta (or other + compute method selected). + SEE ALSO linkperf:perf[1] diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index af80284cd2f6..6ba3bf582d79 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -99,7 +99,11 @@ OPTIONS -o:: --order:: - Specify compute sorting column number. + Specify compute sorting column number. 0 means sorting by baseline + overhead (default) and 1 means sorting by computed value of column 1 + (data from the first file other base baseline). Values more than 1 + can be used only if enough data files are provided. + Default value can be set using diff.order config option. --percentage:: Determine how to display the overhead percentage of filtered entries. diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 781c9e60bd21..181ff996e039 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -17,6 +17,7 @@ #include "util/symbol.h" #include "util/util.h" #include "util/data.h" +#include "util/config.h" #include #include @@ -1291,6 +1292,17 @@ static int data_init(int argc, const char **argv) return 0; } +static int diff__config(const char *var, const char *value, + void *cb __maybe_unused) +{ + if (!strcmp(var, "diff.order")) { + sort_compute = perf_config_int(var, value); + return 0; + } + + return 0; +} + int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) { int ret = hists__init(); @@ -1298,6 +1310,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) if (ret < 0) return ret; + perf_config(diff__config, NULL); + argc = parse_options(argc, argv, options, diff_usage, 0); if (symbol__init(NULL) < 0) -- 2.11.0
[PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2)
Hello, This patchset adds 'delta-abs' compute method to -c/--compute option. The 'delta-abs' is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option. * v2 changes - rebase onto acme/perf/core - change default option to '-o 1 -c delta-abs' Below is default output (-c delta): $ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_x Now with 'delta-abs' it shows entries have bigger delta value either positive or negative. $ perf diff -o 1 -c delta-abs | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 12.72% -3.01% [kernel.kallsyms] [k] intel_idle 9.72% -1.31% [unknown] [.] 0x00411343 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock The patch 2 and 3 are to add config options to control the default behavior of perf diff command. And patch 4 changes the default setting. The code is avaiable at 'perf/diff-delta-abs-v2' branch in git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git Thanks, Namhyung Namhyung Kim (4): perf diff: Add 'delta-abs' compute method perf diff: Add diff.order config option perf diff: Add diff.compute config option perf diff: Change default setting to "delta-abs" tools/perf/Documentation/perf-config.txt | 12 + tools/perf/Documentation/perf-diff.txt | 15 -- tools/perf/builtin-diff.c| 78 ++-- 3 files changed, 98 insertions(+), 7 deletions(-) -- 2.11.0
[PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2)
Hello, This patchset adds 'delta-abs' compute method to -c/--compute option. The 'delta-abs' is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option. * v2 changes - rebase onto acme/perf/core - change default option to '-o 1 -c delta-abs' Below is default output (-c delta): $ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_x Now with 'delta-abs' it shows entries have bigger delta value either positive or negative. $ perf diff -o 1 -c delta-abs | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 12.72% -3.01% [kernel.kallsyms] [k] intel_idle 9.72% -1.31% [unknown] [.] 0x00411343 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock The patch 2 and 3 are to add config options to control the default behavior of perf diff command. And patch 4 changes the default setting. The code is avaiable at 'perf/diff-delta-abs-v2' branch in git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git Thanks, Namhyung Namhyung Kim (4): perf diff: Add 'delta-abs' compute method perf diff: Add diff.order config option perf diff: Add diff.compute config option perf diff: Change default setting to "delta-abs" tools/perf/Documentation/perf-config.txt | 12 + tools/perf/Documentation/perf-diff.txt | 15 -- tools/perf/builtin-diff.c| 78 ++-- 3 files changed, 98 insertions(+), 7 deletions(-) -- 2.11.0
Re: [PATCH 1/3] ath10k: remove ath10k_vif_to_arvif()
On Thu, 2017-02-09 at 23:14 -0800, Adrian Chadd wrote: > If there > were accessors for the skb data / len fields (like we do for mbufs) > then porting the code would've involved about 5,000 less changed > lines. What generic mechanisms would you suggest to make porting easier between bsd and linux and what in your opinion are the best naming schemes to make these functions easiest to read and implement without resorting to excessive identifier lengths? If you have some, please provide examples.
Re: [PATCH 1/3] ath10k: remove ath10k_vif_to_arvif()
On Thu, 2017-02-09 at 23:14 -0800, Adrian Chadd wrote: > If there > were accessors for the skb data / len fields (like we do for mbufs) > then porting the code would've involved about 5,000 less changed > lines. What generic mechanisms would you suggest to make porting easier between bsd and linux and what in your opinion are the best naming schemes to make these functions easiest to read and implement without resorting to excessive identifier lengths? If you have some, please provide examples.
[PATCH v2 1/4] perf diff: Add 'delta-abs' compute method
The 'delta-abs' compute method is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option. Below is default output (-c delta): $ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_x Now with 'delta-abs' it shows entries have bigger delta value either positive or negative. $ perf diff -o 1 -c delta-abs | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 12.72% -3.01% [kernel.kallsyms] [k] intel_idle 9.72% -1.31% [unknown] [.] 0x00411343 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock 0.16% +0.45% [kernel.kallsyms] [k] menu_select 0.72% -0.44% [kernel.kallsyms] [k] lookup_fast Signed-off-by: Namhyung Kim--- tools/perf/Documentation/perf-diff.txt | 6 - tools/perf/builtin-diff.c | 46 -- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 3e9490b9c533..af80284cd2f6 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -86,7 +86,7 @@ OPTIONS -c:: --compute:: -Differential computation selection - delta,ratio,wdiff (default is delta). +Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). See COMPARISON METHODS section for more info. -p:: @@ -181,6 +181,10 @@ delta relative to how entries are filtered. Use --percentage=absolute to prevent such fluctuation. +delta-abs +~ +Same as 'delta` method, but sort the result with the absolute values. + ratio ~ If specified the 'Ratio' column is displayed with value 'r' computed as: diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 933aeec46f4a..781c9e60bd21 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -30,6 +30,7 @@ enum { PERF_HPP_DIFF__RATIO, PERF_HPP_DIFF__WEIGHTED_DIFF, PERF_HPP_DIFF__FORMULA, + PERF_HPP_DIFF__DELTA_ABS, PERF_HPP_DIFF__MAX_INDEX }; @@ -73,11 +74,13 @@ enum { COMPUTE_DELTA, COMPUTE_RATIO, COMPUTE_WEIGHTED_DIFF, + COMPUTE_DELTA_ABS, COMPUTE_MAX, }; const char *compute_names[COMPUTE_MAX] = { [COMPUTE_DELTA] = "delta", + [COMPUTE_DELTA_ABS] = "delta-abs", [COMPUTE_RATIO] = "ratio", [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; @@ -86,6 +89,7 @@ static int compute; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, + [COMPUTE_DELTA_ABS] = PERF_HPP_DIFF__DELTA_ABS, [COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO, [COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF, }; @@ -111,6 +115,10 @@ static struct header_column { .name = "Delta", .width = 7, }, + [PERF_HPP_DIFF__DELTA_ABS] = { + .name = "Delta Abs", + .width = 7, + }, [PERF_HPP_DIFF__RATIO] = { .name = "Ratio", .width = 14, @@ -298,6 +306,7 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair, { switch (compute) { case COMPUTE_DELTA: + case COMPUTE_DELTA_ABS: return formula_delta(he, pair, buf, size); case COMPUTE_RATIO: return formula_ratio(he, pair, buf, size); @@ -461,6 +470,7 @@ static void hists__precompute(struct hists *hists) switch (compute) { case COMPUTE_DELTA: + case COMPUTE_DELTA_ABS: compute_delta(he, pair); break; case COMPUTE_RATIO: @@ -498,6 +508,13 @@ __hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right, return cmp_doubles(l, r); } + case COMPUTE_DELTA_ABS: + { + double l = fabs(left->diff.period_ratio_delta); +
[PATCH v2 1/4] perf diff: Add 'delta-abs' compute method
The 'delta-abs' compute method is same as 'delta' but shows entries with bigger absolute delta first instead of sorting numerically. This is only useful together with -o option. Below is default output (-c delta): $ perf diff -o 1 -c delta | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock +1.15% [kernel.kallsyms] [k] copy_user_generic_string 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk +0.64% [kernel.kallsyms] [k] kmem_cache_alloc 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock +0.45% [kernel.kallsyms] [k] alloc_set_pte 0.16% +0.45% [kernel.kallsyms] [k] menu_select +0.41% ld-2.24.so [.] do_lookup_x Now with 'delta-abs' it shows entries have bigger delta value either positive or negative. $ perf diff -o 1 -c delta-abs | grep -v ^# | head 42.22% +4.97% [kernel.kallsyms] [k] cfb_imageblit 12.72% -3.01% [kernel.kallsyms] [k] intel_idle 9.72% -1.31% [unknown] [.] 0x00411343 0.62% +1.23% [kernel.kallsyms] [k] mutex_lock 2.40% +0.95% [kernel.kallsyms] [k] bit_putcs 0.31% +0.79% [kernel.kallsyms] [k] link_path_walk 1.35% -0.71% [kernel.kallsyms] [k] smp_call_function_single 0.00% +0.57% [kernel.kallsyms] [k] __rcu_read_unlock 0.16% +0.45% [kernel.kallsyms] [k] menu_select 0.72% -0.44% [kernel.kallsyms] [k] lookup_fast Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-diff.txt | 6 - tools/perf/builtin-diff.c | 46 -- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 3e9490b9c533..af80284cd2f6 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -86,7 +86,7 @@ OPTIONS -c:: --compute:: -Differential computation selection - delta,ratio,wdiff (default is delta). +Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). See COMPARISON METHODS section for more info. -p:: @@ -181,6 +181,10 @@ delta relative to how entries are filtered. Use --percentage=absolute to prevent such fluctuation. +delta-abs +~ +Same as 'delta` method, but sort the result with the absolute values. + ratio ~ If specified the 'Ratio' column is displayed with value 'r' computed as: diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 933aeec46f4a..781c9e60bd21 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -30,6 +30,7 @@ enum { PERF_HPP_DIFF__RATIO, PERF_HPP_DIFF__WEIGHTED_DIFF, PERF_HPP_DIFF__FORMULA, + PERF_HPP_DIFF__DELTA_ABS, PERF_HPP_DIFF__MAX_INDEX }; @@ -73,11 +74,13 @@ enum { COMPUTE_DELTA, COMPUTE_RATIO, COMPUTE_WEIGHTED_DIFF, + COMPUTE_DELTA_ABS, COMPUTE_MAX, }; const char *compute_names[COMPUTE_MAX] = { [COMPUTE_DELTA] = "delta", + [COMPUTE_DELTA_ABS] = "delta-abs", [COMPUTE_RATIO] = "ratio", [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; @@ -86,6 +89,7 @@ static int compute; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, + [COMPUTE_DELTA_ABS] = PERF_HPP_DIFF__DELTA_ABS, [COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO, [COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF, }; @@ -111,6 +115,10 @@ static struct header_column { .name = "Delta", .width = 7, }, + [PERF_HPP_DIFF__DELTA_ABS] = { + .name = "Delta Abs", + .width = 7, + }, [PERF_HPP_DIFF__RATIO] = { .name = "Ratio", .width = 14, @@ -298,6 +306,7 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair, { switch (compute) { case COMPUTE_DELTA: + case COMPUTE_DELTA_ABS: return formula_delta(he, pair, buf, size); case COMPUTE_RATIO: return formula_ratio(he, pair, buf, size); @@ -461,6 +470,7 @@ static void hists__precompute(struct hists *hists) switch (compute) { case COMPUTE_DELTA: + case COMPUTE_DELTA_ABS: compute_delta(he, pair); break; case COMPUTE_RATIO: @@ -498,6 +508,13 @@ __hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right, return cmp_doubles(l, r); } + case COMPUTE_DELTA_ABS: + { + double l = fabs(left->diff.period_ratio_delta); + double r =
[PATCH v2 4/4] perf diff: Change default setting to "delta-abs"
The "delta-abs" compute method will show most changed entries on top. So users can easily see how much effect between the data. To see original-style (sorted by baseline) use -o 0 option. Signed-off-by: Namhyung Kim--- tools/perf/builtin-diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4b4004d41c6a..27300f2c665b 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -66,7 +66,7 @@ static bool force; static bool show_period; static bool show_formula; static bool show_baseline_only; -static unsigned int sort_compute; +static unsigned int sort_compute = 1; static s64 compute_wdiff_w1; static s64 compute_wdiff_w2; @@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute = COMPUTE_DELTA; +static int compute = COMPUTE_DELTA_ABS; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, -- 2.11.0
[PATCH v2 4/4] perf diff: Change default setting to "delta-abs"
The "delta-abs" compute method will show most changed entries on top. So users can easily see how much effect between the data. To see original-style (sorted by baseline) use -o 0 option. Signed-off-by: Namhyung Kim --- tools/perf/builtin-diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4b4004d41c6a..27300f2c665b 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -66,7 +66,7 @@ static bool force; static bool show_period; static bool show_formula; static bool show_baseline_only; -static unsigned int sort_compute; +static unsigned int sort_compute = 1; static s64 compute_wdiff_w1; static s64 compute_wdiff_w2; @@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute = COMPUTE_DELTA; +static int compute = COMPUTE_DELTA_ABS; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, -- 2.11.0
[PATCH v2 3/4] perf diff: Add diff.compute config option
The diff.compute config variable is to set the default compute method of perf diff command (-c option). Possible values 'delta' (default), 'delta-abs', 'ratio' and 'wdiff'. Cc: Taeung SongSigned-off-by: Namhyung Kim --- tools/perf/Documentation/perf-config.txt | 5 + tools/perf/Documentation/perf-diff.txt | 5 +++-- tools/perf/builtin-diff.c| 16 +++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 5b54d47ef713..f2d758dc1edc 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -505,6 +505,11 @@ Variables Setting it to 1 will sort the result by delta (or other compute method selected). + diff.compute:: + This options sets the method of computing diff result. + Possible values are 'delta', 'delta-abs', 'ratio' and + 'wdiff'. Default is 'delta'. + SEE ALSO linkperf:perf[1] diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 6ba3bf582d79..70f490408262 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -86,8 +86,9 @@ OPTIONS -c:: --compute:: -Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). -See COMPARISON METHODS section for more info. +Differential computation selection - delta,ratio,wdiff,delta-abs + (default is delta). Default can be changed using diff.compute + config option. See COMPARISON METHODS section for more info. -p:: --period:: diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 181ff996e039..4b4004d41c6a 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute; +static int compute = COMPUTE_DELTA; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, @@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value, sort_compute = perf_config_int(var, value); return 0; } + if (!strcmp(var, "diff.compute")) { + if (!strcmp(value, "delta")) + compute = COMPUTE_DELTA; + else if (!strcmp(value, "delta-abs")) + compute = COMPUTE_DELTA_ABS; + else if (!strcmp(value, "ratio")) + compute = COMPUTE_RATIO; + else if (!strcmp(value, "wdiff")) + compute = COMPUTE_WEIGHTED_DIFF; + else { + pr_err("Invalid compute method: %s\n", value); + return -1; + } + } return 0; } -- 2.11.0
[PATCH v2 3/4] perf diff: Add diff.compute config option
The diff.compute config variable is to set the default compute method of perf diff command (-c option). Possible values 'delta' (default), 'delta-abs', 'ratio' and 'wdiff'. Cc: Taeung Song Signed-off-by: Namhyung Kim --- tools/perf/Documentation/perf-config.txt | 5 + tools/perf/Documentation/perf-diff.txt | 5 +++-- tools/perf/builtin-diff.c| 16 +++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 5b54d47ef713..f2d758dc1edc 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt @@ -505,6 +505,11 @@ Variables Setting it to 1 will sort the result by delta (or other compute method selected). + diff.compute:: + This options sets the method of computing diff result. + Possible values are 'delta', 'delta-abs', 'ratio' and + 'wdiff'. Default is 'delta'. + SEE ALSO linkperf:perf[1] diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 6ba3bf582d79..70f490408262 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -86,8 +86,9 @@ OPTIONS -c:: --compute:: -Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). -See COMPARISON METHODS section for more info. +Differential computation selection - delta,ratio,wdiff,delta-abs + (default is delta). Default can be changed using diff.compute + config option. See COMPARISON METHODS section for more info. -p:: --period:: diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 181ff996e039..4b4004d41c6a 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = { [COMPUTE_WEIGHTED_DIFF] = "wdiff", }; -static int compute; +static int compute = COMPUTE_DELTA; static int compute_2_hpp[COMPUTE_MAX] = { [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, @@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value, sort_compute = perf_config_int(var, value); return 0; } + if (!strcmp(var, "diff.compute")) { + if (!strcmp(value, "delta")) + compute = COMPUTE_DELTA; + else if (!strcmp(value, "delta-abs")) + compute = COMPUTE_DELTA_ABS; + else if (!strcmp(value, "ratio")) + compute = COMPUTE_RATIO; + else if (!strcmp(value, "wdiff")) + compute = COMPUTE_WEIGHTED_DIFF; + else { + pr_err("Invalid compute method: %s\n", value); + return -1; + } + } return 0; } -- 2.11.0
[PATCH] ipc/mqueue: use unsigned int for retval
The retval variable is assigned by bitops only and thus there is no reason to use a signed type. Further matching it with the return type of the function also makes static code checkers happy. Signed-off-by: Nicholas Mc Guire <der.h...@hofr.at> --- Found by experimental type-checking coccinelle script Patch was compile tested with: x86_64_defconfig Patch is against 4.10-rc6 (localversion-next is next-20170209) ipc/mqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 4fdd970..897ce70 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -519,7 +519,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id) static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab) { struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); - int retval = 0; + unsigned int retval = 0; poll_wait(filp, >wait_q, poll_tab); -- 2.1.4
[PATCH] ipc/mqueue: use unsigned int for retval
The retval variable is assigned by bitops only and thus there is no reason to use a signed type. Further matching it with the return type of the function also makes static code checkers happy. Signed-off-by: Nicholas Mc Guire --- Found by experimental type-checking coccinelle script Patch was compile tested with: x86_64_defconfig Patch is against 4.10-rc6 (localversion-next is next-20170209) ipc/mqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 4fdd970..897ce70 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -519,7 +519,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id) static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab) { struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); - int retval = 0; + unsigned int retval = 0; poll_wait(filp, >wait_q, poll_tab); -- 2.1.4
Re: [PATCH ipsec] xfrm: policy: init locks early
On Wed, Feb 08, 2017 at 11:52:29AM +0100, Florian Westphal wrote: > Dmitry reports following splat: > INFO: trying to register non-static key. > the code is fine but needs lockdep annotation. > turning off the locking correctness validator. > CPU: 0 PID: 13059 Comm: syz-executor1 Not tainted 4.10.0-rc7-next-20170207 #1 > [..] > spin_lock_bh include/linux/spinlock.h:304 [inline] > xfrm_policy_flush+0x32/0x470 net/xfrm/xfrm_policy.c:963 > xfrm_policy_fini+0xbf/0x560 net/xfrm/xfrm_policy.c:3041 > xfrm_net_init+0x79f/0x9e0 net/xfrm/xfrm_policy.c:3091 > ops_init+0x10a/0x530 net/core/net_namespace.c:115 > setup_net+0x2ed/0x690 net/core/net_namespace.c:291 > copy_net_ns+0x26c/0x530 net/core/net_namespace.c:396 > create_new_namespaces+0x409/0x860 kernel/nsproxy.c:106 > unshare_nsproxy_namespaces+0xae/0x1e0 kernel/nsproxy.c:205 > SYSC_unshare kernel/fork.c:2281 [inline] > > Problem is that when we get error during xfrm_net_init we will call > xfrm_policy_fini which will acquire xfrm_policy_lock before it was > initialized. Just move it around so locks get set up first. > > Reported-by: Dmitry Vyukov> Fixes: 283bc9f35bbbcb0e9 ("xfrm: Namespacify xfrm state/policy locks") > Signed-off-by: Florian Westphal Applied, thanks everyone!
Re: [PATCH ipsec] xfrm: policy: init locks early
On Wed, Feb 08, 2017 at 11:52:29AM +0100, Florian Westphal wrote: > Dmitry reports following splat: > INFO: trying to register non-static key. > the code is fine but needs lockdep annotation. > turning off the locking correctness validator. > CPU: 0 PID: 13059 Comm: syz-executor1 Not tainted 4.10.0-rc7-next-20170207 #1 > [..] > spin_lock_bh include/linux/spinlock.h:304 [inline] > xfrm_policy_flush+0x32/0x470 net/xfrm/xfrm_policy.c:963 > xfrm_policy_fini+0xbf/0x560 net/xfrm/xfrm_policy.c:3041 > xfrm_net_init+0x79f/0x9e0 net/xfrm/xfrm_policy.c:3091 > ops_init+0x10a/0x530 net/core/net_namespace.c:115 > setup_net+0x2ed/0x690 net/core/net_namespace.c:291 > copy_net_ns+0x26c/0x530 net/core/net_namespace.c:396 > create_new_namespaces+0x409/0x860 kernel/nsproxy.c:106 > unshare_nsproxy_namespaces+0xae/0x1e0 kernel/nsproxy.c:205 > SYSC_unshare kernel/fork.c:2281 [inline] > > Problem is that when we get error during xfrm_net_init we will call > xfrm_policy_fini which will acquire xfrm_policy_lock before it was > initialized. Just move it around so locks get set up first. > > Reported-by: Dmitry Vyukov > Fixes: 283bc9f35bbbcb0e9 ("xfrm: Namespacify xfrm state/policy locks") > Signed-off-by: Florian Westphal Applied, thanks everyone!
[PATCH] proc/sysctl: prune stale dentries during unregistering
Currently unregistering sysctl table does not prune its dentries. Stale dentries could slowdown sysctl operations significantly. For example, command: # for i in {1..10} ; do unshare -n -- sysctl -a &> /dev/null ; done creates a millions of stale denties around sysctls of loopback interface: # sysctl fs.dentry-state fs.dentry-state = 25812579 2472413545 0 0 0 All of them have matching names thus lookup have to scan though whole hash chain and call d_compare (proc_sys_compare) which checks them under system-wide spinlock (sysctl_lock). # time sysctl -a > /dev/null real1m12.806s user0m0.016s sys 1m12.400s Currently only memory reclaimer could remove this garbage. But without significant memory pressure this never happens. This patch collects sysctl inodes into list on sysctl table header and prunes all their dentries once that table unregisters. Signed-off-by: Konstantin KhlebnikovSuggested-by: Al Viro --- fs/proc/inode.c|3 ++ fs/proc/internal.h |7 -- fs/proc/proc_sysctl.c | 59 +++- include/linux/sysctl.h |1 + 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 842a5ff5b85c..7ad9ed7958af 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -43,10 +43,11 @@ static void proc_evict_inode(struct inode *inode) de = PDE(inode); if (de) pde_put(de); + head = PROC_I(inode)->sysctl; if (head) { RCU_INIT_POINTER(PROC_I(inode)->sysctl, NULL); - sysctl_head_put(head); + proc_sys_evict_inode(inode, head); } } diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 2de5194ba378..ed1d762160e6 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -65,6 +65,7 @@ struct proc_inode { struct proc_dir_entry *pde; struct ctl_table_header *sysctl; struct ctl_table *sysctl_entry; + struct list_head sysctl_inodes; const struct proc_ns_operations *ns_ops; struct inode vfs_inode; }; @@ -249,10 +250,12 @@ extern void proc_thread_self_init(void); */ #ifdef CONFIG_PROC_SYSCTL extern int proc_sys_init(void); -extern void sysctl_head_put(struct ctl_table_header *); +extern void proc_sys_evict_inode(struct inode *inode, +struct ctl_table_header *head); #else static inline void proc_sys_init(void) { } -static inline void sysctl_head_put(struct ctl_table_header *head) { } +static inline void proc_sys_evict_inode(struct inode *inode, + struct ctl_table_header *head) { } #endif /* diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index d4e37acd4821..8efb1e10b025 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -190,6 +190,7 @@ static void init_header(struct ctl_table_header *head, head->set = set; head->parent = NULL; head->node = node; + INIT_LIST_HEAD(>inodes); if (node) { struct ctl_table *entry; for (entry = table; entry->procname; entry++, node++) @@ -259,6 +260,29 @@ static void unuse_table(struct ctl_table_header *p) complete(p->unregistering); } +/* called under sysctl_lock */ +static void proc_sys_prune_dcache(struct ctl_table_header *head) +{ + struct inode *inode, *prev = NULL; + struct proc_inode *ei; + + list_for_each_entry(ei, >inodes, sysctl_inodes) { + inode = igrab(>vfs_inode); + if (inode) { + spin_unlock(_lock); + iput(prev); + prev = inode; + d_prune_aliases(inode); + spin_lock(_lock); + } + } + if (prev) { + spin_unlock(_lock); + iput(prev); + spin_lock(_lock); + } +} + /* called under sysctl_lock, will reacquire if has to wait */ static void start_unregistering(struct ctl_table_header *p) { @@ -278,27 +302,17 @@ static void start_unregistering(struct ctl_table_header *p) p->unregistering = ERR_PTR(-EINVAL); } /* +* Prune dentries for unregistered sysctls: namespaced sysctls +* can have duplicate names and contaminate dcache very badly. +*/ + proc_sys_prune_dcache(p); + /* * do not remove from the list until nobody holds it; walking the * list in do_sysctl() relies on that. */ erase_header(p); } -static void sysctl_head_get(struct ctl_table_header *head) -{ - spin_lock(_lock); - head->count++; - spin_unlock(_lock); -} - -void sysctl_head_put(struct ctl_table_header *head) -{ - spin_lock(_lock); - if (!--head->count) - kfree_rcu(head, rcu); -
[PATCH] proc/sysctl: prune stale dentries during unregistering
Currently unregistering sysctl table does not prune its dentries. Stale dentries could slowdown sysctl operations significantly. For example, command: # for i in {1..10} ; do unshare -n -- sysctl -a &> /dev/null ; done creates a millions of stale denties around sysctls of loopback interface: # sysctl fs.dentry-state fs.dentry-state = 25812579 2472413545 0 0 0 All of them have matching names thus lookup have to scan though whole hash chain and call d_compare (proc_sys_compare) which checks them under system-wide spinlock (sysctl_lock). # time sysctl -a > /dev/null real1m12.806s user0m0.016s sys 1m12.400s Currently only memory reclaimer could remove this garbage. But without significant memory pressure this never happens. This patch collects sysctl inodes into list on sysctl table header and prunes all their dentries once that table unregisters. Signed-off-by: Konstantin Khlebnikov Suggested-by: Al Viro --- fs/proc/inode.c|3 ++ fs/proc/internal.h |7 -- fs/proc/proc_sysctl.c | 59 +++- include/linux/sysctl.h |1 + 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 842a5ff5b85c..7ad9ed7958af 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -43,10 +43,11 @@ static void proc_evict_inode(struct inode *inode) de = PDE(inode); if (de) pde_put(de); + head = PROC_I(inode)->sysctl; if (head) { RCU_INIT_POINTER(PROC_I(inode)->sysctl, NULL); - sysctl_head_put(head); + proc_sys_evict_inode(inode, head); } } diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 2de5194ba378..ed1d762160e6 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -65,6 +65,7 @@ struct proc_inode { struct proc_dir_entry *pde; struct ctl_table_header *sysctl; struct ctl_table *sysctl_entry; + struct list_head sysctl_inodes; const struct proc_ns_operations *ns_ops; struct inode vfs_inode; }; @@ -249,10 +250,12 @@ extern void proc_thread_self_init(void); */ #ifdef CONFIG_PROC_SYSCTL extern int proc_sys_init(void); -extern void sysctl_head_put(struct ctl_table_header *); +extern void proc_sys_evict_inode(struct inode *inode, +struct ctl_table_header *head); #else static inline void proc_sys_init(void) { } -static inline void sysctl_head_put(struct ctl_table_header *head) { } +static inline void proc_sys_evict_inode(struct inode *inode, + struct ctl_table_header *head) { } #endif /* diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index d4e37acd4821..8efb1e10b025 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -190,6 +190,7 @@ static void init_header(struct ctl_table_header *head, head->set = set; head->parent = NULL; head->node = node; + INIT_LIST_HEAD(>inodes); if (node) { struct ctl_table *entry; for (entry = table; entry->procname; entry++, node++) @@ -259,6 +260,29 @@ static void unuse_table(struct ctl_table_header *p) complete(p->unregistering); } +/* called under sysctl_lock */ +static void proc_sys_prune_dcache(struct ctl_table_header *head) +{ + struct inode *inode, *prev = NULL; + struct proc_inode *ei; + + list_for_each_entry(ei, >inodes, sysctl_inodes) { + inode = igrab(>vfs_inode); + if (inode) { + spin_unlock(_lock); + iput(prev); + prev = inode; + d_prune_aliases(inode); + spin_lock(_lock); + } + } + if (prev) { + spin_unlock(_lock); + iput(prev); + spin_lock(_lock); + } +} + /* called under sysctl_lock, will reacquire if has to wait */ static void start_unregistering(struct ctl_table_header *p) { @@ -278,27 +302,17 @@ static void start_unregistering(struct ctl_table_header *p) p->unregistering = ERR_PTR(-EINVAL); } /* +* Prune dentries for unregistered sysctls: namespaced sysctls +* can have duplicate names and contaminate dcache very badly. +*/ + proc_sys_prune_dcache(p); + /* * do not remove from the list until nobody holds it; walking the * list in do_sysctl() relies on that. */ erase_header(p); } -static void sysctl_head_get(struct ctl_table_header *head) -{ - spin_lock(_lock); - head->count++; - spin_unlock(_lock); -} - -void sysctl_head_put(struct ctl_table_header *head) -{ - spin_lock(_lock); - if (!--head->count) - kfree_rcu(head, rcu); - spin_unlock(_lock); -} - static struct ctl_table_header
[PATCH] Staging: iio: meter: meter.h - style fix
Changed file permissions to octal. Found with checkpatch. Signed-off-by: Derek Robson--- drivers/staging/iio/meter/meter.h | 60 +++ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/iio/meter/meter.h b/drivers/staging/iio/meter/meter.h index dfba510f29be..0e37f23853f1 100644 --- a/drivers/staging/iio/meter/meter.h +++ b/drivers/staging/iio/meter/meter.h @@ -81,94 +81,94 @@ IIO_DEVICE_ATTR(reactive_power_c_gain, _mode, _show, _store, _addr) #define IIO_DEV_ATTR_CURRENT_A(_show, _addr) \ - IIO_DEVICE_ATTR(current_a, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_a, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CURRENT_B(_show, _addr) \ - IIO_DEVICE_ATTR(current_b, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_b, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CURRENT_C(_show, _addr) \ - IIO_DEVICE_ATTR(current_c, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_c, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_A(_show, _addr) \ - IIO_DEVICE_ATTR(volt_a, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_a, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_B(_show, _addr) \ - IIO_DEVICE_ATTR(volt_b, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_b, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_C(_show, _addr) \ - IIO_DEVICE_ATTR(volt_c, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_c, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(aenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(aenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_RAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(raenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(raenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(laenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(laenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(vaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(vaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LVAENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lvaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lvaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_RVAENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(rvaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(rvaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LVARENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lvarenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lvarenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CHKSUM(_show, _addr) \ - IIO_DEVICE_ATTR(chksum, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(chksum, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE0(_show, _addr) \ - IIO_DEVICE_ATTR(angle0, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle0, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE1(_show, _addr) \ - IIO_DEVICE_ATTR(angle1, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle1, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE2(_show, _addr) \ - IIO_DEVICE_ATTR(angle2, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle2, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(awatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(awatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_BWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(bwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(bwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(cwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(cwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AFWATTHR(_show, _addr)\ - IIO_DEVICE_ATTR(afwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(afwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_BFWATTHR(_show, _addr)\ - IIO_DEVICE_ATTR(bfwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(bfwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CFWATTHR(_show, _addr)\ -
[PATCH] Staging: iio: meter: meter.h - style fix
Changed file permissions to octal. Found with checkpatch. Signed-off-by: Derek Robson --- drivers/staging/iio/meter/meter.h | 60 +++ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/iio/meter/meter.h b/drivers/staging/iio/meter/meter.h index dfba510f29be..0e37f23853f1 100644 --- a/drivers/staging/iio/meter/meter.h +++ b/drivers/staging/iio/meter/meter.h @@ -81,94 +81,94 @@ IIO_DEVICE_ATTR(reactive_power_c_gain, _mode, _show, _store, _addr) #define IIO_DEV_ATTR_CURRENT_A(_show, _addr) \ - IIO_DEVICE_ATTR(current_a, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_a, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CURRENT_B(_show, _addr) \ - IIO_DEVICE_ATTR(current_b, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_b, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CURRENT_C(_show, _addr) \ - IIO_DEVICE_ATTR(current_c, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(current_c, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_A(_show, _addr) \ - IIO_DEVICE_ATTR(volt_a, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_a, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_B(_show, _addr) \ - IIO_DEVICE_ATTR(volt_b, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_b, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VOLT_C(_show, _addr) \ - IIO_DEVICE_ATTR(volt_c, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(volt_c, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(aenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(aenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_RAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(raenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(raenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(laenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(laenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_VAENERGY(_show, _addr)\ - IIO_DEVICE_ATTR(vaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(vaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LVAENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lvaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lvaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_RVAENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(rvaenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(rvaenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_LVARENERGY(_show, _addr) \ - IIO_DEVICE_ATTR(lvarenergy, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(lvarenergy, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CHKSUM(_show, _addr) \ - IIO_DEVICE_ATTR(chksum, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(chksum, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE0(_show, _addr) \ - IIO_DEVICE_ATTR(angle0, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle0, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE1(_show, _addr) \ - IIO_DEVICE_ATTR(angle1, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle1, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_ANGLE2(_show, _addr) \ - IIO_DEVICE_ATTR(angle2, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(angle2, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(awatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(awatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_BWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(bwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(bwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CWATTHR(_show, _addr) \ - IIO_DEVICE_ATTR(cwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(cwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_AFWATTHR(_show, _addr)\ - IIO_DEVICE_ATTR(afwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(afwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_BFWATTHR(_show, _addr)\ - IIO_DEVICE_ATTR(bfwatthr, S_IRUGO, _show, NULL, _addr) + IIO_DEVICE_ATTR(bfwatthr, 0444, _show, NULL, _addr) #define IIO_DEV_ATTR_CFWATTHR(_show, _addr)\ - IIO_DEVICE_ATTR(cfwatthr,
linux-next: manual merge of the akpm tree with the net tree
Hi Andrew, Today's linux-next merge of the akpm tree got a conflict in: drivers/net/usb/sierra_net.c between commit: 5a70348e1187 ("sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications") from the net tree and patch: "lib/vsprintf.c: remove %Z support" from the akpm 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 drivers/net/usb/sierra_net.c index d9440bc022f2,88ace5024306.. --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@@ -376,11 -349,11 +376,11 @@@ static inline int sierra_net_is_valid_a static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen) { struct lsi_umts *lsi = (struct lsi_umts *)data; + u32 expected_length; - if (datalen < sizeof(struct lsi_umts)) { - netdev_err(dev->net, "%s: Data length %d, exp %zu\n", - __func__, datalen, - sizeof(struct lsi_umts)); + if (datalen < sizeof(struct lsi_umts_single)) { - netdev_err(dev->net, "%s: Data length %d, exp >= %Zu\n", ++ netdev_err(dev->net, "%s: Data length %d, exp >= %zu\n", + __func__, datalen, sizeof(struct lsi_umts_single)); return -1; }
linux-next: manual merge of the akpm tree with the net tree
Hi Andrew, Today's linux-next merge of the akpm tree got a conflict in: drivers/net/usb/sierra_net.c between commit: 5a70348e1187 ("sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications") from the net tree and patch: "lib/vsprintf.c: remove %Z support" from the akpm 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 drivers/net/usb/sierra_net.c index d9440bc022f2,88ace5024306.. --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c @@@ -376,11 -349,11 +376,11 @@@ static inline int sierra_net_is_valid_a static int sierra_net_parse_lsi(struct usbnet *dev, char *data, int datalen) { struct lsi_umts *lsi = (struct lsi_umts *)data; + u32 expected_length; - if (datalen < sizeof(struct lsi_umts)) { - netdev_err(dev->net, "%s: Data length %d, exp %zu\n", - __func__, datalen, - sizeof(struct lsi_umts)); + if (datalen < sizeof(struct lsi_umts_single)) { - netdev_err(dev->net, "%s: Data length %d, exp >= %Zu\n", ++ netdev_err(dev->net, "%s: Data length %d, exp >= %zu\n", + __func__, datalen, sizeof(struct lsi_umts_single)); return -1; }
Re: [PATCHSET 0/3] perf diff: Introduce delta-abs compute method
Hi Arnaldo, On Tue, Feb 07, 2017 at 01:02:14PM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Feb 06, 2017 at 11:26:16PM +0900, Namhyung Kim escreveu: > > Hi Arnaldo, > > > > On Mon, Feb 06, 2017 at 09:51:49AM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Mon, Feb 06, 2017 at 04:20:34PM +0900, Namhyung Kim escreveu: > > > I agree on having the default changed to 'delta-abs', Ingo? > > > Good. Also, as I said in the changelog, it needs to change default > > value of -o option to 1 in order to make the 'delta-abs' effective. > > ok > > > > Namhyung, and perhaps we should have a single letter option to do that > > > '| grep -v ^#' bit :-) and perhaps we also should have, for all tools > > > the equivalent of that "| head", that git log has: > > > > > > [acme@jouet linux]$ git log --oneline -5 > > > d7cb3a507d23 Merge tag 'perf-core-for-mingo-4.11-20170201' of > > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core > > > 5443624bedd0 perf/x86/intel/pt: Add format strings for PTWRITE and power > > > event tracing > > > b05d1093987a perf ftrace: Add ftrace.tracer config option > > > 43d41deb71fe perf tools: Create for_each_event macro for tracepoints > > > iteration > > > a26305363d4b perf test: Add libbpf pinning test > > > [acme@jouet linux]$ > > > > > > That '-5' to show just the first 5 lines worth of output. > > > > > > With all that we would have: > > > > > > perf diff -o 1 -q10 > > > > > > As the equivalent to "perf diff -o 1 -c delta-abs | grep -v ^# | head". > > > > The -q/--quiet looks ok since it corresponds to -v/--verbose option. > > Ok, agreed on this one. > > > But I'm not sure about the number option. > > > In case of git, it'll stop processing commits after the given number > > of them, so it will reduce significant processing time IMHO. However, > > in perf, we need to process whole data anyway and sort at the final > > stage, and then stop displaying entries after the given number. > > > Maybe it's just a shortcut of piping to the head command. Then I > > I wasn't thinking about the processing savings from stopping to process > at that many lines, my suggestion was just about making the command line > more compact, to type less. > > If that can also map to processing savings, the better. Ok, I'll take a look at it later. I just want to finish this work first. Thanks, Namhyung
Re: [PATCHSET 0/3] perf diff: Introduce delta-abs compute method
Hi Arnaldo, On Tue, Feb 07, 2017 at 01:02:14PM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Feb 06, 2017 at 11:26:16PM +0900, Namhyung Kim escreveu: > > Hi Arnaldo, > > > > On Mon, Feb 06, 2017 at 09:51:49AM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Mon, Feb 06, 2017 at 04:20:34PM +0900, Namhyung Kim escreveu: > > > I agree on having the default changed to 'delta-abs', Ingo? > > > Good. Also, as I said in the changelog, it needs to change default > > value of -o option to 1 in order to make the 'delta-abs' effective. > > ok > > > > Namhyung, and perhaps we should have a single letter option to do that > > > '| grep -v ^#' bit :-) and perhaps we also should have, for all tools > > > the equivalent of that "| head", that git log has: > > > > > > [acme@jouet linux]$ git log --oneline -5 > > > d7cb3a507d23 Merge tag 'perf-core-for-mingo-4.11-20170201' of > > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core > > > 5443624bedd0 perf/x86/intel/pt: Add format strings for PTWRITE and power > > > event tracing > > > b05d1093987a perf ftrace: Add ftrace.tracer config option > > > 43d41deb71fe perf tools: Create for_each_event macro for tracepoints > > > iteration > > > a26305363d4b perf test: Add libbpf pinning test > > > [acme@jouet linux]$ > > > > > > That '-5' to show just the first 5 lines worth of output. > > > > > > With all that we would have: > > > > > > perf diff -o 1 -q10 > > > > > > As the equivalent to "perf diff -o 1 -c delta-abs | grep -v ^# | head". > > > > The -q/--quiet looks ok since it corresponds to -v/--verbose option. > > Ok, agreed on this one. > > > But I'm not sure about the number option. > > > In case of git, it'll stop processing commits after the given number > > of them, so it will reduce significant processing time IMHO. However, > > in perf, we need to process whole data anyway and sort at the final > > stage, and then stop displaying entries after the given number. > > > Maybe it's just a shortcut of piping to the head command. Then I > > I wasn't thinking about the processing savings from stopping to process > at that many lines, my suggestion was just about making the command line > more compact, to type less. > > If that can also map to processing savings, the better. Ok, I'll take a look at it later. I just want to finish this work first. Thanks, Namhyung
Re: [PATCH V2 2/7] mm: move MADV_FREE pages into LRU_INACTIVE_FILE list
Hi Shaohua, On Fri, Feb 03, 2017 at 03:33:18PM -0800, Shaohua Li wrote: > Userspace indicates MADV_FREE pages could be freed without pageout, so > it pretty much likes used once file pages. For such pages, we'd like to > reclaim them once there is memory pressure. Also it might be unfair > reclaiming MADV_FREE pages always before used once file pages and we > definitively want to reclaim the pages before other anonymous and file > pages. > > To speed up MADV_FREE pages reclaim, we put the pages into > LRU_INACTIVE_FILE list. The rationale is LRU_INACTIVE_FILE list is tiny > nowadays and should be full of used once file pages. Reclaiming > MADV_FREE pages will not have much interfere of anonymous and active > file pages. And the inactive file pages and MADV_FREE pages will be > reclaimed according to their age, so we don't reclaim too many MADV_FREE > pages too. Putting the MADV_FREE pages into LRU_INACTIVE_FILE_LIST also > means we can reclaim the pages without swap support. This idea is > suggested by Johannes. > > We also clear the pages SwapBacked flag to indicate they are MADV_FREE > pages. I think this patch should be merged with 3/7. Otherwise, MADV_FREE will be broken during the bisect. > > Cc: Michal Hocko> Cc: Minchan Kim > Cc: Hugh Dickins > Cc: Johannes Weiner > Cc: Rik van Riel > Cc: Mel Gorman > Cc: Andrew Morton > Signed-off-by: Shaohua Li > --- > include/linux/mm_inline.h | 5 + > include/linux/swap.h | 2 +- > include/linux/vm_event_item.h | 2 +- > mm/huge_memory.c | 5 ++--- > mm/madvise.c | 3 +-- > mm/swap.c | 50 > --- > mm/vmstat.c | 1 + > 7 files changed, 39 insertions(+), 29 deletions(-) > > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > index e030a68..fdded06 100644 > --- a/include/linux/mm_inline.h > +++ b/include/linux/mm_inline.h > @@ -22,6 +22,11 @@ static inline int page_is_file_cache(struct page *page) > return !PageSwapBacked(page); > } > > +static inline bool page_is_lazyfree(struct page *page) > +{ > + return PageAnon(page) && !PageSwapBacked(page); > +} > + trivial: How about using PageLazyFree for consistency with other PageXXX? As well, use SetPageLazyFree/ClearPageLazyFree rather than using raw {Set,Clear}PageSwapBacked. > static __always_inline void __update_lru_size(struct lruvec *lruvec, > enum lru_list lru, enum zone_type zid, > int nr_pages) > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 45e91dd..486494e 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -279,7 +279,7 @@ extern void lru_add_drain_cpu(int cpu); > extern void lru_add_drain_all(void); > extern void rotate_reclaimable_page(struct page *page); > extern void deactivate_file_page(struct page *page); > -extern void deactivate_page(struct page *page); > +extern void mark_page_lazyfree(struct page *page); trivial: How about "deactivate_lazyfree_page"? IMO, it would show intention clear that move the lazy free page to inactive list. It's just matter of preference so I'm not strong against. > extern void swap_setup(void); > > extern void add_page_to_unevictable_list(struct page *page); > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > index 6aa1b6c..94e58da 100644 > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -25,7 +25,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, > FOR_ALL_ZONES(PGALLOC), > FOR_ALL_ZONES(ALLOCSTALL), > FOR_ALL_ZONES(PGSCAN_SKIP), > - PGFREE, PGACTIVATE, PGDEACTIVATE, > + PGFREE, PGACTIVATE, PGDEACTIVATE, PGLAZYFREE, > PGFAULT, PGMAJFAULT, > PGLAZYFREED, > PGREFILL, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index ecf569d..ddb9a94 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1391,9 +1391,6 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, > struct vm_area_struct *vma, > ClearPageDirty(page); > unlock_page(page); > > - if (PageActive(page)) > - deactivate_page(page); > - > if (pmd_young(orig_pmd) || pmd_dirty(orig_pmd)) { > orig_pmd = pmdp_huge_get_and_clear_full(tlb->mm, addr, pmd, > tlb->fullmm); > @@ -1404,6 +1401,8 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, > struct vm_area_struct *vma, > set_pmd_at(mm, addr, pmd, orig_pmd); > tlb_remove_pmd_tlb_entry(tlb, pmd, addr); > } > + > + mark_page_lazyfree(page); > ret = true; > out: > spin_unlock(ptl); > diff --git a/mm/madvise.c
Re: [PATCH V2 2/7] mm: move MADV_FREE pages into LRU_INACTIVE_FILE list
Hi Shaohua, On Fri, Feb 03, 2017 at 03:33:18PM -0800, Shaohua Li wrote: > Userspace indicates MADV_FREE pages could be freed without pageout, so > it pretty much likes used once file pages. For such pages, we'd like to > reclaim them once there is memory pressure. Also it might be unfair > reclaiming MADV_FREE pages always before used once file pages and we > definitively want to reclaim the pages before other anonymous and file > pages. > > To speed up MADV_FREE pages reclaim, we put the pages into > LRU_INACTIVE_FILE list. The rationale is LRU_INACTIVE_FILE list is tiny > nowadays and should be full of used once file pages. Reclaiming > MADV_FREE pages will not have much interfere of anonymous and active > file pages. And the inactive file pages and MADV_FREE pages will be > reclaimed according to their age, so we don't reclaim too many MADV_FREE > pages too. Putting the MADV_FREE pages into LRU_INACTIVE_FILE_LIST also > means we can reclaim the pages without swap support. This idea is > suggested by Johannes. > > We also clear the pages SwapBacked flag to indicate they are MADV_FREE > pages. I think this patch should be merged with 3/7. Otherwise, MADV_FREE will be broken during the bisect. > > Cc: Michal Hocko > Cc: Minchan Kim > Cc: Hugh Dickins > Cc: Johannes Weiner > Cc: Rik van Riel > Cc: Mel Gorman > Cc: Andrew Morton > Signed-off-by: Shaohua Li > --- > include/linux/mm_inline.h | 5 + > include/linux/swap.h | 2 +- > include/linux/vm_event_item.h | 2 +- > mm/huge_memory.c | 5 ++--- > mm/madvise.c | 3 +-- > mm/swap.c | 50 > --- > mm/vmstat.c | 1 + > 7 files changed, 39 insertions(+), 29 deletions(-) > > diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > index e030a68..fdded06 100644 > --- a/include/linux/mm_inline.h > +++ b/include/linux/mm_inline.h > @@ -22,6 +22,11 @@ static inline int page_is_file_cache(struct page *page) > return !PageSwapBacked(page); > } > > +static inline bool page_is_lazyfree(struct page *page) > +{ > + return PageAnon(page) && !PageSwapBacked(page); > +} > + trivial: How about using PageLazyFree for consistency with other PageXXX? As well, use SetPageLazyFree/ClearPageLazyFree rather than using raw {Set,Clear}PageSwapBacked. > static __always_inline void __update_lru_size(struct lruvec *lruvec, > enum lru_list lru, enum zone_type zid, > int nr_pages) > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 45e91dd..486494e 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -279,7 +279,7 @@ extern void lru_add_drain_cpu(int cpu); > extern void lru_add_drain_all(void); > extern void rotate_reclaimable_page(struct page *page); > extern void deactivate_file_page(struct page *page); > -extern void deactivate_page(struct page *page); > +extern void mark_page_lazyfree(struct page *page); trivial: How about "deactivate_lazyfree_page"? IMO, it would show intention clear that move the lazy free page to inactive list. It's just matter of preference so I'm not strong against. > extern void swap_setup(void); > > extern void add_page_to_unevictable_list(struct page *page); > diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h > index 6aa1b6c..94e58da 100644 > --- a/include/linux/vm_event_item.h > +++ b/include/linux/vm_event_item.h > @@ -25,7 +25,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, > FOR_ALL_ZONES(PGALLOC), > FOR_ALL_ZONES(ALLOCSTALL), > FOR_ALL_ZONES(PGSCAN_SKIP), > - PGFREE, PGACTIVATE, PGDEACTIVATE, > + PGFREE, PGACTIVATE, PGDEACTIVATE, PGLAZYFREE, > PGFAULT, PGMAJFAULT, > PGLAZYFREED, > PGREFILL, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index ecf569d..ddb9a94 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1391,9 +1391,6 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, > struct vm_area_struct *vma, > ClearPageDirty(page); > unlock_page(page); > > - if (PageActive(page)) > - deactivate_page(page); > - > if (pmd_young(orig_pmd) || pmd_dirty(orig_pmd)) { > orig_pmd = pmdp_huge_get_and_clear_full(tlb->mm, addr, pmd, > tlb->fullmm); > @@ -1404,6 +1401,8 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, > struct vm_area_struct *vma, > set_pmd_at(mm, addr, pmd, orig_pmd); > tlb_remove_pmd_tlb_entry(tlb, pmd, addr); > } > + > + mark_page_lazyfree(page); > ret = true; > out: > spin_unlock(ptl); > diff --git a/mm/madvise.c b/mm/madvise.c > index c867d88..c24549e 100644 > --- a/mm/madvise.c > +++ b/mm/madvise.c > @@ -378,10 +378,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned >
Re: [PATCH] media: fix s5p_mfc_set_dec_frame_buffer_v6() to print buf size in hex
On 09.02.2017 23:10, Shuah Khan wrote: > Fix s5p_mfc_set_dec_frame_buffer_v6() to print buffer size in hex to be > consistent with the rest of the messages in the routine. > > Signed-off-by: Shuah KhanAs Nicolas said please fix the subject. After this you can add my: Acked-by: Andrzej Hajda -- Regards Andrzej > --- > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > index d6f207e..fc45980 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > @@ -497,7 +497,7 @@ static int s5p_mfc_set_dec_frame_buffer_v6(struct > s5p_mfc_ctx *ctx) > } > } > > - mfc_debug(2, "Buf1: %zu, buf_size1: %d (frames %d)\n", > + mfc_debug(2, "Buf1: %zx, buf_size1: %d (frames %d)\n", > buf_addr1, buf_size1, ctx->total_dpb_count); > if (buf_size1 < 0) { > mfc_debug(2, "Not enough memory has been allocated.\n");
Re: [PATCH] media: fix s5p_mfc_set_dec_frame_buffer_v6() to print buf size in hex
On 09.02.2017 23:10, Shuah Khan wrote: > Fix s5p_mfc_set_dec_frame_buffer_v6() to print buffer size in hex to be > consistent with the rest of the messages in the routine. > > Signed-off-by: Shuah Khan As Nicolas said please fix the subject. After this you can add my: Acked-by: Andrzej Hajda -- Regards Andrzej > --- > drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > index d6f207e..fc45980 100644 > --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c > @@ -497,7 +497,7 @@ static int s5p_mfc_set_dec_frame_buffer_v6(struct > s5p_mfc_ctx *ctx) > } > } > > - mfc_debug(2, "Buf1: %zu, buf_size1: %d (frames %d)\n", > + mfc_debug(2, "Buf1: %zx, buf_size1: %d (frames %d)\n", > buf_addr1, buf_size1, ctx->total_dpb_count); > if (buf_size1 < 0) { > mfc_debug(2, "Not enough memory has been allocated.\n");