Re: [PATCH 4/4] pci: export untrusted attribute in sysfs
On Mon, Jun 15, 2020 at 06:17:42PM -0700, Rajat Jain wrote: > This is needed to allow the userspace to determine when an untrusted > device has been added, and thus allowing it to bind the driver manually > to it, if it so wishes. This is being done as part of the approach > discussed at https://lkml.org/lkml/2020/6/9/1331 > > Signed-off-by: Rajat Jain > --- > drivers/pci/pci-sysfs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index 6d78df981d41a..574e9c613ba26 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -50,6 +50,7 @@ pci_config_attr(subsystem_device, "0x%04x\n"); > pci_config_attr(revision, "0x%02x\n"); > pci_config_attr(class, "0x%06x\n"); > pci_config_attr(irq, "%u\n"); > +pci_config_attr(untrusted, "%u\n"); > > static ssize_t broken_parity_status_show(struct device *dev, >struct device_attribute *attr, > @@ -608,6 +609,7 @@ static struct attribute *pci_dev_attrs[] = { > #endif > _attr_driver_override.attr, > _attr_ari_enabled.attr, > + _attr_untrusted.attr, > NULL, > }; You also need a Documentation/ABI/ update for this new file. thanks, greg k-h
Re: [PATCH v8 4/4] gpio: xilinx: Utilize for_each_set_clump macro
On Tue, Jun 16, 2020 at 1:39 AM kernel test robot wrote: > > Hi Syed, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on 444fc5cde64330661bf59944c43844e7d4c2ccd8] > > url: > https://github.com/0day-ci/linux/commits/Syed-Nayyar-Waris/Introduce-the-for_each_set_clump-macro/20200615-205729 > base:444fc5cde64330661bf59944c43844e7d4c2ccd8 > config: sparc64-randconfig-s032-20200615 (attached as .config) > compiler: sparc64-linux-gcc (GCC) 9.3.0 > reproduce: > # apt-get install sparse > # sparse version: v0.6.2-rc1-3-g55607964-dirty > # save the attached .config to linux build tree > make W=1 C=1 ARCH=sparc64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > > sparse warnings: (new ones prefixed by >>) > > >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type > >> unsigned long > >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type > >> unsigned long >include/linux/bitmap.h:594:63: sparse: sparse: shift too big (64) for type > unsigned long > >> include/linux/bitmap.h:639:45: sparse: sparse: shift too big (64) for type > >> unsigned long > >> include/linux/bitmap.h:638:17: sparse: sparse: invalid access past the end > >> of 'old' (8 8) > > vim +639 include/linux/bitmap.h > > 169c474fb22d8a William Breathitt Gray 2019-12-04 613 > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 614 /** > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 615 * bitmap_set_value - > set n-bit value within a memory region > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 616 * @map: address to > the bitmap memory region > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 617 * @value: value of > nbits > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 618 * @start: bit offset > of the n-bit value > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 619 * @nbits: size of > value in bits > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 620 */ > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 621 static inline void > bitmap_set_value(unsigned long *map, > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 622 > unsigned long value, > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 623 > unsigned long start, unsigned long nbits) > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 624 { > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 625 const size_t index = > BIT_WORD(start); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 626 const unsigned long > offset = start % BITS_PER_LONG; > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 627 const unsigned long > ceiling = roundup(start + 1, BITS_PER_LONG); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 628 const unsigned long > space = ceiling - start; > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 629 > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 630 value &= > GENMASK(nbits - 1, 0); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 631 > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 632 if (space >= nbits) { > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 633 map[index] &= > ~(GENMASK(nbits + offset - 1, offset)); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 634 map[index] |= > value << offset; > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 635 } else { > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 636 map[index] &= > ~BITMAP_FIRST_WORD_MASK(start); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 637 map[index] |= > value << offset; > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 @638 map[index + > 1] &= ~BITMAP_LAST_WORD_MASK(start + nbits); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 @639 map[index + > 1] |= (value >> space); > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 640 } > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 641 } > 803024b6c8a375 Syed Nayyar Waris 2020-06-15 642 Regarding the compilation warning reported above: "sparse: shift too big (64) for type unsigned long" at line 639 "sparse: invalid access past the end of 'old' (8 8)" at line 638 Kindly refer to the code above, at these line numbers. I am in the process of fixing this warning. But what would be the fix ? At the moment can't think of a code-fix to make the compilation warning disappear (specially at line 639). Can anyone please explain to me the meaning of the compilation warning more deeply? By the way, this warning was not reported in (earlier) v7 of the patchset. Regards Syed Nayyar Waris
[PATCH] usb: gadget: u_serial.h: increase MAX_U_SERIAL_PORTS to 8
Mediatek's LTE modem needs up to 8 ports to connect to PC for logging and debugging under some scenarios. Hence we suggest to increase the definition of MAX_U_SERIAL_PORTS to 8 for some complex embedded systems. Signed-off-by: Macpaul Lin --- drivers/usb/gadget/function/u_serial.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_serial.h b/drivers/usb/gadget/function/u_serial.h index e5b08ab..7d61113 100644 --- a/drivers/usb/gadget/function/u_serial.h +++ b/drivers/usb/gadget/function/u_serial.h @@ -12,7 +12,7 @@ #include #include -#define MAX_U_SERIAL_PORTS 4 +#define MAX_U_SERIAL_PORTS 8 struct f_serial_opts { struct usb_function_instance func_inst; -- 1.7.9.5
[PATCH] clk: Provide future parent in clk notification
Current clk notification handlers cannot know its new parent in PRE_RATE_CHANGE event. This patch simply adds parent clk to clk_notifier_data so the child clk is now able to know its future parent prior to reparenting. Change-Id: I099a784d5302a93951bdc6254d85f8df8c770462 Signed-off-by: Ikjoon Jang --- drivers/clk/clk.c | 30 +- include/linux/clk.h | 9 ++--- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 3f588ed06ce3..62c4e7b50ae5 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1458,6 +1458,7 @@ EXPORT_SYMBOL_GPL(clk_round_rate); /** * __clk_notify - call clk notifier chain * @core: clk that is changing rate + * @parent: new parent of core * @msg: clk notifier type (see include/linux/clk.h) * @old_rate: old clk rate * @new_rate: new clk rate @@ -1469,13 +1470,15 @@ EXPORT_SYMBOL_GPL(clk_round_rate); * called if all went well, or NOTIFY_STOP or NOTIFY_BAD immediately if * a driver returns that. */ -static int __clk_notify(struct clk_core *core, unsigned long msg, - unsigned long old_rate, unsigned long new_rate) +static int __clk_notify(struct clk_core *core, struct clk_core *parent, + unsigned long msg, unsigned long old_rate, + unsigned long new_rate) { struct clk_notifier *cn; struct clk_notifier_data cnd; int ret = NOTIFY_DONE; + cnd.parent = parent ? parent->hw->clk : NULL; cnd.old_rate = old_rate; cnd.new_rate = new_rate; @@ -1597,7 +1600,7 @@ static void __clk_recalc_rates(struct clk_core *core, unsigned long msg) * & ABORT_RATE_CHANGE notifiers */ if (core->notifier_count && msg) - __clk_notify(core, msg, old_rate, core->rate); + __clk_notify(core, core->parent, msg, old_rate, core->rate); hlist_for_each_entry(child, >children, child_node) __clk_recalc_rates(child, msg); @@ -1834,7 +1837,7 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent, /** * __clk_speculate_rates * @core: first clk in the subtree - * @parent_rate: the "future" rate of clk's parent + * @parent: the "future" parent of core * * Walks the subtree of clks starting with clk, speculating rates as it * goes and firing off PRE_RATE_CHANGE notifications as necessary. @@ -1846,7 +1849,7 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent, * take on the rate of its parent. */ static int __clk_speculate_rates(struct clk_core *core, -unsigned long parent_rate) +struct clk_core *parent) { struct clk_core *child; unsigned long new_rate; @@ -1854,11 +1857,12 @@ static int __clk_speculate_rates(struct clk_core *core, lockdep_assert_held(_lock); - new_rate = clk_recalc(core, parent_rate); + new_rate = clk_recalc(core, parent ? parent->rate : 0); /* abort rate change if a driver returns NOTIFY_BAD or NOTIFY_STOP */ if (core->notifier_count) - ret = __clk_notify(core, PRE_RATE_CHANGE, core->rate, new_rate); + ret = __clk_notify(core, parent, PRE_RATE_CHANGE, + core->rate, new_rate); if (ret & NOTIFY_STOP_MASK) { pr_debug("%s: clk notifier callback for clock %s aborted with error %d\n", @@ -1867,7 +1871,7 @@ static int __clk_speculate_rates(struct clk_core *core, } hlist_for_each_entry(child, >children, child_node) { - ret = __clk_speculate_rates(child, new_rate); + ret = __clk_speculate_rates(child, core); if (ret & NOTIFY_STOP_MASK) break; } @@ -1996,7 +2000,8 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core, return NULL; if (core->notifier_count) { - ret = __clk_notify(core, event, core->rate, core->new_rate); + ret = __clk_notify(core, core->parent, event, + core->rate, core->new_rate); if (ret & NOTIFY_STOP_MASK) fail_clk = core; } @@ -2098,7 +2103,8 @@ static void clk_change_rate(struct clk_core *core) clk_core_disable_unprepare(parent); if (core->notifier_count && old_rate != core->rate) - __clk_notify(core, POST_RATE_CHANGE, old_rate, core->rate); + __clk_notify(core, core->parent, POST_RATE_CHANGE, +old_rate, core->rate); if (core->flags & CLK_RECALC_NEW_RATES) (void)clk_calc_new_rates(core, core->new_rate); @@ -2479,7 +2485,6 @@ static int clk_core_set_parent_nolock(struct clk_core *core, { int ret = 0; int p_index = 0; - unsigned long p_rate = 0;
Re: [PATCH v4 02/11] fs: Move __scm_install_fd() to __fd_install_received()
On Tue, Jun 16, 2020 at 05:29:41AM +, Sargun Dhillon wrote: > On Mon, Jun 15, 2020 at 08:25:15PM -0700, Kees Cook wrote: > > +/** > > + * __fd_install_received() - Install received file into file descriptor > > table > > + * > > + * @fd: fd to install into (if negative, a new fd will be allocated) > > + * @file: struct file that was received from another process > > + * @ufd_required: true to use @ufd for writing fd number to userspace > > + * @ufd: __user pointer to write new fd number to > > + * @o_flags: the O_* flags to apply to the new fd entry > Probably doesn't matter, but this function doesn't take the fd, or > ufd_required > argument in this patch. > > > + * > > + * Installs a received file into the file descriptor table, with > > appropriate > > + * checks and count updates. Optionally writes the fd number to userspace. > ufd does not apppear options here. Argh, yes, thanks. I think this was a fixup targeting the wrong commit. I will adjust. -- Kees Cook
Re: [PATCH v2 13/24] dyndbg: combine flags & mask into a struct, use that
On Mon, Jun 15, 2020 at 9:14 AM Petr Mladek wrote: > > On Sat 2020-06-13 09:57:27, Jim Cromie wrote: > > combine flags & mask into a struct, and replace those 2 parameters in > > 3 functions: ddebug_change, ddebug_parse_flags, ddebug_read_flags, > > altering the derefs in them accordingly. > > > > This simplifies the 3 function sigs, preparing for more changes. > > We dont yet need mask from ddebug_read_flags, but will soon. > > --- > > lib/dynamic_debug.c | 46 +++-- > > 1 file changed, 24 insertions(+), 22 deletions(-) > > > > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c > > index 93c627e9c094..8dc073a6e8a4 100644 > > --- a/lib/dynamic_debug.c > > +++ b/lib/dynamic_debug.c > > @@ -62,6 +62,11 @@ struct ddebug_iter { > > unsigned int idx; > > }; > > > > +struct flagsettings { > > Please. use underscore to help with parsing such a long names. > I mean use: flags_settings. > ok > > + unsigned int flags; > > + unsigned int mask; > > +}; > > static int ddebug_change(const struct ddebug_query *query, > > - unsigned int pflags, unsigned int mask) > > + struct flagsettings *mods) > > > -static int ddebug_read_flags(const char *str, unsigned int *flags) > > +static int ddebug_read_flags(const char *str, struct flagsettings *f) > > > -static int ddebug_parse_flags(const char *str, unsigned int *flagsp, > > -unsigned int *maskp) > > +static int ddebug_parse_flags(const char *str, struct flagsettings *mods) > > What "mods" stands for, please? > modifying_flags, or modifiers. the original flags & mask bundled together ie the pfmlt in echo +pfmlt > control > I have to say that using a parameter called "mods" in a function > called parse_flags() is inconsistent and confusing. > does the above help ? I could go with modifying_flags keep in mind the name has to suit all + - = operations I'll review all the new names. I recall you didnt like filterflags either, so I wasnt sufficently clear there either. Im mulling a better explanation. > Best Regards, > Petr
[PATCH V2 2/2] dt-bindings: input: Convert imx keypad to json-schema
Convert the i.MX KEYPAD binding to DT schema format using json-schema Signed-off-by: Anson Huang --- Changes since V1: - include matrix-keymap.yaml and "linux,keymap" is unnecessary now, remove it. --- .../devicetree/bindings/input/imx-keypad.txt | 53 -- .../devicetree/bindings/input/imx-keypad.yaml | 85 ++ 2 files changed, 85 insertions(+), 53 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/imx-keypad.txt create mode 100644 Documentation/devicetree/bindings/input/imx-keypad.yaml diff --git a/Documentation/devicetree/bindings/input/imx-keypad.txt b/Documentation/devicetree/bindings/input/imx-keypad.txt deleted file mode 100644 index 2ebaf7d..000 --- a/Documentation/devicetree/bindings/input/imx-keypad.txt +++ /dev/null @@ -1,53 +0,0 @@ -* Freescale i.MX Keypad Port(KPP) device tree bindings - -The KPP is designed to interface with a keypad matrix with 2-point contact -or 3-point contact keys. The KPP is designed to simplify the software task -of scanning a keypad matrix. The KPP is capable of detecting, debouncing, -and decoding one or multiple keys pressed simultaneously on a keypad. - -Required SoC Specific Properties: -- compatible: Should be "fsl,-kpp". - -- reg: Physical base address of the KPP and length of memory mapped - region. - -- interrupts: The KPP interrupt number to the CPU(s). - -- clocks: The clock provided by the SoC to the KPP. Some SoCs use dummy -clock(The clock for the KPP is provided by the SoCs automatically). - -Required Board Specific Properties: -- pinctrl-names: The definition can be found at -pinctrl/pinctrl-bindings.txt. - -- pinctrl-0: The definition can be found at -pinctrl/pinctrl-bindings.txt. - -- linux,keymap: The definition can be found at -bindings/input/matrix-keymap.txt. - -Example: -kpp: kpp@73f94000 { - compatible = "fsl,imx51-kpp", "fsl,imx21-kpp"; - reg = <0x73f94000 0x4000>; - interrupts = <60>; - clocks = < 0>; - pinctrl-names = "default"; - pinctrl-0 = <_kpp_1>; - linux,keymap = <0x0067 /* KEY_UP */ - 0x0001006c /* KEY_DOWN */ - 0x00020072 /* KEY_VOLUMEDOWN */ - 0x00030066 /* KEY_HOME */ - 0x016a /* KEY_RIGHT */ - 0x01010069 /* KEY_LEFT */ - 0x0102001c /* KEY_ENTER */ - 0x01030073 /* KEY_VOLUMEUP */ - 0x0240 /* KEY_F6 */ - 0x02010042 /* KEY_F8 */ - 0x02020043 /* KEY_F9 */ - 0x02030044 /* KEY_F10 */ - 0x033b /* KEY_F1 */ - 0x0301003c /* KEY_F2 */ - 0x0302003d /* KEY_F3 */ - 0x03030074>;/* KEY_POWER */ -}; diff --git a/Documentation/devicetree/bindings/input/imx-keypad.yaml b/Documentation/devicetree/bindings/input/imx-keypad.yaml new file mode 100644 index 000..7432c6e --- /dev/null +++ b/Documentation/devicetree/bindings/input/imx-keypad.yaml @@ -0,0 +1,85 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/imx-keypad.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX Keypad Port(KPP) device tree bindings + +maintainers: + - Liu Ying + +allOf: + - $ref: "/schemas/input/matrix-keymap.yaml#" + +description: | + The KPP is designed to interface with a keypad matrix with 2-point contact + or 3-point contact keys. The KPP is designed to simplify the software task + of scanning a keypad matrix. The KPP is capable of detecting, debouncing, + and decoding one or multiple keys pressed simultaneously on a keypad. + +properties: + compatible: +oneOf: + - const: fsl,imx21-kpp + - items: + - enum: +- fsl,imx25-kpp +- fsl,imx27-kpp +- fsl,imx31-kpp +- fsl,imx35-kpp +- fsl,imx51-kpp +- fsl,imx53-kpp +- fsl,imx50-kpp +- fsl,imx6q-kpp +- fsl,imx6sx-kpp +- fsl,imx6sl-kpp +- fsl,imx6sll-kpp +- fsl,imx6ul-kpp +- fsl,imx7d-kpp + - const: fsl,imx21-kpp + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - linux,keymap + +unevaluatedProperties: false + +examples: + - | +keypad@73f94000 { +compatible = "fsl,imx51-kpp", "fsl,imx21-kpp"; +reg = <0x73f94000 0x4000>; +interrupts = <60>; +clocks = < 0>; +pinctrl-names = "default"; +pinctrl-0 = <_kpp_1>; +linux,keymap = <0x0067 /* KEY_UP */ +0x0001006c /* KEY_DOWN */ +
[PATCH V2 1/2] dt-bindings: input: Convert matrix-keymap to json-schema
Convert the matrix-keymap binding to DT schema format using json-schema Signed-off-by: Anson Huang --- New patch. --- .../devicetree/bindings/input/matrix-keymap.txt| 28 + .../devicetree/bindings/input/matrix-keymap.yaml | 46 ++ 2 files changed, 47 insertions(+), 27 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/matrix-keymap.yaml diff --git a/Documentation/devicetree/bindings/input/matrix-keymap.txt b/Documentation/devicetree/bindings/input/matrix-keymap.txt index c54919f..79f6d01 100644 --- a/Documentation/devicetree/bindings/input/matrix-keymap.txt +++ b/Documentation/devicetree/bindings/input/matrix-keymap.txt @@ -1,27 +1 @@ -A simple common binding for matrix-connected key boards. Currently targeted at -defining the keys in the scope of linux key codes since that is a stable and -standardized interface at this time. - -Required properties: -- linux,keymap: an array of packed 1-cell entries containing the equivalent - of row, column and linux key-code. The 32-bit big endian cell is packed - as: - row << 24 | column << 16 | key-code - -Optional properties: -Properties for the number of rows and columns are optional because some -drivers will use fixed values for these. -- keypad,num-rows: Number of row lines connected to the keypad controller. -- keypad,num-columns: Number of column lines connected to the keypad - controller. - -Some users of this binding might choose to specify secondary keymaps for -cases where there is a modifier key such as a Fn key. Proposed names -for said properties are "linux,fn-keymap" or with another descriptive -word for the modifier other from "Fn". - -Example: - linux,keymap = < 0x00030012 -0x0102003a >; - keypad,num-rows = <2>; - keypad,num-columns = <8>; +This file has been moved to matrix-keymap.yaml diff --git a/Documentation/devicetree/bindings/input/matrix-keymap.yaml b/Documentation/devicetree/bindings/input/matrix-keymap.yaml new file mode 100644 index 000..c3bf091 --- /dev/null +++ b/Documentation/devicetree/bindings/input/matrix-keymap.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/matrix-keymap.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common key matrices binding for matrix-connected key boards + +maintainers: + - Olof Johansson + +description: | + A simple common binding for matrix-connected key boards. Currently targeted at + defining the keys in the scope of linux key codes since that is a stable and + standardized interface at this time. + + Some users of this binding might choose to specify secondary keymaps for + cases where there is a modifier key such as a Fn key. Proposed names + for said properties are "linux,fn-keymap" or with another descriptive + word for the modifier other from "Fn". + +properties: + linux,keymap: +$ref: '/schemas/types.yaml#/definitions/uint32-array' +description: | + An array of packed 1-cell entries containing the equivalent of row, + column and linux key-code. The 32-bit big endian cell is packed as: + row << 24 | column << 16 | key-code + + keypad,num-rows: +$ref: /schemas/types.yaml#/definitions/uint32 +description: Number of row lines connected to the keypad controller. + + keypad,num-columns: +$ref: /schemas/types.yaml#/definitions/uint32 +description: Number of column lines connected to the keypad controller. + +examples: + - | +keypad { +/* ... */ +linux,keymap = < 0x00030012 + 0x0102003a >; +keypad,num-rows = <2>; +keypad,num-columns = <8>; +}; -- 2.7.4
Re: [PATCH] staging: android: ashmem.c: Cleanup
Hi Dio, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on staging/staging-testing] [cannot apply to aa5af974127d317071d6225a0f3678c5f520e7ce] url: https://github.com/0day-ci/linux/commits/Dio-Putra/staging-android-ashmem-c-Cleanup/20200614-013821 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git af7b4801030c07637840191c69eb666917e4135d :: branch date: 3 hours ago :: commit date: 3 hours ago config: i386-randconfig-s002-20200614 (attached as .config) compiler: gcc-9 (Debian 9.3.0-13) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.1-250-g42323db3-dirty # save the attached .config to linux build tree make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> drivers/staging/android/ashmem.c:418:25: sparse: sparse: assignment to const >> expression drivers/staging/android/ashmem.c:419:36: sparse: sparse: assignment to const expression drivers/staging/android/ashmem.c:420:36: sparse: sparse: assignment to const expression # https://github.com/0day-ci/linux/commit/7fe32ab69ec805d9e6b68fc7871f9de384429a48 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 7fe32ab69ec805d9e6b68fc7871f9de384429a48 vim +418 drivers/staging/android/ashmem.c 6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 367 11980c2ac4ccfa Robert Love2011-12-20 368 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) 11980c2ac4ccfa Robert Love2011-12-20 369 { 7fe32ab69ec805 Dio Putra 2020-06-14 370 static const struct file_operations vmfile_fops; 11980c2ac4ccfa Robert Love2011-12-20 371 struct ashmem_area *asma = file->private_data; 11980c2ac4ccfa Robert Love2011-12-20 372 int ret = 0; 11980c2ac4ccfa Robert Love2011-12-20 373 11980c2ac4ccfa Robert Love2011-12-20 374 mutex_lock(_mutex); 11980c2ac4ccfa Robert Love2011-12-20 375 11980c2ac4ccfa Robert Love2011-12-20 376 /* user needs to SET_SIZE before mapping */ 59848d6aded59a Alistair Strachan 2018-06-19 377 if (!asma->size) { 11980c2ac4ccfa Robert Love2011-12-20 378 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 379 goto out; 11980c2ac4ccfa Robert Love2011-12-20 380 } 11980c2ac4ccfa Robert Love2011-12-20 381 8632c614565d0c Alistair Strachan 2018-06-19 382 /* requested mapping size larger than object size */ 8632c614565d0c Alistair Strachan 2018-06-19 383 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) { 11980c2ac4ccfa Robert Love2011-12-20 384 ret = -EINVAL; 11980c2ac4ccfa Robert Love2011-12-20 385 goto out; 11980c2ac4ccfa Robert Love2011-12-20 386 } 11980c2ac4ccfa Robert Love2011-12-20 387 11980c2ac4ccfa Robert Love2011-12-20 388 /* requested protection bits must match our allowed protection mask */ 59848d6aded59a Alistair Strachan 2018-06-19 389 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) & 59848d6aded59a Alistair Strachan 2018-06-19 390 calc_vm_prot_bits(PROT_MASK, 0)) { 11980c2ac4ccfa Robert Love2011-12-20 391 ret = -EPERM; 11980c2ac4ccfa Robert Love2011-12-20 392 goto out; 11980c2ac4ccfa Robert Love2011-12-20 393 } 56f76fc68492af Arve Hjønnevåg 2011-12-20 394 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask); 11980c2ac4ccfa Robert Love2011-12-20 395 11980c2ac4ccfa Robert Love2011-12-20 396 if (!asma->file) { 11980c2ac4ccfa Robert Love2011-12-20 397 char *name = ASHMEM_NAME_DEF; 11980c2ac4ccfa Robert Love2011-12-20 398 struct file *vmfile; 11980c2ac4ccfa Robert Love2011-12-20 399 11980c2ac4ccfa Robert Love2011-12-20 400 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0') 11980c2ac4ccfa Robert Love2011-12-20 401 name = asma->name; 11980c2ac4ccfa Robert Love2011-12-20 402 11980c2ac4ccfa Robert Love2011-12-20 403 /* ... and allocate the backing shmem file */ 11980c2ac4ccfa Robert Love2011-12-20 404 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags); 7f44cb0ba88b40 Viresh Kumar 2015-07-31 405 if (IS_ERR(vmfile)) { 11980c2ac4ccfa Robert Love2011-12-20 406 ret = PTR_ERR(vmfile); 11980c2ac4ccfa Robert Love2011-12-20 407 goto out; 11980c2ac4ccfa Robert Love2011-12-20 408 } 97fbfef6bd5978 Shuxiao Zhang
arch/mips/kvm/mips.c:70:25: error: 'struct kvm_vcpu_stat' has no member named 'vz_cpucfg_exits'; did you mean
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: df2fbf5bfa0e7fff8b4784507e4d68f200454318 commit: 7f2a83f1c2a941ebfee53f504ed5fdbc61cfb333 KVM: MIPS: Add CPUCFG emulation for Loongson-3 date: 9 days ago :: branch date: 16 hours ago :: commit date: 9 days ago config: mips-randconfig-c022-20200613 (attached as .config) compiler: mipsel-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>, old ones prefixed by <<): In file included from : >> arch/mips/kvm/mips.c:70:25: error: 'struct kvm_vcpu_stat' has no member >> named 'vz_cpucfg_exits'; did you mean 'vz_gpsi_exits'? 70 | VCPU_STAT("vz_cpucfg", vz_cpucfg_exits), | ^~~ include/linux/compiler_types.h:133:57: note: in definition of macro '__compiler_offsetof' 133 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^ >> include/linux/kvm_host.h:1142:7: note: in expansion of macro 'offsetof' 1142 | { n, offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## __VA_ARGS__ } | ^~~~ >> arch/mips/kvm/mips.c:70:2: note: in expansion of macro 'VCPU_STAT' 70 | VCPU_STAT("vz_cpucfg", vz_cpucfg_exits), | ^ arch/mips/kvm/mips.c:161:6: warning: no previous prototype for 'kvm_mips_free_vcpus' [-Wmissing-prototypes] 161 | void kvm_mips_free_vcpus(struct kvm *kvm) | ^~~ -- >> arch/mips/kvm/vz.c:32:10: fatal error: loongson_regs.h: No such file or >> directory 32 | #include "loongson_regs.h" | ^ compilation terminated. # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7f2a83f1c2a941ebfee53f504ed5fdbc61cfb333 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git remote update linus git checkout 7f2a83f1c2a941ebfee53f504ed5fdbc61cfb333 vim +70 arch/mips/kvm/mips.c 669e846e6c4e13 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 41 669e846e6c4e13 arch/mips/kvm/kvm_mips.c Sanjay Lal 2012-11-21 42 struct kvm_stats_debugfs_item debugfs_entries[] = { 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 43 VCPU_STAT("wait", wait_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 44 VCPU_STAT("cache", cache_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 45 VCPU_STAT("signal", signal_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 46 VCPU_STAT("interrupt", int_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 47 VCPU_STAT("cop_unusable", cop_unusable_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 48 VCPU_STAT("tlbmod", tlbmod_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 49 VCPU_STAT("tlbmiss_ld", tlbmiss_ld_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 50 VCPU_STAT("tlbmiss_st", tlbmiss_st_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 51 VCPU_STAT("addrerr_st", addrerr_st_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 52 VCPU_STAT("addrerr_ld", addrerr_ld_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 53 VCPU_STAT("syscall", syscall_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 54 VCPU_STAT("resvd_inst", resvd_inst_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 55 VCPU_STAT("break_inst", break_inst_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 56 VCPU_STAT("trap_inst", trap_inst_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 57 VCPU_STAT("msa_fpe", msa_fpe_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 58 VCPU_STAT("fpe", fpe_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 59 VCPU_STAT("msa_disabled", msa_disabled_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 60 VCPU_STAT("flush_dcache", flush_dcache_exits), a7244920d1096c arch/mips/kvm/mips.c James Hogan2017-03-14 61 #ifdef CONFIG_KVM_MIPS_VZ 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 62 VCPU_STAT("vz_gpsi", vz_gpsi_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito 2020-04-14 63 VCPU_STAT("vz_gsfc", vz_gsfc_exits), 812756a82ea51e arch/mips/kvm/mips.c Emanuele Giuseppe Esposito
[PATCH v2] exfat: call sync_filesystem for read-only remount
We need to commit dirty metadata and pages to disk before remounting exfat as read-only. This fixes a failure in xfstests generic/452 generic/452 does the following: cp something / mount -o remount,ro the /something is corrupted. because while exfat is remounted as read-only, exfat doesn't have a chance to commit metadata and vfs invalidates page caches in a block device. Signed-off-by: Hyunchul Lee --- Changes from v1: - Does not check the return value of sync_filesystem to allow to change from "rw" to "ro" even when this function fails. - Add the detailed explanation why generic/452 fails fs/exfat/super.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/fs/exfat/super.c b/fs/exfat/super.c index e650e65536f8..253a92460d52 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -693,10 +693,20 @@ static void exfat_free(struct fs_context *fc) } } +static int exfat_reconfigure(struct fs_context *fc) +{ + fc->sb_flags |= SB_NODIRATIME; + + /* volume flag will be updated in exfat_sync_fs */ + sync_filesystem(fc->root->d_sb); + return 0; +} + static const struct fs_context_operations exfat_context_ops = { .parse_param= exfat_parse_param, .get_tree = exfat_get_tree, .free = exfat_free, + .reconfigure= exfat_reconfigure, }; static int exfat_init_fs_context(struct fs_context *fc) -- 2.17.1
Re: [PATCH] ovl: inode reference leak in ovl_is_inuse true case.
Hi youngjun! Thank you for your patch. You asked for guidance about posting patch revisions so let me repeat my comment in a more clear way (see below). On Tue, Jun 16, 2020 at 7:46 AM youngjun wrote: > When posting a revision of a patch already posted, the practice is to use the subject prefix [PATCH v2]. This will be auto generated for you with -v option for git format-patch. Also, it is not valuable to CC LKML on patches with such a narrow scope. The only relevant CC for this patch is the overlayfs list, overlayfs maintainer and developers that reviewed v1 (me in that case). > When "ovl_is_inuse" true case, trap inode reference not put. > plus adding the comment explaining sequence of > ovl_is_inuse after ovl_setup_trap. > Please add these lines to the bottom of commit message: (They help the stable tree maintainers know that patch should be picked up and to which stable tree) Fixes: 0be0bfd2de9d ("ovl: fix regression caused by overlapping layers..") Cc: # v4.19+ Reviewed-by: Amir Goldstein > Signed-off-by: youngjun > --- > fs/overlayfs/super.c | 10 +- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > index 91476bc422f9..0396793dadb8 100644 > --- a/fs/overlayfs/super.c > +++ b/fs/overlayfs/super.c > @@ -1029,6 +1029,12 @@ static const struct xattr_handler > *ovl_xattr_handlers[] = { > NULL > }; > > +/* > + * Check if lower root conflicts with this overlay layers before checking > + * if it is in-use as upperdir/workdir of "another" mount, because we do > + * not bother to check in ovl_is_inuse() if the upperdir/workdir is in fact > + * in-use by our upperdir/workdir. > + */ Sorry for not being clear about this comment. I meant it should come before the call to ovl_setup_trap() in ovl_get_layers(). It is not true in general that we always call ovl_setup_trap() before ovl_is_inuse(). It is only true and relevant for checking lower layers. If anything I wrote is not clear, do not hesitate to ask for more clarification. Thanks, Amir.
[PATCH] USB: Serial: cypress_M8: Enable Simply Automated UPB PIM
This is UPB(Universal Powerline Bus) PIM(Powerline Interface Module) which allows for controlling multiple UPB comaptible devices from Linux. This device internally uses a Cypress HID->COM interface. Signed-off-by: James Hilliard --- drivers/usb/serial/cypress_m8.c | 2 ++ drivers/usb/serial/cypress_m8.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 216edd5826ca..ecda82198798 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -59,6 +59,7 @@ static const struct usb_device_id id_table_earthmate[] = { static const struct usb_device_id id_table_cyphidcomrs232[] = { { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, + { USB_DEVICE(VENDOR_ID_SAI, PRODUCT_ID_CYPHIDCOM) }, { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, { } /* Terminating entry */ @@ -73,6 +74,7 @@ static const struct usb_device_id id_table_combined[] = { { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, + { USB_DEVICE(VENDOR_ID_SAI, PRODUCT_ID_CYPHIDCOM) }, { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h index 35e223751c0e..ca2d951ee238 100644 --- a/drivers/usb/serial/cypress_m8.h +++ b/drivers/usb/serial/cypress_m8.h @@ -25,6 +25,9 @@ #define VENDOR_ID_CYPRESS 0x04b4 #define PRODUCT_ID_CYPHIDCOM 0x5500 +/* Simply Automated HID->COM UPB PIM */ +#define VENDOR_ID_SAI 0x17dd + /* FRWD Dongle - a GPS sports watch */ #define VENDOR_ID_FRWD 0x6737 #define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001 -- 2.25.1
Re: [PATCH v4 02/11] fs: Move __scm_install_fd() to __fd_install_received()
On Mon, Jun 15, 2020 at 08:25:15PM -0700, Kees Cook wrote: > In preparation for users of the "install a received file" logic outside > of net/ (pidfd and seccomp), relocate and rename __scm_install_fd() from > net/core/scm.c to __fd_install_received() in fs/file.c, and provide a > wrapper named fd_install_received_user(), as future patches will change > the interface to __fd_install_received(). > > Signed-off-by: Kees Cook > --- > fs/file.c| 47 > include/linux/file.h | 8 > include/net/scm.h| 1 - > net/compat.c | 2 +- > net/core/scm.c | 32 +- > 5 files changed, 57 insertions(+), 33 deletions(-) > > diff --git a/fs/file.c b/fs/file.c > index abb8b7081d7a..fcfddae0d252 100644 > --- a/fs/file.c > +++ b/fs/file.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -18,6 +19,8 @@ > #include > #include > #include > +#include > +#include > > unsigned int sysctl_nr_open __read_mostly = 1024*1024; > unsigned int sysctl_nr_open_min = BITS_PER_LONG; > @@ -931,6 +934,50 @@ int replace_fd(unsigned fd, struct file *file, unsigned > flags) > return err; > } > > +/** > + * __fd_install_received() - Install received file into file descriptor table > + * > + * @fd: fd to install into (if negative, a new fd will be allocated) > + * @file: struct file that was received from another process > + * @ufd_required: true to use @ufd for writing fd number to userspace > + * @ufd: __user pointer to write new fd number to > + * @o_flags: the O_* flags to apply to the new fd entry Probably doesn't matter, but this function doesn't take the fd, or ufd_required argument in this patch. > + * > + * Installs a received file into the file descriptor table, with appropriate > + * checks and count updates. Optionally writes the fd number to userspace. ufd does not apppear options here. > + * > + * Returns -ve on error. > + */ > +int __fd_install_received(struct file *file, int __user *ufd, unsigned int > o_flags) > +{ > + struct socket *sock; > + int new_fd; > + int error; > + > + error = security_file_receive(file); > + if (error) > + return error; > + > + new_fd = get_unused_fd_flags(o_flags); > + if (new_fd < 0) > + return new_fd; > + > + error = put_user(new_fd, ufd); > + if (error) { > + put_unused_fd(new_fd); > + return error; > + } > + > + /* Bump the usage count and install the file. */ > + sock = sock_from_file(file, ); > + if (sock) { > + sock_update_netprioidx(>sk->sk_cgrp_data); > + sock_update_classid(>sk->sk_cgrp_data); > + } > + fd_install(new_fd, get_file(file)); > + return 0; > +} > + > static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags) > { > int err = -EBADF; > diff --git a/include/linux/file.h b/include/linux/file.h > index 122f80084a3e..fe18a1a0d555 100644 > --- a/include/linux/file.h > +++ b/include/linux/file.h > @@ -91,6 +91,14 @@ extern void put_unused_fd(unsigned int fd); > > extern void fd_install(unsigned int fd, struct file *file); > > +extern int __fd_install_received(struct file *file, int __user *ufd, > + unsigned int o_flags); > +static inline int fd_install_received_user(struct file *file, int __user > *ufd, > +unsigned int o_flags) > +{ > + return __fd_install_received(file, ufd, o_flags); > +} > + > extern void flush_delayed_fput(void); > extern void __fput_sync(struct file *); > > diff --git a/include/net/scm.h b/include/net/scm.h > index 581a94d6c613..1ce365f4c256 100644 > --- a/include/net/scm.h > +++ b/include/net/scm.h > @@ -37,7 +37,6 @@ struct scm_cookie { > #endif > }; > > -int __scm_install_fd(struct file *file, int __user *ufd, unsigned int > o_flags); > void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); > void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); > int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie > *scm); > diff --git a/net/compat.c b/net/compat.c > index 27d477fdcaa0..94f288e8dac5 100644 > --- a/net/compat.c > +++ b/net/compat.c > @@ -298,7 +298,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct > scm_cookie *scm) > int err = 0, i; > > for (i = 0; i < fdmax; i++) { > - err = __scm_install_fd(scm->fp->fp[i], cmsg_data + i, o_flags); > + err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, > o_flags); > if (err) > break; > } > diff --git a/net/core/scm.c b/net/core/scm.c > index 6151678c73ed..df190f1fdd28 100644 > --- a/net/core/scm.c > +++ b/net/core/scm.c > @@ -280,36 +280,6 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, > struct scm_timestamping_inter > } >
Re: [PATCH] mm/pgtable: Move extern zero_pfn outside __HAVE_COLOR_ZERO_PAGE
On 06/16/2020 09:38 AM, Anshuman Khandual wrote: > zero_pfn variable is required whether __HAVE_COLOR_ZERO_PAGE is enabled > or not. Also it should not really be declared individually in all functions > where it gets used. Just move the declaration outside, which also makes it > available for other potential users. > > Cc: Arnd Bergmann > Cc: linux-a...@vger.kernel.org > Cc: linux...@kvack.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > Applies on 5.8-rc1. If the earlier motivation was to hide zero_pfn from > general visibility, we could just put in a comment and update the commit > message that my_zero_pfn() should always be used rather than zero_pfn. > Build tested on many platforms and boot tested on arm64, x86. > > include/linux/pgtable.h | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index 32b6c52d41b9..078e9864abca 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -1020,10 +1020,11 @@ extern void untrack_pfn(struct vm_area_struct *vma, > unsigned long pfn, > extern void untrack_pfn_moved(struct vm_area_struct *vma); > #endif > > +extern unsigned long zero_pfn; > + > #ifdef __HAVE_COLOR_ZERO_PAGE > static inline int is_zero_pfn(unsigned long pfn) > { > - extern unsigned long zero_pfn; > unsigned long offset_from_zero_pfn = pfn - zero_pfn; > return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT); > } > @@ -1033,13 +1034,11 @@ static inline int is_zero_pfn(unsigned long pfn) > #else > static inline int is_zero_pfn(unsigned long pfn) > { > - extern unsigned long zero_pfn; > return pfn == zero_pfn; > } > > static inline unsigned long my_zero_pfn(unsigned long addr) > { > - extern unsigned long zero_pfn; > return zero_pfn; > } > #endif > The CC list is incomplete. Adding Andrew, Mike and Kirill. +Cc: Andrew Morton +Cc: Mike Rapoport +Cc: Kirill A . Shutemov Will update the CC list next time around. - Anshuman
Re: [PATCH v3] ASoC: fsl_ssi: Fix bclk calculation for mono channel
On Tue, Jun 16, 2020 at 10:53:48AM +0800, Shengjiu Wang wrote: > For mono channel, SSI will switch to Normal mode. > > In Normal mode and Network mode, the Word Length Control bits > control the word length divider in clock generator, which is > different with I2S Master mode (the word length is fixed to > 32bit), it should be the value of params_width(hw_params). > > The condition "slots == 2" is not good for I2S Master mode, > because for Network mode and Normal mode, the slots can also > be 2. Then we need to use (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) > to check if it is I2S Master mode. > > So we refine the formula for mono channel, otherwise there > will be sound issue for S24_LE. > > Fixes: b0a7043d5c2c ("ASoC: fsl_ssi: Caculate bit clock rate using slot > number and width") > Signed-off-by: Shengjiu Wang Reviewed-by: Nicolin Chen
drivers/pci/controller/pci-mvebu.c:368:17: sparse: sparse: restricted __le16 degrades to integer
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f82e7b57b5fc48199e2f26ffafe2f96f7338ad3d commit: e0d9d30b73548fbfe5c024ed630169bdc9a08aee PCI: pci-bridge-emul: Fix big-endian support date: 8 months ago :: branch date: 2 hours ago :: commit date: 8 months ago config: arm-randconfig-s032-20200613 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.1-250-g42323db3-dirty git checkout e0d9d30b73548fbfe5c024ed630169bdc9a08aee # save the attached .config to linux build tree make W=1 C=1 ARCH=arm CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> drivers/pci/controller/pci-mvebu.c:368:17: sparse: sparse: restricted __le16 >> degrades to integer drivers/pci/controller/pci-mvebu.c:368:38: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:369:19: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:389:30: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:392:31: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:406:17: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:406:34: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:407:19: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:419:30: sparse: sparse: restricted __le16 degrades to integer drivers/pci/controller/pci-mvebu.c:420:31: sparse: sparse: restricted __le16 degrades to integer >> drivers/pci/controller/pci-mvebu.c:483:39: sparse: sparse: invalid >> assignment: &= >> drivers/pci/controller/pci-mvebu.c:483:39: sparse:left side has type >> restricted __le16 >> drivers/pci/controller/pci-mvebu.c:483:39: sparse:right side has type int drivers/pci/controller/pci-mvebu.c:557:28: sparse: sparse: symbol 'mvebu_pci_bridge_emul_ops' was not declared. Should it be static? >> drivers/pci/controller/pci-mvebu.c:571:29: sparse: sparse: incorrect type in >> assignment (different base types) @@ expected restricted __le16 >> [usertype] vendor @@ got int @@ >> drivers/pci/controller/pci-mvebu.c:571:29: sparse: expected restricted >> __le16 [usertype] vendor >> drivers/pci/controller/pci-mvebu.c:571:29: sparse: got int >> drivers/pci/controller/pci-mvebu.c:572:29: sparse: sparse: incorrect type in >> assignment (different base types) @@ expected restricted __le16 >> [usertype] device @@ got unsigned int @@ >> drivers/pci/controller/pci-mvebu.c:572:29: sparse: expected restricted >> __le16 [usertype] device >> drivers/pci/controller/pci-mvebu.c:572:29: sparse: got unsigned int >> drivers/pci/controller/pci-mvebu.c:573:37: sparse: sparse: incorrect type in >> assignment (different base types) @@ expected restricted __le32 >> [usertype] class_revision @@ got unsigned int @@ >> drivers/pci/controller/pci-mvebu.c:573:37: sparse: expected restricted >> __le32 [usertype] class_revision drivers/pci/controller/pci-mvebu.c:573:37: sparse: got unsigned int drivers/pci/controller/pci-mvebu.c:716:31: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] * @@ got void * @@ drivers/pci/controller/pci-mvebu.c:716:31: sparse: expected void [noderef] * drivers/pci/controller/pci-mvebu.c:716:31: sparse: got void * # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0d9d30b73548fbfe5c024ed630169bdc9a08aee git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git remote update linus git checkout e0d9d30b73548fbfe5c024ed630169bdc9a08aee vim +368 drivers/pci/controller/pci-mvebu.c d9bf28e2650fe3 drivers/pci/host/pci-mvebu.c Jason Gunthorpe 2016-12-12 360 45361a4fe44641 drivers/pci/host/pci-mvebu.c Thomas Petazzoni 2013-05-16 361 static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port) 45361a4fe44641 drivers/pci/host/pci-mvebu.c Thomas Petazzoni 2013-05-16 362 { d9bf28e2650fe3 drivers/pci/host/pci-mvebu.c Jason Gunthorpe 2016-12-12 363 struct mvebu_pcie_window desired = {}; 1f08673eef1236 drivers/pci/controller/pci-mvebu.c Thomas Petazzoni 2018-10-18 364 struct pci_bridge_emul_conf *conf = >bridge.conf; 45361a4fe44641 drivers/pci/host/pci-mvebu.c Thomas Petazzoni 2013-05-16 365 45361a4fe44641 drivers/pci/host/pci-mvebu.c Thomas Petazzoni 2013-05-16 366 /* Are the new iobase/iolimit values invalid? */ 1f08673eef1236 drivers/pci/controller/pci-mvebu.c Thomas Petazzoni 2018-10-18 367 if
Re: [RFC PATCH] seccomp: Add extensibility mechanism to read notifications
On Mon, Jun 15, 2020 at 11:36:22AM +0200, Jann Horn wrote: > On Sat, Jun 13, 2020 at 9:26 AM Sargun Dhillon wrote: > > This introduces an extensibility mechanism to receive seccomp > > notifications. It uses read(2), as opposed to using an ioctl. The listener > > must be first configured to write the notification via the > > SECCOMP_IOCTL_NOTIF_CONFIG ioctl with the fields that the user is > > interested in. > > > > This is different than the old SECCOMP_IOCTL_NOTIF_RECV method as it allows > > for more flexibility. It allows the user to opt into certain fields, and > > not others. This is nice for users who want to opt into some fields like > > thread group leader. In the future, this mechanism can be used to expose > > file descriptors to users, > > Please don't touch the caller's file descriptor table from read/write > handlers, only from ioctl handlers. A process should always be able to > read from files supplied by an untrusted user without having to worry > about new entries mysteriously popping up in its fd table. > Acknowledged. Is something like: ioctl(listener, SECCOMP_GET_MEMORY, notification_id); reasonable in your opinion? > > such as a representation of the process's > > memory. It also has good forwards and backwards compatibility guarantees. > > Users with programs compiled against newer headers will work fine on older > > kernels as long as they don't opt into any sizes, or optional fields that > > are only available on newer kernels. > > > > The ioctl method relies on an extensible struct[1]. This extensible struct > > is slightly misleading[2] as the ioctl number changes when we extend it. > > This breaks backwards compatibility with older kernels even if we're not > > asking for any fields that we do not need. In order to deal with this, the > > ioctl number would need to be dynamic, or the user would need to pass the > > size they're expecting, and we would need to implemented "extended syscall" > > semantics in ioctl. This potentially causes issue to future work of > > kernel-assisted copying for ioctl user buffers. > > I don't see the issue. Can't you replace "switch (cmd)" with "switch > (cmd & ~IOCSIZE_MASK)" and then check the size separately? It depends: 1. If we rely purely on definitions in ioctl.h, and the user they've pulled in a newer header file, on an older kernel, it will fail. This is because the size is bigger, and we don't actually know if they're interested in those new values 2. We can define new seccomp IOCTL versions, and expose these to the user. This has some niceness to it, in that there's a simple backwards compatibiity story. This is a little unorthodox though. 3. We do something like embed the version / size that someone is interested in in the struct, and the ioctl reads it in order to determine which version of the fields to populate. This is effectively what the read approach does with more steps. There's no reason we can't do #3. Just a complexity tradeoff.
Re: [PATCH 1/4] proc/bootconfig: Fix to use correct quotes for value
On Mon, 2020-06-15 at 16:12 -0700, Randy Dunlap wrote: > On 6/15/20 3:42 PM, Steven Rostedt wrote: > > On Mon, 15 Jun 2020 15:30:41 -0700 > > Randy Dunlap wrote: > > > > > > > Please don't infect kernel sources with that style oddity. > > > > > > > > What do you mean? It's already "infected" all over the kernel, (has > > > > been for years!) Not really. For instance: $ git grep -A6 "^{" fs/proc/*.[ch] > But yes, we all have preferences. For data declaration, mine is more like > order of use or some grouping having to do with locality. > > cheers. Mine too. But a few years ago I submitted this: https://lore.kernel.org/patchwork/patch/732076/
linux-next: removal of the cisco tree
Hi, I have removed the cisco tree (https://github.com/daniel-walker/cisco-linux.git#for-next) from linux-next because it has not been updated in more than a year. If you would like it reinstated, please just reply and let me know. -- Cheers, Stephen Rothwell pgpcjFh295WI1.pgp Description: OpenPGP digital signature
linux-next: removal of the md tree
Hi, I have removed the md tree (git://git.kernel.org/pub/scm/linux/kernel/git/shli/md.gi#for-next) from linux-next because it has not been updated in more than a year. If you would like it reinstated, please just reply and let me know. -- Cheers, Stephen Rothwell pgp5kSl9PQV5r.pgp Description: OpenPGP digital signature
linux-next: removal of the sifive tree
Hi, I have removed the sifive tree (git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git#for-next) from linux-next because it has not been updated in more than a year. If you would like it reinstated, please just reply and let me know. -- Cheers, Stephen Rothwell pgpg4ltc_N53R.pgp Description: OpenPGP digital signature
[PATCHv3] coresight: tmc: Add shutdown callback for TMC ETR
Implement a shutdown callback to ensure ETR hardware is properly shutdown in reboot/shutdown path. This is required for ETR which has SMMU address translation enabled like on SC7180 SoC and few others. If the hardware is still accessing memory after SMMU translation is disabled as part of SMMU shutdown callback in system reboot or shutdown path, then IOVAs(I/O virtual address) which it was using will go on the bus as the physical addresses which might result in unknown crashes (NoC/interconnect errors). So we make sure from this shutdown callback that the ETR is shutdown before SMMU translation is disabled and device_link in SMMU driver will take care of ordering of shutdown callbacks such that SMMU shutdown callback is not called before any of its consumer shutdown callbacks. Signed-off-by: Sai Prakash Ranjan --- Changes since v2: * Remove ETF/ETB disable as suggested by Mathieu and Mike since they are not really affected. * Remove coresight and misc device unregister since it is not required for shutdown callback unlike remove callback and userspace is long gone by this time. Changes since v1: * Use mode flag and drop enable flag as Mike suggested. * Use spinlock before tmc hw disable as Mike suggested. --- .../hwtracing/coresight/coresight-tmc-etr.c | 2 +- drivers/hwtracing/coresight/coresight-tmc.c | 23 +++ drivers/hwtracing/coresight/coresight-tmc.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 625882bc8b08..b29c2db94d96 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1110,7 +1110,7 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata *drvdata) } -static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) +void tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { __tmc_etr_disable_hw(drvdata); /* Disable CATU device if this ETR is connected to one */ diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 39fba1d16e6e..b13ce0daa572 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -538,6 +538,28 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) return ret; } +static void tmc_shutdown(struct amba_device *adev) +{ + unsigned long flags; + struct tmc_drvdata *drvdata = amba_get_drvdata(adev); + + spin_lock_irqsave(>spinlock, flags); + + if (drvdata->mode == CS_MODE_DISABLED) + goto out; + + if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) + tmc_etr_disable_hw(drvdata); + + /* +* We do not care about coresight unregister here unlike remove +* callback which is required for making coresight modular since +* the system is going down after this. +*/ +out: + spin_unlock_irqrestore(>spinlock, flags); +} + static const struct amba_id tmc_ids[] = { CS_AMBA_ID(0x000bb961), /* Coresight SoC 600 TMC-ETR/ETS */ @@ -556,6 +578,7 @@ static struct amba_driver tmc_driver = { .suppress_bind_attrs = true, }, .probe = tmc_probe, + .shutdown = tmc_shutdown, .id_table = tmc_ids, }; builtin_amba_driver(tmc_driver); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 71de978575f3..6e8d2dc33d17 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -268,6 +268,7 @@ ssize_t tmc_etb_get_sysfs_trace(struct tmc_drvdata *drvdata, /* ETR functions */ int tmc_read_prepare_etr(struct tmc_drvdata *drvdata); int tmc_read_unprepare_etr(struct tmc_drvdata *drvdata); +void tmc_etr_disable_hw(struct tmc_drvdata *drvdata); extern const struct coresight_ops tmc_etr_cs_ops; ssize_t tmc_etr_get_sysfs_trace(struct tmc_drvdata *drvdata, loff_t pos, size_t len, char **bufpp); base-commit: 059e38815950dbec65beafe03757bce9436e89a4 -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
linux-next: removal of the c6x tree
Hi, I have removed the c6x tree (git://linux-c6x.org/git/projects/linux-c6x-upstreaming.git#for-linux-next) from linux-next because it has not been updated in more than a year. If you would like it reinstated, please just reply and let me know. -- Cheers, Stephen Rothwell pgpNbJQudE3RW.pgp Description: OpenPGP digital signature
[PATCH] coresight: tmc: Fix TMC mode read in tmc_read_unprepare_etb()
Reading TMC mode register without proper coresight power management can lead to exceptions like the one in the call trace below in tmc_read_unprepare_etb() when the trace data is read after the sink is disabled. So fix this by having a check for coresight sysfs mode before reading TMC mode management register in tmc_read_unprepare_etb() similar to tmc_read_prepare_etb(). SError Interrupt on CPU6, code 0xbe000411 -- SError pstate: 80400089 (Nzcv daIf +PAN -UAO) pc : tmc_read_unprepare_etb+0x74/0x108 lr : tmc_read_unprepare_etb+0x54/0x108 sp : ff80d9507c30 x29: ff80d9507c30 x28: ff80b3569a0c x27: x26: 000a0001 x25: ff80cbae9550 x24: 0010 x23: ffd07296b0f0 x22: ffd0109ee028 x21: x20: ff80d19e70e0 x19: ff80d19e7080 x18: x17: x16: x15: x14: x13: x12: x11: x10: dfd1 x9 : x8 : 0002 x7 : ffd071d0fe78 x6 : x5 : 0080 x4 : 0001 x3 : ffd071d0fe98 x2 : x1 : 0004 x0 : 0001 Kernel panic - not syncing: Asynchronous SError Interrupt Fixes: 4525412a5046 ("coresight: tmc: making prepare/unprepare functions generic") Reported-by: Mike Leach Signed-off-by: Sai Prakash Ranjan --- drivers/hwtracing/coresight/coresight-tmc-etf.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c index 36cce2bfb744..6375504ba8b0 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etf.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c @@ -639,15 +639,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata) spin_lock_irqsave(>spinlock, flags); - /* There is no point in reading a TMC in HW FIFO mode */ - mode = readl_relaxed(drvdata->base + TMC_MODE); - if (mode != TMC_MODE_CIRCULAR_BUFFER) { - spin_unlock_irqrestore(>spinlock, flags); - return -EINVAL; - } - /* Re-enable the TMC if need be */ if (drvdata->mode == CS_MODE_SYSFS) { + /* There is no point in reading a TMC in HW FIFO mode */ + mode = readl_relaxed(drvdata->base + TMC_MODE); + if (mode != TMC_MODE_CIRCULAR_BUFFER) { + spin_unlock_irqrestore(>spinlock, flags); + return -EINVAL; + } /* * The trace run will continue with the same allocated trace * buffer. As such zero-out the buffer so that we don't end base-commit: 3d439a6c349778f129de19595db564a8366c3634 -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH v7 2/4] usb: dwc3: qcom: Add interconnect support in dwc3 driver
On 6/16/2020 1:12 AM, Matthias Kaehlcke wrote: On Thu, Jun 04, 2020 at 04:16:31AM -0700, Stephen Boyd wrote: Quoting Sandeep Maheswaram (Temp) (2020-06-04 02:43:09) On 6/3/2020 11:06 PM, Stephen Boyd wrote: Quoting Sandeep Maheswaram (2020-03-31 22:15:43) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 1dfd024..d33ae86 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -285,6 +307,101 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) return 0; } + +/** + * dwc3_qcom_interconnect_init() - Get interconnect path handles + * @qcom: Pointer to the concerned usb core. + * + */ +static int dwc3_qcom_interconnect_init(struct dwc3_qcom *qcom) +{ + struct device *dev = qcom->dev; + int ret; + + if (!device_is_bound(>dwc3->dev)) + return -EPROBE_DEFER; How is this supposed to work? I see that this was added in an earlier revision of this patch series but there isn't any mention of why device_is_bound() is used here. It would be great if there was a comment detailing why this is necessary. It sounds like maximum_speed is important? Furthermore, dwc3_qcom_interconnect_init() is called by dwc3_qcom_probe() which is the function that registers the device for qcom->dwc3->dev. If that device doesn't probe between the time it is registered by dwc3_qcom_probe() and this function is called then we'll fail dwc3_qcom_probe() with -EPROBE_DEFER. And that will remove the qcom->dwc3->dev device from the platform bus because we call of_platform_depopulate() on the error path of dwc3_qcom_probe(). So isn't this whole thing racy and can potentially lead us to a driver probe loop where the wrapper (dwc3_qcom) and the core (dwc3) are probing and we're trying to time it just right so that driver for dwc3 binds before we setup interconnects? I don't know if dwc3 can communicate to the wrapper but that would be more of a direct way to do this. Or maybe the wrapper should try to read the DT property for maximum speed and fallback to a worst case high bandwidth value if it can't figure it out itself without help from dwc3 core. This was added in V4 to address comments from Matthias in V3 https://patchwork.kernel.org/patch/11148587/ Yes, that why I said: "I see that this was added in an earlier revision of this patch series but there isn't any mention of why device_is_bound() is used here. It would be great if there was a comment detailing why this is necessary. It sounds like maximum_speed is important?" Can you please respond to the rest of my email? I agree with Stephen that using device_is_bound() isn't a good option in this case, when I suggested it I wasn't looking at the big picture of how probing the core driver is triggered, sorry about that. Reading the speed from the DT with usb_get_maximum_speed() as Stephen suggests would be an option, the inconvenient is that we then essentially require the property to be defined, while the core driver gets a suitable value from hardware registers. Not sure if the wrapper driver could read from the same registers. One option could be to poll device_is_bound() for 100 ms (or so), with sleeps between polls. It's not elegant but would probably work if we don't find a better solution. if (np) ret = dwc3_qcom_of_register_core(pdev); else ret = dwc3_qcom_acpi_register_core(pdev); if (ret) { dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret); goto depopulate; } ret = dwc3_qcom_interconnect_init(qcom); if (ret) goto depopulate; qcom->mode = usb_get_dr_mode(>dwc3->dev); Before calling dwc3_qcom_interconnect_init we are checking if (ret) { dev_err(dev, "failed to register DWC3 Core, err=%d\n", ret); goto depopulate; } Doesn't this condition confirm the core driver is probed? -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
linux-next: removal of the leaks tree
Hi, I have removed the leaks tree (https://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git#leaks-next) from linux-next because it has not been updated in more than a year. If you would like it reinstated, please just reply and let me know. -- Cheers, Stephen Rothwell pgpNcys1RS6xP.pgp Description: OpenPGP digital signature
Re: mm lock issue while booting Linux on 5.8-rc1 for RISC-V
On Tue, Jun 16, 2020 at 06:57:47AM +0900, Stafford Horne wrote: > On Mon, Jun 15, 2020 at 12:28:11AM -0700, Atish Patra wrote: > > Hi, > > I encountered the following issue while booting 5.8-rc1 on Qemu for RV64. > > I added additional dump_stack and observed that it's happening in bpf free > > path. > > It happens always if CONFIG_DEBUG_VM is enabled. VM_BUG_ON_MM is > > compiled away without that. > > > > forked to background, child pid 113 > > [ 10.328850] CPU: 3 PID: 51 Comm: kworker/3:1 Not tainted > > 5.8.0-rc1-dirty #732 > > [ 10.331739] Workqueue: events bpf_prog_free_deferred > > [ 10.334133] Call Trace: > > [ 10.338039] [] walk_stackframe+0x0/0xa4 > > [ 10.339988] [] show_stack+0x2e/0x3a > > [ 10.340902] [] dump_stack+0x72/0x8c > > [ 10.341451] [] mmap_assert_locked.part.13+0x14/0x1c > > [ 10.342131] [] walk_page_range_novma+0x0/0x4e > > [ 10.342973] [] set_direct_map_invalid_noflush+0x66/0x6e > > [ 10.343917] [] __vunmap+0xe8/0x212 > > [ 10.344680] [] __vfree+0x22/0x6e > > [ 10.345270] [] vfree+0x34/0x56 > > [ 10.345834] [] __bpf_prog_free+0x2c/0x36 > > [ 10.346529] [] bpf_prog_free_deferred+0x74/0x8a > > [ 10.347394] [] process_one_work+0x13a/0x272 > > [ 10.348239] [] worker_thread+0x50/0x2e4 > > [ 10.348900] [] kthread+0xfc/0x10a > > [ 10.349470] [] ret_from_exception+0x0/0xc > > [ 10.354405] mm ffe001018600 mmap seqnum 0 task_size > > 0 > > [ 10.354405] get_unmapped_area > > [ 10.354405] mmap_base 0 mmap_legacy_base 0 highest_vm_end 0 > > [ 10.354405] pgd ffe001074000 mm_users 2 mm_count 1 > > pgtables_bytes 8192 map_count 0 > > [ 10.354405] hiwater_rss 0 hiwater_vm 0 total_vm 0 locked_vm 0 > > [ 10.354405] pinned_vm 0 data_vm 0 exec_vm 0 stack_vm 0 > > [ 10.354405] start_code ffe00020 end_code ffe00084acc2 > > start_data 0 end_data ffe00106dfe4 > > [ 10.354405] start_brk 0 brk ffe0010bd6d0 start_stack 0 > > [ 10.354405] arg_start 0 arg_end 0 env_start 0 env_end 0 > > [ 10.354405] binfmt flags 0 core_state > > [ 10.354405] ioctx_table > > [ 10.354405] exe_file > > [ 10.354405] tlb_flush_pending 0 > > [ 10.354405] def_flags: 0x0() > > [ 10.369325] [ cut here ] > > [ 10.370763] kernel BUG at include/linux/mmap_lock.h:81! > > [ 10.375235] Kernel BUG [#1] > > [ 10.377198] Modules linked in: > > [ 10.378931] CPU: 3 PID: 51 Comm: kworker/3:1 Not tainted 5.8.0-rc1-dirty > > #732 > > [ 10.380179] Workqueue: events bpf_prog_free_deferred > > [ 10.381270] epc: ffe0002db4d4 ra : ffe0002db4d4 sp : > > ffe3eaea7c70 > > [ 10.382561] gp : ffe00106d950 tp : ffe3ef752f80 t0 : > > ffe0010836e8 > > [ 10.383996] t1 : 0064 t2 : s0 : > > ffe3eaea7c90 > > [ 10.385119] s1 : ffe001018600 a0 : 0289 a1 : > > 0020 > > [ 10.386099] a2 : 0005 a3 : a4 : > > ffe001012758 > > [ 10.387294] a5 : a6 : 0102 a7 : > > 0006 > > [ 10.388265] s2 : ffe3f00674c0 s3 : ffe00106e108 s4 : > > ffe00106e100 > > [ 10.389250] s5 : ffe00106e908 s6 : s7 : > > 6db6db6db6db6db7 > > [ 10.390272] s8 : 0001 s9 : ffe00021a4f8 s10: > > > > [ 10.391293] s11: ffe3f0066600 t3 : 0001a7a8 t4 : > > 0001a7a8 > > [ 10.392314] t5 : t6 : ffe00107b76b > > [ 10.393096] status: 0120 badaddr: > > cause: 0003 > > [ 10.397755] ---[ end trace 861659596ac28841 ]--- > > --- > > > > I haven't had the chance to bisect to figure out which commit caused > > the issue. Just wanted > > to check if it is a known issue already. > > Hi Atish, > > Note, I am getting the same (just now) when booting v5.8-rc1 on OpenRISC. If > you have any updates please post back. I will try to look into this today or > tomorrow. I have bisected this to, 42fc541404f249778e752ab39c8bc25fcb2dbe1e: mmap locking API: add mmap_assert_locked() and mmap_assert_write_locked() This should have just changed the existing lockdep api's but something has changed. I haven't had time to look at it yet. Ccing: Michel Lespinasse -Stafford
[PATCH 1/2] ALSA: hda: Make codec controlled LED support more generic
Currently, only HDA codec GPIO controlled LED class is supported, and only via platform specific quirk. There are systems that control LED via COEF instead of GPIO, and to support those systems, move the LED class registration to snd_hda_gen_add_micmute_led(), so all systems can facilitate the same interface. In addition to that, add LED_CORE_SUSPENDRESUME flag since some systems don't restore the LED properly after suspend. Signed-off-by: Kai-Heng Feng --- sound/pci/hda/hda_generic.c | 28 sound/pci/hda/patch_realtek.c | 30 -- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index f4e9d9445e18..4242407734c0 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -4006,6 +4006,28 @@ static const struct snd_kcontrol_new micmute_led_mode_ctl = { * * Returns 0 if the hook is established or a negative error code. */ + +#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) +static int micmute_led_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); + struct hda_gen_spec *spec = codec->spec; + + spec->micmute_led.led_mode = !brightness; + call_micmute_led_update(codec); + return 0; +} + +static struct led_classdev micmute_led_cdev = { + .name = "hda::micmute", + .max_brightness = 1, + .brightness_set_blocking = micmute_led_set, + .default_trigger = "audio-micmute", + .flags = LED_CORE_SUSPENDRESUME, +}; +#endif + int snd_hda_gen_add_micmute_led(struct hda_codec *codec, void (*hook)(struct hda_codec *)) { @@ -4019,6 +4041,12 @@ int snd_hda_gen_add_micmute_led(struct hda_codec *codec, spec->cap_sync_hook = update_micmute_led; if (!snd_hda_gen_add_kctl(spec, NULL, _led_mode_ctl)) return -ENOMEM; + +#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) + micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); + if (devm_led_classdev_register(>core.dev, _led_cdev)) + codec_warn(codec, "failed to register micmute LED\n"); +#endif return 0; } EXPORT_SYMBOL_GPL(snd_hda_gen_add_micmute_led); diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6d73f8beadb6..cead44a6c6cd 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4109,26 +4109,6 @@ static void alc_gpio_micmute_update(struct hda_codec *codec) spec->gen.micmute_led.led_value); } -#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) -static int micmute_led_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); - struct alc_spec *spec = codec->spec; - - alc_update_gpio_led(codec, spec->gpio_mic_led_mask, - spec->micmute_led_polarity, !!brightness); - return 0; -} - -static struct led_classdev micmute_led_cdev = { - .name = "hda::micmute", - .max_brightness = 1, - .brightness_set_blocking = micmute_led_set, - .default_trigger = "audio-micmute", -}; -#endif - /* setup mute and mic-mute GPIO bits, add hooks appropriately */ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, int action, @@ -4136,9 +4116,6 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, unsigned int micmute_mask) { struct alc_spec *spec = codec->spec; -#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) - int err; -#endif alc_fixup_gpio(codec, action, mute_mask | micmute_mask); @@ -4151,13 +4128,6 @@ static void alc_fixup_hp_gpio_led(struct hda_codec *codec, if (micmute_mask) { spec->gpio_mic_led_mask = micmute_mask; snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update); - -#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) - micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); - err = devm_led_classdev_register(>core.dev, _led_cdev); - if (err) - codec_warn(codec, "failed to register micmute LED\n"); -#endif } } -- 2.17.1
[PATCH 2/2] ALSA: hda/realtek: Add mute LED and micmute LED support for HP systems
There are two more HP systems control mute LED from HDA and control micmute LED from SoF. Add IDs to support them. Signed-off-by: Kai-Heng Feng --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cead44a6c6cd..f7398633d736 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7440,6 +7440,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3), SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), + SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED), -- 2.17.1
[PATCH] ovl: inode reference leak in ovl_is_inuse true case.
When "ovl_is_inuse" true case, trap inode reference not put. plus adding the comment explaining sequence of ovl_is_inuse after ovl_setup_trap. Signed-off-by: youngjun --- fs/overlayfs/super.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 91476bc422f9..0396793dadb8 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1029,6 +1029,12 @@ static const struct xattr_handler *ovl_xattr_handlers[] = { NULL }; +/* + * Check if lower root conflicts with this overlay layers before checking + * if it is in-use as upperdir/workdir of "another" mount, because we do + * not bother to check in ovl_is_inuse() if the upperdir/workdir is in fact + * in-use by our upperdir/workdir. + */ static int ovl_setup_trap(struct super_block *sb, struct dentry *dir, struct inode **ptrap, const char *name) { @@ -1499,8 +1505,10 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, if (ovl_is_inuse(stack[i].dentry)) { err = ovl_report_in_use(ofs, "lowerdir"); - if (err) + if (err) { + iput(trap); goto out; + } } mnt = clone_private_mount([i]); -- 2.17.1 Thank you for comment Amir. I modified patch as you said.
[GIT PULL v2] flexible-array member conversion patches for 5.8-rc2
Hi Linus, v2 of today's pull request. I considerably reduced the size of the changelog text for all the patches, while at the same time, pointing people to where they can read further details about the changes, in case they want/need to. I also reduced the size and modified the commit message for the pull request. It no longer contains the part about the one-element arrays. Thanks -- Gustavo The following changes since commit b3a9e3b9622ae10064826dccb4f7a52bd88c7407: Linux 5.8-rc1 (2020-06-14 12:45:04 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flex-array-conversions-5.8-rc2 for you to fetch changes up to 76fafbfffb447d2a5a95d5a9486b0217c00f9785: w1: Replace zero-length array with flexible-array (2020-06-15 23:08:32 -0500) flexible-array member conversion patches for 5.8-rc2 Hi Linus, Please, pull the following patches that replace zero-length arrays with flexible-array members. Notice that all of these patches have been baking in linux-next for two development cycles now. There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. C99 introduced “flexible array members”, which lacks a numeric size for the array declaration entirely: struct something { size_t count; struct foo items[]; }; This is the way the kernel expects dynamically sized trailing elements to be declared. It allows the compiler to generate errors when the flexible array does not occur last in the structure, which helps to prevent some kind of undefined behavior[3] bugs from being inadvertently introduced to the codebase. It also allows the compiler to correctly analyze array sizes (via sizeof(), CONFIG_FORTIFY_SOURCE, and CONFIG_UBSAN_BOUNDS). For instance, there is no mechanism that warns us that the following application of the sizeof() operator to a zero-length array always results in zero: struct something { size_t count; struct foo items[0]; }; struct something *instance; instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count; size = sizeof(instance->items) * instance->count; memcpy(instance->items, source, size); At the last line of code above, size turns out to be zero, when one might have thought it represents the total size in bytes of the dynamic memory recently allocated for the trailing array items. Here are a couple examples of this issue[4][5]. Instead, flexible array members have incomplete type, and so the sizeof() operator may not be applied[6], so any misuse of such operators will be immediately noticed at build time. The cleanest and least error-prone way to implement this is through the use of a flexible array member: struct something { size_t count; struct foo items[]; }; struct something *instance; instance = kmalloc(struct_size(instance, items, count), GFP_KERNEL); instance->count = count; size = sizeof(instance->items[0]) * instance->count; memcpy(instance->items, source, size); Thanks -- Gustavo [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://github.com/KSPP/linux/issues/21 [3] https://git.kernel.org/linus/76497732932f15e7323dc805e8ea8dc11bb587cf [4] https://git.kernel.org/linus/f2cd32a443da694ac4e28fbf4ac6f9d5cc63a539 [5] https://git.kernel.org/linus/ab91c2a89f86be2898cee208d492816ec238b2cf [6] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Gustavo A. R. Silva (41): firmware: dmi-sysfs: Replace zero-length array with flexible-array member firmware: google: memconsole: Replace zero-length array with flexible-array member firmware: google: vpd: Replace zero-length array with flexible-array member aio: Replace zero-length array with flexible-array ARM: tegra: Replace zero-length array with flexible-array dmaengine: Replace zero-length array with flexible-array can: peak_canfd: Replace zero-length array with flexible-array can: Replace zero-length array with flexible-array crypto: Replace zero-length array with flexible-array drbd: Replace zero-length array with flexible-array drm/edid: Replace zero-length array with flexible-array cb710: Replace zero-length array with flexible-array firewire: ohci: Replace zero-length array with flexible-array FS-Cache: Replace zero-length array with flexible-array ia64: kernel: unwind_i.h: Replace zero-length array with flexible-array samples: mei: Replace zero-length array with flexible-array ibft: Replace zero-length array with flexible-array jffs2: Replace zero-length array with flexible-array
Re: [PATCH 5/5] fpga manager: xilinx-spi: check INIT_B pin during write_init
Hi Luca, On Thu, Jun 11, 2020 at 11:11:44PM +0200, Luca Ceresoli wrote: > The INIT_B reports the status during startup and after the end of the > programming process. However the current driver completely ignores it. > > Check the pin status during startup to make sure programming is never > started too early and also to detect any hardware issues in the FPGA > connection. > > This is optional for backward compatibility. If INIT_B is not passed by > device tree, just fallback to the old udelays. > > Signed-off-by: Luca Ceresoli > --- > drivers/fpga/xilinx-spi.c | 54 ++- > 1 file changed, 53 insertions(+), 1 deletion(-) > > diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c > index 799ae04301be..2710a15ed16b 100644 > --- a/drivers/fpga/xilinx-spi.c > +++ b/drivers/fpga/xilinx-spi.c > @@ -23,6 +23,7 @@ > struct xilinx_spi_conf { > struct spi_device *spi; > struct gpio_desc *prog_b; > + struct gpio_desc *init_b; > struct gpio_desc *done; > }; > > @@ -36,11 +37,44 @@ static enum fpga_mgr_states xilinx_spi_state(struct > fpga_manager *mgr) > return FPGA_MGR_STATE_UNKNOWN; > } > > +/** > + * wait_for_init_b - wait for the INIT_B pin to have a given state, or wait > + * a given delay if the pin is unavailable > + * > + * @mgrThe FPGA manager object > + * @value Value INIT_B to wait for (1 = asserted = low) > + * @act_udelay Delay to wait if the INIT_B pin is not available > + * > + * Returns 0 when the pin reached the given state or -ETIMEDOUT if too much > + * time passed waiting for that. If there is no INIT_B, always return 0. > + */ > +static int wait_for_init_b(struct fpga_manager *mgr, int value, > +unsigned long backup_udelay) > +{ > + struct xilinx_spi_conf *conf = mgr->priv; > + unsigned long timeout = jiffies + msecs_to_jiffies(1000); > + > + if (conf->init_b) { > + while (time_before(jiffies, timeout)) { > + /* dump_state(conf, "wait for init_d .."); */ > + if (gpiod_get_value(conf->init_b) == value) > + return 0; > + usleep_range(100, 400); > + } > + return -ETIMEDOUT; > + } > + > + udelay(backup_udelay); > + > + return 0; > +} > + > static int xilinx_spi_write_init(struct fpga_manager *mgr, >struct fpga_image_info *info, >const char *buf, size_t count) > { > struct xilinx_spi_conf *conf = mgr->priv; > + int err; > > if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) { > dev_err(>dev, "Partial reconfiguration not supported.\n"); > @@ -49,10 +83,21 @@ static int xilinx_spi_write_init(struct fpga_manager *mgr, > > gpiod_set_value(conf->prog_b, 1); > > - udelay(1); /* min is 500 ns */ > + err = wait_for_init_b(mgr, 1, 1); /* min is 500 ns */ > + if (err) { > + dev_err(>dev, "INIT_B pin did not go low\n"); > + gpiod_set_value(conf->prog_b, 0); > + return err; > + } > > gpiod_set_value(conf->prog_b, 0); > > + err = wait_for_init_b(mgr, 0, 0); > + if (err) { > + dev_err(>dev, "INIT_B pin did not go high\n"); > + return err; > + } > + > if (gpiod_get_value(conf->done)) { > dev_err(>dev, "Unexpected DONE pin state...\n"); > return -EIO; > @@ -154,6 +199,13 @@ static int xilinx_spi_probe(struct spi_device *spi) > return PTR_ERR(conf->prog_b); > } > > + conf->init_b = devm_gpiod_get_optional(>dev, "init_b", GPIOD_IN); > + if (IS_ERR(conf->init_b)) { > + dev_err(>dev, "Failed to get INIT_B gpio: %ld\n", > + PTR_ERR(conf->init_b)); > + return PTR_ERR(conf->init_b); > + } > + > conf->done = devm_gpiod_get(>dev, "done", GPIOD_IN); > if (IS_ERR(conf->done)) { > dev_err(>dev, "Failed to get DONE gpio: %ld\n", > -- > 2.27.0 > Series looks good, will apply to for-next. Thanks, Moritz
Re: [PATCH][next] scsi: fnic: Replace vmalloc() + memset() with vzalloc() and use array_size()
On Tue, 2020-06-16 at 00:19 +, Satish Kharat (satishkh) wrote: > Reviewed-by: Satish Kharat > > > On 6/15/20, 3:49 PM, "Gustavo A. R. Silva" wrote: > > Use vzalloc() instead of the vmalloc() and memset. Also, use array_size() > instead of the open-coded version. > > This issue was found with the help of Coccinelle and, audited and fixed > manually. > > Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 > Signed-off-by: Gustavo A. R. Silva > --- > drivers/scsi/fnic/fnic_trace.c | 16 > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/drivers/scsi/fnic/fnic_trace.c > b/drivers/scsi/fnic/fnic_trace.c [] > @@ -488,7 +488,7 @@ int fnic_trace_buf_init(void) > } > > fnic_trace_entries.page_offset = > - vmalloc(array_size(fnic_max_trace_entries, > + vzalloc(array_size(fnic_max_trace_entries, > sizeof(unsigned long))); Perhaps better as kvcalloc(fnic_max_trace_entries, sizeof(unsigned long), GFP_KERNEL);
Re: [PATCH 1/5] dt-bindings: fpga: xilinx-slave-serial: valid for the 7 Series too
On Thu, Jun 11, 2020 at 11:11:40PM +0200, Luca Ceresoli wrote: > The Xilinx 7-series uses the same protocol, mention that. > > Signed-off-by: Luca Ceresoli Acked-by: Moritz Fischer > --- > .../devicetree/bindings/fpga/xilinx-slave-serial.txt | 9 ++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/fpga/xilinx-slave-serial.txt > b/Documentation/devicetree/bindings/fpga/xilinx-slave-serial.txt > index cfa4ed42b62f..9f103f3872e8 100644 > --- a/Documentation/devicetree/bindings/fpga/xilinx-slave-serial.txt > +++ b/Documentation/devicetree/bindings/fpga/xilinx-slave-serial.txt > @@ -1,11 +1,14 @@ > Xilinx Slave Serial SPI FPGA Manager > > -Xilinx Spartan-6 FPGAs support a method of loading the bitstream over > -what is referred to as "slave serial" interface. > +Xilinx Spartan-6 and 7 Series FPGAs support a method of loading the > +bitstream over what is referred to as "slave serial" interface. > The slave serial link is not technically SPI, and might require extra > circuits in order to play nicely with other SPI slaves on the same bus. > > -See https://www.xilinx.com/support/documentation/user_guides/ug380.pdf > +See: > +- https://www.xilinx.com/support/documentation/user_guides/ug380.pdf > +- > https://www.xilinx.com/support/documentation/user_guides/ug470_7Series_Config.pdf > +- > https://www.xilinx.com/support/documentation/application_notes/xapp583-fpga-configuration.pdf > > Required properties: > - compatible: should contain "xlnx,fpga-slave-serial" > -- > 2.27.0 >
[rcu:lkmm-dev] BUILD SUCCESS 29ecbc5a484349975eb1173c79538d4de418f966
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git lkmm-dev branch HEAD: 29ecbc5a484349975eb1173c79538d4de418f966 tools/memory-model: Use "-unroll 0" to keep --hw runs finite elapsed time: 485m configs tested: 107 configs skipped: 1 The following configs have been built successfully. More configs may be tested in the coming days. arm defconfig arm allyesconfig arm allmodconfig arm allnoconfig arm64allyesconfig arm64 defconfig arm64allmodconfig arm64 allnoconfig arm axm55xx_defconfig mips bigsur_defconfig mips bmips_stb_defconfig shmigor_defconfig arm pxa_defconfig um x86_64_defconfig mips pic32mzda_defconfig arm versatile_defconfig ia64 gensparse_defconfig i386 allnoconfig i386 allyesconfig i386defconfig i386 debian-10.3 ia64 allmodconfig ia64defconfig ia64 allnoconfig ia64 allyesconfig m68k allmodconfig m68k allnoconfig m68k sun3_defconfig m68kdefconfig m68k allyesconfig nios2 defconfig nios2allyesconfig openriscdefconfig c6x allyesconfig c6x allnoconfig openrisc allyesconfig nds32 defconfig nds32 allnoconfig csky allyesconfig cskydefconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig h8300allmodconfig xtensa defconfig arc defconfig arc allyesconfig sh allmodconfig shallnoconfig microblazeallnoconfig mips allyesconfig mips allnoconfig mips allmodconfig pariscallnoconfig parisc defconfig parisc allyesconfig parisc allmodconfig powerpc defconfig powerpc allyesconfig powerpc rhel-kconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a006-20200615 i386 randconfig-a002-20200615 i386 randconfig-a001-20200615 i386 randconfig-a004-20200615 i386 randconfig-a005-20200615 i386 randconfig-a003-20200615 x86_64 randconfig-a015-20200615 x86_64 randconfig-a011-20200615 x86_64 randconfig-a016-20200615 x86_64 randconfig-a012-20200615 x86_64 randconfig-a014-20200615 x86_64 randconfig-a013-20200615 i386 randconfig-a015-20200615 i386 randconfig-a011-20200615 i386 randconfig-a014-20200615 i386 randconfig-a013-20200615 i386 randconfig-a016-20200615 i386 randconfig-a012-20200615 riscvallyesconfig riscv allnoconfig riscv defconfig riscvallmodconfig s390 allyesconfig s390 allnoconfig s390 allmodconfig s390defconfig sparcallyesconfig sparc defconfig sparc64 defconfig sparc64 allnoconfig sparc64 allyesconfig sparc64 allmodconfig um allmodconfig umallnoconfig um allyesconfig um defconfig x86_64 rhel-
[PATCH V3 1/3] dt-bindings: spi: Convert mxs spi to json-schema
Convert the MXS SPI binding to DT schema format using json-schema Signed-off-by: Anson Huang Reviewed-by: Rob Herring --- Changes since V2: - drop "clock-frequency" property's type. --- Documentation/devicetree/bindings/spi/mxs-spi.txt | 26 -- Documentation/devicetree/bindings/spi/mxs-spi.yaml | 56 ++ 2 files changed, 56 insertions(+), 26 deletions(-) delete mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.txt create mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.yaml diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.txt b/Documentation/devicetree/bindings/spi/mxs-spi.txt deleted file mode 100644 index 3499b73..000 --- a/Documentation/devicetree/bindings/spi/mxs-spi.txt +++ /dev/null @@ -1,26 +0,0 @@ -* Freescale MX233/MX28 SSP/SPI - -Required properties: -- compatible: Should be "fsl,-spi", where soc is "imx23" or "imx28" -- reg: Offset and length of the register set for the device -- interrupts: Should contain SSP ERROR interrupt -- dmas: DMA specifier, consisting of a phandle to DMA controller node - and SSP DMA channel ID. - Refer to dma.txt and fsl-mxs-dma.txt for details. -- dma-names: Must be "rx-tx". - -Optional properties: -- clock-frequency : Input clock frequency to the SPI block in Hz. - Default is 16000 Hz. - -Example: - -ssp0: ssp@8001 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,imx28-spi"; - reg = <0x8001 0x2000>; - interrupts = <96>; - dmas = <_apbh 0>; - dma-names = "rx-tx"; -}; diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.yaml b/Documentation/devicetree/bindings/spi/mxs-spi.yaml new file mode 100644 index 000..51f8c66 --- /dev/null +++ b/Documentation/devicetree/bindings/spi/mxs-spi.yaml @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/mxs-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale MX233/MX28 SSP/SPI + +maintainers: + - Marek Vasut + +allOf: + - $ref: "/schemas/spi/spi-controller.yaml#" + +properties: + compatible: +enum: + - fsl,imx23-spi + - fsl,imx28-spi + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + dmas: +maxItems: 1 + + dma-names: +const: rx-tx + + clock-frequency: +description: input clock frequency to the SPI block in Hz. +default: 16000 + +required: + - compatible + - reg + - interrupts + - dmas + - dma-names + +unevaluatedProperties: false + +examples: + - | +spi@8001 { +#address-cells = <1>; +#size-cells = <0>; +compatible = "fsl,imx28-spi"; +reg = <0x8001 0x2000>; +interrupts = <96>; +dmas = <_apbh 0>; +dma-names = "rx-tx"; +}; -- 2.7.4
[rcu:lkmm] BUILD SUCCESS a08ae995e32ffd5e54b714f941c7cdde4a83eade
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git lkmm branch HEAD: a08ae995e32ffd5e54b714f941c7cdde4a83eade Documentation/litmus-tests: Cite an RCU litmus test elapsed time: 485m configs tested: 113 configs skipped: 1 The following configs have been built successfully. More configs may be tested in the coming days. arm defconfig arm allyesconfig arm allmodconfig arm allnoconfig arm64allyesconfig arm64 defconfig arm64allmodconfig arm64 allnoconfig arm axm55xx_defconfig mips bigsur_defconfig mips bmips_stb_defconfig shmigor_defconfig c6x allyesconfig arm pxa_defconfig um x86_64_defconfig mips pic32mzda_defconfig arm versatile_defconfig ia64 gensparse_defconfig i386 allnoconfig i386 allyesconfig i386defconfig i386 debian-10.3 ia64 allmodconfig ia64defconfig ia64 allnoconfig ia64 allyesconfig m68k allmodconfig m68k allnoconfig m68k sun3_defconfig m68kdefconfig m68k allyesconfig nios2 defconfig nios2allyesconfig openriscdefconfig c6x allnoconfig openrisc allyesconfig nds32 defconfig nds32 allnoconfig csky allyesconfig cskydefconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig h8300allmodconfig xtensa defconfig arc defconfig arc allyesconfig sh allmodconfig shallnoconfig microblazeallnoconfig mips allyesconfig mips allnoconfig mips allmodconfig pariscallnoconfig parisc defconfig parisc allyesconfig parisc allmodconfig powerpc defconfig powerpc allyesconfig powerpc rhel-kconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a006-20200615 i386 randconfig-a002-20200615 i386 randconfig-a001-20200615 i386 randconfig-a004-20200615 i386 randconfig-a005-20200615 i386 randconfig-a003-20200615 i386 randconfig-a006-20200616 i386 randconfig-a002-20200616 i386 randconfig-a001-20200616 i386 randconfig-a004-20200616 i386 randconfig-a005-20200616 i386 randconfig-a003-20200616 x86_64 randconfig-a015-20200615 x86_64 randconfig-a011-20200615 x86_64 randconfig-a016-20200615 x86_64 randconfig-a012-20200615 x86_64 randconfig-a014-20200615 x86_64 randconfig-a013-20200615 i386 randconfig-a015-20200615 i386 randconfig-a011-20200615 i386 randconfig-a014-20200615 i386 randconfig-a013-20200615 i386 randconfig-a016-20200615 i386 randconfig-a012-20200615 riscvallyesconfig riscv allnoconfig riscv defconfig riscvallmodconfig s390 allyesconfig s390 allnoconfig s390 allmodconfig s390defconfig sparcallyesconfig sparc defconfig sparc64 defconfig sparc64 allnoconfig sparc64 allyesconfig sparc64
[PATCH V3 2/3] dt-bindings: spi: Convert imx cspi to json-schema
Convert the i.MX CSPI binding to DT schema format using json-schema, update compatible, remove obsolete properties "fsl,spi-num-chipselects" and update the example based on latest DT file. Signed-off-by: Anson Huang --- Changes since V2: - remove redundant "maxItems" in "clocks" and "clock-names". --- .../devicetree/bindings/spi/fsl-imx-cspi.txt | 56 - .../devicetree/bindings/spi/fsl-imx-cspi.yaml | 97 ++ 2 files changed, 97 insertions(+), 56 deletions(-) delete mode 100644 Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt create mode 100644 Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt deleted file mode 100644 index 33bc58f..000 --- a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt +++ /dev/null @@ -1,56 +0,0 @@ -* Freescale (Enhanced) Configurable Serial Peripheral Interface - (CSPI/eCSPI) for i.MX - -Required properties: -- compatible : - - "fsl,imx1-cspi" for SPI compatible with the one integrated on i.MX1 - - "fsl,imx21-cspi" for SPI compatible with the one integrated on i.MX21 - - "fsl,imx27-cspi" for SPI compatible with the one integrated on i.MX27 - - "fsl,imx31-cspi" for SPI compatible with the one integrated on i.MX31 - - "fsl,imx35-cspi" for SPI compatible with the one integrated on i.MX35 - - "fsl,imx51-ecspi" for SPI compatible with the one integrated on i.MX51 - - "fsl,imx53-ecspi" for SPI compatible with the one integrated on i.MX53 and later Soc - - "fsl,imx8mq-ecspi" for SPI compatible with the one integrated on i.MX8MQ - - "fsl,imx8mm-ecspi" for SPI compatible with the one integrated on i.MX8MM - - "fsl,imx8mn-ecspi" for SPI compatible with the one integrated on i.MX8MN - - "fsl,imx8mp-ecspi" for SPI compatible with the one integrated on i.MX8MP -- reg : Offset and length of the register set for the device -- interrupts : Should contain CSPI/eCSPI interrupt -- clocks : Clock specifiers for both ipg and per clocks. -- clock-names : Clock names should include both "ipg" and "per" -See the clock consumer binding, - Documentation/devicetree/bindings/clock/clock-bindings.txt - -Recommended properties: -- cs-gpios : GPIOs to use as chip selects, see spi-bus.txt. While the native chip -select lines can be used, they appear to always generate a pulse between each -word of a transfer. Most use cases will require GPIO based chip selects to -generate a valid transaction. - -Optional properties: -- num-cs : Number of total chip selects, see spi-bus.txt. -- dmas: DMA specifiers for tx and rx dma. See the DMA client binding, -Documentation/devicetree/bindings/dma/dma.txt. -- dma-names: DMA request names, if present, should include "tx" and "rx". -- fsl,spi-rdy-drctl: Integer, representing the value of DRCTL, the register -controlling the SPI_READY handling. Note that to enable the DRCTL consideration, -the SPI_READY mode-flag needs to be set too. -Valid values are: 0 (disabled), 1 (edge-triggered burst) and 2 (level-triggered burst). - -Obsolete properties: -- fsl,spi-num-chipselects : Contains the number of the chipselect - -Example: - -ecspi@7001 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,imx51-ecspi"; - reg = <0x7001 0x4000>; - interrupts = <36>; - cs-gpios = < 24 0>, /* GPIO3_24 */ - < 25 0>; /* GPIO3_25 */ - dmas = < 3 7 1>, < 4 7 2>; - dma-names = "rx", "tx"; - fsl,spi-rdy-drctl = <1>; -}; diff --git a/Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml new file mode 100644 index 000..6e44c9c --- /dev/null +++ b/Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/fsl-imx-cspi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale (Enhanced) Configurable Serial Peripheral Interface (CSPI/eCSPI) for i.MX + +maintainers: + - Shawn Guo + +allOf: + - $ref: "/schemas/spi/spi-controller.yaml#" + +properties: + compatible: +oneOf: + - const: fsl,imx1-cspi + - const: fsl,imx21-cspi + - const: fsl,imx27-cspi + - const: fsl,imx31-cspi + - const: fsl,imx35-cspi + - const: fsl,imx51-ecspi + - const: fsl,imx53-ecspi + - items: +- enum: + - fsl,imx50-ecspi + - fsl,imx6q-ecspi + - fsl,imx6sx-ecspi + - fsl,imx6sl-ecspi + - fsl,imx6sll-ecspi + - fsl,imx6ul-ecspi + - fsl,imx7d-ecspi + - fsl,imx8mq-ecspi + - fsl,imx8mm-ecspi + - fsl,imx8mn-ecspi + - fsl,imx8mp-ecspi +- const: fsl,imx51-ecspi + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +items: + -
[PATCH V3 0/3] Convert mxs/imx spi/cspi/lpspi binding to json-schema
This patch series converts mxs/imx spi/cspi/lpspi binding to json-schema. In fsl-imx-cspi.yaml, also update compatible, remove obsolete properties "fsl,spi-num-chipselects" and update the example based on latest DT file; In spi-fsl-lpspi.yaml, the original maintainer's email address pandy@nxp.com is no longer valid, so I use mine. Compared to V2, this patch series mainly removes redundant 'maxItems' in 'clocks' and 'clock-names' property, also drop "clock-frequency" property's type. Anson Huang (3): dt-bindings: spi: Convert mxs spi to json-schema dt-bindings: spi: Convert imx cspi to json-schema dt-bindings: spi: Convert imx lpspi to json-schema .../devicetree/bindings/spi/fsl-imx-cspi.txt | 56 - .../devicetree/bindings/spi/fsl-imx-cspi.yaml | 97 ++ Documentation/devicetree/bindings/spi/mxs-spi.txt | 26 -- Documentation/devicetree/bindings/spi/mxs-spi.yaml | 56 + .../devicetree/bindings/spi/spi-fsl-lpspi.txt | 29 --- .../devicetree/bindings/spi/spi-fsl-lpspi.yaml | 60 + 6 files changed, 213 insertions(+), 111 deletions(-) delete mode 100644 Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt create mode 100644 Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml delete mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.txt create mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.yaml delete mode 100644 Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt create mode 100644 Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml -- 2.7.4
[PATCH V3 3/3] dt-bindings: spi: Convert imx lpspi to json-schema
Convert the i.MX LPSPI binding to DT schema format using json-schema Signed-off-by: Anson Huang --- Changes since V2: - remove redundant "maxItems" in "clocks" and "clock-names". --- .../devicetree/bindings/spi/spi-fsl-lpspi.txt | 29 --- .../devicetree/bindings/spi/spi-fsl-lpspi.yaml | 60 ++ 2 files changed, 60 insertions(+), 29 deletions(-) delete mode 100644 Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt create mode 100644 Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml diff --git a/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt b/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt deleted file mode 100644 index e71b81a..000 --- a/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.txt +++ /dev/null @@ -1,29 +0,0 @@ -* Freescale Low Power SPI (LPSPI) for i.MX - -Required properties: -- compatible : - - "fsl,imx7ulp-spi" for LPSPI compatible with the one integrated on i.MX7ULP soc - - "fsl,imx8qxp-spi" for LPSPI compatible with the one integrated on i.MX8QXP soc -- reg : address and length of the lpspi master registers -- interrupt-parent : core interrupt controller -- interrupts : lpspi interrupt -- clocks : lpspi clock specifier. Its number and order need to correspond to the - value in clock-names. -- clock-names : Corresponding to per clock and ipg clock in "clocks" - respectively. In i.MX7ULP, it only has per clk, so use CLK_DUMMY - to fill the "ipg" blank. -- spi-slave : spi slave mode support. In slave mode, add this attribute without - value. In master mode, remove it. - -Examples: - -lpspi2: lpspi@4029 { - compatible = "fsl,imx7ulp-spi"; - reg = <0x4029 0x1>; - interrupt-parent = <>; - interrupts = ; - clocks = < IMX7ULP_CLK_LPSPI2>, -< IMX7ULP_CLK_DUMMY>; - clock-names = "per", "ipg"; - spi-slave; -}; diff --git a/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml b/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml new file mode 100644 index 000..143b94a --- /dev/null +++ b/Documentation/devicetree/bindings/spi/spi-fsl-lpspi.yaml @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/spi-fsl-lpspi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale Low Power SPI (LPSPI) for i.MX + +maintainers: + - Anson Huang + +allOf: + - $ref: "/schemas/spi/spi-controller.yaml#" + +properties: + compatible: +enum: + - fsl,imx7ulp-spi + - fsl,imx8qxp-spi + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +items: + - description: SoC SPI per clock + - description: SoC SPI ipg clock + + clock-names: +items: + - const: per + - const: ipg + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +unevaluatedProperties: false + +examples: + - | +#include +#include + +spi@4029 { +compatible = "fsl,imx7ulp-spi"; +reg = <0x4029 0x1>; +interrupt-parent = <>; +interrupts = ; +clocks = < IMX7ULP_CLK_LPSPI2>, + < IMX7ULP_CLK_DUMMY>; +clock-names = "per", "ipg"; +spi-slave; +}; -- 2.7.4
Re: [PATCH 2/2] cpufreq: Specify default governor on command line
On 15-06-20, 17:55, Quentin Perret wrote: > +static void cpufreq_get_default_governor(void) > +{ > + default_governor = cpufreq_parse_governor(cpufreq_param_governor); > + if (!default_governor) { > + if (*cpufreq_param_governor) > + pr_warn("Failed to find %s\n", cpufreq_param_governor); > + default_governor = cpufreq_default_governor(); A module_get() never happened for this case and so maybe a module_put() should never get called. > + } > +} > + > +static void cpufreq_put_default_governor(void) > +{ > + if (!default_governor) > + return; > + module_put(default_governor->owner); > + default_governor = NULL; > +} > + > static int cpufreq_init_governor(struct cpufreq_policy *policy) > { > int ret; > @@ -2701,6 +2721,8 @@ int cpufreq_register_driver(struct cpufreq_driver > *driver_data) > > if (driver_data->setpolicy) > driver_data->flags |= CPUFREQ_CONST_LOOPS; > + else > + cpufreq_get_default_governor(); > > if (cpufreq_boost_supported()) { > ret = create_boost_sysfs_file(); > @@ -2769,6 +2791,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver > *driver) > subsys_interface_unregister(_interface); > remove_boost_sysfs_file(); > cpuhp_remove_state_nocalls_cpuslocked(hp_online); > + cpufreq_put_default_governor(); > > write_lock_irqsave(_driver_lock, flags); > > @@ -2792,4 +2815,5 @@ static int __init cpufreq_core_init(void) > return 0; > } And since this is a per boot thing, there is perhaps no need of doing these at driver register/unregister, I would rather do it at: cpufreq_core_init() time itself and so we will never need to run cpufreq_put_default_governor() and so can be removed. And another thing I am not able to understand (despite you commenting about that in the commit log) is what happens if the default governor chosen is built as a module ? -- viresh
Re: [PATCH 1/2] cpufreq: Register governors at core_initcall
On 15-06-20, 17:55, Quentin Perret wrote: > Currently, most CPUFreq governors are registered at core_initcall time > when used as default, and module_init otherwise. In preparation for > letting users specify the default governor on the kernel command line, > change all of them to use core_initcall unconditionally, as is already > the case for schedutil and performance. This will enable us to assume > builtin governors have been registered before the builtin CPUFreq > drivers probe. > > And since all governors now have similar init/exit patterns, introduce > two new macros cpufreq_governor_{init,exit}() to factorize the code. > > Signed-off-by: Quentin Perret > --- > Note: I couldn't boot-test the change to spudemand, by lack of hardware. > But I can confirm cell_defconfig compiles just fine. > --- > .../platforms/cell/cpufreq_spudemand.c| 26 ++- > drivers/cpufreq/cpufreq_conservative.c| 22 > drivers/cpufreq/cpufreq_ondemand.c| 24 + > drivers/cpufreq/cpufreq_performance.c | 14 ++ > drivers/cpufreq/cpufreq_powersave.c | 18 +++-- > drivers/cpufreq/cpufreq_userspace.c | 18 +++-- > include/linux/cpufreq.h | 14 ++ > kernel/sched/cpufreq_schedutil.c | 6 + > 8 files changed, 36 insertions(+), 106 deletions(-) Acked-by: Viresh Kumar -- viresh
Re: [PATCH v2 4/6] regulator: Add support for QCOM PMIC VBUS booster
On 6/15/2020 5:00 AM, Mark Brown wrote: > On Fri, Jun 12, 2020 at 04:19:16PM -0700, Wesley Cheng wrote: > >> +++ b/drivers/regulator/qcom_usb_vbus-regulator.c >> @@ -0,0 +1,147 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Copyright (c) 2020, The Linux Foundation. All rights reserved. >> + */ > > Please make the entire comment a C++ one so things look more > intentional. > Hi Mark, Sure, will do. >> +static int qcom_usb_vbus_enable(struct regulator_dev *rdev) >> +{ > >> +static int qcom_usb_vbus_disable(struct regulator_dev *rdev) >> +{ > >> +static int qcom_usb_vbus_is_enabled(struct regulator_dev *rdev) >> +{ > > These operations can all be replaced by regulator_is_enabled_regmap() > and friends. > Got it. This simplifies the driver a lot. Thanks for the tip. >> +init_data.constraints.valid_ops_mask |= REGULATOR_CHANGE_STATUS; > > No, this is broken - regulators should not override the constraints the > machine sets. > Understood. I decided to go with of_get_regulator_init_data() to initialize the init_data parameter. This should take care of the constraint settings. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH v2 4/6] regulator: Add support for QCOM PMIC VBUS booster
On 6/12/2020 8:28 PM, Randy Dunlap wrote: > On 6/12/20 4:19 PM, Wesley Cheng wrote: >> diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig >> index 074a2ef55943..f9165f9f9051 100644 >> --- a/drivers/regulator/Kconfig >> +++ b/drivers/regulator/Kconfig >> @@ -797,6 +797,16 @@ config REGULATOR_QCOM_SPMI >>Qualcomm SPMI PMICs as a module. The module will be named >>"qcom_spmi-regulator". >> >> +config REGULATOR_QCOM_USB_VBUS >> +tristate "Qualcomm USB Vbus regulator driver" >> +depends on SPMI || COMPILE_TEST >> +help >> + If you say yes to this option, support will be included for the >> + regulator used to enable the VBUS output. >> + >> + Say M here if you want to include support for enabling the VBUS output >> + as a module. The module will be named "qcom_usb-regulator". > > Hi, > Shouldn't that module name match what is in the Makefile? > > Thanks, Randy. Missed this as I was going back and forth on the file name. Thanks for the catch. >> + >> config REGULATOR_RC5T583 >> tristate "RICOH RC5T583 Power regulators" >> depends on MFD_RC5T583 >> diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile >> index c0d6b96ebd78..cbab28aa7b56 100644 >> --- a/drivers/regulator/Makefile >> +++ b/drivers/regulator/Makefile >> @@ -89,6 +89,7 @@ obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o >> obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o >> obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o >> obj-$(CONFIG_REGULATOR_QCOM_SPMI) += qcom_spmi-regulator.o >> +obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o >> obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o >> obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o >> obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o > > > thanks. > -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
[PATCH v7 5/7] fpga: dfl: fme: add interrupt support for global error reporting
Error reporting interrupt is very useful to notify users that some errors are detected by the hardware. Once users are notified, they could query hardware logged error states, no need to continuously poll on these states. This patch adds interrupt support for fme global error reporting sub feature. It follows the common DFL interrupt notification and handling mechanism. And it implements two ioctls below for user to query number of irqs supported, and set/unset interrupt triggers. Ioctls: * DFL_FPGA_FME_ERR_GET_IRQ_NUM get the number of irqs, which is used to determine whether/how many interrupts fme error reporting feature supports. * DFL_FPGA_FME_ERR_SET_IRQ set/unset given eventfds as fme error reporting interrupt triggers. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: use DFL_FPGA_FME_ERR_GET_IRQ_NUM instead of DFL_FPGA_FME_ERR_GET_INFO Delete flags field for DFL_FPGA_FME_ERR_SET_IRQ v3: put_user() instead of copy_to_user() improves comments v4: use common functions to handle irq ioctls v5: Minor fixes for Hao's comments v6: No change v7: No change --- drivers/fpga/dfl-fme-error.c | 18 ++ drivers/fpga/dfl-fme-main.c | 6 ++ include/uapi/linux/fpga-dfl.h | 23 +++ 3 files changed, 47 insertions(+) diff --git a/drivers/fpga/dfl-fme-error.c b/drivers/fpga/dfl-fme-error.c index f897d41..51c2892 100644 --- a/drivers/fpga/dfl-fme-error.c +++ b/drivers/fpga/dfl-fme-error.c @@ -15,6 +15,7 @@ * Mitchel, Henry */ +#include #include #include "dfl.h" @@ -348,6 +349,22 @@ static void fme_global_err_uinit(struct platform_device *pdev, fme_err_mask(>dev, true); } +static long +fme_global_error_ioctl(struct platform_device *pdev, + struct dfl_feature *feature, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case DFL_FPGA_FME_ERR_GET_IRQ_NUM: + return dfl_feature_ioctl_get_num_irqs(pdev, feature, arg); + case DFL_FPGA_FME_ERR_SET_IRQ: + return dfl_feature_ioctl_set_irq(pdev, feature, arg); + default: + dev_dbg(>dev, "%x cmd not handled", cmd); + return -ENODEV; + } +} + const struct dfl_feature_id fme_global_err_id_table[] = { {.id = FME_FEATURE_ID_GLOBAL_ERR,}, {0,} @@ -356,4 +373,5 @@ const struct dfl_feature_id fme_global_err_id_table[] = { const struct dfl_feature_ops fme_global_err_ops = { .init = fme_global_err_init, .uinit = fme_global_err_uinit, + .ioctl = fme_global_error_ioctl, }; diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c index fc210d4..77ea04d 100644 --- a/drivers/fpga/dfl-fme-main.c +++ b/drivers/fpga/dfl-fme-main.c @@ -620,11 +620,17 @@ static int fme_release(struct inode *inode, struct file *filp) { struct dfl_feature_platform_data *pdata = filp->private_data; struct platform_device *pdev = pdata->dev; + struct dfl_feature *feature; dev_dbg(>dev, "Device File Release\n"); mutex_lock(>lock); dfl_feature_dev_use_end(pdata); + + if (!dfl_feature_dev_use_count(pdata)) + dfl_fpga_dev_for_each_feature(pdata, feature) + dfl_fpga_set_irq_triggers(feature, 0, + feature->nr_irqs, NULL); mutex_unlock(>lock); return 0; diff --git a/include/uapi/linux/fpga-dfl.h b/include/uapi/linux/fpga-dfl.h index 6c71c9d..b6495ea 100644 --- a/include/uapi/linux/fpga-dfl.h +++ b/include/uapi/linux/fpga-dfl.h @@ -230,4 +230,27 @@ struct dfl_fpga_fme_port_pr { */ #define DFL_FPGA_FME_PORT_ASSIGN _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 2, int) +/** + * DFL_FPGA_FME_ERR_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_FME_BASE + 3, + * __u32 num_irqs) + * + * Get the number of irqs supported by the fpga fme error reporting private + * feature. Currently hardware supports up to 1 irq. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_FME_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC,\ +DFL_FME_BASE + 3, __u32) + +/** + * DFL_FPGA_FME_ERR_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_FME_BASE + 4, + * struct dfl_fpga_irq_set) + * + * Set fpga fme error reporting interrupt trigger if evtfds[n] is valid. + * Unset related interrupt trigger if evtfds[n] is a negative value. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_FME_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC,\ +DFL_FME_BASE + 4, \ +struct dfl_fpga_irq_set) + #endif /* _UAPI_LINUX_FPGA_DFL_H */ -- 2.7.4
[PATCH v7 7/7] Documentation: fpga: dfl: add descriptions for interrupt related interfaces.
This patch adds introductions of interrupt related interfaces for FME error reporting, port error reporting and AFU user interrupts features. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: Update Documents cause change of irq ioctl interfaces. v3: No change v4: Update interrupt support part. v5: No change v6: No change v7: No change --- Documentation/fpga/dfl.rst | 19 +++ 1 file changed, 19 insertions(+) diff --git a/Documentation/fpga/dfl.rst b/Documentation/fpga/dfl.rst index 978c4af..2df9a0a 100644 --- a/Documentation/fpga/dfl.rst +++ b/Documentation/fpga/dfl.rst @@ -89,6 +89,8 @@ The following functions are exposed through ioctls: - Program bitstream (DFL_FPGA_FME_PORT_PR) - Assign port to PF (DFL_FPGA_FME_PORT_ASSIGN) - Release port from PF (DFL_FPGA_FME_PORT_RELEASE) +- Get number of irqs of FME global error (DFL_FPGA_FME_ERR_GET_IRQ_NUM) +- Set interrupt trigger for FME error (DFL_FPGA_FME_ERR_SET_IRQ) More functions are exposed through sysfs (/sys/class/fpga_region/regionX/dfl-fme.n/): @@ -149,6 +151,10 @@ The following functions are exposed through ioctls: - Map DMA buffer (DFL_FPGA_PORT_DMA_MAP) - Unmap DMA buffer (DFL_FPGA_PORT_DMA_UNMAP) - Reset AFU (DFL_FPGA_PORT_RESET) +- Get number of irqs of port error (DFL_FPGA_PORT_ERR_GET_IRQ_NUM) +- Set interrupt trigger for port error (DFL_FPGA_PORT_ERR_SET_IRQ) +- Get number of irqs of UINT (DFL_FPGA_PORT_UINT_GET_IRQ_NUM) +- Set interrupt trigger for UINT (DFL_FPGA_PORT_UINT_SET_IRQ) DFL_FPGA_PORT_RESET: reset the FPGA Port and its AFU. Userspace can do Port @@ -462,6 +468,19 @@ since they are system-wide counters on FPGA device. The current driver does not support sampling. So "perf record" is unsupported. +Interrupt support += +Some FME and AFU private features are able to generate interrupts. As mentioned +above, users could call ioctl (DFL_FPGA_*_GET_IRQ_NUM) to know whether or how +many interrupts are supported for this private feature. Drivers also implement +an eventfd based interrupt handling mechanism for users to get notified when +interrupt happens. Users could set eventfds to driver via +ioctl (DFL_FPGA_*_SET_IRQ), and then poll/select on these eventfds waiting for +notification. +In Current DFL, 3 sub features (Port error, FME global error and AFU interrupt) +support interrupts. + + Add new FIUs support It's possible that developers made some new function blocks (FIUs) under this -- 2.7.4
[PATCH v7 1/7] fpga: dfl: parse interrupt info for feature devices on enumeration
DFL based FPGA devices could support interrupts for different purposes, but current DFL framework only supports feature device enumeration with given MMIO resources information via common DFL headers. This patch introduces one new API dfl_fpga_enum_info_add_irq for low level bus drivers (e.g. PCIe device driver) to pass its interrupt resources information to DFL framework for enumeration, and also adds interrupt enumeration code in framework to parse and assign interrupt resources for enumerated feature devices and their own sub features. With this patch, DFL framework enumerates interrupt resources for core features, including PORT Error Reporting, FME (FPGA Management Engine) Error Reporting and also AFU User Interrupts. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: early validating irq table for each feature in parse_feature_irq(). Some code improvement and minor fix for Hao's comments. v3: put parse_feature_irqs() inside create_feature_instance() some minor fixes and more comments v4: no need to include asm/irq.h. fail the dfl enumeration when irq parsing error happens. v5: Some minor fix for Hao's comments v6: Remove unnecessary type casting. Some comment fix for Moritz's comments. v7: Add the header file , to fix build error on ARCH=xtensa --- drivers/fpga/dfl.c | 153 + drivers/fpga/dfl.h | 41 ++ 2 files changed, 194 insertions(+) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 9909948..02c1ec4 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -421,6 +421,9 @@ EXPORT_SYMBOL_GPL(dfl_fpga_dev_ops_unregister); * * @dev: device to enumerate. * @cdev: the container device for all feature devices. + * @nr_irqs: number of irqs for all feature devices. + * @irq_table: Linux IRQ numbers for all irqs, indexed by local irq index of + *this device. * @feature_dev: current feature device. * @ioaddr: header register region address of feature device in enumeration. * @sub_features: a sub features linked list for feature device in enumeration. @@ -429,6 +432,9 @@ EXPORT_SYMBOL_GPL(dfl_fpga_dev_ops_unregister); struct build_feature_devs_info { struct device *dev; struct dfl_fpga_cdev *cdev; + unsigned int nr_irqs; + int *irq_table; + struct platform_device *feature_dev; void __iomem *ioaddr; struct list_head sub_features; @@ -442,12 +448,16 @@ struct build_feature_devs_info { * @mmio_res: mmio resource of this sub feature. * @ioaddr: mapped base address of mmio resource. * @node: node in sub_features linked list. + * @irq_base: start of irq index in this sub feature. + * @nr_irqs: number of irqs of this sub feature. */ struct dfl_feature_info { u64 fid; struct resource mmio_res; void __iomem *ioaddr; struct list_head node; + unsigned int irq_base; + unsigned int nr_irqs; }; static void dfl_fpga_cdev_add_port_dev(struct dfl_fpga_cdev *cdev, @@ -520,6 +530,8 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) /* fill features and resource information for feature dev */ list_for_each_entry_safe(finfo, p, >sub_features, node) { struct dfl_feature *feature = >features[index]; + struct dfl_feature_irq_ctx *ctx; + unsigned int i; /* save resource information for each feature */ feature->id = finfo->fid; @@ -527,6 +539,20 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) feature->ioaddr = finfo->ioaddr; fdev->resource[index++] = finfo->mmio_res; + if (finfo->nr_irqs) { + ctx = devm_kcalloc(binfo->dev, finfo->nr_irqs, + sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + for (i = 0; i < finfo->nr_irqs; i++) + ctx[i].irq = + binfo->irq_table[finfo->irq_base + i]; + + feature->irq_ctx = ctx; + feature->nr_irqs = finfo->nr_irqs; + } + list_del(>node); kfree(finfo); } @@ -638,6 +664,78 @@ static u64 feature_id(void __iomem *start) return 0; } +static int parse_feature_irqs(struct build_feature_devs_info *binfo, + resource_size_t ofst, u64 fid, + unsigned int *irq_base, unsigned int *nr_irqs) +{ + void __iomem *base = binfo->ioaddr + ofst; + unsigned int i, ibase, inr = 0; + int virq; + u64 v; + + /* +* Ideally DFL framework should only read info from DFL header, but +* current version DFL only
[PATCH v7 3/7] fpga: dfl: introduce interrupt trigger setting API
FPGA user applications may be interested in interrupts generated by DFL features. For example, users can implement their own FPGA logics with interrupts enabled in AFU (Accelerated Function Unit, dynamic region of DFL based FPGA). So user applications need to be notified to handle these interrupts. In order to allow userspace applications to monitor interrupts, driver requires userspace to provide eventfds as interrupt notification channels. Applications then poll/select on the eventfds to get notified. This patch introduces a generic helper functions to do eventfds binding with given interrupts. Sub feature drivers are expected to use XXX_GET_IRQ_NUM to query irq info, and XXX_SET_IRQ to set eventfds for interrupts. This patch also introduces helper functions for these 2 ioctls. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Signed-off-by: Tom Rix Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: use unsigned int instead of int for irq array indexes in dfl_fpga_set_irq_triggers() Improves comments for NULL fds param in dfl_fpga_set_irq_triggers() v3: Improve comments of dfl_fpga_set_irq_triggers() refines code for dfl_fpga_set_irq_triggers, delete local variable j v4: Introduce 2 helper functions to help handle the XXX_GET_IRQ_NUM & XXX_SET_IRQ ioctls for sub feature drivers. v5: Some minor fix for Hao's comments v6: Remove unnecessary type casting v7: Split the check and wrap the overflow check with the unlikely macro for dfl_fpga_set_irq_triggers() remove the redunant check in do_set_irq_trigger() --- drivers/fpga/dfl.c| 157 ++ drivers/fpga/dfl.h| 16 + include/uapi/linux/fpga-dfl.h | 13 3 files changed, 186 insertions(+) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 02c1ec4..b51db80 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -10,7 +10,9 @@ * Wu Hao * Xiao Guangrong */ +#include #include +#include #include "dfl.h" @@ -534,6 +536,7 @@ static int build_info_commit_dev(struct build_feature_devs_info *binfo) unsigned int i; /* save resource information for each feature */ + feature->dev = fdev; feature->id = finfo->fid; feature->resource_index = index; feature->ioaddr = finfo->ioaddr; @@ -1394,6 +1397,160 @@ int dfl_fpga_cdev_config_ports_vf(struct dfl_fpga_cdev *cdev, int num_vfs) } EXPORT_SYMBOL_GPL(dfl_fpga_cdev_config_ports_vf); +static irqreturn_t dfl_irq_handler(int irq, void *arg) +{ + struct eventfd_ctx *trigger = arg; + + eventfd_signal(trigger, 1); + return IRQ_HANDLED; +} + +static int do_set_irq_trigger(struct dfl_feature *feature, unsigned int idx, + int fd) +{ + struct platform_device *pdev = feature->dev; + struct eventfd_ctx *trigger; + int irq, ret; + + irq = feature->irq_ctx[idx].irq; + + if (feature->irq_ctx[idx].trigger) { + free_irq(irq, feature->irq_ctx[idx].trigger); + kfree(feature->irq_ctx[idx].name); + eventfd_ctx_put(feature->irq_ctx[idx].trigger); + feature->irq_ctx[idx].trigger = NULL; + } + + if (fd < 0) + return 0; + + feature->irq_ctx[idx].name = + kasprintf(GFP_KERNEL, "fpga-irq[%u](%s-%llx)", idx, + dev_name(>dev), feature->id); + if (!feature->irq_ctx[idx].name) + return -ENOMEM; + + trigger = eventfd_ctx_fdget(fd); + if (IS_ERR(trigger)) { + ret = PTR_ERR(trigger); + goto free_name; + } + + ret = request_irq(irq, dfl_irq_handler, 0, + feature->irq_ctx[idx].name, trigger); + if (!ret) { + feature->irq_ctx[idx].trigger = trigger; + return ret; + } + + eventfd_ctx_put(trigger); +free_name: + kfree(feature->irq_ctx[idx].name); + + return ret; +} + +/** + * dfl_fpga_set_irq_triggers - set eventfd triggers for dfl feature interrupts + * + * @feature: dfl sub feature. + * @start: start of irq index in this dfl sub feature. + * @count: number of irqs. + * @fds: eventfds to bind with irqs. unbind related irq if fds[n] is negative. + * unbind "count" specified number of irqs if fds ptr is NULL. + * + * Bind given eventfds with irqs in this dfl sub feature. Unbind related irq if + * fds[n] is negative. Unbind "count" specified number of irqs if fds ptr is + * NULL. + * + * Return: 0 on success, negative error code otherwise. + */ +int dfl_fpga_set_irq_triggers(struct dfl_feature *feature, unsigned int start, + unsigned int count, int32_t *fds) +{ + unsigned int i; + int ret = 0; + + /* overflow */ + if (unlikely(start + count < start)) + return -EINVAL; + + /* exceeds
[PATCH v7 4/7] fpga: dfl: afu: add interrupt support for port error reporting
Error reporting interrupt is very useful to notify users that some errors are detected by the hardware. Once users are notified, they could query hardware logged error states, no need to continuously poll on these states. This patch adds interrupt support for port error reporting sub feature. It follows the common DFL interrupt notification and handling mechanism, implements two ioctl commands below for user to query number of irqs supported, and set/unset interrupt triggers. Ioctls: * DFL_FPGA_PORT_ERR_GET_IRQ_NUM get the number of irqs, which is used to determine whether/how many interrupts error reporting feature supports. * DFL_FPGA_PORT_ERR_SET_IRQ set/unset given eventfds as error interrupt triggers. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: use DFL_FPGA_PORT_ERR_GET_IRQ_NUM instead of DFL_FPGA_PORT_ERR_GET_INFO Delete flag field for DFL_FPGA_PORT_ERR_SET_IRQ param v3: put_user() instead of copy_to_user() improves comments v4: use common functions to handle irq ioctls v5: minor fixes for Hao's comments v6: No change v7: No change --- drivers/fpga/dfl-afu-error.c | 17 + drivers/fpga/dfl-afu-main.c | 4 include/uapi/linux/fpga-dfl.h | 23 +++ 3 files changed, 44 insertions(+) diff --git a/drivers/fpga/dfl-afu-error.c b/drivers/fpga/dfl-afu-error.c index c1467ae..c469118 100644 --- a/drivers/fpga/dfl-afu-error.c +++ b/drivers/fpga/dfl-afu-error.c @@ -14,6 +14,7 @@ * Mitchel Henry */ +#include #include #include "dfl-afu.h" @@ -219,6 +220,21 @@ static void port_err_uinit(struct platform_device *pdev, afu_port_err_mask(>dev, true); } +static long +port_err_ioctl(struct platform_device *pdev, struct dfl_feature *feature, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case DFL_FPGA_PORT_ERR_GET_IRQ_NUM: + return dfl_feature_ioctl_get_num_irqs(pdev, feature, arg); + case DFL_FPGA_PORT_ERR_SET_IRQ: + return dfl_feature_ioctl_set_irq(pdev, feature, arg); + default: + dev_dbg(>dev, "%x cmd not handled", cmd); + return -ENODEV; + } +} + const struct dfl_feature_id port_err_id_table[] = { {.id = PORT_FEATURE_ID_ERROR,}, {0,} @@ -227,4 +243,5 @@ const struct dfl_feature_id port_err_id_table[] = { const struct dfl_feature_ops port_err_ops = { .init = port_err_init, .uinit = port_err_uinit, + .ioctl = port_err_ioctl, }; diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c index b0c3178..357cd5d 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -577,6 +577,7 @@ static int afu_release(struct inode *inode, struct file *filp) { struct platform_device *pdev = filp->private_data; struct dfl_feature_platform_data *pdata; + struct dfl_feature *feature; dev_dbg(>dev, "Device File Release\n"); @@ -586,6 +587,9 @@ static int afu_release(struct inode *inode, struct file *filp) dfl_feature_dev_use_end(pdata); if (!dfl_feature_dev_use_count(pdata)) { + dfl_fpga_dev_for_each_feature(pdata, feature) + dfl_fpga_set_irq_triggers(feature, 0, + feature->nr_irqs, NULL); __port_reset(pdev); afu_dma_region_destroy(pdata); } diff --git a/include/uapi/linux/fpga-dfl.h b/include/uapi/linux/fpga-dfl.h index 7331350..6c71c9d 100644 --- a/include/uapi/linux/fpga-dfl.h +++ b/include/uapi/linux/fpga-dfl.h @@ -164,6 +164,29 @@ struct dfl_fpga_irq_set { __s32 evtfds[]; }; +/** + * DFL_FPGA_PORT_ERR_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 5, + * __u32 num_irqs) + * + * Get the number of irqs supported by the fpga port error reporting private + * feature. Currently hardware supports up to 1 irq. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_PORT_ERR_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC,\ +DFL_PORT_BASE + 5, __u32) + +/** + * DFL_FPGA_PORT_ERR_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 6, + * struct dfl_fpga_irq_set) + * + * Set fpga port error reporting interrupt trigger if evtfds[n] is valid. + * Unset related interrupt trigger if evtfds[n] is a negative value. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_PORT_ERR_SET_IRQ _IOW(DFL_FPGA_MAGIC,\ +DFL_PORT_BASE + 6, \ +struct dfl_fpga_irq_set) + /* IOCTLs for FME file descriptor */ /** -- 2.7.4
[PATCH v7 6/7] fpga: dfl: afu: add AFU interrupt support
AFU (Accelerated Function Unit) is dynamic region of the DFL based FPGA, and always defined by users. Some DFL based FPGA cards allow users to implement their own interrupts in AFU. In order to support this, hardware implements a new UINT (AFU Interrupt) private feature with related capability register which describes the number of supported AFU interrupts as well as the local index of the interrupts for software enumeration, and from software side, driver follows the common DFL interrupt notification and handling mechanism, and it implements two ioctls below for user to query number of irqs supported and set/unset interrupt triggers. Ioctls: * DFL_FPGA_PORT_UINT_GET_IRQ_NUM get the number of irqs, which is used to determine how many interrupts UINT feature supports. * DFL_FPGA_PORT_UINT_SET_IRQ set/unset eventfds as AFU interrupt triggers. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: use DFL_FPGA_PORT_UINT_GET_IRQ_NUM instead of DFL_FPGA_PORT_UINT_GET_INFO Delete flags field for DFL_FPGA_PORT_UINT_SET_IRQ v3: put_user() instead of copy_to_user() improves comments v4: use common functions to handle irq ioctls v5: Minor fixes for Hao's comments v6: No change v7: No change --- drivers/fpga/dfl-afu-main.c | 28 include/uapi/linux/fpga-dfl.h | 23 +++ 2 files changed, 51 insertions(+) diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c index 357cd5d..7c84fee 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -529,6 +529,30 @@ static const struct dfl_feature_ops port_stp_ops = { .init = port_stp_init, }; +static long +port_uint_ioctl(struct platform_device *pdev, struct dfl_feature *feature, + unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case DFL_FPGA_PORT_UINT_GET_IRQ_NUM: + return dfl_feature_ioctl_get_num_irqs(pdev, feature, arg); + case DFL_FPGA_PORT_UINT_SET_IRQ: + return dfl_feature_ioctl_set_irq(pdev, feature, arg); + default: + dev_dbg(>dev, "%x cmd not handled", cmd); + return -ENODEV; + } +} + +static const struct dfl_feature_id port_uint_id_table[] = { + {.id = PORT_FEATURE_ID_UINT,}, + {0,} +}; + +static const struct dfl_feature_ops port_uint_ops = { + .ioctl = port_uint_ioctl, +}; + static struct dfl_feature_driver port_feature_drvs[] = { { .id_table = port_hdr_id_table, @@ -547,6 +571,10 @@ static struct dfl_feature_driver port_feature_drvs[] = { .ops = _stp_ops, }, { + .id_table = port_uint_id_table, + .ops = _uint_ops, + }, + { .ops = NULL, } }; diff --git a/include/uapi/linux/fpga-dfl.h b/include/uapi/linux/fpga-dfl.h index b6495ea..1621b07 100644 --- a/include/uapi/linux/fpga-dfl.h +++ b/include/uapi/linux/fpga-dfl.h @@ -187,6 +187,29 @@ struct dfl_fpga_irq_set { DFL_PORT_BASE + 6, \ struct dfl_fpga_irq_set) +/** + * DFL_FPGA_PORT_UINT_GET_IRQ_NUM - _IOR(DFL_FPGA_MAGIC, DFL_PORT_BASE + 7, + * __u32 num_irqs) + * + * Get the number of irqs supported by the fpga AFU interrupt private + * feature. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_PORT_UINT_GET_IRQ_NUM _IOR(DFL_FPGA_MAGIC,\ +DFL_PORT_BASE + 7, __u32) + +/** + * DFL_FPGA_PORT_UINT_SET_IRQ - _IOW(DFL_FPGA_MAGIC, DFL_PORT_BASE + 8, + * struct dfl_fpga_irq_set) + * + * Set fpga AFU interrupt trigger if evtfds[n] is valid. + * Unset related interrupt trigger if evtfds[n] is a negative value. + * Return: 0 on success, -errno on failure. + */ +#define DFL_FPGA_PORT_UINT_SET_IRQ _IOW(DFL_FPGA_MAGIC,\ +DFL_PORT_BASE + 8, \ +struct dfl_fpga_irq_set) + /* IOCTLs for FME file descriptor */ /** -- 2.7.4
[PATCH v7 2/7] fpga: dfl: pci: add irq info for feature devices enumeration
Some DFL FPGA PCIe cards (e.g. Intel FPGA Programmable Acceleration Card) support MSI-X based interrupts. This patch allows PCIe driver to prepare and pass interrupt resources to DFL via enumeration API. These interrupt resources could then be assigned to actual features which use them. Signed-off-by: Luwei Kang Signed-off-by: Wu Hao Signed-off-by: Xu Yilun Signed-off-by: Tom Rix Reviewed-by: Marcelo Tosatti Acked-by: Wu Hao --- v2: put irq resources init code inside cce_enumerate_feature_dev() Some minor changes for Hao's comments. v3: Some minor fix for Hao's comments for v2. v4: Some minor fix for Hao's comments for v3. v5: No change. v6: Some minor fix for Moritz's comments. v7: remove cci_pci_free_irq_table(), just use kfree(). --- drivers/fpga/dfl-pci.c | 76 -- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c index 5387550..4a14a24 100644 --- a/drivers/fpga/dfl-pci.c +++ b/drivers/fpga/dfl-pci.c @@ -39,6 +39,27 @@ static void __iomem *cci_pci_ioremap_bar(struct pci_dev *pcidev, int bar) return pcim_iomap_table(pcidev)[bar]; } +static int cci_pci_alloc_irq(struct pci_dev *pcidev) +{ + int ret, nvec = pci_msix_vec_count(pcidev); + + if (nvec <= 0) { + dev_dbg(>dev, "fpga interrupt not supported\n"); + return 0; + } + + ret = pci_alloc_irq_vectors(pcidev, nvec, nvec, PCI_IRQ_MSIX); + if (ret < 0) + return ret; + + return nvec; +} + +static void cci_pci_free_irq(struct pci_dev *pcidev) +{ + pci_free_irq_vectors(pcidev); +} + /* PCI Device ID */ #define PCIE_DEVICE_ID_PF_INT_5_X 0xBCBD #define PCIE_DEVICE_ID_PF_INT_6_X 0xBCC0 @@ -78,17 +99,34 @@ static void cci_remove_feature_devs(struct pci_dev *pcidev) /* remove all children feature devices */ dfl_fpga_feature_devs_remove(drvdata->cdev); + cci_pci_free_irq(pcidev); +} + +static int *cci_pci_create_irq_table(struct pci_dev *pcidev, unsigned int nvec) +{ + unsigned int i; + int *table; + + table = kcalloc(nvec, sizeof(int), GFP_KERNEL); + if (!table) + return table; + + for (i = 0; i < nvec; i++) + table[i] = pci_irq_vector(pcidev, i); + + return table; } /* enumerate feature devices under pci device */ static int cci_enumerate_feature_devs(struct pci_dev *pcidev) { struct cci_drvdata *drvdata = pci_get_drvdata(pcidev); + int port_num, bar, i, nvec, ret = 0; struct dfl_fpga_enum_info *info; struct dfl_fpga_cdev *cdev; resource_size_t start, len; - int port_num, bar, i, ret = 0; void __iomem *base; + int *irq_table; u32 offset; u64 v; @@ -97,11 +135,30 @@ static int cci_enumerate_feature_devs(struct pci_dev *pcidev) if (!info) return -ENOMEM; + /* add irq info for enumeration if the device support irq */ + nvec = cci_pci_alloc_irq(pcidev); + if (nvec < 0) { + dev_err(>dev, "Fail to alloc irq %d.\n", nvec); + ret = nvec; + goto enum_info_free_exit; + } else if (nvec) { + irq_table = cci_pci_create_irq_table(pcidev, nvec); + if (!irq_table) { + ret = -ENOMEM; + goto irq_free_exit; + } + + ret = dfl_fpga_enum_info_add_irq(info, nvec, irq_table); + kfree(irq_table); + if (ret) + goto irq_free_exit; + } + /* start to find Device Feature List from Bar 0 */ base = cci_pci_ioremap_bar(pcidev, 0); if (!base) { ret = -ENOMEM; - goto enum_info_free_exit; + goto irq_free_exit; } /* @@ -154,7 +211,7 @@ static int cci_enumerate_feature_devs(struct pci_dev *pcidev) dfl_fpga_enum_info_add_dfl(info, start, len, base); } else { ret = -ENODEV; - goto enum_info_free_exit; + goto irq_free_exit; } /* start enumeration with prepared enumeration information */ @@ -162,11 +219,14 @@ static int cci_enumerate_feature_devs(struct pci_dev *pcidev) if (IS_ERR(cdev)) { dev_err(>dev, "Enumeration failure\n"); ret = PTR_ERR(cdev); - goto enum_info_free_exit; + goto irq_free_exit; } drvdata->cdev = cdev; +irq_free_exit: + if (ret) + cci_pci_free_irq(pcidev); enum_info_free_exit: dfl_fpga_enum_info_free(info); @@ -211,12 +271,10 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid) } ret = cci_enumerate_feature_devs(pcidev); - if (ret) { - dev_err(>dev, "enumeration failure %d.\n", ret); -
[PATCH v7 0/7] Add interrupt support to FPGA DFL drivers
This patchset add interrupt support to FPGA DFL drivers. With these patches, DFL driver will parse and assign interrupt resources for enumerated feature devices and their sub features. This patchset also introduces a set of APIs for user to monitor DFL interrupts. Three sub features (DFL FME error, DFL AFU error and user interrupt) drivers now support these APIs. Patch #1: DFL framework change. Accept interrupt info input from DFL bus driver, and add interrupt parsing and assignment for feature sub devices. Patch #2: DFL pci driver change, add interrupt info on DFL enumeration. Patch #3: DFL framework change. Add helper functions for feature sub device drivers to handle interrupt and notify users. Patch #4: Add interrupt support for AFU error reporting sub feature. Patch #5: Add interrupt support for FME global error reporting sub feature. Patch #6: Add interrupt support for a new sub feature, to handle user interrupts implemented in AFU. Patch #7: Documentation for DFL interrupt handling. Main changes from v1: - Early validating irq table for each feature in parse_feature_irq() in Patch #1. - Changes IOCTL interfaces. use DFL_FPGA_FME/PORT_XXX_GET_IRQ_NUM instead of DFL_FPGA_FME/PORT_XXX_GET_INFO, delete flag field for DFL_FPGA_FME/PORT_XXX_SET_IRQ param Main changes from v2: - put parse_feature_irqs() inside create_feature_instance(). - refines code for dfl_fpga_set_irq_triggers, delete local variable j. - put_user() instead of copy_to_user() for DFL_FPGA_XXX_GET_IRQ_NUM IOCTL Main changes from v3: - rebased to 5.7-rc1. - fail the dfl enumeration when irq parsing error happens. - Add 2 helper functions in dfl.c to handle generic irq ioctls in feature drivers. Main changes from v4: - Minor fixes for Hao's comments. Main changes from v5: - Remove unnecessary type casting in Patch #1 & #3. - Minor fixes for Moritz's comments. Main changes from v6: - Add the header file for Patch #1, to fix build error on ARCH=xtensa - Minor fixes in Patch #2 & #3. Xu Yilun (7): fpga: dfl: parse interrupt info for feature devices on enumeration fpga: dfl: pci: add irq info for feature devices enumeration fpga: dfl: introduce interrupt trigger setting API fpga: dfl: afu: add interrupt support for port error reporting fpga: dfl: fme: add interrupt support for global error reporting fpga: dfl: afu: add AFU interrupt support Documentation: fpga: dfl: add descriptions for interrupt related interfaces. Documentation/fpga/dfl.rst| 19 +++ drivers/fpga/dfl-afu-error.c | 17 +++ drivers/fpga/dfl-afu-main.c | 32 + drivers/fpga/dfl-fme-error.c | 18 +++ drivers/fpga/dfl-fme-main.c | 6 + drivers/fpga/dfl-pci.c| 76 +-- drivers/fpga/dfl.c| 310 ++ drivers/fpga/dfl.h| 57 include/uapi/linux/fpga-dfl.h | 82 +++ 9 files changed, 608 insertions(+), 9 deletions(-) -- 2.7.4
[PATCH] mm/pgtable: Move extern zero_pfn outside __HAVE_COLOR_ZERO_PAGE
zero_pfn variable is required whether __HAVE_COLOR_ZERO_PAGE is enabled or not. Also it should not really be declared individually in all functions where it gets used. Just move the declaration outside, which also makes it available for other potential users. Cc: Arnd Bergmann Cc: linux-a...@vger.kernel.org Cc: linux...@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- Applies on 5.8-rc1. If the earlier motivation was to hide zero_pfn from general visibility, we could just put in a comment and update the commit message that my_zero_pfn() should always be used rather than zero_pfn. Build tested on many platforms and boot tested on arm64, x86. include/linux/pgtable.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 32b6c52d41b9..078e9864abca 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1020,10 +1020,11 @@ extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, extern void untrack_pfn_moved(struct vm_area_struct *vma); #endif +extern unsigned long zero_pfn; + #ifdef __HAVE_COLOR_ZERO_PAGE static inline int is_zero_pfn(unsigned long pfn) { - extern unsigned long zero_pfn; unsigned long offset_from_zero_pfn = pfn - zero_pfn; return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT); } @@ -1033,13 +1034,11 @@ static inline int is_zero_pfn(unsigned long pfn) #else static inline int is_zero_pfn(unsigned long pfn) { - extern unsigned long zero_pfn; return pfn == zero_pfn; } static inline unsigned long my_zero_pfn(unsigned long addr) { - extern unsigned long zero_pfn; return zero_pfn; } #endif -- 2.20.1
[PATCH][v2] PM / s2idle: Clear _TIF_POLLING_NRFLAG before suspend to idle
Suspend to idle was found to not work on Goldmont CPU recently. And the issue was triggered due to: 1. On Goldmont the CPU in idle can only be woken up via IPIs, not POLLING mode: Commit 08e237fa56a1 ("x86/cpu: Add workaround for MONITOR instruction erratum on Goldmont based CPUs") 2. When the CPU is entering suspend to idle process, the _TIF_POLLING_NRFLAG is kept on, due to cpuidle_enter_s2idle() doesn't properly match call_cpuidle(). 3. Commit b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") makes use of _TIF_POLLING_NRFLAG to avoid sending IPIs to idle CPUs. 4. As a result, some IPIs related functions might not work well during suspend to idle on Goldmont. For example, one suspected victim: tick_unfreeze() -> timekeeping_resume() -> hrtimers_resume() -> clock_was_set() -> on_each_cpu() might wait forever, because the IPIs will not be sent to the CPUs which are sleeping with _TIF_POLLING_NRFLAG set, and Goldmont CPU could not be woken up by only setting _TIF_NEED_RESCHED on the monitor address. I don't find a way in Ubuntu to update the firmware of Goldmont and check if the issue was gone, a fix patch would do no harm. Clear the _TIF_POLLING_NRFLAG flag before entering suspend to idle, and let the driver's enter_s2idle() to decide whether to set _TIF_POLLING_NRFLAG or not. So that to avoid the scenario described above and keep the context consistent with before. Also adjust the naming to be consistent with call_cpuidle(). Fixes: b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") Suggested-by: Peter Zijlstra (Intel) Reported-by: kbuild test robot Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Peter Zijlstra (Intel) Signed-off-by: Chen Yu --- v2: According to Peter's review, v1 is racy, if someone already set TIF_NEED_RESCHED this patch just clear POLLING and go to sleep. Check TIF_NEED_RESCHED before entering suspend to idle and adjust the naming to be consistent with call_cpuidle(). -- drivers/cpuidle/cpuidle.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index c149d9e20dfd..b003767abebd 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -133,8 +134,8 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv, } #ifdef CONFIG_SUSPEND -static void enter_s2idle_proper(struct cpuidle_driver *drv, - struct cpuidle_device *dev, int index) +static void s2idle_enter(struct cpuidle_driver *drv, +struct cpuidle_device *dev, int index) { ktime_t time_start, time_end; @@ -168,6 +169,15 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv, dev->states_usage[index].s2idle_usage++; } +static int call_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev, + int index) +{ + if (!current_clr_polling_and_test()) + s2idle_enter(drv, dev, index); + + return index; +} + /** * cpuidle_enter_s2idle - Enter an idle state suitable for suspend-to-idle. * @drv: cpuidle driver for the given CPU. @@ -187,7 +197,7 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev) */ index = find_deepest_state(drv, dev, U64_MAX, 0, true); if (index > 0) - enter_s2idle_proper(drv, dev, index); + call_s2idle(drv, dev, index); return index; } -- 2.17.1
Re: [PATCH 1/1] scsi: mpt3sas: fix spelling mistake
On Tue, 9 Jun 2020 18:13:13 +0200, Flavio Suligoi wrote: > Fix typo: "tigger" --> "trigger" Applied to 5.9/scsi-queue, thanks! [1/1] scsi: mpt3sas: Fix spelling mistake https://git.kernel.org/mkp/scsi/c/896c9b4907c5 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 00/17] spelling.txt: /decriptors/descriptors/
On Tue, 9 Jun 2020 13:45:53 +0100, Kieran Bingham wrote: > I wouldn't normally go through spelling fixes, but I caught sight of > this typo twice, and then foolishly grepped the tree for it, and saw how > pervasive it was. > > so here I am ... fixing a typo globally... but with an addition in > scripts/spelling.txt so it shouldn't re-appear ;-) > > [...] Applied to 5.9/scsi-queue, thanks! [06/17] scsi: Fix trivial spelling https://git.kernel.org/mkp/scsi/c/0a19a725c0ed -- Martin K. Petersen Oracle Linux Engineering
[PATCH V3 1/2] dt-bindings: i2c: Convert mxs i2c to json-schema
Convert the MXS I2C binding to DT schema format using json-schema Signed-off-by: Anson Huang --- Changes since V2: - remove 'clock-frequency' property's typs and use enum for it, as it ONLY support 100KHz/400KHz. --- Documentation/devicetree/bindings/i2c/i2c-mxs.txt | 25 --- Documentation/devicetree/bindings/i2c/i2c-mxs.yaml | 51 ++ 2 files changed, 51 insertions(+), 25 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-mxs.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mxs.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt deleted file mode 100644 index 4e1c8ac..000 --- a/Documentation/devicetree/bindings/i2c/i2c-mxs.txt +++ /dev/null @@ -1,25 +0,0 @@ -* Freescale MXS Inter IC (I2C) Controller - -Required properties: -- compatible: Should be "fsl,-i2c" -- reg: Should contain registers location and length -- interrupts: Should contain ERROR interrupt number -- clock-frequency: Desired I2C bus clock frequency in Hz. - Only 10Hz and 40Hz modes are supported. -- dmas: DMA specifier, consisting of a phandle to DMA controller node - and I2C DMA channel ID. - Refer to dma.txt and fsl-mxs-dma.txt for details. -- dma-names: Must be "rx-tx". - -Examples: - -i2c0: i2c@80058000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "fsl,imx28-i2c"; - reg = <0x80058000 2000>; - interrupts = <111>; - clock-frequency = <10>; - dmas = <_apbx 6>; - dma-names = "rx-tx"; -}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-mxs.yaml b/Documentation/devicetree/bindings/i2c/i2c-mxs.yaml new file mode 100644 index 000..d3134ed --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-mxs.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-mxs.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale MXS Inter IC (I2C) Controller + +maintainers: + - Shawn Guo + +properties: + compatible: +enum: + - fsl,imx23-i2c + - fsl,imx28-i2c + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clock-frequency: +enum: [ 10, 40 ] + + dmas: +maxItems: 1 + + dma-names: +const: rx-tx + +required: + - compatible + - reg + - interrupts + - dmas + - dma-names + +additionalProperties: false + +examples: + - | +i2c@80058000 { +compatible = "fsl,imx28-i2c"; +reg = <0x80058000 2000>; +interrupts = <111>; +clock-frequency = <10>; +dmas = <_apbx 6>; +dma-names = "rx-tx"; +}; -- 2.7.4
Re: [PATCH v3 0/2] scsi: ufs: Add trace event for UIC commands and cleanup UIC struct
On Mon, 15 Jun 2020 15:22:33 +0800, Stanley Chu wrote: > This series adds trace event for UIC commands and do a small cleanup in > struct uic_command. > > v2 -> v3: > - Refactor "complete" event hooks in ufshcd_uic_cmd_compl() (Avri Altman) > > v1 -> v2: > - Rename "uic_send" to "send" and "uic_complete" to "complete" > - Move "send" trace before UIC command is sent otherwise "send" trace may > log incorrect arguments > - Move "complete" trace to UIC interrupt handler to make logging time > precise > > [...] Applied to 5.9/scsi-queue, thanks! [1/2] scsi: ufs: Remove unused field in struct uic_command https://git.kernel.org/mkp/scsi/c/7a7df52dbc71 [2/2] scsi: ufs: Add trace event for UIC commands https://git.kernel.org/mkp/scsi/c/aa5c697988b4 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3 0/5] scsi: ufs-mediatek: Fix clk-gating and introduce low-power mode for vccq2
On Mon, 1 Jun 2020 18:46:41 +0800, Stanley Chu wrote: > This series fixes clk-gating issues and introduces low-power mode for vccq2 > in MediaTek platforms. > > v2 -> v3: > - Fix (add back) linkoff support in patch [4] since previous version > incorrectly removed linkoff support > > v1 -> v2: > - Add patch [4] and [5] > > [...] Applied to 5.9/scsi-queue, thanks! [1/5] scsi: ufs-mediatek: Fix imprecise waiting time for ref-clk control https://git.kernel.org/mkp/scsi/c/fb43337cd4cf [2/5] scsi: ufs-mediatek: Do not gate clocks if auto-hibern8 is not entered yet https://git.kernel.org/mkp/scsi/c/9006e3986f66 [3/5] scsi: ufs-mediatek: Introduce low-power mode for device power supply https://git.kernel.org/mkp/scsi/c/488edafb1120 [4/5] scsi: ufs-mediatek: Fix unbalanced clock on/off https://git.kernel.org/mkp/scsi/c/561e3a8726b2 [5/5] scsi: ufs-mediatek: Allow unbound mphy https://git.kernel.org/mkp/scsi/c/fc4983018fea -- Martin K. Petersen Oracle Linux Engineering
[PATCH V3 2/2] dt-bindings: i2c: Convert imx i2c to json-schema
Convert the i.MX I2C binding to DT schema format using json-schema, some improvements applied, such as update example based on latest DT file, add more compatible for existing SoCs, and remove unnecessary common property "pinctrl". Signed-off-by: Anson Huang --- Changes since V2: - remove 'clock-frequency' property's type and use enum for it, ONLY support 100KHz/400KHz. - remove *-gpios's typs/description, since it is already defined in i2c-gpio.yaml. - fix space issue in example. --- Documentation/devicetree/bindings/i2c/i2c-imx.txt | 49 -- Documentation/devicetree/bindings/i2c/i2c-imx.yaml | 103 + 2 files changed, 103 insertions(+), 49 deletions(-) delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.txt create mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.txt b/Documentation/devicetree/bindings/i2c/i2c-imx.txt deleted file mode 100644 index b967544..000 --- a/Documentation/devicetree/bindings/i2c/i2c-imx.txt +++ /dev/null @@ -1,49 +0,0 @@ -* Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX - -Required properties: -- compatible : - - "fsl,imx1-i2c" for I2C compatible with the one integrated on i.MX1 SoC - - "fsl,imx21-i2c" for I2C compatible with the one integrated on i.MX21 SoC - - "fsl,vf610-i2c" for I2C compatible with the one integrated on Vybrid vf610 SoC -- reg : Should contain I2C/HS-I2C registers location and length -- interrupts : Should contain I2C/HS-I2C interrupt -- clocks : Should contain the I2C/HS-I2C clock specifier - -Optional properties: -- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. - The absence of the property indicates the default frequency 100 kHz. -- dmas: A list of two dma specifiers, one for each entry in dma-names. -- dma-names: should contain "tx" and "rx". -- scl-gpios: specify the gpio related to SCL pin -- sda-gpios: specify the gpio related to SDA pin -- pinctrl: add extra pinctrl to configure i2c pins to gpio function for i2c - bus recovery, call it "gpio" state - -Examples: - -i2c@83fc4000 { /* I2C2 on i.MX51 */ - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; - reg = <0x83fc4000 0x4000>; - interrupts = <63>; -}; - -i2c@70038000 { /* HS-I2C on i.MX51 */ - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; - reg = <0x70038000 0x4000>; - interrupts = <64>; - clock-frequency = <40>; -}; - -i2c0: i2c@40066000 { /* i2c0 on vf610 */ - compatible = "fsl,vf610-i2c"; - reg = <0x40066000 0x1000>; - interrupts =<0 71 0x04>; - dmas = < 0 50>, - < 0 51>; - dma-names = "rx","tx"; - pinctrl-names = "default", "gpio"; - pinctrl-0 = <_i2c1>; - pinctrl-1 = <_i2c1_gpio>; - scl-gpios = < 26 GPIO_ACTIVE_HIGH>; - sda-gpios = < 27 GPIO_ACTIVE_HIGH>; -}; diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml new file mode 100644 index 000..869f2ae --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml @@ -0,0 +1,103 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-imx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX + +maintainers: + - Wolfram Sang + +properties: + compatible: +oneOf: + - const: fsl,imx1-i2c + - const: fsl,imx21-i2c + - const: fsl,vf610-i2c + - items: + - const: fsl,imx35-i2c + - const: fsl,imx1-i2c + - items: + - enum: +- fsl,imx25-i2c +- fsl,imx27-i2c +- fsl,imx31-i2c +- fsl,imx50-i2c +- fsl,imx51-i2c +- fsl,imx53-i2c +- fsl,imx6q-i2c +- fsl,imx6sl-i2c +- fsl,imx6sx-i2c +- fsl,imx6sll-i2c +- fsl,imx6ul-i2c +- fsl,imx7s-i2c +- fsl,imx8mq-i2c +- fsl,imx8mm-i2c +- fsl,imx8mn-i2c +- fsl,imx8mp-i2c + - const: fsl,imx21-i2c + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +maxItems: 1 + + clock-names: +const: ipg + + clock-frequency: +enum: [ 10, 40 ] + + dmas: +items: + - description: DMA controller phandle and request line for RX + - description: DMA controller phandle and request line for TX + + dma-names: +items: + - const: rx + - const: tx + + sda-gpios: +maxItems: 1 + + scl-gpios: +maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - | +#include +#include +#include +#include + +i2c@83fc4000 { +compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; +reg = <0x83fc4000
Re: [PATCH v2 0/2] scsi: ufs: Fix and cleanup device quirks
On Fri, 12 Jun 2020 09:26:23 +0800, Stanley Chu wrote: > this series provides some device quirk fixes and cleanups. > > v1 -> v2: > - Sort device quirks in alphabetical order (Alim Akhtar) > > Stanley Chu (2): > scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices > scsi: ufs: Cleanup device vendor name and device quirk table > > [...] Applied to 5.9/scsi-queue, thanks! [1/2] scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devices https://git.kernel.org/mkp/scsi/c/c0a18ee0ce78 [2/2] scsi: ufs: Clean up device vendor name and device quirk table https://git.kernel.org/mkp/scsi/c/ed0b40ffa364 -- Martin K. Petersen Oracle Linux Engineering
Re: [RESENT PATCH v5 0/5] scsi: ufs: cleanup ufs initialization
On Wed, 3 Jun 2020 11:19:54 +0200, Bean Huo wrote: > Resent this patchset since linux-s...@vger.kernel.org and > linux-kernel@vger.kernel.org rejected my email > > > Cleanup UFS descriptor length initialization, and delete some unnecessary > code. > > Changelog: > v4 - v5: > 1. Rebased patch > 2. In the patch 3/5, change "param_size > buff_len" to >"(param_offset + param_size) > buff_len" > > [...] Applied to 5.9/scsi-queue, thanks! [1/5] scsi: ufs: Remove max_t in ufs_get_device_desc https://git.kernel.org/mkp/scsi/c/458a45f5262b [2/5] scsi: ufs: Delete ufshcd_read_desc() https://git.kernel.org/mkp/scsi/c/c4607a09450d [3/5] scsi: ufs: Fix potential NULL pointer access during memcpy https://git.kernel.org/mkp/scsi/c/cbe193f6f093 [4/5] scsi: ufs: Clean up ufs initialization path https://git.kernel.org/mkp/scsi/c/7a0bf85b5e18 [5/5] scsi: ufs: Add compatibility with 3.1 UFS unit descriptor length https://git.kernel.org/mkp/scsi/c/72fb690eece1 -- Martin K. Petersen Oracle Linux Engineering
Re: [RESEND PATCH v10 00/10] exynos-ufs: Add support for UFS HCI
On Sat, 13 Jun 2020 08:16:56 +0530, Alim Akhtar wrote: > This patch-set introduces UFS (Universal Flash Storage) host controller > support > for Samsung family SoC. Mostly, it consists of UFS PHY and host specific > driver. > > - Changes since v9 > * fixed the review comments by Rob on ufs dt bindings > * Addeded Rob's reviwed-by tag on 08/10 patch > > [...] Applied to 5.9/scsi-queue, thanks! [01/10] scsi: ufs: Add quirk to fix mishandling utrlclr/utmrlclr https://git.kernel.org/mkp/scsi/c/871838412adf [02/10] scsi: ufs: Add quirk to disallow reset of interrupt aggregation https://git.kernel.org/mkp/scsi/c/b638b5eb624b [03/10] scsi: ufs: add quirk to enable host controller without hce (no commit info) [04/10] scsi: ufs: Introduce UFSHCD_QUIRK_PRDT_BYTE_GRAN quirk https://git.kernel.org/mkp/scsi/c/26f968d7de82 [05/10] scsi: ufs: Add quirk to fix abnormal ocs fatal error https://git.kernel.org/mkp/scsi/c/d779a6e90e18 [09/10] scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs https://git.kernel.org/mkp/scsi/c/55f4b1f73631 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v5] scsi: ufs: Fix imprecise load calculation in devfreq window
On Thu, 11 Jun 2020 18:10:43 +0800, Stanley Chu wrote: > The UFS load calculation is based on "total_time" and "busy_time" in a > devfreq window. However, the source of time is different for both > parameters: "busy_time" is assigned from "jiffies" thus has different > accuracy from "total_time" which is assigned from ktime_get(). > > Besides, the time of window boundary is not exactly the same as > the starting busy time in this window if UFS is actually busy > in the beginning of the window. A similar accuracy error may also > happen for the end of busy time in current window. > > [...] Applied to 5.9/scsi-queue, thanks! [1/1] scsi: ufs: Fix imprecise load calculation in devfreq window https://git.kernel.org/mkp/scsi/c/b1bf66d1d5a8 -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3 0/2] scsi: ufs: cleanup UFS driver
On Fri, 5 Jun 2020 22:05:18 +0200, Bean Huo wrote: > Cleanup, no functional change > > Changelog: > > v2 -v3: > 1. Change SPDX-License-Identifier: GPL-2.0 to >SPDX-License-Identifier: GPL-2.0-or-later (Eric Biggers) > v1 - v2: > 1. Split patch (Tomas Winkler) > > [...] Applied to 5.9/scsi-queue, thanks! [1/2] scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplate https://git.kernel.org/mkp/scsi/c/673511199ac9 -- Martin K. Petersen Oracle Linux Engineering
RE: [PATCH V2 3/3] dt-bindings: i2c: Convert imx i2c to json-schema
Hi, Rob > Subject: Re: [PATCH V2 3/3] dt-bindings: i2c: Convert imx i2c to json-schema > > On Thu, Jun 04, 2020 at 09:49:18AM +0800, Anson Huang wrote: > > Convert the i.MX I2C binding to DT schema format using json-schema, > > some improvements applied, such as update example based on latest DT > > file, add more compatible for existing SoCs, and remove unnecessary > > common property "pinctrl". > > > > Signed-off-by: Anson Huang > > --- > > Changes since V1: > > - add "additionalProperties: false". > > --- > > Documentation/devicetree/bindings/i2c/i2c-imx.txt | 49 - > > Documentation/devicetree/bindings/i2c/i2c-imx.yaml | 119 > > + > > 2 files changed, 119 insertions(+), 49 deletions(-) delete mode > > 100644 Documentation/devicetree/bindings/i2c/i2c-imx.txt > > create mode 100644 Documentation/devicetree/bindings/i2c/i2c-imx.yaml > > > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.txt > > b/Documentation/devicetree/bindings/i2c/i2c-imx.txt > > deleted file mode 100644 > > index b967544..000 > > --- a/Documentation/devicetree/bindings/i2c/i2c-imx.txt > > +++ /dev/null > > @@ -1,49 +0,0 @@ > > -* Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for i.MX > > - > > -Required properties: > > -- compatible : > > - - "fsl,imx1-i2c" for I2C compatible with the one integrated on > > i.MX1 SoC > > - - "fsl,imx21-i2c" for I2C compatible with the one integrated on > > i.MX21 SoC > > - - "fsl,vf610-i2c" for I2C compatible with the one integrated on > > Vybrid vf610 SoC > > -- reg : Should contain I2C/HS-I2C registers location and length > > -- interrupts : Should contain I2C/HS-I2C interrupt > > -- clocks : Should contain the I2C/HS-I2C clock specifier > > - > > -Optional properties: > > -- clock-frequency : Constains desired I2C/HS-I2C bus clock frequency in Hz. > > - The absence of the property indicates the default frequency 100 kHz. > > -- dmas: A list of two dma specifiers, one for each entry in dma-names. > > -- dma-names: should contain "tx" and "rx". > > -- scl-gpios: specify the gpio related to SCL pin > > -- sda-gpios: specify the gpio related to SDA pin > > -- pinctrl: add extra pinctrl to configure i2c pins to gpio function > > for i2c > > - bus recovery, call it "gpio" state > > - > > -Examples: > > - > > -i2c@83fc4000 { /* I2C2 on i.MX51 */ > > - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; > > - reg = <0x83fc4000 0x4000>; > > - interrupts = <63>; > > -}; > > - > > -i2c@70038000 { /* HS-I2C on i.MX51 */ > > - compatible = "fsl,imx51-i2c", "fsl,imx21-i2c"; > > - reg = <0x70038000 0x4000>; > > - interrupts = <64>; > > - clock-frequency = <40>; > > -}; > > - > > -i2c0: i2c@40066000 { /* i2c0 on vf610 */ > > - compatible = "fsl,vf610-i2c"; > > - reg = <0x40066000 0x1000>; > > - interrupts =<0 71 0x04>; > > - dmas = < 0 50>, > > - < 0 51>; > > - dma-names = "rx","tx"; > > - pinctrl-names = "default", "gpio"; > > - pinctrl-0 = <_i2c1>; > > - pinctrl-1 = <_i2c1_gpio>; > > - scl-gpios = < 26 GPIO_ACTIVE_HIGH>; > > - sda-gpios = < 27 GPIO_ACTIVE_HIGH>; > > -}; > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx.yaml > > b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml > > new file mode 100644 > > index 000..63cceab > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/i2c/i2c-imx.yaml > > @@ -0,0 +1,119 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 > > +--- > > +$id: > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi > > > +cetree.org%2Fschemas%2Fi2c%2Fi2c-imx.yaml%23data=02%7C01%7C > Anson > > > +.Huang%40nxp.com%7C943043d1a28548a7fd3308d8114efd9d%7C686ea1d > 3bc2b4c6 > > > +fa92cd99c5c301635%7C0%7C0%7C637278378260012996sdata=VZfJ > %2BLVtuB > > +JOWy0e9riauncrE5UNozko4iP6tYm9y80%3Dreserved=0 > > +$schema: > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi > > > +cetree.org%2Fmeta-schemas%2Fcore.yaml%23data=02%7C01%7CAns > on.Hua > > > +ng%40nxp.com%7C943043d1a28548a7fd3308d8114efd9d%7C686ea1d3bc2 > b4c6fa92 > > > +cd99c5c301635%7C0%7C0%7C637278378260012996sdata=ABISCsw > dkJMA4ECe > > +JE7wKsgzcwZYQS1dfVrxCAecLlY%3Dreserved=0 > > + > > +title: Freescale Inter IC (I2C) and High Speed Inter IC (HS-I2C) for > > +i.MX > > + > > +maintainers: > > + - Wolfram Sang > > + > > +properties: > > + compatible: > > +oneOf: > > + - const: fsl,imx1-i2c > > + - const: fsl,imx21-i2c > > + - const: fsl,vf610-i2c > > + - items: > > + - const: fsl,imx35-i2c > > + - const: fsl,imx1-i2c > > + - items: > > + - enum: > > +- fsl,imx25-i2c > > +- fsl,imx27-i2c > > +- fsl,imx31-i2c > > +- fsl,imx50-i2c > > +- fsl,imx51-i2c > > +- fsl,imx53-i2c > > +- fsl,imx6q-i2c > > +- fsl,imx6sl-i2c > > +- fsl,imx6sx-i2c > > +- fsl,imx6sll-i2c > >
Re: [PATCH bpf 1/2] flow_dissector: reject invalid attach_flags
On Mon, Jun 15, 2020 at 7:43 AM Lorenz Bauer wrote: > > On Fri, 12 Jun 2020 at 23:36, Alexei Starovoitov > wrote: > > > > On Fri, Jun 12, 2020 at 9:02 AM Lorenz Bauer wrote: > > > > > > Using BPF_PROG_ATTACH on a flow dissector program supports neither flags > > > nor target_fd but accepts any value. Return EINVAL if either are non-zero. > > > > > > Signed-off-by: Lorenz Bauer > > > Fixes: b27f7bb590ba ("flow_dissector: Move out netns_bpf prog callbacks") > > > --- > > > kernel/bpf/net_namespace.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/kernel/bpf/net_namespace.c b/kernel/bpf/net_namespace.c > > > index 78cf061f8179..56133e78ae4f 100644 > > > --- a/kernel/bpf/net_namespace.c > > > +++ b/kernel/bpf/net_namespace.c > > > @@ -192,6 +192,9 @@ int netns_bpf_prog_attach(const union bpf_attr *attr, > > > struct bpf_prog *prog) > > > struct net *net; > > > int ret; > > > > > > + if (attr->attach_flags || attr->target_fd) > > > + return -EINVAL; > > > + > > > > In theory it makes sense, but how did you test it? > > Not properly it seems, sorry! > > > test_progs -t flow > > fails 5 tests. > > I spent today digging through this, and the issue is actually more annoying > than > I thought. BPF_PROG_DETACH for sockmap and flow_dissector ignores > attach_bpf_fd. The cgroup and lirc2 attach point use this to make sure that > the > program being detached is actually what user space expects. We actually have > tests that set attach_bpf_fd for these to attach points, which tells > me that this is > an easy mistake to make. > > Unfortunately I can't come up with a good fix that seems backportable: > - Making sockmap and flow_dissector have the same semantics as cgroup > and lirc2 requires a bunch of changes (probably a new function for sockmap) making flow dissector pass prog_fd as cg and lirc is certainly my preference. Especially since tests are passing fd user code is likely doing the same, so breakage is unlikely. Also it wasn't done that long ago, so we can backport far enough. It will remove cap_net_admin ugly check in bpf_prog_detach() which is the only exception now in cap model.
linux-next: Tree for Jun 16
Hi all, Changes since 20200615: New tree: safesetid Removed trees: c6x, cisco, leaks, md, sifive (not been updated in over a year) My fixes tree contains: 4cb4bfffe2c1 ("device_cgroup: Fix RCU list debugging warning") The drm-intel-fixes tree gained a build failure for which I reverted a commit. The vfs tree gained build failures for which I reverted a commit. Non-merge commits (relative to Linus' tree): 1123 1011 files changed, 242886 insertions(+), 15484 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 htmldocs. 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 320 trees (counting Linus' and 82 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 (a5dc8300df75 scripts/decode_stacktrace: warn when modpath is needed but is unset) Merging fixes/master (df8cb0ea9423 device_cgroup: Fix RCU list debugging warning) Merging kbuild-current/fixes (7b16994437c7 Makefile: Improve compressed debug info support detection) Merging arc-current/for-curr (9d9368e839c2 ARC: [arcompact] fix bitrot with 2 levels of interrupt) Merging arm-current/fixes (3866f217aaa8 ARM: 8977/1: ptrace: Fix mask for thumb breakpoint hook) Merging arm-soc-fixes/arm/fixes (99706d62fb50 Merge tag 'omap-for-v5.7/cpsw-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes) Merging uniphier-fixes/fixes (0e698dfa2822 Linux 5.7-rc4) Merging arm64-fixes/for-next/fixes (8dd4daa04278 arm64: mm: reset address tag set by kasan sw tagging) Merging m68k-current/for-linus (3381df095419 m68k: tools: Replace zero-length array with flexible-array member) Merging powerpc-fixes/fixes (e881bfaf5a5f KVM: PPC: Fix nested guest RC bits update) Merging s390-fixes/fixes (3d77e6a8804a Linux 5.7) Merging sparc/master (b3a9e3b9622a Linux 5.8-rc1) Merging fscrypt-current/for-stable (2b4eae95c736 fscrypt: don't evict dirty inodes after removing key) Merging net/master (c92cbaea3cc0 net: dsa: sja1105: fix PTP timestamping with large tc-taprio cycles) Merging bpf/master (b3a9e3b9622a Linux 5.8-rc1) Merging ipsec/master (a4902d914e50 xfrm: merge fixup for "remove output_finish indirection from xfrm_state_afinfo") Merging netfilter/master (c92cbaea3cc0 net: dsa: sja1105: fix PTP timestamping with large tc-taprio cycles) Merging ipvs/master (bdc48fa11e46 checkpatch/coding-style: deprecate 80-column warning) Merging wireless-drivers/master (b3a9e3b9622a Linux 5.8-rc1) Merging mac80211/master (59d4bfc1e2c0 net: fix wiki website url mac80211 and wireless files) Merging rdma-fixes/for-rc (b3a9e3b9622a Linux 5.8-rc1) Merging sound-current/for-linus (8abf41dcd1bc ALSA: usb-audio: Set 48 kHz rate for Rodecaster) Merging sound-asoc-fixes/for-linus (66425001bdaf Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus) Merging regmap-fixes/for-linus (67faf3e95a5a Merge remote-tracking branch 'regmap/for-5.8' into regmap-linus) Merging regulator-fixes/for-linus (375eadc1a0e3 Merge remote-tracking branch 'regulator/for-5.8' into regulator-linus) Merging spi-fixes/for-linus (284d6aa26be2 Merge remote-tracking branch 'spi/for-5.8' into spi-linus) Merging pci-current/for-linus (b3a9e3b9622a Linux 5.8-rc1) Merging driver-core.current/driver-core-linus (b3a9e3b9622a Linux 5.8-rc1) Merging tty.current/tty-linus (b3a9e3b9622a Linu
Re: [PATCH] scsi: ufs-bsg: Fix runtime PM imbalance on error
On Fri, 22 May 2020 12:59:29 +0800, Dinghao Liu wrote: > When ufs_bsg_alloc_desc_buffer() returns an error code, > a pairing runtime PM usage counter decrement is needed > to keep the counter balanced. Applied to 5.8/scsi-fixes, thanks! [1/1] scsi: ufs-bsg: Fix runtime PM imbalance on error https://git.kernel.org/mkp/scsi/c/a1e17eb03e69 -- Martin K. Petersen Oracle Linux Engineering
[PATCH V3] dt-bindings: mmc: Convert imx esdhc to json-schema
Convert the i.MX ESDHC binding to DT schema format using json-schema Signed-off-by: Anson Huang --- Changes since V2: - fix typo of "dealy" to "delay"; - remove unused "Several ranges could be specified." in voltage-ranges which contradicts the min/max items. --- .../devicetree/bindings/mmc/fsl-imx-esdhc.txt | 67 --- .../devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 124 + 2 files changed, 124 insertions(+), 67 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt create mode 100644 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt deleted file mode 100644 index de1b8bd..000 --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt +++ /dev/null @@ -1,67 +0,0 @@ -* Freescale Enhanced Secure Digital Host Controller (eSDHC) for i.MX - -The Enhanced Secure Digital Host Controller on Freescale i.MX family -provides an interface for MMC, SD, and SDIO types of memory cards. - -This file documents differences between the core properties described -by mmc.txt and the properties used by the sdhci-esdhc-imx driver. - -Required properties: -- compatible : Should be "fsl,-esdhc", the supported chips include - "fsl,imx25-esdhc" - "fsl,imx35-esdhc" - "fsl,imx51-esdhc" - "fsl,imx53-esdhc" - "fsl,imx6q-usdhc" - "fsl,imx6sl-usdhc" - "fsl,imx6sx-usdhc" - "fsl,imx6ull-usdhc" - "fsl,imx7d-usdhc" - "fsl,imx7ulp-usdhc" - "fsl,imx8mq-usdhc" - "fsl,imx8mm-usdhc" - "fsl,imx8mn-usdhc" - "fsl,imx8mp-usdhc" - "fsl,imx8qm-usdhc" - "fsl,imx8qxp-usdhc" - -Optional properties: -- fsl,wp-controller : Indicate to use controller internal write protection -- fsl,delay-line : Specify the number of delay cells for override mode. - This is used to set the clock delay for DLL(Delay Line) on override mode - to select a proper data sampling window in case the clock quality is not good - due to signal path is too long on the board. Please refer to eSDHC/uSDHC - chapter, DLL (Delay Line) section in RM for details. -- voltage-ranges : Specify the voltage range in case there are software - transparent level shifters on the outputs of the controller. Two cells are - required, first cell specifies minimum slot voltage (mV), second cell - specifies maximum slot voltage (mV). Several ranges could be specified. -- fsl,tuning-start-tap: Specify the start dealy cell point when send first CMD19 - in tuning procedure. -- fsl,tuning-step: Specify the increasing delay cell steps in tuning procedure. - The uSDHC use one delay cell as default increasing step to do tuning process. - This property allows user to change the tuning step to more than one delay - cells which is useful for some special boards or cards when the default - tuning step can't find the proper delay window within limited tuning retries. -- fsl,strobe-dll-delay-target: Specify the strobe dll control slave delay target. - This delay target programming host controller loopback read clock, and this - property allows user to change the delay target for the strobe input read clock. - If not use this property, driver default set the delay target to value 7. - Only eMMC HS400 mode need to take care of this property. - -Examples: - -esdhc@70004000 { - compatible = "fsl,imx51-esdhc"; - reg = <0x70004000 0x4000>; - interrupts = <1>; - fsl,wp-controller; -}; - -esdhc@70008000 { - compatible = "fsl,imx51-esdhc"; - reg = <0x70008000 0x4000>; - interrupts = <2>; - cd-gpios = < 6 0>; /* GPIO1_6 */ - wp-gpios = < 5 0>; /* GPIO1_5 */ -}; diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml new file mode 100644 index 000..75dc116 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml @@ -0,0 +1,124 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mmc/fsl-imx-esdhc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale Enhanced Secure Digital Host Controller (eSDHC) for i.MX + +maintainers: + - Shawn Guo + +allOf: + - $ref: "mmc-controller.yaml" + +description: | + The Enhanced Secure Digital Host Controller on Freescale i.MX family + provides an interface for MMC, SD, and SDIO types of memory cards. + + This file documents differences between the core properties described + by mmc.txt and the properties used by the sdhci-esdhc-imx driver. + +properties: + compatible: +enum: + - fsl,imx25-esdhc + - fsl,imx35-esdhc + - fsl,imx51-esdhc + - fsl,imx53-esdhc + -
Re: linux-next: build failures after merge of the vfs tree
On Tue, Jun 16, 2020 at 11:05:02AM +1000, Herbert Xu wrote: > On Tue, Jun 16, 2020 at 10:34:40AM +1000, Stephen Rothwell wrote: > > [Just adding Herbert to cc] > > > > On Tue, 16 Jun 2020 10:33:30 +1000 Stephen Rothwell > > wrote: > > > > > > Hi all, > > > > > > After merging the vfs tree, today's linux-next build (x86_64 allmodconfig) > > > failed like this: > > Thanks Stephen, here is an incremental patch to fix these up. Folded and pushed
Re: [PATCH][RFC] PM / s2idle: Clear _TIF_POLLING_NRFLAG before suspend to idle
On Mon, Jun 15, 2020 at 09:31:54PM +0200, Peter Zijlstra wrote: > On Mon, Jun 15, 2020 at 08:40:41PM +0200, Peter Zijlstra wrote: > > > > @@ -186,8 +187,10 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, > > > struct cpuidle_device *dev) > > >* be frozen safely. > > >*/ > > > index = find_deepest_state(drv, dev, U64_MAX, 0, true); > > > - if (index > 0) > > > + if (index > 0) { > > > + __current_clr_polling(); > > > enter_s2idle_proper(drv, dev, index); > > > + } > > > > > > return index; > > > } > > > > So how is that commit 08e237fa56a1 not suffient? That makes > > mwait_idle_with_hints() DTRT for this 'functionally challenged' piece of > > hardware. > > > > AFAICT intel_enter_s2idle() uses mwait_idle_with_hints(). > > > > What am I missing? > > What's missing is that cpuidle_enter_s2idle() doesn't properly match > call_cpuidle(). > Right. > Something like so then. Your version is racy, if someone already set > TIF_NEED_RESCHED you just clear POLLING and go to sleep. > Got it, I'll test the patch below. Thanks, Chenyu > --- > > diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c > index c149d9e20dfd..81bee8d03c6d 100644 > --- a/drivers/cpuidle/cpuidle.c > +++ b/drivers/cpuidle/cpuidle.c > @@ -133,8 +133,8 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv, > } > > #ifdef CONFIG_SUSPEND > -static void enter_s2idle_proper(struct cpuidle_driver *drv, > - struct cpuidle_device *dev, int index) > +static void s2idle_enter(struct cpuidle_driver *drv, > + struct cpuidle_device *dev, int index) > { > ktime_t time_start, time_end; > > @@ -168,6 +168,15 @@ static void enter_s2idle_proper(struct cpuidle_driver > *drv, > dev->states_usage[index].s2idle_usage++; > } > > +static int call_s2idle(struct cpuidle_driver *drv, struct cpuidle_device > *dev, > +int index) > +{ > + if (!current_clr_polling_and_test()) > + s2idle_enter(drv, dev, index); > + > + return index; > +} > + > /** > * cpuidle_enter_s2idle - Enter an idle state suitable for suspend-to-idle. > * @drv: cpuidle driver for the given CPU. > @@ -187,7 +196,7 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, > struct cpuidle_device *dev) >*/ > index = find_deepest_state(drv, dev, U64_MAX, 0, true); > if (index > 0) > - enter_s2idle_proper(drv, dev, index); > + call_s2idle(drv, dev, index); > > return index; > }
[tip:x86/cleanups] BUILD SUCCESS 28b60197b573cd0b2d8f0ded56a5441c6147af14
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/cleanups branch HEAD: 28b60197b573cd0b2d8f0ded56a5441c6147af14 x86/asm: Unify __ASSEMBLY__ blocks elapsed time: 482m configs tested: 107 configs skipped: 1 The following configs have been built successfully. More configs may be tested in the coming days. arm defconfig arm allyesconfig arm allmodconfig arm allnoconfig arm64allyesconfig arm64 defconfig arm64allmodconfig arm64 allnoconfig arm axm55xx_defconfig mips bigsur_defconfig mips bmips_stb_defconfig c6x allyesconfig shmigor_defconfig arm pxa_defconfig um x86_64_defconfig mips pic32mzda_defconfig arm versatile_defconfig ia64 gensparse_defconfig i386 allnoconfig i386 allyesconfig i386defconfig i386 debian-10.3 ia64 allmodconfig ia64defconfig ia64 allnoconfig ia64 allyesconfig m68k allmodconfig m68k allnoconfig m68k sun3_defconfig m68kdefconfig m68k allyesconfig nios2 defconfig nios2allyesconfig openriscdefconfig c6x allnoconfig openrisc allyesconfig nds32 defconfig nds32 allnoconfig csky allyesconfig cskydefconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig h8300allmodconfig xtensa defconfig arc defconfig arc allyesconfig sh allmodconfig shallnoconfig microblazeallnoconfig mips allyesconfig mips allnoconfig mips allmodconfig pariscallnoconfig parisc defconfig parisc allyesconfig parisc allmodconfig powerpc defconfig powerpc allyesconfig powerpc rhel-kconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a006-20200615 i386 randconfig-a002-20200615 i386 randconfig-a001-20200615 i386 randconfig-a004-20200615 i386 randconfig-a005-20200615 i386 randconfig-a003-20200615 x86_64 randconfig-a015-20200615 x86_64 randconfig-a011-20200615 x86_64 randconfig-a016-20200615 x86_64 randconfig-a012-20200615 x86_64 randconfig-a014-20200615 x86_64 randconfig-a013-20200615 i386 randconfig-a015-20200615 i386 randconfig-a011-20200615 i386 randconfig-a014-20200615 i386 randconfig-a013-20200615 i386 randconfig-a016-20200615 i386 randconfig-a012-20200615 riscvallyesconfig riscv allnoconfig riscv defconfig riscvallmodconfig s390 allyesconfig s390 allnoconfig s390 allmodconfig s390defconfig sparcallyesconfig sparc defconfig sparc64 defconfig sparc64 allnoconfig sparc64 allyesconfig sparc64 allmodconfig um allmodconfig umallnoconfig um allyesconfig um defconfig x86_64 rhel-7.6 x86_64rhel-7.6-kselftests x86_64
Re: [PATCH v4 1/3] mm/slab: Use memzero_explicit() in kzfree()
On Mon, Jun 15, 2020 at 09:57:16PM -0400, Waiman Long wrote: > The kzfree() function is normally used to clear some sensitive > information, like encryption keys, in the buffer before freeing it back > to the pool. Memset() is currently used for the buffer clearing. However, > it is entirely possible that the compiler may choose to optimize away the > memory clearing especially if LTO is being used. To make sure that this > optimization will not happen, memzero_explicit(), which is introduced > in v3.18, is now used in kzfree() to do the clearing. > > Fixes: 3ef0e5ba4673 ("slab: introduce kzfree()") > Cc: sta...@vger.kernel.org > Signed-off-by: Waiman Long > --- > mm/slab_common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/slab_common.c b/mm/slab_common.c > index 9e72ba224175..37d48a56431d 100644 > --- a/mm/slab_common.c > +++ b/mm/slab_common.c > @@ -1726,7 +1726,7 @@ void kzfree(const void *p) > if (unlikely(ZERO_OR_NULL_PTR(mem))) > return; > ks = ksize(mem); > - memset(mem, 0, ks); > + memzero_explicit(mem, ks); > kfree(mem); > } > EXPORT_SYMBOL(kzfree); This is a good change, but the commit message isn't really accurate. AFAIK, no one has found any case where this memset() gets optimized out. And even with LTO, it would be virtually impossible due to all the synchronization and global data structures that kfree() uses. (Remember that this isn't the C standard function "free()", so the compiler can't assign it any special meaning.) Not to mention that LTO support isn't actually upstream yet. I still agree with the change, but it might be helpful if the commit message were honest that this is really a hardening measure and about properly conveying the intent. As-is this sounds like a critical fix, which might confuse people. - Eric
[PATCH v4 00/11] Add seccomp notifier ioctl that enables adding fds
Hello! This is a bit of thread-merge between [1] and [2]. tl;dr: add a way for a seccomp user_notif process manager to inject files into the managed process in order to handle emulation of various fd-returning syscalls across security boundaries. Containers folks and Chrome are in need of the feature, and investigating this solution uncovered (and fixed) implementation issues with existing file sending routines. I intend to carry this in the seccomp tree, unless someone has objections. :) Please review and test! -Kees [1] https://lore.kernel.org/lkml/20200603011044.7972-1-sar...@sargun.me/ [2] https://lore.kernel.org/lkml/20200610045214.1175600-1-keesc...@chromium.org/ Kees Cook (9): net/scm: Regularize compat handling of scm_detach_fds() fs: Move __scm_install_fd() to __fd_install_received() fs: Add fd_install_received() wrapper for __fd_install_received() pidfd: Replace open-coded partial fd_install_received() fs: Expand __fd_install_received() to accept fd selftests/seccomp: Make kcmp() less required selftests/seccomp: Rename user_trap_syscall() to user_notif_syscall() seccomp: Switch addfd to Extensible Argument ioctl seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID Sargun Dhillon (2): seccomp: Introduce addfd ioctl to seccomp user notifier selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD fs/file.c | 65 include/linux/file.h | 16 + include/uapi/linux/seccomp.h | 25 +- kernel/pid.c | 11 +- kernel/seccomp.c | 181 - net/compat.c | 55 ++- net/core/scm.c| 50 +-- tools/testing/selftests/seccomp/seccomp_bpf.c | 350 +++--- 8 files changed, 618 insertions(+), 135 deletions(-) -- 2.25.1
[PATCH v4 09/11] selftests/seccomp: Rename user_trap_syscall() to user_notif_syscall()
The user_trap_syscall() helper creates a filter with SECCOMP_RET_USER_NOTIF. To avoid confusion with SECCOMP_RET_TRAP, rename the helper to user_notif_syscall(). Additionally fix a redundant "return" after XFAIL. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 60 +-- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 40ed846744e4..95b134933831 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -3110,10 +3110,8 @@ TEST(get_metadata) long ret; /* Only real root can get metadata. */ - if (geteuid()) { - XFAIL(return, "get_metadata requires real root"); - return; - } + if (geteuid()) + XFAIL(return, "get_metadata test requires real root"); ASSERT_EQ(0, pipe(pipefd)); @@ -3170,7 +3168,7 @@ TEST(get_metadata) ASSERT_EQ(0, kill(pid, SIGKILL)); } -static int user_trap_syscall(int nr, unsigned int flags) +static int user_notif_syscall(int nr, unsigned int flags) { struct sock_filter filter[] = { BPF_STMT(BPF_LD+BPF_W+BPF_ABS, @@ -3216,7 +3214,7 @@ TEST(user_notification_basic) /* Check that we get -ENOSYS with no listener attached */ if (pid == 0) { - if (user_trap_syscall(__NR_getppid, 0) < 0) + if (user_notif_syscall(__NR_getppid, 0) < 0) exit(1); ret = syscall(__NR_getppid); exit(ret >= 0 || errno != ENOSYS); @@ -3233,13 +3231,13 @@ TEST(user_notification_basic) EXPECT_EQ(seccomp(SECCOMP_SET_MODE_FILTER, 0, ), 0); /* Check that the basic notification machinery works */ - listener = user_trap_syscall(__NR_getppid, -SECCOMP_FILTER_FLAG_NEW_LISTENER); + listener = user_notif_syscall(__NR_getppid, + SECCOMP_FILTER_FLAG_NEW_LISTENER); ASSERT_GE(listener, 0); /* Installing a second listener in the chain should EBUSY */ - EXPECT_EQ(user_trap_syscall(__NR_getppid, - SECCOMP_FILTER_FLAG_NEW_LISTENER), + EXPECT_EQ(user_notif_syscall(__NR_getppid, +SECCOMP_FILTER_FLAG_NEW_LISTENER), -1); EXPECT_EQ(errno, EBUSY); @@ -3303,12 +3301,12 @@ TEST(user_notification_with_tsync) /* these were exclusive */ flags = SECCOMP_FILTER_FLAG_NEW_LISTENER | SECCOMP_FILTER_FLAG_TSYNC; - ASSERT_EQ(-1, user_trap_syscall(__NR_getppid, flags)); + ASSERT_EQ(-1, user_notif_syscall(__NR_getppid, flags)); ASSERT_EQ(EINVAL, errno); /* but now they're not */ flags |= SECCOMP_FILTER_FLAG_TSYNC_ESRCH; - ret = user_trap_syscall(__NR_getppid, flags); + ret = user_notif_syscall(__NR_getppid, flags); close(ret); ASSERT_LE(0, ret); } @@ -3326,8 +3324,8 @@ TEST(user_notification_kill_in_middle) TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!"); } - listener = user_trap_syscall(__NR_getppid, -SECCOMP_FILTER_FLAG_NEW_LISTENER); + listener = user_notif_syscall(__NR_getppid, + SECCOMP_FILTER_FLAG_NEW_LISTENER); ASSERT_GE(listener, 0); /* @@ -3380,8 +3378,8 @@ TEST(user_notification_signal) ASSERT_EQ(socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair), 0); - listener = user_trap_syscall(__NR_gettid, -SECCOMP_FILTER_FLAG_NEW_LISTENER); + listener = user_notif_syscall(__NR_gettid, + SECCOMP_FILTER_FLAG_NEW_LISTENER); ASSERT_GE(listener, 0); pid = fork(); @@ -3450,8 +3448,8 @@ TEST(user_notification_closed_listener) TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!"); } - listener = user_trap_syscall(__NR_getppid, -SECCOMP_FILTER_FLAG_NEW_LISTENER); + listener = user_notif_syscall(__NR_getppid, + SECCOMP_FILTER_FLAG_NEW_LISTENER); ASSERT_GE(listener, 0); /* @@ -3484,8 +3482,8 @@ TEST(user_notification_child_pid_ns) ASSERT_EQ(unshare(CLONE_NEWUSER | CLONE_NEWPID), 0); - listener = user_trap_syscall(__NR_getppid, -SECCOMP_FILTER_FLAG_NEW_LISTENER); + listener = user_notif_syscall(__NR_getppid, + SECCOMP_FILTER_FLAG_NEW_LISTENER); ASSERT_GE(listener, 0); pid = fork(); @@ -3524,8 +3522,8 @@ TEST(user_notification_sibling_pid_ns) TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!"); } -
[PATCH v4 08/11] selftests/seccomp: Make kcmp() less required
The seccomp tests are a bit noisy without CONFIG_CHECKPOINT_RESTORE (due to missing the kcmp() syscall). The seccomp tests are more accurate with kcmp(), but it's not strictly required. Refactor the tests to use alternatives (comparing fd numbers), and provide a central test for kcmp() so there is a single XFAIL instead of many. Continue to produce warnings for the other tests, though. Additionally adds some more bad flag EINVAL tests to the addfd selftest. Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 100 +++--- 1 file changed, 64 insertions(+), 36 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index c4e264b37c30..40ed846744e4 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -258,6 +258,27 @@ int seccomp(unsigned int op, unsigned int flags, void *args) #define SIBLING_EXIT_FAILURE 0xbadface #define SIBLING_EXIT_NEWPRIVS 0xbadfeed +static int filecmp(pid_t pid1, pid_t pid2, int fd1, int fd2) +{ +#ifdef __NR_kcmp + errno = 0; + return syscall(__NR_kcmp, pid1, pid2, KCMP_FILE, fd1, fd2); +#else + errno = ENOSYS; + return -1; +#endif +} + +TEST(kcmp) +{ + int ret; + + ret = filecmp(getpid(), getpid(), 1, 1); + EXPECT_EQ(ret, 0); + if (ret != 0 && errno == ENOSYS) + XFAIL(return, "Kernel does not support kcmp() (missing CONFIG_CHECKPOINT_RESTORE?)"); +} + TEST(mode_strict_support) { long ret; @@ -3606,16 +3627,6 @@ TEST(seccomp_get_notif_sizes) EXPECT_EQ(sizes.seccomp_notif_resp, sizeof(struct seccomp_notif_resp)); } -static int filecmp(pid_t pid1, pid_t pid2, int fd1, int fd2) -{ -#ifdef __NR_kcmp - return syscall(__NR_kcmp, pid1, pid2, KCMP_FILE, fd1, fd2); -#else - errno = ENOSYS; - return -1; -#endif -} - TEST(user_notification_continue) { pid_t pid; @@ -3640,20 +3651,20 @@ TEST(user_notification_continue) int dup_fd, pipe_fds[2]; pid_t self; - ret = pipe(pipe_fds); - if (ret < 0) - exit(1); + ASSERT_GE(pipe(pipe_fds), 0); dup_fd = dup(pipe_fds[0]); - if (dup_fd < 0) - exit(1); + ASSERT_GE(dup_fd, 0); + EXPECT_NE(pipe_fds[0], dup_fd); self = getpid(); - ret = filecmp(self, self, pipe_fds[0], dup_fd); - if (ret) - exit(2); - + if (ret != 0) { + if (ret < 0 && errno == ENOSYS) { + TH_LOG("kcmp() syscall missing (test is less accurate)"); + } else + ASSERT_EQ(ret, 0); + } exit(0); } @@ -3700,12 +3711,7 @@ TEST(user_notification_continue) skip: EXPECT_EQ(waitpid(pid, , 0), pid); EXPECT_EQ(true, WIFEXITED(status)); - EXPECT_EQ(0, WEXITSTATUS(status)) { - if (WEXITSTATUS(status) == 2) { - XFAIL(return, "Kernel does not support kcmp() syscall"); - return; - } - } + EXPECT_EQ(0, WEXITSTATUS(status)); } TEST(user_notification_filter_empty) @@ -3847,7 +3853,7 @@ TEST(user_notification_sendfd) { pid_t pid; long ret; - int status, listener, memfd; + int status, listener, memfd, fd; struct seccomp_notif_addfd addfd = {}; struct seccomp_notif req = {}; struct seccomp_notif_resp resp = {}; @@ -3880,34 +3886,56 @@ TEST(user_notification_sendfd) addfd.size = sizeof(addfd); addfd.srcfd = memfd; - addfd.newfd_flags = O_CLOEXEC; addfd.newfd = 0; addfd.id = req.id; - addfd.flags = 0xff; + addfd.flags = 0; + + /* Verify bad newfd_flags cannot be set */ + addfd.newfd_flags = ~O_CLOEXEC; + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), -1); + EXPECT_EQ(errno, EINVAL); + addfd.newfd_flags = O_CLOEXEC; /* Verify bad flags cannot be set */ + addfd.flags = 0xff; EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), -1); EXPECT_EQ(errno, EINVAL); + addfd.flags = 0; /* Verify that remote_fd cannot be set without setting flags */ - addfd.flags = 0; addfd.newfd = 1; EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), -1); EXPECT_EQ(errno, EINVAL); - - /* Verify we can set an arbitrary remote fd */ addfd.newfd = 0; - ret = ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ); - EXPECT_GE(ret, 0); - EXPECT_EQ(filecmp(getpid(), pid, memfd, ret), 0); + /* Verify we can set an arbitrary remote fd */ + fd = ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ); + /* +
[PATCH v4 07/11] selftests/seccomp: Test SECCOMP_IOCTL_NOTIF_ADDFD
From: Sargun Dhillon Test whether we can add file descriptors in response to notifications. This injects the file descriptors via notifications, and then uses kcmp to determine whether or not it has been successful. It also includes some basic sanity checking for arguments. Signed-off-by: Sargun Dhillon Link: https://lore.kernel.org/r/20200603011044.7972-5-sar...@sargun.me Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 188 ++ 1 file changed, 188 insertions(+) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 402ccb3a4e52..c4e264b37c30 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -168,7 +169,9 @@ struct seccomp_metadata { #ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3) +#endif +#ifndef SECCOMP_RET_USER_NOTIF #define SECCOMP_RET_USER_NOTIF 0x7fc0U #define SECCOMP_IOC_MAGIC '!' @@ -204,6 +207,24 @@ struct seccomp_notif_sizes { }; #endif +#ifndef SECCOMP_IOCTL_NOTIF_ADDFD +/* On success, the return value is the remote process's added fd number */ +#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \ + struct seccomp_notif_addfd) + +/* valid flags for seccomp_notif_addfd */ +#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */ + +struct seccomp_notif_addfd { + __u64 size; + __u64 id; + __u32 flags; + __u32 srcfd; + __u32 newfd; + __u32 newfd_flags; +}; +#endif + #ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY #define PTRACE_EVENTMSG_SYSCALL_ENTRY 1 #define PTRACE_EVENTMSG_SYSCALL_EXIT 2 @@ -3822,6 +3843,173 @@ TEST(user_notification_filter_empty_threaded) EXPECT_GT((pollfd.revents & POLLHUP) ?: 0, 0); } +TEST(user_notification_sendfd) +{ + pid_t pid; + long ret; + int status, listener, memfd; + struct seccomp_notif_addfd addfd = {}; + struct seccomp_notif req = {}; + struct seccomp_notif_resp resp = {}; + /* 100 ms */ + struct timespec delay = { .tv_nsec = 1 }; + + memfd = memfd_create("test", 0); + ASSERT_GE(memfd, 0); + + ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0); + ASSERT_EQ(0, ret) { + TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!"); + } + + /* Check that the basic notification machinery works */ + listener = user_trap_syscall(__NR_getppid, +SECCOMP_FILTER_FLAG_NEW_LISTENER); + ASSERT_GE(listener, 0); + + pid = fork(); + ASSERT_GE(pid, 0); + + if (pid == 0) { + if (syscall(__NR_getppid) != USER_NOTIF_MAGIC) + exit(1); + exit(syscall(__NR_getppid) != USER_NOTIF_MAGIC); + } + + ASSERT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, ), 0); + + addfd.size = sizeof(addfd); + addfd.srcfd = memfd; + addfd.newfd_flags = O_CLOEXEC; + addfd.newfd = 0; + addfd.id = req.id; + addfd.flags = 0xff; + + /* Verify bad flags cannot be set */ + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), -1); + EXPECT_EQ(errno, EINVAL); + + /* Verify that remote_fd cannot be set without setting flags */ + addfd.flags = 0; + addfd.newfd = 1; + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), -1); + EXPECT_EQ(errno, EINVAL); + + /* Verify we can set an arbitrary remote fd */ + addfd.newfd = 0; + + ret = ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ); + EXPECT_GE(ret, 0); + EXPECT_EQ(filecmp(getpid(), pid, memfd, ret), 0); + + /* Verify we can set a specific remote fd */ + addfd.newfd = 42; + addfd.flags = SECCOMP_ADDFD_FLAG_SETFD; + + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ), 42); + EXPECT_EQ(filecmp(getpid(), pid, memfd, 42), 0); + + resp.id = req.id; + resp.error = 0; + resp.val = USER_NOTIF_MAGIC; + + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_SEND, ), 0); + + /* +* This sets the ID of the ADD FD to the last request plus 1. The +* notification ID increments 1 per notification. +*/ + addfd.id = req.id + 1; + + /* This spins until the underlying notification is generated */ + while (ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, ) != -1 && + errno != -EINPROGRESS) + nanosleep(, NULL); + + memset(, 0, sizeof(req)); + ASSERT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_RECV, ), 0); + ASSERT_EQ(addfd.id, req.id); + + resp.id = req.id; + resp.error = 0; + resp.val = USER_NOTIF_MAGIC; + EXPECT_EQ(ioctl(listener, SECCOMP_IOCTL_NOTIF_SEND, ), 0); +
[PATCH v4 05/11] fs: Expand __fd_install_received() to accept fd
Expand __fd_install_received() with support for replace_fd() for the coming seccomp "addfd" ioctl(). Add new wrapper fd_replace_received() for the new mode and update existing wrappers to retain old mode. Signed-off-by: Kees Cook --- fs/file.c| 22 -- include/linux/file.h | 10 +++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/fs/file.c b/fs/file.c index 14a8ef74efb2..b583e7c60571 100644 --- a/fs/file.c +++ b/fs/file.c @@ -950,8 +950,8 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) * * Returns newly install fd or -ve on error. */ -int __fd_install_received(struct file *file, bool ufd_required, int __user *ufd, - unsigned int o_flags) +int __fd_install_received(int fd, struct file *file, bool ufd_required, + int __user *ufd, unsigned int o_flags) { struct socket *sock; int new_fd; @@ -961,9 +961,11 @@ int __fd_install_received(struct file *file, bool ufd_required, int __user *ufd, if (error) return error; - new_fd = get_unused_fd_flags(o_flags); - if (new_fd < 0) - return new_fd; + if (fd < 0) { + new_fd = get_unused_fd_flags(o_flags); + if (new_fd < 0) + return new_fd; + } if (ufd_required) { error = put_user(new_fd, ufd); @@ -973,6 +975,15 @@ int __fd_install_received(struct file *file, bool ufd_required, int __user *ufd, } } + if (fd < 0) + fd_install(new_fd, get_file(file)); + else { + new_fd = fd; + error = replace_fd(new_fd, file, o_flags); + if (error) + return error; + } + /* Bump the usage count and install the file. The resulting value of * "error" is ignored here since we only need to take action when * the file is a socket and testing "sock" for NULL is sufficient. @@ -982,7 +993,6 @@ int __fd_install_received(struct file *file, bool ufd_required, int __user *ufd, sock_update_netprioidx(>sk->sk_cgrp_data); sock_update_classid(>sk->sk_cgrp_data); } - fd_install(new_fd, get_file(file)); return new_fd; } diff --git a/include/linux/file.h b/include/linux/file.h index 999a2c56db07..f1d16e24a12e 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -91,16 +91,20 @@ extern void put_unused_fd(unsigned int fd); extern void fd_install(unsigned int fd, struct file *file); -extern int __fd_install_received(struct file *file, bool ufd_required, +extern int __fd_install_received(int fd, struct file *file, bool ufd_required, int __user *ufd, unsigned int o_flags); static inline int fd_install_received_user(struct file *file, int __user *ufd, unsigned int o_flags) { - return __fd_install_received(file, true, ufd, o_flags); + return __fd_install_received(-1, file, true, ufd, o_flags); } static inline int fd_install_received(struct file *file, unsigned int o_flags) { - return __fd_install_received(file, false, NULL, o_flags); + return __fd_install_received(-1, file, false, NULL, o_flags); +} +static inline int fd_replace_received(int fd, struct file *file, unsigned int o_flags) +{ + return __fd_install_received(fd, file, false, NULL, o_flags); } extern void flush_delayed_fput(void); -- 2.25.1
RE: [PATCH] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync
[AMD Official Use Only - Internal Distribution Only] Acked-by: Evan Quan -Original Message- From: amd-gfx On Behalf Of Aditya Pakki Sent: Sunday, June 14, 2020 10:21 AM To: pakki...@umn.edu Cc: wu000...@umn.edu; David Airlie ; k...@umn.edu; linux-kernel@vger.kernel.org; amd-...@lists.freedesktop.org; dri-de...@lists.freedesktop.org; Daniel Vetter ; Deucher, Alexander ; Koenig, Christian Subject: [PATCH] drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error. Signed-off-by: Aditya Pakki --- drivers/gpu/drm/radeon/radeon_display.c | 4 +++- drivers/gpu/drm/radeon/radeon_drv.c | 4 +++- drivers/gpu/drm/radeon/radeon_kms.c | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 35db79a168bf..df1a7eb73651 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -635,8 +635,10 @@ radeon_crtc_set_config(struct drm_mode_set *set, dev = set->crtc->dev; ret = pm_runtime_get_sync(dev->dev); -if (ret < 0) +if (ret < 0) { +pm_runtime_put_autosuspend(dev->dev); return ret; +} ret = drm_crtc_helper_set_config(set, ctx); diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index bbb0883e8ce6..62b5069122cc 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -549,8 +549,10 @@ long radeon_drm_ioctl(struct file *filp, long ret; dev = file_priv->minor->dev; ret = pm_runtime_get_sync(dev->dev); -if (ret < 0) +if (ret < 0) { +pm_runtime_put_autosuspend(dev->dev); return ret; +} ret = drm_ioctl(filp, cmd, arg); diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index c5d1dc9618a4..99ee60f8b604 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -638,8 +638,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) file_priv->driver_priv = NULL; r = pm_runtime_get_sync(dev->dev); -if (r < 0) +if (r < 0) { +pm_runtime_put_autosuspend(dev->dev); return r; +} /* new gpu have virtual address space support */ if (rdev->family >= CHIP_CAYMAN) { -- 2.25.1 ___ amd-gfx mailing list amd-...@lists.freedesktop.org https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfxdata=02%7C01%7Cevan.quan%40amd.com%7Cc86101e02ef24c52b36408d810fdcc14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278029582429567sdata=qtKTCV33q8l2GTxMUX0nlJ4fV32dXaLH7y6hymksQEo%3Dreserved=0
[PATCH v4 03/11] fs: Add fd_install_received() wrapper for __fd_install_received()
For both pidfd and seccomp, the __user pointer is not used. Update __fd_install_received() to make writing to ufd optional. (ufd itself cannot checked for NULL because this changes the SCM_RIGHTS interface behavior.) In these cases, the new fd needs to be returned on success. Update the existing callers to handle it. Add new wrapper fd_install_received() for pidfd and seccomp that does not use the ufd argument. Signed-off-by: Kees Cook --- fs/file.c| 26 +- include/linux/file.h | 10 +++--- net/compat.c | 2 +- net/core/scm.c | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/fs/file.c b/fs/file.c index fcfddae0d252..14a8ef74efb2 100644 --- a/fs/file.c +++ b/fs/file.c @@ -944,11 +944,14 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) * @o_flags: the O_* flags to apply to the new fd entry * * Installs a received file into the file descriptor table, with appropriate - * checks and count updates. Optionally writes the fd number to userspace. + * checks and count updates. Optionally writes the fd number to userspace, if + * @ufd_required is true (@ufd cannot just be tested for NULL because NULL may + * actually get passed into SCM_RIGHTS). * - * Returns -ve on error. + * Returns newly install fd or -ve on error. */ -int __fd_install_received(struct file *file, int __user *ufd, unsigned int o_flags) +int __fd_install_received(struct file *file, bool ufd_required, int __user *ufd, + unsigned int o_flags) { struct socket *sock; int new_fd; @@ -962,20 +965,25 @@ int __fd_install_received(struct file *file, int __user *ufd, unsigned int o_fla if (new_fd < 0) return new_fd; - error = put_user(new_fd, ufd); - if (error) { - put_unused_fd(new_fd); - return error; + if (ufd_required) { + error = put_user(new_fd, ufd); + if (error) { + put_unused_fd(new_fd); + return error; + } } - /* Bump the usage count and install the file. */ + /* Bump the usage count and install the file. The resulting value of +* "error" is ignored here since we only need to take action when +* the file is a socket and testing "sock" for NULL is sufficient. +*/ sock = sock_from_file(file, ); if (sock) { sock_update_netprioidx(>sk->sk_cgrp_data); sock_update_classid(>sk->sk_cgrp_data); } fd_install(new_fd, get_file(file)); - return 0; + return new_fd; } static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags) diff --git a/include/linux/file.h b/include/linux/file.h index fe18a1a0d555..999a2c56db07 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -91,12 +91,16 @@ extern void put_unused_fd(unsigned int fd); extern void fd_install(unsigned int fd, struct file *file); -extern int __fd_install_received(struct file *file, int __user *ufd, -unsigned int o_flags); +extern int __fd_install_received(struct file *file, bool ufd_required, +int __user *ufd, unsigned int o_flags); static inline int fd_install_received_user(struct file *file, int __user *ufd, unsigned int o_flags) { - return __fd_install_received(file, ufd, o_flags); + return __fd_install_received(file, true, ufd, o_flags); +} +static inline int fd_install_received(struct file *file, unsigned int o_flags) +{ + return __fd_install_received(file, false, NULL, o_flags); } extern void flush_delayed_fput(void); diff --git a/net/compat.c b/net/compat.c index 94f288e8dac5..71494337cca7 100644 --- a/net/compat.c +++ b/net/compat.c @@ -299,7 +299,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm) for (i = 0; i < fdmax; i++) { err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, o_flags); - if (err) + if (err < 0) break; } diff --git a/net/core/scm.c b/net/core/scm.c index df190f1fdd28..b9a0442ebd26 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -307,7 +307,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) for (i = 0; i < fdmax; i++) { err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, o_flags); - if (err) + if (err < 0) break; } -- 2.25.1
[PATCH v4 11/11] seccomp: Fix ioctl number for SECCOMP_IOCTL_NOTIF_ID_VALID
When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced it had the wrong direction flag set. While this isn't a big deal as nothing currently enforces these bits in the kernel, it should be defined correctly. Fix the define and provide support for the old command until it is no longer needed for backward compatibility. Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace") Cc: sta...@vger.kernel.org Signed-off-by: Kees Cook --- include/uapi/linux/seccomp.h | 2 +- kernel/seccomp.c | 9 + tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h index 473a61695ac3..6ba18b82a02e 100644 --- a/include/uapi/linux/seccomp.h +++ b/include/uapi/linux/seccomp.h @@ -142,7 +142,7 @@ struct seccomp_notif_addfd { #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ struct seccomp_notif_resp) -#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) +#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) /* On success, the return value is the remote process's added fd number */ #define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \ struct seccomp_notif_addfd) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 9660abf91135..61e556bca338 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -43,6 +43,14 @@ #include #include +/* + * When SECCOMP_IOCTL_NOTIF_ID_VALID was first introduced, it had the + * wrong direction flag in the ioctl number. This is the broken one, + * which the kernel needs to keep supporting until all userspaces stop + * using the wrong command number. + */ +#define SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR SECCOMP_IOR(2, __u64) + enum notify_state { SECCOMP_NOTIFY_INIT, SECCOMP_NOTIFY_SENT, @@ -1397,6 +1405,7 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, return seccomp_notify_recv(filter, buf); case SECCOMP_IOCTL_NOTIF_SEND: return seccomp_notify_send(filter, buf); + case SECCOMP_IOCTL_NOTIF_ID_VALID_WRONG_DIR: case SECCOMP_IOCTL_NOTIF_ID_VALID: return seccomp_notify_id_valid(filter, buf); } diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index cf1480e498ea..403c6d0f149e 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -184,7 +184,7 @@ struct seccomp_metadata { #define SECCOMP_IOCTL_NOTIF_RECV SECCOMP_IOWR(0, struct seccomp_notif) #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ struct seccomp_notif_resp) -#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) +#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOW(2, __u64) struct seccomp_notif { __u64 id; -- 2.25.1
[PATCH v4 01/11] net/scm: Regularize compat handling of scm_detach_fds()
Duplicate the cleanups from commit 2618d530dd8b ("net/scm: cleanup scm_detach_fds") into the compat code. Move the check added in commit 1f466e1f15cf ("net: cleanly handle kernel vs user buffers for ->msg_control") to before the compat call, even though it should be impossible for an in-kernel call to also be compat. Correct the int "flags" argument to unsigned int to match fd_install() and similar APIs. Regularize any remaining differences, including a whitespace issue, a checkpatch warning, and add the check from commit 6900317f5eff ("net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds") which fixed an overflow unique to 64-bit. To avoid confusion when comparing the compat handler to the native handler, just include the same check in the compat handler. Fixes: 48a87cc26c13 ("net: netprio: fd passed in SCM_RIGHTS datagram not set correctly") Fixes: d84295067fc7 ("net: net_cls: fd passed in SCM_RIGHTS datagram not set correctly") Signed-off-by: Kees Cook --- include/net/scm.h | 1 + net/compat.c | 55 +-- net/core/scm.c| 18 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/include/net/scm.h b/include/net/scm.h index 1ce365f4c256..581a94d6c613 100644 --- a/include/net/scm.h +++ b/include/net/scm.h @@ -37,6 +37,7 @@ struct scm_cookie { #endif }; +int __scm_install_fd(struct file *file, int __user *ufd, unsigned int o_flags); void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); diff --git a/net/compat.c b/net/compat.c index 5e3041a2c37d..27d477fdcaa0 100644 --- a/net/compat.c +++ b/net/compat.c @@ -281,39 +281,31 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat return 0; } -void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) +static int scm_max_fds_compat(struct msghdr *msg) { - struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control; - int fdmax = (kmsg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int); - int fdnum = scm->fp->count; - struct file **fp = scm->fp->fp; - int __user *cmfptr; - int err = 0, i; + if (msg->msg_controllen <= sizeof(struct compat_cmsghdr)) + return 0; + return (msg->msg_controllen - sizeof(struct compat_cmsghdr)) / sizeof(int); +} - if (fdnum < fdmax) - fdmax = fdnum; +void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm) +{ + struct compat_cmsghdr __user *cm = + (struct compat_cmsghdr __user *)msg->msg_control; + unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0; + int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count); + int __user *cmsg_data = CMSG_USER_DATA(cm); + int err = 0, i; - for (i = 0, cmfptr = (int __user *) CMSG_COMPAT_DATA(cm); i < fdmax; i++, cmfptr++) { - int new_fd; - err = security_file_receive(fp[i]); + for (i = 0; i < fdmax; i++) { + err = __scm_install_fd(scm->fp->fp[i], cmsg_data + i, o_flags); if (err) break; - err = get_unused_fd_flags(MSG_CMSG_CLOEXEC & kmsg->msg_flags - ? O_CLOEXEC : 0); - if (err < 0) - break; - new_fd = err; - err = put_user(new_fd, cmfptr); - if (err) { - put_unused_fd(new_fd); - break; - } - /* Bump the usage count and install the file. */ - fd_install(new_fd, get_file(fp[i])); } if (i > 0) { int cmlen = CMSG_COMPAT_LEN(i * sizeof(int)); + err = put_user(SOL_SOCKET, >cmsg_level); if (!err) err = put_user(SCM_RIGHTS, >cmsg_type); @@ -321,16 +313,19 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) err = put_user(cmlen, >cmsg_len); if (!err) { cmlen = CMSG_COMPAT_SPACE(i * sizeof(int)); - kmsg->msg_control += cmlen; - kmsg->msg_controllen -= cmlen; + if (msg->msg_controllen < cmlen) + cmlen = msg->msg_controllen; + msg->msg_control += cmlen; + msg->msg_controllen -= cmlen; } } - if (i < fdnum) - kmsg->msg_flags |= MSG_CTRUNC; + + if (i < scm->fp->count || (scm->fp->count && fdmax <= 0)) + msg->msg_flags |= MSG_CTRUNC; /* -* All of the files that fit in the message
[PATCH v4 04/11] pidfd: Replace open-coded partial fd_install_received()
The sock counting (sock_update_netprioidx() and sock_update_classid()) was missing from pidfd's implementation of received fd installation. Replace the open-coded version with a call to the new fd_install_received() helper. Fixes: 8649c322f75c ("pid: Implement pidfd_getfd syscall") Signed-off-by: Kees Cook --- kernel/pid.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/kernel/pid.c b/kernel/pid.c index f1496b757162..24924ec5df0e 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -635,18 +635,9 @@ static int pidfd_getfd(struct pid *pid, int fd) if (IS_ERR(file)) return PTR_ERR(file); - ret = security_file_receive(file); - if (ret) { - fput(file); - return ret; - } - - ret = get_unused_fd_flags(O_CLOEXEC); + ret = fd_install_received(file, O_CLOEXEC); if (ret < 0) fput(file); - else - fd_install(ret, file); - return ret; } -- 2.25.1
[PATCH v4 10/11] seccomp: Switch addfd to Extensible Argument ioctl
This patch is based on discussions[1] with Sargun Dhillon, Christian Brauner, and David Laight. Instead of building size into the addfd structure, make it a function of the ioctl command (which is how sizes are normally passed to ioctls). To support forward and backward compatibility, just mask out the direction and size, and match everything. The size (and any future direction) checks are done along with copy_struct_from_user() logic. Also update the selftests to check size bounds. [1] https://lore.kernel.org/lkml/20200612104629.GA15814@ircssh-2.c.rugged-nimbus-611.internal Signed-off-by: Kees Cook --- include/uapi/linux/seccomp.h | 2 - kernel/seccomp.c | 21 ++ tools/testing/selftests/seccomp/seccomp_bpf.c | 40 --- 3 files changed, 49 insertions(+), 14 deletions(-) diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h index c347160378e5..473a61695ac3 100644 --- a/include/uapi/linux/seccomp.h +++ b/include/uapi/linux/seccomp.h @@ -118,7 +118,6 @@ struct seccomp_notif_resp { /** * struct seccomp_notif_addfd - * @size: The size of the seccomp_notif_addfd structure * @id: The ID of the seccomp notification * @flags: SECCOMP_ADDFD_FLAG_* * @srcfd: The local fd number @@ -126,7 +125,6 @@ struct seccomp_notif_resp { * @newfd_flags: The O_* flags the remote FD should have applied */ struct seccomp_notif_addfd { - __u64 size; __u64 id; __u32 flags; __u32 srcfd; diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 3c913f3b8451..9660abf91135 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -1292,17 +1292,17 @@ static long seccomp_notify_id_valid(struct seccomp_filter *filter, } static long seccomp_notify_addfd(struct seccomp_filter *filter, -struct seccomp_notif_addfd __user *uaddfd) +struct seccomp_notif_addfd __user *uaddfd, +unsigned int size) { struct seccomp_notif_addfd addfd; struct seccomp_knotif *knotif; struct seccomp_kaddfd kaddfd; - u64 size; int ret; - ret = get_user(size, >size); - if (ret) - return ret; + /* 24 is original sizeof(struct seccomp_notif_addfd) */ + if (size < 24 || size >= PAGE_SIZE) + return -EINVAL; ret = copy_struct_from_user(, sizeof(addfd), uaddfd, size); if (ret) @@ -1391,6 +1391,7 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, struct seccomp_filter *filter = file->private_data; void __user *buf = (void __user *)arg; + /* Fixed-size ioctls */ switch (cmd) { case SECCOMP_IOCTL_NOTIF_RECV: return seccomp_notify_recv(filter, buf); @@ -1398,11 +1399,17 @@ static long seccomp_notify_ioctl(struct file *file, unsigned int cmd, return seccomp_notify_send(filter, buf); case SECCOMP_IOCTL_NOTIF_ID_VALID: return seccomp_notify_id_valid(filter, buf); - case SECCOMP_IOCTL_NOTIF_ADDFD: - return seccomp_notify_addfd(filter, buf); + } + + /* Extensible Argument ioctls */ +#define EA_IOCTL(cmd) ((cmd) & ~(IOC_INOUT | IOCSIZE_MASK)) + switch (EA_IOCTL(cmd)) { + case EA_IOCTL(SECCOMP_IOCTL_NOTIF_ADDFD): + return seccomp_notify_addfd(filter, buf, _IOC_SIZE(cmd)); default: return -EINVAL; } +#undef EA_IOCTL } static __poll_t seccomp_notify_poll(struct file *file, diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 95b134933831..cf1480e498ea 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -216,7 +216,6 @@ struct seccomp_notif_sizes { #define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */ struct seccomp_notif_addfd { - __u64 size; __u64 id; __u32 flags; __u32 srcfd; @@ -225,6 +224,22 @@ struct seccomp_notif_addfd { }; #endif +struct seccomp_notif_addfd_small { + __u64 id; + char weird[4]; +}; +#define SECCOMP_IOCTL_NOTIF_ADDFD_SMALL\ + SECCOMP_IOW(3, struct seccomp_notif_addfd_small) + +struct seccomp_notif_addfd_big { + union { + struct seccomp_notif_addfd addfd; + char buf[sizeof(struct seccomp_notif_addfd) + 8]; + }; +}; +#define SECCOMP_IOCTL_NOTIF_ADDFD_BIG \ + SECCOMP_IOWR(3, struct seccomp_notif_addfd_big) + #ifndef PTRACE_EVENTMSG_SYSCALL_ENTRY #define PTRACE_EVENTMSG_SYSCALL_ENTRY 1 #define PTRACE_EVENTMSG_SYSCALL_EXIT 2 @@ -3853,6 +3868,8 @@ TEST(user_notification_sendfd) long ret; int status, listener, memfd, fd; struct seccomp_notif_addfd addfd = {}; + struct seccomp_notif_addfd_small small = {}; + struct
[PATCH v4 02/11] fs: Move __scm_install_fd() to __fd_install_received()
In preparation for users of the "install a received file" logic outside of net/ (pidfd and seccomp), relocate and rename __scm_install_fd() from net/core/scm.c to __fd_install_received() in fs/file.c, and provide a wrapper named fd_install_received_user(), as future patches will change the interface to __fd_install_received(). Signed-off-by: Kees Cook --- fs/file.c| 47 include/linux/file.h | 8 include/net/scm.h| 1 - net/compat.c | 2 +- net/core/scm.c | 32 +- 5 files changed, 57 insertions(+), 33 deletions(-) diff --git a/fs/file.c b/fs/file.c index abb8b7081d7a..fcfddae0d252 100644 --- a/fs/file.c +++ b/fs/file.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #include #include #include +#include +#include unsigned int sysctl_nr_open __read_mostly = 1024*1024; unsigned int sysctl_nr_open_min = BITS_PER_LONG; @@ -931,6 +934,50 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) return err; } +/** + * __fd_install_received() - Install received file into file descriptor table + * + * @fd: fd to install into (if negative, a new fd will be allocated) + * @file: struct file that was received from another process + * @ufd_required: true to use @ufd for writing fd number to userspace + * @ufd: __user pointer to write new fd number to + * @o_flags: the O_* flags to apply to the new fd entry + * + * Installs a received file into the file descriptor table, with appropriate + * checks and count updates. Optionally writes the fd number to userspace. + * + * Returns -ve on error. + */ +int __fd_install_received(struct file *file, int __user *ufd, unsigned int o_flags) +{ + struct socket *sock; + int new_fd; + int error; + + error = security_file_receive(file); + if (error) + return error; + + new_fd = get_unused_fd_flags(o_flags); + if (new_fd < 0) + return new_fd; + + error = put_user(new_fd, ufd); + if (error) { + put_unused_fd(new_fd); + return error; + } + + /* Bump the usage count and install the file. */ + sock = sock_from_file(file, ); + if (sock) { + sock_update_netprioidx(>sk->sk_cgrp_data); + sock_update_classid(>sk->sk_cgrp_data); + } + fd_install(new_fd, get_file(file)); + return 0; +} + static int ksys_dup3(unsigned int oldfd, unsigned int newfd, int flags) { int err = -EBADF; diff --git a/include/linux/file.h b/include/linux/file.h index 122f80084a3e..fe18a1a0d555 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -91,6 +91,14 @@ extern void put_unused_fd(unsigned int fd); extern void fd_install(unsigned int fd, struct file *file); +extern int __fd_install_received(struct file *file, int __user *ufd, +unsigned int o_flags); +static inline int fd_install_received_user(struct file *file, int __user *ufd, + unsigned int o_flags) +{ + return __fd_install_received(file, ufd, o_flags); +} + extern void flush_delayed_fput(void); extern void __fput_sync(struct file *); diff --git a/include/net/scm.h b/include/net/scm.h index 581a94d6c613..1ce365f4c256 100644 --- a/include/net/scm.h +++ b/include/net/scm.h @@ -37,7 +37,6 @@ struct scm_cookie { #endif }; -int __scm_install_fd(struct file *file, int __user *ufd, unsigned int o_flags); void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); diff --git a/net/compat.c b/net/compat.c index 27d477fdcaa0..94f288e8dac5 100644 --- a/net/compat.c +++ b/net/compat.c @@ -298,7 +298,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm) int err = 0, i; for (i = 0; i < fdmax; i++) { - err = __scm_install_fd(scm->fp->fp[i], cmsg_data + i, o_flags); + err = fd_install_received_user(scm->fp->fp[i], cmsg_data + i, o_flags); if (err) break; } diff --git a/net/core/scm.c b/net/core/scm.c index 6151678c73ed..df190f1fdd28 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -280,36 +280,6 @@ void put_cmsg_scm_timestamping(struct msghdr *msg, struct scm_timestamping_inter } EXPORT_SYMBOL(put_cmsg_scm_timestamping); -int __scm_install_fd(struct file *file, int __user *ufd, unsigned int o_flags) -{ - struct socket *sock; - int new_fd; - int error; - - error = security_file_receive(file); - if (error) - return error; - - new_fd = get_unused_fd_flags(o_flags); - if (new_fd < 0) - return new_fd; - - error = put_user(new_fd,
[PATCH v4 06/11] seccomp: Introduce addfd ioctl to seccomp user notifier
From: Sargun Dhillon This adds a seccomp notifier ioctl which allows for the listener to "add" file descriptors to a process which originated a seccomp user notification. This allows calls like mount, and mknod to be "implemented", as the return value, and the arguments are data in memory. On the other hand, calls like connect can be "implemented" using pidfd_getfd. Unfortunately, there are calls which return file descriptors, like open, which are vulnerable to ToCToU attacks, and require that the more privileged supervisor can inspect the argument, and perform the syscall on behalf of the process generating the notification. This allows the file descriptor generated from that open call to be returned to the calling process. In addition, there is functionality to allow for replacement of specific file descriptors, following dup2-like semantics. As a note, the seccomp_notif_addfd structure is laid out based on 8-byte alignment without requiring packing as there have been packing issues with uapi highlighted before[1][2]. Although we could overload the newfd field and use -1 to indicate that it is not to be used, doing so requires changing the size of the fd field, and introduces struct packing complexity. [1]: https://lore.kernel.org/lkml/87o8w9bcaf@mid.deneb.enyo.de/ [2]: https://lore.kernel.org/lkml/a328b91d-fd8f-4f27-b3c2-91a9c45f1...@rasmusvillemoes.dk/ Suggested-by: Matt Denton Link: https://lore.kernel.org/r/20200603011044.7972-4-sar...@sargun.me Signed-off-by: Sargun Dhillon Signed-off-by: Kees Cook --- include/uapi/linux/seccomp.h | 25 ++ kernel/seccomp.c | 165 ++- 2 files changed, 189 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h index c1735455bc53..c347160378e5 100644 --- a/include/uapi/linux/seccomp.h +++ b/include/uapi/linux/seccomp.h @@ -113,6 +113,27 @@ struct seccomp_notif_resp { __u32 flags; }; +/* valid flags for seccomp_notif_addfd */ +#define SECCOMP_ADDFD_FLAG_SETFD (1UL << 0) /* Specify remote fd */ + +/** + * struct seccomp_notif_addfd + * @size: The size of the seccomp_notif_addfd structure + * @id: The ID of the seccomp notification + * @flags: SECCOMP_ADDFD_FLAG_* + * @srcfd: The local fd number + * @newfd: Optional remote FD number if SETFD option is set, otherwise 0. + * @newfd_flags: The O_* flags the remote FD should have applied + */ +struct seccomp_notif_addfd { + __u64 size; + __u64 id; + __u32 flags; + __u32 srcfd; + __u32 newfd; + __u32 newfd_flags; +}; + #define SECCOMP_IOC_MAGIC '!' #define SECCOMP_IO(nr) _IO(SECCOMP_IOC_MAGIC, nr) #define SECCOMP_IOR(nr, type) _IOR(SECCOMP_IOC_MAGIC, nr, type) @@ -124,4 +145,8 @@ struct seccomp_notif_resp { #define SECCOMP_IOCTL_NOTIF_SEND SECCOMP_IOWR(1, \ struct seccomp_notif_resp) #define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64) +/* On success, the return value is the remote process's added fd number */ +#define SECCOMP_IOCTL_NOTIF_ADDFD SECCOMP_IOW(3, \ + struct seccomp_notif_addfd) + #endif /* _UAPI_LINUX_SECCOMP_H */ diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 0016cad0e605..3c913f3b8451 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -78,10 +78,42 @@ struct seccomp_knotif { long val; u32 flags; - /* Signals when this has entered SECCOMP_NOTIFY_REPLIED */ + /* +* Signals when this has changed states, such as the listener +* dying, a new seccomp addfd message, or changing to REPLIED +*/ struct completion ready; struct list_head list; + + /* outstanding addfd requests */ + struct list_head addfd; +}; + +/** + * struct seccomp_kaddfd - container for seccomp_addfd ioctl messages + * + * @file: A reference to the file to install in the other task + * @fd: The fd number to install it at. If the fd number is -1, it means the + * installing process should allocate the fd as normal. + * @flags: The flags for the new file descriptor. At the moment, only O_CLOEXEC + * is allowed. + * @ret: The return value of the installing process. It is set to the fd num + * upon success (>= 0). + * @completion: Indicates that the installing process has completed fd + * installation, or gone away (either due to successful + * reply, or signal) + * + */ +struct seccomp_kaddfd { + struct file *file; + int fd; + unsigned int flags; + + /* To only be set on reply */ + int ret; + struct completion completion; + struct list_head list; }; /** @@ -784,6 +816,17 @@ static u64 seccomp_next_notify_id(struct seccomp_filter *filter) return filter->notif->next_id++; } +static void seccomp_handle_addfd(struct seccomp_kaddfd *addfd) +{ +
arch/s390/kvm/../../../virt/kvm/kvm_main.c:4326:17: sparse: struct kvm_vcpu Documentation Kbuild Makefile crypto include sound usr kvm_get_running_vcpus( ... )
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: a5dc8300df75e8b8384b4c82225f1e4a0b4d9b55 commit: 7495e22bb165e7030bae4d9c6e84addb5ea17b29 KVM: Move running VCPU from ARM to common code date: 5 months ago config: s390-randconfig-s032-20200615 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-rc1-3-g55607964-dirty git checkout 7495e22bb165e7030bae4d9c6e84addb5ea17b29 # save the attached .config to linux build tree make W=1 C=1 ARCH=s390 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) arch/s390/kvm/../../../virt/kvm/kvm_main.c:4326:17: sparse: sparse: symbol 'kvm_get_running_vcpus' redeclared with different type (different address spaces): >> arch/s390/kvm/../../../virt/kvm/kvm_main.c:4326:17: sparse:struct >> kvm_vcpu *[noderef] *extern [addressable] [toplevel] >> kvm_get_running_vcpus( ... ) include/linux/kvm_host.h:1339:26: sparse: note: previously declared as: include/linux/kvm_host.h:1339:26: sparse:struct kvm_vcpu [noderef] **extern [addressable] [toplevel] kvm_get_running_vcpus( ... ) vim +4326 arch/s390/kvm/../../../virt/kvm/kvm_main.c 4322 4323 /** 4324 * kvm_get_running_vcpus - get the per-CPU array of currently running vcpus. 4325 */ > 4326 struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void) 4327 { 4328 return _running_vcpu; 4329 } 4330 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [LKP] [sched/fair] 070f5e860e: reaim.jobs_per_min -10.5% regression
On 6/15/2020 11:10 PM, Hillf Danton wrote: On Mon, 15 Jun 2020 10:10:41 +0200 Vincent Guittot wrote: Le lundi 15 juin 2020 15:26:59 (+0800), Xing Zhengjun a crit : On 6/12/2020 7:06 PM, Hillf Danton wrote: On Fri, 12 Jun 2020 14:36:49 +0800 Xing Zhengjun wrote: ... I apply the patch based on v5.7, the regression still existed. Thanks for the test. Thanks. I don't know if it's relevant or not but the results seem a bit better with the patch and I'd like to check that it's only a matter of threshold to fix the problem. Could you try the patch below which is quite aggressive but will help to confirm this ? diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 28be1c984a42..3c51d557547b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8322,10 +8322,13 @@ static inline int sg_imbalanced(struct sched_group *group) static inline bool group_has_capacity(unsigned int imbalance_pct, struct sg_lb_stats *sgs) { + unsigned long imb; + if (sgs->sum_nr_running < sgs->group_weight) return true; - if ((sgs->group_capacity * imbalance_pct) < + imb = sgs->sum_nr_running * 100; + if ((sgs->group_capacity * imb) < (sgs->group_runnable * 100)) return false; @@ -8347,6 +8350,8 @@ group_has_capacity(unsigned int imbalance_pct, struct sg_lb_stats *sgs) static inline bool group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) { + unsigned long imb; + if (sgs->sum_nr_running <= sgs->group_weight) return false; @@ -8354,7 +8359,8 @@ group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) (sgs->group_util * imbalance_pct)) return true; - if ((sgs->group_capacity * imbalance_pct) < + imb = sgs->sum_nr_running * 100; + if ((sgs->group_capacity * imb) < (sgs->group_runnable * 100)) return true; = tbox_group/testcase/rootfs/kconfig/compiler/runtime/nr_task/debug-setup/test/cpufreq_governor/ucode: lkp-ivb-d04/reaim/debian-x86_64-20191114.cgz/x86_64-rhel-7.6/gcc-7/300s/100%/test/five_sec/performance/0x21 commit: 9f68395333ad7f5bfe2f83473fed363d4229f11c 070f5e860ee2bf588c99ef7b4c202451faa48236 v5.7 6b33257768b8dd3982054885ea310871be2cfe0b (Hillf's patch) 9f68395333ad7f5b 070f5e860ee2bf588c99ef7b4c2v5.7 6b33257768b8dd3982054885ea3 --- --- --- %stddev %change %stddev %change %stddev %change %stddev \ |\ |\ |\ 0.69 -10.3% 0.62-9.1% 0.62 -10.1% 0.62reaim.child_systime 0.62-1.0% 0.61+0.5% 0.62 +0.3% 0.62reaim.child_utime 66870 -10.0% 60187-7.6% 61787 -8.3% 61305reaim.jobs_per_min 16717 -10.0% 15046-7.6% 15446 -8.3% 15326reaim.jobs_per_min_child 97.84-1.1% 96.75-0.4% 97.43 -0.5% 97.37reaim.jti 72000 -10.8% 64216-8.3% 66000 -8.3% 66000reaim.max_jobs_per_min 0.36 +10.6% 0.40+7.8% 0.39 +9.4% 0.39reaim.parent_time 1.58 2% +71.0% 2.70 2% +26.9% 2.01 2% +33.2% 2.11reaim.std_dev_percent 0.00 5%+110.4% 0.01 3% +48.8% 0.01 7% +65.3% 0.01 3% reaim.std_dev_time 50800-2.4% 49600-1.6% 5 -1.8% 49866reaim.workload Following the introduction of runnable_avg there came a gap between it and util, and it can be supposedly filled up by determining the pivot point using the imb percent. The upside is that no heuristic is added. --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8215,15 +8215,8 @@ group_has_capacity(unsigned int imbalanc if (sgs->sum_nr_running < sgs->group_weight) return true; - if ((sgs->group_capacity * imbalance_pct) < - (sgs->group_runnable * 100)) - return false; - - if ((sgs->group_capacity * 100) > - (sgs->group_util * imbalance_pct)) - return true; - - return false; + return sgs->group_capacity * imbalance_pct > + (sgs->group_util + sgs->group_runnable) *50; } /* @@ -8240,15 +8233,8 @@ group_is_overloaded(unsigned int imbalan if (sgs->sum_nr_running <= sgs->group_weight) return false; - if ((sgs->group_capacity * 100) <
Re: [PATCH] kbuild: reuse vmlinux.o in vmlinux_link
On Tue, Jun 16, 2020 at 6:47 AM Sami Tolvanen wrote: > > On Sat, May 23, 2020 at 8:13 AM Masahiro Yamada wrote: > > > > Hi Nicholas, > > (+CC: Sam Ravnborg) > > > > > > On Sat, May 23, 2020 at 7:06 PM Nicholas Piggin wrote: > > > > > > Excerpts from Masahiro Yamada's message of May 23, 2020 3:44 am: > > > > + Michael, and PPC ML. > > > > > > > > They may know something about the reason of failure. > > > > > > Because the linker can't put branch stubs within object code sections, > > > so when you incrementally link them too large, the linker can't resolve > > > branches into other object files. > > > > > > Ah, you are right. > > > > So, this is a problem not only for PPC > > but also for ARM (both 32 and 64 bit), etc. > > > > ARM needs to insert a veneer to jump far. > > > > Prior to thin archive, we could not compile > > ARCH=arm allyesconfig because > > drivers/built-in.o was too large. > > > > This patch gets us back to the too large > > incremental object situation. > > > > With my quick compile-testing, > > ARCH=arm allyesconfig > > and ARCH=arm64 allyesconfig are broken. > > Thanks for looking into this! Clang doesn't appear to have this issue > with LTO because it always enables both -ffunction-sections and > -fdata-sections. I confirmed that -ffunction-sections also fixes arm64 > allyesconfig with this patch. While I'm fine with reusing vmlinux.o > only with LTO, how would you feel about enabling -ffunction-sections > in the kernel by default? I am OK if it works. Please do compile tests for some architectures. (especially, ARCH=powerpc defconfig, and ARCH=arm(64) allyesconfig) Thank you. -- Best Regards Masahiro Yamada
[PATCH] arm/mm: Drop [PTE|PMD]_TYPE_FAULT
Drop these unused symbols i.e PTE_TYPE_FAULT and PMD_TYPE_FAULT. Cc: Russell King Cc: Thomas Gleixner Cc: Allison Randal Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- Applies on 5.8-rc1. Just found by code inspection and built tested for arm platform. arch/arm/include/asm/pgtable-2level-hwdef.h | 2 -- arch/arm/include/asm/pgtable-3level-hwdef.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h index 556937e1790e..b10d6e1aee33 100644 --- a/arch/arm/include/asm/pgtable-2level-hwdef.h +++ b/arch/arm/include/asm/pgtable-2level-hwdef.h @@ -14,7 +14,6 @@ * - common */ #define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0) -#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0) #define PMD_TYPE_TABLE (_AT(pmdval_t, 1) << 0) #define PMD_TYPE_SECT (_AT(pmdval_t, 2) << 0) #define PMD_PXNTABLE (_AT(pmdval_t, 1) << 2) /* v7 */ @@ -56,7 +55,6 @@ * - common */ #define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0) -#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0) #define PTE_TYPE_LARGE (_AT(pteval_t, 1) << 0) #define PTE_TYPE_SMALL (_AT(pteval_t, 2) << 0) #define PTE_TYPE_EXT (_AT(pteval_t, 3) << 0) /* v5 */ diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h index 2f35b4eddaa8..43aa8f61eac1 100644 --- a/arch/arm/include/asm/pgtable-3level-hwdef.h +++ b/arch/arm/include/asm/pgtable-3level-hwdef.h @@ -15,7 +15,6 @@ * - common */ #define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0) -#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0) #define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0) #define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0) #define PMD_TABLE_BIT (_AT(pmdval_t, 1) << 1) @@ -56,7 +55,6 @@ * + Level 3 descriptor (PTE) */ #define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0) -#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0) #define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0) #define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1) #define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */ -- 2.20.1
Re: [LKP] [sched/fair] 070f5e860e: reaim.jobs_per_min -10.5% regression
On 6/15/2020 4:10 PM, Vincent Guittot wrote: Hi Xing, Le lundi 15 juin 2020 à 15:26:59 (+0800), Xing Zhengjun a écrit : On 6/12/2020 7:06 PM, Hillf Danton wrote: On Fri, 12 Jun 2020 14:36:49 +0800 Xing Zhengjun wrote: ... --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8215,12 +8215,8 @@ group_has_capacity(unsigned int imbalanc if (sgs->sum_nr_running < sgs->group_weight) return true; - if ((sgs->group_capacity * imbalance_pct) < - (sgs->group_runnable * 100)) - return false; - - if ((sgs->group_capacity * 100) > - (sgs->group_util * imbalance_pct)) + if ((sgs->group_capacity * 100) > (sgs->group_util * imbalance_pct) && + (sgs->group_capacity * 100) > (sgs->group_runnable * imbalance_pct)) return true; return false; @@ -8240,12 +8236,8 @@ group_is_overloaded(unsigned int imbalan if (sgs->sum_nr_running <= sgs->group_weight) return false; - if ((sgs->group_capacity * 100) < - (sgs->group_util * imbalance_pct)) - return true; - - if ((sgs->group_capacity * imbalance_pct) < - (sgs->group_runnable * 100)) + if ((sgs->group_capacity * 100) < (sgs->group_util * imbalance_pct) || + (sgs->group_capacity * 100) < (sgs->group_runnable * imbalance_pct)) return true; return false; I apply the patch based on v5.7, the regression still existed. Thanks for the test. I don't know if it's relevant or not but the results seem a bit better with the patch and I'd like to check that it's only a matter of threshold to fix the problem. Could you try the patch below which is quite aggressive but will help to confirm this ? diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 28be1c984a42..3c51d557547b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8322,10 +8322,13 @@ static inline int sg_imbalanced(struct sched_group *group) static inline bool group_has_capacity(unsigned int imbalance_pct, struct sg_lb_stats *sgs) { + unsigned long imb; + if (sgs->sum_nr_running < sgs->group_weight) return true; - if ((sgs->group_capacity * imbalance_pct) < + imb = sgs->sum_nr_running * 100; + if ((sgs->group_capacity * imb) < (sgs->group_runnable * 100)) return false; @@ -8347,6 +8350,8 @@ group_has_capacity(unsigned int imbalance_pct, struct sg_lb_stats *sgs) static inline bool group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) { + unsigned long imb; + if (sgs->sum_nr_running <= sgs->group_weight) return false; @@ -8354,7 +8359,8 @@ group_is_overloaded(unsigned int imbalance_pct, struct sg_lb_stats *sgs) (sgs->group_util * imbalance_pct)) return true; - if ((sgs->group_capacity * imbalance_pct) < + imb = sgs->sum_nr_running * 100; + if ((sgs->group_capacity * imb) < (sgs->group_runnable * 100)) return true; I apply the patch based on v5.7, the test result is as the following: = tbox_group/testcase/rootfs/kconfig/compiler/runtime/nr_task/debug-setup/test/cpufreq_governor/ucode: lkp-ivb-d04/reaim/debian-x86_64-20191114.cgz/x86_64-rhel-7.6/gcc-7/300s/100%/test/five_sec/performance/0x21 commit: 9f68395333ad7f5bfe2f83473fed363d4229f11c 070f5e860ee2bf588c99ef7b4c202451faa48236 v5.7 3e1643da53f3fc7414cfa3ad2a16ab2a164b7f4d (the test patch) 9f68395333ad7f5b 070f5e860ee2bf588c99ef7b4c2v5.7 3e1643da53f3fc7414cfa3ad2a1 --- --- --- %stddev %change %stddev %change %stddev %change %stddev \ |\ |\ |\ 0.69 -10.3% 0.62-9.1% 0.62 -7.1% 0.64reaim.child_systime 0.62-1.0% 0.61+0.5% 0.62 +1.3% 0.63reaim.child_utime 66870 -10.0% 60187-7.6% 61787 -6.1% 62807reaim.jobs_per_min 16717 -10.0% 15046-7.6% 15446 -6.1% 15701reaim.jobs_per_min_child 97.84-1.1% 96.75-0.4% 97.43 -0.5% 97.34reaim.jti 72000 -10.8% 64216-8.3% 66000 -5.7% 67885reaim.max_jobs_per_min 0.36 +10.6% 0.40+7.8% 0.39 +6.9% 0.38reaim.parent_time 1.58 ± 2% +71.0%
[PATCH] arm64/panic: Unify all three existing notifier blocks
Currently there are three different registered panic notifier blocks. This unifies all of them into a single one i.e arm64_panic_block, hence reducing code duplication and required calling sequence during panic. This preserves the existing dump sequence. Cc: Catalin Marinas Cc: Will Deacon Cc: Steve Capper Cc: Mark Rutland Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- Applies on 5.8-rc1. arch/arm64/include/asm/cpufeature.h | 1 + arch/arm64/include/asm/memory.h | 1 + arch/arm64/kernel/cpufeature.c | 15 +-- arch/arm64/kernel/setup.c | 24 ++-- arch/arm64/mm/init.c| 18 +- 5 files changed, 18 insertions(+), 41 deletions(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 5d1f4ae42799..e375529ca9fc 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -774,6 +774,7 @@ static inline unsigned int get_vmid_bits(u64 mmfr1) } u32 get_kvm_ipa_limit(void); +void dump_cpu_features(void); #endif /* __ASSEMBLY__ */ diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index a1871bb32bb1..2a88cb734d06 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -322,6 +322,7 @@ static inline void *phys_to_virt(phys_addr_t x) __is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr)); \ }) +void dump_mem_limit(void); #endif /* !ASSEMBLY */ /* diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 2270eda9a7fb..756775f4b7d4 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -119,24 +119,11 @@ static inline void finalize_system_capabilities(void) static_branch_enable(_const_caps_ready); } -static int dump_cpu_hwcaps(struct notifier_block *self, unsigned long v, void *p) +void dump_cpu_features(void) { /* file-wide pr_fmt adds "CPU features: " prefix */ pr_emerg("0x%*pb\n", ARM64_NCAPS, _hwcaps); - return 0; -} - -static struct notifier_block cpu_hwcaps_notifier = { - .notifier_call = dump_cpu_hwcaps -}; - -static int __init register_cpu_hwcaps_dumper(void) -{ - atomic_notifier_chain_register(_notifier_list, - _hwcaps_notifier); - return 0; } -__initcall(register_cpu_hwcaps_dumper); DEFINE_STATIC_KEY_ARRAY_FALSE(cpu_hwcap_keys, ARM64_NCAPS); EXPORT_SYMBOL(cpu_hwcap_keys); diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 93b3844cf442..312b19263cb7 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -400,11 +400,7 @@ static int __init topology_init(void) } subsys_initcall(topology_init); -/* - * Dump out kernel offset information on panic. - */ -static int dump_kernel_offset(struct notifier_block *self, unsigned long v, - void *p) +void dump_kernel_offset(void) { const unsigned long offset = kaslr_offset(); @@ -415,17 +411,25 @@ static int dump_kernel_offset(struct notifier_block *self, unsigned long v, } else { pr_emerg("Kernel Offset: disabled\n"); } +} + +static int arm64_panic_block_dump(struct notifier_block *self, + unsigned long v, void *p) +{ + dump_kernel_offset(); + dump_cpu_features(); + dump_mem_limit(); return 0; } -static struct notifier_block kernel_offset_notifier = { - .notifier_call = dump_kernel_offset +static struct notifier_block arm64_panic_block = { + .notifier_call = arm64_panic_block_dump }; -static int __init register_kernel_offset_dumper(void) +static int __init register_arm64_panic_block(void) { atomic_notifier_chain_register(_notifier_list, - _offset_notifier); + _panic_block); return 0; } -__initcall(register_kernel_offset_dumper); +__initcall(register_arm64_panic_block); diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index e631e6425165..b88ef04033de 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -558,27 +558,11 @@ void free_initmem(void) unmap_kernel_range((u64)__init_begin, (u64)(__init_end - __init_begin)); } -/* - * Dump out memory limit information on panic. - */ -static int dump_mem_limit(struct notifier_block *self, unsigned long v, void *p) +void dump_mem_limit(void) { if (memory_limit != PHYS_ADDR_MAX) { pr_emerg("Memory Limit: %llu MB\n", memory_limit >> 20); } else { pr_emerg("Memory Limit: none\n"); } - return 0; -} - -static struct notifier_block mem_limit_notifier = { - .notifier_call = dump_mem_limit, -}; - -static int __init register_mem_limit_dumper(void) -{ - atomic_notifier_chain_register(_notifier_list, -
Re: [PATCH 4/5] spi: bcm-qspi: Make multiple data blocks interrupt-driven
On Mon, 2020-06-15 at 15:32 +0100, Mark Brown wrote: > On Mon, Jun 15, 2020 at 04:05:56PM +1200, Mark Tomlinson wrote: > > > When needing to send/receive data in small chunks, make this interrupt > > driven rather than waiting for a completion event for each small section > > of data. > > Again was this done for a reason and if so do we understand why doing > this from interrupt context is safe - how long can the interrupts be > when stuffing the FIFO from interrupt context? As I'm porting a Broadcom patch, I'm hoping someone else can add something to this. From the history it appears there was a hard limit (no small chunks), and this was changed to doing it in chunks with patch 345309fa7c0c92, apparently to improve performance. I believe this change further improves performance, but as the patch arrived without any documentation, I'm not certain. > > @@ -731,12 +733,14 @@ static inline u16 read_rxram_slot_u16(struct bcm_qspi > > *qspi, int slot) > > ((bcm_qspi_read(qspi, MSPI, msb_offset) & 0xff) << 8); > > } > > > > -static void read_from_hw(struct bcm_qspi *qspi, int slots) > > +static void read_from_hw(struct bcm_qspi *qspi) > > { > > Things might be clearer if this refactoring were split out into a > separate patch. Done. > > @@ -960,24 +966,21 @@ static int bcm_qspi_transfer_one(struct spi_master > > *master, > > struct spi_transfer *trans) > > { > > struct bcm_qspi *qspi = spi_master_get_devdata(master); > > - int slots; > > - unsigned long timeo = msecs_to_jiffies(100); > > + unsigned long timeo = msecs_to_jiffies(1000); > > That's a randomly chosen value - if we're now doing the entire transfer > then we should be trying to estimate the length of time the transfer > will take, for a very large transfer on a slow bus it's possible that > even a second won't be enough. > Again, the value came from Broadcom. Using the data length as an estimate sounds like a good idea. > > - complete(>mspi_done); > > + > > + read_from_hw(qspi); > > + > > + if (qspi->trans_pos.trans) { > > + write_to_hw(qspi); > > + } else { > > + complete(>mspi_done); > > + spi_finalize_current_transfer(qspi->master); > > + } > > + > > This is adding a spi_finalize_current_transfer() which we didn't have > before, and still leaving us doing cleanup work in the driver in another > thread. This is confused, the driver should only need to finalize the > transfer explicitly if it returned a timeout from transfer_one() but > nothing's changed there. I can remove the call to spi_finalize_current_transfer() from this patch. I'll try to check what does happen in the timeout case.
RE: [PATCH v1 RFC 1/2] spi: introduce fallback to pio
On 2020/06/15 Vinod Koul wrote: > Hi Robin, > > On 15-06-20, 08:59, Robin Gong wrote: > > Hi Vinod, > > Is there any way to let the device driver to know dma controller is > > ready (in sdma case is sdma firmware loaded or not)before prep_call? > > Hence, spi core could map dma buffer or not. Prep_call is too late for > > spi core since the buffers have been already mapped. > > Can you use .device_alloc_chan_resources for that? This is where all the > resource allocation for a channel should happen... But many client driver request dma channel(device_alloc_chan_resources) in driver probe phase instead of later transfer startup phase. > > From my view, seems dmaengine_slave_config is the only one...Further, > > sdma need direction in dmaengine_slave_config phase, because currently > > what's the tx/rx script used on sdma channel is decided not only > > peripheral_type but also direction. For example, spi tx dma is running > > ram script to workaround ecspi ERR009165 while rx dma is running rom > > script, so only spi tx dma channel depends on sdma firmware loaded(now > > that could be detect by ' load_address < 0' in sdma_load_context() and prep_ > call finally). > >I knew direction is deprecated in dmaengine_slave_config, but > > that's really very useful for sdma to check if firmware loaded and spi > > core could get it earlier before prep_call(fallback to PIO if dma is not > > ready). > > I think that is wrong expectation, dmaengine_slave_config should pass the > slave_config to driver and nothing else. The relevant action should be taken > in > respective prep_ calls here, so that should be fixed as well Got it, thanks for your clarification.
[PATCH v3] ASoC: fsl_ssi: Fix bclk calculation for mono channel
For mono channel, SSI will switch to Normal mode. In Normal mode and Network mode, the Word Length Control bits control the word length divider in clock generator, which is different with I2S Master mode (the word length is fixed to 32bit), it should be the value of params_width(hw_params). The condition "slots == 2" is not good for I2S Master mode, because for Network mode and Normal mode, the slots can also be 2. Then we need to use (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) to check if it is I2S Master mode. So we refine the formula for mono channel, otherwise there will be sound issue for S24_LE. Fixes: b0a7043d5c2c ("ASoC: fsl_ssi: Caculate bit clock rate using slot number and width") Signed-off-by: Shengjiu Wang --- changes in v3 - update according to Nicolin's comments changes in v2 - refine patch for Network mode and Normal mode. sound/soc/fsl/fsl_ssi.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index bad89b0d129e..1a2fa7f18142 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -678,8 +678,9 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, struct regmap *regs = ssi->regs; u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i; unsigned long clkrate, baudrate, tmprate; - unsigned int slots = params_channels(hw_params); - unsigned int slot_width = 32; + unsigned int channels = params_channels(hw_params); + unsigned int slot_width = params_width(hw_params); + unsigned int slots = 2; u64 sub, savesub = 10; unsigned int freq; bool baudclk_is_used; @@ -688,10 +689,14 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, /* Override slots and slot_width if being specifically set... */ if (ssi->slots) slots = ssi->slots; - /* ...but keep 32 bits if slots is 2 -- I2S Master mode */ - if (ssi->slot_width && slots != 2) + if (ssi->slot_width) slot_width = ssi->slot_width; + /* ...but force 32 bits for stereo audio using I2S Master Mode */ + if (channels == 2 && + (ssi->i2s_net & SSI_SCR_I2S_MODE_MASK) == SSI_SCR_I2S_MODE_MASTER) + slot_width = 32; + /* Generate bit clock based on the slot number and slot width */ freq = slots * slot_width * params_rate(hw_params); -- 2.21.0
Re: [btrfs] e678934cbe: reaim.jobs_per_min -30.7% regression
On 6/12/20 7:50 PM, Filipe Manana wrote: On 11/06/20 10:02, kernel test robot wrote: Greeting, FYI, we noticed a -30.7% regression of reaim.jobs_per_min due to commit: Hello, In the future, can you please always CC linux-bt...@vger.kernel.org for btrfs related reports? Thanks for the advice, we'll cc the mailing list next time. Best Regards, Rong Chen Thanks. commit: e678934cbe5f026c2765a1da651e61daa5724fb3 ("btrfs: Remove unnecessary check from join_running_log_trans") https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master in testcase: reaim on test machine: 96 threads Intel(R) Xeon(R) Gold 6252 CPU @ 2.10GHz with 256G memory with following parameters: runtime: 300s nr_task: 100 disk: 1HDD fs: btrfs test: disk cpufreq_governor: performance ucode: 0x52c test-description: REAIM is an updated and improved version of AIM 7 benchmark. test-url: https://sourceforge.net/projects/re-aim-7/ If you fix the issue, kindly add following tag Reported-by: kernel test robot Details are as below: --> To reproduce: git clone https://github.com/intel/lkp-tests.git cd lkp-tests bin/lkp install job.yaml # job file is attached in this email bin/lkp run job.yaml = compiler/cpufreq_governor/disk/fs/kconfig/nr_task/rootfs/runtime/tbox_group/test/testcase/ucode: gcc-9/performance/1HDD/btrfs/x86_64-rhel-7.6/100/debian-x86_64-20191114.cgz/300s/lkp-csl-2sp6/disk/reaim/0x52c commit: 32e534402a ("Btrfs: wake up inode cache waiters sooner to reduce waiting time") e678934cbe ("btrfs: Remove unnecessary check from join_running_log_trans") 32e534402ad52e9f e678934cbe5f026c2765a1da651 --- fail:runs %reproductionfail:runs | | | :4 25% 1:4 dmesg.WARNING:at#for_ip_swapgs_restore_regs_and_return_to_usermode/0x %stddev %change %stddev \ |\ 5.39+6.4% 5.73 ± 6% reaim.child_utime 6882 ± 2% -30.7% 4771 ± 2% reaim.jobs_per_min 68.82 ± 2% -30.7% 47.72 ± 2% reaim.jobs_per_min_child 98.56-3.4% 95.25reaim.jti 6978 ± 2% -29.5% 4917 ± 2% reaim.max_jobs_per_min 87.24 ± 2% +44.3% 125.92 ± 2% reaim.parent_time 0.97 ± 5%+337.7% 4.26 ± 9% reaim.std_dev_percent 0.84 ± 5%+504.3% 5.05 ± 7% reaim.std_dev_time 357.77 ± 2% +7.4% 384.27 ± 2% reaim.time.elapsed_time 357.77 ± 2% +7.4% 384.27 ± 2% reaim.time.elapsed_time.max 276434 -25.6% 205672reaim.time.file_system_inputs 10740316 -20.1%8583748 ± 2% reaim.time.file_system_outputs 63443 -13.8% 54688 reaim.time.involuntary_context_switches 6205791 -24.9%4661554reaim.time.minor_page_faults 84.25 ± 2% -34.4% 55.25 ± 11% reaim.time.percent_of_cpu_this_job_got 281.73 -30.3% 196.49 ± 11% reaim.time.system_time 21.59 -20.2% 17.23 ± 6% reaim.time.user_time 2253123 -10.4%2017718 reaim.time.voluntary_context_switches 4 -25.0% 3reaim.workload 92.59+2.6% 95.01iostat.cpu.idle 6.37 -32.9% 4.27iostat.cpu.iowait 0.97 ± 4% -32.4% 0.65 ± 13% iostat.cpu.system 6.41-2.14.29mpstat.cpu.all.iowait% 0.02 ± 6% -0.00.01 ± 4% mpstat.cpu.all.soft% 0.95 ± 4% -0.30.64 ± 13% mpstat.cpu.all.sys% 0.07 ± 2% -0.00.06 ± 3% mpstat.cpu.all.usr% 3177396 ± 4% -17.2%2630192 ± 2% numa-numastat.node0.local_node 3208408 ± 3% -17.3%2653430 ± 3% numa-numastat.node0.numa_hit 3183435 ± 4% -21.0%2515397 ± 2% numa-numastat.node1.local_node 3183678 ± 4% -20.7%2523398 ± 2% numa-numastat.node1.numa_hit 92.00+2.4% 94.25vmstat.cpu.id 382.00 -30.6% 265.25vmstat.io.bi 26136 -29.9% 18312vmstat.io.bo 6.00 -37.5% 3.75 ± 11% vmstat.procs.b 20123 ± 2% -19.6% 16189vmstat.system.cs 1044628 -21.1% 824233 ± 4% meminfo.Active 758190 -28.5% 542058 ± 7% meminfo.Active(file) 163791 +76.7% 289387 ± 6% meminfo.Inactive 145927 +86.1% 271504 ± 6% meminfo.Inactive(file) 10778
Re: [PATCH] [v2] media: vsp1: Fix runtime PM imbalance on error
Hello Dinghao, Thank you for the patch. On Mon, Jun 08, 2020 at 01:29:19PM +0800, Dinghao Liu wrote: > pm_runtime_get_sync() increments the runtime PM usage counter even > when it returns an error code. Thus a pairing decrement is needed on > the error handling path to keep the counter balanced. > > Signed-off-by: Dinghao Liu Reviewed-by: Laurent Pinchart I have however received multiple similar patches recently, for different drivers. I've CC'ed Rafael, the PM maintainer, in one of those e-mail threads, and questioned whether we should really mass-patch drivers, or fix the issue in pm_runtime_get_sync(). I'll defer pushing this patch until that discussion comes to a conclusion. > --- > > Changelog: > > v2: - Fix the imbalance in vsp1_device_get(). > Use vsp1_device_get() and vsp1_device_put() > to replace pm_runtime_get_sync() and > pm_runtime_put_sync() in vsp1_probe(). > --- > drivers/media/platform/vsp1/vsp1_drv.c | 11 --- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/vsp1/vsp1_drv.c > b/drivers/media/platform/vsp1/vsp1_drv.c > index c650e45bb0ad..dc62533cf32c 100644 > --- a/drivers/media/platform/vsp1/vsp1_drv.c > +++ b/drivers/media/platform/vsp1/vsp1_drv.c > @@ -562,7 +562,12 @@ int vsp1_device_get(struct vsp1_device *vsp1) > int ret; > > ret = pm_runtime_get_sync(vsp1->dev); > - return ret < 0 ? ret : 0; > + if (ret < 0) { > + pm_runtime_put_noidle(vsp1->dev); > + return ret; > + } > + > + return 0; > } > > /* > @@ -845,12 +850,12 @@ static int vsp1_probe(struct platform_device *pdev) > /* Configure device parameters based on the version register. */ > pm_runtime_enable(>dev); > > - ret = pm_runtime_get_sync(>dev); > + ret = vsp1_device_get(vsp1); > if (ret < 0) > goto done; > > vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION); > - pm_runtime_put_sync(>dev); > + vsp1_device_put(vsp1); > > for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) { > if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) == -- Regards, Laurent Pinchart
Re: [RFC PATCH v2 2/5] scsi: ufs: Add UFS-feature layer
Hi, Bean > > On Mon, 2020-06-15 at 16:23 +0900, Daejun Park wrote: > > +void ufsf_scan_features(struct ufs_hba *hba) > > +{ > > + int ret; > > + > > + init_waitqueue_head(>ufsf.sdev_wait); > > + atomic_set(>ufsf.slave_conf_cnt, 0); > > + > > + if (hba->dev_info.wspecversion >= HPB_SUPPORTED_VERSION && > > + (hba->dev_info.b_ufs_feature_sup & UFS_DEV_HPB_SUPPORT)) > > How about removing this check "(hba->dev_info.wspecversion >= > HPB_SUPPORTED_VERSION" since ufs with lower version than v3.1 can add > HPB feature by FFU, > if (hba->dev_info.b_ufs_feature_sup _FEATURE_SUPPORT_HPB_BIT) is > enough. OK, changing it seems no problem. But I want to know what other people think about this version checking code. Thanks, Daejun