From: Greg Kroah-Hartman Date: Mon, 2 May 2016 23:31:24 +0000 (-0700) Subject: 4.5-stable patches X-Git-Tag: v3.14.68~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fddf87a8c8c54d44f46723ca8880f3b71dc8c401;p=thirdparty%2Fkernel%2Fstable-queue.git 4.5-stable patches added patches: bus-uniphier-system-bus-fix-condition-of-overlap-check.patch mtd-brcmnand-fix-v7.1-register-offsets.patch mtd-nand-drop-mtd.owner-requirement-in-nand_scan.patch mtd-spi-nor-remove-micron_quad_enable.patch ntb-perf-test-fix-address-space-confusion.patch ntb-remove-_addr-functions-from-ntb_hw_amd.patch perf-core-don-t-leak-event-in-the-syscall-error-path.patch perf-core-fix-time-tracking-bug-with-multiplexing.patch perf-hists-browser-fix-dump-to-show-correct-callchain-style.patch perf-hists-browser-only-offer-symbol-scripting-when-a-symbol-is-under-the-cursor.patch perf-hists-fix-determination-of-a-callchain-node-s-childlessness.patch perf-stat-document-detailed-option.patch perf-tools-handle-spaces-in-file-names-obtained-from-proc-pid-maps.patch --- diff --git a/queue-4.5/bus-uniphier-system-bus-fix-condition-of-overlap-check.patch b/queue-4.5/bus-uniphier-system-bus-fix-condition-of-overlap-check.patch new file mode 100644 index 00000000000..69eb7317359 --- /dev/null +++ b/queue-4.5/bus-uniphier-system-bus-fix-condition-of-overlap-check.patch @@ -0,0 +1,33 @@ +From 3de7beebddf8d56dcaa17b41c723d602dd0c513c Mon Sep 17 00:00:00 2001 +From: Kunihiko Hayashi +Date: Fri, 1 Apr 2016 19:32:43 +0900 +Subject: bus: uniphier-system-bus: fix condition of overlap check + +From: Kunihiko Hayashi + +commit 3de7beebddf8d56dcaa17b41c723d602dd0c513c upstream. + +This patch fixes condition whether the specified address ranges +overlap each other. + +Fixes: 4b7f48d395a7 ("bus: uniphier-system-bus: add UniPhier System Bus driver") +Signed-off-by: Kunihiko Hayashi +Acked-by: Masahiro Yamada +Signed-off-by: Olof Johansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/bus/uniphier-system-bus.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/bus/uniphier-system-bus.c ++++ b/drivers/bus/uniphier-system-bus.c +@@ -108,7 +108,7 @@ static int uniphier_system_bus_check_ove + + for (i = 0; i < ARRAY_SIZE(priv->bank); i++) { + for (j = i + 1; j < ARRAY_SIZE(priv->bank); j++) { +- if (priv->bank[i].end > priv->bank[j].base || ++ if (priv->bank[i].end > priv->bank[j].base && + priv->bank[i].base < priv->bank[j].end) { + dev_err(priv->dev, + "region overlap between bank%d and bank%d\n", diff --git a/queue-4.5/mtd-brcmnand-fix-v7.1-register-offsets.patch b/queue-4.5/mtd-brcmnand-fix-v7.1-register-offsets.patch new file mode 100644 index 00000000000..a73d7e9e569 --- /dev/null +++ b/queue-4.5/mtd-brcmnand-fix-v7.1-register-offsets.patch @@ -0,0 +1,73 @@ +From d267aefc54a28efc5bda7f009598dc83b5f98734 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +Date: Wed, 24 Feb 2016 16:07:23 -0800 +Subject: mtd: brcmnand: Fix v7.1 register offsets + +From: Florian Fainelli + +commit d267aefc54a28efc5bda7f009598dc83b5f98734 upstream. + +The BRCMNAND controller revision 7.1 is almost 100% compatible with the +previous v6.0 register offset layout, except for the Correctable Error +Reporting Threshold registers. Fix this by adding another table with the +correct offsets for CORR_THRESHOLD and CORR_THRESHOLD_EXT. + +Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") +Signed-off-by: Florian Fainelli +Signed-off-by: Brian Norris +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/nand/brcmnand/brcmnand.c | 34 +++++++++++++++++++++++++++++++++- + 1 file changed, 33 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/brcmnand/brcmnand.c +@@ -311,6 +311,36 @@ static const u16 brcmnand_regs_v60[] = { + [BRCMNAND_FC_BASE] = 0x400, + }; + ++/* BRCMNAND v7.1 */ ++static const u16 brcmnand_regs_v71[] = { ++ [BRCMNAND_CMD_START] = 0x04, ++ [BRCMNAND_CMD_EXT_ADDRESS] = 0x08, ++ [BRCMNAND_CMD_ADDRESS] = 0x0c, ++ [BRCMNAND_INTFC_STATUS] = 0x14, ++ [BRCMNAND_CS_SELECT] = 0x18, ++ [BRCMNAND_CS_XOR] = 0x1c, ++ [BRCMNAND_LL_OP] = 0x20, ++ [BRCMNAND_CS0_BASE] = 0x50, ++ [BRCMNAND_CS1_BASE] = 0, ++ [BRCMNAND_CORR_THRESHOLD] = 0xdc, ++ [BRCMNAND_CORR_THRESHOLD_EXT] = 0xe0, ++ [BRCMNAND_UNCORR_COUNT] = 0xfc, ++ [BRCMNAND_CORR_COUNT] = 0x100, ++ [BRCMNAND_CORR_EXT_ADDR] = 0x10c, ++ [BRCMNAND_CORR_ADDR] = 0x110, ++ [BRCMNAND_UNCORR_EXT_ADDR] = 0x114, ++ [BRCMNAND_UNCORR_ADDR] = 0x118, ++ [BRCMNAND_SEMAPHORE] = 0x150, ++ [BRCMNAND_ID] = 0x194, ++ [BRCMNAND_ID_EXT] = 0x198, ++ [BRCMNAND_LL_RDATA] = 0x19c, ++ [BRCMNAND_OOB_READ_BASE] = 0x200, ++ [BRCMNAND_OOB_READ_10_BASE] = 0, ++ [BRCMNAND_OOB_WRITE_BASE] = 0x280, ++ [BRCMNAND_OOB_WRITE_10_BASE] = 0, ++ [BRCMNAND_FC_BASE] = 0x400, ++}; ++ + enum brcmnand_cs_reg { + BRCMNAND_CS_CFG_EXT = 0, + BRCMNAND_CS_CFG, +@@ -406,7 +436,9 @@ static int brcmnand_revision_init(struct + } + + /* Register offsets */ +- if (ctrl->nand_version >= 0x0600) ++ if (ctrl->nand_version >= 0x0701) ++ ctrl->reg_offsets = brcmnand_regs_v71; ++ else if (ctrl->nand_version >= 0x0600) + ctrl->reg_offsets = brcmnand_regs_v60; + else if (ctrl->nand_version >= 0x0500) + ctrl->reg_offsets = brcmnand_regs_v50; diff --git a/queue-4.5/mtd-nand-drop-mtd.owner-requirement-in-nand_scan.patch b/queue-4.5/mtd-nand-drop-mtd.owner-requirement-in-nand_scan.patch new file mode 100644 index 00000000000..3a84407b52e --- /dev/null +++ b/queue-4.5/mtd-nand-drop-mtd.owner-requirement-in-nand_scan.patch @@ -0,0 +1,61 @@ +From 20c07a5bf094198ff2382aa5e7c930b3c9807792 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ezequiel=20Garc=C3=ADa?= +Date: Fri, 1 Apr 2016 18:29:23 -0300 +Subject: mtd: nand: Drop mtd.owner requirement in nand_scan + +From: Ezequiel García + +commit 20c07a5bf094198ff2382aa5e7c930b3c9807792 upstream. + +Since commit 807f16d4db95 ("mtd: core: set some defaults +when dev.parent is set"), it's now legal for drivers +to call nand_scan and nand_scan_ident without setting +mtd.owner. + +Drop the check and while at it remove the BUG() abuse. + +Fixes: 807f16d4db95 ("mtd: core: set some defaults when dev.parent is set") +Signed-off-by: Ezequiel Garcia +Acked-by: Boris Brezillon +[Brian: editorial note - while commit 807f16d4db95 wasn't explicitly + broken, some follow-up commits in the v4.4 release broke a few + drivers, since they would hit this BUG() if they used nand_scan() + and were built as modules] +Signed-off-by: Brian Norris +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/nand/nand_base.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -4021,7 +4021,6 @@ static int nand_dt_init(struct nand_chip + * This is the first phase of the normal nand_scan() function. It reads the + * flash ID and sets up MTD fields accordingly. + * +- * The mtd->owner field must be set to the module of the caller. + */ + int nand_scan_ident(struct mtd_info *mtd, int maxchips, + struct nand_flash_dev *table) +@@ -4443,19 +4442,12 @@ EXPORT_SYMBOL(nand_scan_tail); + * + * This fills out all the uninitialized function pointers with the defaults. + * The flash ID is read and the mtd/chip structures are filled with the +- * appropriate values. The mtd->owner field must be set to the module of the +- * caller. ++ * appropriate values. + */ + int nand_scan(struct mtd_info *mtd, int maxchips) + { + int ret; + +- /* Many callers got this wrong, so check for it for a while... */ +- if (!mtd->owner && caller_is_module()) { +- pr_crit("%s called with NULL mtd->owner!\n", __func__); +- BUG(); +- } +- + ret = nand_scan_ident(mtd, maxchips, NULL); + if (!ret) + ret = nand_scan_tail(mtd); diff --git a/queue-4.5/mtd-spi-nor-remove-micron_quad_enable.patch b/queue-4.5/mtd-spi-nor-remove-micron_quad_enable.patch new file mode 100644 index 00000000000..e8ee117b361 --- /dev/null +++ b/queue-4.5/mtd-spi-nor-remove-micron_quad_enable.patch @@ -0,0 +1,112 @@ +From 3b5394a3ccffbfa1d1d448d48742853a862822c4 Mon Sep 17 00:00:00 2001 +From: Cyrille Pitchen +Date: Wed, 3 Feb 2016 14:26:46 +0100 +Subject: mtd: spi-nor: remove micron_quad_enable() + +From: Cyrille Pitchen + +commit 3b5394a3ccffbfa1d1d448d48742853a862822c4 upstream. + +This patch remove the micron_quad_enable() function which force the Quad +SPI mode. However, once this mode is enabled, the Micron memory expect ALL +commands to use the SPI 4-4-4 protocol. Hence a failure does occur when +calling spi_nor_wait_till_ready() right after the update of the Enhanced +Volatile Configuration Register (EVCR) in the micron_quad_enable() as +the SPI controller driver is not aware about the protocol change. + +Since there is almost no performance increase using Fast Read 4-4-4 +commands instead of Fast Read 1-1-4 commands, we rather keep on using the +Extended SPI mode than enabling the Quad SPI mode. + +Let's take the example of the pretty standard use of 8 dummy cycles during +Fast Read operations on 64KB erase sectors: + +Fast Read 1-1-4 requires 8 cycles for the command, then 24 cycles for the +3byte address followed by 8 dummy clock cycles and finally 65536*2 cycles +for the read data; so 131112 clock cycles. + +On the other hand the Fast Read 4-4-4 would require 2 cycles for the +command, then 6 cycles for the 3byte address followed by 8 dummy clock +cycles and finally 65536*2 cycles for the read data. So 131088 clock +cycles. The theorical bandwidth increase is 0.0%. + +Now using Fast Read operations on 512byte pages: +Fast Read 1-1-4 needs 8+24+8+(512*2) = 1064 clock cycles whereas Fast +Read 4-4-4 would requires 2+6+8+(512*2) = 1040 clock cycles. Hence the +theorical bandwidth increase is 2.3%. +Consecutive reads for non sequential pages is not a relevant use case so +The Quad SPI mode is not worth it. + +mtd_speedtest seems to confirm these figures. + +Signed-off-by: Cyrille Pitchen +Fixes: 548cd3ab54da ("mtd: spi-nor: Add quad I/O support for Micron SPI NOR") +Signed-off-by: Brian Norris +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/spi-nor/spi-nor.c | 46 ------------------------------------------ + 1 file changed, 1 insertion(+), 45 deletions(-) + +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -1100,45 +1100,6 @@ static int spansion_quad_enable(struct s + return 0; + } + +-static int micron_quad_enable(struct spi_nor *nor) +-{ +- int ret; +- u8 val; +- +- ret = nor->read_reg(nor, SPINOR_OP_RD_EVCR, &val, 1); +- if (ret < 0) { +- dev_err(nor->dev, "error %d reading EVCR\n", ret); +- return ret; +- } +- +- write_enable(nor); +- +- /* set EVCR, enable quad I/O */ +- nor->cmd_buf[0] = val & ~EVCR_QUAD_EN_MICRON; +- ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1); +- if (ret < 0) { +- dev_err(nor->dev, "error while writing EVCR register\n"); +- return ret; +- } +- +- ret = spi_nor_wait_till_ready(nor); +- if (ret) +- return ret; +- +- /* read EVCR and check it */ +- ret = nor->read_reg(nor, SPINOR_OP_RD_EVCR, &val, 1); +- if (ret < 0) { +- dev_err(nor->dev, "error %d reading EVCR\n", ret); +- return ret; +- } +- if (val & EVCR_QUAD_EN_MICRON) { +- dev_err(nor->dev, "Micron EVCR Quad bit not clear\n"); +- return -EINVAL; +- } +- +- return 0; +-} +- + static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info) + { + int status; +@@ -1152,12 +1113,7 @@ static int set_quad_mode(struct spi_nor + } + return status; + case SNOR_MFR_MICRON: +- status = micron_quad_enable(nor); +- if (status) { +- dev_err(nor->dev, "Micron quad-read not enabled\n"); +- return -EINVAL; +- } +- return status; ++ return 0; + default: + status = spansion_quad_enable(nor); + if (status) { diff --git a/queue-4.5/ntb-perf-test-fix-address-space-confusion.patch b/queue-4.5/ntb-perf-test-fix-address-space-confusion.patch new file mode 100644 index 00000000000..908b4ba83ae --- /dev/null +++ b/queue-4.5/ntb-perf-test-fix-address-space-confusion.patch @@ -0,0 +1,110 @@ +From 1985a88107b5330b2a911ad4d279e1bd7e4deb24 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 26 Jan 2016 10:31:45 +0100 +Subject: ntb: perf test: fix address space confusion + +From: Arnd Bergmann + +commit 1985a88107b5330b2a911ad4d279e1bd7e4deb24 upstream. + +The ntb driver assigns between pointers an __iomem tokens, and +also casts them to 64-bit integers, which results in compiler +warnings on 32-bit systems: + +drivers/ntb/test/ntb_perf.c: In function 'perf_copy': +drivers/ntb/test/ntb_perf.c:213:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] + vbase = (u64)(u64 *)mw->vbase; + ^ +drivers/ntb/test/ntb_perf.c:214:14: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] + dst_vaddr = (u64)(u64 *)dst; + ^ + +This adds __iomem annotations where needed and changes the temporary +variables to iomem pointers to avoid casting them to u64. I did not +see the problem in linux-next earlier, but it show showed up in +4.5-rc1. + +Signed-off-by: Arnd Bergmann +Acked-by: Dave Jiang +Fixes: 8a7b6a778a85 ("ntb: ntb perf tool") +Signed-off-by: Jon Mason +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ntb/test/ntb_perf.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +--- a/drivers/ntb/test/ntb_perf.c ++++ b/drivers/ntb/test/ntb_perf.c +@@ -178,7 +178,7 @@ static void perf_copy_callback(void *dat + atomic_dec(&pctx->dma_sync); + } + +-static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst, ++static ssize_t perf_copy(struct pthr_ctx *pctx, char __iomem *dst, + char *src, size_t size) + { + struct perf_ctx *perf = pctx->perf; +@@ -189,7 +189,8 @@ static ssize_t perf_copy(struct pthr_ctx + dma_cookie_t cookie; + size_t src_off, dst_off; + struct perf_mw *mw = &perf->mw; +- u64 vbase, dst_vaddr; ++ void __iomem *vbase; ++ void __iomem *dst_vaddr; + dma_addr_t dst_phys; + int retries = 0; + +@@ -204,14 +205,14 @@ static ssize_t perf_copy(struct pthr_ctx + } + + device = chan->device; +- src_off = (size_t)src & ~PAGE_MASK; +- dst_off = (size_t)dst & ~PAGE_MASK; ++ src_off = (uintptr_t)src & ~PAGE_MASK; ++ dst_off = (uintptr_t __force)dst & ~PAGE_MASK; + + if (!is_dma_copy_aligned(device, src_off, dst_off, size)) + return -ENODEV; + +- vbase = (u64)(u64 *)mw->vbase; +- dst_vaddr = (u64)(u64 *)dst; ++ vbase = mw->vbase; ++ dst_vaddr = dst; + dst_phys = mw->phys_addr + (dst_vaddr - vbase); + + unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT); +@@ -261,13 +262,13 @@ err_get_unmap: + return 0; + } + +-static int perf_move_data(struct pthr_ctx *pctx, char *dst, char *src, ++static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src, + u64 buf_size, u64 win_size, u64 total) + { + int chunks, total_chunks, i; + int copied_chunks = 0; + u64 copied = 0, result; +- char *tmp = dst; ++ char __iomem *tmp = dst; + u64 perf, diff_us; + ktime_t kstart, kstop, kdiff; + +@@ -324,7 +325,7 @@ static int ntb_perf_thread(void *data) + struct perf_ctx *perf = pctx->perf; + struct pci_dev *pdev = perf->ntb->pdev; + struct perf_mw *mw = &perf->mw; +- char *dst; ++ char __iomem *dst; + u64 win_size, buf_size, total; + void *src; + int rc, node, i; +@@ -364,7 +365,7 @@ static int ntb_perf_thread(void *data) + if (buf_size > MAX_TEST_SIZE) + buf_size = MAX_TEST_SIZE; + +- dst = (char *)mw->vbase; ++ dst = (char __iomem *)mw->vbase; + + atomic_inc(&perf->tsync); + while (atomic_read(&perf->tsync) != perf->perf_threads) diff --git a/queue-4.5/ntb-remove-_addr-functions-from-ntb_hw_amd.patch b/queue-4.5/ntb-remove-_addr-functions-from-ntb_hw_amd.patch new file mode 100644 index 00000000000..851a3966283 --- /dev/null +++ b/queue-4.5/ntb-remove-_addr-functions-from-ntb_hw_amd.patch @@ -0,0 +1,82 @@ +From 4f1b50c3e3082b31c94cee2b897bd9f5d0f3e7c8 Mon Sep 17 00:00:00 2001 +From: Allen Hubbe +Date: Mon, 21 Mar 2016 04:53:14 -0400 +Subject: NTB: Remove _addr functions from ntb_hw_amd + +From: Allen Hubbe + +commit 4f1b50c3e3082b31c94cee2b897bd9f5d0f3e7c8 upstream. + +Kernel zero day testing warned about address space confusion. A virtual +iomem address was used where a physical address is expected. The +offending functions implement an optional part of the api, so they are +removed. They can be added later, after testing. + +Fixes: a1b3695820aa490e58915d720a1438069813008b + +Signed-off-by: Allen Hubbe +Acked-by: Xiangliang Yu +Signed-off-by: Jon Mason +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/ntb/hw/amd/ntb_hw_amd.c | 30 ------------------------------ + 1 file changed, 30 deletions(-) + +--- a/drivers/ntb/hw/amd/ntb_hw_amd.c ++++ b/drivers/ntb/hw/amd/ntb_hw_amd.c +@@ -357,20 +357,6 @@ static int amd_ntb_db_clear_mask(struct + return 0; + } + +-static int amd_ntb_peer_db_addr(struct ntb_dev *ntb, +- phys_addr_t *db_addr, +- resource_size_t *db_size) +-{ +- struct amd_ntb_dev *ndev = ntb_ndev(ntb); +- +- if (db_addr) +- *db_addr = (phys_addr_t)(ndev->peer_mmio + AMD_DBREQ_OFFSET); +- if (db_size) +- *db_size = sizeof(u32); +- +- return 0; +-} +- + static int amd_ntb_peer_db_set(struct ntb_dev *ntb, u64 db_bits) + { + struct amd_ntb_dev *ndev = ntb_ndev(ntb); +@@ -415,20 +401,6 @@ static int amd_ntb_spad_write(struct ntb + return 0; + } + +-static int amd_ntb_peer_spad_addr(struct ntb_dev *ntb, int idx, +- phys_addr_t *spad_addr) +-{ +- struct amd_ntb_dev *ndev = ntb_ndev(ntb); +- +- if (idx < 0 || idx >= ndev->spad_count) +- return -EINVAL; +- +- if (spad_addr) +- *spad_addr = (phys_addr_t)(ndev->self_mmio + AMD_SPAD_OFFSET + +- ndev->peer_spad + (idx << 2)); +- return 0; +-} +- + static u32 amd_ntb_peer_spad_read(struct ntb_dev *ntb, int idx) + { + struct amd_ntb_dev *ndev = ntb_ndev(ntb); +@@ -472,12 +444,10 @@ static const struct ntb_dev_ops amd_ntb_ + .db_clear = amd_ntb_db_clear, + .db_set_mask = amd_ntb_db_set_mask, + .db_clear_mask = amd_ntb_db_clear_mask, +- .peer_db_addr = amd_ntb_peer_db_addr, + .peer_db_set = amd_ntb_peer_db_set, + .spad_count = amd_ntb_spad_count, + .spad_read = amd_ntb_spad_read, + .spad_write = amd_ntb_spad_write, +- .peer_spad_addr = amd_ntb_peer_spad_addr, + .peer_spad_read = amd_ntb_peer_spad_read, + .peer_spad_write = amd_ntb_peer_spad_write, + }; diff --git a/queue-4.5/perf-core-don-t-leak-event-in-the-syscall-error-path.patch b/queue-4.5/perf-core-don-t-leak-event-in-the-syscall-error-path.patch new file mode 100644 index 00000000000..65e0b4815e3 --- /dev/null +++ b/queue-4.5/perf-core-don-t-leak-event-in-the-syscall-error-path.patch @@ -0,0 +1,43 @@ +From 201c2f85bd0bc13b712d9c0b3d11251b182e06ae Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 21 Mar 2016 10:02:42 +0200 +Subject: perf/core: Don't leak event in the syscall error path + +From: Alexander Shishkin + +commit 201c2f85bd0bc13b712d9c0b3d11251b182e06ae upstream. + +In the error path, event_file not being NULL is used to determine +whether the event itself still needs to be free'd, so fix it up to +avoid leaking. + +Reported-by: Leon Yu +Signed-off-by: Alexander Shishkin +Signed-off-by: Peter Zijlstra (Intel) +Cc: Arnaldo Carvalho de Melo +Cc: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Stephane Eranian +Cc: Thomas Gleixner +Cc: Vince Weaver +Fixes: 130056275ade ("perf: Do not double free") +Link: http://lkml.kernel.org/r/87twk06yxp.fsf@ashishki-desk.ger.corp.intel.com +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/events/core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -8479,6 +8479,7 @@ SYSCALL_DEFINE5(perf_event_open, + f_flags); + if (IS_ERR(event_file)) { + err = PTR_ERR(event_file); ++ event_file = NULL; + goto err_context; + } + diff --git a/queue-4.5/perf-core-fix-time-tracking-bug-with-multiplexing.patch b/queue-4.5/perf-core-fix-time-tracking-bug-with-multiplexing.patch new file mode 100644 index 00000000000..aace3c16d8d --- /dev/null +++ b/queue-4.5/perf-core-fix-time-tracking-bug-with-multiplexing.patch @@ -0,0 +1,108 @@ +From 8fdc65391c6ad16461526a685f03262b3b01bfde Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Tue, 29 Mar 2016 09:26:44 +0200 +Subject: perf/core: Fix time tracking bug with multiplexing + +From: Peter Zijlstra + +commit 8fdc65391c6ad16461526a685f03262b3b01bfde upstream. + +Stephane reported that commit: + + 3cbaa5906967 ("perf: Fix ctx time tracking by introducing EVENT_TIME") + +introduced a regression wrt. time tracking, as easily observed by: + +> This patch introduce a bug in the time tracking of events when +> multiplexing is used. +> +> The issue is easily reproducible with the following perf run: +> +> $ perf stat -a -C 0 -e branches,branches,branches,branches,branches,branches -I 1000 +> 1.000730239 652,394 branches (66.41%) +> 1.000730239 597,809 branches (66.41%) +> 1.000730239 593,870 branches (66.63%) +> 1.000730239 651,440 branches (67.03%) +> 1.000730239 656,725 branches (66.96%) +> 1.000730239 branches +> +> One branches event is shown as not having run. Yet, with +> multiplexing, all events should run especially with a 1s (-I 1000) +> interval. The delta for time_running comes out to 0. Yet, the event +> has run because the kernel is actually multiplexing the events. The +> problem is that the time tracking is the kernel and especially in +> ctx_sched_out() is wrong now. +> +> The problem is that in case that the kernel enters ctx_sched_out() with the +> following state: +> ctx->is_active=0x7 event_type=0x1 +> Call Trace: +> [] dump_stack+0x63/0x82 +> [] ctx_sched_out+0x2bc/0x2d0 +> [] perf_mux_hrtimer_handler+0xf6/0x2c0 +> [] ? __perf_install_in_context+0x130/0x130 +> [] __hrtimer_run_queues+0xf8/0x2f0 +> [] hrtimer_interrupt+0xb7/0x1d0 +> [] local_apic_timer_interrupt+0x38/0x60 +> [] smp_apic_timer_interrupt+0x3d/0x50 +> [] apic_timer_interrupt+0x8c/0xa0 +> +> In that case, the test: +> if (is_active & EVENT_TIME) +> +> will be false and the time will not be updated. Time must always be updated on +> sched out. + +Fix this by always updating time if EVENT_TIME was set, as opposed to +only updating time when EVENT_TIME changed. + +Reported-by: Stephane Eranian +Tested-by: Stephane Eranian +Signed-off-by: Peter Zijlstra (Intel) +Cc: Alexander Shishkin +Cc: Arnaldo Carvalho de Melo +Cc: Jiri Olsa +Cc: Linus Torvalds +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: Vince Weaver +Cc: kan.liang@intel.com +Cc: namhyung@kernel.org +Fixes: 3cbaa5906967 ("perf: Fix ctx time tracking by introducing EVENT_TIME") +Link: http://lkml.kernel.org/r/20160329072644.GB3408@twins.programming.kicks-ass.net +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/events/core.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -2402,14 +2402,24 @@ static void ctx_sched_out(struct perf_ev + cpuctx->task_ctx = NULL; + } + +- is_active ^= ctx->is_active; /* changed bits */ +- ++ /* ++ * Always update time if it was set; not only when it changes. ++ * Otherwise we can 'forget' to update time for any but the last ++ * context we sched out. For example: ++ * ++ * ctx_sched_out(.event_type = EVENT_FLEXIBLE) ++ * ctx_sched_out(.event_type = EVENT_PINNED) ++ * ++ * would only update time for the pinned events. ++ */ + if (is_active & EVENT_TIME) { + /* update (and stop) ctx time */ + update_context_time(ctx); + update_cgrp_time_from_cpuctx(cpuctx); + } + ++ is_active ^= ctx->is_active; /* changed bits */ ++ + if (!ctx->nr_active || !(is_active & EVENT_ALL)) + return; + diff --git a/queue-4.5/perf-hists-browser-fix-dump-to-show-correct-callchain-style.patch b/queue-4.5/perf-hists-browser-fix-dump-to-show-correct-callchain-style.patch new file mode 100644 index 00000000000..f28ca0dd578 --- /dev/null +++ b/queue-4.5/perf-hists-browser-fix-dump-to-show-correct-callchain-style.patch @@ -0,0 +1,153 @@ +From 0c841c6c16f320704f75970bbe6a9800c53e6cf5 Mon Sep 17 00:00:00 2001 +From: Namhyung Kim +Date: Thu, 28 Jan 2016 00:40:54 +0900 +Subject: perf hists browser: Fix dump to show correct callchain style + +From: Namhyung Kim + +commit 0c841c6c16f320704f75970bbe6a9800c53e6cf5 upstream. + +The commit 8c430a348699 ("perf hists browser: Support folded +callchains") missed to update hist_browser__dump() so it always shows +graph-style callchains regardless of current setting. + +To fix that, factor out callchain printing code and rename the existing +function which prints graph-style callchain. + +Signed-off-by: Namhyung Kim +Cc: Andi Kleen +Cc: David Ahern +Cc: Frederic Weisbecker +Cc: Jiri Olsa +Cc: Peter Zijlstra +Cc: Wang Nan +Fixes: 8c430a348699 ("perf hists browser: Support folded callchains") +Link: http://lkml.kernel.org/r/1453909257-26015-8-git-send-email-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/ui/browsers/hists.c | 73 +++++++++++++++++++++++------------------ + 1 file changed, 41 insertions(+), 32 deletions(-) + +--- a/tools/perf/ui/browsers/hists.c ++++ b/tools/perf/ui/browsers/hists.c +@@ -844,7 +844,7 @@ next: + return row - first_row; + } + +-static int hist_browser__show_callchain(struct hist_browser *browser, ++static int hist_browser__show_callchain_graph(struct hist_browser *browser, + struct rb_root *root, int level, + unsigned short row, u64 total, + print_callchain_entry_fn print, +@@ -898,7 +898,7 @@ static int hist_browser__show_callchain( + else + new_total = total; + +- row += hist_browser__show_callchain(browser, &child->rb_root, ++ row += hist_browser__show_callchain_graph(browser, &child->rb_root, + new_level, row, new_total, + print, arg, is_output_full); + } +@@ -910,6 +910,43 @@ out: + return row - first_row; + } + ++static int hist_browser__show_callchain(struct hist_browser *browser, ++ struct hist_entry *entry, int level, ++ unsigned short row, ++ print_callchain_entry_fn print, ++ struct callchain_print_arg *arg, ++ check_output_full_fn is_output_full) ++{ ++ u64 total = hists__total_period(entry->hists); ++ int printed; ++ ++ if (callchain_param.mode == CHAIN_GRAPH_REL) { ++ if (symbol_conf.cumulate_callchain) ++ total = entry->stat_acc->period; ++ else ++ total = entry->stat.period; ++ } ++ ++ if (callchain_param.mode == CHAIN_FLAT) { ++ printed = hist_browser__show_callchain_flat(browser, ++ &entry->sorted_chain, row, total, ++ print, arg, is_output_full); ++ } else if (callchain_param.mode == CHAIN_FOLDED) { ++ printed = hist_browser__show_callchain_folded(browser, ++ &entry->sorted_chain, row, total, ++ print, arg, is_output_full); ++ } else { ++ printed = hist_browser__show_callchain_graph(browser, ++ &entry->sorted_chain, level, row, total, ++ print, arg, is_output_full); ++ } ++ ++ if (arg->is_current_entry) ++ browser->he_selection = entry; ++ ++ return printed; ++} ++ + struct hpp_arg { + struct ui_browser *b; + char folded_sign; +@@ -1084,38 +1121,14 @@ static int hist_browser__show_entry(stru + --row_offset; + + if (folded_sign == '-' && row != browser->b.rows) { +- u64 total = hists__total_period(entry->hists); + struct callchain_print_arg arg = { + .row_offset = row_offset, + .is_current_entry = current_entry, + }; + +- if (callchain_param.mode == CHAIN_GRAPH_REL) { +- if (symbol_conf.cumulate_callchain) +- total = entry->stat_acc->period; +- else +- total = entry->stat.period; +- } +- +- if (callchain_param.mode == CHAIN_FLAT) { +- printed += hist_browser__show_callchain_flat(browser, +- &entry->sorted_chain, row, total, +- hist_browser__show_callchain_entry, &arg, +- hist_browser__check_output_full); +- } else if (callchain_param.mode == CHAIN_FOLDED) { +- printed += hist_browser__show_callchain_folded(browser, +- &entry->sorted_chain, row, total, +- hist_browser__show_callchain_entry, &arg, +- hist_browser__check_output_full); +- } else { +- printed += hist_browser__show_callchain(browser, +- &entry->sorted_chain, 1, row, total, ++ printed += hist_browser__show_callchain(browser, entry, 1, row, + hist_browser__show_callchain_entry, &arg, + hist_browser__check_output_full); +- } +- +- if (arg.is_current_entry) +- browser->he_selection = entry; + } + + return printed; +@@ -1380,15 +1393,11 @@ do_offset: + static int hist_browser__fprintf_callchain(struct hist_browser *browser, + struct hist_entry *he, FILE *fp) + { +- u64 total = hists__total_period(he->hists); + struct callchain_print_arg arg = { + .fp = fp, + }; + +- if (symbol_conf.cumulate_callchain) +- total = he->stat_acc->period; +- +- hist_browser__show_callchain(browser, &he->sorted_chain, 1, 0, total, ++ hist_browser__show_callchain(browser, he, 1, 0, + hist_browser__fprintf_callchain_entry, &arg, + hist_browser__check_dump_full); + return arg.printed; diff --git a/queue-4.5/perf-hists-browser-only-offer-symbol-scripting-when-a-symbol-is-under-the-cursor.patch b/queue-4.5/perf-hists-browser-only-offer-symbol-scripting-when-a-symbol-is-under-the-cursor.patch new file mode 100644 index 00000000000..9a6e64a2379 --- /dev/null +++ b/queue-4.5/perf-hists-browser-only-offer-symbol-scripting-when-a-symbol-is-under-the-cursor.patch @@ -0,0 +1,50 @@ +From c221acb0f970d3b80d72c812cda19c121acf5d52 Mon Sep 17 00:00:00 2001 +From: Namhyung Kim +Date: Thu, 21 Jan 2016 19:50:09 -0300 +Subject: perf hists browser: Only offer symbol scripting when a symbol is under the cursor + +From: Namhyung Kim + +commit c221acb0f970d3b80d72c812cda19c121acf5d52 upstream. + +When this feature was introduced a check was made if there was a +resolved symbol under the cursor, it got lost in commit ea7cd5923309 +("perf hists browser: Split popup menu actions - part 2"), reinstate it. + +Signed-off-by: Namhyung Kim +Tested-by: Arnaldo Carvalho de Melo +Cc: Andi Kleen +Cc: David Ahern +Cc: Jiri Olsa , +Cc: Peter Zijlstra +Cc: Stephane Eranian +Cc: Wang Nan +Fixes: ea7cd5923309 ("perf hists browser: Split popup menu actions - part 2") +Link: http://lkml.kernel.org/r/1452960197-5323-9-git-send-email-namhyung@kernel.org +[ Carved out from a larger patch ] +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/ui/browsers/hists.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/tools/perf/ui/browsers/hists.c ++++ b/tools/perf/ui/browsers/hists.c +@@ -2320,10 +2320,12 @@ skip_annotation: + * + * See hist_browser__show_entry. + */ +- nr_options += add_script_opt(browser, +- &actions[nr_options], +- &options[nr_options], +- NULL, browser->selection->sym); ++ if (sort__has_sym && browser->selection->sym) { ++ nr_options += add_script_opt(browser, ++ &actions[nr_options], ++ &options[nr_options], ++ NULL, browser->selection->sym); ++ } + } + nr_options += add_script_opt(browser, &actions[nr_options], + &options[nr_options], NULL, NULL); diff --git a/queue-4.5/perf-hists-fix-determination-of-a-callchain-node-s-childlessness.patch b/queue-4.5/perf-hists-fix-determination-of-a-callchain-node-s-childlessness.patch new file mode 100644 index 00000000000..4561bd2b857 --- /dev/null +++ b/queue-4.5/perf-hists-fix-determination-of-a-callchain-node-s-childlessness.patch @@ -0,0 +1,43 @@ +From 909890355507e92bdaf648e73870f6b5df606da8 Mon Sep 17 00:00:00 2001 +From: Andres Freund +Date: Wed, 30 Mar 2016 21:02:45 +0200 +Subject: perf hists: Fix determination of a callchain node's childlessness + +From: Andres Freund + +commit 909890355507e92bdaf648e73870f6b5df606da8 upstream. + +The 4b3a3212233a ("perf hists browser: Support flat callchains") commit +over-aggressively tried to optimize callchain_node__init_have_children(). + +That lead to --tui mode not allowing to expand call chain elements if a +call chain element had only one parent. That's why --inverted callgraphs +looked halfway sane, but plain ones didn't. + +Revert that individual optimization, it wasn't really related to the +rest of the commit. + +Signed-off-by: Andres Freund +Acked-by: Namhyung Kim +Tested-by: Arnaldo Carvalho de Melo +Cc: Peter Zijlstra +Fixes: 4b3a3212233a ("perf hists browser: Support flat callchains") +Link: http://lkml.kernel.org/r/20160330190245.GB13305@awork2.anarazel.de +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/ui/browsers/hists.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/ui/browsers/hists.c ++++ b/tools/perf/ui/browsers/hists.c +@@ -302,7 +302,7 @@ static void callchain_node__init_have_ch + chain = list_entry(node->val.next, struct callchain_list, list); + chain->has_children = has_sibling; + +- if (node->val.next != node->val.prev) { ++ if (!list_empty(&node->val)) { + chain = list_entry(node->val.prev, struct callchain_list, list); + chain->has_children = !RB_EMPTY_ROOT(&node->rb_root); + } diff --git a/queue-4.5/perf-stat-document-detailed-option.patch b/queue-4.5/perf-stat-document-detailed-option.patch new file mode 100644 index 00000000000..73dc06d1ae0 --- /dev/null +++ b/queue-4.5/perf-stat-document-detailed-option.patch @@ -0,0 +1,57 @@ +From f594bae08183fb6b57db55387794ece3e1edf6f6 Mon Sep 17 00:00:00 2001 +From: Borislav Petkov +Date: Mon, 7 Mar 2016 16:44:44 -0300 +Subject: perf stat: Document --detailed option + +From: Borislav Petkov + +commit f594bae08183fb6b57db55387794ece3e1edf6f6 upstream. + +I'm surprised this remained undocumented since at least 2011. And it is +actually a very useful switch, as Steve and I came to realize recently. + +Add the text from + + 2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events") + +which added the incrementing aspect to -d. + +Tested-by: Arnaldo Carvalho de Melo +Signed-off-by: Borislav Petkov +Signed-off-by: Arnaldo Carvalho de Melo +Cc: Alexander Shishkin +Cc: David Ahern +Cc: Davidlohr Bueso +Cc: Jiri Olsa +Cc: Mel Gorman +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Peter Zijlstra +Cc: Steven Rostedt +Cc: Thomas Gleixner +Fixes: 2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events") +Link: http://lkml.kernel.org/r/1457347294-32546-1-git-send-email-bp@alien8.de +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/Documentation/perf-stat.txt | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/tools/perf/Documentation/perf-stat.txt ++++ b/tools/perf/Documentation/perf-stat.txt +@@ -69,6 +69,14 @@ report:: + --scale:: + scale/normalize counter values + ++-d:: ++--detailed:: ++ print more detailed statistics, can be specified up to 3 times ++ ++ -d: detailed events, L1 and LLC data cache ++ -d -d: more detailed events, dTLB and iTLB events ++ -d -d -d: very detailed events, adding prefetch events ++ + -r:: + --repeat=:: + repeat command and print average + stddev (max: 100). 0 means forever. diff --git a/queue-4.5/perf-tools-handle-spaces-in-file-names-obtained-from-proc-pid-maps.patch b/queue-4.5/perf-tools-handle-spaces-in-file-names-obtained-from-proc-pid-maps.patch new file mode 100644 index 00000000000..7f61975b66d --- /dev/null +++ b/queue-4.5/perf-tools-handle-spaces-in-file-names-obtained-from-proc-pid-maps.patch @@ -0,0 +1,38 @@ +From 89fee59b504f86925894fcc9ba79d5c933842f93 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= +Date: Tue, 19 Jan 2016 20:03:03 +0100 +Subject: perf tools: handle spaces in file names obtained from /proc/pid/maps +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marcin Ślusarz + +commit 89fee59b504f86925894fcc9ba79d5c933842f93 upstream. + +Steam frequently puts game binaries in folders with spaces. + +Note: "(deleted)" markers are now treated as part of the file name. + +Signed-off-by: Marcin Ślusarz +Acked-by: Namhyung Kim +Fixes: 6064803313ba ("perf tools: Use sscanf for parsing /proc/pid/maps") +Link: http://lkml.kernel.org/r/20160119190303.GA17579@marcin-Inspiron-7720 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/event.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/util/event.c ++++ b/tools/perf/util/event.c +@@ -282,7 +282,7 @@ int perf_event__synthesize_mmap_events(s + strcpy(execname, ""); + + /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ +- n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %s\n", ++ n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %[^\n]\n", + &event->mmap2.start, &event->mmap2.len, prot, + &event->mmap2.pgoff, &event->mmap2.maj, + &event->mmap2.min, diff --git a/queue-4.5/series b/queue-4.5/series index 7e3066583dc..b9ebc120b2b 100644 --- a/queue-4.5/series +++ b/queue-4.5/series @@ -167,3 +167,16 @@ f2fs-do-f2fs_balance_fs-when-block-is-allocated.patch f2fs-don-t-need-to-call-set_page_dirty-for-io-error.patch f2fs-crypto-handle-unexpected-lack-of-encryption-keys.patch f2fs-crypto-make-sure-the-encryption-info-is-initialized-on-opendir-2.patch +bus-uniphier-system-bus-fix-condition-of-overlap-check.patch +mtd-spi-nor-remove-micron_quad_enable.patch +mtd-brcmnand-fix-v7.1-register-offsets.patch +mtd-nand-drop-mtd.owner-requirement-in-nand_scan.patch +perf-hists-browser-only-offer-symbol-scripting-when-a-symbol-is-under-the-cursor.patch +perf-hists-browser-fix-dump-to-show-correct-callchain-style.patch +perf-tools-handle-spaces-in-file-names-obtained-from-proc-pid-maps.patch +perf-stat-document-detailed-option.patch +ntb-perf-test-fix-address-space-confusion.patch +ntb-remove-_addr-functions-from-ntb_hw_amd.patch +perf-core-don-t-leak-event-in-the-syscall-error-path.patch +perf-core-fix-time-tracking-bug-with-multiplexing.patch +perf-hists-fix-determination-of-a-callchain-node-s-childlessness.patch