[PATCH v2 1/3] Documentation: bindings: add assign clock property in u2phy node
On some platform such as RK3328, the 480m clock may need to assign clock parent in dts in stead of clock driver. So this patch add property of assigned-clocks and assigned-clock-parents to assign parent for 480m clock. Changes in v2: - move u2phy grf specification to grf.txt Signed-off-by: Meng Dongyang --- Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt index 3c29c77..e71a8d2 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt @@ -2,6 +2,7 @@ ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK Required properties (phy (parent) node): - compatible : should be one of the listed compatibles: + * "rockchip,rk3328-usb2phy" * "rockchip,rk3366-usb2phy" * "rockchip,rk3399-usb2phy" - reg : the address offset of grf for usb-phy configuration. @@ -11,6 +12,11 @@ Required properties (phy (parent) node): Optional properties: - clocks : phandle + phy specifier pair, for the input clock of phy. - clock-names : input clock name of phy, must be "phyclk". + - assigned-clocks : phandle of usb 480m clock. + - assigned-clock-parents : parent of usb 480m clock, select between +usb-phy output 480m and xin24m. +Refer to clk/clock-bindings.txt for generic clock +consumer properties. Required nodes : a sub-node is required for each port the phy provides. The sub-node name is used to identify host or otg port, -- 1.9.1
[PATCH] ARM: dump: Add domain to output
This adds the memory domain (on non-LPAE) to the PMD and PTE dumps. This isn't in the regular PMD bits because I couldn't find a clean way to fall back to retain some of the PMD bits when reporting PTE. So this is special-cased currently. New output example: ---[ Modules ]--- 0x7f00-0x7f001000 4K DOMAIN_KERNEL ro x SHD MEM/CACHED/WBWA 0x7f001000-0x7f002000 4K DOMAIN_KERNEL ro NX SHD MEM/CACHED/WBWA 0x7f002000-0x7f004000 8K DOMAIN_KERNEL RW NX SHD MEM/CACHED/WBWA ---[ Kernel Mapping ]--- 0x8000-0x8010 1M DOMAIN_KERNEL RW NX SHD 0x8010-0x8080 7M DOMAIN_KERNEL ro x SHD 0x8080-0x80b0 3M DOMAIN_KERNEL ro NX SHD 0x80b0-0xa000 501M DOMAIN_KERNEL RW NX SHD ... ---[ Vectors ]--- 0x-0x1000 4K DOMAIN_VECTORS USR ro x SHD MEM/CACHED/WBWA 0x1000-0x2000 4K DOMAIN_VECTORS ro x SHD MEM/CACHED/WBWA Signed-off-by: Kees Cook --- arch/arm/mm/dump.c | 38 -- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index 21192d6eda40..63faa33a83b1 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -43,6 +44,7 @@ struct pg_state { unsigned long start_address; unsigned level; u64 current_prot; + const char *domain; }; struct prot_bits { @@ -240,6 +242,8 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, u unit++; } seq_printf(st->seq, "%9lu%c", delta, *unit); + if (st->domain) + seq_printf(st->seq, " %s", st->domain); if (pg_level[st->level].bits) dump_prot(st, pg_level[st->level].bits, pg_level[st->level].num); seq_printf(st->seq, "\n"); @@ -267,6 +271,29 @@ static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start) } } +static void set_domain_name(struct pg_state *st, pmd_t *pmd) +{ +#ifndef CONFIG_ARM_LPAE + switch (pmd_val(*pmd) & PMD_DOMAIN_MASK) { + case PMD_DOMAIN(DOMAIN_KERNEL): + st->domain = "DOMAIN_KERNEL "; + break; + case PMD_DOMAIN(DOMAIN_USER): + st->domain = "DOMAIN_USER "; + break; + case PMD_DOMAIN(DOMAIN_IO): + st->domain = "DOMAIN_IO "; + break; + case PMD_DOMAIN(DOMAIN_VECTORS): + st->domain = "DOMAIN_VECTORS"; + break; + default: + st->domain = "DOMAIN_unknown"; + break; + } +#endif +} + static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) { pmd_t *pmd = pmd_offset(pud, 0); @@ -275,14 +302,21 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) for (i = 0; i < PTRS_PER_PMD; i++, pmd++) { addr = start + i * PMD_SIZE; + set_domain_name(st, pmd); if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd)) note_page(st, addr, 3, pmd_val(*pmd)); else walk_pte(st, pmd, addr); - if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1])) - note_page(st, addr + SECTION_SIZE, 3, pmd_val(pmd[1])); + if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1])) { + addr += SECTION_SIZE; + pmd++; + set_domain_name(st, pmd); + note_page(st, addr, 3, pmd_val(*pmd)); + } } + + st->domain = NULL; } static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start) -- 2.7.4 -- Kees Cook Pixel Security
Re: [PATCHv2] perf tools: Force uncore events to system wide monitoring
On Wed, Mar 01, 2017 at 06:36:39PM -0300, Arnaldo Carvalho de Melo wrote: SNIP > [acme@jouet linux]$ perf stat usleep 1 > >Performance counter stats for 'usleep 1': > > 2.022049 task-clock:u (msec) #0.181 CPUs utilized > > 0 context-switches:u#0.000 K/sec > > 0 cpu-migrations:u #0.000 K/sec > > 48 page-faults:u #0.024 M/sec > > 2,177,301 cycles:u #1.077 GHz > >245,106 instructions:u#0.11 insn per cycle > > 48,000 branches:u# 23.738 M/sec > > 3,936 branch-misses:u #8.20% of all branches > > >0.011181563 seconds time elapsed > > [acme@jouet linux]$ > > - > > Seems related to the auto :u done when the user can't do kernel profiling, > etc. > > Re-applying your patch, to triple check: > > [acme@jouet linux]$ perf stat usleep 1 2>&1 | head -2 > Error: > You may not have permission to collect system-wide stats. > [acme@jouet linux]$ > > > > Waiting for v3 :-) oh my... I'll check thanks, jirka
[PATCH v2 2/3] Documentation: bindings: add DT documentation for u2phy and u2phy grf
Due to the u2phy registers are separated from general grf, we need to add u2phy grf node and place u2phy node in it. So this patch add u2phy grf node. Changes in v2: - add u2phy grf specification Signed-off-by: Meng Dongyang --- Documentation/devicetree/bindings/soc/rockchip/grf.txt | 15 +++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.txt b/Documentation/devicetree/bindings/soc/rockchip/grf.txt index 013e71a..6ac23f9 100644 --- a/Documentation/devicetree/bindings/soc/rockchip/grf.txt +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.txt @@ -7,6 +7,9 @@ From RK3368 SoCs, the GRF is divided into two sections, - GRF, used for general non-secure system, - PMUGRF, used for always on system +On RK3328 SoCs, the GRF is divided into three sections, +except GRF and PMUGRF, add a section for USB2PHYGRF, + Required Properties: - compatible: GRF should be one of the followings @@ -19,6 +22,8 @@ Required Properties: - compatible: PMUGRF should be one of the followings - "rockchip,rk3368-pmugrf", "syscon": for rk3368 - "rockchip,rk3399-pmugrf", "syscon": for rk3399 +- compatible: USB2GRF should be one of the followings + - "rockchip,rk3328-usb2phy-grf", "syscon": for rk3328 - reg: physical base address of the controller and length of memory mapped region. @@ -33,3 +38,13 @@ Example: GRF and PMUGRF of RK3399 SoCs compatible = "rockchip,rk3399-grf", "syscon"; reg = <0x0 0xff77 0x0 0x1>; }; + +Example: USB2GRF of RK3328 SoCs + + usb2phy_grf: syscon@ff45 { + compatible = "rockchip,rk3328-usb2phy-grf", "syscon", +"simple-mfd"; + reg = <0x0 0xff45 0x0 0x1>; + #address-cells = <1>; + #size-cells = <1>; + }; -- 1.9.1
Re: [PATCH v6 2/2] [media] s5p-mfc: Handle 'v4l2_pix_format:field' in try_fmt and g_fmt
On 01.03.2017 16:21, Nicolas Dufresne wrote: > Le mercredi 01 mars 2017 à 14:12 +0100, Andrzej Hajda a écrit : >> - on output side you have encoded bytestream - you cannot say about >> interlacing in such case, so the only valid value is NONE, >> - on capture side you have decoded frames, and in this case it >> depends >> on the device and driver capabilities, if the driver/device does not >> support (de-)interlacing (I suppose this is MFC case), interlace type >> field should be filled according to decoded bytestream header (on >> output >> side), but no direct copying from output side!!! > I think we need some nuance here for this to actually be usable. If the > information is not provided by the driver (yes, hardware is limiting > sometimes), it would make sense to copy over the information that > userspace provided. Setting NONE is just the worst approximation in my > opinion. The whole point is that s_fmt on output side is to describe format of the stream passed to the device, and in case of decoder it is just mpeg/h.26x/... stream. It does not contain frames, fields, width, height - it is just raw stream of bytes. We cannot say in such case about field type, there is not such thing as interlaced byte stream. Using s_fmt on output to describe things on capture side look for me unnecessary and abuses V4L2 API IMO. > > About MFC, it will be worth trying to read the DISPLAY_STATUS after the > headers has been processed. It's not clearly stated in the spec if this > will be set or not. > Documentation for MFC6.5 states clearly: > Note: On SEQ_DONE, INTERLACE_PICTURE will return the picture type to > be decoded based on the > sequence header information. In case of MFC5.1 it is unclear, but I hope HW behaves the same way. Anyway I agree it will be good to fix it at least for MFC6.5+, any volunteer? Regards Andrzej
Re: [PATCH V5 6/6] proc: show MADV_FREE pages info in smaps
On Wed, Mar 01, 2017 at 07:57:35PM +0100, Michal Hocko wrote: > On Wed 01-03-17 13:31:49, Johannes Weiner wrote: > > On Wed, Mar 01, 2017 at 02:36:24PM +0100, Michal Hocko wrote: > > > On Fri 24-02-17 13:31:49, Shaohua Li wrote: > > > > show MADV_FREE pages info of each vma in smaps. The interface is for > > > > diganose or monitoring purpose, userspace could use it to understand > > > > what happens in the application. Since userspace could dirty MADV_FREE > > > > pages without notice from kernel, this interface is the only place we > > > > can get accurate accounting info about MADV_FREE pages. > > > > > > I have just got to test this patchset and noticed something that was a > > > bit surprising > > > > > > madvise(mmap(len), len, MADV_FREE) > > > Size: 102400 kB > > > Rss: 102400 kB > > > Pss: 102400 kB > > > Shared_Clean: 0 kB > > > Shared_Dirty: 0 kB > > > Private_Clean:102400 kB > > > Private_Dirty: 0 kB > > > Referenced:0 kB > > > Anonymous:102400 kB > > > LazyFree: 102368 kB > > > > > > It took me a some time to realize that LazyFree is not accurate because > > > there are still pages on the per-cpu lru_lazyfree_pvecs. I believe this > > > is an implementation detail which shouldn't be visible to the userspace. > > > Should we simply drain the pagevec? A crude way would be to simply > > > lru_add_drain_all after we are done with the given range. We can also > > > make this lru_lazyfree_pvecs specific but I am not sure this is worth > > > the additional code. > > > --- > > > diff --git a/mm/madvise.c b/mm/madvise.c > > > index dc5927c812d3..d2c318db16c9 100644 > > > --- a/mm/madvise.c > > > +++ b/mm/madvise.c > > > @@ -474,7 +474,7 @@ static int madvise_free_single_vma(struct > > > vm_area_struct *vma, > > > madvise_free_page_range(&tlb, vma, start, end); > > > mmu_notifier_invalidate_range_end(mm, start, end); > > > tlb_finish_mmu(&tlb, start, end); > > > - > > > + lru_add_drain_all(); > > > > A full drain on all CPUs is very expensive and IMO not justified for > > some per-cpu fuzz factor in the stats. I'd take hampering the stats > > over hampering the syscall any day; only a subset of MADV_FREE users > > will look at the stats. > > > > And while the aggregate error can be large on machines with many CPUs > > (notably the machines on which you absolutely don't want to send IPIs > > to all cores each time a thread madvises some pages!), > > I am not sure I understand. Where would we trigger IPIs? > lru_add_drain_all relies on workqueus. > > > the pages of a > > single process are not likely to be spread out across more than a few > > CPUs. > > Then we can simply only flushe lru_lazyfree_pvecs which should reduce > the unrelated noise from other pagevecs. > > > The error when reading a specific smaps should be completely ok. > > > > In numbers: even if your process is madvising from 16 different CPUs, > > the error in its smaps file will peak at 896K in the worst case. That > > level of concurrency tends to come with much bigger memory quantities > > for that amount of error to matter. > > It is still an unexpected behavior IMHO and an implementation detail > which leaks to the userspace. > > > IMO this is a non-issue. > > I will not insist if there is a general consensus on this and it is a > documented behavior, though. We cannot gurantee with that even draining because madvise_free can miss some of pages easily with several conditions. First of all, userspace can never know how many of pages are mapped in there at the moment. As well, one of page in the range can be swapped out or is going migrating, fail to try_lockpage and so on.
[PATCH v2 3/3] phy: rockchip-inno-usb2: add support of u2phy for rk3328
Add u2phy config information in the data of match table for rk3328. Changes in v2: - add support of otg port Signed-off-by: Meng Dongyang --- drivers/phy/phy-rockchip-inno-usb2.c | 52 1 file changed, 52 insertions(+) diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c index 4ea95c2..0d6 100644 --- a/drivers/phy/phy-rockchip-inno-usb2.c +++ b/drivers/phy/phy-rockchip-inno-usb2.c @@ -1141,6 +1141,57 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) return ret; } +static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = { + { + .reg = 0x100, + .num_ports = 2, + .phy_tuning = rk3328_usb2phy_tuning, + .clkout_ctl = { 0x108, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus= { 0x0100, 15, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x0110, 2, 2, 0, 1 }, + .bvalid_det_st = { 0x0114, 2, 2, 0, 1 }, + .bvalid_det_clr = { 0x0118, 2, 2, 0, 1 }, + .idfall_det_en = { 0x0110, 5, 5, 0, 1 }, + .idfall_det_st = { 0x0114, 5, 5, 0, 1 }, + .idfall_det_clr = { 0x0118, 5, 5, 0, 1 }, + .idrise_det_en = { 0x0110, 4, 4, 0, 1 }, + .idrise_det_st = { 0x0114, 4, 4, 0, 1 }, + .idrise_det_clr = { 0x0118, 4, 4, 0, 1 }, + .ls_det_en = { 0x0110, 0, 0, 0, 1 }, + .ls_det_st = { 0x0114, 0, 0, 0, 1 }, + .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, + .utmi_avalid= { 0x0120, 10, 10, 0, 1 }, + .utmi_bvalid= { 0x0120, 9, 9, 0, 1 }, + .utmi_iddig = { 0x0120, 6, 6, 0, 1 }, + .utmi_ls= { 0x0120, 5, 4, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + .phy_sus= { 0x104, 15, 0, 0, 0x1d1 }, + .ls_det_en = { 0x110, 1, 1, 0, 1 }, + .ls_det_st = { 0x114, 1, 1, 0, 1 }, + .ls_det_clr = { 0x118, 1, 1, 0, 1 }, + .utmi_ls= { 0x120, 17, 16, 0, 1 }, + .utmi_hstdet= { 0x120, 19, 19, 0, 1 } + } + }, + .chg_det = { + .opmode = { 0x0100, 3, 0, 5, 1 }, + .cp_det = { 0x0120, 24, 24, 0, 1 }, + .dcp_det= { 0x0120, 23, 23, 0, 1 }, + .dp_det = { 0x0120, 25, 25, 0, 1 }, + .idm_sink_en= { 0x0108, 8, 8, 0, 1 }, + .idp_sink_en= { 0x0108, 7, 7, 0, 1 }, + .idp_src_en = { 0x0108, 9, 9, 0, 1 }, + .rdm_pdwn_en= { 0x0108, 10, 10, 0, 1 }, + .vdm_src_en = { 0x0108, 12, 12, 0, 1 }, + .vdp_src_en = { 0x0108, 11, 11, 0, 1 }, + }, + }, + { /* sentinel */ } +}; + static const struct rockchip_usb2phy_cfg rk3366_phy_cfgs[] = { { .reg = 0x700, @@ -1223,6 +1274,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) }; static const struct of_device_id rockchip_usb2phy_dt_match[] = { + { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs }, { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, {} -- 1.9.1
[PATCH v2 0/3] add support of u2phy for rk3328
The config information of RK3328 about address and port property is different from before platform. So add config information in the data of match table and documentation of the device tree bindings of u2phy. Changes in v2: - move u2phy grf specification to .../devicetree/bindings/soc/rockchip/grf.txt - add otg port config information of rk3328 Meng Dongyang (3): Documentation: bindings: add assign clock property in u2phy node Documentation: bindings: add DT documentation for u2phy and u2phy grf phy: rockchip-inno-usb2: add support of u2phy for rk3328 .../bindings/phy/phy-rockchip-inno-usb2.txt| 6 +++ .../devicetree/bindings/soc/rockchip/grf.txt | 15 +++ drivers/phy/phy-rockchip-inno-usb2.c | 52 ++ 3 files changed, 73 insertions(+) -- 1.9.1
Re: [PATCH] zram: reduce load operation in page_same_filled
On (03/02/17 16:02), Minchan Kim wrote: > Acked-by: Minchan Kim Reviewed-by: Sergey Senozhatsky thanks. -ss
[RFC] [PATCH] net: account for possible negative frag_mem_limit
I'm also not sure if we'd better disable bottom halves before calculating the counter sum, as sum_frag_mem_limit() does. --- 8< --- On SMP systems, percpu_counter_sum() is permitted to return negative values. However, inet_frag_exit_net() function is following the assumption that its return value is either positive or zero. If a negative value is returned, the code loops forever, possibly keeping net_mutex locked. This could break many things, including unshare(CLONE_NEWNET) system call which would hang forever. Fix this by explicitly asking for a positive return value from the percpu counter. Signed-off-by: Valentine Sinitsyn --- net/ipv4/inet_fragment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index b5e9317..0a63c9e 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -234,7 +234,7 @@ void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) cond_resched(); if (read_seqretry(&f->rnd_seqlock, seq) || - percpu_counter_sum(&nf->mem)) + percpu_counter_sum_positive(&nf->mem)) goto evict_again; percpu_counter_destroy(&nf->mem); -- 2.7.4
Re: [RFC 03/11] mm: remove SWAP_DIRTY in ttu
On March 02, 2017 2:39 PM Minchan Kim wrote: > @@ -1424,7 +1424,8 @@ static int try_to_unmap_one(struct page *page, struct > vm_area_struct *vma, > } else if (!PageSwapBacked(page)) { > /* dirty MADV_FREE page */ Nit: enrich the comment please. > set_pte_at(mm, address, pvmw.pte, pteval); > - ret = SWAP_DIRTY; > + SetPageSwapBacked(page); > + ret = SWAP_FAIL; > page_vma_mapped_walk_done(&pvmw); > break; > }
Re: [RESEND PATCH v2 0/5] Fix the parse_dt of exynos dsi and remove the OF graph
On Thu, Mar 2, 2017 at 3:44 AM, Hoegeun Kwon wrote: > On 02/28/2017 06:58 PM, Krzysztof Kozlowski wrote: >> Discussions in previous thread lead us to bisectability problem. >> Bisectability in regular driver changes is one thing but in case of >> driver + DTS the gap is much bigger. DTS will go through separate tree >> and branches. How do you want to solve the problem? > > > Sorry for the delay in reply, Mar 1st was the holiday. > I thought of two solutions. > > 1. squash the patches in a single patch No, for the same reason. DTS code/patches have to go through arm-soc DTS branch without mixing with any driver changes. Otherwise arm-soc guys are angry. > 2. split the dts related patches so that the first part adds the: > +samsung,burst-clock-frequency = <51200>; > +samsung,esc-clock-frequency = <1600>; > > and the second part at the end removes the 'port' node > So it consists of 6 patches in total. That's a solution. The remaining DTS patches would go in next release... Another solution would be for this release cycle: if (of_property_does_not_exist(node, "samsung,burst-clock-frequency") { // Fallback to old parsing mode node = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0); if (!node) { dev_err(dev, "no burst-clock-frequency nor output port with endpoint specified\n"); return -EINVAL; } } ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency", &dsi->burst_clk_rate); ... ...and in next release the DTS patches would go in. This would give you also DTB backward compatibility. However still DTS could be applied later, after driver changes gets into mainline. Personally I would prefer your solution #2 (with separate DTS patch adding new properties). Does it sound reasonable for Inki? Thanks for looking into this problem. Best regards, Krzysztof
ERROR: "do_not_recover" [drivers/scsi/qedi/qedi.ko] undefined!
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4977ab6e92e267afe9d8f78438c3db330ca8434c commit: ace7f46ba5fde7273207c7122b0650ceb72510e0 scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework. date: 3 months ago config: i386-randconfig-h0-03021247 (attached as .config) compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904 reproduce: git checkout ace7f46ba5fde7273207c7122b0650ceb72510e0 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): >> ERROR: "do_not_recover" [drivers/scsi/qedi/qedi.ko] undefined! --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
[PATCHv2 08/14] intel_th: Use set_memory.h header
set_memory_* functions have moved to set_memory.h. Switch to this explicitly. Signed-off-by: Laura Abbott --- drivers/hwtracing/intel_th/msu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c index e88afe1..f0e36c8 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include "intel_th.h" #include "msu.h" -- 2.7.4
[PATCH v2 2/2] pinctrl: rockchip: Add input schmitt support for rk3328
From: "david.wu" Signed-off-by: david.wu Reviewed-by: Heiko Stuebner --- drivers/pinctrl/pinctrl-rockchip.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 9b8d516..91b5051 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1358,6 +1358,28 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, return ret; } +#define RK3328_SCHMITT_BITS_PER_PIN1 +#define RK3328_SCHMITT_PINS_PER_REG16 +#define RK3328_SCHMITT_BANK_STRIDE 8 +#define RK3328_SCHMITT_GRF_OFFSET 0x380 + +static int rk3328_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, + int pin_num, + struct regmap **regmap, + int *reg, u8 *bit) +{ + struct rockchip_pinctrl *info = bank->drvdata; + + *regmap = info->regmap_base; + *reg = RK3328_SCHMITT_GRF_OFFSET; + + *reg += bank->bank_num * RK3328_SCHMITT_BANK_STRIDE; + *reg += ((pin_num / RK3328_SCHMITT_PINS_PER_REG) * 4); + *bit = pin_num % RK3328_SCHMITT_PINS_PER_REG; + + return 0; +} + static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int pin_num) { struct rockchip_pinctrl *info = bank->drvdata; @@ -2861,6 +2883,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) .pull_calc_reg = rk3228_calc_pull_reg_and_bit, .drv_calc_reg = rk3228_calc_drv_reg_and_bit, .iomux_recalc = rk3328_recalc_mux, + .schmitt_calc_reg = rk3328_calc_schmitt_reg_and_bit, }; static struct rockchip_pin_bank rk3368_pin_banks[] = { -- 1.9.1
[PATCH v2 1/2] pinctrl: rockchip:Add input schmitt support
From: "david.wu" To prevent external signal crosstalk, some pins need to enable input schmitt, like i2c pins, 32k-input pin and so on. Signed-off-by: david.wu --- changes in v2: - check the return value (Heiko) drivers/pinctrl/pinctrl-rockchip.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index a20ce9f..9b8d516 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -308,6 +308,9 @@ struct rockchip_pin_ctrl { int *reg, u8 *bit); void(*iomux_recalc)(u8 bank_num, int pin, int *reg, u8 *bit, int *mask); + int (*schmitt_calc_reg)(struct rockchip_pin_bank *bank, + int pin_num, struct regmap **regmap, + int *reg, u8 *bit); }; struct rockchip_pin_config { @@ -1355,6 +1358,57 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, return ret; } +static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int pin_num) +{ + struct rockchip_pinctrl *info = bank->drvdata; + struct rockchip_pin_ctrl *ctrl = info->ctrl; + struct regmap *regmap; + int reg, ret; + u8 bit; + u32 data; + + ret = ctrl->schmitt_calc_reg(bank, pin_num, ®map, ®, &bit); + if (ret) + return ret; + + ret = regmap_read(regmap, reg, &data); + if (ret) + return ret; + + data >>= bit; + return data & 0x1; +} + +static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, + int pin_num, int enable) +{ + struct rockchip_pinctrl *info = bank->drvdata; + struct rockchip_pin_ctrl *ctrl = info->ctrl; + struct regmap *regmap; + int reg, ret; + unsigned long flags; + u8 bit; + u32 data, rmask; + + dev_dbg(info->dev, "setting input schmitt of GPIO%d-%d to %d\n", + bank->bank_num, pin_num, enable); + + ret = ctrl->schmitt_calc_reg(bank, pin_num, ®map, ®, &bit); + if (ret) + return ret; + + spin_lock_irqsave(&bank->slock, flags); + + /* enable the write to the equivalent lower bits */ + data = BIT(bit + 16) | (enable << bit); + rmask = BIT(bit + 16) | BIT(bit); + + ret = regmap_update_bits(regmap, reg, rmask, data); + spin_unlock_irqrestore(&bank->slock, flags); + + return ret; +} + /* * Pinmux_ops handling */ @@ -1574,6 +1628,15 @@ static int rockchip_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, if (rc < 0) return rc; break; + case PIN_CONFIG_INPUT_SCHMITT_ENABLE: + if (!info->ctrl->schmitt_calc_reg) + return -ENOTSUPP; + + rc = rockchip_set_schmitt(bank, + pin - bank->pin_base, arg); + if (rc < 0) + return rc; + break; default: return -ENOTSUPP; break; @@ -1634,6 +1697,16 @@ static int rockchip_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, arg = rc; break; + case PIN_CONFIG_INPUT_SCHMITT_ENABLE: + if (!info->ctrl->schmitt_calc_reg) + return -ENOTSUPP; + + rc = rockchip_get_schmitt(bank, pin - bank->pin_base); + if (rc < 0) + return rc; + + arg = rc; + break; default: return -ENOTSUPP; break; -- 1.9.1
[RFC 06/11] mm: remove SWAP_MLOCK in ttu
ttu don't need to return SWAP_MLOCK. Instead, just return SWAP_FAIL because it means the page is not-swappable so it should move to another LRU list(active or unevictable). putback friends will move it to right list depending on the page's LRU flag. A side effect is shrink_page_list accounts unevictable list movement by PGACTIVATE but I don't think it corrupts something severe. Signed-off-by: Minchan Kim --- include/linux/rmap.h | 1 - mm/rmap.c| 3 +-- mm/vmscan.c | 14 +++--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1b0cd4c..3630d4d 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -297,6 +297,5 @@ static inline int page_mkclean(struct page *page) #define SWAP_SUCCESS 0 #define SWAP_AGAIN 1 #define SWAP_FAIL 2 -#define SWAP_MLOCK 3 #endif /* _LINUX_RMAP_H */ diff --git a/mm/rmap.c b/mm/rmap.c index 61ae694..47898a1 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1328,7 +1328,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, */ mlock_vma_page(page); } - ret = SWAP_MLOCK; + ret = SWAP_FAIL; page_vma_mapped_walk_done(&pvmw); break; } @@ -1494,7 +1494,6 @@ static int page_mapcount_is_zero(struct page *page) * SWAP_SUCCESS- we succeeded in removing all mappings * SWAP_AGAIN - we missed a mapping, try again later * SWAP_FAIL - the page is unswappable - * SWAP_MLOCK - page is mlocked. */ int try_to_unmap(struct page *page, enum ttu_flags flags) { diff --git a/mm/vmscan.c b/mm/vmscan.c index 91cef05..3cdd270b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -981,7 +981,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, sc->nr_scanned++; if (unlikely(!page_evictable(page))) - goto cull_mlocked; + goto activate_locked; if (!sc->may_unmap && page_mapped(page)) goto keep_locked; @@ -1146,8 +1146,6 @@ static unsigned long shrink_page_list(struct list_head *page_list, goto activate_locked; case SWAP_AGAIN: goto keep_locked; - case SWAP_MLOCK: - goto cull_mlocked; case SWAP_SUCCESS: ; /* try to free the page below */ } @@ -1289,16 +1287,10 @@ static unsigned long shrink_page_list(struct list_head *page_list, list_add(&page->lru, &free_pages); continue; -cull_mlocked: - if (PageSwapCache(page)) - try_to_free_swap(page); - unlock_page(page); - list_add(&page->lru, &ret_pages); - continue; - activate_locked: /* Not a candidate for swapping, so reclaim swap space. */ - if (PageSwapCache(page) && mem_cgroup_swap_full(page)) + if (PageSwapCache(page) && (mem_cgroup_swap_full(page) || + PageMlocked(page))) try_to_free_swap(page); VM_BUG_ON_PAGE(PageActive(page), page); SetPageActive(page); -- 2.7.4
[RFC 03/11] mm: remove SWAP_DIRTY in ttu
If we found lazyfree page is dirty, ttuo can just SetPageSwapBakced in there like PG_mlocked page and just return with SWAP_FAIL which is very natural because the page is not swappable right now so that vmscan can activate it. There is no point to introduce new return value SWAP_DIRTY in ttu at the moment. Cc: Shaohua Li Signed-off-by: Minchan Kim --- include/linux/rmap.h | 1 - mm/rmap.c| 4 ++-- mm/vmscan.c | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index fee10d7..b556eef 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -298,6 +298,5 @@ static inline int page_mkclean(struct page *page) #define SWAP_AGAIN 1 #define SWAP_FAIL 2 #define SWAP_MLOCK 3 -#define SWAP_DIRTY 4 #endif /* _LINUX_RMAP_H */ diff --git a/mm/rmap.c b/mm/rmap.c index 8076347..3a14013 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1424,7 +1424,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, } else if (!PageSwapBacked(page)) { /* dirty MADV_FREE page */ set_pte_at(mm, address, pvmw.pte, pteval); - ret = SWAP_DIRTY; + SetPageSwapBacked(page); + ret = SWAP_FAIL; page_vma_mapped_walk_done(&pvmw); break; } @@ -1494,7 +1495,6 @@ static int page_mapcount_is_zero(struct page *page) * SWAP_AGAIN - we missed a mapping, try again later * SWAP_FAIL - the page is unswappable * SWAP_MLOCK - page is mlocked. - * SWAP_DIRTY - page is dirty MADV_FREE page */ int try_to_unmap(struct page *page, enum ttu_flags flags) { diff --git a/mm/vmscan.c b/mm/vmscan.c index 7aa89e3..91cef05 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1141,9 +1141,6 @@ static unsigned long shrink_page_list(struct list_head *page_list, if (page_mapped(page)) { switch (ret = try_to_unmap(page, ttu_flags | TTU_BATCH_FLUSH)) { - case SWAP_DIRTY: - SetPageSwapBacked(page); - /* fall through */ case SWAP_FAIL: nr_unmap_fail++; goto activate_locked; -- 2.7.4
[RFC 08/11] mm: make ttu's return boolean
try_to_unmap returns SWAP_SUCCESS or SWAP_FAIL so it's suitable for boolean return. This patch changes it. Cc: "Kirill A. Shutemov" Cc: Naoya Horiguchi Signed-off-by: Minchan Kim --- include/linux/rmap.h | 4 ++-- mm/huge_memory.c | 4 ++-- mm/memory-failure.c | 22 ++ mm/rmap.c| 8 +++- mm/vmscan.c | 7 +-- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 3630d4d..6028c38 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -191,7 +191,7 @@ static inline void page_dup_rmap(struct page *page, bool compound) int page_referenced(struct page *, int is_locked, struct mem_cgroup *memcg, unsigned long *vm_flags); -int try_to_unmap(struct page *, enum ttu_flags flags); +bool try_to_unmap(struct page *, enum ttu_flags flags); /* Avoid racy checks */ #define PVMW_SYNC (1 << 0) @@ -281,7 +281,7 @@ static inline int page_referenced(struct page *page, int is_locked, return 0; } -#define try_to_unmap(page, refs) SWAP_FAIL +#define try_to_unmap(page, refs) false static inline int page_mkclean(struct page *page) { diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fe2ccd4..79ea769 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2106,7 +2106,7 @@ static void freeze_page(struct page *page) { enum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS | TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD; - int ret; + bool ret; VM_BUG_ON_PAGE(!PageHead(page), page); @@ -2114,7 +2114,7 @@ static void freeze_page(struct page *page) ttu_flags |= TTU_MIGRATION; ret = try_to_unmap(page, ttu_flags); - VM_BUG_ON_PAGE(ret != SWAP_SUCCESS, page); + VM_BUG_ON_PAGE(!ret, page); } static void unfreeze_page(struct page *page) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index b78d080..75fcbd8 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -321,7 +321,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, * wrong earlier. */ static void kill_procs(struct list_head *to_kill, int forcekill, int trapno, - int fail, struct page *page, unsigned long pfn, + bool fail, struct page *page, unsigned long pfn, int flags) { struct to_kill *tk, *next; @@ -903,13 +903,13 @@ EXPORT_SYMBOL_GPL(get_hwpoison_page); * Do all that is necessary to remove user space mappings. Unmap * the pages and send SIGBUS to the processes if the data was dirty. */ -static int hwpoison_user_mappings(struct page *p, unsigned long pfn, +static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, int trapno, int flags, struct page **hpagep) { enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; struct address_space *mapping; LIST_HEAD(tokill); - int ret; + bool ret; int kill = 1, forcekill; struct page *hpage = *hpagep; @@ -918,20 +918,20 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, * other types of pages. */ if (PageReserved(p) || PageSlab(p)) - return SWAP_SUCCESS; + return true; if (!(PageLRU(hpage) || PageHuge(p))) - return SWAP_SUCCESS; + return true; /* * This check implies we don't kill processes if their pages * are in the swap cache early. Those are always late kills. */ if (!page_mapped(hpage)) - return SWAP_SUCCESS; + return true; if (PageKsm(p)) { pr_err("Memory failure: %#lx: can't handle KSM pages.\n", pfn); - return SWAP_FAIL; + return false; } if (PageSwapCache(p)) { @@ -971,7 +971,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, collect_procs(hpage, &tokill, flags & MF_ACTION_REQUIRED); ret = try_to_unmap(hpage, ttu); - if (ret != SWAP_SUCCESS) + if (!ret) pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n", pfn, page_mapcount(hpage)); @@ -986,8 +986,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn, * any accesses to the poisoned memory. */ forcekill = PageDirty(hpage) || (flags & MF_MUST_KILL); - kill_procs(&tokill, forcekill, trapno, - ret != SWAP_SUCCESS, p, pfn, flags); + kill_procs(&tokill, forcekill, trapno, !ret , p, pfn, flags); return ret; } @@ -1229,8 +1228,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) * When the raw error page is thp tail page, hpage points to the raw * page after thp split. */ - if (h
[RFC 05/11] mm: make the try_to_munlock void function
try_to_munlock returns SWAP_MLOCK if the one of VMAs mapped the page has VM_LOCKED flag. In that time, VM set PG_mlocked to the page if the page is not pte-mapped THP which cannot be mlocked, either. With that, __munlock_isolated_page can use PageMlocked to check whether try_to_munlock is successful or not without relying on try_to_munlock's retval. It helps to make ttu/ttuo simple with upcoming patches. Cc: Vlastimil Babka Cc: Kirill A. Shutemov Signed-off-by: Minchan Kim --- include/linux/rmap.h | 2 +- mm/mlock.c | 6 ++ mm/rmap.c| 16 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index b556eef..1b0cd4c 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -235,7 +235,7 @@ int page_mkclean(struct page *); * called in munlock()/munmap() path to check for other vmas holding * the page mlocked. */ -int try_to_munlock(struct page *); +void try_to_munlock(struct page *); void remove_migration_ptes(struct page *old, struct page *new, bool locked); diff --git a/mm/mlock.c b/mm/mlock.c index cdbed8a..d34a540 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -122,17 +122,15 @@ static bool __munlock_isolate_lru_page(struct page *page, bool getpage) */ static void __munlock_isolated_page(struct page *page) { - int ret = SWAP_AGAIN; - /* * Optimization: if the page was mapped just once, that's our mapping * and we don't need to check all the other vmas. */ if (page_mapcount(page) > 1) - ret = try_to_munlock(page); + try_to_munlock(page); /* Did try_to_unlock() succeed or punt? */ - if (ret != SWAP_MLOCK) + if (!PageMlocked(page)) count_vm_event(UNEVICTABLE_PGMUNLOCKED); putback_lru_page(page); diff --git a/mm/rmap.c b/mm/rmap.c index 0a48958..61ae694 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1540,18 +1540,10 @@ static int page_not_mapped(struct page *page) * Called from munlock code. Checks all of the VMAs mapping the page * to make sure nobody else has this page mlocked. The page will be * returned with PG_mlocked cleared if no other vmas have it mlocked. - * - * Return values are: - * - * SWAP_AGAIN - no vma is holding page mlocked, or, - * SWAP_AGAIN - page mapped in mlocked vma -- couldn't acquire mmap sem - * SWAP_FAIL - page cannot be located at present - * SWAP_MLOCK - page is now mlocked. */ -int try_to_munlock(struct page *page) -{ - int ret; +void try_to_munlock(struct page *page) +{ struct rmap_walk_control rwc = { .rmap_one = try_to_unmap_one, .arg = (void *)TTU_MUNLOCK, @@ -1561,9 +1553,9 @@ int try_to_munlock(struct page *page) }; VM_BUG_ON_PAGE(!PageLocked(page) || PageLRU(page), page); + VM_BUG_ON_PAGE(PageMlocked(page), page); - ret = rmap_walk(page, &rwc); - return ret; + rmap_walk(page, &rwc); } void __put_anon_vma(struct anon_vma *anon_vma) -- 2.7.4
[RFC 10/11] mm: make rmap_one boolean function
rmap_one's return value controls whether rmap_work should contine to scan other ptes or not so it's target for changing to boolean. Return true if the scan should be continued. Otherwise, return false to stop the scanning. This patch makes rmap_one's return value to boolean. Signed-off-by: Minchan Kim --- include/linux/rmap.h | 2 +- mm/ksm.c | 2 +- mm/migrate.c | 4 ++-- mm/page_idle.c | 4 ++-- mm/rmap.c| 30 +++--- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 1d7d457c..59d7dd7 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -257,7 +257,7 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma); */ struct rmap_walk_control { void *arg; - int (*rmap_one)(struct page *page, struct vm_area_struct *vma, + bool (*rmap_one)(struct page *page, struct vm_area_struct *vma, unsigned long addr, void *arg); int (*done)(struct page *page); struct anon_vma *(*anon_lock)(struct page *page); diff --git a/mm/ksm.c b/mm/ksm.c index 68f8820..f764afb 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1975,7 +1975,7 @@ void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue; - if (SWAP_AGAIN != rwc->rmap_one(page, vma, + if (!rwc->rmap_one(page, vma, rmap_item->address, rwc->arg)) { anon_vma_unlock_read(anon_vma); return; diff --git a/mm/migrate.c b/mm/migrate.c index cda4c27..22daaea 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -193,7 +193,7 @@ void putback_movable_pages(struct list_head *l) /* * Restore a potential migration pte to a working pte entry */ -static int remove_migration_pte(struct page *page, struct vm_area_struct *vma, +static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, unsigned long addr, void *old) { struct page_vma_mapped_walk pvmw = { @@ -249,7 +249,7 @@ static int remove_migration_pte(struct page *page, struct vm_area_struct *vma, update_mmu_cache(vma, pvmw.address, pvmw.pte); } - return SWAP_AGAIN; + return true; } /* diff --git a/mm/page_idle.c b/mm/page_idle.c index b0ee56c..1b0f48c 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -50,7 +50,7 @@ static struct page *page_idle_get_page(unsigned long pfn) return page; } -static int page_idle_clear_pte_refs_one(struct page *page, +static bool page_idle_clear_pte_refs_one(struct page *page, struct vm_area_struct *vma, unsigned long addr, void *arg) { @@ -84,7 +84,7 @@ static int page_idle_clear_pte_refs_one(struct page *page, */ set_page_young(page); } - return SWAP_AGAIN; + return true; } static void page_idle_clear_pte_refs(struct page *page) diff --git a/mm/rmap.c b/mm/rmap.c index 08e4f81..60adedb 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -717,7 +717,7 @@ struct page_referenced_arg { /* * arg: page_referenced_arg will be passed */ -static int page_referenced_one(struct page *page, struct vm_area_struct *vma, +static bool page_referenced_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { struct page_referenced_arg *pra = arg; @@ -734,7 +734,7 @@ static int page_referenced_one(struct page *page, struct vm_area_struct *vma, if (vma->vm_flags & VM_LOCKED) { page_vma_mapped_walk_done(&pvmw); pra->vm_flags |= VM_LOCKED; - return SWAP_FAIL; /* To break the loop */ + return false; /* To break the loop */ } if (pvmw.pte) { @@ -774,9 +774,9 @@ static int page_referenced_one(struct page *page, struct vm_area_struct *vma, } if (!pra->mapcount) - return SWAP_SUCCESS; /* To break the loop */ + return false; /* To break the loop */ - return SWAP_AGAIN; + return true; } static bool invalid_page_referenced_vma(struct vm_area_struct *vma, void *arg) @@ -847,7 +847,7 @@ int page_referenced(struct page *page, return pra.referenced; } -static int page_mkclean_one(struct page *page, struct vm_area_struct *vma, +static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { struct page_vma_mapped_walk pvmw = { @@ -900,7 +900,7 @@ static int page_mkclean_one(struct page *page, struct vm_area_struct *vma,
[RFC 02/11] mm: remove unncessary ret in page_referenced
Anyone doesn't use ret variable. Remove it. Signed-off-by: Minchan Kim --- mm/rmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index bb45712..8076347 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -805,7 +805,6 @@ int page_referenced(struct page *page, struct mem_cgroup *memcg, unsigned long *vm_flags) { - int ret; int we_locked = 0; struct page_referenced_arg pra = { .mapcount = total_mapcount(page), @@ -839,7 +838,7 @@ int page_referenced(struct page *page, rwc.invalid_vma = invalid_page_referenced_vma; } - ret = rmap_walk(page, &rwc); + rmap_walk(page, &rwc); *vm_flags = pra.vm_flags; if (we_locked) -- 2.7.4
[RFC 01/11] mm: use SWAP_SUCCESS instead of 0
SWAP_SUCCESS defined value 0 can be changed always so don't rely on it. Instead, use explict macro. Cc: Kirill A. Shutemov Signed-off-by: Minchan Kim --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 092cc5c..fe2ccd4 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2114,7 +2114,7 @@ static void freeze_page(struct page *page) ttu_flags |= TTU_MIGRATION; ret = try_to_unmap(page, ttu_flags); - VM_BUG_ON_PAGE(ret, page); + VM_BUG_ON_PAGE(ret != SWAP_SUCCESS, page); } static void unfreeze_page(struct page *page) -- 2.7.4
[RFC 09/11] mm: make rmap_walk void function
There is no user of return value from rmap_walk friend so this patch makes them void function. Signed-off-by: Minchan Kim --- include/linux/ksm.h | 5 ++--- include/linux/rmap.h | 4 ++-- mm/ksm.c | 16 ++-- mm/rmap.c| 32 +--- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 481c8c4..317ad0b 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -60,7 +60,7 @@ static inline void set_page_stable_node(struct page *page, struct page *ksm_might_need_to_copy(struct page *page, struct vm_area_struct *vma, unsigned long address); -int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); +void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); void ksm_migrate_page(struct page *newpage, struct page *oldpage); #else /* !CONFIG_KSM */ @@ -93,10 +93,9 @@ static inline int page_referenced_ksm(struct page *page, return 0; } -static inline int rmap_walk_ksm(struct page *page, +static inline void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) { - return 0; } static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 6028c38..1d7d457c 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -264,8 +264,8 @@ struct rmap_walk_control { bool (*invalid_vma)(struct vm_area_struct *vma, void *arg); }; -int rmap_walk(struct page *page, struct rmap_walk_control *rwc); -int rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc); +void rmap_walk(struct page *page, struct rmap_walk_control *rwc); +void rmap_walk_locked(struct page *page, struct rmap_walk_control *rwc); #else /* !CONFIG_MMU */ diff --git a/mm/ksm.c b/mm/ksm.c index 520e4c3..68f8820 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1931,11 +1931,10 @@ struct page *ksm_might_need_to_copy(struct page *page, return new_page; } -int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) +void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) { struct stable_node *stable_node; struct rmap_item *rmap_item; - int ret = SWAP_AGAIN; int search_new_forks = 0; VM_BUG_ON_PAGE(!PageKsm(page), page); @@ -1948,7 +1947,7 @@ int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) stable_node = page_stable_node(page); if (!stable_node) - return ret; + return; again: hlist_for_each_entry(rmap_item, &stable_node->hlist, hlist) { struct anon_vma *anon_vma = rmap_item->anon_vma; @@ -1976,23 +1975,20 @@ int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc) if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg)) continue; - ret = rwc->rmap_one(page, vma, - rmap_item->address, rwc->arg); - if (ret != SWAP_AGAIN) { + if (SWAP_AGAIN != rwc->rmap_one(page, vma, + rmap_item->address, rwc->arg)) { anon_vma_unlock_read(anon_vma); - goto out; + return; } if (rwc->done && rwc->done(page)) { anon_vma_unlock_read(anon_vma); - goto out; + return; } } anon_vma_unlock_read(anon_vma); } if (!search_new_forks++) goto again; -out: - return ret; } #ifdef CONFIG_MIGRATION diff --git a/mm/rmap.c b/mm/rmap.c index 01f7832..08e4f81 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1595,13 +1595,12 @@ static struct anon_vma *rmap_walk_anon_lock(struct page *page, * vm_flags for that VMA. That should be OK, because that vma shouldn't be * LOCKED. */ -static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc, +static void rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc, bool locked) { struct anon_vma *anon_vma; pgoff_t pgoff_start, pgoff_end; struct anon_vma_chain *avc; - int ret = SWAP_AGAIN; if (locked) { anon_vma = page_anon_vma(page); @@ -1611,7 +1610,7 @@ static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc, anon_vma = rmap_walk_anon_lock(page, rwc); } if (!anon_vma) - return ret; + return; pgoff_start = page_to_pgoff(page); pgoff_end = pgoff_start + hpage_nr_pages(page) - 1; @@ -1625,8 +1624,7 @@ static int rmap_walk_anon(struct page *page, struct
[RFC 00/11] make try_to_unmap simple
Currently, try_to_unmap returns various return value(SWAP_SUCCESS, SWAP_FAIL, SWAP_AGAIN, SWAP_DIRTY and SWAP_MLOCK). When I look into that, it's unncessary complicated so this patch aims for cleaning it up. Change ttu to boolean function so we can remove SWAP_AGAIN, SWAP_DIRTY, SWAP_MLOCK. This patchset is based on v4.10-mmots-2017-02-28-17-33. Minchan Kim (11): mm: use SWAP_SUCCESS instead of 0 mm: remove unncessary ret in page_referenced mm: remove SWAP_DIRTY in ttu mm: remove SWAP_MLOCK check for SWAP_SUCCESS in ttu mm: make the try_to_munlock void function mm: remove SWAP_MLOCK in ttu mm: remove SWAP_AGAIN in ttu mm: make ttu's return boolean mm: make rmap_walk void function mm: make rmap_one boolean function mm: remove SWAP_[SUCCESS|AGAIN|FAIL] include/linux/ksm.h | 5 ++- include/linux/rmap.h | 21 mm/huge_memory.c | 4 +-- mm/ksm.c | 16 - mm/memory-failure.c | 22 ++-- mm/migrate.c | 4 +-- mm/mlock.c | 6 ++-- mm/page_idle.c | 4 +-- mm/rmap.c| 97 mm/vmscan.c | 26 +++--- 10 files changed, 73 insertions(+), 132 deletions(-) -- 2.7.4
[RFC 04/11] mm: remove SWAP_MLOCK check for SWAP_SUCCESS in ttu
If the page is mapped and rescue in ttuo, page_mapcount(page) == 0 cannot be true so page_mapcount check in ttu is enough to return SWAP_SUCCESS. IOW, SWAP_MLOCK check is redundant so remove it. Signed-off-by: Minchan Kim --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index 3a14013..0a48958 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1523,7 +1523,7 @@ int try_to_unmap(struct page *page, enum ttu_flags flags) else ret = rmap_walk(page, &rwc); - if (ret != SWAP_MLOCK && !page_mapcount(page)) + if (!page_mapcount(page)) ret = SWAP_SUCCESS; return ret; } -- 2.7.4
[RFC 07/11] mm: remove SWAP_AGAIN in ttu
In 2002, [1] introduced SWAP_AGAIN. At that time, ttuo used spin_trylock(&mm->page_table_lock) so it's really easy to contend and fail to hold a lock so SWAP_AGAIN to keep LRU status makes sense. However, now we changed it to mutex-based lock and be able to block without skip pte so there is a few of small window to return SWAP_AGAIN so remove SWAP_AGAIN and just return SWAP_FAIL. [1] c48c43e, minimal rmap Signed-off-by: Minchan Kim --- mm/rmap.c | 11 +++ mm/vmscan.c | 2 -- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 47898a1..da18f21 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1492,13 +1492,10 @@ static int page_mapcount_is_zero(struct page *page) * Return values are: * * SWAP_SUCCESS- we succeeded in removing all mappings - * SWAP_AGAIN - we missed a mapping, try again later * SWAP_FAIL - the page is unswappable */ int try_to_unmap(struct page *page, enum ttu_flags flags) { - int ret; - struct rmap_walk_control rwc = { .rmap_one = try_to_unmap_one, .arg = (void *)flags, @@ -1518,13 +1515,11 @@ int try_to_unmap(struct page *page, enum ttu_flags flags) rwc.invalid_vma = invalid_migration_vma; if (flags & TTU_RMAP_LOCKED) - ret = rmap_walk_locked(page, &rwc); + rmap_walk_locked(page, &rwc); else - ret = rmap_walk(page, &rwc); + rmap_walk(page, &rwc); - if (!page_mapcount(page)) - ret = SWAP_SUCCESS; - return ret; + return !page_mapcount(page) ? SWAP_SUCCESS: SWAP_FAIL; } static int page_not_mapped(struct page *page) diff --git a/mm/vmscan.c b/mm/vmscan.c index 3cdd270b..170c61f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1144,8 +1144,6 @@ static unsigned long shrink_page_list(struct list_head *page_list, case SWAP_FAIL: nr_unmap_fail++; goto activate_locked; - case SWAP_AGAIN: - goto keep_locked; case SWAP_SUCCESS: ; /* try to free the page below */ } -- 2.7.4
[RFC 11/11] mm: remove SWAP_[SUCCESS|AGAIN|FAIL]
There is no user for it. Remove it. Signed-off-by: Minchan Kim --- include/linux/rmap.h | 7 --- 1 file changed, 7 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 59d7dd7..5d6788f 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -291,11 +291,4 @@ static inline int page_mkclean(struct page *page) #endif /* CONFIG_MMU */ -/* - * Return values of try_to_unmap - */ -#define SWAP_SUCCESS 0 -#define SWAP_AGAIN 1 -#define SWAP_FAIL 2 - #endif /* _LINUX_RMAP_H */ -- 2.7.4
Re: perf test 'instruction decoder' failing
On 01/03/17 16:50, Arnaldo Carvalho de Melo wrote: > Em Tue, Feb 28, 2017 at 12:02:36PM +0200, Adrian Hunter escreveu: >> On 24/02/17 22:27, Arnaldo Carvalho de Melo wrote: >>> Hi Adrian, >>> >>> This test is failing, I'll try to recheck this and bisect it, >>> but since I haven't had the time so far and I saw it since yesterday (at >>> least), lemme document it here: >>> >>> >>> [root@jouet ~]# perf test -v 57 >>> 57: x86 instruction decoder - new instructions : >>> --- start --- >>> test child forked, pid 18975 >>> Decoded ok: 0f 31 rdtsc >>> Decoded ok: 0f 1b 80 78 56 34 12bndstx %bnd0,0x12345678(%eax) >>> >>> Decoded ok: 0f 1b 85 78 56 34 12bndstx %bnd0,0x12345678(%ebp) >>> Decoded ok: 0f 1b 84 01 78 56 34 12 bndstx >>> %bnd0,0x12345678(%ecx,%eax,1) >>> Decoded ok: 0f 1b 84 05 78 56 34 12 bndstx >>> %bnd0,0x12345678(%ebp,%eax,1) >>> Decoded ok: 0f 1b 84 08 78 56 34 12 bndstx >>> %bnd0,0x12345678(%eax,%ecx,1) >>> Decoded ok: f2 e8 fc ff ff ff bnd call fce >>> Failed to decode 'rel' value (0xfffc vs expected 0): f2 ff 10 >>> bnd call *(%eax) >>> Failed to decode 'rel' value (0xfffc vs expected 0): f2 c3 >>> bnd ret >>> Decoded ok: f2 e9 fc ff ff ff bnd jmp fd9 >>> Decoded ok: f2 e9 fc ff ff ff bnd jmp fdf >>> Failed to decode 'rel' value (0xfffc vs expected 0): f2 ff 21 >>> bnd jmp *(%ecx) >>> Decoded ok: f2 0f 85 fc ff ff ffbnd jne fe9 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc c1 00 >>> sha1rnds4 $0x0,%xmm1,%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc d7 91 >>> sha1rnds4 $0x91,%xmm7,%xmm2 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 00 91 >>> sha1rnds4 $0x91,(%eax),%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 05 78 56 >>> 34 12 91 sha1rnds4 $0x91,0x12345678,%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 18 91 >>> sha1rnds4 $0x91,(%eax),%xmm3 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 04 01 91 >>> sha1rnds4 $0x91,(%ecx,%eax,1),%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 04 05 78 >>> 56 34 12 91 sha1rnds4 $0x91,0x12345678(,%eax,1),%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 04 08 91 >>> sha1rnds4 $0x91,(%eax,%ecx,1),%xmm0 >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 3a cc 04 c8 91 >>> sha1rnds4 $0x91,(%eax,%ecx,8),%xmm0 >>> >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 45 12 >>> bndstx %bnd0,0x12(%rbp) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 44 01 12 >>> bndstx %bnd0,0x12(%rcx,%rax,1) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 44 05 12 >>> bndstx %bnd0,0x12(%rbp,%rax,1) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 44 08 12 >>> bndstx %bnd0,0x12(%rax,%rcx,1) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 80 78 56 34 >>> 12 bndstx %bnd0,0x12345678(%rax) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 85 78 56 34 >>> 12 bndstx %bnd0,0x12345678(%rbp) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 84 01 78 56 >>> 34 12bndstx %bnd0,0x12345678(%rcx,%rax,1) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 84 05 78 56 >>> 34 12bndstx %bnd0,0x12345678(%rbp,%rax,1) >>> Failed to decode 'rel' value (0xfffc vs expected 0): 0f 1b 84 08 78 56 >>> 34 12bndstx %bnd0,0x12345678(%rax,%rcx,1) >>> Decoded ok: f2 e8 00 00 00 00 bnd callq f22 >>> Decoded ok: 67 f2 ff 10 bnd callq *(%eax) >>> >>> Decoded ok: 41 0f c7 9c c8 78 56 34 12 xrstors 0x12345678(%r8,%rcx,8) >>> Decoded ok: 0f 01 eerdpkru >>> Decoded ok: 0f 01 efwrpkru >>> test child finished with -1 >>> end >>> x86 instruction decoder - new instructions: FAILED! >>> >>> Fedora 25, >>> >>> [acme@jouet linux]$ uname -a >>> Linux jouet 4.10.0-rc8 #2 SMP Wed Feb 15 15:26:36 BRT 2017 x86_64 x86_64 >>> x86_64 GNU/Linux >>> >>> [acme@jouet linux]$ rpm -q binutils elfutils gcc glibc >>> binutils-2.26.1-1.fc25.x86_64 >>> elfutils-0.168-1.fc25.x86_64 >>> gcc-6.3.1-1.fc25.x86_64 >>> glibc-2.24-4.fc25.x86_64 >>> glibc-2.24-4.fc25.i686 >>> [acme@jouet linux]$ >>> >>> [acme@jouet linux]$ perf -v >>> perf version 4.10.g264b77 >>> >>> perf as in tip/perf/core and soon as in acme/perf/core >> >> There is missing initialization. It only affects the test because it is >> checking 'rel' even in cases where there is no value. >> >> Here is the fix. > > Thanks, I'll test it, I assume I can add your Signed-off-by: tag to this > cset, ok? The comment I can just use your
[PATCH v2 0/2] Add pinctrl input schmitt support
Some pins need to enable Schmitt triggers which are used in open loop configurations for noise immunity and closed loop configurations to implement function generators. david.wu (2): pinctrl: rockchip:Add input schmitt support pinctrl: rockchip: Add input schmitt support for rk3328 drivers/pinctrl/pinctrl-rockchip.c | 96 ++ 1 file changed, 96 insertions(+) -- 1.9.1
Re: [PATCH] target: Fix NULL dereference during LUN lookup + active I/O shutdown
On Thu, 2017-02-23 at 11:46 -0600, Bryant G. Ly wrote: > > From: Nicholas Bellinger > > > > When transport_clear_lun_ref() is shutting down a se_lun via > > configfs with new I/O in-flight, it's possible to trigger a > > NULL pointer dereference in transport_lookup_cmd_lun() due > > to the fact percpu_ref_get() doesn't do any __PERCPU_REF_DEAD > > checking before incrementing lun->lun_ref.count after > > lun->lun_ref has switched to atomic_t mode. > > > > This results in a NULL pointer dereference as LUN shutdown > > code in core_tpg_remove_lun() continues running after the > > existing ->release() -> core_tpg_lun_ref_release() callback > > completes, and clears the RCU protected se_lun->lun_se_dev > > pointer. > > > > During the OOPs, the state of lun->lun_ref in the process > > which triggered the NULL pointer dereference looks like > > the following on v4.1.y stable code: > > > > struct se_lun { > >lun_link_magic = 4294932337, > >lun_status = TRANSPORT_LUN_STATUS_FREE, > > > >. > > > >lun_se_dev = 0x0, > >lun_sep = 0x0, > > > >. > > > >lun_ref = { > > count = { > >counter = 1 > > }, > > percpu_count_ptr = 3, > > release = 0xa02fa1e0 , > > confirm_switch = 0x0, > > force_atomic = false, > > rcu = { > >next = 0x88154fa1a5d0, > >func = 0x8137c4c0 > > } > >} > > } > > > > To address this bug, use percpu_ref_tryget_live() to ensure > > once __PERCPU_REF_DEAD is visable on all CPUs and ->lun_ref > > has switched to atomic_t, all new I/Os will fail to obtain > > a new lun->lun_ref reference. > > > > Also use an explicit percpu_ref_kill_and_confirm() callback > > to block on ->lun_ref_comp to allow the first stage and > > associated RCU grace period to complete, and then block on > > ->lun_ref_shutdown waiting for the final percpu_ref_put() > > to drop the last reference via transport_lun_remove_cmd() > > before continuing with core_tpg_remove_lun() shutdown. > > > > Reported-by: Rob Millner > > Tested-by: Rob Millner > > Cc: Rob Millner > > Tested-by: Vaibhav Tandon > > Cc: Vaibhav Tandon > > Signed-off-by: Nicholas Bellinger > > --- > > drivers/target/target_core_device.c| 10 -- > > drivers/target/target_core_tpg.c | 3 ++- > > drivers/target/target_core_transport.c | 31 > > ++- > > include/target/target_core_base.h | 1 + > > 4 files changed, 41 insertions(+), 4 deletions(-) > > > I have seen this and have tested this with our custom kernel. > > So this looks good from me! > Added your Tested-by to the patch. Thanks Bryant.
WARNING: at arch/x86/kernel/cpu/perf_event_intel_cqm.c:186 __put_rmid+0x28/0x80()
Hi, I test Trinity, and got the following log. My OS version is RHEL 7.2, I'm not sure if it has fixed in mainline. Any comment is welcome. [57676.532593] [ cut here ] [57676.537415] WARNING: at arch/x86/kernel/cpu/perf_event_intel_cqm.c:186 __put_rmid+0x28/0x80() [57676.546299] Modules linked in: 8021q garp stp mrp llc fuse cmtp kernelcapi scsi_transport_iscsi rfcomm dccp_ipv6 dccp_ipv4 dccp ipt_ULOG bluetooth rfkill af_key nfnetlink af_802154 vmw_vsock_vmci_transport vmw_vmci vsock atm pppoe pppox ppp_generic slhc openvswitch ipmi_devintf ipmi_si ipmi_msghandler coretemp intel_rapl crc32_pclmul crc32c_intel ghash_clmulni_intel iTCO_wdt iTCO_vendor_support tg3 aesni_intel lrw gf128mul glue_helper ptp pps_core ses enclosure ablk_helper cryptd sg sb_edac pcspkr edac_core acpi_power_meter i2c_i801 i2c_core mei_me mei shpchp lpc_ich mfd_core ip_tables ext3 mbcache jbd sd_mod crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common ahci libahci libata megaraid_sas dm_mod nf_conntrack_ipv4 nf_defrag_ipv4 vhost_net tun vhost macvtap macvlan vfio_pci irqbypass [57676.620009] vfio_iommu_type1 vfio xt_sctp nf_conntrack_proto_sctp nf_nat_proto_sctp nf_nat nf_conntrack sctp libcrc32c [57676.629998] CPU: 11 PID: 114 Comm: kworker/11:0 Not tainted 3.10.0-327.44.58.22.x86_64 #1 [57676.638525] Hardware name: Huawei RH2288H V3/BC11HGSA0, BIOS 3.31 08/22/2016 [57676.645746] Workqueue: events intel_cqm_rmid_rotate [57676.650821] 701d762a 882027873d60 8163b400 [57676.658639] 882027873d98 8107b1f0 0001 [57676.666458] 88201fba7000 88100ceeb400 8820265730c0 882027873da8 [57676.674285] Call Trace: [57676.676915] [] dump_stack+0x19/0x1b [57676.682227] [] warn_slowpath_common+0x70/0xb0 [57676.688404] [] warn_slowpath_null+0x1a/0x20 [57676.694409] [] __put_rmid+0x28/0x80 [57676.699694] [] intel_cqm_rmid_rotate+0xba/0x440 [57676.706051] [] process_one_work+0x17b/0x470 [57676.712070] [] worker_thread+0x11b/0x400 [57676.717819] [] ? rescuer_thread+0x400/0x400 [57676.723830] [] kthread+0xcf/0xe0 [57676.728883] [] ? kthread_create_on_node+0x140/0x140 [57676.735586] [] ret_from_fork+0x58/0x90 [57676.741156] [] ? kthread_create_on_node+0x140/0x140 [57676.747860] ---[ end trace dee4db6217e5fc5d ]--- [57676.752669] BUG: unable to handle kernel NULL pointer dereference at (null) [57676.760870] IP: [] __put_rmid+0x36/0x80 [57676.766458] PGD 1026c33067 PUD 10282c4067 PMD 0 [57676.771279] Oops: [#1] SMP [57676.774722] Modules linked in: 8021q garp stp mrp llc fuse cmtp kernelcapi scsi_transport_iscsi rfcomm dccp_ipv6 dccp_ipv4 dccp ipt_ULOG bluetooth rfkill af_key nfnetlink af_802154 vmw_vsock_vmci_transport vmw_vmci vsock atm pppoe pppox ppp_generic slhc openvswitch ipmi_devintf ipmi_si ipmi_msghandler coretemp intel_rapl crc32_pclmul crc32c_intel ghash_clmulni_intel iTCO_wdt iTCO_vendor_support tg3 aesni_intel lrw gf128mul glue_helper ptp pps_core ses enclosure ablk_helper cryptd sg sb_edac pcspkr edac_core acpi_power_meter i2c_i801 i2c_core mei_me mei shpchp lpc_ich mfd_core ip_tables ext3 mbcache jbd sd_mod crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common ahci libahci libata megaraid_sas dm_mod nf_conntrack_ipv4 nf_defrag_ipv4 vhost_net tun vhost macvtap macvlan vfio_pci irqbypass [57676.848405] vfio_iommu_type1 vfio xt_sctp nf_conntrack_proto_sctp nf_nat_proto_sctp nf_nat nf_conntrack sctp libcrc32c [57676.858377] CPU: 11 PID: 114 Comm: kworker/11:0 Tainted: GW --- 3.10.0-327.44.58.22.x86_64 #1 [57676.869330] Hardware name: Huawei RH2288H V3/BC11HGSA0, BIOS 3.31 08/22/2016 [57676.876548] Workqueue: events intel_cqm_rmid_rotate [57676.881618] task: 882027868b80 ti: 88202787 task.ti: 88202787 [57676.889448] RIP: 0010:[] [] __put_rmid+0x36/0x80 [57676.897638] RSP: 0018:882027873db8 EFLAGS: 00010296 [57676.903119] RAX: 8820259e4300 RBX: RCX: [57676.910419] RDX: RSI: RDI: 0009 [57676.917725] RBP: 882027873dc8 R08: 0092 R09: 880bcec0 [57676.925031] R10: 00a0 R11: 0050 R12: [57676.932330] R13: 88201fba7000 R14: 88100ceeb400 R15: 8820265730c0 [57676.939631] FS: () GS:88203e34() knlGS: [57676.948064] CS: 0010 DS: ES: CR0: 80050033 [57676.953982] CR2: CR3: 001026c32000 CR4: 001407e0 [57676.961286] DR0: 7f2390b3d000 DR1: 7fc8e188f000 DR2: [57676.968586] DR3: DR6: 0ff0 DR7: 0600 [57676.975889] Stack: [57676.978078] 0001 8820265730c8 882027873e18 8103a74a [57676.985892] 001a8109b3d9 88202676dc00 00060006 8196b600 [57676.993703]
Re: [PATCH 2/2] HID: Remove unnecessary OOM messages
On Thu, 2017-03-02 at 07:51 +0100, Michel Hermier wrote: > Le 01/03/2017 à 20:19, Joe Perches a écrit : > > diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c [] > > @@ -224,7 +224,6 @@ static int asus_start_multitouch(struct hid_device > > *hdev) > > > > if (!dmabuf) { > > ret = -ENOMEM; > > - hid_err(hdev, "Asus failed to alloc dma buf: %d\n", ret); > > return ret; > > } > > Trivial set and return value missed. You're welcome to submit a follow-on patch. The compiler should produce the same code in any case.
RE: [PATCH v4 11/19] scsi: megaraid: Replace PCI pool old API
>-Original Message- >From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- >ow...@vger.kernel.org] On Behalf Of Romain Perier >Sent: Wednesday, March 01, 2017 9:25 PM >To: Dan Williams; Doug Ledford; Sean Hefty; Hal Rosenstock; >jeffrey.t.kirs...@intel.com; David S. Miller; stas.yakov...@gmail.com; James E.J. >Bottomley; Martin K. Petersen; Felipe Balbi; Greg Kroah-Hartman >Cc: linux-r...@vger.kernel.org; net...@vger.kernel.org; linux- >u...@vger.kernel.org; linux-s...@vger.kernel.org; linux-kernel@vger.kernel.org; >Romain Perier; Peter Senna Tschudin >Subject: [PATCH v4 11/19] scsi: megaraid: Replace PCI pool old API > >The PCI pool API is deprecated. This commits replaces the PCI pool old API by the >appropriated function with the DMA pool API. > >Signed-off-by: Romain Perier >Reviewed-by: Peter Senna Tschudin >--- > drivers/scsi/megaraid/megaraid_mbox.c | 33 +++ > drivers/scsi/megaraid/megaraid_mm.c | 32 +++--- > drivers/scsi/megaraid/megaraid_sas_base.c | 29 +++-- > drivers/scsi/megaraid/megaraid_sas_fusion.c | 66 + > 4 files changed, 77 insertions(+), 83 deletions(-) > >diff --git a/drivers/scsi/megaraid/megaraid_mbox.c >b/drivers/scsi/megaraid/megaraid_mbox.c >index f0987f2..7dfc2e2 100644 >--- a/drivers/scsi/megaraid/megaraid_mbox.c >+++ b/drivers/scsi/megaraid/megaraid_mbox.c >@@ -1153,8 +1153,8 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) > > > // Allocate memory for 16-bytes aligned mailboxes >- raid_dev->mbox_pool_handle = pci_pool_create("megaraid mbox pool", >- adapter->pdev, >+ raid_dev->mbox_pool_handle = dma_pool_create("megaraid mbox >pool", >+ &adapter->pdev->dev, > sizeof(mbox64_t) + 16, > 16, 0); > >@@ -1164,7 +1164,7 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) > > mbox_pci_blk = raid_dev->mbox_pool; > for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { >- mbox_pci_blk[i].vaddr = pci_pool_alloc( >+ mbox_pci_blk[i].vaddr = dma_pool_alloc( > raid_dev->mbox_pool_handle, > GFP_KERNEL, > &mbox_pci_blk[i].dma_addr); >@@ -1181,8 +1181,8 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) >* share common memory pool. Passthru structures piggyback on >memory >* allocted to extended passthru since passthru is smaller of the two >*/ >- raid_dev->epthru_pool_handle = pci_pool_create("megaraid mbox >pthru", >- adapter->pdev, sizeof(mraid_epassthru_t), 128, 0); >+ raid_dev->epthru_pool_handle = dma_pool_create("megaraid mbox >pthru", >+ &adapter->pdev->dev, sizeof(mraid_epassthru_t), 128, >0); > > if (raid_dev->epthru_pool_handle == NULL) { > goto fail_setup_dma_pool; >@@ -1190,7 +1190,7 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) > > epthru_pci_blk = raid_dev->epthru_pool; > for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { >- epthru_pci_blk[i].vaddr = pci_pool_alloc( >+ epthru_pci_blk[i].vaddr = dma_pool_alloc( > raid_dev->epthru_pool_handle, > GFP_KERNEL, > &epthru_pci_blk[i].dma_addr); >@@ -1202,8 +1202,8 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) > > // Allocate memory for each scatter-gather list. Request for 512 bytes > // alignment for each sg list >- raid_dev->sg_pool_handle = pci_pool_create("megaraid mbox sg", >- adapter->pdev, >+ raid_dev->sg_pool_handle = dma_pool_create("megaraid mbox sg", >+ &adapter->pdev->dev, > sizeof(mbox_sgl64) * >MBOX_MAX_SG_SIZE, > 512, 0); > >@@ -1213,7 +1213,7 @@ megaraid_mbox_setup_dma_pools(adapter_t >*adapter) > > sg_pci_blk = raid_dev->sg_pool; > for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { >- sg_pci_blk[i].vaddr = pci_pool_alloc( >+ sg_pci_blk[i].vaddr = dma_pool_alloc( > raid_dev->sg_pool_handle, > GFP_KERNEL, > &sg_pci_blk[i].dma_addr); >@@ -1249,29 +1249,26 @@ megaraid_mbox_teardown_dma_pools(adapter_t >*adapter) > > sg_pci_blk = raid_dev->sg_pool; > for (i = 0; i < MBOX_MAX_SCSI_CMDS && sg_pci_blk[i].vaddr; i++) { >- pci_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr, >+ dma_pool_free(raid_dev->sg_pool_handle, sg_pci_blk[i].vaddr, > sg_pci_blk[i].dma_addr); > } >- if (raid_dev->sg_pool_handle) >- pci_pool_destroy(raid_dev->sg_pool_handle); >+ dma_pool_
Re: [PATCH] zram: reduce load operation in page_same_filled
Hi Sangwoo, On Thu, Mar 02, 2017 at 01:15:04PM +0900, Sangwoo wrote: > In page_same_filled function, all elements in the page is compared > with next index value. The current comparison routine compares > the (i)th and (i+1)th values of the page. > In this case, two load operaions occur for each comparison. > But if we store first value of the page stores at 'val' variable > and using it to compare with others, the load opearation is reduced. > It reduce load operation per page by up to 64times. > > Signed-off-by: Sangwoo The rule is that you should use your full name Sangwoo Park for SOB. :) Anyway, Good spot! FYI, Ccing Andrew because he merges zram patches to mmotm tree. Acked-by: Minchan Kim Thanks.
Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
Shuah Khan writes: > Hi Bamovar, > > Your original series badly broke the selftest build. I can no longer > build individual tests. For example: > > cd breakpoints/ > shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ > make > gcc breakpoint_test.c -o /breakpoint_test > /usr/bin/ld: cannot open output file /breakpoint_test: Permission denied > collect2: error: ld returned 1 exit status > ../lib.mk:54: recipe for target '/breakpoint_test' failed > make: *** [/breakpoint_test] Error 1 I also got a report of that just yesterday. You can do: $ cd tools/testing/selftests ; make TARGETS=breakpoints But it's not ideal. > commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9 > Author: bamvor.zhangj...@huawei.com > Date: Tue Nov 29 19:55:52 2016 +0800 > > selftests: enable O and KBUILD_OUTPUT > > I believe the above patch is one of the suspects. Michael fixed > some of the problems in this patch and others he sent. It is that patch which caused it yes. > At the moment individual tests will not build. > tools/testing/selftests/x86$ make > Makefile:44: warning: overriding recipe for target 'clean' > ../lib.mk:51: warning: ignoring old recipe for target 'clean' > gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall > single_step_syscall.c -lrt -ldl > /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission > denied > collect2: error: ld returned 1 exit status > Makefile:50: recipe for target '/single_step_syscall_64' failed > make: *** [/single_step_syscall_64] Error 1 > > > My guess is OUTPUT doesn't resolve in individual builds from the test > directory. > We have to get this fixed for 4.11-rc1 Yeah, OUTPUT is passed down from the top-level Makefile. > Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work. > Michael's patches depend on this. So anyway, please let me know if you > can fix this quickly. I am going to be trying a few things today as well. This seems to work, but needs some testing with and without OUTPUT set. Basically if OUTPUT is not set, assume the current directory. It should only take effect when someone builds from an individual directory, because if you build from the top level OUTPUT is already set. diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index ce96d80ad64f..9087fa949e82 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -2,6 +2,8 @@ # Makefile can operate with or without the kbuild infrastructure. CC := $(CROSS_COMPILE)gcc +OUTPUT ?= $(PWD) + TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) cheers
Re: [PATCH 2/2] HID: Remove unnecessary OOM messages
Le 01/03/2017 à 20:19, Joe Perches a écrit : diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 70b12f89a193..1ee6aac855a3 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -224,7 +224,6 @@ static int asus_start_multitouch(struct hid_device *hdev) if (!dmabuf) { ret = -ENOMEM; - hid_err(hdev, "Asus failed to alloc dma buf: %d\n", ret); return ret; } Trivial set and return value missed.
Re: mm allocation failure and hang when running xfstests generic/269 on xfs
On 03/02/2017 10:49 AM, Xiong Zhou wrote: > On Wed, Mar 01, 2017 at 04:37:31PM -0800, Christoph Hellwig wrote: >> On Wed, Mar 01, 2017 at 12:46:34PM +0800, Xiong Zhou wrote: >>> Hi, >>> >>> It's reproduciable, not everytime though. Ext4 works fine. >> On ext4 fsstress won't run bulkstat because it doesn't exist. Either >> way this smells like a MM issue to me as there were not XFS changes >> in that area recently. > Yap. > > First bad commit: > > commit 5d17a73a2ebeb8d1c6924b91e53ab2650fe86ffb > Author: Michal Hocko > Date: Fri Feb 24 14:58:53 2017 -0800 > > vmalloc: back off when the current task is killed > > Reverting this commit on top of > e5d56ef Merge tag 'watchdog-for-linus-v4.11' > survives the tests. Does fsstress test or the system hang ? I am not familiar with this code but If it's the test which is getting hung and its hitting this new check introduced by the above commit that means the requester is currently being killed by OOM killer for some other memory allocation request. Then is not this kind if memory alloc failure expected ?
Re: mm allocation failure and hang when running xfstests generic/269 on xfs
On 2017/3/2 13:19, Xiong Zhou wrote: > On Wed, Mar 01, 2017 at 04:37:31PM -0800, Christoph Hellwig wrote: >> On Wed, Mar 01, 2017 at 12:46:34PM +0800, Xiong Zhou wrote: >>> Hi, >>> >>> It's reproduciable, not everytime though. Ext4 works fine. >> >> On ext4 fsstress won't run bulkstat because it doesn't exist. Either >> way this smells like a MM issue to me as there were not XFS changes >> in that area recently. > > Yap. > > First bad commit: > It looks like not a bug. >From below commit, the allocation failure print was due to current process >received SIGKILL signal. You may need to confirm whether that's the case. Regards, Bob > commit 5d17a73a2ebeb8d1c6924b91e53ab2650fe86ffb > Author: Michal Hocko > Date: Fri Feb 24 14:58:53 2017 -0800 > > vmalloc: back off when the current task is killed > > Reverting this commit on top of > e5d56ef Merge tag 'watchdog-for-linus-v4.11' > survives the tests. >
Re: [PATCH v7 0/5] usb: early: add support for early printk through USB3 debug port
* Lu Baolu wrote: > Hi Ingo, > > How about this version? Any further comments? So I have re-read the review feedback I gave on Jan 19 and found at least one thing I pointed out that you didn't address in the latest patches ... Plus please go beyond the feedback given - for example the Kconfig text contains at least one typo. Thanks, Ingo
Kernel bio layer is sending bio size more than our block device is capable of handling
Hello, We are registering bio size of our device with linux kernel with below available kernel API. blk_queue_max_hw_sectors(dev->osdev.queue, (dev->aggr_max_size >> KERNEL_SECTOR_SHIFT));. Max size of bio that our block device can handle is 106496 bytes (104KB) but linux block device is sending 262144 bytes (256 KB) which is more than we are registering with kernel. This issue we are observing in 4.4.0-59-generic kernel version. Until this we had not seen this issue. So does anything extra require to tell linux kernel or anything else need to register ? Thanks -- View this message in context: http://linux-kernel.2935.n7.nabble.com/Kernel-bio-layer-is-sending-bio-size-more-than-our-block-device-is-capable-of-handling-tp1381843.html Sent from the Linux Kernel mailing list archive at Nabble.com.
Re: Problem with RSA test from testmgr
Am Donnerstag, 2. März 2017, 03:15:13 CET schrieb Tadeusz Struk: Hi Tadeusz, > > memset(ptextp, 0, 256); > memcpy(ptextp + 64 - 8, ptext_ex, plen); I actually have tested that and it did not return the data the kernel implementation would return Ciao Stephan
Re: [PATCH] [RFC] x86: avoid -mtune=atom for objtool warnings
* Josh Poimboeuf wrote: > On Wed, Mar 01, 2017 at 11:42:54PM +0100, Arnd Bergmann wrote: > > On Wed, Mar 1, 2017 at 5:53 PM, Josh Poimboeuf wrote: > > > On Wed, Mar 01, 2017 at 04:27:29PM +0100, Arnd Bergmann wrote: > > > > > I see no apparent reason for the ud2. > > > > It's the possible division by zero. This change would avoid the ud2: > > > > diff --git a/drivers/i2c/busses/i2c-img-scb.c > > b/drivers/i2c/busses/i2c-img-scb.c > > index db8e8b40569d..a2b09c518225 100644 > > --- a/drivers/i2c/busses/i2c-img-scb.c > > +++ b/drivers/i2c/busses/i2c-img-scb.c > > @@ -1196,6 +1196,8 @@ static int img_i2c_init(struct img_i2c *i2c) > > clk_khz /= prescale; > > > > /* Setup the clock increment value */ > > + if (clk_khz < 1) > > + clk_khz = 1; > > inc = (256 * 16 * bitrate_khz) / clk_khz; > > > > /* > > Ok, I see what gcc is doing. > > clk_khz = clk_get_rate(i2c->scb_clk) / 1000; > ... > inc = (256 * 16 * bitrate_khz) / clk_khz; > > Because CONFIG_HAVE_CLK isn't set, clk_get_rate() returns 0, which means > clk_khz is always zero, so the last statement *always* results in a > divide-by-zero. So that looks like a bug in the code. > > However, I'm baffled by how gcc handles it. Instead of: > > a) reporting a compile-time warning/error; or > > b) letting the #DE (divide error) exception happen; > > it inserts a 'ud2', resulting in a #UD (invalid opcode). Why?!? Well, technically an invalid opcode is shorter code than generating an (integer) division by zero exception, right? Thanks, Ingo
Re: Problem with RSA test from testmgr
On Wed, Mar 01, 2017 at 04:07:17PM +0100, Stephan Müller wrote: > Am Mittwoch, 1. März 2017, 13:04:14 CET schrieb Corentin Labbe: > > Hi Corentin, > > > > > I got the following: > > > > [1.086228] alg: akcipher: encrypt test failed. Invalid output > > [1.092196] : 6e 7c 8a 75 e7 30 80 d1 5e ab 9b db a2 cf ed db > > [1.098882] 0010: c9 b2 db 43 bd 9a b9 75 27 f3 73 d9 73 b7 81 8c > > [1.105524] 0020: 49 e8 45 fc 43 44 f5 6d f0 f7 b8 f2 ae 6b ae 49 > > [1.112090] 0030: 1b 8e 50 c6 88 4e 99 09 78 14 f2 5d 99 c3 7f f9 > > [1.118747] alg: akcipher: test 1 failed for rsa-generic, err=-22 > > (Exactly the output of my hardare and openssl test) > > > > So the problem is just that my hardware does not handle non-padded data. > > I guess the best course of action would be to patch the test vector to use > the > padded data. > > Ciao > Stephan I am finishing a patch that made testmgr test both (padded and unpadded). Regards Corentin Labbe
[PATCH V3 4/4] serial: sprd: adjust TIMEOUT to a big value
From: Wei Qiao SPRD_TIMEOUT was 256, which is too small to wait until the status switched to workable in a while loop, so that the earlycon could not work correctly. Signed-off-by: Wei Qiao Signed-off-by: Chunyan Zhang --- drivers/tty/serial/sprd_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 699447a..cc1a55e 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -36,7 +36,7 @@ #define SPRD_FIFO_SIZE 128 #define SPRD_DEF_RATE 2600 #define SPRD_BAUD_IO_LIMIT 300 -#define SPRD_TIMEOUT 256 +#define SPRD_TIMEOUT 256000 /* the offset of serial registers and BITs for them */ /* data registers */ -- 2.7.4
[PATCH] selftests: lib.mk Fix individual test builds
In commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT"), added support to generate compile targets in a user specified directory. OUTPUT variable controls the location which is undefined when tests are built in the test directory or with "make -C tools/testing/selftests/x86". make -C tools/testing/selftests/x86/ make: Entering directory '/lkml/linux_4.11/tools/testing/selftests/x86' Makefile:44: warning: overriding recipe for target 'clean' ../lib.mk:51: warning: ignoring old recipe for target 'clean' gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall single_step_syscall.c -lrt -ldl /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied collect2: error: ld returned 1 exit status Makefile:50: recipe for target '/single_step_syscall_64' failed make: *** [/single_step_syscall_64] Error 1 make: Leaving directory '/lkml/linux_4.11/tools/testing/selftests/x86' Same failure with "cd tools/testing/selftests/x86/;make" run. Fix this with a change to lib.mk to define OUTPUT to be the pwd when MAKELEVEL is 0. This covers both cases mentioned above. Reported-by: Ingo Molnar Signed-off-by: Shuah Khan --- tools/testing/selftests/lib.mk | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index ce96d80..775c589 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -2,6 +2,10 @@ # Makefile can operate with or without the kbuild infrastructure. CC := $(CROSS_COMPILE)gcc +ifeq (0,$(MAKELEVEL)) +OUTPUT := $(shell pwd) +endif + TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) -- 2.7.4
[PULL] vhost: cleanups and fixes
The following changes since commit c470abd4fde40ea6a0846a2beab642a578c0b8cd: Linux 4.10 (2017-02-19 14:34:00 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus for you to fetch changes up to c4baad50297d84bde1a7ad45e50c73adae4a2192: virtio-console: avoid DMA from stack (2017-03-02 01:35:06 +0200) virtio, vhost: optimizations, fixes Looks like a quiet cycle for vhost/virtio, just a couple of minor tweaks. Most notable is automatic interrupt affinity for blk and scsi. Hopefully other devices are not far behind. Signed-off-by: Michael S. Tsirkin Christoph Hellwig (9): virtio_pci: remove struct virtio_pci_vq_info virtio_pci: use shared interrupts for virtqueues virtio_pci: don't duplicate the msix_enable flag in struct pci_dev virtio_pci: simplify MSI-X setup virtio: allow drivers to request IRQ affinity when creating VQs virtio: provide a method to get the IRQ affinity mask for a virtqueue blk-mq: provide a default queue mapping for virtio device virtio_blk: use virtio IRQ affinity virtio_scsi: use virtio IRQ affinity Jason Wang (2): vhost: try avoiding avail index access when getting descriptor vhost: introduce O(1) vq metadata cache Michael S. Tsirkin (1): virtio_mmio: expose header to userspace Omar Sandoval (1): virtio-console: avoid DMA from stack block/Kconfig | 5 + block/Makefile | 1 + block/blk-mq-virtio.c | 54 + drivers/block/virtio_blk.c | 14 +- drivers/char/virtio_console.c | 14 +- drivers/crypto/virtio/virtio_crypto_core.c | 2 +- drivers/gpu/drm/virtio/virtgpu_kms.c | 2 +- drivers/misc/mic/vop/vop_main.c| 2 +- drivers/net/caif/caif_virtio.c | 3 +- drivers/net/virtio_net.c | 2 +- drivers/remoteproc/remoteproc_virtio.c | 3 +- drivers/rpmsg/virtio_rpmsg_bus.c | 2 +- drivers/s390/virtio/kvm_virtio.c | 3 +- drivers/s390/virtio/virtio_ccw.c | 3 +- drivers/scsi/virtio_scsi.c | 127 +- drivers/vhost/vhost.c | 173 + drivers/vhost/vhost.h | 8 + drivers/virtio/virtio_balloon.c| 3 +- drivers/virtio/virtio_input.c | 3 +- drivers/virtio/virtio_mmio.c | 5 +- drivers/virtio/virtio_pci_common.c | 376 - drivers/virtio/virtio_pci_common.h | 50 +--- drivers/virtio/virtio_pci_legacy.c | 9 +- drivers/virtio/virtio_pci_modern.c | 17 +- include/linux/blk-mq-virtio.h | 10 + include/linux/cpuhotplug.h | 1 - include/linux/virtio_config.h | 12 +- include/uapi/linux/Kbuild | 1 + include/{ => uapi}/linux/virtio_mmio.h | 0 include/uapi/linux/virtio_pci.h| 2 +- net/vmw_vsock/virtio_transport.c | 3 +- 31 files changed, 456 insertions(+), 454 deletions(-) create mode 100644 block/blk-mq-virtio.c create mode 100644 include/linux/blk-mq-virtio.h rename include/{ => uapi}/linux/virtio_mmio.h (100%)
RE: [PATCH v5 06/13] lockdep: Implement crossrelease feature
> -Original Message- > From: Matthew Wilcox [mailto:wi...@infradead.org] > Sent: Thursday, March 02, 2017 1:20 PM > To: Peter Zijlstra > Cc: Byungchul Park; mi...@kernel.org; t...@linutronix.de; > wal...@google.com; boqun.f...@gmail.com; kir...@shutemov.name; linux- > ker...@vger.kernel.org; linux...@kvack.org; iamjoonsoo@lge.com; > a...@linux-foundation.org; npig...@gmail.com > Subject: Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature > > On Tue, Feb 28, 2017 at 07:15:47PM +0100, Peter Zijlstra wrote: > > (And we should not be returning to userspace with locks held anyway -- > > lockdep already has a check for that). > > Don't we return to userspace with page locks held, eg during async > directio? Hello, I think that the check when returning to user with crosslocks held should be an exception. Don't you think so? Thanks, Byungchul
Re: [PATCH] mm: free reserved area's memmap if possiable
On 2017/3/1 18:41, Jisheng Zhang wrote: Add Chen, Catalin On Thu, 16 Feb 2017 09:11:29 +0800 zhouxianrong wrote: On 2017/2/15 15:10, Ard Biesheuvel wrote: On 15 February 2017 at 01:44, zhouxianrong wrote: On 2017/2/14 17:03, Ard Biesheuvel wrote: On 14 February 2017 at 06:53, wrote: From: zhouxianrong just like freeing no-map area's memmap (gaps of memblock.memory) we could free reserved area's memmap (areas of memblock.reserved) as well only when user of reserved area indicate that we can do this in drivers. that is, user of reserved area know how to use the reserved area who could not memblock_free or free_reserved_xxx the reserved area and regard the area as raw pfn usage by kernel. the patch supply a way to users who want to utilize the memmap memory corresponding to raw pfn reserved areas as many as possible. users can do this by memblock_mark_raw_pfn interface which mark the reserved area as raw pfn and tell free_unused_memmap that this area's memmap could be freeed. Could you give an example how much memory we actually recover by doing this? I understand it depends on the size of the reserved regions, but I'm sure you have an actual example that inspired you to write this patch. i did statistics in our platform, the memmap of reserved region that can be freed is about 6MB. it's fewer. <...> In any case, it is good to emphasize that on 4 KB pagesize kernels, we will only free multiples of 8 MB that are 8 MB aligned, resulting in 128 KB of memmap backing to be released. + if (start < end) + free_memmap(start, end); + } } #endif /* !CONFIG_SPARSEMEM_VMEMMAP */ diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 5b759c9..9f8d277 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -26,6 +26,7 @@ enum { MEMBLOCK_HOTPLUG= 0x1, /* hotpluggable region */ MEMBLOCK_MIRROR = 0x2, /* mirrored region */ MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */ + MEMBLOCK_RAW_PFN= 0x8, /* region whose memmap never be used */ I think we should be *very* careful about the combinatorial explosion that results when combining all these flags, given that this is not a proper enum but a bit field. In any case, the generic memblock change should be in a separate patch from the arm64 change. MEMBLOCK_RAW_PFN and MEMBLOCK_NOMAP can not be set at the same time They should not. But if I call memblock_mark_raw_pfn() on a MEMBLOCK_NOMAP region, it will have both flags set. In summary, I don't think we need this patch. And if you can convince us otherwise, you should really be more methodical and explicit in implementing this RAW_PFN flag, not add it as a byproduct of the arch code that uses it. Also, you should explain how RAW_PFN relates to NOMAP, and ensure that RAW_PFN and NOMAP regions don't intersect if that is an unsupported combination. yes, setting both MEMBLOCK_RAW_PFN and MEMBLOCK_NOMAP could meet some problems when gaps of memblock.memory intersect memblock.reserved. if they do not intersect, that's ok. so as you said this should be carefully considered. as you think this patch is not needed because, i have showed my idea, it's enough, thanks! we are also interested in this area. Just curious, is this patch to "free the vmemmap holes" mentioned by by Catalin in [1]? free the vmemmap of reserved memblock (other than no-map regions) whose driver owner know it is never be used. [1]http://lkml.iu.edu/hypermail/linux/kernel/1604.1/03036.html .
Re: [PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt()
From: Alexander Potapenko Date: Wed, 1 Mar 2017 12:57:20 +0100 > KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of > uninitialized memory in packet_bind_spkt(): ... > This happens because addr.sa_data copied from the userspace is not > zero-terminated, and copying it with strlcpy() in packet_bind_spkt() > results in calling strlen() on the kernel copy of that non-terminated > buffer. > > Signed-off-by: Alexander Potapenko > --- > Changes since v3: > - addressed comments by Eric Dumazet (avoid using constants, >use memcpy() instead of strncpy()) Applied and queued up for -stable.
Re: [PATCH v2 1/3] perf annotate: Get correct line numbers matched with addr
On 03/01/2017 10:17 PM, Namhyung Kim wrote: Hi Taeung, On Wed, Mar 01, 2017 at 04:59:51AM +0900, Taeung Song wrote: Currently perf-annotate show wrong line numbers. For example, Actual source code is as below ... 21 }; 22 23 unsigned int limited_wgt; 24 25 unsigned int get_cond_maxprice(int wgt) 26 { ... However, the output of perf-annotate is as below. 4 Disassembly of section .text: 6 00400966 : 7 get_cond_maxprice(): 26 }; 28 unsigned int limited_wgt; 30 unsigned int get_cond_maxprice(int wgt) 31 { The cause is the wrong way counting line numbers in symbol__parse_objdump_line(). So remove wrong current code counting line number and use other method for it using functions related to addr2line instead of the output of '-l' of objdump. Hmm.. do you think it's a bug of objdump or it's perf failing to parse the line number correctly? I'd like to see the output of `objdump -l` Both are ok. 'objdump -l' hasn't a bug related to line number and perf's method parsing the line number is ok. But symbol__parse_objdump_line() wrongly count line numbers after parsing it as below. 1172 /* /filename:linenr ? Save line number and ignore. */ 1173 if (regexec(&file_lineno, line, 2, match, 0) == 0) { 1174 *line_nr = atoi(line + match[1].rm_so); 1175 return 0; 1176 } ... 1208 dl = disasm_line__new(offset, parsed_line, privsize, *line_nr, arch, map); 1209 free(line); 1210 (*line_nr)++; Increasing line_nr each asm line is wrong method. Because 'line_nr' means actual source code line number. Sure, I can fix only the wrong counting way. But the above parsing method(1172~1176) is never used because of 'grep -v' in command as below. (the grep already remove lines containing filename:linenr of output) 1435 snprintf(command, sizeof(command), 1436 "%s %s%s --start-address=0x%016" PRIx64 1437 " --stop-address=0x%016" PRIx64 1438 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", 1439 objdump_path ? objdump_path : "objdump", 1440 disassembler_style ? "-M " : "", 1441 disassembler_style ? disassembler_style : "", 1442 map__rip_2objdump(map, sym->start), 1443 map__rip_2objdump(map, sym->end), 1444 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw", 1445 symbol_conf.annotate_src ? "-S" : "", 1446 symfs_filename, symfs_filename); Therefore, I think it is better to do three things 1) fix the wrong counting line number problem 2) remove unused the line number parsing method 3) In addtion, a bit reduce objdump dependency using functions related to addr2line of perf. What do you think about that ? Is it bad idea ? However, despite the correct line numbers, we can't show proper source code view because of limitations from output of 'objdump -S'. So, next commit will resolve the limitations from 'objdump -S' with the new source code view. It seems not related with this commit.. Okey, will remove the mention. Thanks, Taeung
Re: [RFC PATCH] printk: Make functions of pr_ macros
On Thu, 2017-03-02 at 14:35 +0900, Sergey Senozhatsky wrote: > Hello Joe, > > On (02/28/17 19:17), Joe Perches wrote: > > Can save the space that the KERN_ headers require. > > > > The biggest negative here is the %pV use which needs > > recursion and adds stack depth. > > > > $ size vmlinux.o* (defconfig, x86-64) > >text data bss dec hex filename > > 12586135 1909841 777528 15273504 e90e20 vmlinux.o.new > > 12590348 1909841 777528 15277717 e91e95 vmlinux.o.old > > interesting. 4K. Yeah, more when more calls are converted, Maybe more like 12k, still the goal is to create singletons for the pr_fmt prefixes and whatever __func__ uses that are most common via a SOH + flag and using __builtin_return_address where possible and appropriate. That could shrink another 10k or so. > [..] > > +#define define_pr_func(func, level)\ > > +asmlinkage __visible int func(const char *fmt, ...)\ > > +{ \ > > + va_list args; \ > > + int r; \ > > + struct va_format vaf; \ > > + \ > > + va_start(args, fmt);\ > > + vaf.fmt = fmt; \ > > + vaf.va = &args; \ > > + \ > > + r = printk(level "%pV", &vaf); \ > > + \ > > + va_end(args); \ > > + \ > > + return r; \ > > +} \ > > hm. that's really hacky (which is a compliment) and a bit complicated. > my quick thought was to tweak vprintk_emit() for 'facility != 0' so it > could get loglevel (and adjust lflags) from the passed level, not from > the text, and then do something like this > #define define_pr_func(func, level) asmlinkage __visible int func(const char > *fmt, ...) > { > va_start(args, fmt); > r = vprintk_emit(level[0], level[1], NULL, 0, fmt, args); > va_end(); > } > > but this won't do the trick. because func()->vprintk_emit() shortcut > disables the printk-safe mechanism: > func()->printk()->vprintk_func()->this_cpu(printk_context)::print() That was what I had done originally a while ago https://lkml.org/lkml/2016/6/23/652 Now the with "safe" version, it's a bit more complicated. [stack depth can be high, ~400 bytes per recursion] > dunno, at the moment I'm not really comfortable with %pV recursion > for every pr_foo() call Me neither really. I'd much prefer a direct vprintk_emit.
[PATCH] pinctrl: rockchip: add irq_enable & irq_disable ops
Currently we are trying to enable/disable the clk of irq's gpio bank when unmask/mask irq. But the kernel's "lazy disable approach" will skip masking irq when the irq chip doesn't support irq_disable ops. So we may hit this case: irq_enable-> enable clk irq_disable-> noop irq_enable-> enable clk again irq_disable-> noop Signed-off-by: Jeffy Chen --- drivers/pinctrl/pinctrl-rockchip.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 7813599..a9a7dfa 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2061,7 +2061,7 @@ static void rockchip_irq_resume(struct irq_data *d) clk_disable(bank->clk); } -static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d) +static void rockchip_irq_enable(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; @@ -2070,7 +2070,7 @@ static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d) irq_gc_mask_clr_bit(d); } -static void rockchip_irq_gc_mask_set_bit(struct irq_data *d) +static void rockchip_irq_disable(struct irq_data *d) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct rockchip_pin_bank *bank = gc->private; @@ -2137,9 +2137,10 @@ static int rockchip_interrupts_register(struct platform_device *pdev, gc->chip_types[0].regs.mask = GPIO_INTMASK; gc->chip_types[0].regs.ack = GPIO_PORTS_EOI; gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit; - gc->chip_types[0].chip.irq_mask = rockchip_irq_gc_mask_set_bit; - gc->chip_types[0].chip.irq_unmask = - rockchip_irq_gc_mask_clr_bit; + gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit; + gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit; + gc->chip_types[0].chip.irq_enable = rockchip_irq_enable; + gc->chip_types[0].chip.irq_disable = rockchip_irq_disable; gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend; gc->chip_types[0].chip.irq_resume = rockchip_irq_resume; -- 2.1.4
Re: net: use-after-free in neigh_timer_handler/sock_wfree
On Wed, Mar 1, 2017 at 9:25 PM, Cong Wang wrote: > On Wed, Mar 1, 2017 at 3:15 PM, Eric Dumazet wrote: >> On Wed, Mar 1, 2017 at 3:09 PM, Cong Wang wrote: >> >>> >>> But I doubt skb_orphan() is the solution here, shouldn't we just >>> update sk->sk_wmem_alloc with skb->truesize changes? >> >> Is it worth it ? Apart from syszkaller I mean... >> >> We started with something that had a real impact on real workloads. >> >> 158f323b9868b59967ad96957c4ca388161be321 net: adjust skb->truesize in >> pskb_expand_head() >> >> Note that auditing the stack took me a while. > > I don't know how sk refcnt could work correctly without making > sk_wmem_alloc correctly. We certainly could just call skb_orphan() > is we don't need skb->sk any more, probably like the frag case, > but for this case, the neigh one, the skb's sitting in neigh->arp_queue > are not going to be freed unless in failed case, therefore skb->sk > should not be orphaned so early. There is absolutely no issue in arp/nd case. Many skbs can sit there and it is fine. Same with skbs sitting a long time in a qdisc. Of course we try to not call skb_orphan() unless really needed. tcp_gso_segment() tries very hard to propagate skb ownership to the segments, but even something apparently easy like that took some patches before being done right. (for details : 0d08c42cf9a71530fef5ebcfe368f38f2dd0476f "tcp: gso: fix truesize tracking") conntrack reasm is mostly used in forwarding workloads, where skb->sk is already NULL. Are you thinking of a real workload where skb->sk _needs_ to be kept in ipv6 reasm ?
Re: [f2fs-dev] [PATCH RFC] f2fs: combine nat_bits and free_nid_bitmap cache
On 3/2/2017 09:35, Chao Yu wrote: > On 2017/3/1 21:09, Kinglong Mee wrote: >> On 3/1/2017 17:10, Chao Yu wrote: >>> Both nat_bits cache and free_nid_bitmap cache provide same functionality >>> as a intermediate cache between free nid cache and disk, but with >>> different granularity of indicating free nid range, and different >>> persistence policy. nat_bits cache provides better persistence ability, >>> and free_nid_bitmap provides better granularity. >>> >>> In this patch we combine advantage of both caches, so finally policy of >>> the intermediate cache would be: >>> - init: load free nid status from nat_bits into free_nid_bitmap >>> - lookup: scan free_nid_bitmap before load NAT blocks >> >> Why not scan the full_nat_bits/empty_nat_bits before load NAT blocks here? >> If after an objects shrinker, the cached free nid will be empty quickly. > > Since after this patch, all nids status (free or used) of > full_nat_bits/empty_nat_bits will be loaded into free_nid_bitmap, so we can > just > check free_nid_bitmap instead of both cache before loading NAT blocks. Yes, you are right. I forgot f2fs also updates update_free_nid_bitmap in __flush_nat_entry_set. thanks, Kinglong Mee >>> - update: update free_nid_bitmap in real-time >>> - persistence: udpate and persist nat_bits in checkpoint >>> >>> Signed-off-by: Chao Yu >>> --- >>> fs/f2fs/node.c | 109 >>> + >>> 1 file changed, 39 insertions(+), 70 deletions(-) >>> >>> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >>> index 1a759d45b7e4..6c027b6833f4 100644 >>> --- a/fs/f2fs/node.c >>> +++ b/fs/f2fs/node.c >>> @@ -338,9 +338,6 @@ static void set_node_addr(struct f2fs_sb_info *sbi, >>> struct node_info *ni, >>> set_nat_flag(e, IS_CHECKPOINTED, false); >>> __set_nat_cache_dirty(nm_i, e); >>> >>> - if (enabled_nat_bits(sbi, NULL) && new_blkaddr == NEW_ADDR) >>> - clear_bit_le(NAT_BLOCK_OFFSET(ni->nid), nm_i->empty_nat_bits); >>> - >>> /* update fsync_mark if its inode nat entry is still alive */ >>> if (ni->nid != ni->ino) >>> e = __lookup_nat_cache(nm_i, ni->ino); >>> @@ -1920,58 +1917,6 @@ static void scan_free_nid_bits(struct f2fs_sb_info >>> *sbi) >>> up_read(&nm_i->nat_tree_lock); >>> } >>> >>> -static int scan_nat_bits(struct f2fs_sb_info *sbi) >>> -{ >>> - struct f2fs_nm_info *nm_i = NM_I(sbi); >>> - struct page *page; >>> - unsigned int i = 0; >>> - nid_t nid; >>> - >>> - if (!enabled_nat_bits(sbi, NULL)) >>> - return -EAGAIN; >>> - >>> - down_read(&nm_i->nat_tree_lock); >>> -check_empty: >>> - i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i); >>> - if (i >= nm_i->nat_blocks) { >>> - i = 0; >>> - goto check_partial; >>> - } >>> - >>> - for (nid = i * NAT_ENTRY_PER_BLOCK; nid < (i + 1) * NAT_ENTRY_PER_BLOCK; >>> - nid++) { >>> - if (unlikely(nid >= nm_i->max_nid)) >>> - break; >>> - add_free_nid(sbi, nid, true); >>> - } >>> - >>> - if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS) >>> - goto out; >>> - i++; >>> - goto check_empty; >>> - >>> -check_partial: >>> - i = find_next_zero_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i); >>> - if (i >= nm_i->nat_blocks) { >>> - disable_nat_bits(sbi, true); >>> - up_read(&nm_i->nat_tree_lock); >>> - return -EINVAL; >>> - } >>> - >>> - nid = i * NAT_ENTRY_PER_BLOCK; >>> - page = get_current_nat_page(sbi, nid); >>> - scan_nat_page(sbi, page, nid); >>> - f2fs_put_page(page, 1); >>> - >>> - if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) { >>> - i++; >>> - goto check_partial; >>> - } >>> -out: >>> - up_read(&nm_i->nat_tree_lock); >>> - return 0; >>> -} >>> - >>> static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool >>> mount) >>> { >>> struct f2fs_nm_info *nm_i = NM_I(sbi); >>> @@ -1993,21 +1938,6 @@ static void __build_free_nids(struct f2fs_sb_info >>> *sbi, bool sync, bool mount) >>> >>> if (nm_i->nid_cnt[FREE_NID_LIST]) >>> return; >>> - >>> - /* try to find free nids with nat_bits */ >>> - if (!scan_nat_bits(sbi) && nm_i->nid_cnt[FREE_NID_LIST]) >>> - return; >>> - } >>> - >>> - /* find next valid candidate */ >>> - if (enabled_nat_bits(sbi, NULL)) { >>> - int idx = find_next_zero_bit_le(nm_i->full_nat_bits, >>> - nm_i->nat_blocks, 0); >>> - >>> - if (idx >= nm_i->nat_blocks) >>> - set_sbi_flag(sbi, SBI_NEED_FSCK); >>> - else >>> - nid = idx * NAT_ENTRY_PER_BLOCK; >>> } >>> >>> /* readahead nat pages to be scanned */ >>> @@ -2590,6 +2520,41 @@ static int __get_nat_bitmaps(struct f2fs_sb_info >>> *sbi) >>> return 0; >>> } >
Re: [RFC PATCH] printk: Make functions of pr_ macros
Hello Joe, On (02/28/17 19:17), Joe Perches wrote: > Can save the space that the KERN_ headers require. > > The biggest negative here is the %pV use which needs > recursion and adds stack depth. > > $ size vmlinux.o* (defconfig, x86-64) >text data bss dec hex filename > 12586135 1909841 777528 15273504 e90e20 vmlinux.o.new > 12590348 1909841 777528 15277717 e91e95 vmlinux.o.old interesting. 4K. [..] > +#define define_pr_func(func, level) \ > +asmlinkage __visible int func(const char *fmt, ...) \ > +{\ > + va_list args; \ > + int r; \ > + struct va_format vaf; \ > + \ > + va_start(args, fmt);\ > + vaf.fmt = fmt; \ > + vaf.va = &args; \ > + \ > + r = printk(level "%pV", &vaf); \ > + \ > + va_end(args); \ > + \ > + return r; \ > +}\ hm. that's really hacky (which is a compliment) and a bit complicated. my quick thought was to tweak vprintk_emit() for 'facility != 0' so it could get loglevel (and adjust lflags) from the passed level, not from the text, and then do something like this #define define_pr_func(func, level) asmlinkage __visible int func(const char *fmt, ...) { va_start(args, fmt); r = vprintk_emit(level[0], level[1], NULL, 0, fmt, args); va_end(); } but this won't do the trick. because func()->vprintk_emit() shortcut disables the printk-safe mechanism: func()->printk()->vprintk_func()->this_cpu(printk_context)::print() this *probably* and *may be* works for dev_printk() /* assuming that dev_printk() is never called fomr under sched/sempahore/etc locks */, but for printk() in general it's a huge no-no-no. so I see that you did the very same thing in 99bcf217183e02ebae for dev_printk(), which is, once again, probably ok for dev_print(). and now the question is do we want to add %pV recursion to non-dev printk-s, and I'm, frankly, don't have any answers at the moment. sorry. there are already %pV pr_foo() calls in the kernel. and we even have %pV in OOM path. now those calls are going to be %pV->%pV = recursion depth 2. for example I can easily do this thing: [ 38.006766] WARNING: CPU: 2 PID: 368 at lib/vsprintf.c:1901 format_decode+0x226/0x2fd [ 38.006766] Please remove unsupported %] in format string [..] [ 38.006783] Call Trace: [ 38.006783] dump_stack+0x68/0x92 [ 38.006784] __warn+0xc2/0xdd [ 38.006784] warn_slowpath_fmt+0x4b/0x53 [ 38.006785] ? __lock_acquire+0x2ac/0x1501 [ 38.006785] format_decode+0x226/0x2fd [ 38.006786] vsnprintf+0x89/0x3b7 [ 38.006786] pointer+0x1c3/0x378 [ 38.006787] vsnprintf+0x22d/0x3b7 [ 38.006787] pointer+0x1c3/0x378 [ 38.006788] vsnprintf+0x22d/0x3b7 [ 38.006788] vscnprintf+0xd/0x26 [ 38.006788] vprintk_emit+0x81/0x294 [ 38.006789] ? 0xa0096000 [ 38.006789] vprintk_default+0x1d/0x1f [ 38.006790] vprintk_func+0x6c/0x73 [ 38.006790] ? 0xa0096000 [ 38.006791] printk+0x43/0x4b [ 38.006791] pr_cont+0x56/0x5e I wonder if it can get any worse than that. I sort of suspect it can. in trivial case, dump_stack() can add at least one more level of recursion by using pr_{err, etc.} instead of corresponding printk(KERN_{ERR, etc}. can it be even worse? um... NMI? any thoughts? dunno, at the moment I'm not really comfortable with %pV recursion for every pr_foo() call. -ss
Re: [PATCH v2] scsi: ufs: Factor out ufshcd_read_desc_param
> "Michal'" == Potomski, MichalX writes: Michal'> Since in UFS 2.1 specification some of the descriptor lengths Michal'> differs from 2.0 specification and some devices, which are Michal'> reporting spec version 2.0 have different descriptor lengths we Michal'> can not rely on hardcoded values taken from 2.0 Michal'> specification. This patch introduces reading these lengths per Michal'> each device from descriptor headers at probe time to ensure Michal'> their correctness. Applied to 4.11/scsi-fixes. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: mm allocation failure and hang when running xfstests generic/269 on xfs
On Wed, Mar 01, 2017 at 04:37:31PM -0800, Christoph Hellwig wrote: > On Wed, Mar 01, 2017 at 12:46:34PM +0800, Xiong Zhou wrote: > > Hi, > > > > It's reproduciable, not everytime though. Ext4 works fine. > > On ext4 fsstress won't run bulkstat because it doesn't exist. Either > way this smells like a MM issue to me as there were not XFS changes > in that area recently. Yap. First bad commit: commit 5d17a73a2ebeb8d1c6924b91e53ab2650fe86ffb Author: Michal Hocko Date: Fri Feb 24 14:58:53 2017 -0800 vmalloc: back off when the current task is killed Reverting this commit on top of e5d56ef Merge tag 'watchdog-for-linus-v4.11' survives the tests.
[PATCH V3 5/9] Staging: rtl8712: rtl871x_mp_ioctl.h - style fix
Fixed style of block comments Found using checkpatch Signed-off-by: Derek Robson --- Version #1 Introduced lines longer then 80 Version #2 Lacked spaces at either end of comment line drivers/staging/rtl8712/rtl871x_mp_ioctl.h | 191 - 1 file changed, 107 insertions(+), 84 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.h b/drivers/staging/rtl8712/rtl871x_mp_ioctl.h index 1102451a733d..8efa6d3388bc 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.h +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.h @@ -150,103 +150,126 @@ uint oid_rt_get_power_mode_hdl( #ifdef _RTL871X_MP_IOCTL_C_ /* CAUTION!!! */ /* This ifdef _MUST_ be left in!! */ static const struct oid_obj_priv oid_rtl_seg_81_80_00[] = { - {1, oid_null_function}, /*0x00 OID_RT_PRO_RESET_DUT */ - {1, oid_rt_pro_set_data_rate_hdl}, /*0x01*/ - {1, oid_rt_pro_start_test_hdl}, /*0x02*/ - {1, oid_rt_pro_stop_test_hdl}, /*0x03*/ - {1, oid_null_function}, /*0x04 OID_RT_PRO_SET_PREAMBLE*/ - {1, oid_null_function}, /*0x05 OID_RT_PRO_SET_SCRAMBLER*/ - {1, oid_null_function}, /*0x06 OID_RT_PRO_SET_FILTER_BB*/ - {1, oid_null_function}, /*0x07 -* OID_RT_PRO_SET_MANUAL_DIVERS_BB -*/ - {1, oid_rt_pro_set_channel_direct_call_hdl},/*0x08*/ - {1, oid_null_function}, /*0x09 - * OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL - */ - {1, oid_null_function}, /*0x0A - * OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL - */ - {1, oid_rt_pro_set_continuous_tx_hdl}, /*0x0B - * OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL - */ - {1, oid_rt_pro_set_single_carrier_tx_hdl}, /*0x0C - * OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS - */ - {1, oid_null_function}, /*0x0D - * OID_RT_PRO_SET_TX_ANTENNA_BB - */ - {1, oid_rt_pro_set_antenna_bb_hdl}, /*0x0E*/ - {1, oid_null_function}, /*0x0F OID_RT_PRO_SET_CR_SCRAMBLER*/ - {1, oid_null_function}, /*0x10 OID_RT_PRO_SET_CR_NEW_FILTER*/ - {1, oid_rt_pro_set_tx_power_control_hdl}, /*0x11 - * OID_RT_PRO_SET_TX_POWER_CONTROL - */ - {1, oid_null_function}, /*0x12 OID_RT_PRO_SET_CR_TX_CONFIG*/ - {1, oid_null_function}, /*0x13 -* OID_RT_PRO_GET_TX_POWER_CONTROL -*/ - {1, oid_null_function}, /*0x14 -* OID_RT_PRO_GET_CR_SIGNAL_QUALITY -*/ - {1, oid_null_function}, /*0x15 OID_RT_PRO_SET_CR_SETPOINT*/ - {1, oid_null_function}, /*0x16 OID_RT_PRO_SET_INTEGRATOR*/ - {1, oid_null_function}, /*0x17 OID_RT_PRO_SET_SIGNAL_QUALITY*/ - {1, oid_null_function}, /*0x18 OID_RT_PRO_GET_INTEGRATOR*/ - {1, oid_null_function}, /*0x19 OID_RT_PRO_GET_SIGNAL_QUALITY*/ - {1, oid_null_function}, /*0x1A OID_RT_PRO_QUERY_EEPROM_TYPE*/ - {1, oid_null_function}, /*0x1B OID_RT_PRO_WRITE_MAC_ADDRESS*/ - {1, oid_null_function}, /*0x1C OID_RT_PRO_READ_MAC_ADDRESS*/ - {1, oid_null_function}, /*0x1D OID_RT_PRO_WRITE_CIS_DATA*/ - {1, oid_null_function}, /*0x1E OID_RT_PRO_READ_CIS_DATA*/ - {1, oid_null_function} /*0x1F OID_RT_PRO_WRITE_POWER_CONTROL*/ + /* 0x00 OID_RT_PRO_RESET_DUT */ + {1, oid_null_function}, + /* 0x01 */ + {1, oid_rt_pro_set_data_rate_hdl}, + /* 0x02 */ + {1, oid_rt_pro_start_test_hdl}, + /* 0x03 */ + {1, oid_rt_pro_stop_test_hdl}, + /* 0x04 OID_RT_PRO_SET_PREAMBLE */ + {1, oid_null_function}, + /* 0x05 OID_RT_PRO_SET_SCRAMBLER */ + {1, oid_null_function}, + /* 0x06 OID_RT_PRO_SET_FILTER_BB */ + {1, oid_null_function}, + /* 0x07 OID_RT_PRO_SET_MANUAL_DIVERS_BB */ + {1, oid_null_function}, + /* 0x08 */ + {1, oid_rt_pro_set_channel_direct_call_hdl}, + /* 0x09 OID_RT_PRO_SET_SLEEP_MODE_DIRECT_CALL */ + {1, oid_null_function}, + /* 0x0A OID_RT_PRO_SET_WAKE_MODE_DIRECT_CALL */ + {1, oid_null_function}, + /* 0x0B OID_RT_PRO_SET_TX_CONTINUOUS_DIRECT_CALL */ + {1, oid_rt_pro_set_continuous_tx_hdl}, + /* 0x0C OID_RT_PRO_SET_SINGLE_CARRIER_TX_CONTINUOUS */ + {1, oid_rt_pro_set_single_carrier_tx_hdl}, + /* 0x0D OID_RT_PRO_SET_TX_ANTENNA_BB */ + {1, oid_null_function}, +
Re: net: use-after-free in neigh_timer_handler/sock_wfree
On Wed, Mar 1, 2017 at 3:15 PM, Eric Dumazet wrote: > On Wed, Mar 1, 2017 at 3:09 PM, Cong Wang wrote: > >> >> But I doubt skb_orphan() is the solution here, shouldn't we just >> update sk->sk_wmem_alloc with skb->truesize changes? > > Is it worth it ? Apart from syszkaller I mean... > > We started with something that had a real impact on real workloads. > > 158f323b9868b59967ad96957c4ca388161be321 net: adjust skb->truesize in > pskb_expand_head() > > Note that auditing the stack took me a while. I don't know how sk refcnt could work correctly without making sk_wmem_alloc correctly. We certainly could just call skb_orphan() is we don't need skb->sk any more, probably like the frag case, but for this case, the neigh one, the skb's sitting in neigh->arp_queue are not going to be freed unless in failed case, therefore skb->sk should not be orphaned so early.
Re: [PATCH v4 10/11] drivers: perf: hisi: Handle counter overflow IRQ in MN PMU
On Friday 24 February 2017 08:34 AM, Anurup M wrote: +static int hisi_mn_init_irqs_fdt(struct device *dev, +struct hisi_pmu *mn_pmu) +{ +struct hisi_mn_data *mn_data = mn_pmu->hwmod_data; +struct hisi_djtag_client *client = mn_data->client; +int irq = -1, num_irqs, i; + +num_irqs = of_irq_count(dev->of_node); Surely we expect a specific number of interrupts? +for (i = 0; i < num_irqs; i++) { +irq = of_irq_get(dev->of_node, i); +if (irq < 0) +dev_info(dev, "No IRQ resource!\n"); +} Why are we throwing these away? + +if (irq < 0) +return 0; + +/* The last entry in the IRQ list to be chosen + * This is as per mbigen-v2 IRQ mapping + */ +return hisi_mn_init_irq(irq, mn_pmu, client); I don't understand this comment. Why do we only use the list IRQ? What does this have to do with the mbigen? No ordering requirement was described in the DT binding. There is a defect in the mbigen hardware to handle the IRQ mapping for MN. Due to this the IRQ property of MN is made as a list and we read all IRQs and use only the last one. I shall mention it in the comment and also add note in the DT bindings. You'll need to elaborate on that a bit further; I don't understand. If the interrupts aren't usable, there's arguably not much point listing them in the DT. Regardless, the order of the list *must* be specified in the DT binding. I'm sorry for creating this confusion. It was a wrong workaround due to my misunderstanding of the IRQ mapping. The MN will use a single IRQ for overflow in HiP07. I shall update it and resend. But in HiP05/06 there is no support for this IRQ, So I shall modify to use polling when IRQ is not available. On further tests it is confirmed that the MN interrupt line is broken in hardware. so the driver will only use poll method. I shall remove the IRQ support and resubmit adding poll method. Thanks, Anurup Thanks, Anurup Thanks, Mark.
Re: Regression in 4.11 - PowerPC crashes on boot, bisected to commit 5657933dbb6e
On Thu, 2017-03-02 at 16:14 +1100, Benjamin Herrenschmidt wrote: > On Wed, 2017-03-01 at 21:26 -0600, Larry Finger wrote: > > My Powerbook G4 Aluminum generates a fatal splat early in the boot process, > > just > > after identifying the driver for the disk. Unfortunately, it turns off > > almost > > immediately, thus I cannot report the message. After this bug has been > > triggered, the system clock has been reset to Dec. 31, 1969. I assume this > > is a > > side effect of an uncontrolled DMA operation. > > > > This problem has been bisected to commit 5657933dbb6e ("treewide: Move > > dma_ops > > from struct dev_archdata into struct device"). > > Side effect of a crash during boot... the PMU gets upset when we crash while > there's a request in flight, that's probably what is happening. > > As to why that commit is broken, I don't have time to look into it right now, > maybe next week of nobody beats me to it. Hello Ben, Thanks. I will try to reproduce what has been reported with qemu-ppc on Friday to double check that it's really commit 5657933dbb6e that is causing this. I reread it but couldn't find any reason why it works on x86-64 but not on powerpc. BTW, the following patch is needed on at least s390 but probably also on powerpc to restore InfiniBand support: http://marc.info/?l=linux-rdma&m=148823342415501&w=2. This is why I asked for the kernel config. Bart.
Re: [RESEND PATCH v7 0/7] Rockchip dw-mipi-dsi driver
On Mon, Feb 20, 2017 at 04:02:16PM +0800, Chris Zhong wrote: > Hi all > > [Resend this v7 version series, since there are 5 mails have gone missing, > last > week] > > This version does not change the existing v6 patches, just to add the > "bandwidth fix" patch back, since we really need it. > > This patch serial is for RK3399 MIPI DSI. The MIPI DSI controller of > RK3399 is almost the same as RK3288, except a little bit of difference > in phy clock controlling and port id selection register. These patches > add RK3399 support and the power domain support. > > And these patches base on John Keeping's v3 patches[0], it fixes many bugs, > they have been tested on rk3288 evb board. > > [0]: > [01/24] https://patchwork.kernel.org/patch/9544089 > [02/24] https://patchwork.kernel.org/patch/9544061 > [03/24] https://patchwork.kernel.org/patch/9544065 > [04/24] https://patchwork.kernel.org/patch/9544077 > [05/24] https://patchwork.kernel.org/patch/9544033 > [06/24] https://patchwork.kernel.org/patch/9544037 > [07/24] https://patchwork.kernel.org/patch/9544029 > [08/24] https://patchwork.kernel.org/patch/9544031 > [09/24] https://patchwork.kernel.org/patch/9544083 > [10/24] https://patchwork.kernel.org/patch/9544063 > [11/24] https://patchwork.kernel.org/patch/9544085 > [12/24] https://patchwork.kernel.org/patch/9544093 > [13/24] https://patchwork.kernel.org/patch/9544081 > [14/24] https://patchwork.kernel.org/patch/9544057 > [15/24] https://patchwork.kernel.org/patch/9544079 > [16/24] https://patchwork.kernel.org/patch/9544035 > [17/24] https://patchwork.kernel.org/patch/9544105 > [18/24] https://patchwork.kernel.org/patch/9544059 > [21/24] https://patchwork.kernel.org/patch/9544009 > [22/24] https://patchwork.kernel.org/patch/9544049 > [23/24] https://patchwork.kernel.org/patch/9544055 > [24/24] https://patchwork.kernel.org/patch/9544109 > > > Changes in v6: > - no need check phy_cfg_clk before enable/disable > > Changes in v5: > - check the error of phy_cfg_clk in dw_mipi_dsi_bind > > Changes in v4: > - remove the unrelated change > > Changes in v3: > - base on John Keeping's patch series > > Chris Zhong (7): > dt-bindings: add rk3399 support for dw-mipi-rockchip > drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi > drm/rockchip/dsi: dw-mipi: correct the coding style > drm/rockchip/dsi: remove mode_valid function > dt-bindings: add power domain node for dw-mipi-rockchip > drm/rockchip/dsi: fix insufficient bandwidth of some panel > drm/rockchip/dsi: add dw-mipi power domain support Applied to drm-misc Thanks, Sean > > .../display/rockchip/dw_mipi_dsi_rockchip.txt | 7 +- > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 160 > - > 2 files changed, 100 insertions(+), 67 deletions(-) > > -- > 2.6.3 > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt()
On Wed, Mar 1, 2017 at 3:57 AM, Alexander Potapenko wrote: > This happens because addr.sa_data copied from the userspace is not > zero-terminated, and copying it with strlcpy() in packet_bind_spkt() > results in calling strlen() on the kernel copy of that non-terminated > buffer. Very similar to commit b301f2538759933cf9ff1f7c4f968da72e3f0757 Author: Pablo Neira Ayuso Date: Thu Mar 24 21:29:53 2016 +0100 netfilter: x_tables: enforce nul-terminated table name from getsockopt GET_ENTRIES
Re: Regression in 4.11 - PowerPC crashes on boot, bisected to commit 5657933dbb6e
On Wed, 2017-03-01 at 21:26 -0600, Larry Finger wrote: > My Powerbook G4 Aluminum generates a fatal splat early in the boot process, > just > after identifying the driver for the disk. Unfortunately, it turns off almost > immediately, thus I cannot report the message. After this bug has been > triggered, the system clock has been reset to Dec. 31, 1969. I assume this is > a > side effect of an uncontrolled DMA operation. > > This problem has been bisected to commit 5657933dbb6e ("treewide: Move > dma_ops > from struct dev_archdata into struct device"). Side effect of a crash during boot... the PMU gets upset when we crash while there's a request in flight, that's probably what is happening. As to why that commit is broken, I don't have time to look into it right now, maybe next week of nobody beats me to it. Cheers, Ben.
[PATCH v14 2/5] iio: adc: mxs-lradc: Add support for adc driver
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic Reviewed-by: Jonathan Cameron Reviewed-by: Marek Vasut --- Changes in v14: - fix checkpatch warnings Changes in v13: - none Changes in v12: - none Changes in v11: - use dev_get_drvdata instead dev_get_platdata - use writel instead mxs_lradc_reg_* functions Changes in v10: - none Changes in v9: - none Changes in v8: - rebase onto 4.9-rc1 Changes in v7: - none Changes in v6: - update copyright Changes in v5: - add field void __iomem *base to struct mxs_lradc_adc - change arguments in all functions for accessing I/O memory to follow the previous change. - use devm_ioremap for mapping I/O memory Changes in v4: - update copyright - use platform_get_irq_byname - use irq_of_parse_and_map Changes in v3: - make buffer large enough for timestamps - remove unnecessary blank lines Changes in v2: - improve commit message - do not change spacing in Kconfig - impove formating - remove wrapper show_scale_avail - use correct syntax for comments - use devm_iio_trigger_alloc - do not allocate buffer dynamically - use iio_device_claim_*_mode helpers - add spinlock in struct mxs_lradc_ts to enable locking in interrupt handler - only grab irqs that are relevant to adc - remove blank line at the end of the file - change licence to GPL - add copyright drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile| 1 + drivers/iio/adc/mxs-lradc-adc.c | 843 3 files changed, 857 insertions(+) create mode 100644 drivers/iio/adc/mxs-lradc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index dedae7a..97a3803 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -229,6 +229,19 @@ config EXYNOS_ADC To compile this driver as a module, choose M here: the module will be called exynos_adc. +config MXS_LRADC_ADC + tristate "Freescale i.MX23/i.MX28 LRADC ADC" + depends on MFD_MXS_LRADC + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for the ADC functions of the + i.MX23/i.MX28 LRADC. This includes general-purpose ADC readings, + battery voltage measurement, and die temperature measurement. + + This driver can also be built as a module. If so, the module will be + called mxs-lradc-adc. + config FSL_MX25_ADC tristate "Freescale MX25 ADC driver" depends on MFD_MX25_TSADC diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index d001262..38f0e15 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_MCP3422) += mcp3422.o obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o obj-$(CONFIG_MESON_SARADC) += meson_saradc.o +obj-$(CONFIG_MXS_LRADC_ADC) += mxs-lradc-adc.o obj-$(CONFIG_MXS_LRADC) += mxs-lradc.o obj-$(CONFIG_NAU7802) += nau7802.o obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c new file mode 100644 index 000..b0c7d8e --- /dev/null +++ b/drivers/iio/adc/mxs-lradc-adc.c @@ -0,0 +1,843 @@ +/* + * Freescale MXS LRADC ADC driver + * + * Copyright (c) 2012 DENX Software Engineering, GmbH. + * Copyright (c) 2017 Ksenija Stanojevic + * + * Authors: + * Marek Vasut + * Ksenija Stanojevic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +/* + * Make this runtime configurable if necessary. Currently, if the buffered mode + * is enabled, the LRADC takes LRADC_DELAY_TIMER_LOOP samples of data before + * triggering IRQ. The sampling happens every (LRADC_DELAY_TIMER_PER / 2000) + * seconds. The result is that the samples arrive every 500mS. + */ +#define LRADC_DELAY_TIMER_PER 200 +#define LRADC_DELAY_TIMER_LOOP 5 + +#define VREF_MV_BASE 1850 + +const char *mx23_lradc_adc_irq_names[] = { + "mxs-lradc-channel0", + "mxs-lradc-channel1", + "mxs-lradc-channel2", + "mxs-lradc-channel3", + "mxs-lradc-channel4", + "mxs-lradc-channel5", +}; + +const char *mx28_lradc_adc_irq_names[] = { + "m
Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature
On Tue, Feb 28, 2017 at 07:15:47PM +0100, Peter Zijlstra wrote: > (And we should not be returning to userspace with locks held anyway -- > lockdep already has a check for that). Don't we return to userspace with page locks held, eg during async directio?
[PATCH] zram: reduce load operation in page_same_filled
In page_same_filled function, all elements in the page is compared with next index value. The current comparison routine compares the (i)th and (i+1)th values of the page. In this case, two load operaions occur for each comparison. But if we store first value of the page stores at 'val' variable and using it to compare with others, the load opearation is reduced. It reduce load operation per page by up to 64times. Signed-off-by: Sangwoo --- drivers/block/zram/zram_drv.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index e27d89a..87581d1 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -177,15 +177,17 @@ static bool page_same_filled(void *ptr, unsigned long *element) { unsigned int pos; unsigned long *page; + unsigned long val; page = (unsigned long *)ptr; + val = page[0]; - for (pos = 0; pos < PAGE_SIZE / sizeof(*page) - 1; pos++) { - if (page[pos] != page[pos + 1]) + for (pos = 1; pos < PAGE_SIZE / sizeof(*page); pos++) { + if (val != page[pos]) return false; } - *element = page[pos]; + *element = val; return true; } -- 2.6.2
Re: [PATCH v2] staging: mkspec: added aarch64 ifarch case.
On Wed, Mar 01, 2017 at 09:24:14AM -0800, James Tau wrote: > Patch attempting to fix native 'make rpm' build on ARM64 machines by adding an > "ifarch aarch64" case. Without it, build fails because the 'cp ...' in the > default case can't find the built image. > > Signed-off-by: James Tau > --- > scripts/package/mkspec | 4 > 1 file changed, 4 insertions(+) Is this the same issue that was fixed by: http://lkml.kernel.org/r/20161122213434.14788-1-mma...@suse.com ? I was assuming that Michael was going to queue those, but I could be wrong. Will
Re: [PATCH v7 3/8] perf tool: update about the new option to record namespace events
Em Tue, Feb 21, 2017 at 07:31:37PM +0530, Hari Bathini escreveu: > Now that we have a new option to record namespace events, update > the perf-record documentation accordingly. > > Signed-off-by: Hari Bathini > --- > tools/perf/Documentation/perf-record.txt |3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/perf/Documentation/perf-record.txt > b/tools/perf/Documentation/perf-record.txt > index 27256bc..9c85a65 100644 > --- a/tools/perf/Documentation/perf-record.txt > +++ b/tools/perf/Documentation/perf-record.txt > @@ -347,6 +347,9 @@ Enable weightened sampling. An additional weight is > recorded per sample and can > displayed with the weight and local_weight sort keys. This currently works > for TSX > abort events and some memory events in precise mode on modern Intel CPUs. > > +--namespaces:: > +Record events of type PERF_RECORD_NAMESPACES. > + > --transaction:: > Record transaction flags for transaction related events. So, here it is, please update the documentation together with the patch that introduces the option. - Arnaldo
Re: Regression in 4.11 - PowerPC crashes on boot, bisected to commit 5657933dbb6e
On Wed, 2017-03-01 at 21:26 -0600, Larry Finger wrote: > My Powerbook G4 Aluminum generates a fatal splat early in the boot process, > just > after identifying the driver for the disk. Unfortunately, it turns off almost > immediately, thus I cannot report the message. After this bug has been > triggered, the system clock has been reset to Dec. 31, 1969. I assume this is > a > side effect of an uncontrolled DMA operation. > > This problem has been bisected to commit 5657933dbb6e ("treewide: Move > dma_ops > from struct dev_archdata into struct device"). Can you provide the kernel .config of that G4? Thanks, Bart.
Re: [PATCH 2/4] perf tools: Introduce cpu_map__snprint_mask()
Em Sat, Feb 25, 2017 at 01:27:34PM +0900, Namhyung Kim escreveu: > On Fri, Feb 24, 2017 at 06:08:53PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Fri, Feb 24, 2017 at 10:12:49AM +0900, Namhyung Kim escreveu: > > util/cpumap.c:679:8: error: comparison is always true due to limited range > > of data type [-Werror=type-limits] > > if (0 <= val && val <= 9) > > ^~ > > Are you ok with the patch below? > I'd rather change hex_char() instead. How about this? Ok, applying by hand, somehow it didn't apply using git-am... - Arnaldo > +++ b/tools/perf/util/cpumap.c > @@ -674,11 +674,11 @@ size_t cpu_map__snprint(struct cpu_map *map, char *buf, > size_t size) > return ret; > } > > -static char hex_char(char val) > +static char hex_char(unsigned char val) > { > - if (0 <= val && val <= 9) > + if (val < 10) > return val + '0'; > - if (10 <= val && val < 16) > + if (val < 16) > return val - 10 + 'a'; > return '?'; > }
Re: [PATCH] pci: dwc: Fix NULL pointer dereference due to missing assignment
On 03/01/2017 02:32 AM, Bjorn Helgaas wrote: On Tue, Feb 28, 2017 at 01:38:18PM +0530, Vivek Gautam wrote: Add missing assignment of dw_pci core structure for designware-plat. Commit 8b130f815a6b ("PCI: dwc: Fix crashes seen due to missing assignments") fixed all other platforms, but missed designware-plat file. Fixes: 442ec4c04d12 ("PCI: dwc: all: Split struct pcie_port into host-only and core structures") Cc: Guenter Roeck Cc: Bjorn Helgaas Cc: Kishon Vijay Abraham I Cc: Jingoo Han Cc: Joao Pinto Cc: linux-...@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Vivek Gautam Thanks, Vivek! I folded this into Guenter's patch and added your Signed-off-by for this designware-plat fix. I'll ask Linus to pull this before v4.11-rc1. Thanks Bjorn. BRs Vivek -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[PATCH v1] qed: Fix copy of uninitialized memory
In qed_ll2_start_ooo() the ll2_info variable is uninitialized and then passed to qed_ll2_acquire_connection() where it is copied into a new memory space. This shouldn't cause any issue as long as non of the copied memory is every read. But the potential for a bug being introduced by reading this memory is real. Detected by CoverityScan, CID#1399632 ("Uninitialized scalar variable") Signed-off-by: Robert Foss --- drivers/net/ethernet/qlogic/qed/qed_ll2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c index 9a0b9af10a57..5fb34db377c8 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c +++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c @@ -968,7 +968,7 @@ static int qed_ll2_start_ooo(struct qed_dev *cdev, { struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev); u8 *handle = &hwfn->pf_params.iscsi_pf_params.ll2_ooo_queue_id; - struct qed_ll2_conn ll2_info; + struct qed_ll2_conn ll2_info = { 0 }; int rc; ll2_info.conn_type = QED_LL2_TYPE_ISCSI_OOO; -- 2.11.0.453.g787f75f05
Re: ftrace_graph_filter not working correctly since v4.10
On Wed, 1 Mar 2017 22:28:43 -0500 Steven Rostedt wrote: > > 4.10 is fine. It's what has been merged for 4.11 that's broken. I'm > doing a bisect now to see what broke it. Yes, lots of commits touched > that code recently. I found the bad commit. I'll have a patch for you to test tomorrow. -- Steve
Re: [PATCH 2/2] hwmon: Aspeed AST2400/AST2500 ADC
Resending in plain text. On Tue, Feb 28, 2017 at 7:45 PM, Guenter Roeck wrote: > On 02/28/2017 04:49 PM, Joel Stanley wrote: >> >> On Wed, Mar 1, 2017 at 6:44 AM, Rick Altherr wrote: >>> >>> Aspeed AST2400/AST2500 BMC SoCs include a 16 channel, 10-bit ADC. This >>> driver implements reading the ADC values, enabling channels via device >>> tree, and optionally providing channel labels via device tree. Low and >>> high threshold interrupts are supported by the hardware but not >>> implemented. >>> >>> Signed-off-by: Rick Altherr >> >> >> Looks good. Some minor comments below. >> >> Is there a reason you wrote a hwmon driver instead of an iio driver? I >> wasn't sure what the recommended subsystem is. > > > Excellent point. Question is really if there is a plan to add support for > thresholds. If not, an iio driver might be more appropriate. > > Guenter > The hardware supports firing interrupts on high and low thresholds. I'm not planning to use that feature yet so I didn't implement it. Would you prefer that I leave it as is (maybe with a TODO), implement the thresholding, or change to iio? Rick >> >>> --- >>> drivers/hwmon/Kconfig | 10 ++ >>> drivers/hwmon/Makefile | 1 + >>> drivers/hwmon/aspeed_adc.c | 383 >>> + >>> 3 files changed, 394 insertions(+) >>> create mode 100644 drivers/hwmon/aspeed_adc.c >>> >>> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig >>> index 0649d53f3d16..c99a67b4afe4 100644 >>> --- a/drivers/hwmon/Kconfig >>> +++ b/drivers/hwmon/Kconfig >>> @@ -261,6 +261,16 @@ config SENSORS_ASC7621 >>> This driver can also be built as a module. If so, the module >>> will be called asc7621. >>> >>> +config SENSORS_ASPEED_ADC >>> + tristate "Aspeed AST2400/AST2500 ADC" >>> + depends on ARCH_ASPEED >> >> >> depends on ARCH_ASPEED || COMPILE_TEST. >> >>> + help >>> + If you say yes here you get support for the Aspeed >>> AST2400/AST2500 >>> + ADC. >>> + >>> + This driver can also be built as a module. If so, the module >>> + will be called aspeed_adc. >>> + >>> config SENSORS_K8TEMP >>> tristate "AMD Athlon64/FX or Opteron temperature sensor" >>> depends on X86 && PCI >>> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile >>> index 5509edf6186a..eede049c9d0d 100644 >>> --- a/drivers/hwmon/Makefile >>> +++ b/drivers/hwmon/Makefile >>> @@ -46,6 +46,7 @@ obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o >>> obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o >>> obj-$(CONFIG_SENSORS_ARM_SCPI) += scpi-hwmon.o >>> obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o >>> +obj-$(CONFIG_SENSORS_ASPEED_ADC) += aspeed_adc.o >>> obj-$(CONFIG_SENSORS_ATXP1)+= atxp1.o >>> obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o >>> obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o >>> diff --git a/drivers/hwmon/aspeed_adc.c b/drivers/hwmon/aspeed_adc.c >>> new file mode 100644 >>> index ..098e32315264 >>> --- /dev/null >>> +++ b/drivers/hwmon/aspeed_adc.c >>> @@ -0,0 +1,383 @@ >>> +/* >>> + * Aspeed AST2400/2500 ADC >>> + * >>> + * Copyright (C) 2017 Google, Inc. >>> + * >>> + * This program is free software; you can redistribute it and/or modify >>> it >>> + * under the terms and conditions of the GNU General Public License, >>> + * version 2, as published by the Free Software Foundation. >>> + * >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#define ASPEED_ADC_NUM_CHANNELS16 >>> +#define ASPEED_ADC_REF_VOLTAGE 2500 /* millivolts */ >>> + >>> +#define ASPEED_ADC_REG_ADC00 0x00 >>> +#define ASPEED_ADC_REG_ADC04 0x04 >>> +#define ASPEED_ADC_REG_ADC08 0x08 >>> +#define ASPEED_ADC_REG_ADC0C 0x0C >>> +#define ASPEED_ADC_REG_ADC10 0x10 >>> +#define ASPEED_ADC_REG_ADC14 0x14 >>> +#define ASPEED_ADC_REG_ADC18 0x18 >>> +#define ASPEED_ADC_REG_ADC1C 0x1C >>> +#define ASPEED_ADC_REG_ADC20 0x20 >>> +#define ASPEED_ADC_REG_ADC24 0x24 >>> +#define ASPEED_ADC_REG_ADC28 0x28 >>> +#define ASPEED_ADC_REG_ADC2C 0x2C >> >> >> I'm not sure that these defines add any value. I'd either give them >> names such as "ASPEED_ADC_ENGINE_CTRL". or just use the register >> offset directly. >> >>> + >>> +#define ASPEED_ADC_OPERATION_MODE_POWER_DOWN (0x0 << 1) >>> +#define ASPEED_ADC_OPERATION_MODE_STANDBY (0x1 << 1) >>> +#define ASPEED_ADC_OPERATION_MODE_NORMAL (0x7 << 1) >>> + >>> +#define ASPEED_ADC_ENGINE_ENABLE BIT(0) >>> + >>> +struct aspeed_adc_data { >>> + struct device *dev; >>> + void __iomem*base; >>> + struct clk *pclk; >>> + struct mutexlock; >>> + unsigned long update_interval_ms; >>> + u32 enabled_channel_mask; >>> + const char* channel_labels[ASPEED_ADC_NUM_CHANNELS]; >>> +}; >>> + >>> +static int aspeed_adc_se
Re: [PATCH v2 0/4] fujitsu_init() cleanup [resend due to vger error]
On Wed, Mar 01, 2017 at 09:10:40AM +0100, Micha?? K??pie?? wrote: > These patches should make fujitsu_init() a bit more palatable. No > changes are made to platform device code yet, for clarity these will be > posted in a separate series after this one gets applied. Thanks for these. As for the other series you posted I will endeavour to review and test within the next 48 hours. I note the particular testing requirements of patch 2/4. Could you confirm which git tree you've based these off? I'm resending this for the benefit of the lists, hoping they will work this time. On the first attempt (at 2 Mar 2017 09:09:12 +1030) I got this: >- The following addresses had permanent fatal errors - > > > >- Transcript of session follows - > ... while talking to vger.kernel.org.: > >>> MAIL From: SIZE=1474 > <<< 450 4.5.0 Interactive router timed out! > 550 5.1.2 > ,... Host > unknown (Name server: bl-ckh-le.kernel.org.: host not found) Regards jonathan
Re: [PATCH 8/9] Revert "mm, vmscan: account for skipped pages as a partial scan"
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > This reverts commit d7f05528eedb047efe2288cff777676b028747b6. > > Now that reclaimability of a node is no longer based on the ratio > between pages scanned and theoretically reclaimable pages, we can > remove accounting tricks for pages skipped due to zone constraints. > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
[PATCH] f2fs-tools: calculate cp_ver correctly
It needs to check CP_CRC_RECOVERY_FLAG during cp_ver calculation. Signed-off-by: Chao Yu --- include/f2fs_fs.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h index 057adf39f6a9..a92011b83ff5 100644 --- a/include/f2fs_fs.h +++ b/include/f2fs_fs.h @@ -1089,10 +1089,13 @@ static inline __le64 get_cp_crc(struct f2fs_checkpoint *cp) { u_int64_t cp_ver = get_cp(checkpoint_ver); size_t crc_offset = get_cp(checksum_offset); + unsigned int ckpt_flags = le32_to_cpu(cp->ckpt_flags); + u_int32_t crc = le32_to_cpu(*(__le32 *)((unsigned char *)cp + crc_offset)); - cp_ver |= ((u_int64_t)crc << 32); + if (ckpt_flags & CP_CRC_RECOVERY_FLAG) + cp_ver |= ((u_int64_t)crc << 32); return cpu_to_le64(cp_ver); } -- 2.8.2.295.g3f1c1d0
Re: [PATCH 9/9] mm: remove unnecessary back-off function when retrying page reclaim
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > The backoff mechanism is not needed. If we have MAX_RECLAIM_RETRIES > loops without progress, we'll OOM anyway; backing off might cut one or > two iterations off that in the rare OOM case. If we have intermittent > success reclaiming a few pages, the backoff function gets reset also, > and so is of little help in these scenarios. > > We might want a backoff function for when there IS progress, but not > enough to be satisfactory. But this isn't that. Remove it. > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
[PATCH] staging: lustre: fix sparse warning about different address spaces
fixed the following sparse warning by adding proper cast: drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74: warning: incorrect type in argument 2 (different address spaces) drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74:expected char const [noderef] * drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74:got char *[assigned] sval Signed-off-by: Mario Bambagini --- drivers/staging/lustre/lustre/obdclass/obd_config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 9ca84c7..8fce88f 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1052,7 +1052,8 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, oldfs = get_fs(); set_fs(KERNEL_DS); - rc = var->fops->write(&fakefile, sval, + rc = var->fops->write(&fakefile, + (const char __user *)sval, vallen, NULL); set_fs(oldfs); } -- 2.1.4
Re: [PATCH V3 2/7] PM / OPP: Introduce "domain-performance-state" binding to OPP nodes
On 03/02/2017 04:43 AM, Rob Herring wrote: > On Wed, Mar 1, 2017 at 12:27 AM, Rajendra Nayak wrote: >> >> >> On 02/28/2017 09:22 PM, Rob Herring wrote: >>> On Tue, Feb 28, 2017 at 9:14 AM, Ulf Hansson wrote: [...] >> ---> Parent domain-2 (Contains >> Perfomance states) >> | >> | >> C.) DeviceX ---> Parent-domain-1 | >> | >> | >> ---> Parent domain-3 (Contains >> Perfomance states) > > I'm a bit confused. How does a domain have 2 parent domains? This comes from the early design of the generic PM domain, thus I assume we have some HW with such complex PM topology. However, I don't know if it is actually being used. Moreover, the corresponding DT bindings for "power-domains" parents, can easily be extended to cover more than one parent. See more in Documentation/devicetree/bindings/power/power_domain.txt >>> >>> I could easily see device having 2 power domains. For example a cpu >>> may have separate domains for RAM/caches and logic. And nesting of >> >> yet the bindings for power-domains (for consumer devices) only allows for >> one powerdomain to be associated with a device. > > There's nothing in the binding only allowing that. If that was true, > then #powerdomain-cells would be pointless Is't #powerdomain-cells a powerdomain provider property? and used to specify if a powerdomain provider supports providing 1 or many powerdomains? I was talking about the power domain consumer property. Looking at Documentation/devicetree/bindings/power/power_domain.txt.. ==PM domain consumers== Required properties: - power-domains : A phandle and PM domain specifier as defined by bindings of the power controller specified by phandle. It clearly says 'A phandle'. If there was a way to specify multiple power-domains for a consumer device should it not be saying a list of phandles? Like we do for clocks and regulators? > as the property size would > tell you the number of cells. Now it may be that we simply don't have > any cases with more than 1. Hopefully that's not because bindings are > working around PM domain limitations/requirements. > > Rob > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 4/9] mm: remove unnecessary reclaimability check from NUMA balancing target
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > NUMA balancing already checks the watermarks of the target node to > decide whether it's a suitable balancing target. Whether the node is > reclaimable or not is irrelevant when we don't intend to reclaim. > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
Re: [PATCH 7/9] mm: delete NR_PAGES_SCANNED and pgdat_reclaimable()
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > NR_PAGES_SCANNED counts number of pages scanned since the last page > free event in the allocator. This was used primarily to measure the > reclaimability of zones and nodes, and determine when reclaim should > give up on them. In that role, it has been replaced in the preceeding > patches by a different mechanism. > > Being implemented as an efficient vmstat counter, it was automatically > exported to userspace as well. It's however unlikely that anyone > outside the kernel is using this counter in any meaningful way. > > Remove the counter and the unused pgdat_reclaimable(). > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
Re: PPro arch_cpu_idle: NMI watchdog: Watchdog detected hard LOCKUP on cpu 1
> > This is on my trusty IBM PC365, dual Pentium Pro. 4.10 worked fine, > > 4.10.0-09686-g9e314890292c and 4.10.0-10770-g2d6be4abf514 exhibit a > > problem. Ocassionally NMI watchdog kicks in and discovers one of the > > CPUs in LOCKUP. The system keeps running fine. The first lockup was > > different, all the others were from arch_cpu_idle. Sometime ecey couple > > of seconds (after some activity), sometimes nothing for a long time > > (idle, no SSH logins). > > The only watchdog related patch which hit after 4.10 is: > > 8dcde9def5a1 kernel/watchdog.c: do not hardcode CPU 0 as the initial thread > > Can you try to revert that for a start? I'm not seeing why it should be the > culprit from a quick glance, but ... Reverting this patch does not help. -- Meelis Roos (mr...@linux.ee)
Re: [PATCH 5/9] mm: don't avoid high-priority reclaim on unreclaimable nodes
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > 246e87a93934 ("memcg: fix get_scan_count() for small targets") sought > to avoid high reclaim priorities for kswapd by forcing it to scan a > minimum amount of pages when lru_pages >> priority yielded nothing. > > b95a2f2d486d ("mm: vmscan: convert global reclaim to per-memcg LRU > lists"), due to switching global reclaim to a round-robin scheme over > all cgroups, had to restrict this forceful behavior to unreclaimable > zones in order to prevent massive overreclaim with many cgroups. > > The latter patch effectively neutered the behavior completely for all > but extreme memory pressure. But in those situations we might as well > drop the reclaimers to lower priority levels. Remove the check. > > Signed-off-by: Johannes Weiner > --- > mm/vmscan.c | 19 +-- > 1 file changed, 5 insertions(+), 14 deletions(-) > Acked-by: Hillf Danton
Re: [PATCH 6/9] mm: don't avoid high-priority reclaim on memcg limit reclaim
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > 246e87a93934 ("memcg: fix get_scan_count() for small targets") sought > to avoid high reclaim priorities for memcg by forcing it to scan a > minimum amount of pages when lru_pages >> priority yielded nothing. > This was done at a time when reclaim decisions like dirty throttling > were tied to the priority level. > > Nowadays, the only meaningful thing still tied to priority dropping > below DEF_PRIORITY - 2 is gating whether laptop_mode=1 is generally > allowed to write. But that is from an era where direct reclaim was > still allowed to call ->writepage, and kswapd nowadays avoids writes > until it's scanned every clean page in the system. Potential changes > to how quick sc->may_writepage could trigger are of little concern. > > Remove the force_scan stuff, as well as the ugly multi-pass target > calculation that it necessitated. > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
Re: ftrace_graph_filter not working correctly since v4.10
On Wed, 01 Mar 2017 18:01:31 -0800 Todd Brandt wrote: > I've been using early boot trace to gather callgraph data on filtered > functions but something appears to have broken it in v10.0. The graph > trace worked fine in v4.10-rc8, so something changed since the release. > > Issue: > Using the ftrace_graph_filter kernel parameter to filter on a specific > function produces no data (msleep for instance). The graph trace also > continues to produce nothing even after reconfiguring it through > debugfs. It worked fine in v4.10-rc8 but fails in v4.10. > 4.10 is fine. It's what has been merged for 4.11 that's broken. I'm doing a bisect now to see what broke it. Yes, lots of commits touched that code recently. I'll have to add this command line as one of my tests I perform. Thanks! -- Steve
Re: [PATCH 3/9] mm: remove seemingly spurious reclaimability check from laptop_mode gating
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > 1d82de618ddd ("mm, vmscan: make kswapd reclaim in terms of nodes") > allowed laptop_mode=1 to start writing not just when the priority > drops to DEF_PRIORITY - 2 but also when the node is unreclaimable. > That appears to be a spurious change in this patch as I doubt the > series was tested with laptop_mode, and neither is that particular > change mentioned in the changelog. Remove it, it's still recent. > > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
Regression in 4.11 - PowerPC crashes on boot, bisected to commit 5657933dbb6e
My Powerbook G4 Aluminum generates a fatal splat early in the boot process, just after identifying the driver for the disk. Unfortunately, it turns off almost immediately, thus I cannot report the message. After this bug has been triggered, the system clock has been reset to Dec. 31, 1969. I assume this is a side effect of an uncontrolled DMA operation. This problem has been bisected to commit 5657933dbb6e ("treewide: Move dma_ops from struct dev_archdata into struct device"). Larry
Re: [PATCH 2/9] mm: fix check for reclaimable pages in PF_MEMALLOC reclaim throttling
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > PF_MEMALLOC direct reclaimers get throttled on a node when the sum of > all free pages in each zone fall below half the min watermark. During > the summation, we want to exclude zones that don't have reclaimables. > Checking the same pgdat over and over again doesn't make sense. > > Fixes: 599d0c954f91 ("mm, vmscan: move LRU lists to node") > Signed-off-by: Johannes Weiner > --- Acked-by: Hillf Danton
[PATCH] f2fs: correct cp_ver for compatibility to old image
There is no CP_CRC_RECOVERY_FLAG tagged in checkpoint pack, calculate cp_version as old format. Signed-off-by: Chao Yu --- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 6c027b6833f4..0d46404ca769 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2507,7 +2507,9 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) f2fs_put_page(page, 1); } - cp_ver |= (cur_cp_crc(ckpt) << 32); + if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG)) + cp_ver |= (cur_cp_crc(ckpt) << 32); + if (cpu_to_le64(cp_ver) != *(__le64 *)nm_i->nat_bits) { disable_nat_bits(sbi, true); return 0; -- 2.8.2.295.g3f1c1d0
Re: [PATCH 2/2] printk: fix double printing with earlycon
On Wed, 1 Mar 2017 19:13:46 +0300 Aleksey Makarov wrote: > If a console was specified by ACPI SPCR table _and_ > command line parameters like "console=ttyAMA0" _and_ "earlycon" > were specified, then log messages appears twice. > > The root cause is that the code traverse the list > of specified consoles (the `console_cmdline` array) and stops at the > first match. But it may happen that the same console is referred by > the elements of this array twice: > > ttyAMA0 -- from command line > pl011,mmio,0x87e02400,115200 -- from SPCR > > but in this case `preferred_console` points to the second entry and > the flag CON_CONSDEV is not set, so bootconsole is not deregistered. > > To fix that, match the console against the `console_cmdline` entry > pointed by `preferred_console` instead of the first match. > > Signed-off-by: Aleksey Makarov > --- > kernel/printk/printk.c | 52 > ++ > 1 file changed, 31 insertions(+), 21 deletions(-) > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index ed2a9b31f214..92008ae9db3f 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2380,6 +2380,24 @@ static int __init keep_bootcon_setup(char *str) > > early_param("keep_bootcon", keep_bootcon_setup); > > +static int match_console(struct console *newcon, struct console_cmdline *c) > +{ > + if (!newcon->match || > + newcon->match(newcon, c->name, c->index, c->options) != 0) { > + /* default matching */ > + BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); > + if (strcmp(c->name, newcon->name) != 0) > + return -ENODEV; > + if (newcon->index >= 0 && > + newcon->index != c->index) > + return -ENODEV; > + if (newcon->index < 0) > + newcon->index = c->index; > + } > + > + return 0; > +} > + > /* > * The console driver calls this routine during kernel initialization > * to register the console printing procedure with printk() and to > @@ -2460,37 +2478,29 @@ void register_console(struct console *newcon) > for (i = 0, c = console_cmdline; >i < MAX_CMDLINECONSOLES && c->name[0]; >i++, c++) { > - if (!newcon->match || > - newcon->match(newcon, c->name, c->index, c->options) != 0) { > - /* default matching */ > - BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); > - if (strcmp(c->name, newcon->name) != 0) > - continue; > - if (newcon->index >= 0 && > - newcon->index != c->index) > - continue; > - if (newcon->index < 0) > - newcon->index = c->index; > + if (match_console(newcon, c)) > + continue; > > - if (_braille_register_console(newcon, c)) > - return; > + if (_braille_register_console(newcon, c)) > + return; > > - if (newcon->setup && > - newcon->setup(newcon, c->options) != 0) > - break; > - } > + if (newcon->setup && > + newcon->setup(newcon, c->options) != 0) > + break; > > newcon->flags |= CON_ENABLED; > - if (i == preferred_console) { > - newcon->flags |= CON_CONSDEV; > - has_preferred = true; > - } > break; > } > > if (!(newcon->flags & CON_ENABLED)) > return; > We could use a comment right about here, explaining why the below is needed. -- Steve > + if (preferred_console >= 0 && > + match_console(newcon, console_cmdline + preferred_console) == 0) { > + newcon->flags |= CON_CONSDEV; > + has_preferred = true; > + } > + > /* >* If we have a bootconsole, and are switching to a real console, >* don't print everything out again, since when the boot console, and
Re: [PATCH 1/9] mm: fix 100% CPU kswapd busyloop on unreclaimable nodes
On March 01, 2017 5:40 AM Johannes Weiner wrote: > > Jia He reports a problem with kswapd spinning at 100% CPU when > requesting more hugepages than memory available in the system: > > $ echo 4000 >/proc/sys/vm/nr_hugepages > > top - 13:42:59 up 3:37, 1 user, load average: 1.09, 1.03, 1.01 > Tasks: 1 total, 1 running, 0 sleeping, 0 stopped, 0 zombie > %Cpu(s): 0.0 us, 12.5 sy, 0.0 ni, 85.5 id, 2.0 wa, 0.0 hi, 0.0 si, 0.0 > st > KiB Mem: 31371520 total, 30915136 used, 456384 free, 320 buffers > KiB Swap: 6284224 total, 115712 used, 6168512 free.48192 cached Mem > > PID USER PR NIVIRTRESSHR S %CPU %MEM TIME+ COMMAND >76 root 20 0 0 0 0 R 100.0 0.000 217:17.29 kswapd3 > > At that time, there are no reclaimable pages left in the node, but as > kswapd fails to restore the high watermarks it refuses to go to sleep. > > Kswapd needs to back away from nodes that fail to balance. Up until > 1d82de618ddd ("mm, vmscan: make kswapd reclaim in terms of nodes") > kswapd had such a mechanism. It considered zones whose theoretically > reclaimable pages it had reclaimed six times over as unreclaimable and > backed away from them. This guard was erroneously removed as the patch > changed the definition of a balanced node. > > However, simply restoring this code wouldn't help in the case reported > here: there *are* no reclaimable pages that could be scanned until the > threshold is met. Kswapd would stay awake anyway. > > Introduce a new and much simpler way of backing off. If kswapd runs > through MAX_RECLAIM_RETRIES (16) cycles without reclaiming a single > page, make it back off from the node. This is the same number of shots > direct reclaim takes before declaring OOM. Kswapd will go to sleep on > that node until a direct reclaimer manages to reclaim some pages, thus > proving the node reclaimable again. > > v2: move MAX_RECLAIM_RETRIES to mm/internal.h (Michal) > > Reported-by: Jia He > Signed-off-by: Johannes Weiner > Tested-by: Jia He > Acked-by: Michal Hocko > --- Acked-by: Hillf Danton
Re: [PATCH v5 0/4] iio: accel: adxl345: Split driver into core and I2C then add SPI support
On Thu, Mar 02, 2017 at 01:22:11AM +0200, Andy Shevchenko wrote: > On Tue, Feb 28, 2017 at 4:37 AM, Eva Rachel Retuya > wrote: > > This patchset modifies the adxl345 to use regmap. In doing so, we can > > easily introduce SPI support and let regmap handle the rest. > > > > Recap of basic features: read_raw for x, y and z axes, scale. After > > applying this series, driver now supports the SPI protocol and enumeration > > of device via device tree. > > If I knew you are going to send new version I would have commented on v4... > Hi Andy, Please state your comments and I will submit a new revision. Thanks, Eva > > > > Changes from v4: > > [PATCH 1/4] > > * Update subject-prefix > > * Update node name from "adxl345@unit-address" to > > "accelerometer@unit-address" > > Patches 2-4 > > * Add Andy's Reviewed-by tag > > > > Changes from v3: > > [PATCH 1/4] > > * None > > [PATCH 2/4] > > * Keep intact I2C client structure which was deleted from v3 > > * Make use of regmap_get_device to retrieve struct device, use these for > > debugging prints instead of &client->dev. > > [PATCH 3/4] and [PATCH 4/4] > > * Revert to explicit and separate I2C and SPI configuration > > * Add OF match table, make it enumerable in ACPI environment (Andy's > > suggestion) > > > > Changes from v2: > > * Drop PATCH 4 iio: accel: adxl345: Add ACPI support > > * Add OF match table on both I2C and SPI files and document them > > > > Changes from v1: > > [PATCH 1/4] > > * Move other deletions from patch 2 in here -- make it clear what got > > deleted > > and/or modified that is hard to see previously > > * Introduce the driver header file "adxl345.h" here instead of doing it in > > the > > next patch > > * Completely omit traces of i2c_client and let this file (adxl345.c) mirror > > the > > core file on the next patch. > > * Improve debugging print about invalid device ID in probe. > > [PATCH 2/4] > > * Update Kconfig to Jonathan's preferred style > > * Improve similarity index from 78% to 100% (rename detection) > > [PATCH 4/4] > > * Correct acpi_device_id: ADX0345 -> ADS0345 > > > > Eva Rachel Retuya (4): > > dt-bindings: iio: accel: Document ADXL345 accelerometer binding > > iio: accel: adxl345: Use I2C regmap instead of direct I2C access > > iio: accel: adxl345: Split driver into core and I2C > > iio: accel: adxl345: Add SPI support > > > > .../devicetree/bindings/iio/accel/adxl345.txt | 38 + > > drivers/iio/accel/Kconfig | 26 ++- > > drivers/iio/accel/Makefile | 4 +- > > drivers/iio/accel/adxl345.h| 18 + > > drivers/iio/accel/{adxl345.c => adxl345_core.c}| 89 > > +- > > drivers/iio/accel/adxl345_i2c.c| 78 +++ > > drivers/iio/accel/adxl345_spi.c| 83 > > > > 7 files changed, 281 insertions(+), 55 deletions(-) > > create mode 100644 Documentation/devicetree/bindings/iio/accel/adxl345.txt > > create mode 100644 drivers/iio/accel/adxl345.h > > rename drivers/iio/accel/{adxl345.c => adxl345_core.c} (62%) > > create mode 100644 drivers/iio/accel/adxl345_i2c.c > > create mode 100644 drivers/iio/accel/adxl345_spi.c > > > > -- > > 2.7.4 > > > > > > -- > With Best Regards, > Andy Shevchenko
Re: tracing: add #undef to fix compile error
On Wed, 28 Sep 2016 22:55:54 -0400 Rik van Riel wrote: > There are several trace include files that define TRACE_INCLUDE_FILE. > > Include several of them in the same .c file (as I currently have in > some code I am working on), and the compile will blow up with a > "warning: "TRACE_INCLUDE_FILE" redefined #define TRACE_INCLUDE_FILE syscalls" > > Every other include file in include/trace/events/ avoids that issue > by having a #undef TRACE_INCLUDE_FILE before the #define; syscalls.h > should have one, too. Cleaning out my INBOX, I stumbled over this patch. It looks like I missed it. I'm guessing this is still an issue? (Too lazy to actually look deeper, well just too tired at the moment). -- Steve > > Signed-off-by: Rik van Riel > --- > include/trace/events/syscalls.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h > index 14e49c798135..b35533b94277 100644 > --- a/include/trace/events/syscalls.h > +++ b/include/trace/events/syscalls.h > @@ -1,5 +1,6 @@ > #undef TRACE_SYSTEM > #define TRACE_SYSTEM raw_syscalls > +#undef TRACE_INCLUDE_FILE > #define TRACE_INCLUDE_FILE syscalls > > #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
Re: [PATCH 00/21] MIPS memblock: Remove bootmem code and switch to NO_BOOTMEM
On 01/22/2017 11:55 PM, Marcin Nowakowski wrote: > Hi Serge, > > Thanks for this patch series, it's really useful. I've tested it on > Malta and Ci40 and it seems to work well (I've posted a few small > comments separately). I have not tested this yet, but this is definitively a very useful patch series, thanks a lot for doing this Serge! One thing that was not obvious to me is that you may have to take care of the "NOMAP" memblock type and avoid mapping these regions, which may or may not be relevant on MIPS due to the different virtual memory model. On ARM it's done in arch/arm/mm/mmu.c::map_lowmem. Please respin, this is very helpful! > > > On 19.12.2016 03:07, Serge Semin wrote: >> Most of the modern platforms supported by linux kernel have already >> been cleaned up of old bootmem allocator by moving to nobootmem >> interface wrapping up the memblock. This patchset is the first >> attempt to do the similar improvement for MIPS for UMA systems >> only. >> >> Even though the porting was performed as much careful as possible >> there still might be problem with support of some platforms, >> especially Loonson3 or SGI IP27, which perform early memory manager >> initialization by their self. > >> The patchset is split so individual patch being consistent in >> functional and buildable ways. But the MIPS early memory manager >> will work correctly only either with or without the whole set being >> applied. For the same reason a reviewer should not pay much attention >> to methods bootmem_init(), arch_mem_init(), paging_init() and >> mem_init() until they are fully refactored. > > I'm not sure this can be merged that way? It would be up to Ralf to > decide, but it is generally expected that all intermediate patches not > only build, but also work correctly. I understand that this might be > difficult to achieve given the scale of changes required here. > >> The patchset is applied on top of kernel v4.9. > > Can you please work on cleaning up the issues discussed in the comments > so far as well as rebasing (and updating) the changes onto linux-next? > There are a few patches I made related to kexec and kernel relocation > that will force changes in your code (although I admit that the changes > I did for kexec/relocation were in some places unnecessarily complex > because of the mess in the bootmem handling in MIPS that you are now > trying to clean up). > > > Thanks, > Marcin > >> Signed-off-by: Serge Semin >> >> Serge Semin (21): >> MIPS memblock: Unpin dts memblock sanity check method >> MIPS memblock: Add dts mem and reserved-mem callbacks >> MIPS memblock: Alter traditional add_memory_region() method >> MIPS memblock: Alter user-defined memory parameter parser >> MIPS memblock: Alter initrd memory reservation method >> MIPS memblock: Alter kexec-crashkernel parameters parser >> MIPS memblock: Alter elfcorehdr parameters parser >> MIPS memblock: Move kernel parameters parser into individual method >> MIPS memblock: Move kernel memory reservation to individual method >> MIPS memblock: Discard bootmem allocator initialization >> MIPS memblock: Add memblock sanity check method >> MIPS memblock: Add memblock print outs in debug >> MIPS memblock: Add memblock allocator initialization >> MIPS memblock: Alter IO resources initialization method >> MIPS memblock: Alter weakened MAAR initialization method >> MIPS memblock: Alter paging initialization method >> MIPS memblock: Alter high memory freeing method >> MIPS memblock: Slightly improve buddy allocator init method >> MIPS memblock: Add print out method of kernel virtual memory layout >> MIPS memblock: Add free low memory test method call >> MIPS memblock: Deactivate old bootmem allocator >> >> arch/mips/Kconfig| 2 +- >> arch/mips/kernel/prom.c | 32 +- >> arch/mips/kernel/setup.c | 958 +++-- >> arch/mips/mm/init.c | 234 --- >> drivers/of/fdt.c | 47 +- >> include/linux/of_fdt.h | 1 + >> 6 files changed, 739 insertions(+), 535 deletions(-) >> > -- Florian
[PATCH] drivers: net: ethernet: remove incorrect __exit markups
Even if bus is not hot-pluggable, devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes. Signed-off-by: Dmitry Torokhov --- drivers/net/ethernet/amd/declance.c| 30 +++--- drivers/net/ethernet/broadcom/sb1250-mac.c | 4 ++-- drivers/net/ethernet/faraday/ftgmac100.c | 4 ++-- drivers/net/ethernet/faraday/ftmac100.c| 4 ++-- drivers/net/ethernet/seeq/sgiseeq.c| 4 ++-- drivers/net/ethernet/sgi/meth.c| 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/amd/declance.c b/drivers/net/ethernet/amd/declance.c index 76e5fc7adff5..6c98901f1b89 100644 --- a/drivers/net/ethernet/amd/declance.c +++ b/drivers/net/ethernet/amd/declance.c @@ -1276,18 +1276,6 @@ static int dec_lance_probe(struct device *bdev, const int type) return ret; } -static void __exit dec_lance_remove(struct device *bdev) -{ - struct net_device *dev = dev_get_drvdata(bdev); - resource_size_t start, len; - - unregister_netdev(dev); - start = to_tc_dev(bdev)->resource.start; - len = to_tc_dev(bdev)->resource.end - start + 1; - release_mem_region(start, len); - free_netdev(dev); -} - /* Find all the lance cards on the system and initialize them */ static int __init dec_lance_platform_probe(void) { @@ -1320,7 +1308,7 @@ static void __exit dec_lance_platform_remove(void) #ifdef CONFIG_TC static int dec_lance_tc_probe(struct device *dev); -static int __exit dec_lance_tc_remove(struct device *dev); +static int dec_lance_tc_remove(struct device *dev); static const struct tc_device_id dec_lance_tc_table[] = { { "DEC ", "PMAD-AA " }, @@ -1334,7 +1322,7 @@ static struct tc_driver dec_lance_tc_driver = { .name = "declance", .bus= &tc_bus_type, .probe = dec_lance_tc_probe, - .remove = __exit_p(dec_lance_tc_remove), + .remove = dec_lance_tc_remove, }, }; @@ -1346,7 +1334,19 @@ static int dec_lance_tc_probe(struct device *dev) return status; } -static int __exit dec_lance_tc_remove(struct device *dev) +static void dec_lance_remove(struct device *bdev) +{ + struct net_device *dev = dev_get_drvdata(bdev); + resource_size_t start, len; + + unregister_netdev(dev); + start = to_tc_dev(bdev)->resource.start; + len = to_tc_dev(bdev)->resource.end - start + 1; + release_mem_region(start, len); + free_netdev(dev); +} + +static int dec_lance_tc_remove(struct device *dev) { put_device(dev); dec_lance_remove(dev); diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c index 435a2e4739d1..f82ec1e506e2 100644 --- a/drivers/net/ethernet/broadcom/sb1250-mac.c +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c @@ -2617,7 +2617,7 @@ static int sbmac_probe(struct platform_device *pldev) return err; } -static int __exit sbmac_remove(struct platform_device *pldev) +static int sbmac_remove(struct platform_device *pldev) { struct net_device *dev = platform_get_drvdata(pldev); struct sbmac_softc *sc = netdev_priv(dev); @@ -2634,7 +2634,7 @@ static int __exit sbmac_remove(struct platform_device *pldev) static struct platform_driver sbmac_driver = { .probe = sbmac_probe, - .remove = __exit_p(sbmac_remove), + .remove = sbmac_remove, .driver = { .name = sbmac_string, }, diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 262587240c86..928b0df2b8e0 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1456,7 +1456,7 @@ static int ftgmac100_probe(struct platform_device *pdev) return err; } -static int __exit ftgmac100_remove(struct platform_device *pdev) +static int ftgmac100_remove(struct platform_device *pdev) { struct net_device *netdev; struct ftgmac100 *priv; @@ -1483,7 +1483,7 @@ MODULE_DEVICE_TABLE(of, ftgmac100_of_match); static struct platform_driver ftgmac100_driver = { .probe = ftgmac100_probe, - .remove = __exit_p(ftgmac100_remove), + .remove = ftgmac100_remove, .driver = { .name = DRV_NAME, .of_match_table = ftgmac100_of_match, diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c index dce5f7b7f772..0f122a85a484 100644 --- a/drivers/net/ethernet/faraday/ftmac100.c +++ b/drivers/net/ethernet/faraday/ftmac100.c @@ -1154,7 +1154,7 @@ static int ftmac100_probe(struct platform_device *pdev) return err; } -static int __exit ftmac100_remove(struct platform_device *pdev) +stat
Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature
On Wed, Mar 01, 2017 at 02:17:07PM +0900, Byungchul Park wrote: > > > +void lock_commit_crosslock(struct lockdep_map *lock) > > > +{ > > > + struct cross_lock *xlock; > > > + unsigned long flags; > > > + > > > + if (!current->xhlocks) > > > + return; > > > + > > > + if (unlikely(current->lockdep_recursion)) > > > + return; > > > + > > > + raw_local_irq_save(flags); > > > + check_flags(flags); > > > + current->lockdep_recursion = 1; > > > + > > > + if (unlikely(!debug_locks)) > > > + return; > > > + > > > + if (!graph_lock()) > > > + return; > > > + > > > + xlock = &((struct lockdep_map_cross *)lock)->xlock; > > > + if (atomic_read(&xlock->ref) > 0 && !commit_xhlocks(xlock)) > > > > You terminate with graph_lock() held. > > Oops. What did I do? I'll fix it. I remembered it. It's no problem because it would terminate there, only if _both_ 'xlock->ref > 0' and 'commit_xhlocks returns 0' are true. Otherwise, it will unlock the lock safely.
Re: [PATCH 1/2] drm: Use pr_cont where appropriate
On Mon, Feb 27, 2017 at 8:31 PM, Joe Perches wrote: > Using 'printk("\n")' is not preferred anymore and > using printk to continue logging messages now produces > multiple line logging output unless the continuations > use KERN_CONT. > > Convert these uses to appropriately use pr_cont or a > single printk where possible. > > Miscellanea: > > o Use a temporary const char * instead of multiple printks > o Remove trailing space from logging by using a leading space instead > > Signed-off-by: Joe Perches Applied. thanks! Alex > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c | 70 > drivers/gpu/drm/radeon/r600_dpm.c | 71 > + > 2 files changed, 73 insertions(+), 68 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c > index 6ca0333ca4c0..38e9b0d3659a 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c > @@ -31,86 +31,88 @@ > > void amdgpu_dpm_print_class_info(u32 class, u32 class2) > { > - printk("\tui class: "); > + const char *s; > + > switch (class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) { > case ATOM_PPLIB_CLASSIFICATION_UI_NONE: > default: > - printk("none\n"); > + s = "none"; > break; > case ATOM_PPLIB_CLASSIFICATION_UI_BATTERY: > - printk("battery\n"); > + s = "battery"; > break; > case ATOM_PPLIB_CLASSIFICATION_UI_BALANCED: > - printk("balanced\n"); > + s = "balanced"; > break; > case ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE: > - printk("performance\n"); > + s = "performance"; > break; > } > - printk("\tinternal class: "); > + printk("\tui class: %s\n", s); > + printk("\tinternal class:"); > if (((class & ~ATOM_PPLIB_CLASSIFICATION_UI_MASK) == 0) && > (class2 == 0)) > - printk("none"); > + pr_cont(" none"); > else { > if (class & ATOM_PPLIB_CLASSIFICATION_BOOT) > - printk("boot "); > + pr_cont(" boot"); > if (class & ATOM_PPLIB_CLASSIFICATION_THERMAL) > - printk("thermal "); > + pr_cont(" thermal"); > if (class & ATOM_PPLIB_CLASSIFICATION_LIMITEDPOWERSOURCE) > - printk("limited_pwr "); > + pr_cont(" limited_pwr"); > if (class & ATOM_PPLIB_CLASSIFICATION_REST) > - printk("rest "); > + pr_cont(" rest"); > if (class & ATOM_PPLIB_CLASSIFICATION_FORCED) > - printk("forced "); > + pr_cont(" forced"); > if (class & ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE) > - printk("3d_perf "); > + pr_cont(" 3d_perf"); > if (class & ATOM_PPLIB_CLASSIFICATION_OVERDRIVETEMPLATE) > - printk("ovrdrv "); > + pr_cont(" ovrdrv"); > if (class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) > - printk("uvd "); > + pr_cont(" uvd"); > if (class & ATOM_PPLIB_CLASSIFICATION_3DLOW) > - printk("3d_low "); > + pr_cont(" 3d_low"); > if (class & ATOM_PPLIB_CLASSIFICATION_ACPI) > - printk("acpi "); > + pr_cont(" acpi"); > if (class & ATOM_PPLIB_CLASSIFICATION_HD2STATE) > - printk("uvd_hd2 "); > + pr_cont(" uvd_hd2"); > if (class & ATOM_PPLIB_CLASSIFICATION_HDSTATE) > - printk("uvd_hd "); > + pr_cont(" uvd_hd"); > if (class & ATOM_PPLIB_CLASSIFICATION_SDSTATE) > - printk("uvd_sd "); > + pr_cont(" uvd_sd"); > if (class2 & ATOM_PPLIB_CLASSIFICATION2_LIMITEDPOWERSOURCE_2) > - printk("limited_pwr2 "); > + pr_cont(" limited_pwr2"); > if (class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) > - printk("ulv "); > + pr_cont(" ulv"); > if (class2 & ATOM_PPLIB_CLASSIFICATION2_MVC) > - printk("uvd_mvc "); > + pr_cont(" uvd_mvc"); > } > - printk("\n"); > + pr_cont("\n"); > } > > void amdgpu_dpm_print_cap_info(u32 caps) > { > - printk("\tcaps: "); > + printk("\tcaps:"); > if (caps & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) > - printk("single_disp "); > + pr_cont(" single_disp");