Re: [PATCH v3 01/33] mtd: rawnand: brcmnand: convert driver to nand_scan()
Hi Boris, Boris Brezillon wrote on Fri, 20 Jul 2018 01:17:19 +0200: > On Fri, 20 Jul 2018 00:59:54 +0200 > Miquel Raynal wrote: > > > + > > +static struct nand_controller_ops brcmnand_controller_ops = { > > static const ... Mmmh right, I'll constify every controller_ops definition. > > The same comment applies to all patches of this series. > > > + .attach_chip = brcmnand_attach_chip, > > +}; > Miquèl
Re: [PATCH 4/5] mtd: rawnand: qcom: update BBT related flags
On 2018-07-19 03:12, Miquel Raynal wrote: Abhishek, Miquel Raynal wrote on Wed, 18 Jul 2018 23:41:44 +0200: Hi Boris, Boris Brezillon wrote on Wed, 18 Jul 2018 23:36:37 +0200: > On Wed, 18 Jul 2018 23:15:26 +0200 > Miquel Raynal wrote: > > > Hi Abhishek, > > > > Abhishek Sahu wrote on Fri, 6 Jul 2018 > > 13:21:58 +0530: > > > > > Remove the NAND_SKIP_BBTSCAN to use RAM based BBT. > > > > Unless I am understanding it the wrong way, NAND_SKIP_BBTSCAN will skip > > the scan of the on-chip BBT and will scan every block to construct a > > RAM, based BBT thanks to the BBM. > > > > So flash based BBT is already unused and removing this flag is a > > mistake, right? > > ->scan_bbt() is also taking care of building the in-RAM BBT based on > BBM when no on-flash BBT is provided, so I think it's the right thing > to do. Oh right. Then doing so is harmless. Could you please update the commit log to reflect this aspect? Thanks Miquel and Boris. I will update the commit log. Regards, Abhishek
[PATCH] pwm: stm32-lp: Remove useless loop in stm32_pwm_lp_remove()
LPTimer has only one pwm channel (npwm = 1). Remove useless for loop in remove routine. Signed-off-by: Fabrice Gasnier --- drivers/pwm/pwm-stm32-lp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c index 7c13e25..0059b24c 100644 --- a/drivers/pwm/pwm-stm32-lp.c +++ b/drivers/pwm/pwm-stm32-lp.c @@ -217,10 +217,8 @@ static int stm32_pwm_lp_probe(struct platform_device *pdev) static int stm32_pwm_lp_remove(struct platform_device *pdev) { struct stm32_pwm_lp *priv = platform_get_drvdata(pdev); - unsigned int i; - for (i = 0; i < priv->chip.npwm; i++) - pwm_disable(&priv->chip.pwms[i]); + pwm_disable(&priv->chip.pwms[0]); return pwmchip_remove(&priv->chip); } -- 1.9.1
Re: [PATCH v3 28/33] mtd: rawnand: docg4: convert driver to nand_scan()
Hi Boris, Boris Brezillon wrote on Fri, 20 Jul 2018 01:27:32 +0200: > On Fri, 20 Jul 2018 01:00:21 +0200 > Miquel Raynal wrote: > > > Two helpers have been added to the core to make ECC-related > > configuration between the detection phase and the final NAND scan. Use > > these hooks and convert the driver to just use nand_scan() instead of > > both nand_scan_ident() and nand_scan_tail(). > > > > Signed-off-by: Miquel Raynal > > --- > > drivers/mtd/nand/raw/docg4.c | 55 > > ++-- > > 1 file changed, 32 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/mtd/nand/raw/docg4.c b/drivers/mtd/nand/raw/docg4.c > > index 4dccdfba6140..2f6fcd4efab2 100644 > > --- a/drivers/mtd/nand/raw/docg4.c > > +++ b/drivers/mtd/nand/raw/docg4.c > > @@ -1227,10 +1227,9 @@ static void __init init_mtd_structs(struct mtd_info > > *mtd) > > * required within a nand driver because they are performed by the nand > > * infrastructure code as part of nand_scan(). In this case they need > > * to be initialized here because we skip call to nand_scan_ident() (the > > -* first half of nand_scan()). The call to nand_scan_ident() is skipped > > -* because for this device the chip id is not read in the manner of a > > -* standard nand device. Unfortunately, nand_scan_ident() does other > > -* things as well, such as call nand_set_defaults(). > > +* first half of nand_scan()). The call to nand_scan_ident() could be > > +* skipped because for this device the chip id is not read in the manner > > +* of a standard nand device. > > */ > > > > struct nand_chip *nand = mtd_to_nand(mtd); > > @@ -1315,6 +1314,27 @@ static int __init read_id_reg(struct mtd_info *mtd) > > > > static char const *part_probes[] = { "cmdlinepart", "saftlpart", NULL }; > > > > +static int docg4_attach_chip(struct nand_chip *chip) > > +{ > > + struct mtd_info *mtd = nand_to_mtd(chip); > > + struct docg4_priv *doc = (struct docg4_priv *)(chip + 1); > > + > > + init_mtd_structs(mtd); > > + > > + /* Initialize kernel BCH algorithm */ > > + doc->bch = init_bch(DOCG4_M, DOCG4_T, DOCG4_PRIMITIVE_POLY); > > + if (!doc->bch) > > + return -EINVAL; > > + > > + reset(mtd); > > + > > + return read_id_reg(mtd); > > +} > > + > > +static struct nand_controller_ops docg4_controller_ops = { > > + .attach_chip = docg4_attach_chip, > > +}; > > + > > static int __init probe_docg4(struct platform_device *pdev) > > { > > struct mtd_info *mtd; > > @@ -1350,26 +1370,16 @@ static int __init probe_docg4(struct > > platform_device *pdev) > > mtd->dev.parent = &pdev->dev; > > doc->virtadr = virtadr; > > doc->dev = dev; > > - > > - init_mtd_structs(mtd); > > - > > - /* initialize kernel bch algorithm */ > > - doc->bch = init_bch(DOCG4_M, DOCG4_T, DOCG4_PRIMITIVE_POLY); > > - if (doc->bch == NULL) { > > - retval = -EINVAL; > > - goto free_nand; > > - } > > - > > platform_set_drvdata(pdev, doc); > > > > - reset(mtd); > > - retval = read_id_reg(mtd); > > - if (retval == -ENODEV) { > > - dev_warn(dev, "No diskonchip G4 device found.\n"); > > - goto free_bch; > > - } > > - > > - retval = nand_scan_tail(mtd); > > + /* > > +* Asking for 0 chips is useless here but it warns the user that the use > > +* of the nand_scan() function is a bit abused here because the > > +* initialization is actually a bit specific and re-handled again in the > > +* ->attach_chip() hook. It will probably leak some memory though. > > +*/ > > + nand->dummy_controller.ops = &docg4_controller_ops; > > + retval = nand_scan(mtd, 0); > > if (retval) > > goto free_bch; > > Hm, not sure this works. The driver only calls nand_scan_tail(), but > you replace that by a call to nand_scan(), which will call both > nand_scan_ident() and nand_scan_tail(), and I'm pretty sure > nand_scan_ident() will fail here. I know docg4 is a bit specific and could maybe be moved out of the raw/ subdirectory. But in the meantime I don't want to block the series for this. The better I can propose right now (open to other ideas as well) would be to return 0 in nand_scan_ident() if the maxchip parameter is 0 which is the case only in this driver AFAIS. Miquèl
[PATCH v4 0/8] swap: THP optimizing refactoring
This patchset is based on 2018-07-13 head of mmotm tree. Now the THP (Transparent Huge Page) swap optimizing is implemented in the way like below, #ifdef CONFIG_THP_SWAP huge_function(...) { } #else normal_function(...) { } #endif general_function(...) { if (huge) return thp_function(...); else return normal_function(...); } As pointed out by Dave Hansen, this will, 1. Created a new, wholly untested code path for huge page 2. Created two places to patch bugs 3. Are not reusing code when possible This patchset is to address these problems via merging huge/normal code path/functions if possible. One concern is that this may cause code size to dilate when !CONFIG_TRANSPARENT_HUGEPAGE. The data shows that most refactoring will only cause quite slight code size increase. Best Regards, Huang, Ying
[PATCH v4 1/8] swap: Add comments to lock_cluster_or_swap_info()
To improve the code readability. Signed-off-by: "Huang, Ying" Suggested-and-acked-by: Dave Hansen Reviewed-by: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index d8fddfb000ec..d101e044efbf 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -297,13 +297,18 @@ static inline void unlock_cluster(struct swap_cluster_info *ci) spin_unlock(&ci->lock); } +/* + * Determine the locking method in use for this device. Return + * swap_cluster_info if SSD-style cluster-based locking is in place. + */ static inline struct swap_cluster_info *lock_cluster_or_swap_info( - struct swap_info_struct *si, - unsigned long offset) + struct swap_info_struct *si, unsigned long offset) { struct swap_cluster_info *ci; + /* Try to use fine-grained SSD-style locking if available: */ ci = lock_cluster(si, offset); + /* Otherwise, fall back to traditional, coarse locking: */ if (!ci) spin_lock(&si->lock); -- 2.16.4
[PATCH v4 4/8] swap: Unify normal/huge code path in swap_page_trans_huge_swapped()
As suggested by Dave, we should unify the code path for normal and huge swap support if possible to avoid duplicated code, bugs, etc. and make it easier to review code. In this patch, the normal/huge code path in swap_page_trans_huge_swapped() is unified, the added and removed lines are same. And the binary size is kept almost same when CONFIG_TRANSPARENT_HUGEPAGE=n. text data bss dec hex filename base: 24179 2028 340 2654767b3 mm/swapfile.o unified:24215 2028 340 2658367d7 mm/swapfile.o Signed-off-by: "Huang, Ying" Suggested-and-acked-by: Dave Hansen Reviewed-by: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 833613e59ef7..97814a01170d 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -270,7 +270,9 @@ static inline void cluster_set_null(struct swap_cluster_info *info) static inline bool cluster_is_huge(struct swap_cluster_info *info) { - return info->flags & CLUSTER_FLAG_HUGE; + if (IS_ENABLED(CONFIG_THP_SWAP)) + return info->flags & CLUSTER_FLAG_HUGE; + return false; } static inline void cluster_clear_huge(struct swap_cluster_info *info) @@ -1492,9 +1494,6 @@ static bool swap_page_trans_huge_swapped(struct swap_info_struct *si, int i; bool ret = false; - if (!IS_ENABLED(CONFIG_THP_SWAP)) - return swap_swapcount(si, entry) != 0; - ci = lock_cluster_or_swap_info(si, offset); if (!ci || !cluster_is_huge(ci)) { if (swap_count(map[roffset])) -- 2.16.4
[PATCH v4 2/8] mm/swapfile.c: Replace some #ifdef with IS_ENABLED()
In mm/swapfile.c, THP (Transparent Huge Page) swap specific code is enclosed by #ifdef CONFIG_THP_SWAP/#endif to avoid code dilating when THP isn't enabled. But #ifdef/#endif in .c file hurt the code readability, so Dave suggested to use IS_ENABLED(CONFIG_THP_SWAP) instead and let compiler to do the dirty job for us. This has potential to remove some duplicated code too. From output of `size`, text data bss dec hex filename THP=y: 26269 2076 340 28685700d mm/swapfile.o ifdef/endif: 24115 2028 340 264836773 mm/swapfile.o IS_ENABLED:24179 2028 340 2654767b3 mm/swapfile.o IS_ENABLED() based solution works quite well, almost as good as that of #ifdef/#endif. And from the diffstat, the removed lines are more than added lines. One #ifdef for split_swap_cluster() is kept. Because it is a public function with a stub implementation for CONFIG_THP_SWAP=n in swap.h. Signed-off-by: "Huang, Ying" Suggested-and-acked-by: Dave Hansen Reviewed-by: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 60 --- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index d101e044efbf..7283104bfafa 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -869,7 +869,6 @@ static int scan_swap_map_slots(struct swap_info_struct *si, return n_ret; } -#ifdef CONFIG_THP_SWAP static int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) { unsigned long idx; @@ -877,6 +876,15 @@ static int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) unsigned long offset, i; unsigned char *map; + /* +* Should not even be attempting cluster allocations when huge +* page swap is disabled. Warn and fail the allocation. +*/ + if (!IS_ENABLED(CONFIG_THP_SWAP)) { + VM_WARN_ON_ONCE(1); + return 0; + } + if (cluster_list_empty(&si->free_clusters)) return 0; @@ -907,13 +915,6 @@ static void swap_free_cluster(struct swap_info_struct *si, unsigned long idx) unlock_cluster(ci); swap_range_free(si, offset, SWAPFILE_CLUSTER); } -#else -static int swap_alloc_cluster(struct swap_info_struct *si, swp_entry_t *slot) -{ - VM_WARN_ON_ONCE(1); - return 0; -} -#endif /* CONFIG_THP_SWAP */ static unsigned long scan_swap_map(struct swap_info_struct *si, unsigned char usage) @@ -1259,7 +1260,6 @@ static void swapcache_free(swp_entry_t entry) } } -#ifdef CONFIG_THP_SWAP static void swapcache_free_cluster(swp_entry_t entry) { unsigned long offset = swp_offset(entry); @@ -1270,6 +1270,9 @@ static void swapcache_free_cluster(swp_entry_t entry) unsigned int i, free_entries = 0; unsigned char val; + if (!IS_ENABLED(CONFIG_THP_SWAP)) + return; + si = _swap_info_get(entry); if (!si) return; @@ -1305,6 +1308,7 @@ static void swapcache_free_cluster(swp_entry_t entry) } } +#ifdef CONFIG_THP_SWAP int split_swap_cluster(swp_entry_t entry) { struct swap_info_struct *si; @@ -1319,11 +1323,7 @@ int split_swap_cluster(swp_entry_t entry) unlock_cluster(ci); return 0; } -#else -static inline void swapcache_free_cluster(swp_entry_t entry) -{ -} -#endif /* CONFIG_THP_SWAP */ +#endif void put_swap_page(struct page *page, swp_entry_t entry) { @@ -1482,7 +1482,6 @@ int swp_swapcount(swp_entry_t entry) return count; } -#ifdef CONFIG_THP_SWAP static bool swap_page_trans_huge_swapped(struct swap_info_struct *si, swp_entry_t entry) { @@ -1493,6 +1492,9 @@ static bool swap_page_trans_huge_swapped(struct swap_info_struct *si, int i; bool ret = false; + if (!IS_ENABLED(CONFIG_THP_SWAP)) + return swap_swapcount(si, entry) != 0; + ci = lock_cluster_or_swap_info(si, offset); if (!ci || !cluster_is_huge(ci)) { if (map[roffset] != SWAP_HAS_CACHE) @@ -1515,7 +1517,7 @@ static bool page_swapped(struct page *page) swp_entry_t entry; struct swap_info_struct *si; - if (likely(!PageTransCompound(page))) + if (!IS_ENABLED(CONFIG_THP_SWAP) || likely(!PageTransCompound(page))) return page_swapcount(page) != 0; page = compound_head(page); @@ -1539,10 +1541,8 @@ static int page_trans_huge_map_swapcount(struct page *page, int *total_mapcount, /* hugetlbfs shouldn't call it */ VM_BUG_ON_PAGE(PageHuge(page), page); - if (likely(!PageTransCompound(page))) { - mapcount = atomic_read(&page->_mapcount) + 1; - if (total_mapcount) -
Re: m68k allmodconfig build errors
On Jul 19 2018, Randy Dunlap wrote: > block/partitions/ldm.o: In function `ldm_partition': > ldm.c:(.text+0x1900): undefined reference to `strcmp' > ldm.c:(.text+0x1964): undefined reference to `strcmp' > drivers/rtc/rtc-proc.o: In function `is_rtc_hctosys': > rtc-proc.c:(.text+0x290): undefined reference to `strcmp' > drivers/watchdog/watchdog_pretimeout.o: In function > `watchdog_register_governor': > (.text+0x142): undefined reference to `strcmp' GCC has optimized strncmp to strcmp, but at a stage where macros are no longer available. I think the right fix is to use strcmp directly, since strncmp doesn't make sense here. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
[PATCH v4 8/8] swap, put_swap_page: Share more between huge/normal code path
In this patch, locking related code is shared between huge/normal code path in put_swap_page() to reduce code duplication. And `free_entries == 0` case is merged into more general `free_entries != SWAPFILE_CLUSTER` case, because the new locking method makes it easy. The added lines is same as the removed lines. But the code size is increased when CONFIG_TRANSPARENT_HUGEPAGE=n. text data bss dec hex filename base: 24123 2004 340 264676763 mm/swapfile.o unified: 24485 2004 340 2682968cd mm/swapfile.o Dig on step deeper with `size -A mm/swapfile.o` for base and unified kernel and compare the result, yields, -.text17723 0 +.text17835 0 -.orc_unwind_ip1380 0 +.orc_unwind_ip1480 0 -.orc_unwind 2070 0 +.orc_unwind 2220 0 -Total26686 +Total27048 The total difference is the same. The text segment difference is much smaller: 112. More difference comes from the ORC unwinder segments: (1480 + 2220) - (1380 + 2070) = 250. If the frame pointer unwinder is used, this costs nothing. Signed-off-by: "Huang, Ying" Reviewed-by: Daniel Jordan Acked-by: Dave Hansen Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 402d52ff3e4a..f792fa902249 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1282,8 +1282,8 @@ void put_swap_page(struct page *page, swp_entry_t entry) if (!si) return; + ci = lock_cluster_or_swap_info(si, offset); if (size == SWAPFILE_CLUSTER) { - ci = lock_cluster(si, offset); VM_BUG_ON(!cluster_is_huge(ci)); map = si->swap_map + offset; for (i = 0; i < SWAPFILE_CLUSTER; i++) { @@ -1292,13 +1292,9 @@ void put_swap_page(struct page *page, swp_entry_t entry) if (val == SWAP_HAS_CACHE) free_entries++; } - if (!free_entries) { - for (i = 0; i < SWAPFILE_CLUSTER; i++) - map[i] &= ~SWAP_HAS_CACHE; - } cluster_clear_huge(ci); - unlock_cluster(ci); if (free_entries == SWAPFILE_CLUSTER) { + unlock_cluster_or_swap_info(si, ci); spin_lock(&si->lock); ci = lock_cluster(si, offset); memset(map, 0, SWAPFILE_CLUSTER); @@ -1309,12 +1305,16 @@ void put_swap_page(struct page *page, swp_entry_t entry) return; } } - if (size == 1 || free_entries) { - for (i = 0; i < size; i++, entry.val++) { - if (!__swap_entry_free(si, entry, SWAP_HAS_CACHE)) - free_swap_slot(entry); + for (i = 0; i < size; i++, entry.val++) { + if (!__swap_entry_free_locked(si, offset + i, SWAP_HAS_CACHE)) { + unlock_cluster_or_swap_info(si, ci); + free_swap_slot(entry); + if (i == size - 1) + return; + lock_cluster_or_swap_info(si, offset); } } + unlock_cluster_or_swap_info(si, ci); } #ifdef CONFIG_THP_SWAP -- 2.16.4
[PATCH v4 5/8] swap: Unify normal/huge code path in put_swap_page()
In this patch, the normal/huge code path in put_swap_page() and several helper functions are unified to avoid duplicated code, bugs, etc. and make it easier to review the code. The removed lines are more than added lines. And the binary size is kept exactly same when CONFIG_TRANSPARENT_HUGEPAGE=n. Signed-off-by: "Huang, Ying" Suggested-and-acked-by: Dave Hansen Reviewed-by: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 83 ++- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 97814a01170d..ad247c3da494 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -205,8 +205,16 @@ static void discard_swap_cluster(struct swap_info_struct *si, #ifdef CONFIG_THP_SWAP #define SWAPFILE_CLUSTER HPAGE_PMD_NR + +#define swap_entry_size(size) (size) #else #define SWAPFILE_CLUSTER 256 + +/* + * Define swap_entry_size() as constant to let compiler to optimize + * out some code if !CONFIG_THP_SWAP + */ +#define swap_entry_size(size) 1 #endif #define LATENCY_LIMIT 256 @@ -1251,18 +1259,7 @@ void swap_free(swp_entry_t entry) /* * Called after dropping swapcache to decrease refcnt to swap entries. */ -static void swapcache_free(swp_entry_t entry) -{ - struct swap_info_struct *p; - - p = _swap_info_get(entry); - if (p) { - if (!__swap_entry_free(p, entry, SWAP_HAS_CACHE)) - free_swap_slot(entry); - } -} - -static void swapcache_free_cluster(swp_entry_t entry) +void put_swap_page(struct page *page, swp_entry_t entry) { unsigned long offset = swp_offset(entry); unsigned long idx = offset / SWAPFILE_CLUSTER; @@ -1271,39 +1268,41 @@ static void swapcache_free_cluster(swp_entry_t entry) unsigned char *map; unsigned int i, free_entries = 0; unsigned char val; - - if (!IS_ENABLED(CONFIG_THP_SWAP)) - return; + int size = swap_entry_size(hpage_nr_pages(page)); si = _swap_info_get(entry); if (!si) return; - ci = lock_cluster(si, offset); - VM_BUG_ON(!cluster_is_huge(ci)); - map = si->swap_map + offset; - for (i = 0; i < SWAPFILE_CLUSTER; i++) { - val = map[i]; - VM_BUG_ON(!(val & SWAP_HAS_CACHE)); - if (val == SWAP_HAS_CACHE) - free_entries++; - } - if (!free_entries) { - for (i = 0; i < SWAPFILE_CLUSTER; i++) - map[i] &= ~SWAP_HAS_CACHE; - } - cluster_clear_huge(ci); - unlock_cluster(ci); - if (free_entries == SWAPFILE_CLUSTER) { - spin_lock(&si->lock); + if (size == SWAPFILE_CLUSTER) { ci = lock_cluster(si, offset); - memset(map, 0, SWAPFILE_CLUSTER); + VM_BUG_ON(!cluster_is_huge(ci)); + map = si->swap_map + offset; + for (i = 0; i < SWAPFILE_CLUSTER; i++) { + val = map[i]; + VM_BUG_ON(!(val & SWAP_HAS_CACHE)); + if (val == SWAP_HAS_CACHE) + free_entries++; + } + if (!free_entries) { + for (i = 0; i < SWAPFILE_CLUSTER; i++) + map[i] &= ~SWAP_HAS_CACHE; + } + cluster_clear_huge(ci); unlock_cluster(ci); - mem_cgroup_uncharge_swap(entry, SWAPFILE_CLUSTER); - swap_free_cluster(si, idx); - spin_unlock(&si->lock); - } else if (free_entries) { - for (i = 0; i < SWAPFILE_CLUSTER; i++, entry.val++) { + if (free_entries == SWAPFILE_CLUSTER) { + spin_lock(&si->lock); + ci = lock_cluster(si, offset); + memset(map, 0, SWAPFILE_CLUSTER); + unlock_cluster(ci); + mem_cgroup_uncharge_swap(entry, SWAPFILE_CLUSTER); + swap_free_cluster(si, idx); + spin_unlock(&si->lock); + return; + } + } + if (size == 1 || free_entries) { + for (i = 0; i < size; i++, entry.val++) { if (!__swap_entry_free(si, entry, SWAP_HAS_CACHE)) free_swap_slot(entry); } @@ -1327,14 +1326,6 @@ int split_swap_cluster(swp_entry_t entry) } #endif -void put_swap_page(struct page *page, swp_entry_t entry) -{ - if (!PageTransHuge(page)) - swapcache_free(entry); - else - swapcache_free_cluster(entry); -} - static int swp_entry_cmp(const void *ent1, const void *ent2) { const swp_entry_t *e1 = ent1, *e2 =
[PATCH v4 7/8] swap: Add __swap_entry_free_locked()
The part of __swap_entry_free() with lock held is separated into a new function __swap_entry_free_locked(). Because we want to reuse that piece of code in some other places. Just mechanical code refactoring, there is no any functional change in this function. Signed-off-by: "Huang, Ying" Reviewed-by: Daniel Jordan Acked-by: Dave Hansen Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index d80567dd60db..402d52ff3e4a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1182,16 +1182,13 @@ struct swap_info_struct *get_swap_device(swp_entry_t entry) return NULL; } -static unsigned char __swap_entry_free(struct swap_info_struct *p, - swp_entry_t entry, unsigned char usage) +static unsigned char __swap_entry_free_locked(struct swap_info_struct *p, + unsigned long offset, + unsigned char usage) { - struct swap_cluster_info *ci; - unsigned long offset = swp_offset(entry); unsigned char count; unsigned char has_cache; - ci = lock_cluster_or_swap_info(p, offset); - count = p->swap_map[offset]; has_cache = count & SWAP_HAS_CACHE; @@ -1219,6 +1216,17 @@ static unsigned char __swap_entry_free(struct swap_info_struct *p, usage = count | has_cache; p->swap_map[offset] = usage ? : SWAP_HAS_CACHE; + return usage; +} + +static unsigned char __swap_entry_free(struct swap_info_struct *p, + swp_entry_t entry, unsigned char usage) +{ + struct swap_cluster_info *ci; + unsigned long offset = swp_offset(entry); + + ci = lock_cluster_or_swap_info(p, offset); + usage = __swap_entry_free_locked(p, offset, usage); unlock_cluster_or_swap_info(p, ci); return usage; -- 2.16.4
[PATCH v4 6/8] swap, get_swap_pages: Use entry_size instead of cluster in parameter
As suggested by Matthew Wilcox, it is better to use "int entry_size" instead of "bool cluster" as parameter to specify whether to operate for huge or normal swap entries. Because this improve the flexibility to support other swap entry size. And Dave Hansen thinks that this improves code readability too. So in this patch, the "bool cluster" parameter of get_swap_pages() is replaced by "int entry_size". And nr_swap_entries() trick is used to reduce the binary size when !CONFIG_TRANSPARENT_HUGE_PAGE. textdata bss dec hex filename base 242152028 340 2658367d7 mm/swapfile.o head 241232004 340 264676763 mm/swapfile.o Signed-off-by: "Huang, Ying" Acked-by: Dave Hansen Cc: Daniel Jordan Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- include/linux/swap.h | 2 +- mm/swap_slots.c | 8 mm/swapfile.c| 16 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index e20c240d6c65..34de0d8bf4fa 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -443,7 +443,7 @@ extern void si_swapinfo(struct sysinfo *); extern swp_entry_t get_swap_page(struct page *page); extern void put_swap_page(struct page *page, swp_entry_t entry); extern swp_entry_t get_swap_page_of_type(int); -extern int get_swap_pages(int n, bool cluster, swp_entry_t swp_entries[]); +extern int get_swap_pages(int n, swp_entry_t swp_entries[], int entry_size); extern int add_swap_count_continuation(swp_entry_t, gfp_t); extern void swap_shmem_alloc(swp_entry_t); extern int swap_duplicate(swp_entry_t); diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 008ccb22fee6..63a7b4563a57 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -269,8 +269,8 @@ static int refill_swap_slots_cache(struct swap_slots_cache *cache) cache->cur = 0; if (swap_slot_cache_active) - cache->nr = get_swap_pages(SWAP_SLOTS_CACHE_SIZE, false, - cache->slots); + cache->nr = get_swap_pages(SWAP_SLOTS_CACHE_SIZE, + cache->slots, 1); return cache->nr; } @@ -316,7 +316,7 @@ swp_entry_t get_swap_page(struct page *page) if (PageTransHuge(page)) { if (IS_ENABLED(CONFIG_THP_SWAP)) - get_swap_pages(1, true, &entry); + get_swap_pages(1, &entry, HPAGE_PMD_NR); goto out; } @@ -350,7 +350,7 @@ swp_entry_t get_swap_page(struct page *page) goto out; } - get_swap_pages(1, false, &entry); + get_swap_pages(1, &entry, 1); out: if (mem_cgroup_try_charge_swap(page, entry)) { put_swap_page(page, entry); diff --git a/mm/swapfile.c b/mm/swapfile.c index ad247c3da494..d80567dd60db 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -941,18 +941,18 @@ static unsigned long scan_swap_map(struct swap_info_struct *si, } -int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[]) +int get_swap_pages(int n_goal, swp_entry_t swp_entries[], int entry_size) { - unsigned long nr_pages = cluster ? SWAPFILE_CLUSTER : 1; + unsigned long size = swap_entry_size(entry_size); struct swap_info_struct *si, *next; long avail_pgs; int n_ret = 0; int node; /* Only single cluster request supported */ - WARN_ON_ONCE(n_goal > 1 && cluster); + WARN_ON_ONCE(n_goal > 1 && size == SWAPFILE_CLUSTER); - avail_pgs = atomic_long_read(&nr_swap_pages) / nr_pages; + avail_pgs = atomic_long_read(&nr_swap_pages) / size; if (avail_pgs <= 0) goto noswap; @@ -962,7 +962,7 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[]) if (n_goal > avail_pgs) n_goal = avail_pgs; - atomic_long_sub(n_goal * nr_pages, &nr_swap_pages); + atomic_long_sub(n_goal * size, &nr_swap_pages); spin_lock(&swap_avail_lock); @@ -989,14 +989,14 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[]) spin_unlock(&si->lock); goto nextsi; } - if (cluster) { + if (size == SWAPFILE_CLUSTER) { if (!(si->flags & SWP_FILE)) n_ret = swap_alloc_cluster(si, swp_entries); } else n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE, n_goal, swp_entries); spin_unlock(&si->lock); - if (n_ret || cluster) + if (n_ret || size == SWAPFILE_CLUSTER) goto check_out; pr_debug("scan_swap_map of si %d failed to find off
[PATCH v4 3/8] swap: Use swap_count() in swap_page_trans_huge_swapped()
In swap_page_trans_huge_swapped(), to identify whether there's any page table mapping for a 4k sized swap entry, "si->swap_map[i] != SWAP_HAS_CACHE" is used. This works correctly now, because all users of the function will only call it after checking SWAP_HAS_CACHE. But as pointed out by Daniel, it is better to use "swap_count(map[i])" here, because it works for "map[i] == 0" case too. And this makes the implementation more consistent between normal and huge swap entry. Signed-off-by: "Huang, Ying" Suggested-and-reviewed-by: Daniel Jordan Acked-by: Dave Hansen Cc: Michal Hocko Cc: Johannes Weiner Cc: Shaohua Li Cc: Hugh Dickins Cc: Minchan Kim Cc: Rik van Riel Cc: Dan Williams --- mm/swapfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 7283104bfafa..833613e59ef7 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1497,12 +1497,12 @@ static bool swap_page_trans_huge_swapped(struct swap_info_struct *si, ci = lock_cluster_or_swap_info(si, offset); if (!ci || !cluster_is_huge(ci)) { - if (map[roffset] != SWAP_HAS_CACHE) + if (swap_count(map[roffset])) ret = true; goto unlock_out; } for (i = 0; i < SWAPFILE_CLUSTER; i++) { - if (map[offset + i] != SWAP_HAS_CACHE) { + if (swap_count(map[offset + i])) { ret = true; break; } -- 2.16.4
[RESEND PATCH] Revert "pwm: Set class for exported channels in sysfs"
This reverts commit 7e5d1fd75c3dde9fc10c4472b9368089d1b81d00 as it causes regression with multiple pwm chip. It creates a new entry in '/sys/class/pwm' every time a 'pwmX' is exported with 'echo X > export': - 1st time export will create an entry in /sys/class/pwm/pwmX - when another export happens on another pwmchip, it can't be created (e.g. -EEXIST) This also changes existing ABI (Documentation/ABI/testing/sysfs-class-pwm): - pmwX should be there: /sys/class/pwm/pwmchipN/pwmX Example on stm32 (stm32429i-eval) platform: $ ls /sys/class/pwm pwmchip0 pwmchip4 $ cd /sys/class/pwm/pwmchip0/ $ echo 0 > export $ ls /sys/class/pwm pwm0 pwmchip0 pwmchip4 $ cd /sys/class/pwm/pwmchip4/ $ echo 0 > export sysfs: cannot create duplicate filename '/class/pwm/pwm0' ...Exception stack follows... Signed-off-by: Fabrice Gasnier --- drivers/pwm/sysfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index 7c71cdb..4726d43 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c @@ -263,7 +263,6 @@ static int pwm_export_child(struct device *parent, struct pwm_device *pwm) export->pwm = pwm; mutex_init(&export->lock); - export->child.class = parent->class; export->child.release = pwm_export_release; export->child.parent = parent; export->child.devt = MKDEV(0, 0); -- 1.9.1
[PATCH] x86: use PTR_ERR_OR_ZERO to fix ptr_ret.cocci warning
ptr_ret.cocci warnings: arch/x86/kernel/pcspeaker.c:12:8-14: WARNING: PTR_ERR_OR_ZERO can be used use PTR_ERR_OR_ZERO rather than an open-code version to fix this. Signed-off-by: YueHaibing --- arch/x86/kernel/pcspeaker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/pcspeaker.c b/arch/x86/kernel/pcspeaker.c index da5190a..4a710ff 100644 --- a/arch/x86/kernel/pcspeaker.c +++ b/arch/x86/kernel/pcspeaker.c @@ -9,6 +9,6 @@ static __init int add_pcspkr(void) pd = platform_device_register_simple("pcspkr", -1, NULL, 0); - return IS_ERR(pd) ? PTR_ERR(pd) : 0; + return PTR_ERR_OR_ZERO(pd); } device_initcall(add_pcspkr); -- 2.7.0
UBSAN: Undefined behaviour in arch/x86/events/core.c:668:25
Dear Linux folks, Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the warning below is shown. [1.945853] [1.946192] UBSAN: Undefined behaviour in arch/x86/events/core.c:668:25 [1.946309] member access within null pointer of type 'struct perf_event' [1.946500] CPU: 0 PID: 127 Comm: perf_4.17 Not tainted 4.18.0-rc5-00316-g4864b68cedf2 #104 [1.946502] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 [1.946505] Call Trace: [1.946518] dump_stack+0x55/0x89 [1.946524] ubsan_epilogue+0xb/0x33 [1.946529] handle_null_ptr_deref+0x7f/0x90 [1.946534] __ubsan_handle_type_mismatch_v1+0x55/0x60 [1.946540] x86_pmu_enable_all+0x165/0x1b0 [1.946544] x86_pmu_enable+0x162/0x480 [1.946550] perf_pmu_enable.part.39+0x14/0x30 [1.946553] ctx_resched+0xa4/0x130 [1.946558] __perf_install_in_context+0x21e/0x3e0 [1.946562] ? memcg_kmem_get_cache+0xb2/0x3a0 [1.946565] ? memcg_kmem_get_cache+0xb2/0x3a0 [1.946569] remote_function+0x45/0x60 [1.946574] generic_exec_single+0x102/0x210 [1.946579] ? get_empty_filp+0x6b/0x260 [1.946582] ? task_function_call+0x80/0x80 [1.946586] smp_call_function_single+0xf0/0x150 [1.946590] ? get_empty_filp+0x102/0x260 [1.946594] ? alloc_file+0x9b/0x1e0 [1.946598] perf_install_in_context+0x14e/0x1d0 [1.946602] ? perf_install_in_context+0x1d0/0x1d0 [1.946607] __do_sys_perf_event_open+0x413/0xfa0 [1.946616] sys_perf_event_open+0x21/0x30 [1.946619] do_fast_syscall_32+0xce/0x3e0 [1.946624] entry_SYSENTER_32+0x4e/0x7c [1.946628] EIP: 0xb7f73bb5 [1.946630] Code: 89 e5 8b 55 08 85 d2 8b 80 5c cd ff ff 74 02 89 02 5d c3 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76 [1.946699] EAX: ffda EBX: 00e3f49c ECX: EDX: [1.946701] ESI: EDI: 0008 EBP: ESP: bfe3257c [1.946704] DS: 007b ES: 007b FS: GS: 0033 SS: 007b EFLAGS: 0296 [1.946708] Kind regards, Paul
Re: [PATCH v3 28/33] mtd: rawnand: docg4: convert driver to nand_scan()
On Fri, 20 Jul 2018 09:17:45 +0200 Miquel Raynal wrote: > Hi Boris, > > Boris Brezillon wrote on Fri, 20 Jul 2018 > 01:27:32 +0200: > > > On Fri, 20 Jul 2018 01:00:21 +0200 > > Miquel Raynal wrote: > > > > > Two helpers have been added to the core to make ECC-related > > > configuration between the detection phase and the final NAND scan. Use > > > these hooks and convert the driver to just use nand_scan() instead of > > > both nand_scan_ident() and nand_scan_tail(). > > > > > > Signed-off-by: Miquel Raynal > > > --- > > > drivers/mtd/nand/raw/docg4.c | 55 > > > ++-- > > > 1 file changed, 32 insertions(+), 23 deletions(-) > > > > > > diff --git a/drivers/mtd/nand/raw/docg4.c b/drivers/mtd/nand/raw/docg4.c > > > index 4dccdfba6140..2f6fcd4efab2 100644 > > > --- a/drivers/mtd/nand/raw/docg4.c > > > +++ b/drivers/mtd/nand/raw/docg4.c > > > @@ -1227,10 +1227,9 @@ static void __init init_mtd_structs(struct > > > mtd_info *mtd) > > >* required within a nand driver because they are performed by the nand > > >* infrastructure code as part of nand_scan(). In this case they need > > >* to be initialized here because we skip call to nand_scan_ident() (the > > > - * first half of nand_scan()). The call to nand_scan_ident() is skipped > > > - * because for this device the chip id is not read in the manner of a > > > - * standard nand device. Unfortunately, nand_scan_ident() does other > > > - * things as well, such as call nand_set_defaults(). > > > + * first half of nand_scan()). The call to nand_scan_ident() could be > > > + * skipped because for this device the chip id is not read in the manner > > > + * of a standard nand device. > > >*/ > > > > > > struct nand_chip *nand = mtd_to_nand(mtd); > > > @@ -1315,6 +1314,27 @@ static int __init read_id_reg(struct mtd_info *mtd) > > > > > > static char const *part_probes[] = { "cmdlinepart", "saftlpart", NULL }; > > > > > > +static int docg4_attach_chip(struct nand_chip *chip) > > > +{ > > > + struct mtd_info *mtd = nand_to_mtd(chip); > > > + struct docg4_priv *doc = (struct docg4_priv *)(chip + 1); > > > + > > > + init_mtd_structs(mtd); > > > + > > > + /* Initialize kernel BCH algorithm */ > > > + doc->bch = init_bch(DOCG4_M, DOCG4_T, DOCG4_PRIMITIVE_POLY); > > > + if (!doc->bch) > > > + return -EINVAL; > > > + > > > + reset(mtd); > > > + > > > + return read_id_reg(mtd); > > > +} > > > + > > > +static struct nand_controller_ops docg4_controller_ops = { > > > + .attach_chip = docg4_attach_chip, > > > +}; > > > + > > > static int __init probe_docg4(struct platform_device *pdev) > > > { > > > struct mtd_info *mtd; > > > @@ -1350,26 +1370,16 @@ static int __init probe_docg4(struct > > > platform_device *pdev) > > > mtd->dev.parent = &pdev->dev; > > > doc->virtadr = virtadr; > > > doc->dev = dev; > > > - > > > - init_mtd_structs(mtd); > > > - > > > - /* initialize kernel bch algorithm */ > > > - doc->bch = init_bch(DOCG4_M, DOCG4_T, DOCG4_PRIMITIVE_POLY); > > > - if (doc->bch == NULL) { > > > - retval = -EINVAL; > > > - goto free_nand; > > > - } > > > - > > > platform_set_drvdata(pdev, doc); > > > > > > - reset(mtd); > > > - retval = read_id_reg(mtd); > > > - if (retval == -ENODEV) { > > > - dev_warn(dev, "No diskonchip G4 device found.\n"); > > > - goto free_bch; > > > - } > > > - > > > - retval = nand_scan_tail(mtd); > > > + /* > > > + * Asking for 0 chips is useless here but it warns the user that the use > > > + * of the nand_scan() function is a bit abused here because the > > > + * initialization is actually a bit specific and re-handled again in the > > > + * ->attach_chip() hook. It will probably leak some memory though. > > > + */ > > > + nand->dummy_controller.ops = &docg4_controller_ops; > > > + retval = nand_scan(mtd, 0); > > > if (retval) > > > goto free_bch; > > > > Hm, not sure this works. The driver only calls nand_scan_tail(), but > > you replace that by a call to nand_scan(), which will call both > > nand_scan_ident() and nand_scan_tail(), and I'm pretty sure > > nand_scan_ident() will fail here. > > I know docg4 is a bit specific and could maybe be moved out of the raw/ > subdirectory. But in the meantime I don't want to block the series for > this. The better I can propose right now (open to other ideas as > well) would be to return 0 in nand_scan_ident() if the maxchip parameter > is 0 which is the case only in this driver AFAIS. Sounds good. Just document this particular case in nand_scan_ident() kernel-doc header.
[PATCH v4 10/11] kbuild: do not update config for 'make kernelrelease'
'make kernelrelease' depends on CONFIG_LOCALVERSION(_AUTO), but for the same reason as install targets, we do not want to update the configuration just for printing the kernelrelease string. This is likely to happen when you compiled the kernel with CROSS_COMPILE, but forget to pass it to 'make kernelrelease'. Signed-off-by: Masahiro Yamada --- Changes in v4: None Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ad83917..0ec1c27 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,8 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg -no-sync-config-targets := $(no-dot-config-targets) install %install +no-sync-config-targets := $(no-dot-config-targets) install %install \ + kernelrelease config-targets := 0 mixed-targets := 0 -- 2.7.4
[PATCH v4 06/11] kconfig: allow all config targets to write auto.conf if missing
Currently, only syncconfig creates or updates include/config/auto.conf and some other files. Other config targets create or update only the .config file. When you configure and build the kernel from a pristine source tree, any config target is followed by syncconfig in the build stage since include/config/auto.conf is missing. We are moving compiler tests from Makefile to Kconfig. It means that parsing Kconfig files will be more costly since Kconfig invokes the compiler commands internally. Thus, we want to avoid invoking Kconfig twice (one for *config to create the .config, and one for syncconfig to synchronize the auto.conf). If auto.conf does not exist, we can generate all configuration files in the first configuration stage, which will save the syncconfig in the build stage. Please note this should be done only when auto.conf is missing. If *config blindly did this, time stamp files under include/config/ would be unnecessarily touched, triggering unneeded rebuild of objects. I assume a scenario like this: 1. You have a source tree that has already been built with CONFIG_FOO disabled 2. Run "make menuconfig" to enable CONFIG_FOO 3. CONFIG_FOO turns out to be unnecessary. Run "make menuconfig" again to disable CONFIG_FOO 4. Run "make" In this case, include/config/foo.h should not be touched since there is no change in CONFIG_FOO. The sync process should be delayed until the user really attempts to build the kernel. This commit has another motivation; I want to suppress the 'No such file or directory' warning from the 'include' directive. The top-level Makefile includes auto.conf with '-include' directive, like this: ifeq ($(dot-config),1) -include include/config/auto.conf endif This looks strange because auto.conf is mandatory when dot-config is 1. I guess only the reason of using '-include' is to suppress the warning 'include/config/auto.conf: No such file or directory' when building from a clean tree. However, this has a side-effect; Make considers the files included by '-include' are optional. Hence, Make continues to build even if it fails to generate include/config/auto.conf. I will change this in the next commit, but the warning message is annoying. (At least, kbuild test robot reports it as a regression.) With this commit, Kconfig will generate all configuration files together with the .config and I guess it is a solution good enough to suppress the warning. Note: GNU Make 4.2 or later does not display the warning from the 'include' directive if include files are successfully generated. See GNU Make commit 87a5f98d248f ("[SV 102] Don't show unnecessary include file errors.") However, older GNU Make versions are still widely used. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/conf.c | 31 +-- scripts/kconfig/confdata.c | 11 +++ scripts/kconfig/gconf.c | 1 + scripts/kconfig/lkc_proto.h | 2 +- scripts/kconfig/mconf.c | 1 + scripts/kconfig/nconf.c | 1 + scripts/kconfig/qconf.cc| 2 ++ 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 5af8991..b35cc93 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -686,29 +686,32 @@ int main(int ac, char **av) break; } - if (sync_kconfig) { - /* syncconfig is used during the build so we shall update autoconf. -* All other commands are only used to generate a config. -*/ - if (!no_conf_write && conf_write(NULL)) { - fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); - exit(1); - } - if (conf_write_autoconf()) { - fprintf(stderr, "\n*** Error during update of the configuration.\n\n"); - return 1; - } - } else if (input_mode == savedefconfig) { + if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n", defconfig_file); return 1; } } else if (input_mode != listnewconfig) { - if (conf_write(NULL)) { + if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } + + /* +* Create auto.conf if it does not exist. +* This prevents GNU Make 4.1 or older from emitting +* "include/config/auto.conf: No such file or directory" +* in the top-level Makefile +* +* syncconfig always creates or updates auto.conf because it is +
[PATCH v4 08/11] kbuild: add .DELETE_ON_ERROR special target
If Make gets a fatal signal while a shell is executing, it may delete the target file that the recipe was supposed to update. This is needed to make sure that it is remade from scratch when Make is next run; if Make is interrupted after the recipe has begun to write the target file, it results in an incomplete file whose time stamp is newer than that of the prerequisites files. Make automatically deletes the incomplete file on interrupt unless the target is marked .PRECIOUS. The situation is just the same as when the shell fails for some reasons. Usually when a recipe line fails, if it has changed the target file at all, the file is corrupted, or at least it is not completely updated. Yet the file’s time stamp says that it is now up to date, so the next time Make runs, it will not try to update that file. However, Make does not cater to delete the incomplete target file in this case. We need to add .DELETE_ON_ERROR somewhere in the Makefile to request it. scripts/Kbuild.include seems a suitable place to add it because it is included from almost all sub-makes. Please note .DELETE_ON_ERROR is not effective for phony targets. The external module building should never ever touch the kernel tree. The following recipe fails if include/generated/autoconf.h is missing. However, include/config/auto.conf is not deleted since it is a phony target. PHONY += include/config/auto.conf include/config/auto.conf: $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or $@ are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/Kbuild.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 3d14d0e..7f4b1db 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -400,3 +400,6 @@ endif endef # ### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: -- 2.7.4
[PATCH v4 09/11] kbuild: do not update config when running install targets
"make syncconfig" is automatically invoked when any of the following happens: - .config is updated - any of Kconfig files is updated - any of environment variables referenced in Kconfig is changed Then, it updates configuration files such as include/config/auto.conf include/generated/autoconf.h, etc. Even install targets (install, modules_install, etc.) are no exception. However, they should never ever modify the source tree. Install targets are often run with root privileges. Once those configuration files are owned by root, "make mrproper" would end up with permission error. Install targets should just copy things blindly. They should not care whether the configuration is up-to-date or not. This makes more sense because we are interested in the configuration that was used in the previous kernel building. This issue has existed since before, but rarely happened. I expect more chance where people are hit by this; with the new Kconfig syntax extension, the .config now contains the compiler information. If you cross-compile the kernel with CROSS_COMPILE, but forget to pass it for "make install", you meet "any of environment variables referenced in Kconfig is changed" because $(CC) is referenced in Kconfig. Another scenario is the compiler upgrade before the installation. Install targets need the configuration. "make modules_install" refer to CONFIG_MODULES etc. "make dtbs_install" also needs CONFIG_ARCH_* to decide which dtb files to install. However, the auto-update of the configuration files should be avoided. We already do this for external modules. Now, Make targets are categorized into 3 groups: [1] Do not need the kernel configuration at all help, coccicheck, headers_install etc. [2] Need the latest kernel configuration If new config options are added, Kconfig will show prompt to ask user's selection. Build targets such as vmlinux, in-kernel modules are the cases. [3] Need the kernel configuration, but do not want to update it Install targets except headers_install, and external modules are the cases. Signed-off-by: Masahiro Yamada --- Changes in v4: None Makefile | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 2fa9830..ad83917 100644 --- a/Makefile +++ b/Makefile @@ -225,10 +225,12 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg +no-sync-config-targets := $(no-dot-config-targets) install %install -config-targets := 0 -mixed-targets := 0 -dot-config := 1 +config-targets := 0 +mixed-targets := 0 +dot-config := 1 +may-sync-config := 1 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) @@ -236,6 +238,16 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif endif +ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) + may-sync-config := 0 + endif +endif + +ifneq ($(KBUILD_EXTMOD),) + may-sync-config := 0 +endif + ifeq ($(KBUILD_EXTMOD),) ifneq ($(filter config %config,$(MAKECMDGOALS)),) config-targets := 1 @@ -607,7 +619,7 @@ ARCH_CFLAGS := include arch/$(SRCARCH)/Makefile ifeq ($(dot-config),1) -ifeq ($(KBUILD_EXTMOD),) +ifeq ($(may-sync-config),1) # Read in dependencies to all Kconfig* files, make sure to run syncconfig if # changes are detected. This should be included after arch/$(SRCARCH)/Makefile # because some architectures define CROSS_COMPILE there. @@ -622,8 +634,9 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else -# external modules needs include/generated/autoconf.h and include/config/auto.conf -# but do not care if they are up-to-date. Use auto.conf to trigger the test +# External modules and some install targets need include/generated/autoconf.h +# and include/config/auto.conf but do not care if they are up-to-date. +# Use auto.conf to trigger the test PHONY += include/config/auto.conf include/config/auto.conf: @@ -635,7 +648,7 @@ include/config/auto.conf: echo >&2 ; \ /bin/false) -endif # KBUILD_EXTMOD +endif # may-sync-config else # Dummy target needed, because used as prerequisite -- 2.7.4
[PATCH v4 00/11] kbuild/kconfig: do not update config during installation
The main motivation of this patch series is to suppress the syncconfig during running installation targets. V1 consisted of only two patches: https://patchwork.kernel.org/patch/10468105/ https://patchwork.kernel.org/patch/10468103/ I noticed that installation targets would continue running even if the source tree is not configured at all because the inclusion of include/config/auto.conf was optional. So, I added one more patch in V2: https://patchwork.kernel.org/patch/10483637/ However, kbuild test robot reported a new warning message was displayed: Makefile:592: include/config/auto.conf: No such file or directory This warning is displayed only for Make 4.1 or older. To fix this annoying warning, I changed Kconfig too, which leaded to more clean-up, improvements in Kconfig. So, V3 became a big patch series. Only a few changes for V4. - I dropped the last patch in v3. - I am keeping include/config/auto.conf as the prerequisite of modules.builtin (11/11) Masahiro Yamada (11): kconfig: rename file_write_dep and move it to confdata.c kconfig: split out useful helpers in confdata.c kconfig: remove unneeded directory generation from local*config kconfig: create directories needed for syncconfig by itself kconfig: make syncconfig update .config regardless of sym_change_count kconfig: allow all config targets to write auto.conf if missing kbuild: use 'include' directive to load auto.conf from top Makefile kbuild: add .DELETE_ON_ERROR special target kbuild: do not update config when running install targets kbuild: do not update config for 'make kernelrelease' kbuild: remove auto.conf from prerequisite of phony targets Makefile| 44 +-- scripts/Kbuild.include | 3 + scripts/kconfig/Makefile| 16 ++ scripts/kconfig/conf.c | 39 +++-- scripts/kconfig/confdata.c | 135 +--- scripts/kconfig/gconf.c | 1 + scripts/kconfig/lkc.h | 1 - scripts/kconfig/lkc_proto.h | 2 +- scripts/kconfig/mconf.c | 1 + scripts/kconfig/nconf.c | 1 + scripts/kconfig/qconf.cc| 2 + scripts/kconfig/util.c | 30 -- 12 files changed, 177 insertions(+), 98 deletions(-) -- 2.7.4
[PATCH v2] checkpatch: kbuild: if_changed: check for multiple calls in targets
The kbuild function if_changed should not be called more than once for a target. Because that function writes the command line to a .cmd file for later tests, multiple calls of it within a target would result in overwrites of previous values and effectively render the command line test meaningless, resulting in flip-flop behaviour. Add a check for makefiles and kbuild files and produce an error for targets with multiple calls to if_changed. Three examples that now could be detected: 98f78525371b55ccd (x86/boot: Refuse to build with data relocations) 6a8dfe1cac5c591ae (microblaze: support U-BOOT image format) 684151a75bf25f5ae (sparc32: added U-Boot build target: uImage) Reviewed-by: Joe Perches Suggested-by: Masahiro Yamada Signed-off-by: Dirk Gouders --- v2: rework commit message and regular expression --- scripts/checkpatch.pl | 8 1 file changed, 8 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 447857ffaf6b..437e98414f74 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2911,6 +2911,14 @@ sub process { "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag}); } + # Check for multiple calls of if_changed within a target in Makefiles + if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) && + ($prevline =~ /^[ +]\t\s*\$\(call\s+if_changed,/) && + ($line =~ /^[ +]\t\s*\$\(call\s+if_changed,/)) { + ERROR("MULTIPLE_IF_CHANGED", + "Multiple calls of if_changed within a target.\n" . $herecurr); + } + # check for DT compatible documentation if (defined $root && (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) || -- 2.16.1
[PATCH v4 04/11] kconfig: create directories needed for syncconfig by itself
'make syncconfig' creates some files such as include/config/auto.conf, include/generate/autoconf.h, etc. but the necessary directory creation relies on scripts/kconfig/Makefile. To make Kconfig self-contained, create directories as needed in conf_write_autoconf(). This change allows scripts/kconfig/Makefile cleanups; syncconfig can be merged into simple-targets. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/Makefile | 15 ++- scripts/kconfig/confdata.c | 14 ++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 96a1c3d..963ba90 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -3,8 +3,7 @@ # Kernel configuration targets # These targets are used from top-level makefile -PHONY += xconfig gconfig menuconfig config syncconfig \ - localmodconfig localyesconfig +PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) @@ -34,12 +33,6 @@ config: $(obj)/conf nconfig: $(obj)/nconf $< $(silent) $(Kconfig) -# This has become an internal implementation detail and is now deprecated -# for external use. -syncconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated - $< $(silent) --$@ $(Kconfig) - localyesconfig localmodconfig: $(obj)/conf $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ @@ -55,8 +48,12 @@ localyesconfig localmodconfig: $(obj)/conf $(Q)rm -f .tmp.config # These targets map 1:1 to the commandline options of 'conf' +# +# Note: +# syncconfig has become an internal implementation detail and is now +# deprecated for external use simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ - alldefconfig randconfig listnewconfig olddefconfig + alldefconfig randconfig listnewconfig olddefconfig syncconfig PHONY += $(simple-targets) $(simple-targets): $(obj)/conf diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index f9c5ad4..029ab16 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -894,6 +894,9 @@ static int conf_write_dep(const char *name) fprintf(out, "\n$(deps_config): ;\n"); fclose(out); + + if (make_parent_dir(name)) + return 1; rename("..config.tmp", name); return 0; } @@ -910,6 +913,8 @@ static int conf_split_config(void) conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); + if (make_parent_dir("include/config/foo.h")) + return 1; if (chdir("include/config")) return 1; @@ -986,6 +991,7 @@ static int conf_split_config(void) res = 1; goto out; } + /* Try it again. */ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd == -1) { @@ -1058,14 +1064,22 @@ int conf_write_autoconf(void) name = getenv("KCONFIG_AUTOHEADER"); if (!name) name = "include/generated/autoconf.h"; + if (make_parent_dir(name)) + return 1; if (rename(".tmpconfig.h", name)) return 1; + name = getenv("KCONFIG_TRISTATE"); if (!name) name = "include/config/tristate.conf"; + if (make_parent_dir(name)) + return 1; if (rename(".tmpconfig_tristate", name)) return 1; + name = conf_get_autoconfig_name(); + if (make_parent_dir(name)) + return 1; /* * This must be the last step, kbuild has a dependency on auto.conf * and this marks the successful completion of the previous steps. -- 2.7.4
[PATCH v4 01/11] kconfig: rename file_write_dep and move it to confdata.c
file_write_dep() is called only from conf_write_autoconf(). Move it from util.c to confdata.c to make it static. Also, rename it to conf_write_dep() since it should belong to the group of conf_write* functions. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/confdata.c | 31 ++- scripts/kconfig/lkc.h | 1 - scripts/kconfig/util.c | 30 -- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 39e2097..4771820 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -813,6 +813,35 @@ int conf_write(const char *name) return 0; } +/* write a dependency file as used by kbuild to track dependencies */ +static int conf_write_dep(const char *name) +{ + struct file *file; + FILE *out; + + if (!name) + name = ".kconfig.d"; + out = fopen("..config.tmp", "w"); + if (!out) + return 1; + fprintf(out, "deps_config := \\\n"); + for (file = file_list; file; file = file->next) { + if (file->next) + fprintf(out, "\t%s \\\n", file->name); + else + fprintf(out, "\t%s\n", file->name); + } + fprintf(out, "\n%s: \\\n" +"\t$(deps_config)\n\n", conf_get_autoconfig_name()); + + env_write_dep(out, conf_get_autoconfig_name()); + + fprintf(out, "\n$(deps_config): ;\n"); + fclose(out); + rename("..config.tmp", name); + return 0; +} + static int conf_split_config(void) { const char *name; @@ -935,7 +964,7 @@ int conf_write_autoconf(void) sym_clear_all_valid(); - file_write_dep("include/config/auto.conf.cmd"); + conf_write_dep("include/config/auto.conf.cmd"); if (conf_split_config()) return 1; diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index ed3ff88..6b7bbc6 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -97,7 +97,6 @@ void menu_set_type(int type); /* util.c */ struct file *file_lookup(const char *name); -int file_write_dep(const char *name); void *xmalloc(size_t size); void *xcalloc(size_t nmemb, size_t size); void *xrealloc(void *p, size_t size); diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index a365594..d999683 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c @@ -29,36 +29,6 @@ struct file *file_lookup(const char *name) return file; } -/* write a dependency file as used by kbuild to track dependencies */ -int file_write_dep(const char *name) -{ - struct file *file; - FILE *out; - - if (!name) - name = ".kconfig.d"; - out = fopen("..config.tmp", "w"); - if (!out) - return 1; - fprintf(out, "deps_config := \\\n"); - for (file = file_list; file; file = file->next) { - if (file->next) - fprintf(out, "\t%s \\\n", file->name); - else - fprintf(out, "\t%s\n", file->name); - } - fprintf(out, "\n%s: \\\n" -"\t$(deps_config)\n\n", conf_get_autoconfig_name()); - - env_write_dep(out, conf_get_autoconfig_name()); - - fprintf(out, "\n$(deps_config): ;\n"); - fclose(out); - rename("..config.tmp", name); - return 0; -} - - /* Allocate initial growable string */ struct gstr str_new(void) { -- 2.7.4
[PATCH v4 05/11] kconfig: make syncconfig update .config regardless of sym_change_count
syncconfig updates the .config only when sym_change_count > 0, i.e. any change in config symbols has been detected. Not only symbols but also comments are contained in the .config file. If only comments are updated, they are not fed back to the .config, then the stale comments are left-over. Of course, this is just a matter of comments, but why not fix it. I see some scenarios where this happens. Scenario A: 1. You have a source tree that has already been configured. 2. Linus increments the version number in the top-level Makefile (i.e. he commits a new release) 3. You pull it, and run 'make' 4. syncconfig is invoked because the environment variable, KERNELVERSION is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains a kernel version in the top line: # Automatically generated file; DO NOT EDIT. # Linux/arm64 4.18.0-rc2 Kernel Configuration ... which points to a previous version. Scenario B: 1. You have a source tree that has already been configured. 2. You upgrade the compiler, but it still has the same version number. This may happen if you regularly build the latest compiler from the source code. 3. You run 'make' 4. syncconfig is invoked because the environment variable, CC_VERSION_TEXT is updated, but the .config is not updated since no config symbol is changed. 5. The .config file contains the version string of the compiler: # # Compiler: aarch64-linux-gcc (GCC) 9.0.0 20180628 (experimental) # ... which carries the information of the old compiler. If KCONFIG_NOSILENTUPDATE is set, syncconfig is not allowed to update the .config file. Otherwise, it is fine to update it regardless of sym_change_count. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/conf.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 671ff53..5af8991 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -496,6 +496,7 @@ int main(int ac, char **av) int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; struct stat tmpstat; + int no_conf_write = 0; tty_stdio = isatty(0) && isatty(1); @@ -633,13 +634,14 @@ int main(int ac, char **av) } if (sync_kconfig) { - if (conf_get_changed()) { - name = getenv("KCONFIG_NOSILENTUPDATE"); - if (name && *name) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + if (conf_get_changed()) { fprintf(stderr, "\n*** The configuration requires explicit update.\n\n"); return 1; } + no_conf_write = 1; } } @@ -688,7 +690,7 @@ int main(int ac, char **av) /* syncconfig is used during the build so we shall update autoconf. * All other commands are only used to generate a config. */ - if (conf_get_changed() && conf_write(NULL)) { + if (!no_conf_write && conf_write(NULL)) { fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } -- 2.7.4
[PATCH v4 03/11] kconfig: remove unneeded directory generation from local*config
Commit 17263baf958b ("kconfig: Create include/generated for localmodconfig") added the 'mkdir' line because local{yes,mod}config ran streamline_config.pl followed by silentoldconfig at that time. Since commit 81d2bc227305 ("kconfig: invoke oldconfig instead of silentoldconfig from local*config"), no sub-directory is required. Signed-off-by: Masahiro Yamada --- Changes in v4: None scripts/kconfig/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index f3c0e62..96a1c3d 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -41,7 +41,6 @@ syncconfig: $(obj)/conf $< $(silent) --$@ $(Kconfig) localyesconfig localmodconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ cmp -s .tmp.config .config || \ -- 2.7.4
[PATCH v4 02/11] kconfig: split out useful helpers in confdata.c
Split out helpers: is_present() - check if the given path exists is_dir() - check if the given path exists and it is a directory make_parent_dir() - create the parent directories of the given path These helpers will be reused in later commits. Signed-off-by: Masahiro Yamada --- Changes in v4: - Rename mkdir_p() to make_parent_dir() for clarification - Add is_present() instead of is_file() scripts/kconfig/confdata.c | 81 -- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4771820..f9c5ad4 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -16,6 +16,64 @@ #include "lkc.h" +/* return true if 'path' exists, false otherwise */ +static bool is_present(const char *path) +{ + struct stat st; + + return !stat(path, &st); +} + +/* return true if 'path' exists and it is a directory, false otherwise */ +static bool is_dir(const char *path) +{ + struct stat st; + + if (stat(path, &st)) + return 0; + + return S_ISDIR(st.st_mode); +} + +/* + * Create the parent directory of the given path. + * + * For example, if 'include/config/auto.conf' is given, create 'include/config'. + */ +static int make_parent_dir(const char *path) +{ + char tmp[PATH_MAX + 1]; + char *p; + + strncpy(tmp, path, sizeof(tmp)); + tmp[sizeof(tmp) - 1] = 0; + + /* Remove the base name. Just return if nothing is left */ + p = strrchr(tmp, '/'); + if (!p) + return 0; + *(p + 1) = 0; + + /* Just in case it is an absolute path */ + p = tmp; + while (*p == '/') + p++; + + while ((p = strchr(p, '/'))) { + *p = 0; + + /* skip if the directory exists */ + if (!is_dir(tmp) && mkdir(tmp, 0755)) + return -1; + + *p = '/'; + while (*p == '/') + p++; + } + + return 0; +} + struct conf_printer { void (*print_symbol)(FILE *, struct symbol *, const char *, void *); void (*print_comment)(FILE *, const char *, void *); @@ -83,7 +141,6 @@ const char *conf_get_autoconfig_name(void) char *conf_get_default_confname(void) { - struct stat buf; static char fullname[PATH_MAX+1]; char *env, *name; @@ -91,7 +148,7 @@ char *conf_get_default_confname(void) env = getenv(SRCTREE); if (env) { sprintf(fullname, "%s/%s", env, name); - if (!stat(fullname, &buf)) + if (is_present(fullname)) return fullname; } return name; @@ -725,10 +782,9 @@ int conf_write(const char *name) dirname[0] = 0; if (name && name[0]) { - struct stat st; char *slash; - if (!stat(name, &st) && S_ISDIR(st.st_mode)) { + if (is_dir(name)) { strcpy(dirname, name); strcat(dirname, "/"); basename = conf_get_configname(); @@ -848,7 +904,6 @@ static int conf_split_config(void) char path[PATH_MAX+1]; char *s, *d, c; struct symbol *sym; - struct stat sb; int res, i, fd; name = conf_get_autoconfig_name(); @@ -926,18 +981,10 @@ static int conf_split_config(void) res = 1; break; } - /* -* Create directory components, -* unless they exist already. -*/ - d = path; - while ((d = strchr(d, '/'))) { - *d = 0; - if (stat(path, &sb) && mkdir(path, 0755)) { - res = 1; - goto out; - } - *d++ = '/'; + + if (make_parent_dir(path)) { + res = 1; + goto out; } /* Try it again. */ fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); -- 2.7.4
[PATCH v4 11/11] kbuild: remove auto.conf from prerequisite of phony targets
The top-level Makefile adds include/config/auto.conf as prerequisites of 'scripts', 'prepare1', etc. They were needed to terminate the build when include/config/auto.conf is missing. Now that the inclusion of include/config/auto.conf is mandatory in the top-level Makefile if dot-config is 1 (Note 'include' directive is used instead of '-include'). Make terminates the build by itself if it fails to create or update include/config/auto.conf so we are sure that include/config/auto.conf exists in the very first stage of make. I am still keeping include/config/auto.conf as the prerequisite of %/modules.builtin because modules.builtin is a real file. According to commit a6c366324cac ("kbuild: Do not unnecessarily regenerate modules.builtin"), it is intentional to compare time-stamps between %/modules.builtin and include/config/auto.conf . I moved tristate.conf here because it is only included from scripts/Makefile.modbuiltin. Signed-off-by: Masahiro Yamada --- Changes in v4: None Makefile | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 0ec1c27..ceb9c1e 100644 --- a/Makefile +++ b/Makefile @@ -650,10 +650,6 @@ include/config/auto.conf: /bin/false) endif # may-sync-config - -else -# Dummy target needed, because used as prerequisite -include/config/auto.conf: ; endif # $(dot-config) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) @@ -1048,15 +1044,14 @@ define filechk_kernel.release endef # Store (new) KERNELRELEASE string in include/config/kernel.release -include/config/kernel.release: include/config/auto.conf FORCE +include/config/kernel.release: $(srctree)/Makefile FORCE $(call filechk,kernel.release) # Additional helpers built in scripts/ # Carefully list dependencies so we do not try to build scripts twice # in parallel PHONY += scripts -scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ -asm-generic gcc-plugins $(autoksyms_h) +scripts: scripts_basic asm-generic gcc-plugins $(autoksyms_h) $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1086,8 +1081,7 @@ endif # that need to depend on updated CONFIG_* values can be checked here. prepare2: prepare3 outputmakefile asm-generic -prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h \ - include/config/auto.conf +prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts_basic @@ -1225,7 +1219,7 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) $(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin -%/modules.builtin: include/config/auto.conf +%/modules.builtin: include/config/auto.conf include/config/tristate.conf $(Q)$(MAKE) $(modbuiltin)=$* -- 2.7.4
[PATCH v4 07/11] kbuild: use 'include' directive to load auto.conf from top Makefile
When you build targets that require the kernel configuration, dot-config is set to 1, then the top-level Makefile includes auto.conf. However, Make considers its inclusion is optional because the '-include' directive is used here. If a necessary configuration file is missing for the external module building, the following error message is displayed: ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it. However, Make still continues building; /bin/false let the creation of 'include/config/auto.config' fail, but Make can ignore the error since it is included by the '-include' directive. I guess the reason of using '-include' directive was to suppress the warning when you build the kernel from a pristine source tree: Makefile:605: include/config/auto.conf: No such file or directory The previous commit made sure include/config/auto.conf exists after the 'make *config' stage. Now, we can use the 'include' directive without showing the warning. Signed-off-by: Masahiro Yamada --- Changes in v4: None Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5c8e9a3..2fa9830 100644 --- a/Makefile +++ b/Makefile @@ -585,7 +585,7 @@ virt-y := virt/ endif # KBUILD_EXTMOD ifeq ($(dot-config),1) --include include/config/auto.conf +include include/config/auto.conf endif # The all: target is the default when no target is given on the -- 2.7.4
UBSAN: Undefined behaviour in arch/x86/events/amd/ibs.c:582:24: member access within null pointer of type 'struct perf_event'
Dear Linux folks, Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the warning below is shown. [2.111913] [2.111917] UBSAN: Undefined behaviour in arch/x86/events/amd/ibs.c:582:24 [2.111919] member access within null pointer of type 'struct perf_event' [2.111926] CPU: 0 PID: 144 Comm: udevadm Not tainted 4.18.0-rc5-00316-g4864b68cedf2 #104 [2.111928] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 [2.111930] Call Trace: [2.111943] dump_stack+0x55/0x89 [2.111949] ubsan_epilogue+0xb/0x33 [2.111953] handle_null_ptr_deref+0x7f/0x90 [2.111958] __ubsan_handle_type_mismatch_v1+0x55/0x60 [2.111964] perf_ibs_handle_irq+0x596/0x620 [2.111968] ? perf_output_sample+0x771/0xa90 [2.111971] ? perf_prepare_sample+0x48a/0x8b0 [2.111976] ? sched_clock_cpu+0x13/0x200 [2.111978] ? perf_prepare_sample+0x8b0/0x8b0 [2.111982] ? perf_output_end+0xd/0x10 [2.111985] ? perf_event_output_forward+0x4e/0x70 [2.111990] ? __perf_event_overflow+0x7b/0x1a0 [2.111993] ? perf_event_overflow+0x15/0x20 [2.111996] ? x86_pmu_handle_irq+0x180/0x230 [2.112001] ? x86_pmu_enable_all+0x6c/0x1b0 [2.112005] ? x86_pmu_commit_txn+0xc1/0x190 [2.112012] ? native_sched_clock+0x32/0x120 [2.112017] perf_ibs_nmi_handler+0x2b/0x65 [2.112020] nmi_handle+0x8f/0x240 [2.112025] default_do_nmi+0x4e/0x2e0 [2.112028] do_nmi+0xb7/0x100 [2.112032] nmi+0x51/0x6c [2.112036] EIP: x86_pmu_enable_all+0x6c/0x1b0 [2.112037] Code: 10 01 00 00 8b 45 e8 8b 75 e4 81 ca 00 00 40 00 f7 d0 21 d0 8b 93 14 01 00 00 f7 d6 8b 9b 20 01 00 00 21 d6 89 d9 89 f2 0f 30 <0f> 1f 44 00 00 47 39 3d 08 cd 40 d6 0f 8e a1 00 00 00 83 ff 3f 0f [2.112079] EAX: 00530076 EBX: c001 ECX: c001 EDX: [2.112081] ESI: EDI: EBP: f2cffaf0 ESP: f2cffacc [2.112083] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 0046 [2.112089] x86_pmu_enable+0x162/0x480 [2.112094] perf_pmu_enable.part.39+0x14/0x30 [2.112097] ctx_resched+0xa4/0x130 [2.112101] __perf_event_enable+0x1d0/0x390 [2.112104] ? ctx_resched+0x130/0x130 [2.112107] event_function+0xb2/0x1b0 [2.112111] ? task_function_call+0x80/0x80 [2.112113] remote_function+0x45/0x60 [2.112118] flush_smp_call_function_queue+0x6c/0x1e0 [2.112123] generic_smp_call_function_single_interrupt+0x12/0x2a [2.112126] smp_call_function_single_interrupt+0x3c/0x1c0 [2.112129] call_function_single_interrupt+0x3c/0x44 [2.112134] EIP: kmem_cache_alloc+0x65/0x3e0 [2.112135] Code: 45 e4 89 da e8 1c d8 f9 ff 85 c0 0f 85 eb 01 00 00 e9 ef 00 00 00 8b 45 e4 89 45 e8 8b 75 e8 85 f6 0f 84 d5 01 00 00 8b 45 e8 <8b> 30 64 8b 4e 04 64 03 35 28 71 51 d6 85 f6 0f 84 e9 02 00 00 8b [2.112172] EAX: f4c60300 EBX: ECX: 0001 EDX: 00611ac0 [2.112174] ESI: f4c60300 EDI: f4c60300 EBP: f2cffc5c ESP: f2cffc28 [2.112177] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 0286 [2.112183] ? create_object+0x3a/0x3a0 [2.112186] create_object+0x3a/0x3a0 [2.112190] ? create_object+0x270/0x3a0 [2.112194] kmemleak_alloc+0x9b/0xb0 [2.112199] __kmalloc_track_caller+0x18c/0x420 [2.112203] ? __alloc_skb+0x6c/0x2b0 [2.112208] __kmalloc_reserve.isra.16+0x28/0x80 [2.112211] __alloc_skb+0x6c/0x2b0 [2.112215] alloc_uevent_skb+0x4a/0x160 [2.112218] ? add_uevent_var+0x57/0x130 [2.11] kobject_uevent_env+0x599/0xa10 [2.112228] ? device_get_devnode+0x1a0/0x1a0 [2.112231] kobject_synth_uevent+0x36e/0x515 [2.112234] ? mntput+0x2f/0x60 [2.112239] uevent_store+0x2b/0x70 [2.112241] ? __check_heap_object+0x4c/0x190 [2.112244] ? dev_err+0x50/0x50 [2.112247] dev_attr_store+0x33/0x60 [2.112249] ? dev_uevent_name+0x40/0x40 [2.112254] sysfs_kf_write+0x5e/0x100 [2.112257] ? mutex_lock+0x2a/0x80 [2.112260] ? sysfs_kf_bin_read+0x170/0x170 [2.112263] kernfs_fop_write+0x132/0x250 [2.112266] ? kernfs_fop_open+0x660/0x660 [2.112270] __vfs_write+0x52/0x2d0 [2.112273] ? kmemleak_free+0x6d/0x90 [2.112277] ? kmem_cache_free+0xc6/0x440 [2.112281] vfs_write+0xb0/0x2b0 [2.112284] ? do_sys_open+0x174/0x2a0 [2.112287] ksys_write+0x51/0xc0 [2.112291] sys_write+0x16/0x20 [2.112294] do_fast_syscall_32+0xce/0x3e0 [2.112298] entry_SYSENTER_32+0x4e/0x7c [2.112301] EIP: 0xb7f0fbb5 [2.112302] Code: 89 e5 8b 55 08 85 d2 8b 80 5c cd ff ff 74 02 89 02 5d c3 8b 04 24 c3 8b 1c 24 c3 8b 3c 24 c3 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76 [2.112339] EAX: ffda EBX: 0003 ECX: bfadbf54 EDX: 0003 [2.112341] ESI: 01f0a640 EDI: 00
[PATCH] pinctrl: tegra: fix spelling in devicetree binding document
From: Marcel Ziswiler This fixes a spelling mistake. Signed-off-by: Marcel Ziswiler --- Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt index ecb5c0d25218..f4d06bb0b55a 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt @@ -17,7 +17,7 @@ Tegra124 adds the following optional properties for pin configuration subnodes. The macros for options are defined in the include/dt-binding/pinctrl/pinctrl-tegra.h. - nvidia,enable-input: Integer. Enable the pin's input path. - enable :TEGRA_PIN_ENABLE0 and + enable :TEGRA_PIN_ENABLE and disable or output only: TEGRA_PIN_DISABLE. - nvidia,open-drain: Integer. enable: TEGRA_PIN_ENABLE. -- 2.14.4
[PATCH] ASoC: sgtl5000: fix spelling in devicetree binding document
From: Marcel Ziswiler This fixes a spelling mistake. Signed-off-by: Marcel Ziswiler --- Documentation/devicetree/bindings/sound/sgtl5000.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index 0f214457476f..9c58f724396a 100644 --- a/Documentation/devicetree/bindings/sound/sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt @@ -17,7 +17,7 @@ Optional properties: - VDDD-supply : the regulator provider of VDDD -- micbias-resistor-k-ohms : the bias resistor to be used in kOmhs +- micbias-resistor-k-ohms : the bias resistor to be used in kOhms The resistor can take values of 2k, 4k or 8k. If set to 0 it will be off. If this node is not mentioned or if the value is unknown, then -- 2.14.4
UBSAN: Undefined behaviour in lib/radix-tree.c:123:14: member access within null pointer of type 'const struct radix_tree_node'
Dear Linux folks, Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the warning below is shown. [0.958688] [0.959029] UBSAN: Undefined behaviour in lib/radix-tree.c:123:14 [0.959212] member access within null pointer of type 'const struct radix_tree_node' [0.959472] CPU: 0 PID: 24 Comm: kworker/0:2 Not tainted 4.18.0-rc5-00316-g4864b68cedf2 #104 [0.959475] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 [0.959488] Workqueue: events_power_efficient ioc_release_fn [0.959492] Call Trace: [0.959501] dump_stack+0x55/0x89 [0.959507] ubsan_epilogue+0xb/0x33 [0.959511] handle_null_ptr_deref+0x7f/0x90 [0.959516] __ubsan_handle_type_mismatch_v1+0x55/0x60 [0.959521] __radix_tree_delete+0xc5/0xe0 [0.959525] radix_tree_delete_item+0x5f/0xf0 [0.959529] radix_tree_delete+0xa/0x10 [0.959532] ioc_destroy_icq+0x58/0x1f0 [0.959538] ? free_tty_struct+0x34/0x50 [0.959541] ioc_release_fn+0x9c/0x1a0 [0.959548] process_one_work+0x220/0x700 [0.959553] worker_thread+0x5a/0x690 [0.959557] kthread+0x14e/0x200 [0.959561] ? drain_workqueue+0x290/0x290 [0.959565] ? kthread_create_worker_on_cpu+0x30/0x30 [0.959568] ret_from_fork+0x1c/0x38 [0.959572] Kind regards, Paul
[PATCH] ASoC: wm9712: fix replace codec to component
From: Marcel Ziswiler Since commit 143b44845d87 ("ASoC: wm9712: replace codec to component") "wm9712-codec" got renamed to "wm9712-component", however, this change never got propagated down to the actual board/platform drivers. E.g. on Colibri T20 this lead to the following spew upon boot with sound/touch being broken: [2.214121] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered [2.222137] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517) ... [2.344384] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered [2.351885] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517) ... [2.668339] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered [2.675811] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517) ... [3.208408] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered [3.216312] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517) ... [3.235397] tegra-snd-wm9712 sound: ASoC: CODEC DAI wm9712-hifi not registered [3.248938] tegra-snd-wm9712 sound: snd_soc_register_card failed (-517) ... [ 14.970443] ALSA device list: [ 14.996628] No soundcards found. This commit finally fixes this again. Signed-off-by: Marcel Ziswiler --- arch/arm/mach-pxa/tosa.c | 2 +- arch/mips/alchemy/devboards/db1300.c | 2 +- drivers/mfd/wm97xx-core.c| 6 +++--- sound/soc/au1x/db1200.c | 4 ++-- sound/soc/fsl/pcm030-audio-fabric.c | 6 +++--- sound/soc/fsl/phycore-ac97.c | 6 +++--- sound/soc/pxa/e800_wm9712.c | 4 ++-- sound/soc/pxa/em-x270.c | 4 ++-- sound/soc/pxa/palm27x.c | 4 ++-- sound/soc/pxa/tosa.c | 4 ++-- sound/soc/tegra/tegra_wm9712.c | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index cb5cd8e78c94..32011e600496 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -848,7 +848,7 @@ static struct platform_device sharpsl_rom_device = { }; static struct platform_device wm9712_device = { - .name = "wm9712-codec", + .name = "wm9712-component", .id = -1, }; diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c index efb318e03e0a..841a27736eb1 100644 --- a/arch/mips/alchemy/devboards/db1300.c +++ b/arch/mips/alchemy/devboards/db1300.c @@ -638,7 +638,7 @@ static struct platform_device db1300_sd0_dev = { /**/ static struct platform_device db1300_wm9715_dev = { - .name = "wm9712-codec", + .name = "wm9712-component", .id = 1,/* ID of PSC for AC97 audio, see asoc glue! */ }; diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c index f5a8347f837f..9fec11fc0410 100644 --- a/drivers/mfd/wm97xx-core.c +++ b/drivers/mfd/wm97xx-core.c @@ -109,7 +109,7 @@ static const struct regmap_config wm9705_regmap_config = { }; static struct mfd_cell wm9705_cells[] = { - { .name = "wm9705-codec", }, + { .name = "wm9705-component", }, { .name = "wm97xx-ts", }, }; @@ -177,7 +177,7 @@ static const struct regmap_config wm9712_regmap_config = { }; static struct mfd_cell wm9712_cells[] = { - { .name = "wm9712-codec", }, + { .name = "wm9712-component", }, { .name = "wm97xx-ts", }, }; @@ -248,7 +248,7 @@ static const struct regmap_config wm9713_regmap_config = { }; static struct mfd_cell wm9713_cells[] = { - { .name = "wm9713-codec", }, + { .name = "wm9713-component", }, { .name = "wm97xx-ts", }, }; diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c index 301e1fc9a377..d452478d62b4 100644 --- a/sound/soc/au1x/db1200.c +++ b/sound/soc/au1x/db1200.c @@ -52,7 +52,7 @@ static struct snd_soc_dai_link db1200_ac97_dai = { .codec_dai_name = "ac97-hifi", .cpu_dai_name = "au1xpsc_ac97.1", .platform_name = "au1xpsc-pcm.1", - .codec_name = "ac97-codec.1", + .codec_name = "ac97-component.1", }; static struct snd_soc_card db1200_ac97_machine = { @@ -68,7 +68,7 @@ static struct snd_soc_dai_link db1300_ac97_dai = { .codec_dai_name = "wm9712-hifi", .cpu_dai_name = "au1xpsc_ac97.1", .platform_name = "au1xpsc-pcm.1", - .codec_name = "wm9712-codec.1", + .codec_name = "wm9712-component.1", }; static struct snd_soc_card db1300_ac97_machine = { diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index ec731223cab3..869f4b226ccd 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c @@ -33,14 +33,14 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = { .stream_name = "AC97 Analog", .codec_dai_name = "wm9712-hifi", .cpu_dai_name = "mpc5200-ps
[PATCH] mfd: stmpe: honor gpio interrupt probe deferral
From: Marcel Ziswiler Actually honor probe deferral in trying to get the GPIO interrupt as of_get_named_gpio_flags() in stmpe_of_probe() may as well just do so. Signed-off-by: Marcel Ziswiler --- drivers/mfd/stmpe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 566caca4efd8..4d6ffd3ef398 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1331,6 +1331,8 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum) return -ENOMEM; stmpe_of_probe(pdata, np); + if (-EPROBE_DEFER == pdata->irq_gpio) + return -EPROBE_DEFER; if (of_find_property(np, "interrupts", NULL) == NULL) ci->irq = -1; -- 2.14.4
[PATCH] ARM: dts: spear: fix stmpe811 interrupt properties
From: Marcel Ziswiler The property "irq-over-gpio" simply does not exist (this is nowadays actually auto detected) and the property "irq-gpios" is actually called "irq-gpios". Signed-off-by: Marcel Ziswiler --- arch/arm/boot/dts/spear320-hmi.dts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/spear320-hmi.dts b/arch/arm/boot/dts/spear320-hmi.dts index 0d0da1f65f0e..d2d1fe944407 100644 --- a/arch/arm/boot/dts/spear320-hmi.dts +++ b/arch/arm/boot/dts/spear320-hmi.dts @@ -241,8 +241,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x41>; - irq-over-gpio; - irq-gpios = <&gpiopinctrl 29 0x4>; + irq-gpio = <&gpiopinctrl 29 0x4>; id = <0>; blocks = <0x5>; irq-trigger = <0x1>; -- 2.14.4
[PATCH] clk: tegra: probe deferral error reporting
From: Marcel Ziswiler Actually report the error code from devm_regulator_get() which may as well just be a probe deferral. Signed-off-by: Marcel Ziswiler --- drivers/clk/tegra/clk-dfll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c index 48ee43734e05..b2123084e175 100644 --- a/drivers/clk/tegra/clk-dfll.c +++ b/drivers/clk/tegra/clk-dfll.c @@ -1609,8 +1609,9 @@ int tegra_dfll_register(struct platform_device *pdev, td->vdd_reg = devm_regulator_get(td->dev, "vdd-cpu"); if (IS_ERR(td->vdd_reg)) { - dev_err(td->dev, "couldn't get vdd_cpu regulator\n"); - return PTR_ERR(td->vdd_reg); + ret = PTR_ERR(td->vdd_reg); + dev_err(td->dev, "couldn't get vdd_cpu regulator: %d\n", ret); + return ret; } td->dvco_rst = devm_reset_control_get(td->dev, "dvco"); -- 2.14.4
Re: [PATCH 00/39 v8] PTI support for x86-32
Hi Thomas, On Fri, Jul 20, 2018 at 01:21:33AM +0200, Thomas Gleixner wrote: > On Wed, 18 Jul 2018, Joerg Roedel wrote: > > > > here is version 8 of my patches to enable PTI on x86-32. The > > last version got some good review which I mostly worked into > > this version. > > I went over the whole set once again and did not find any real issues. As > the outstanding review comments are addressed, I decided that only broader > exposure can shake out eventually remaining issues. Applied and pushed out, > so it should show up in linux-next soon. > > The mm regression seems to be sorted, so there is no immeditate fallout > expected. > > Thanks for your patience in reworking this over and over. Thanks to Andy > for putting his entry focssed eyes on it more than once. Great work! Thanks a lot too! Let's hope things will go smooth from here... I will also continue testing and improving the code, currently I am working on a relaxed paranoid entry/exit path suggested by Andy. Regards, Joerg
[PATCH] gpiolib: probe deferral error reporting
From: Marcel Ziswiler Actually report the error code from devm_regulator_get() which may as well just be a probe deferral. This is e.g. what one gets upon booting a Colibri T20: gpiochip_add_data_with_key: GPIOs 0..223 (tegra-gpio) failed to register Signed-off-by: Marcel Ziswiler --- drivers/gpio/gpiolib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 2e2a6f8db405..40c65eb1d97b 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1408,9 +1408,9 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, err_free_gdev: ida_simple_remove(&gpio_ida, gdev->id); /* failures here can mean systems won't boot... */ - pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__, + pr_err("%s: GPIOs %d..%d (%s) failed to register, %d\n", __func__, gdev->base, gdev->base + gdev->ngpio - 1, - chip->label ? : "generic"); + chip->label ? : "generic", status); kfree(gdev); return status; } -- 2.14.4
Re: [PATCH v1] memory: tegra: Don't invoke Tegra30+ specific memory timing setup on Tegra20
On 19/07/18 16:38, Dmitry Osipenko wrote: > On Thursday, 19 July 2018 18:30:48 MSK Jon Hunter wrote: >> On 19/07/18 14:24, Dmitry Osipenko wrote: >>> This fixes irrelevant "tegra-mc 7000f000.memory-controller: no memory >>> timings for RAM code 0 registered" warning message during of kernels >>> boot-up on Tegra20. >> >> Looking at the tegra20-emc.txt bindings doc [0], the 'nvidia,ram-code' >> property is also valid for Tegra20. In fact, I see this warning on the >> Tegra30 Cardhu because this property is not populated. So I think that >> this warning is valid and harmless. >> >> Cheers >> Jon >> >> [0] Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-emc.txt > > That is the irrelevant binding, the relevant one for this driver is [0]. The > warning is valid for T30+, but not for T20. > > [0] Documentation/devicetree/bindings/memory-controllers/nvidia,tegra20-mc.txt Yes indeed, looks like we never supported this for Tegra20. OK, fine with me I guess this was introduced during the consolidation of the MC drivers. Can you add the appropriate fixes tag? Otherwise ... Acked-by: Jon Hunter Cheers Jon -- nvpublic
[GIT PULL] ACPI fix for v4.18-rc6
Hi Linus, Please pull from the tag git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ acpi-4.18-rc6 with top-most commit 2c4d6baf1bc4f7729773ffcee9ba2a9781578633 ACPI / EC: Use ec_no_wakeup on more Thinkpad X1 Carbon 6th systems on top of commit 9d3cce1e8b8561fed5f383d22a4d6949db4eadbe Linux 4.18-rc5 to receive an ACPI fix for 4.18-rc6. This extends the recently added suspend-to-idle quirk for Thinkpad X1 Carbon 6th to other systems from that family which turned out to need it too (Robin Johnson). Thanks! --- Robin H. Johnson (1): ACPI / EC: Use ec_no_wakeup on more Thinkpad X1 Carbon 6th systems --- drivers/acpi/ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier
Andy Lutomirski writes: > [I added PeterZ and Vitaly -- can you see any way in which this would > break something obscure? I don't.] Thanks for CCing me, I don't see how this can break things either. At first glance, however, I'm afraid we can add performance penalty to virtualized guests which don't use native_flush_tlb_others() (Hyper-V, KVM): we will be reloading CR3 without a need as we don't look at lazy mode in PV tlb flush functions. We can either check to switch_mm_irqs_off() that native_flush_tlb_others() is in use or teach PV tlb flush functions to look at lazy mode too. (Sorry if I'm missing something important here or if this was already discussed. I just became aware of this work) [...] -- Vitaly
[GIT PULL] Power management fix for v4.18-rc6
Hi Linus, Please pull from the tag git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \ pm-4.18-rc6 with top-most commit 95d6c0857e54b788982746071130d822a795026b cpufreq: intel_pstate: Register when ACPI PCCH is present on top of commit 9d3cce1e8b8561fed5f383d22a4d6949db4eadbe Linux 4.18-rc5 to receive a power management fix for 4.18-rc6. This fixes a relatively old initialization issue in intel_pstate causing the pcc-cpufreq driver to be used instead of it on some HP Proliant systems, which turned into a functional regression during the 4.17 cycle, because pcc-cpufreq is a scalability disaster and that was amplified by the idle loop rework done at that time (Rafael Wysocki). Thanks! --- Rafael J. Wysocki (1): cpufreq: intel_pstate: Register when ACPI PCCH is present --- drivers/cpufreq/intel_pstate.c | 17 - drivers/cpufreq/pcc-cpufreq.c | 4 2 files changed, 20 insertions(+), 1 deletion(-)
[PATCH 2/2] ASoC: tegra: probe deferral error reporting
From: Marcel Ziswiler Actually report the error codes from of_get_named_gpio() resp. devm_gpio_request_one() upon trying to get the codec reset resp. sync GPIOs which may as well just be a probe deferrals. Signed-off-by: Marcel Ziswiler --- sound/soc/tegra/tegra20_ac97.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 682ef33afb5f..4875512f0732 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -351,18 +351,21 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ret = devm_gpio_request_one(&pdev->dev, ac97->reset_gpio, GPIOF_OUT_INIT_HIGH, "codec-reset"); if (ret) { - dev_err(&pdev->dev, "could not get codec-reset GPIO\n"); + dev_err(&pdev->dev, "could not get codec-reset GPIO: " + "%d\n", ret); goto err_clk_put; } } else { - dev_err(&pdev->dev, "no codec-reset GPIO supplied\n"); + ret = ac97->reset_gpio; + dev_err(&pdev->dev, "no codec-reset GPIO supplied: %d\n", ret); goto err_clk_put; } ac97->sync_gpio = of_get_named_gpio(pdev->dev.of_node, "nvidia,codec-sync-gpio", 0); if (!gpio_is_valid(ac97->sync_gpio)) { - dev_err(&pdev->dev, "no codec-sync GPIO supplied\n"); + ret = ac97->sync_gpio; + dev_err(&pdev->dev, "no codec-sync GPIO supplied: %d\n", ret); goto err_clk_put; } -- 2.14.4
Re: [PATCH v3 5/6] KVM: X86: Add NMI support to PV IPIs
On 20/07/2018 05:53, Wanpeng Li wrote: >>> - ret = kvm_hypercall3(KVM_HC_SEND_IPI, ipi_bitmap_low, >>> ipi_bitmap_high, vector); >>> + switch (vector) { >>> + default: >>> + icr = APIC_DM_FIXED | vector; >>> + break; >>> + case NMI_VECTOR: >>> + icr = APIC_DM_NMI; >> I think it would be better to say that KVM interprets NMI_VECTOR and >> sends the interrupt as APIC_DM_NMI. It's not KVM, this is arch/x86/kernel/kvm.c so the guest side. Paolo > Yeah, in addition, SDM 10.6.1 also mentioned that: > Delivery mode: > 100 (NMI) Delivers an NMI interrupt to the target processor or > processors. The vector information is ignored.
[PATCH 1/2] ASoC: tegra: improve goto error label
From: Marcel Ziswiler While the two error labels "err" and "err_clk_put" goto the same place it is rather confusing that the earlier one is certainly used later again. Signed-off-by: Marcel Ziswiler --- sound/soc/tegra/tegra20_ac97.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index affad46bf188..682ef33afb5f 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c @@ -377,7 +377,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) ret = clk_prepare_enable(ac97->clk_ac97); if (ret) { dev_err(&pdev->dev, "clk_enable failed: %d\n", ret); - goto err; + goto err_clk_put; } ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); -- 2.14.4
Re: [PATCH v3 2/6] KVM: X86: Implement PV IPIs in linux guest
On 20/07/2018 07:58, Wanpeng Li wrote: >> >> We could keep the cluster size of 128, but it would be more complicated >> to do the left shift in the first "else if". If the limit is 64, you >> can keep the two arguments in the hypercall, and just pass 0 as the >> "high" bitmap on 64-bit kernels. > As David pointed out, we need to scale to higher APIC IDs. The offset is enough to scale to higher APIC IDs. It's just an optimization to allow 128 CPUs per hypercall instead of 64 CPUs. But actually you can use __uint128_t on 64-bit machines, I forgot about that. With u64 on 32-bit and __uint128_t on 64-bit, you can do 64 CPUs per hypercall on 32-bit and 128 CPUs per hypercall on 64-bit. I will add > the cpu id to apic id transfer in the for loop. How about: > kvm_hypercall2(KVM_HC_SEND_IPI, ipi_bitmap, vector); directly. In > addition, why need to pass the 0 as the "high" bitmap even if for 128 > vCPUs case?
Re: [PATCH v15 23/26] sched: early boot clock
On Thu, Jul 19, 2018 at 04:55:42PM -0400, Pavel Tatashin wrote: > diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c > index 0e9dbb2d9aea..422cd63f8f17 100644 > --- a/kernel/sched/clock.c > +++ b/kernel/sched/clock.c > @@ -202,7 +202,25 @@ static void __sched_clock_gtod_offset(void) > > void __init sched_clock_init(void) > { > + unsigned long flags; > + > + /* > + * Set __gtod_offset such that once we mark sched_clock_running, > + * sched_clock_tick() continues where sched_clock() left off. > + * > + * Even if TSC is buggered, we're still UP at this point so it > + * can't really be out of sync. > + */ > + local_irq_save(flags); > + __sched_clock_gtod_offset(); > + local_irq_restore(flags); > + > sched_clock_running = 1; > + > + /* Now that sched_clock_running is set adjust scd */ > + local_irq_save(flags); > + sched_clock_tick(); > + local_irq_restore(flags); > } Sorry, that's still wrong. Because the moment you enable sched_clock_running we need to have everything set-up for it to run. The above looks double weird because you could've just done that =1 under the same IRQ-disable section and it would've mostly been OK (except for NMIs). But the reason it's weird like that is because you're going to change it into a static key later on. The below cures things. --- Subject: sched/clock: Close a hole in sched_clock_init() All data required for the 'unstable' sched_clock must be set-up _before_ enabling it -- setting sched_clock_running. This includes the __gtod_offset but also a recent scd stamp. Make the gtod-offset update also set the csd stamp -- it requires the same two clock reads _anyway_. This doesn't hurt in the sched_clock_tick_stable() case and ensures sched_clock_init() gets everything set-up before use. Also switch to unconditional IRQ-disable/enable because the static key stuff already requires this is not ran with IRQs disabled. Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/clock.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c index c5c47ad3f386..811a39aca1ce 100644 --- a/kernel/sched/clock.c +++ b/kernel/sched/clock.c @@ -197,13 +197,14 @@ void clear_sched_clock_stable(void) static void __sched_clock_gtod_offset(void) { - __gtod_offset = (sched_clock() + __sched_clock_offset) - ktime_get_ns(); + struct sched_clock_data *scd = this_scd(); + + __scd_stamp(scd); + __gtod_offset = (scd->tick_raw + __sched_clock_offset) - scd->tick_gtod; } void __init sched_clock_init(void) { - unsigned long flags; - /* * Set __gtod_offset such that once we mark sched_clock_running, * sched_clock_tick() continues where sched_clock() left off. @@ -211,16 +212,11 @@ void __init sched_clock_init(void) * Even if TSC is buggered, we're still UP at this point so it * can't really be out of sync. */ - local_irq_save(flags); + local_irq_disable(); __sched_clock_gtod_offset(); - local_irq_restore(flags); + local_irq_enable(); static_branch_inc(&sched_clock_running); - - /* Now that sched_clock_running is set adjust scd */ - local_irq_save(flags); - sched_clock_tick(); - local_irq_restore(flags); } /* * We run this as late_initcall() such that it runs after all built-in drivers,
[PATCH V4 2/2] mux: adgs1408: new driver for Analog Devices ADGS1408/1409 mux …
This patch adds basic support for Analog Device ADGS1408/09 SPI mux controller. The device is probed and set to a disabled state. It uses the new mux controller framework. Signed-off-by: Mircea Caprioru --- Changelog V3 -> V4 - named enum to adgs1408_chip_id - added .data with id enum values - added chip id verification for of_device_get_match_data drivers/mux/Kconfig| 10 drivers/mux/Makefile | 2 + drivers/mux/adgs1408.c | 132 + 3 files changed, 144 insertions(+) create mode 100644 drivers/mux/adgs1408.c diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig index 6241678e99af..7659d6c5f718 100644 --- a/drivers/mux/Kconfig +++ b/drivers/mux/Kconfig @@ -21,6 +21,16 @@ config MUX_ADG792A To compile the driver as a module, choose M here: the module will be called mux-adg792a. +config MUX_ADGS1408 + tristate "Analog Devices ADGS1408/ADGS1409 Multiplexers" + depends on SPI + help + ADGS1408 8:1 multiplexer and ADGS1409 double 4:1 multiplexer + switches. + + To compile the driver as a module, choose M here: the module will + be called mux-adgs1408. + config MUX_GPIO tristate "GPIO-controlled Multiplexer" depends on GPIOLIB || COMPILE_TEST diff --git a/drivers/mux/Makefile b/drivers/mux/Makefile index c3d883955fd5..6e9fa47daf56 100644 --- a/drivers/mux/Makefile +++ b/drivers/mux/Makefile @@ -5,10 +5,12 @@ mux-core-objs := core.o mux-adg792a-objs := adg792a.o +mux-adgs1408-objs := adgs1408.o mux-gpio-objs := gpio.o mux-mmio-objs := mmio.o obj-$(CONFIG_MULTIPLEXER) += mux-core.o obj-$(CONFIG_MUX_ADG792A) += mux-adg792a.o +obj-$(CONFIG_MUX_ADGS1408) += mux-adgs1408.o obj-$(CONFIG_MUX_GPIO) += mux-gpio.o obj-$(CONFIG_MUX_MMIO) += mux-mmio.o diff --git a/drivers/mux/adgs1408.c b/drivers/mux/adgs1408.c new file mode 100644 index ..9cc749e10383 --- /dev/null +++ b/drivers/mux/adgs1408.c @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * ADGS1408/ADGS1409 SPI MUX driver + * + * Copyright 2018 Analog Devices Inc. + */ + +#include +#include +#include +#include +#include +#include + +#define ADGS1408_SW_DATA (0x01) +#define ADGS1408_REG_READ(reg) ((reg) | 0x80) +#define ADGS1408_DISABLE (0x00) +#define ADGS1408_MUX(state)(((state) << 1) | 1) + +enum adgs1408_chip_id { + ADGS1408 = 1, + ADGS1409, +}; + +static int adgs1408_spi_reg_write(struct spi_device *spi, + u8 reg_addr, u8 reg_data) +{ + u8 tx_buf[2]; + + tx_buf[0] = reg_addr; + tx_buf[1] = reg_data; + + return spi_write_then_read(spi, tx_buf, sizeof(tx_buf), NULL, 0); +} + +static int adgs1408_set(struct mux_control *mux, int state) +{ + struct spi_device *spi = to_spi_device(mux->chip->dev.parent); + u8 reg; + + if (state == MUX_IDLE_DISCONNECT) + reg = ADGS1408_DISABLE; + else + reg = ADGS1408_MUX(state); + + return adgs1408_spi_reg_write(spi, ADGS1408_SW_DATA, reg); +} + +static const struct mux_control_ops adgs1408_ops = { + .set = adgs1408_set, +}; + +static int adgs1408_probe(struct spi_device *spi) +{ + struct device *dev = &spi->dev; + struct mux_chip *mux_chip; + struct mux_control *mux; + int ret, idle_state; + enum adgs1408_chip_id chip_id; + + chip_id = (enum adgs1408_chip_id)of_device_get_match_data(dev); + if (!chip_id) + chip_id = spi_get_device_id(spi)->driver_data; + + mux_chip = devm_mux_chip_alloc(dev, 1, 0); + if (IS_ERR(mux_chip)) + return PTR_ERR(mux_chip); + + mux_chip->ops = &adgs1408_ops; + + ret = adgs1408_spi_reg_write(spi, ADGS1408_SW_DATA, ADGS1408_DISABLE); + if (ret < 0) + return ret; + + ret = device_property_read_u32_array(dev, "idle-state", +&idle_state, +mux_chip->controllers); + if (ret < 0) + idle_state = MUX_IDLE_AS_IS; + + mux = mux_chip->mux; + + if (chip_id == ADGS1408) + mux->states = 8; + else + mux->states = 4; + + switch (idle_state) { + case MUX_IDLE_DISCONNECT: + case MUX_IDLE_AS_IS: + case 0 ... 7: + /* adgs1409 supports only 4 states */ + if (idle_state < mux->states) { + mux->idle_state = idle_state; + break; + } + /* fall through */ + default: + dev_err(dev, "invalid idle-state %d\n", idle_state); + return -EINVAL; + } + + return devm_mux_chip_register(dev, mux_chip); +} + +static const struct spi_device_id adgs1408_spi_id[] = { +
Re: [PATCH] pinctrl: tegra: fix spelling in devicetree binding document
On 20/07/18 08:52, Marcel Ziswiler wrote: > From: Marcel Ziswiler > > This fixes a spelling mistake. > > Signed-off-by: Marcel Ziswiler > > --- > > Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git > a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > index ecb5c0d25218..f4d06bb0b55a 100644 > --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > @@ -17,7 +17,7 @@ Tegra124 adds the following optional properties for pin > configuration subnodes. > The macros for options are defined in the > include/dt-binding/pinctrl/pinctrl-tegra.h. > - nvidia,enable-input: Integer. Enable the pin's input path. > - enable :TEGRA_PIN_ENABLE0 and > + enable :TEGRA_PIN_ENABLE and > disable or output only: TEGRA_PIN_DISABLE. > - nvidia,open-drain: Integer. > enable: TEGRA_PIN_ENABLE. Thanks for fixing! Can you also fix up the one in nvidia,tegra210-pinmux.txt as well? Cheers! Jon -- nvpublic
[GIT PULL] ARM: at91: DT for 4.19
Arnd, Olof, Here are the unusually large DT PR for AT91. It contains mainly new DTs. There is a pm.c change that I'm including here so it is along with the corresponding DT changes. The following changes since commit ce397d215ccd07b8ae3f71db689aedb85d56ab40: Linux 4.18-rc1 (2018-06-17 08:04:49 +0900) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git tags/at91-ab-4.19-dt for you to fetch changes up to c8cbc1c20c29697e7335a5044fe6c60aa5c6e922: ARM: dts: at91: fix typos for SSC TD functions (2018-07-20 10:05:14 +0200) AT91 DT for 4.19: - New boards from Laird: WB45N, WB50N, SOM60 modules and DVK, Gatwick - fix the PMC compatibles Alexandre Belloni (4): dt-bindings: arm: remove PMC bindings dt-bindings: clk: at91: Document all the PMC compatibles ARM: at91: fix USB clock detection handling ARM: dts: fix PMC compatible Ben Whitten (6): dt-bindings: add laird and giantec vendor prefix ARM: dts: at91: add labels to soc dtsi for derivative boards ARM: dts: add support for Laird WB45N cpu module and DVK ARM: dts: add support for Laird WB50N cpu module and DVK ARM: dts: add support for Gatwick board based on WB50N ARM: dts: add support for Laird SOM60 module and DVK boards Claudiu Beznea (1): ARM: dts: at91: fix typos for SSC TD functions .../devicetree/bindings/arm/atmel-pmc.txt | 14 -- .../devicetree/bindings/clock/at91-clock.txt | 9 +- .../devicetree/bindings/vendor-prefixes.txt| 2 + arch/arm/boot/dts/Makefile | 4 + arch/arm/boot/dts/at91-dvk_som60.dts | 95 + arch/arm/boot/dts/at91-dvk_su60_somc.dtsi | 159 ++ arch/arm/boot/dts/at91-dvk_su60_somc_lcm.dtsi | 90 arch/arm/boot/dts/at91-gatwick.dts | 121 +++ arch/arm/boot/dts/at91-som60.dtsi | 230 + arch/arm/boot/dts/at91-wb45n.dts | 64 ++ arch/arm/boot/dts/at91-wb45n.dtsi | 165 +++ arch/arm/boot/dts/at91-wb50n.dts | 112 ++ arch/arm/boot/dts/at91-wb50n.dtsi | 198 ++ arch/arm/boot/dts/at91sam9261.dtsi | 2 +- arch/arm/boot/dts/at91sam9263.dtsi | 2 +- arch/arm/boot/dts/at91sam9rl.dtsi | 2 +- arch/arm/boot/dts/at91sam9x5.dtsi | 8 +- arch/arm/boot/dts/sama5d2-pinfunc.h| 4 +- arch/arm/boot/dts/sama5d3.dtsi | 8 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- arch/arm/mach-at91/pm.c| 5 + 21 files changed, 1263 insertions(+), 33 deletions(-) delete mode 100644 Documentation/devicetree/bindings/arm/atmel-pmc.txt create mode 100644 arch/arm/boot/dts/at91-dvk_som60.dts create mode 100644 arch/arm/boot/dts/at91-dvk_su60_somc.dtsi create mode 100644 arch/arm/boot/dts/at91-dvk_su60_somc_lcm.dtsi create mode 100644 arch/arm/boot/dts/at91-gatwick.dts create mode 100644 arch/arm/boot/dts/at91-som60.dtsi create mode 100644 arch/arm/boot/dts/at91-wb45n.dts create mode 100644 arch/arm/boot/dts/at91-wb45n.dtsi create mode 100644 arch/arm/boot/dts/at91-wb50n.dts create mode 100644 arch/arm/boot/dts/at91-wb50n.dtsi -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v3 0/4] Add basic support for Mediatek MT8183 SoC
On Mon, 2018-07-16 at 11:28 +0200, Matthias Brugger wrote: > Hi Erin, > > On 17/05/18 08:22, Erin Lo wrote: > > MT8183 is a SoC based on 64bit ARMv8 architecture. > > It contains 4 CA53 and 4 CA73 cores. > > MT8183 share many HW IP with MT65xx series. > > This patchset was tested on MT8183 evaluation board, and boot to shell ok. > > > > This series contains document bindings, device tree including interrupt, > > uart. > > > > Change in v3: > > 1. Fill out GICC, GICH, GICV regions > > 2. Update Copyright to 2018 > > > > Change in v2: > > 1. Split dt-bindings into different patches > > 2. Correct bindings for supported SoCs (mtk-uart.txt) > > > > Ben Ho (1): > > arm64: dts: Add Mediatek SoC MT8183 and evaluation board dts and > > Makefile > > > > Erin Lo (3): > > dt-bindings: arm: Add bindings for Mediatek MT8183 SoC Platform > > dt-bindings: mtk-sysirq: Add compatible for Mediatek MT8183 > > dt-bindings: serial: Add compatible for Mediatek MT8183 > > > > I'm a bit reluctant to take this series, as it will only enable the EVB board > to > boot into a serial console. Are you planning to add support for other devices > of > this SoC? > > Apart please take into account that there is an issue with the dts file, as > you > were told by the kbuild test robot. > > Regards, > Matthias > Hi, Matthias Sorry for missing this letter...since mail proxy server. We plan to add support all the devices of MT8183 in serious. We have implemented the clock and pinctrl driver for upstream and they are in internal review right now. About the dts issue... do you suggest me to send new patch right now or wait for clock and pinctrl driver ready then send them together? Best Regards, Erin > ___ > Linux-mediatek mailing list > linux-media...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek
[GIT PULL] ARM: at91: SoC for 4.19
Arnd, Olof, Here is the SoC PR for 4.19. It is a cleanup of pm.c and the addition of a new low power mode. The following changes since commit ce397d215ccd07b8ae3f71db689aedb85d56ab40: Linux 4.18-rc1 (2018-06-17 08:04:49 +0900) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git tags/at91-ab-4.19-soc for you to fetch changes up to d7484f5c6b3b0565d2395aece2862f183581e1c1: ARM: at91: pm: configure wakeup sources for ULP1 mode (2018-07-17 15:08:12 +0200) AT91 SoC for 4.19: - New low power mode for sama5d2: ULP1 Boris Brezillon (1): MAINTAINERS: Remove the AT91 clk driver entry Claudiu Beznea (3): ARM: at91: pm: Use ULP0 naming instead of slow clock ARM: at91: pm: add PMC fast startup registers defines ARM: at91: pm: configure wakeup sources for ULP1 mode Wenyou Yang (1): ARM: at91: pm: Add ULP1 mode support MAINTAINERS | 5 -- arch/arm/mach-at91/pm.c | 187 +--- arch/arm/mach-at91/pm.h | 6 +- arch/arm/mach-at91/pm_suspend.S | 142 +- include/linux/clk/at91_pmc.h| 15 5 files changed, 297 insertions(+), 58 deletions(-) -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
[PATCH v2] pinctrl: tegra: fix spelling in devicetree binding document
From: Marcel Ziswiler This fixes a spelling mistake. Signed-off-by: Marcel Ziswiler --- Changes in v2: - Also fix up the one in nvidia,tegra210-pinmux.txt as suggested by Jon. Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt | 2 +- Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt index ecb5c0d25218..f4d06bb0b55a 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt @@ -17,7 +17,7 @@ Tegra124 adds the following optional properties for pin configuration subnodes. The macros for options are defined in the include/dt-binding/pinctrl/pinctrl-tegra.h. - nvidia,enable-input: Integer. Enable the pin's input path. - enable :TEGRA_PIN_ENABLE0 and + enable :TEGRA_PIN_ENABLE and disable or output only: TEGRA_PIN_DISABLE. - nvidia,open-drain: Integer. enable: TEGRA_PIN_ENABLE. diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt index a62d82d5fbe9..85f211436b8e 100644 --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt @@ -44,7 +44,7 @@ Optional subnode-properties: - nvidia,tristate: Integer. 0: drive, 1: tristate. - nvidia,enable-input: Integer. Enable the pin's input path. -enable :TEGRA_PIN_ENABLE0 and +enable :TEGRA_PIN_ENABLE and disable or output only: TEGRA_PIN_DISABLE. - nvidia,open-drain: Integer. enable: TEGRA_PIN_ENABLE. -- 2.14.4
Re: [PATCH] pinctrl: tegra: fix spelling in devicetree binding document
On Fri, 2018-07-20 at 09:12 +0100, Jon Hunter wrote: > On 20/07/18 08:52, Marcel Ziswiler wrote: > > From: Marcel Ziswiler > > > > This fixes a spelling mistake. > > > > Signed-off-by: Marcel Ziswiler > > > > --- > > > > Documentation/devicetree/bindings/pinctrl/nvidia,tegra124- > > pinmux.txt | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git > > a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124- > > pinmux.txt > > b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124- > > pinmux.txt > > index ecb5c0d25218..f4d06bb0b55a 100644 > > --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124- > > pinmux.txt > > +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124- > > pinmux.txt > > @@ -17,7 +17,7 @@ Tegra124 adds the following optional properties > > for pin configuration subnodes. > > The macros for options are defined in the > > include/dt-binding/pinctrl/pinctrl-tegra.h. > > - nvidia,enable-input: Integer. Enable the pin's input path. > > - enable :TEGRA_PIN_ENABLE0 and > > + enable :TEGRA_PIN_ENABLE and > > disable or output only: TEGRA_PIN_DISABLE. > > - nvidia,open-drain: Integer. > > enable: TEGRA_PIN_ENABLE. > > Thanks for fixing! Can you also fix up the one in nvidia,tegra210- > pinmux.txt as well? Sure, that reminds me to always grep through the whole tree for such curiosities (;-p). I just sent out a v2. > Cheers! > Jon
Re: [PATCH 2/6] drivers/md/raid5: Do not disable irq on release_inactive_stripe_list() call
On 2018-07-03 22:01:37 [+0200], To linux-kernel@vger.kernel.org wrote: > From: Anna-Maria Gleixner > > There is no need to invoke release_inactive_stripe_list() with interrupts > disabled. All call sites, except raid5_release_stripe(), unlock > ->device_lock and enable interrupts before invoking the function. > > Make it consistent. Shaohua, I've seen that you already applied 1/6. Could you also please apply this one? This is the only remaining raid5 patch :) > Cc: Shaohua Li > Cc: linux-r...@vger.kernel.org > Acked-by: Peter Zijlstra (Intel) > Signed-off-by: Anna-Maria Gleixner > Signed-off-by: Sebastian Andrzej Siewior > --- > drivers/md/raid5.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > index e933bff9459e..ca1dd0cb04c5 100644 > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c > @@ -414,9 +414,8 @@ void raid5_release_stripe(struct stripe_head *sh) > INIT_LIST_HEAD(&list); > hash = sh->hash_lock_index; > do_release_stripe(conf, sh, &list); > - spin_unlock(&conf->device_lock); > + spin_unlock_irqrestore(&conf->device_lock, flags); > release_inactive_stripe_list(conf, &list, hash); > - local_irq_restore(flags); > } > } > Sebastian
Re: [PATCH] ASoC: wm9712: fix replace codec to component
Hi Marcel > From: Marcel Ziswiler > > Since commit 143b44845d87 ("ASoC: wm9712: replace codec to component") > "wm9712-codec" got renamed to "wm9712-component", however, this change > never got propagated down to the actual board/platform drivers. E.g. on > Colibri T20 this lead to the following spew upon boot with sound/touch > being broken: Oops, my bad... The platform_driver name is not important, how about simply rename back it to "wm9712-codec" ? Best regards --- Kuninori Morimoto
Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier
On Thu, Jul 19, 2018 at 10:04:09AM -0700, Andy Lutomirski wrote: > I added some more arch maintainers. The idea here is that, on x86 at > least, task->active_mm and all its refcounting is pure overhead. When > a process exits, __mmput() gets called, but the core kernel has a > longstanding "optimization" in which other tasks (kernel threads and > idle tasks) may have ->active_mm pointing at this mm. This is nasty, > complicated, and hurts performance on large systems, since it requires > extra atomic operations whenever a CPU switches between real users > threads and idle/kernel threads. > > It's also almost completely worthless on x86 at least, since __mmput() > frees pagetables, and that operation *already* forces a remote TLB > flush, so we might as well zap all the active_mm references at the > same time. So I disagree that active_mm is complicated (the code is less than ideal but that is actually fixable). And aside from the process exit case, it does avoid CR3 writes when switching between user and kernel threads (which can be far more often than exit if you have longer running tasks). Now agreed, recent x86 work has made that less important. And I of course also agree that not doing those refcount atomics is better.
Re: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address space mapping flush support
On 20/07/2018 05:58, KY Srinivasan wrote: > > >> -Original Message- >> From: Tianyu Lan >> Sent: Thursday, July 19, 2018 1:40 AM >> Cc: Tianyu Lan ; de...@linuxdriverproject.org; >> Haiyang Zhang ; h...@zytor.com; >> k...@vger.kernel.org; KY Srinivasan ; linux- >> ker...@vger.kernel.org; mi...@redhat.com; pbonz...@redhat.com; >> rkrc...@redhat.com; Stephen Hemminger ; >> t...@linutronix.de; x...@kernel.org; Michael Kelley (EOSG) >> ; vkuzn...@redhat.com >> Subject: [PATCH V3 0/4] KVM/x86/hyper-V: Introduce PV guest address >> space mapping flush support >> >> Hyper-V provides a para-virtualization hypercall >> HvFlushGuestPhysicalAddressSpace >> to flush nested VM address space mapping in l1 hypervisor and it's to reduce >> overhead >> of flushing ept tlb among vcpus. The tradition way is to send IPIs to all >> affected >> vcpus and executes INVEPT on each vcpus. It will trigger several vmexits for >> IPI and >> INVEPT emulation. The pv hypercall can help to flush specified ept table on >> all >> vcpus >> via one single hypercall. >> >> Change since v2: >>- Make ept_pointers_match as tristate "check", "match" and "mismatch". >>Set "check" in vmx_set_cr3(), check all ept table pointers in >> hv_remote_flush_tlb() >>and call hypercall when all ept pointers are same. >>- Rename kvm_arch_hv_flush_remote_tlb with >> kvm_arch_flush_remote_tlb and >>Rename kvm_x86_ops->hv_tlb_remote_flush with kvm_x86_ops- >>> tlb_remote_flush >>- Fix issue that ignore updating tlbs_dirty during calling >> kvm_arch_flush_remote_tlbs() >>- Merge patch "KVM/VMX: Add identical ept table pointer check" and >>patch "KVM/x86: Add tlb_remote_flush callback support for vmx" >> >> Change since v1: >>- Fix compilation error for non-x86 platform. >>- Use ept_pointers_match to check condition of identical ept >> table pointer and get ept pointer from struct >> vcpu_vmx->ept_pointer. >>- Add hyperv_nested_flush_guest_mapping ftrace support >> >> >> >> Lan Tianyu (4): >> X86/Hyper-V: Add flush HvFlushGuestPhysicalAddressSpace hypercall >> support >> X86/Hyper-V: Add hyperv_nested_flush_guest_mapping ftrace support >> KVM: Add tlb remote flush callback in kvm_x86_ops. >> KVM/x86: Add tlb_remote_flush callback support for vmx >> >> arch/x86/hyperv/Makefile| 2 +- >> arch/x86/hyperv/nested.c| 67 >> ++ >> arch/x86/include/asm/hyperv-tlfs.h | 8 + >> arch/x86/include/asm/kvm_host.h | 11 ++ >> arch/x86/include/asm/mshyperv.h | 2 ++ >> arch/x86/include/asm/trace/hyperv.h | 14 >> arch/x86/kvm/vmx.c | 72 >> - >> include/linux/kvm_host.h| 7 >> virt/kvm/kvm_main.c | 3 +- >> 9 files changed, 183 insertions(+), 3 deletions(-) >> create mode 100644 arch/x86/hyperv/nested.c > > Acked-by: K. Y. Srinivasan Queued, thanks! Paolo
Re: UBSAN: Undefined behaviour in lib/radix-tree.c:123:14: member access within null pointer of type 'const struct radix_tree_node'
In-Reply-To: <19427cc3-3372-9b02-4b92-096fbe328...@molgen.mpg.de> On Fri, Jul 20, 2018 at 09:53:21AM +0200, Paul Menzel wrote: > Dear Linux folks, Hi, > Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ > (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the > warning below is shown. > > > [0.958688] > > > > [0.959029] UBSAN: Undefined behaviour in lib/radix-tree.c:123:14 That's in get_slot_offset(), and I think this is addressed by the patch [1] I previously sent. There are at least a couple of instances in the radix tree code, and I had intended to address them together, but I haven't had the chance over the last couple of weeks. I will try to get back to that soon. > > [0.959212] member access within null pointer of type 'const struct > > radix_tree_node' > > [0.959472] CPU: 0 PID: 24 Comm: kworker/0:2 Not tainted > > 4.18.0-rc5-00316-g4864b68cedf2 #104 > > [0.959475] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 > > [0.959488] Workqueue: events_power_efficient ioc_release_fn > > [0.959492] Call Trace: > > [0.959501] dump_stack+0x55/0x89 > > [0.959507] ubsan_epilogue+0xb/0x33 > > [0.959511] handle_null_ptr_deref+0x7f/0x90 > > [0.959516] __ubsan_handle_type_mismatch_v1+0x55/0x60 > > [0.959521] __radix_tree_delete+0xc5/0xe0 > > [0.959525] radix_tree_delete_item+0x5f/0xf0 > > [0.959529] radix_tree_delete+0xa/0x10 > > [0.959532] ioc_destroy_icq+0x58/0x1f0 > > [0.959538] ? free_tty_struct+0x34/0x50 > > [0.959541] ioc_release_fn+0x9c/0x1a0 > > [0.959548] process_one_work+0x220/0x700 > > [0.959553] worker_thread+0x5a/0x690 > > [0.959557] kthread+0x14e/0x200 > > [0.959561] ? drain_workqueue+0x290/0x290 > > [0.959565] ? kthread_create_worker_on_cpu+0x30/0x30 > > [0.959568] ret_from_fork+0x1c/0x38 > > [0.959572] > > Thanks, Mark. [1] https://lkml.kernel.org/r/20180706134144.48446-1-mark.rutl...@arm.com
Re: [PATCH v2 (v4.18 regression fix)] vfs: don't evict uninitialized inode
On Thu, Jul 19, 2018 at 11:45 PM, Al Viro wrote: > On Wed, Jul 18, 2018 at 01:18:33PM +0100, Al Viro wrote: > >> BTW, why have you left generic_readlink() sitting around? AFAICS, >> it could've been folded into the only remaining caller just as >> you've made it static in late 2016... I'll fold it in; >> just curious what was the reason for not doing that back then... > > BTW^2: > const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) > { > const char *res = ERR_PTR(-EINVAL); > struct inode *inode = d_inode(dentry); > > if (d_is_symlink(dentry)) { > res = ERR_PTR(security_inode_readlink(dentry)); > if (!res) > res = inode->i_op->get_link(dentry, inode, done); > } > return res; > } > hits a method call that is not needed in the majority of cases. Is there > any subtle reason why it shouldn't be > > const char *vfs_get_link(struct dentry *dentry, struct delayed_call *done) > { > const char *res = ERR_PTR(-EINVAL); > struct inode *inode = d_inode(dentry); > > if (d_is_symlink(dentry)) { > res = ERR_PTR(security_inode_readlink(dentry)); > if (!res) > res = inode->i_link; > if (!res) > res = inode->i_op->get_link(dentry, inode, done); > } > return res; > } > instead? Can't see any issues. But I also don't think any of the callers are seriously performance sensitive, so I guess it basically doesn't matter. Thanks, Miklos
Re: [PATCH V2 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio
On 20/07/2018 16:11, Zhang,Yi wrote: > Added Jiang,Dave, > > Ping for further review, comments. I need an Acked-by from the MM people to merge this. Jan, Dan? Paolo > > Thanks All > > Regards > Yi. > > > On 2018年07月11日 01:01, Zhang Yi wrote: >> For device specific memory space, when we move these area of pfn to >> memory zone, we will set the page reserved flag at that time, some of >> these reserved for device mmio, and some of these are not, such as >> NVDIMM pmem. >> >> Now, we map these dev_dax or fs_dax pages to kvm for DIMM/NVDIMM >> backend, since these pages are reserved. the check of >> kvm_is_reserved_pfn() misconceives those pages as MMIO. Therefor, we >> introduce 2 page map types, MEMORY_DEVICE_FS_DAX/MEMORY_DEVICE_DEV_DAX, >> to indentify these pages are from NVDIMM pmem. and let kvm treat these >> as normal pages. >> >> Without this patch, Many operations will be missed due to this >> mistreatment to pmem pages. For example, a page may not have chance to >> be unpinned for KVM guest(in kvm_release_pfn_clean); not able to be >> marked as dirty/accessed(in kvm_set_pfn_dirty/accessed) etc. >> >> V1: >> https://lkml.org/lkml/2018/7/4/91 >> >> V2: >> *Add documentation for MEMORY_DEVICE_DEV_DAX memory type in comment block >> *Add is_dax_page() in mm.h to differentiate the pages is from DAX device. >> *Remove the function kvm_is_nd_pfn(). >> >> Zhang Yi (4): >> kvm: remove redundant reserved page check >> mm: introduce memory type MEMORY_DEVICE_DEV_DAX >> mm: add a function to differentiate the pages is from DAX device >> memory >> kvm: add a check if pfn is from NVDIMM pmem. >> >> drivers/dax/pmem.c | 1 + >> include/linux/memremap.h | 9 + >> include/linux/mm.h | 12 >> virt/kvm/kvm_main.c | 16 >> 4 files changed, 30 insertions(+), 8 deletions(-) >> > >
linux-next: Tree for Jul 20
Hi all, Changes since 20180719: The powerpc tree gained a conflict against the powerpc-fixes tree. The pci tree gained a conflict against Linus' tree. The net-next tree gained a conflict against Linus' tree. I also applied a supplied patch to work around a kconfig problem. The mfd tree gained a conflict against the sound tree. Non-merge commits (relative to Linus' tree): 6975 6624 files changed, 267988 insertions(+), 137155 deletions(-) I have created today's linux-next tree at git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (patches at http://www.kernel.org/pub/linux/kernel/next/ ). If you are tracking the linux-next tree using git, you should not use "git pull" to do so as that will try to merge the new linux-next release with the old one. You should use "git fetch" and checkout or reset to the new master. You can see which trees have been included by looking in the Next/Trees file in the source. There are also quilt-import.log and merge.log files in the Next directory. Between each merge, the tree was built with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a multi_v7_defconfig for arm and a native build of tools/perf. After the final fixups (if any), I do an x86_64 modules_install followed by builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit), ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc and sparc64 defconfig. And finally, a simple boot test of the powerpc pseries_le_defconfig kernel in qemu (with and without kvm enabled). Below is a summary of the state of the merge. I am currently merging 285 trees (counting Linus' and 65 trees of bug fix patches pending for the current merge release). Stats about the size of the tree over time can be seen at http://neuling.org/linux-next-size.html . Status of my local build tests will be at http://kisskb.ellerman.id.au/linux-next . If maintainers want to give advice about cross compilers/configs that work, we are always open to add more builds. Thanks to Randy Dunlap for doing many randconfig builds. And to Paul Gortmaker for triage and bug fixes. -- Cheers, Stephen Rothwell $ git checkout master $ git reset --hard stable Merging origin/master (fb7d1bcf1602 Merge tag 'pci-v4.18-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci) Merging fixes/master (147a89bc71e7 Merge tag 'kconfig-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild) Merging kbuild-current/fixes (9d3cce1e8b85 Linux 4.18-rc5) Merging arc-current/for-curr (af1fc5baa724 ARCv2: [plat-hsdk]: Save accl reg pair by default) Merging arm-current/fixes (b4c7e2bd2eb4 ARM: 8780/1: ftrace: Only set kernel memory back to read-only after boot) Merging arm64-fixes/for-next/fixes (2fd8eb4ad871 arm64: neon: Fix function may_use_simd() return error status) Merging m68k-current/for-linus (b12c8a70643f m68k: Set default dma mask for platform devices) Merging powerpc-fixes/fixes (b03897cf318d powerpc/powernv: Fix save/restore of SPRG3 on entry/exit from stop (idle)) Merging sparc/master (1aaccb5fa0ea Merge tag 'rtc-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux) Merging fscrypt-current/for-stable (ae64f9bd1d36 Linux 4.15-rc2) Merging net/master (f39f28ff82c1 Merge tag 'sound-4.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound) Merging bpf/master (f39f28ff82c1 Merge tag 'sound-4.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound) Merging ipsec/master (7284fdf39a91 esp6: fix memleak on error path in esp6_input) Merging netfilter/master (c293ac959f80 netfilter: nft_set_rbtree: fix panic when destroying set by GC) Merging ipvs/master (0026129c8629 rhashtable: add restart routine in rhashtable_free_and_destroy()) Merging wireless-drivers/master (248c690a2dc8 Merge tag 'wireless-drivers-for-davem-2018-07-03' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers) Merging mac80211/master (5cf3006cc81d nl80211: Add a missing break in parse_station_flags) Merging rdma-fixes/for-rc (d63c46734c54 RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path) Merging sound-current/for-linus (f3d737b6340b ALSA: hda/realtek - Yet another Clevo P950 quirk entry) Merging sound-asoc-fixes/for-linus (94688072d0c4 Merge branch 'asoc-4.18' into asoc-linus) Merging regmap-fixes/for-linus (9d3cce1e8b85 Linux 4.18-rc5) Merging regulator-fixes/for-linus (35e160a31b7c Merge branch 'regulator-4.18' into regulator-linus) Merging spi-fixes/for-linus (525e437354b6 Merge branch 'spi-4.18' into spi-linus) Merging pci-current/for-linus (270ed733e689 PCI: v3-semi: Fix I/O space page leak) Merging driver-core.current/driver-core-linus (722e5f2b1eec driver core: Partially revert "driver core: correct device's shutdown order") Merging tty.current/tty-linus (021c91791a5e Linux 4.18-rc3) Merging usb.current/usb-linus (2c3806c48245 Merge tag '
[PATCH 1/2] clk: uniphier: add NAND 200MHz clock
The Denali NAND controller IP needs three clocks: - clk: controller core clock - clk_x: bus interface clock - ecc_clk: clock at which ECC circuitry is run Currently, only the first one (50MHz) is provided. The rest of the two clock ports must be connected to the 200MHz clock line. Add this. Signed-off-by: Masahiro Yamada --- drivers/clk/uniphier/clk-uniphier-sys.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/clk/uniphier/clk-uniphier-sys.c b/drivers/clk/uniphier/clk-uniphier-sys.c index 4f5ff9f..a582446 100644 --- a/drivers/clk/uniphier/clk-uniphier-sys.c +++ b/drivers/clk/uniphier/clk-uniphier-sys.c @@ -29,18 +29,20 @@ UNIPHIER_CLK_FACTOR("sd-200m", -1, "spll", 1, 10), \ UNIPHIER_CLK_FACTOR("sd-133m", -1, "spll", 1, 15) -/* Denali driver requires clk_x rate (clk: 50MHz, clk_x & ecc_clk: 200MHz) */ #define UNIPHIER_LD4_SYS_CLK_NAND(idx) \ - UNIPHIER_CLK_FACTOR("nand-200m", -1, "spll", 1, 8), \ - UNIPHIER_CLK_GATE("nand", (idx), "nand-200m", 0x2104, 2) + UNIPHIER_CLK_FACTOR("nand-50m", -1, "spll", 1, 32), \ + UNIPHIER_CLK_GATE("nand", (idx), "nand-50m", 0x2104, 2) #define UNIPHIER_PRO5_SYS_CLK_NAND(idx) \ - UNIPHIER_CLK_FACTOR("nand-200m", -1, "spll", 1, 12),\ - UNIPHIER_CLK_GATE("nand", (idx), "nand-200m", 0x2104, 2) + UNIPHIER_CLK_FACTOR("nand-50m", -1, "spll", 1, 48), \ + UNIPHIER_CLK_GATE("nand", (idx), "nand-50m", 0x2104, 2) #define UNIPHIER_LD11_SYS_CLK_NAND(idx) \ - UNIPHIER_CLK_FACTOR("nand-200m", -1, "spll", 1, 10),\ - UNIPHIER_CLK_GATE("nand", (idx), "nand-200m", 0x210c, 0) + UNIPHIER_CLK_FACTOR("nand-50m", -1, "spll", 1, 40), \ + UNIPHIER_CLK_GATE("nand", (idx), "nand-50m", 0x210c, 0) + +#define UNIPHIER_SYS_CLK_NAND_4X(idx) \ + UNIPHIER_CLK_FACTOR("nand-4x", (idx), "nand", 4, 1) #define UNIPHIER_LD11_SYS_CLK_EMMC(idx) \ UNIPHIER_CLK_GATE("emmc", (idx), NULL, 0x210c, 2) @@ -94,6 +96,7 @@ const struct uniphier_clk_data uniphier_ld4_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "a2pll", 1, 16), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 16), UNIPHIER_LD4_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_LD4_SYS_CLK_SD, UNIPHIER_CLK_FACTOR("usb2", -1, "upll", 1, 12), UNIPHIER_LD4_SYS_CLK_STDMAC(8), /* Ether, HSC, MIO */ @@ -109,6 +112,7 @@ const struct uniphier_clk_data uniphier_pro4_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "a2pll", 1, 8), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 32), UNIPHIER_LD4_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_LD4_SYS_CLK_SD, UNIPHIER_CLK_FACTOR("usb2", -1, "upll", 1, 12), UNIPHIER_PRO4_SYS_CLK_ETHER(6), @@ -131,6 +135,7 @@ const struct uniphier_clk_data uniphier_sld8_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "spll", 1, 20), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 16), UNIPHIER_LD4_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_LD4_SYS_CLK_SD, UNIPHIER_CLK_FACTOR("usb2", -1, "upll", 1, 12), UNIPHIER_LD4_SYS_CLK_STDMAC(8), /* Ether, HSC, MIO */ @@ -144,6 +149,7 @@ const struct uniphier_clk_data uniphier_pro5_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "dapll2", 1, 40), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 48), UNIPHIER_PRO5_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_PRO5_SYS_CLK_SD, UNIPHIER_LD4_SYS_CLK_STDMAC(8), /* HSC */ UNIPHIER_PRO4_SYS_CLK_GIO(12), /* PCIe, USB3 */ @@ -159,6 +165,7 @@ const struct uniphier_clk_data uniphier_pxs2_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "spll", 1, 27), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 48), UNIPHIER_PRO5_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_PRO5_SYS_CLK_SD, UNIPHIER_PRO4_SYS_CLK_ETHER(6), UNIPHIER_LD4_SYS_CLK_STDMAC(8), /* HSC, RLE */ @@ -181,6 +188,7 @@ const struct uniphier_clk_data uniphier_ld11_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "spll", 1, 34), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 40), UNIPHIER_LD11_SYS_CLK_NAND(2), + UNIPHIER_SYS_CLK_NAND_4X(3), UNIPHIER_LD11_SYS_CLK_EMMC(4), /* Index 5 reserved for eMMC PHY */ UNIPHIER_LD11_SYS_CLK_ETHER(6), @@ -214,6 +222,7 @@ const struct uniphier_clk_data uniphier_ld20_sys_clk_data[] = { UNIPHIER_CLK_FACTOR("uart", 0, "spll", 1, 34), UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1,
[PATCH 2/2] clk: uniphier: add more USB3 PHY clocks
Add USB3 PHY clocks where missing. Use fixed-factor clocks for those without gating. For clarification, prefix clock names with 'ss' or 'hs'. Signed-off-by: Masahiro Yamada --- drivers/clk/uniphier/clk-uniphier-sys.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/clk/uniphier/clk-uniphier-sys.c b/drivers/clk/uniphier/clk-uniphier-sys.c index a582446..1c5a998 100644 --- a/drivers/clk/uniphier/clk-uniphier-sys.c +++ b/drivers/clk/uniphier/clk-uniphier-sys.c @@ -122,6 +122,9 @@ const struct uniphier_clk_data uniphier_pro4_sys_clk_data[] = { UNIPHIER_PRO4_SYS_CLK_GIO(12), /* Ether, SATA, USB3 */ UNIPHIER_PRO4_SYS_CLK_USB3(14, 0), UNIPHIER_PRO4_SYS_CLK_USB3(15, 1), + UNIPHIER_CLK_FACTOR("usb30-hsphy0", 16, "upll", 1, 12), + UNIPHIER_CLK_FACTOR("usb30-ssphy0", 17, "ref", 1, 1), + UNIPHIER_CLK_FACTOR("usb31-ssphy0", 20, "ref", 1, 1), UNIPHIER_CLK_GATE("sata0", 28, NULL, 0x2104, 18), UNIPHIER_CLK_GATE("sata1", 29, NULL, 0x2104, 19), UNIPHIER_PRO4_SYS_CLK_AIO(40), @@ -173,8 +176,11 @@ const struct uniphier_clk_data uniphier_pxs2_sys_clk_data[] = { UNIPHIER_PRO4_SYS_CLK_USB3(14, 0), UNIPHIER_PRO4_SYS_CLK_USB3(15, 1), /* The document mentions 0x2104 bit 18, but not functional */ - UNIPHIER_CLK_GATE("usb30-phy", 16, NULL, 0x2104, 19), - UNIPHIER_CLK_GATE("usb31-phy", 20, NULL, 0x2104, 20), + UNIPHIER_CLK_GATE("usb30-hsphy0", 16, NULL, 0x2104, 19), + UNIPHIER_CLK_FACTOR("usb30-ssphy0", 17, "ref", 1, 1), + UNIPHIER_CLK_FACTOR("usb30-ssphy1", 18, "ref", 1, 1), + UNIPHIER_CLK_GATE("usb31-hsphy0", 20, NULL, 0x2104, 20), + UNIPHIER_CLK_FACTOR("usb31-ssphy0", 21, "ref", 1, 1), UNIPHIER_CLK_GATE("sata0", 28, NULL, 0x2104, 22), UNIPHIER_PRO5_SYS_CLK_AIO(40), { /* sentinel */ } @@ -235,8 +241,10 @@ const struct uniphier_clk_data uniphier_ld20_sys_clk_data[] = { * We do not use bit 15 here. */ UNIPHIER_CLK_GATE("usb30", 14, NULL, 0x210c, 14), - UNIPHIER_CLK_GATE("usb30-phy0", 16, NULL, 0x210c, 12), - UNIPHIER_CLK_GATE("usb30-phy1", 17, NULL, 0x210c, 13), + UNIPHIER_CLK_GATE("usb30-hsphy0", 16, NULL, 0x210c, 12), + UNIPHIER_CLK_GATE("usb30-hsphy1", 17, NULL, 0x210c, 13), + UNIPHIER_CLK_FACTOR("usb30-ssphy0", 18, "ref", 1, 1), + UNIPHIER_CLK_FACTOR("usb30-ssphy1", 19, "ref", 1, 1), UNIPHIER_CLK_GATE("pcie", 24, NULL, 0x210c, 4), UNIPHIER_LD11_SYS_CLK_AIO(40), UNIPHIER_LD11_SYS_CLK_EVEA(41), @@ -272,11 +280,11 @@ const struct uniphier_clk_data uniphier_pxs3_sys_clk_data[] = { UNIPHIER_CLK_GATE("usb30", 12, NULL, 0x210c, 4),/* =GIO0 */ UNIPHIER_CLK_GATE("usb31-0", 13, NULL, 0x210c, 5), /* =GIO1 */ UNIPHIER_CLK_GATE("usb31-1", 14, NULL, 0x210c, 6), /* =GIO1-1 */ - UNIPHIER_CLK_GATE("usb30-phy0", 16, NULL, 0x210c, 16), - UNIPHIER_CLK_GATE("usb30-phy1", 17, NULL, 0x210c, 18), - UNIPHIER_CLK_GATE("usb30-phy2", 18, NULL, 0x210c, 20), - UNIPHIER_CLK_GATE("usb31-phy0", 20, NULL, 0x210c, 17), - UNIPHIER_CLK_GATE("usb31-phy1", 21, NULL, 0x210c, 19), + UNIPHIER_CLK_GATE("usb30-hsphy0", 16, NULL, 0x210c, 16), + UNIPHIER_CLK_GATE("usb30-ssphy0", 17, NULL, 0x210c, 18), + UNIPHIER_CLK_GATE("usb30-ssphy1", 18, NULL, 0x210c, 20), + UNIPHIER_CLK_GATE("usb31-hsphy0", 20, NULL, 0x210c, 17), + UNIPHIER_CLK_GATE("usb31-ssphy0", 21, NULL, 0x210c, 19), UNIPHIER_CLK_GATE("pcie", 24, NULL, 0x210c, 3), UNIPHIER_CLK_GATE("sata0", 28, NULL, 0x210c, 7), UNIPHIER_CLK_GATE("sata1", 29, NULL, 0x210c, 8), -- 2.7.4
Re: [PATCH V2 0/4] Fix kvm misconceives NVDIMM pages as reserved mmio
Thanks Paolo, let's wait Jan&Dan 's comments. Thank you, Paolo. Regards Yi On 2018年07月20日 16:32, Paolo Bonzini wrote: > On 20/07/2018 16:11, Zhang,Yi wrote: >> Added Jiang,Dave, >> >> Ping for further review, comments. > I need an Acked-by from the MM people to merge this. Jan, Dan? > > Paolo > >> Thanks All >> >> Regards >> Yi. >> >> >> On 2018年07月11日 01:01, Zhang Yi wrote: >>> For device specific memory space, when we move these area of pfn to >>> memory zone, we will set the page reserved flag at that time, some of >>> these reserved for device mmio, and some of these are not, such as >>> NVDIMM pmem. >>> >>> Now, we map these dev_dax or fs_dax pages to kvm for DIMM/NVDIMM >>> backend, since these pages are reserved. the check of >>> kvm_is_reserved_pfn() misconceives those pages as MMIO. Therefor, we >>> introduce 2 page map types, MEMORY_DEVICE_FS_DAX/MEMORY_DEVICE_DEV_DAX, >>> to indentify these pages are from NVDIMM pmem. and let kvm treat these >>> as normal pages. >>> >>> Without this patch, Many operations will be missed due to this >>> mistreatment to pmem pages. For example, a page may not have chance to >>> be unpinned for KVM guest(in kvm_release_pfn_clean); not able to be >>> marked as dirty/accessed(in kvm_set_pfn_dirty/accessed) etc. >>> >>> V1: >>> https://lkml.org/lkml/2018/7/4/91 >>> >>> V2: >>> *Add documentation for MEMORY_DEVICE_DEV_DAX memory type in comment block >>> *Add is_dax_page() in mm.h to differentiate the pages is from DAX device. >>> *Remove the function kvm_is_nd_pfn(). >>> >>> Zhang Yi (4): >>> kvm: remove redundant reserved page check >>> mm: introduce memory type MEMORY_DEVICE_DEV_DAX >>> mm: add a function to differentiate the pages is from DAX device >>> memory >>> kvm: add a check if pfn is from NVDIMM pmem. >>> >>> drivers/dax/pmem.c | 1 + >>> include/linux/memremap.h | 9 + >>> include/linux/mm.h | 12 >>> virt/kvm/kvm_main.c | 16 >>> 4 files changed, 30 insertions(+), 8 deletions(-) >>> >>
[PATCH v4 0/2] Fix lockdep warning with nested instances of i2c-mux
Hi! Ping. This is almost a resend of v3, but I added tested-by tags from John and unwrapped a line in the commit message, so it's a v4. How is this going to find its way to Linus? I can move this through the i2c-mux tree, but I obviously need a tag for patch 1/2 for that... Cheers, Peter Changes since v3https://lkml.org/lkml/2018/5/24/994 - Added Tested-by tags from John. - Unwrapped commit message for patch 2/2. Changes since v2https://lkml.org/lkml/2018/5/24/176 - EXPORT_SYMBOL_GPL(rt_mutex_lock_nested) is more appropriate (the rt_ prefix was missing). Changes since v1https://lkml.org/lkml/2018/5/24/93 - Further compile tests indicated a missing #define for rt_mutex_lock with lockdep enabled, so that one is added. - I have verified that I don't get any lockdep splat for a local i2c-mux setup with these patches applied, and that I do without them. Cheers, Peter Peter Rosin (2): rtmutex: allow specifying a subclass for nested locking i2c: mux: annotate the nested rt_mutex usage drivers/i2c/i2c-core-base.c | 2 +- drivers/i2c/i2c-mux.c | 4 ++-- include/linux/rtmutex.h | 7 +++ kernel/locking/rtmutex.c| 29 + 4 files changed, 35 insertions(+), 7 deletions(-) -- 2.11.0
[PATCH v4 1/2] rtmutex: allow specifying a subclass for nested locking
Needed for annotating rt_mutex locks. Tested-by: John Sperbeck Signed-off-by: Peter Rosin --- include/linux/rtmutex.h | 7 +++ kernel/locking/rtmutex.c | 29 + 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index 1b92a28dd672..6fd615a0eea9 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h @@ -106,7 +106,14 @@ static inline int rt_mutex_is_locked(struct rt_mutex *lock) extern void __rt_mutex_init(struct rt_mutex *lock, const char *name, struct lock_class_key *key); extern void rt_mutex_destroy(struct rt_mutex *lock); +#ifdef CONFIG_DEBUG_LOCK_ALLOC +extern void rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass); +#define rt_mutex_lock(lock) rt_mutex_lock_nested(lock, 0) +#else extern void rt_mutex_lock(struct rt_mutex *lock); +#define rt_mutex_lock_nested(lock, subclass) rt_mutex_lock(lock) +#endif + extern int rt_mutex_lock_interruptible(struct rt_mutex *lock); extern int rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout); diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 4f014be7a4b8..2823d4163a37 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1465,6 +1465,29 @@ rt_mutex_fastunlock(struct rt_mutex *lock, rt_mutex_postunlock(&wake_q); } +static inline void __rt_mutex_lock(struct rt_mutex *lock, unsigned int subclass) +{ + might_sleep(); + + mutex_acquire(&lock->dep_map, subclass, 0, _RET_IP_); + rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, rt_mutex_slowlock); +} + +#ifdef CONFIG_DEBUG_LOCK_ALLOC +/** + * rt_mutex_lock_nested - lock a rt_mutex + * + * @lock: the rt_mutex to be locked + * @subclass: the lockdep subclass + */ +void __sched rt_mutex_lock_nested(struct rt_mutex *lock, unsigned int subclass) +{ + __rt_mutex_lock(lock, subclass); +} +EXPORT_SYMBOL_GPL(rt_mutex_lock_nested); +#endif + +#ifndef CONFIG_DEBUG_LOCK_ALLOC /** * rt_mutex_lock - lock a rt_mutex * @@ -1472,12 +1495,10 @@ rt_mutex_fastunlock(struct rt_mutex *lock, */ void __sched rt_mutex_lock(struct rt_mutex *lock) { - might_sleep(); - - mutex_acquire(&lock->dep_map, 0, 0, _RET_IP_); - rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, rt_mutex_slowlock); + __rt_mutex_lock(lock, 0); } EXPORT_SYMBOL_GPL(rt_mutex_lock); +#endif /** * rt_mutex_lock_interruptible - lock a rt_mutex interruptible -- 2.11.0
Re: UBSAN: Undefined behaviour in arch/x86/events/amd/ibs.c:582:24: member access within null pointer of type 'struct perf_event'
Paul, On Fri, 20 Jul 2018, Paul Menzel wrote: > Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+ > (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the > warning below is shown. > > > [2.111913] > > > > [2.111917] UBSAN: Undefined behaviour in > > arch/x86/events/amd/ibs.c:582:24 > > [2.111919] member access within null pointer of type 'struct perf_event' > > [2.111926] CPU: 0 PID: 144 Comm: udevadm Not tainted > > 4.18.0-rc5-00316-g4864b68cedf2 #104 > > [2.111928] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970 > > [2.111930] Call Trace: > > [2.111943] dump_stack+0x55/0x89 > > [2.111949] ubsan_epilogue+0xb/0x33 > > [2.111953] handle_null_ptr_deref+0x7f/0x90 > > [2.111958] __ubsan_handle_type_mismatch_v1+0x55/0x60 > > [2.111964] perf_ibs_handle_irq+0x596/0x620 Right, the code dereferences event before checking the STARTED bit. Patch below should cure the issue. The warning should not trigger, if I analyzed the thing correctly. Emphasis on *should* Thanks, tglx 8< diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index 4b98101209a1..d50bb4dc0650 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -579,7 +579,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) { struct cpu_perf_ibs *pcpu = this_cpu_ptr(perf_ibs->pcpu); struct perf_event *event = pcpu->event; - struct hw_perf_event *hwc = &event->hw; + struct hw_perf_event *hwc; struct perf_sample_data data; struct perf_raw_record raw; struct pt_regs regs; @@ -602,6 +602,10 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) return 0; } + if (WARN_ON_ONCE(!event)) + goto fail; + + hwc = &event->hw; msr = hwc->config_base; buf = ibs_data.regs; rdmsrl(msr, *buf);
[PATCH v4 2/2] i2c: mux: annotate the nested rt_mutex usage
If an i2c topology has instances of nested muxes, then a lockdep splat is produced when when i2c_parent_lock_bus() is called. Here is an example: WARNING: possible recursive locking detected insmod/68159 is trying to acquire lock: (i2c_register_adapter#2){+.+.}, at: i2c_parent_lock_bus+0x32/0x50 [i2c_mux] but task is already holding lock: (i2c_register_adapter#2){+.+.}, at: i2c_parent_lock_bus+0x32/0x50 [i2c_mux] other info that might help us debug this: Possible unsafe locking scenario: CPU0 lock(i2c_register_adapter#2); lock(i2c_register_adapter#2); *** DEADLOCK *** May be due to missing lock nesting notation 1 lock held by insmod/68159: #0: (i2c_register_adapter#2){+.+.}, at: i2c_parent_lock_bus+0x32/0x50 [i2c_mux] stack backtrace: CPU: 13 PID: 68159 Comm: insmod Tainted: G O Call Trace: dump_stack+0x67/0x98 __lock_acquire+0x162e/0x1780 lock_acquire+0xba/0x200 rt_mutex_lock+0x44/0x60 i2c_parent_lock_bus+0x32/0x50 [i2c_mux] i2c_parent_lock_bus+0x3e/0x50 [i2c_mux] i2c_smbus_xfer+0xf0/0x700 i2c_smbus_read_byte+0x42/0x70 my2c_init+0xa2/0x1000 [my2c] do_one_initcall+0x51/0x192 do_init_module+0x62/0x216 load_module+0x20f9/0x2b50 SYSC_init_module+0x19a/0x1c0 SyS_init_module+0xe/0x10 do_syscall_64+0x6c/0x1a0 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Reported-by: John Sperbeck Tested-by: John Sperbeck Signed-off-by: Peter Rosin --- drivers/i2c/i2c-core-base.c | 2 +- drivers/i2c/i2c-mux.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index f5ec6ec6776f..1157a64c7be3 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -615,7 +615,7 @@ static int i2c_check_addr_busy(struct i2c_adapter *adapter, int addr) static void i2c_adapter_lock_bus(struct i2c_adapter *adapter, unsigned int flags) { - rt_mutex_lock(&adapter->bus_lock); + rt_mutex_lock_nested(&adapter->bus_lock, i2c_adapter_depth(adapter)); } /** diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 9669ca4937b8..7ba31f6bf148 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -144,7 +144,7 @@ static void i2c_mux_lock_bus(struct i2c_adapter *adapter, unsigned int flags) struct i2c_mux_priv *priv = adapter->algo_data; struct i2c_adapter *parent = priv->muxc->parent; - rt_mutex_lock(&parent->mux_lock); + rt_mutex_lock_nested(&parent->mux_lock, i2c_adapter_depth(adapter)); if (!(flags & I2C_LOCK_ROOT_ADAPTER)) return; i2c_lock_bus(parent, flags); @@ -181,7 +181,7 @@ static void i2c_parent_lock_bus(struct i2c_adapter *adapter, struct i2c_mux_priv *priv = adapter->algo_data; struct i2c_adapter *parent = priv->muxc->parent; - rt_mutex_lock(&parent->mux_lock); + rt_mutex_lock_nested(&parent->mux_lock, i2c_adapter_depth(adapter)); i2c_lock_bus(parent, flags); } -- 2.11.0
Re: [patch v3] mm, oom: fix unnecessary killing of additional processes
On Thu, 19 Jul 2018, Tetsuo Handa wrote: > Sigh... > > Nacked-by: Tetsuo Handa > > because David is not aware what is wrong. > Hmm, didn't you incorporate this exact patch into your own patch series that you proposed? :) I'm coming to this stark realization that all of these theater is only for effect. Perhaps other observers have come to that understanding earlier and I was late to the party. You're nacking a patch because it does a double set_bit() and jiffies can wraparound and we can add a process to the oom reaper list twice if the oom happens at the exact same moment. Ok. These are extremely trivial to fix. > Let's call "A" as a thread doing exit_mmap(), and "B" as the OOM reaper > kernel thread. > > (1) "A" finds that unlikely(mm_is_oom_victim(mm)) == true. > (2) "B" finds that test_bit(MMF_OOM_SKIP, &mm->flags) in oom_reap_task() is > false. > (3) "B" finds that !test_bit(MMF_UNSTABLE, &mm->flags) in oom_reap_task() is > true. > (4) "B" enters into oom_reap_task_mm(tsk, mm). > (5) "B" finds that !down_read_trylock(&mm->mmap_sem) is false. > (6) "B" finds that mm_has_blockable_invalidate_notifiers(mm) is false. > (7) "B" finds that test_bit(MMF_UNSTABLE, &mm->flags) is false. > (8) "B" enters into __oom_reap_task_mm(mm). > (9) "A" finds that test_and_set_bit(MMF_UNSTABLE, &mm->flags) is false. > (10) "A" is preempted by somebody else. > (11) "B" finds that test_and_set_bit(MMF_UNSTABLE, &mm->flags) is true. > (12) "B" leaves __oom_reap_task_mm(mm). > (13) "B" leaves oom_reap_task_mm(). > (14) "B" finds that time_after_eq(jiffies, mm->oom_free_expire) became true. > (15) "B" finds that !test_bit(MMF_OOM_SKIP, &mm->flags) is true. > (16) "B" calls set_bit(MMF_OOM_SKIP, &mm->flags). > (17) "B" finds that test_bit(MMF_OOM_SKIP, &mm->flags) is true. > (18) select_bad_process() finds that MMF_OOM_SKIP is already set. > (19) out_of_memory() kills a new OOM victim. > (20) "A" resumes execution and start reclaiming memory. > > because oom_lock serialization was already removed. > Absent oom_lock serialization, this is exactly working as intended. You could argue that once the thread has reached exit_mmap() and begins oom reaping that it should be allowed to finish before the oom reaper declares MMF_OOM_SKIP. That could certainly be helpful, I simply haven't encountered a usecase where it were needed. Or, we could restart the oom expiration when MMF_UNSTABLE is set and deem that progress is being made so it give it some extra time. In practice, again, we haven't seen this needed. But either of those are very easy to add in as well. Which would you prefer? mm, oom: fix unnecessary killing of additional processes fix Fix double set_bit() per Tetsuo. Fix jiffies wraparound per Tetsuo. Signed-off-by: David Rientjes --- mm/mmap.c | 13 ++--- mm/oom_kill.c | 7 +-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3069,23 +3069,22 @@ void exit_mmap(struct mm_struct *mm) * Nothing can be holding mm->mmap_sem here and the above call * to mmu_notifier_release(mm) ensures mmu notifier callbacks in * __oom_reap_task_mm() will not block. -*/ - __oom_reap_task_mm(mm); - - /* -* Now, set MMF_UNSTABLE to avoid racing with the oom reaper. +* +* This sets MMF_UNSTABLE to avoid racing with the oom reaper. * This needs to be done before calling munlock_vma_pages_all(), * which clears VM_LOCKED, otherwise the oom reaper cannot * reliably test for it. If the oom reaper races with * munlock_vma_pages_all(), this can result in a kernel oops if * a pmd is zapped, for example, after follow_page_mask() has * checked pmd_none(). -* +*/ + __oom_reap_task_mm(mm); + + /* * Taking mm->mmap_sem for write after setting MMF_UNSTABLE will * guarantee that the oom reaper will not run on this mm again * after mmap_sem is dropped. */ - set_bit(MMF_UNSTABLE, &mm->flags); down_write(&mm->mmap_sem); up_write(&mm->mmap_sem); } diff --git a/mm/oom_kill.c b/mm/oom_kill.c --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -666,12 +666,15 @@ static int oom_reaper(void *unused) static u64 oom_free_timeout_ms = 1000; static void wake_oom_reaper(struct task_struct *tsk) { + unsigned long expire = jiffies + msecs_to_jiffies(oom_free_timeout_ms); + + if (!expire) + expire++; /* * Set the reap timeout; if it's already set, the mm is enqueued and * this tsk can be ignored. */ - if (cmpxchg(&tsk->signal->oom_mm->oom_free_expire, 0UL, -
Re: [PATCH 1/2] security/keys/secure_key: Adds the secure key support based on CAAM.
On Fri, 2018-07-20 at 11:16 +0530, Udit Agarwal wrote: > +== > +Secure Key > +== > + > +Secure key is the new type added to kernel key ring service. > +Secure key is a symmetric type key of minimum length 32 bytes > +and with maximum possible length to be 128 bytes. It is produced > +in kernel using the CAAM crypto engine. Userspace can only see > +the blob for the corresponding key. All the blobs are displayed > +or loaded in hex ascii. > + > +Secure key can only be created on platforms which supports CAAM > +hardware block. Secure key can also be used as a master key to > +create the encrypted keys along with the existing key types in > +kernel. > + > +Secure key uses CAAM hardware to generate the key and blobify its > +content for userspace. Generated blobs are tied up with the hardware > +secret key stored in CAAM, hence the same blob will not be able to > +de-blobify with the different secret key on another machine. Thanks for working on this, so far we've been using this functionality via a custom sysfs interface. Proper integration into the keyring framework would be very nice! Some questions which might influence the userspace api design: - If I remember correctly, CAAM key blobs contain flags which specify if the key can be exported from the CAAM after unwrapping or not (then it stays in one of the internal key registers). Which mode do you use? - If that's not already supported by this series, do you intend to make secure keys (in the non-exportable-mode) usable for encryption/ decryption, so they could be used for dm-crypt? If so, you'd probably need some resource management in the CAAM driver, as the number of key registers is limited. - Secure keys could also be implemented using OP-TEE for example, so the documentation shouldn't be CAAM-specific and only use it as an example. Are there corresponding changes to the CAAM driver needed to test this? Best regards, Jan -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- |
Re: [PATCH v2 08/10] coresight: perf: Add helper to retrieve sink configuration
On 19/07/18 21:07, Mathieu Poirier wrote: On Tue, Jul 17, 2018 at 06:11:39PM +0100, Suzuki K Poulose wrote: We can always find the sink configuration for a given perf_output_handle. Add a helper to retrieve the sink configuration for a given perf_output_handle. This will be used to get rid of the set_buffer() call back. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm-perf.c | 14 - drivers/hwtracing/coresight/coresight-etm-perf.h | 26 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 6a4252b..3cc4a0b 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -23,20 +23,6 @@ static struct pmu etm_pmu; static bool etm_perf_up; -/** - * struct etm_event_data - Coresight specifics associated to an event - * @work: Handle to free allocated memory outside IRQ context. - * @mask: Hold the CPU(s) this event was set for. - * @snk_config:The sink configuration. - * @path: An array of path, each slot for one CPU. - */ -struct etm_event_data { - struct work_struct work; - cpumask_t mask; - void *snk_config; - struct list_head * __percpu *path; -}; - If this is moved to coresight-etm-perf.h, the #include can be removed. Actually, we do have the PER_CPU variables in the file already, which is why I left them there. See the next line. static DEFINE_PER_CPU(struct perf_output_handle, ctx_handle); static DEFINE_PER_CPU(struct coresight_device *, csdev_src); diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index 4197df4..da7d933 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -7,6 +7,7 @@ #ifndef _CORESIGHT_ETM_PERF_H #define _CORESIGHT_ETM_PERF_H +#include #include "coresight-priv.h" struct coresight_device; @@ -42,14 +43,39 @@ struct etm_filters { boolssstatus; }; +/** + * struct etm_event_data - Coresight specifics associated to an event + * @work: Handle to free allocated memory outside IRQ context. + * @mask: Hold the CPU(s) this event was set for. + * @snk_config:The sink configuration. + * @path: An array of path, each slot for one CPU. + */ +struct etm_event_data { + struct work_struct work; + cpumask_t mask; + void *snk_config; + struct list_head * __percpu *path; +}; #ifdef CONFIG_CORESIGHT int etm_perf_symlink(struct coresight_device *csdev, bool link); +static inline void *etm_perf_sink_config(struct perf_output_handle *handle) +{ + struct etm_event_data *data = perf_get_aux(handle); + if (data) + return data->snk_config; + return NULL; +} #else static inline int etm_perf_symlink(struct coresight_device *csdev, bool link) { return -EINVAL; } +static inline void *etm_perf_sink_config(struct perf_output_handle *handle) +{ + return NULL; +} + I think we can do without those... See my comment in the next patch. Sure
Re: [PATCH v2] pinctrl: tegra: fix spelling in devicetree binding document
On 20/07/18 09:22, Marcel Ziswiler wrote: > From: Marcel Ziswiler > > This fixes a spelling mistake. > > Signed-off-by: Marcel Ziswiler > > --- > > Changes in v2: > - Also fix up the one in nvidia,tegra210-pinmux.txt as suggested by Jon. > > Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt | 2 +- > Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git > a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > index ecb5c0d25218..f4d06bb0b55a 100644 > --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-pinmux.txt > @@ -17,7 +17,7 @@ Tegra124 adds the following optional properties for pin > configuration subnodes. > The macros for options are defined in the > include/dt-binding/pinctrl/pinctrl-tegra.h. > - nvidia,enable-input: Integer. Enable the pin's input path. > - enable :TEGRA_PIN_ENABLE0 and > + enable :TEGRA_PIN_ENABLE and > disable or output only: TEGRA_PIN_DISABLE. > - nvidia,open-drain: Integer. > enable: TEGRA_PIN_ENABLE. > diff --git > a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt > b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt > index a62d82d5fbe9..85f211436b8e 100644 > --- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt > +++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra210-pinmux.txt > @@ -44,7 +44,7 @@ Optional subnode-properties: > - nvidia,tristate: Integer. > 0: drive, 1: tristate. > - nvidia,enable-input: Integer. Enable the pin's input path. > -enable :TEGRA_PIN_ENABLE0 and > +enable :TEGRA_PIN_ENABLE and > disable or output only: TEGRA_PIN_DISABLE. > - nvidia,open-drain: Integer. > enable: TEGRA_PIN_ENABLE. Acked-by: Jon Hunter Thanks! Jon -- nvpublic
[PATCH 1/2] ARM: uniphier: dts: add more clocks to Denali NAND controller node
Catch up with the new binding of the Denali IP where three clocks, "nand", "nand_x", "ecc" are required. For UniPhier SoCs, the "nand_x" and "ecc" are tied up because they are both 200MHz. Signed-off-by: Masahiro Yamada --- arch/arm/boot/dts/uniphier-ld4.dtsi | 3 ++- arch/arm/boot/dts/uniphier-pro4.dtsi | 3 ++- arch/arm/boot/dts/uniphier-pro5.dtsi | 3 ++- arch/arm/boot/dts/uniphier-pxs2.dtsi | 3 ++- arch/arm/boot/dts/uniphier-sld8.dtsi | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/arm/boot/dts/uniphier-ld4.dtsi b/arch/arm/boot/dts/uniphier-ld4.dtsi index 37950ad..2a17066 100644 --- a/arch/arm/boot/dts/uniphier-ld4.dtsi +++ b/arch/arm/boot/dts/uniphier-ld4.dtsi @@ -347,7 +347,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand2cs>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm/boot/dts/uniphier-pro4.dtsi b/arch/arm/boot/dts/uniphier-pro4.dtsi index 49539f0..da88ccc 100644 --- a/arch/arm/boot/dts/uniphier-pro4.dtsi +++ b/arch/arm/boot/dts/uniphier-pro4.dtsi @@ -394,7 +394,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm/boot/dts/uniphier-pro5.dtsi b/arch/arm/boot/dts/uniphier-pro5.dtsi index 06c2cef..40a84f2 100644 --- a/arch/arm/boot/dts/uniphier-pro5.dtsi +++ b/arch/arm/boot/dts/uniphier-pro5.dtsi @@ -439,7 +439,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand2cs>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm/boot/dts/uniphier-pxs2.dtsi b/arch/arm/boot/dts/uniphier-pxs2.dtsi index 641d961..1903752 100644 --- a/arch/arm/boot/dts/uniphier-pxs2.dtsi +++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi @@ -528,7 +528,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand2cs>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm/boot/dts/uniphier-sld8.dtsi b/arch/arm/boot/dts/uniphier-sld8.dtsi index e9b9b4f..dc723bf 100644 --- a/arch/arm/boot/dts/uniphier-sld8.dtsi +++ b/arch/arm/boot/dts/uniphier-sld8.dtsi @@ -351,7 +351,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand2cs>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; -- 2.7.4
[PATCH 2/2] arm64: uniphier: dts: add more clocks to Denali NAND controller node
Catch up with the new binding of the Denali IP where three clocks, "nand", "nand_x", "ecc" are required. For UniPhier SoCs, the "nand_x" and "ecc" are tied up because they are both 200MHz. Signed-off-by: Masahiro Yamada --- arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi | 3 ++- arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi | 3 ++- arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi index d63b56e..5640dac 100644 --- a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi @@ -571,7 +571,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi index 0298bd0..a8964c0 100644 --- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi @@ -626,7 +626,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi index 2a4cf42..fd2bcd4 100644 --- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi @@ -455,7 +455,8 @@ interrupts = <0 65 4>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nand>; - clocks = <&sys_clk 2>; + clock-names = "nand", "nand_x", "ecc"; + clocks = <&sys_clk 2>, <&sys_clk 3>, <&sys_clk 3>; resets = <&sys_rst 2>; }; }; -- 2.7.4
Re: [PATCH v2 09/10] coresight: perf: Remove set_buffer call back
Mathieu, On 19/07/18 21:36, Mathieu Poirier wrote: On Tue, Jul 17, 2018 at 06:11:40PM +0100, Suzuki K Poulose wrote: In coresight perf mode, we need to prepare the sink before starting a session, which is done via set_buffer call back. We then proceed to enable the tracing. If we fail to start the session successfully, we leave the sink configuration unchanged. This was fine for the existing backends as they don't have any state associated with the buffers. But with ETR, we need to keep track of the buffer details and need to be cleaned up if we fail. In order to make the operation atomic and to avoid yet another call back, we get rid of the "set_buffer" call back and pass the buffer details via enable() call back to the sink. Suzuki, I'm not sure I understand the problem you're trying to fix there. From the implementation of tmc_enable_etr_sink_perf() in the next patch, wouldn't the same result been achievable using a callback? We can definitely achieve the results using "set_buffer". But for ETR, we track the "perf_buf" in drvdata->perf_data when we do "set_buffer". But if we failed to enable_path(), we leave the drvdata->perf_data and doesn't clean it up. Now when another session is about to set_buf, we check if perf_data is empty and WARNs otherwise. Because we can't be sure if it belongs to an abandoned session or another active session and we completely messed somewhere in the driver. So, we need a clear_buffer call back if the enable fails, something not really worth. Anyways, there is no point in separating set_buffer and enabling the sink, as the error handling becomes cumbersome as explained above. I'm fine with this patch and supportive of getting rid of callbacks if we can, I just need to understand the exact problem you're after. From looking a your code (and the current implementation), if we succeed in setting the memory for the sink but fail in any of the subsequent steps i.e, enabling the rest of the compoment on the path or the source, the sink is left unchanged. Yes, thats right. And we should WARN (which I missed in this version) if there is a perf_data already for a disabled ETR. Please see my response to the next patch. diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 3cc4a0b..12a247d 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -269,16 +269,11 @@ static void etm_event_start(struct perf_event *event, int flags) path = etm_event_cpu_path(event_data, cpu); /* We need a sink, no need to continue without one */ sink = coresight_get_sink(path); - if (WARN_ON_ONCE(!sink || !sink_ops(sink)->set_buffer)) - goto fail_end_stop; - - /* Configure the sink */ - if (sink_ops(sink)->set_buffer(sink, handle, - event_data->snk_config)) + if (WARN_ON_ONCE(!sink)) goto fail_end_stop; /* Nothing will happen without a path */ - if (coresight_enable_path(path, CS_MODE_PERF)) + if (coresight_enable_path(path, CS_MODE_PERF, handle)) Here we already have a handle on "event_data". As such I think this is what we should feed to coresight_enable_path() rather than the handle. That way we don't need to call etm_perf_sink_config(), we just use the data. The advantage of passing on the handle is, we could get all the way upto the "perf_event" for the given session. Passing the event_data will loose that information. i.e, perf_event-> |perf_ouput_handle | -> |event_data | -> sink_config | <-event || | The purpose of the wrapper "etm_perf_sink_config()" is to abstract the way we handle the information under the event_data. i.e, if we decide to make some changes in the way we store event_data, we need to spill the changes every where. But the perf_ouput_handle has much more stable ABI than event_data, hence the choice of passing handle. Cheers Suzuki
Re: [PATCH v2 10/10] coresight: etm-perf: Add support for ETR backend
On 19/07/18 20:59, Mathieu Poirier wrote: On Tue, Jul 17, 2018 at 06:11:41PM +0100, Suzuki K Poulose wrote: Add support for using TMC-ETR as backend for ETM perf tracing. We use software double buffering at the moment. i.e, the TMC-ETR uses a separate buffer than the perf ring buffer. The data is copied to the perf ring buffer once a session completes. The TMC-ETR would try to match the larger of perf ring buffer or the ETR buffer size configured via sysfs, scaling down to a minimum limit of 1MB. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- + CS_UNLOCK(drvdata->base); + + tmc_flush_and_stop(drvdata); + tmc_sync_etr_buf(drvdata); + + CS_UNLOCK(drvdata->base); This is a copy/paste oversight, here you want to lock again. Thanks for catching that, will fix it. + /* Reset perf specific data */ + drvdata->perf_data = NULL; + spin_unlock_irqrestore(&drvdata->spinlock, flags); + + size = etr_buf->len; + tmc_etr_sync_perf_buffer(etr_perf); + + /* +* Update handle->head in snapshot mode. Also update the size to the +* hardware buffer size if there was an overflow. +*/ + if (etr_perf->snapshot) { + handle->head += size; + if (etr_buf->full) + size = etr_buf->size; + } + + lost |= etr_buf->full; +out: + if (lost) + perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); + return size; +} + static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data) { - /* We don't support perf mode yet ! */ - return -EINVAL; + int rc = 0; + unsigned long flags; + struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); + struct perf_output_handle *handle = data; + struct etr_perf_buffer *etr_perf = etm_perf_sink_config(handle); + + spin_lock_irqsave(&drvdata->spinlock, flags); + /* +* There can be only one writer per sink in perf mode. If the sink +* is already open in SYSFS mode, we can't use it. +*/ + if (drvdata->mode != CS_MODE_DISABLED || drvdata->perf_data) { + rc = -EBUSY; As discussed in the previous patch, I am missing a WARN_ON here : i.e, +if (drvdata->mode != CS_MODE_DISABLED || WARN_ON(drvdata->perf_data)) which was there in the previous version in set_buffer, which triggered some warnings for me with testing. + goto unlock_out; + } + + if (WARN_ON(!etr_perf || !etr_perf->etr_buf)) { + rc = -EINVAL; + goto unlock_out; + } + + etr_perf->head = PERF_IDX2OFF(handle->head, etr_perf); + drvdata->perf_data = etr_perf; + drvdata->mode = CS_MODE_PERF; + tmc_etr_enable_hw(drvdata, etr_perf->etr_buf); + +unlock_out: + spin_unlock_irqrestore(&drvdata->spinlock, flags); + return rc; } static int tmc_enable_etr_sink(struct coresight_device *csdev, @@ -1148,6 +1389,9 @@ static void tmc_disable_etr_sink(struct coresight_device *csdev) static const struct coresight_ops_sink tmc_etr_sink_ops = { .enable = tmc_enable_etr_sink, .disable= tmc_disable_etr_sink, + .alloc_buffer = tmc_etr_alloc_perf_buffer, + .update_buffer = tmc_etr_update_perf_buffer, + .free_buffer= tmc_etr_free_perf_buffer, .alloc_buffer = tmc_alloc_etr_buffer, .update_buffer = tmc_update_etr_buffer, .free_buffer= tmc_free_etr_buffer, To be consistant with .enable and .disable along with the naming convention on the ETF side. Sure, I can change them. Cheers Suzuki
Re: linux-next: manual merge of the pci tree with Linus' tree
On Fri, Jul 20, 2018 at 11:03:10AM +1000, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the pci tree got a conflict in: > > drivers/pci/controller/pci-aardvark.c > > between commit: > > 1df3e5b3feeb ("PCI: aardvark: Fix I/O space page leak") > > from Linus' tree and commit: > > 6df6ba974a55 ("PCI: aardvark: Remove PCIe outbound window configuration") > > from the pci tree. > > I fixed it up (see below) and can carry the fix as necessary. This > is now fixed as far as linux-next is concerned, but any non trivial > conflicts should be mentioned to your upstream maintainer when your tree > is submitted for merging. You may also want to consider cooperating > with the maintainer of the conflicting tree to minimise any particularly > complex conflicts. > > -- > Cheers, > Stephen Rothwell > > diff --cc drivers/pci/controller/pci-aardvark.c > index 0fae816fba39,d5030cd06197.. > --- a/drivers/pci/controller/pci-aardvark.c > +++ b/drivers/pci/controller/pci-aardvark.c > @@@ -843,13 -809,7 +809,7 @@@ static int advk_pcie_parse_request_of_p > > switch (resource_type(res)) { > case IORESOURCE_IO: > - advk_pcie_set_ob_win(pcie, 1, > - upper_32_bits(res->start), > - lower_32_bits(res->start), > - 0, 0xF800, 0, > - lower_32_bits(res->start), > - OB_PCIE_IO); > -err = pci_remap_iospace(res, iobase); > +err = devm_pci_remap_iospace(dev, res, iobase); > if (err) { > dev_warn(dev, "error %d: failed to map resource > %pR\n", >err, res); Hi Stephen, thanks for fixing this up, the fix looks fine to me (Thomas please confirm), if it is I would ask Bjorn please to send it upstream when the time for the PCI pull request comes. Thanks, Lorenzo
[PATCH V3] sched/deadline: Update rq_clock of later_rq when pushing a task
Daniel Casini got this warn while running a DL task here at RetisLab: [ 461.137582] [ cut here ] [ 461.137583] rq->clock_update_flags < RQCF_ACT_SKIP [ 461.137599] WARNING: CPU: 4 PID: 2354 at kernel/sched/sched.h:967 assert_clock_updated.isra.32.part.33+0x17/0x20 [a ton of modules] [ 461.137646] CPU: 4 PID: 2354 Comm: label_image Not tainted 4.18.0-rc4+ #3 [ 461.137647] Hardware name: ASUS All Series/Z87-K, BIOS 0801 09/02/2013 [ 461.137649] RIP: 0010:assert_clock_updated.isra.32.part.33+0x17/0x20 [ 461.137649] Code: ff 48 89 83 08 09 00 00 eb c6 66 0f 1f 84 00 00 00 00 00 55 48 c7 c7 98 7a 6c a5 c6 05 bc 0d 54 01 01 48 89 e5 e8 a9 84 fb ff <0f> 0b 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 83 7e 60 01 74 0a 48 3b [ 461.137673] RSP: 0018:a77e08cafc68 EFLAGS: 00010082 [ 461.137674] RAX: RBX: 8b3fc1702d80 RCX: 0006 [ 461.137674] RDX: 0007 RSI: 0096 RDI: 8b3fded164b0 [ 461.137675] RBP: a77e08cafc68 R08: 0026 R09: 0339 [ 461.137676] R10: 8b3fd060d410 R11: 0026 R12: a4e14e20 [ 461.137677] R13: 8b3fdec22940 R14: 8b3fc1702da0 R15: 8b3fdec22940 [ 461.137678] FS: 7efe43ee5700() GS:8b3fded0() knlGS: [ 461.137679] CS: 0010 DS: ES: CR0: 80050033 [ 461.137680] CR2: 7efe3010 CR3: 000301744003 CR4: 001606e0 [ 461.137680] Call Trace: [ 461.137684] push_dl_task.part.46+0x3bc/0x460 [ 461.137686] task_woken_dl+0x60/0x80 [ 461.137689] ttwu_do_wakeup+0x4f/0x150 [ 461.137690] ttwu_do_activate+0x77/0x80 [ 461.137692] try_to_wake_up+0x1d6/0x4c0 [ 461.137693] wake_up_q+0x32/0x70 [ 461.137696] do_futex+0x7e7/0xb50 [ 461.137698] __x64_sys_futex+0x8b/0x180 [ 461.137701] do_syscall_64+0x5a/0x110 [ 461.137703] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 461.137705] RIP: 0033:0x7efe4918ca26 [ 461.137705] Code: 00 00 00 74 17 49 8b 48 20 44 8b 59 10 41 83 e3 30 41 83 fb 20 74 1e be 85 00 00 00 41 ba 01 00 00 00 41 b9 01 00 00 04 0f 05 <48> 3d 01 f0 ff ff 73 1f 31 c0 c3 be 8c 00 00 00 49 89 c8 4d 31 d2 [ 461.137738] RSP: 002b:7efe43ee4928 EFLAGS: 0283 ORIG_RAX: 00ca [ 461.137739] RAX: ffda RBX: 05094df0 RCX: 7efe4918ca26 [ 461.137740] RDX: 0001 RSI: 0085 RDI: 05094e24 [ 461.137741] RBP: 7efe43ee49c0 R08: 05094e20 R09: 0401 [ 461.137741] R10: 0001 R11: 0283 R12: [ 461.137742] R13: 05094df8 R14: 0001 R15: 00448a10 [ 461.137743] ---[ end trace 187df4cad2bf7649 ]--- This warning happened in the push_dl_task(), because __add_running_bw()->cpufreq_update_util() is getting the rq_clock of the later_rq before its update, which takes place at activate_task(). The fix then is to update the rq_clock before calling add_running_bw(). To avoid double rq_clock_update() call, we set ENQUEUE_NOCLOCK flag to activate_task(). Changes: v1->v2: Remove part of the comment regarding the ENQUEUE_NOCLOCK usage (Kirill Tkhai). v0->v1: Cosmetic changes in the log, and correct Juri's email (Daniel). Reported-by: Daniel Casini Signed-off-by: Daniel Bristot de Oliveira Acked-by: Juri Lelli Cc: Clark Williams Cc: Juri Lelli Cc: Luca Abeni Cc: Tommaso Cucinotta Cc: Steven Rostedt Cc: Peter Zijlstra Cc: Ingo Molnar Cc: linux-kernel@vger.kernel.org Cc: # 4.16+ Fixes: e0367b12674b sched/deadline: Move CPU frequency selection triggering points --- kernel/sched/deadline.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index fbfc3f1d368a..8b50eea4b607 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2090,8 +2090,14 @@ static int push_dl_task(struct rq *rq) sub_rq_bw(&next_task->dl, &rq->dl); set_task_cpu(next_task, later_rq->cpu); add_rq_bw(&next_task->dl, &later_rq->dl); + + /* +* Update the later_rq clock here, because the clock is used +* by the cpufreq_update_util() inside __add_running_bw(). +*/ + update_rq_clock(later_rq); add_running_bw(&next_task->dl, &later_rq->dl); - activate_task(later_rq, next_task, 0); + activate_task(later_rq, next_task, ENQUEUE_NOCLOCK); ret = 1; resched_curr(later_rq); -- 2.17.1
Re: [PATCH] ASoC: wm9712: fix replace codec to component
Hi Kuninori On Fri, 2018-07-20 at 08:30 +, Kuninori Morimoto wrote: > Hi Marcel > > > From: Marcel Ziswiler > > > > Since commit 143b44845d87 ("ASoC: wm9712: replace codec to > > component") > > "wm9712-codec" got renamed to "wm9712-component", however, this > > change > > never got propagated down to the actual board/platform drivers. > > E.g. on > > Colibri T20 this lead to the following spew upon boot with > > sound/touch > > being broken: > > Oops, my bad... > The platform_driver name is not important, > how about simply rename back it to "wm9712-codec" ? Sure, that's your call. After all it was now broken for almost half a year (;-p). Should I cook that up as well or are you gona do it? > Best regards > --- > Kuninori Morimoto Cheers Marcel
Re: [PATCH 3/5] dmaengine: mv_xor_v2: convert callback to helper function
On 17-07-18, 13:30, han...@marvell.com wrote: > From: Hanna Hawa > > This is in preperation of moving to a callback that provides results to the typo preperation > callback for the transaction. The conversion will maintain current behavior > and the driver must convert to new callback mechanism at a later time in > order to receive results. > > Signed-off-by: Hanna Hawa > --- > drivers/dma/mv_xor_v2.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/dma/mv_xor_v2.c b/drivers/dma/mv_xor_v2.c > index e718498..14e2a7a 100644 > --- a/drivers/dma/mv_xor_v2.c > +++ b/drivers/dma/mv_xor_v2.c > @@ -589,9 +589,8 @@ static void mv_xor_v2_tasklet(unsigned long data) >*/ > dma_cookie_complete(&next_pending_sw_desc->async_tx); > > - if (next_pending_sw_desc->async_tx.callback) > - next_pending_sw_desc->async_tx.callback( > - next_pending_sw_desc->async_tx.callback_param); > + dmaengine_desc_get_callback_invoke( > + &next_pending_sw_desc->async_tx, NULL); > > dma_descriptor_unmap(&next_pending_sw_desc->async_tx); > } -- ~Vinod
Ihre Position
Sehr geehrte Damen und Herren, Nach der Analyse Ihrer Internetseite haben wir Fehler im Code ermittelt, die einen groβen Einfluss darauf haben, dass Ihre Webseite eine niedrige Position in den Suchmaschinen, darunter auch in der wichtigsten, d. h. auf Google, einnimmt. Wir bieten Ihnen die Optimierung Ihrer Webseite ohne Abonnement, ohne monatliche Gebühren, ohne versteckte Kosten und ohne Strafen für den Vertragsbruch an. Die Optimierung Ihrer Internetseite wird für die bessere Suchmaschinenfreundlichkeit sorgen und dadurch wird auch ihre Position im Google-Ranking und in anderen Suchmaschinen steigen. *** Aktionspreis: 240 € (inkl. MwSt.) - bis zum 20.07.2018 *** Mehr Informationen finden Sie auf unserer Internetseite: http://www.web-suchmaschinenoptimierung.net Mit freundlichen Grüßen Martin Schoch Web Analytics
Re: [PATCH 0/5] dmaengine: mv_xor_v2: fixes and alignment for XOR-v2 driver
On 17-07-18, 13:29, han...@marvell.com wrote: > From: Hanna Hawa > > This series bring some minor fixes & alignmnet to the driver of > Marvell XOR-v2 engine. Applied after fixing typo is 3rd patch, thanks -- ~Vinod
Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier
On Thu, Jul 19, 2018 at 09:45:47AM -0700, Andy Lutomirski wrote: > After some grepping, there are very few users. The > only nontrivial ones are the ones in kernel/ and mm/mmu_context.c that > are involved in the rather complicated dance of refcounting active_mm. Something like so should work I suppose. It keeps the field, but ensure that for all tasks tsk->active_mm == tsk->mm. The implication is that switch_mm(.prev == NULL) should work (it does for x86, we don't care about @prev). diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d84eafcf5e29..7bfd850c6bf7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2780,12 +2780,8 @@ static __always_inline struct rq * context_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next, struct rq_flags *rf) { - struct mm_struct *mm, *oldmm; - prepare_task_switch(rq, prev, next); - mm = next->mm; - oldmm = prev->active_mm; /* * For paravirt, this is coupled with an exit in switch_to to * combine the page table reload and the switch backend into @@ -2800,16 +2796,32 @@ context_switch(struct rq *rq, struct task_struct *prev, * membarrier after storing to rq->curr, before returning to * user-space. */ - if (!mm) { - next->active_mm = oldmm; - mmgrab(oldmm); - enter_lazy_tlb(oldmm, next); - } else - switch_mm_irqs_off(oldmm, mm, next); - - if (!prev->mm) { - prev->active_mm = NULL; - rq->prev_mm = oldmm; + + /* +* kernel -> kernel lazy + transfer active +* user -> kernel lazy + mmgrab() active +* +* kernel -> user switch + mmdrop() active +* user -> user switch +*/ + if (!next->mm) {// to kernel + enter_lazy_tlb(prev->active_mm, next); + +#ifdef ARCH_NO_ACTIVE_MM + next->active_mm = prev->active_mm; + if (prev->mm) // from user + mmgrab(prev->active_mm); +#endif + } else {// to user + switch_mm_irqs_off(prev->active_mm, next->mm, next); + +#ifdef ARCH_NO_ACTIVE_MM + if (!prev->mm) {// from kernel + /* will mmdrop() in finish_task_switch(). */ + rq->prev_mm = prev->active_mm; + prev->active_mm = NULL; + } +#endif } rq->clock_update_flags &= ~(RQCF_ACT_SKIP|RQCF_REQ_SKIP); diff --git a/mm/mmu_context.c b/mm/mmu_context.c index 3e612ae748e9..770bb615d115 100644 --- a/mm/mmu_context.c +++ b/mm/mmu_context.c @@ -12,6 +12,10 @@ #include +#ifndef finish_arch_post_lock_switch +# define finish_arch_post_lock_switch()do { } while (0) +#endif + /* * use_mm * Makes the calling kernel thread take on the specified @@ -33,12 +37,14 @@ void use_mm(struct mm_struct *mm) tsk->mm = mm; switch_mm(active_mm, mm, tsk); task_unlock(tsk); -#ifdef finish_arch_post_lock_switch finish_arch_post_lock_switch(); -#endif +#ifdef ARCH_NO_ACTIVE_MM + WARN_ON_ONCE(active_mm != NULL); +#else if (active_mm != mm) mmdrop(active_mm); +#endif } EXPORT_SYMBOL_GPL(use_mm); @@ -57,8 +63,22 @@ void unuse_mm(struct mm_struct *mm) task_lock(tsk); sync_mm_rss(mm); tsk->mm = NULL; + + WARN_ON_ONCE(tsk->active_mm != mm); + +#ifdef ARCH_NO_ACTIVE_MM + switch_mm(tsk->active_mm, &init_mm, tsk); + mmdrop(tsk->active_mm); + tsk->active_mm = NULL; +#else /* active_mm is still 'mm' */ enter_lazy_tlb(mm, tsk); +#endif + task_unlock(tsk); + +#ifdef ARCH_NO_ACTIVE_MM + finish_arch_post_lock_switch(); +#endif } EXPORT_SYMBOL_GPL(unuse_mm);
Re: [PATCH v3 1/7] mm, slab: combine kmalloc_caches and kmalloc_dma_caches
On 07/19/2018 10:10 AM, Mel Gorman wrote: > On Wed, Jul 18, 2018 at 03:36:14PM +0200, Vlastimil Babka wrote: >> The kmalloc caches currently mainain separate (optional) array >> kmalloc_dma_caches for __GFP_DMA allocations. There are tests for __GFP_DMA >> in >> the allocation hotpaths. We can avoid the branches by combining >> kmalloc_caches >> and kmalloc_dma_caches into a single two-dimensional array where the outer >> dimension is cache "type". This will also allow to add kmalloc-reclaimable >> caches as a third type. >> >> Signed-off-by: Vlastimil Babka > > I'm surprised there are so many kmalloc users that require the DMA zone. > Some of them are certainly bogus such as in drivers for archs that only > have one zone and is probably a reflection of the confusing naming. The > audit would be a mess and unrelated to the patch so for this patch; Yeah, there was a session about that on LSF/MM and Luis was working on it. One of the motivations was to get rid of the branch, so that's sidestepped by this patch. I would still like to not have slabinfo full of empty dma-kmalloc caches though :) > Acked-by: Mel Gorman >
Re: [PATCH v3 2/7] mm, slab/slub: introduce kmalloc-reclaimable caches
On 07/19/2018 10:23 AM, Mel Gorman wrote: >> /* >> diff --git a/mm/slab_common.c b/mm/slab_common.c >> index 4614248ca381..614fb7ab8312 100644 >> --- a/mm/slab_common.c >> +++ b/mm/slab_common.c >> @@ -1107,10 +1107,21 @@ void __init setup_kmalloc_cache_index_table(void) >> } >> } >> >> -static void __init new_kmalloc_cache(int idx, slab_flags_t flags) >> +static void __init >> +new_kmalloc_cache(int idx, int type, slab_flags_t flags) >> { >> -kmalloc_caches[KMALLOC_NORMAL][idx] = create_kmalloc_cache( >> -kmalloc_info[idx].name, >> +const char *name; >> + >> +if (type == KMALLOC_RECLAIM) { >> +flags |= SLAB_RECLAIM_ACCOUNT; >> +name = kasprintf(GFP_NOWAIT, "kmalloc-rcl-%u", >> +kmalloc_info[idx].size); >> +BUG_ON(!name); >> +} else { >> +name = kmalloc_info[idx].name; >> +} >> + >> +kmalloc_caches[type][idx] = create_kmalloc_cache(name, >> kmalloc_info[idx].size, flags, 0, >> kmalloc_info[idx].size); >> } > > I was going to query that BUG_ON but if I'm reading it right, we just > have to be careful in the future that the "normal" kmalloc cache is always > initialised before the reclaimable cache or there will be issues. Yeah, I was just copying how the dma-kmalloc code does it. >> @@ -1122,22 +1133,25 @@ static void __init new_kmalloc_cache(int idx, >> slab_flags_t flags) >> */ >> void __init create_kmalloc_caches(slab_flags_t flags) >> { >> -int i; >> -int type = KMALLOC_NORMAL; >> +int i, type; >> >> -for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { >> -if (!kmalloc_caches[type][i]) >> -new_kmalloc_cache(i, flags); >> +for (type = KMALLOC_NORMAL; type <= KMALLOC_RECLAIM; type++) { >> +for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { >> +if (!kmalloc_caches[type][i]) >> +new_kmalloc_cache(i, type, flags); >> > > I don't see a problem here as such but the values of the KMALLOC_* types > is important both for this function and the kmalloc_type(). It might be > worth adding a warning that these functions be examined if updating the > types but then again, anyone trying and getting it wrong will have a > broken kernel so; OK > Acked-by: Mel Gorman Thanks!
Re: [PATCH v3 2/7] mm, slab/slub: introduce kmalloc-reclaimable caches
On 07/19/2018 08:16 PM, Roman Gushchin wrote: >> is_dma = !!(flags & __GFP_DMA); >> #endif >> >> -return is_dma; >> +is_reclaimable = !!(flags & __GFP_RECLAIMABLE); >> + >> +/* >> + * If an allocation is botth __GFP_DMA and __GFP_RECLAIMABLE, return > ^^ > typo >> + * KMALLOC_DMA and effectively ignore __GFP_RECLAIMABLE >> + */ >> +return (is_dma * 2) + (is_reclaimable & !is_dma); > > Maybe > is_dma * KMALLOC_DMA + (is_reclaimable && !is_dma) * KMALLOC_RECLAIM > looks better? I think I meant to do that but forgot, thanks. >> } >> >> /* >> diff --git a/mm/slab_common.c b/mm/slab_common.c >> index 4614248ca381..614fb7ab8312 100644 >> --- a/mm/slab_common.c >> +++ b/mm/slab_common.c >> @@ -1107,10 +1107,21 @@ void __init setup_kmalloc_cache_index_table(void) >> } >> } >> >> -static void __init new_kmalloc_cache(int idx, slab_flags_t flags) >> +static void __init >> +new_kmalloc_cache(int idx, int type, slab_flags_t flags) >> { >> -kmalloc_caches[KMALLOC_NORMAL][idx] = create_kmalloc_cache( >> -kmalloc_info[idx].name, >> +const char *name; >> + >> +if (type == KMALLOC_RECLAIM) { >> +flags |= SLAB_RECLAIM_ACCOUNT; >> +name = kasprintf(GFP_NOWAIT, "kmalloc-rcl-%u", >> +kmalloc_info[idx].size); >> +BUG_ON(!name); > > I'd replace this with WARN_ON() and falling back to kmalloc_info[idx].name. It's basically a copy/paste of the dma-kmalloc code. If that triggers, it means somebody was changing the code and introduced a wrong order (as Mel said). A system that genuinely has no memory for that printf at this point, would not get very far anyway... >> +} else { >> +name = kmalloc_info[idx].name; >> +} >> + >> +kmalloc_caches[type][idx] = create_kmalloc_cache(name, >> kmalloc_info[idx].size, flags, 0, >> kmalloc_info[idx].size); >> }
Re: [PATCH v3 1/4] x86/boot: Add acpitb.h to help parse acpi tables
On Thu, Jul 19, 2018 at 05:19:43PM +0200, Thomas Gleixner wrote: >On Tue, 17 Jul 2018, Chao Fan wrote: > >> In order to parse ACPI tables, reuse the head file linux/acpi.h, >> so that the files in 'compressed' directory can read ACPI table >> by including this head file. >> >> Signed-off-by: Chao Fan >> --- >> arch/x86/boot/compressed/acpitb.h | 50 +++ >> 1 file changed, 50 insertions(+) >> create mode 100644 arch/x86/boot/compressed/acpitb.h >> >> diff --git a/arch/x86/boot/compressed/acpitb.h >> b/arch/x86/boot/compressed/acpitb.h >> new file mode 100644 >> index ..fd2bba23f447 >> --- /dev/null >> +++ b/arch/x86/boot/compressed/acpitb.h >> @@ -0,0 +1,50 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +#include >> + >> +#define ACPI_MAX_TABLES128 >> + >> +/* Function to get ACPI SRAT table pointer. */ >> +struct acpi_table_header *get_acpi_srat_table(void); >> + >> +#ifdef ACPI_BIG_ENDIAN >> + >> +#define ACPI_MOVE_64_TO_64(d, s) \ >> +{((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7]; \ >> +((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6]; \ >> +((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5]; \ >> +((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4]; \ >> +((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3]; \ >> +((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2]; \ >> +((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1]; \ >> +((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0]; } > >Whats wrong with be64_to_cpu() ? Hi tglx, Thanks for your review. ACPI_MOVE_64_TO_64 and ACPI_MOVE_16_TO_32 are copied from arch/x86/boot/compressed/acpitb.h cause I though copying the old code is reliable. I will delete these two definitions and only using le64_to_cpu and le16_to_cpu may be enough(since ACPI table is in little endian). And also add more comments in next version. Thanks, Chao Fan > >> + >> +#define ACPI_MOVE_16_TO_32(d, s) \ >> +{(*(u32 *)(void *)(d)) = 0; \ >> +((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1]; \ >> +((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0]; } > >Huch? > >> + >> +#else >> +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED >> + >> +#define ACPI_MOVE_64_TO_64(d, s) \ >> +{*(u64 *)(void *)(d) = *(u64 *)(void *)(s); } >> + >> +#define ACPI_MOVE_16_TO_32(d, s) \ >> +{*(u32 *)(void *)(d) = *(u16 *)(void *)(s); } >> + >> +#else >> +#define ACPI_MOVE_64_TO_64(d, s) \ >> +{((u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0]; \ >> +((u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1]; \ >> +((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2]; \ >> +((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3]; \ >> +((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4]; \ >> +((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5]; \ >> +((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6]; \ >> +((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7]; } > >And why doees this have to be done bytewise? Some comments would be >helpful. > >Thanks, > > tglx > >
Re: [PATCH v3 3/7] mm, slab: allocate off-slab freelists as reclaimable when appropriate
On 07/19/2018 10:35 AM, Mel Gorman wrote: > On Wed, Jul 18, 2018 at 03:36:16PM +0200, Vlastimil Babka wrote: >> In SLAB, OFF_SLAB caches allocate management structures (currently just the >> freelist) from kmalloc caches when placement in a slab page together with >> objects would lead to suboptimal memory usage. For SLAB_RECLAIM_ACCOUNT >> caches, >> we can allocate the freelists from the newly introduced reclaimable kmalloc >> caches, because shrinking the OFF_SLAB cache will in general result to >> freeing >> of the freelists as well. This should improve accounting and >> anti-fragmentation >> a bit. >> >> Signed-off-by: Vlastimil Babka > > I'm not quite convinced by this one. The freelist cache is tied to the > lifetime of the slab and not the objects. A single freelist can be reclaimed > eventually but for caches with many objects per slab, it could take a lot > of shrinking random objects to reclaim one freelist. Functionally the > patch appears to be fine. Hm you're right that the reclaimability of freelist is maybe too much detached, and could do more harm than good for the reclaimable caches. I will probably drop it unless I can measure it's an improvement. Thanks.
[PATCH 1/2] clk: meson: Add vid_pll divider driver
Add support the VID_PLL fully programmable divider used right after the HDMI PLL clock source. It is used to achieve complex fractional division with a programmble bitfield. Signed-off-by: Neil Armstrong --- drivers/clk/meson/Makefile | 2 +- drivers/clk/meson/clkc.h| 6 +++ drivers/clk/meson/vid-pll-div.c | 90 + 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/meson/vid-pll-div.c diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile index 72ec8c4..0234767 100644 --- a/drivers/clk/meson/Makefile +++ b/drivers/clk/meson/Makefile @@ -2,7 +2,7 @@ # Makefile for Meson specific clk # -obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o clk-phase.o +obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o clk-phase.o vid-pll-div.o obj-$(CONFIG_COMMON_CLK_AMLOGIC_AUDIO) += clk-triphase.o sclk-div.o obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o diff --git a/drivers/clk/meson/clkc.h b/drivers/clk/meson/clkc.h index 6b96d55..9166605 100644 --- a/drivers/clk/meson/clkc.h +++ b/drivers/clk/meson/clkc.h @@ -90,6 +90,11 @@ struct meson_clk_phase_data { int meson_clk_degrees_from_val(unsigned int val, unsigned int width); unsigned int meson_clk_degrees_to_val(int degrees, unsigned int width); +struct meson_vid_pll_div_data { + struct parm val; + struct parm sel; +}; + #define MESON_GATE(_name, _reg, _bit) \ struct clk_regmap _name = {\ .data = &(struct clk_regmap_gate_data){ \ @@ -112,5 +117,6 @@ extern const struct clk_ops meson_clk_cpu_ops; extern const struct clk_ops meson_clk_mpll_ro_ops; extern const struct clk_ops meson_clk_mpll_ops; extern const struct clk_ops meson_clk_phase_ops; +extern const struct clk_ops meson_vid_pll_div_ro_ops; #endif /* __CLKC_H */ diff --git a/drivers/clk/meson/vid-pll-div.c b/drivers/clk/meson/vid-pll-div.c new file mode 100644 index 000..5f267be --- /dev/null +++ b/drivers/clk/meson/vid-pll-div.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018 BayLibre, SAS. + * Author: Neil Armstrong + */ + +#include +#include "clkc.h" + +static inline struct meson_vid_pll_div_data * +meson_vid_pll_div_data(struct clk_regmap *clk) +{ + return (struct meson_vid_pll_div_data *)clk->data; +} + +/* + * This vid_pll divided is a fully programmable fractionnal divider to + * achieve complex video clock rates. + * + * Here are provided the commonly used fraction values provided by Amlogic. + */ + +struct vid_pll_div { + unsigned int shift_val; + unsigned int shift_sel; + unsigned int frac_top; + unsigned int frac_bot; +}; + +#define VID_PLL_DIV(_val, _sel, _ft, _fb) \ + { \ + .shift_val = (_val),\ + .shift_sel = (_sel),\ + .frac_top = (_ft), \ + .frac_bot = (_fb), \ + } + +static const struct vid_pll_div vid_pll_div_table[] = { + VID_PLL_DIV(0x0aaa, 0, 2, 1), /* 2/1 => /2 */ + VID_PLL_DIV(0x5294, 2, 5, 2), /* 5/2 => /2.5 */ + VID_PLL_DIV(0x0db6, 0, 3, 1), /* 3/1 => /3 */ + VID_PLL_DIV(0x36cc, 1, 7, 2), /* 7/2 => /3.5 */ + VID_PLL_DIV(0x, 2, 15, 4), /* 15/4 => /3.75 */ + VID_PLL_DIV(0x0ccc, 4, 4, 1), /* 4/1 => /4 */ + VID_PLL_DIV(0x739c, 2, 5, 1), /* 5/1 => /5 */ + VID_PLL_DIV(0x0e38, 0, 6, 1), /* 6/1 => /6 */ + VID_PLL_DIV(0x, 3, 25, 4), /* 25/4 => /6.25 */ + VID_PLL_DIV(0x3c78, 1, 7, 1), /* 7/1 => /7 */ + VID_PLL_DIV(0x78f0, 2, 15, 2), /* 15/2 => /7.5 */ + VID_PLL_DIV(0x0fc0, 0, 12, 1), /* 12/1 => /12 */ + VID_PLL_DIV(0x3f80, 1, 14, 1), /* 14/1 => /14 */ + VID_PLL_DIV(0x7f80, 2, 15, 1), /* 15/1 => /15 */ +}; + +#define to_meson_vid_pll_div(_hw) container_of(_hw, struct meson_vid_pll_div, hw) + +const struct vid_pll_div *_get_table_val(unsigned int shift_val, +unsigned int shift_sel) +{ + int i; + + for (i = 0 ; i < ARRAY_SIZE(vid_pll_div_table) ; ++i) { + if (vid_pll_div_table[i].shift_val == shift_val && + vid_pll_div_table[i].shift_sel == shift_sel) + return &vid_pll_div_table[i]; + } + + return NULL; +} + +static unsigned long meson_vid_pll_div_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct clk_regmap *clk = to_clk_regmap(hw); + struct meson_vid_pll_div_data *pll_div = meson_vid_pll_div_data(clk); + const struct v
[PATCH 0/2] clk: meson: Add video clocks path
This patchset adds initial support the Video Clocks used in the Display Pipelin from the DRM driver. The DRM driver is in his way to finaly switch to the Common Clock Framework to setup the clock path, this adds the clock entries that will be used by the DRM driver in a near future. The vid_pll programmable divider is introduced in its R/O form right now, but will be extended to be R/W in a next iteration. Until the DRM driver actually uses these clocks, the Gates are marked as IGNORE_IF_UNSUSED and the MUX/Dividers as NOCACHE since the registers will be modified directly. Neil Armstrong (2): clk: meson: Add vid_pll divider driver clk: meson-gxbb: Add video clocks drivers/clk/meson/Makefile| 2 +- drivers/clk/meson/clkc.h | 6 + drivers/clk/meson/gxbb.c | 667 ++ drivers/clk/meson/gxbb.h | 24 +- drivers/clk/meson/vid-pll-div.c | 90 + include/dt-bindings/clock/gxbb-clkc.h | 17 + 6 files changed, 803 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/meson/vid-pll-div.c -- 2.7.4
[PATCH 2/2] clk: meson-gxbb: Add video clocks
Add the clocks entries used in the video clock path, the clock path is doubled to permit having different synchronized clocks for different parts of the video pipeline. Signed-off-by: Neil Armstrong --- drivers/clk/meson/gxbb.c | 667 ++ drivers/clk/meson/gxbb.h | 24 +- include/dt-bindings/clock/gxbb-clkc.h | 17 + 3 files changed, 706 insertions(+), 2 deletions(-) diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index f79ea33..5fabedf 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -1508,6 +1508,570 @@ static struct clk_regmap gxbb_vapb = { }, }; +/* Video Clocks */ + +static struct clk_regmap gxbb_vid_pll_div = { + .data = &(struct meson_vid_pll_div_data){ + .val = { + .reg_off = HHI_VID_PLL_CLK_DIV, + .shift = 0, + .width = 15, + }, + .sel = { + .reg_off = HHI_VID_PLL_CLK_DIV, + .shift = 16, + .width = 2, + }, + }, + .hw.init = &(struct clk_init_data) { + .name = "vid_pll_div", + .ops = &meson_vid_pll_div_ro_ops, + .parent_names = (const char *[]){ "hdmi_pll" }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE, + }, +}; + +static u32 mux_table_vid_pll[] = { 0, 1 }; +const char *gxbb_vid_pll_parent_names[] = { "vid_pll_div", "hdmi_pll" }; + +static struct clk_regmap gxbb_vid_pll_sel = { + .data = &(struct clk_regmap_mux_data){ + .offset = HHI_VID_PLL_CLK_DIV, + .mask = 0x1, + .shift = 18, + .table = mux_table_vid_pll, + }, + .hw.init = &(struct clk_init_data){ + .name = "vid_pll_sel", + .ops = &clk_regmap_mux_ops, + /* +* bit 18 selects from 2 possible parents: +* vid_pll_div or hdmi_pll +*/ + .parent_names = gxbb_vid_pll_parent_names, + .num_parents = ARRAY_SIZE(gxbb_vid_pll_parent_names), + .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, + }, +}; + +static struct clk_regmap gxbb_vid_pll = { + .data = &(struct clk_regmap_gate_data){ + .offset = HHI_VID_PLL_CLK_DIV, + .bit_idx = 19, + }, + .hw.init = &(struct clk_init_data) { + .name = "vid_pll", + .ops = &clk_regmap_gate_ops, + .parent_names = (const char *[]){ "vid_pll_sel" }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, + }, +}; + +static u32 mux_table_vclk[] = { 0, 1, 2, 3, 4, 5, 6 }; +const char *gxbb_vclk_parent_names[] = { + "vid_pll", "fclk_div4", "fclk_div3", "fclk_div5", "vid_pll", + "fclk_div7", "mpll1", +}; + +static struct clk_regmap gxbb_vclk_sel = { + .data = &(struct clk_regmap_mux_data){ + .offset = HHI_VID_CLK_CNTL, + .mask = 0x7, + .shift = 16, + .table = mux_table_vclk, + }, + .hw.init = &(struct clk_init_data){ + .name = "vclk_sel", + .ops = &clk_regmap_mux_ops, + /* +* bits 16:18 selects from 8 possible parents: +* vid_pll, fclk_div4, fclk_div3, fclk_div5, +* vid_pll, fclk_div7, mp1 +*/ + .parent_names = gxbb_vclk_parent_names, + .num_parents = ARRAY_SIZE(gxbb_vclk_parent_names), + .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, + }, +}; + +static struct clk_regmap gxbb_vclk2_sel = { + .data = &(struct clk_regmap_mux_data){ + .offset = HHI_VIID_CLK_CNTL, + .mask = 0x7, + .shift = 16, + .table = mux_table_vclk, + }, + .hw.init = &(struct clk_init_data){ + .name = "vclk2_sel", + .ops = &clk_regmap_mux_ops, + /* +* bits 16:18 selects from 8 possible parents: +* vid_pll, fclk_div4, fclk_div3, fclk_div5, +* vid_pll, fclk_div7, mp1 +*/ + .parent_names = gxbb_vclk_parent_names, + .num_parents = ARRAY_SIZE(gxbb_vclk_parent_names), + .flags = CLK_SET_RATE_NO_REPARENT | CLK_GET_RATE_NOCACHE, + }, +}; + +static struct clk_regmap gxbb_vclk_input = { + .data = &(struct clk_regmap_gate_data){ + .offset = HHI_VID_CLK_DIV, + .bit_idx = 16, + }, + .hw.init = &(struct clk_init_data) { + .name = "vclk_input", + .ops = &clk_regmap_gate_ops, + .parent_names = (const char *[]){ "vclk_sel" }, + .num_
RE: [PATCH v2 2/3] dmaengine: imx-sdma: add memcpy interface
> -Original Message- > From: Sascha Hauer [mailto:s.ha...@pengutronix.de] > Sent: 2018年7月13日 14:16 > To: Robin Gong > Cc: vk...@kernel.org; dan.j.willi...@intel.com; shawn...@kernel.org; Fabio > Estevam ; li...@armlinux.org.uk; > linux-arm-ker...@lists.infradead.org; ker...@pengutronix.de; > dmaeng...@vger.kernel.org; linux-kernel@vger.kernel.org; dl-linux-imx > > Subject: Re: [PATCH v2 2/3] dmaengine: imx-sdma: add memcpy interface > > On Fri, Jul 13, 2018 at 09:08:46PM +0800, Robin Gong wrote: > > Add MEMCPY capability for imx-sdma driver. > > > > Signed-off-by: Robin Gong > > --- > > drivers/dma/imx-sdma.c | 95 > > -- > > 1 file changed, 92 insertions(+), 3 deletions(-) > > > > @@ -1318,6 +1347,63 @@ static struct sdma_desc > *sdma_transfer_init(struct sdma_channel *sdmac, > > return NULL; > > } > > > > +static struct dma_async_tx_descriptor *sdma_prep_memcpy( > > + struct dma_chan *chan, dma_addr_t dma_dst, > > + dma_addr_t dma_src, size_t len, unsigned long flags) { > > + struct sdma_channel *sdmac = to_sdma_chan(chan); > > + struct sdma_engine *sdma = sdmac->sdma; > > + int channel = sdmac->channel; > > + size_t count; > > + int i = 0, param; > > + struct sdma_buffer_descriptor *bd; > > + struct sdma_desc *desc; > > + > > + if (!chan || !len) > > + return NULL; > > + > > + dev_dbg(sdma->dev, "memcpy: %pad->%pad, len=%zu, channel=%d.\n", > > + &dma_src, &dma_dst, len, channel); > > + > > + desc = sdma_transfer_init(sdmac, DMA_MEM_TO_MEM, > > + len / SDMA_BD_MAX_CNT + 1); > > + if (!desc) > > + return NULL; > > + > > + do { > > + count = min_t(size_t, len, SDMA_BD_MAX_CNT); > > + bd = &desc->bd[i]; > > + bd->buffer_addr = dma_src; > > + bd->ext_buffer_addr = dma_dst; > > + bd->mode.count = count; > > + desc->chn_count += count; > > + /* align with sdma->dma_device.copy_align: 4bytes */ > > + bd->mode.command = 0; > > + > > + dma_src += count; > > + dma_dst += count; > > + len -= count; > > + i++; > > NACK. > > Please actually look at your code and find out where you do unaligned DMA > accesses. Hint: What happens when this loop body is executed more than > once? > > Sascha Actually internal sdma script has already take such 'align' matter like below: Burst with words if source/dest address and data length are all aligned with words, burst with Byte if not. So I will remove the comment '/* align with sdma->dma_device.copy_align: 4bytes */' In v3. Besides, I have found another bug which introduced by my virt-dma patch. Will send V3 later. > > > + > > + param = BD_DONE | BD_EXTD | BD_CONT; > > + /* last bd */ > > + if (!len) { > > + param |= BD_INTR; > > + param |= BD_LAST; > > + param &= ~BD_CONT; > > + } > > + > > + dev_dbg(sdma->dev, "entry %d: count: %zd dma: 0x%x %s%s\n", > > + i, count, bd->buffer_addr, > > + param & BD_WRAP ? "wrap" : "", > > + param & BD_INTR ? " intr" : ""); > > + > > + bd->mode.status = param; > > + } while (len); > > + > > -- > Pengutronix e.K. | > | > Industrial Linux Solutions | > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww. > pengutronix.de%2F&data=02%7C01%7Cyibin.gong%40nxp.com%7Cf78f9 > 91028e64b45cf7508d5e888310d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7 > C0%7C0%7C636670594003030732&sdata=zyDkLHVl4VneD05f4VvaY82m > ZITkybewrXyCj2YRu%2FI%3D&reserved=0 | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0| > Amtsgericht Hildesheim, HRA 2686 | Fax: > +49-5121-206917- |
Re: [PATCH v3 0/7] kmalloc-reclaimable caches
On 07/19/2018 09:53 PM, Roman Gushchin wrote: >> Vlastimil > Overall the patchset looks solid to me. > Please, feel free to add > Acked-by: Roman Gushchin Thanks! > Two small nits: > 1) The last patch is unrelated to the main idea, > and can potentially cause ABI breakage. Yes, that's why it's last. > I'd separate it from the rest of the patchset. It's not independent though because there would be conflicts. It has to be decided if it goes before of after the rest. Putting it last in the series makes the order clear and makes it possible to revert it in case it does break any users, without disrupting the rest of the series. > 2) It's actually re-opening the security issue for SLOB > users. Is the memory overhead really big enough to > justify that? I assume that anyone choosing SLOB has a tiny embedded device which runs only pre-flashed code, so that's less of an issue. If somebody can trigger the issue remotely, there are likely also other ways to exhaust the limited memory there? > Thanks!
[PATCH] livepatch: Validate module/old func name length
livepatch module author can pass module name/old function name with more than the defined character limit. With obj->name length greater than MODULE_NAME_LEN, the livepatch module gets loaded but waits forever on the module specified by obj->name to be loaded. It also populates a /sys directory with an untruncated object name. In the case of funcs->old_name length greater then KSYM_NAME_LEN, it would not match against any of the symbol table entries. Instead loop through the symbol table comparing them against a nonexisting function, which can be avoided. The same issues apply, to misspelled/incorrect names. At least gatekeep the modules with over the limit string length, by checking for their length during livepatch module registration. Signed-off-by: Kamalesh Babulal --- kernel/livepatch/core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 3a4656fb7047..5b77a7314e01 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -678,6 +678,9 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) if (!func->old_name || !func->new_func) return -EINVAL; + if (strlen(func->old_name) >= KSYM_NAME_LEN) + return -EINVAL; + INIT_LIST_HEAD(&func->stack_node); func->patched = false; func->transition = false; @@ -751,6 +754,9 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj) if (!obj->funcs) return -EINVAL; + if (klp_is_module(obj) && strlen(obj->name) >= MODULE_NAME_LEN) + return -EINVAL; + obj->patched = false; obj->mod = NULL; -- 2.7.4
Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier
On Fri, Jul 20, 2018 at 10:02:10AM +0200, Vitaly Kuznetsov wrote: > Andy Lutomirski writes: > > > [I added PeterZ and Vitaly -- can you see any way in which this would > > break something obscure? I don't.] > > Thanks for CCing me, > > I don't see how this can break things either. At first glance, however, > I'm afraid we can add performance penalty to virtualized guests which > don't use native_flush_tlb_others() (Hyper-V, KVM): we will be reloading > CR3 without a need as we don't look at lazy mode in PV tlb flush > functions. > > We can either check to switch_mm_irqs_off() that > native_flush_tlb_others() is in use or teach PV tlb flush functions to > look at lazy mode too. As Rik noted elsewhere in the thread, kvm_flush_tlb_others() ends up calling native_tlb_flush_others() for all running vcpu threads. The Hyper-V thing is magical, we can't really do anything about it there. Let them worry about it.
Re: [PATCH v3 2/6] KVM: X86: Implement PV IPIs in linux guest
2018-07-20 11:33+0800, Wanpeng Li: > On Fri, 20 Jul 2018 at 00:28, Radim Krčmář wrote: > > 2018-07-03 14:21+0800, Wanpeng Li: > > But because it is very similar to x2apic, I'd really need some real > > performance data to see if this benefits a real workload. > > Thanks for your review, Radim! :) I will find another real benchmark > instead of the micro one to evaluate the performance. Analyzing the cpu bitmap for every IPI request on a non-small guest (at least 32 VCPUs, ideally >256) during various workloads could also provide some insight regardless of workload/benchmark result -- we want to know how many VM exits we would save. > > > +static void kvm_send_ipi_all(int vector) > > > +{ > > > + __send_ipi_mask(cpu_online_mask, vector); > > > > These should be faster when using the native APIC shorthand -- is this > > the "Broadcast" in your tests? > > Not true, .send_IPI_all almost no callers though linux apic drivers > implement this hook, in addition, shortcut is not used for x2apic > mode(__x2apic_send_IPI_dest()), and very limited using in other > scenarios according to linux apic drivers. Good point, (xAPIC is using shorthands, so I didn't expect we'd stop doing so on x2APIC, but there was probably no need.) thanks.