Re: [linux-yocto] [PATCH] kernel/sched: Fix uninitialized read in nohz_full/isolcpus setup

2023-08-14 Thread Paul Gortmaker via lists.yoctoproject.org
[Re: [linux-yocto] [PATCH] kernel/sched: Fix uninitialized read in 
nohz_full/isolcpus setup] On 26/06/2023 (Mon 11:05) Paul Gortmaker wrote:

> [[linux-yocto] [PATCH] kernel/sched: Fix uninitialized read in 
> nohz_full/isolcpus setup] On 25/06/2023 (Sun 18:50) Adrian Cinal via 
> lists.yoctoproject.org wrote:
> 
> > Fix reading uninitialized cpumask and using it to validate the nohz_full=
> > and isolcpus= kernel command line parameters.
> > 
> > An older version of a patch from lkml was incorporated into linux-yocto,
> > whereas a newer, rebased version was later published. See:
> > https://lore.kernel.org/lkml/20220221182009.1283-1-paul.gortma...@windriver.com/
> 
> Let me remind myself of what got merged upstream and what didn't and
> why, and I'll follow up shortly with a Yocto specific update.

Sorry for the delayed reply.  The commit log kind of confused me for a
while until I had a quiet moment to get the cobwebs out of my head and
realize what happened.

Your fix is correct. The v6.1 (and v6.4) kernels are performing the
sanity tests on uninitialized memory and hence isolcpus= can randomly
reject perfectly valid inputs.  Same for nohz_full= it seems.

I'd suggest we augment the commit log with this:

 --
PG: To be more clear as to what happened here - it isn't a broken older
patch from lkml integrated into linux-yocto.  It is a carry forward of
a correct commit from the v5.15 linux-yocto kernel:

https://git.yoctoproject.org/linux-yocto/commit/?id=97c96388922

...in which case the sanity checks are properly *after* the allocation
and processing of the bootargs into the cpumask.

However, it seems patch (or wiggle?) apparently decided to put the
sanity checks *before* the population of the cpumask during the
carry-forward and generation of the new v6.1 kernel.  Meaning they are
validating uninitialized memory and hence nohz_full= and isolcpus= are
subject to random failures even for valid input ranges.

Acked-by: Paul Gortmaker 
 --

Bruce - both carry-forwards -- the v6.1 [d81fac6e842] and v6.4 kernels
[23b162bc3058] have this issue.  The commit IDs above are in their
respective standard/base version and hence this fix will have to also
land there and be merged out to -rt and and all BSPs etc etc.

The copies in the yocto-kernel-cache also have the sanity checks above
the actual cpulist_parse(str, non_housekeeping_mask) which populates the
cpumask with the data to be validated and hence are also broken.

https://git.yoctoproject.org/yocto-kernel-cache/tree/features/clear_warn_once/sched-isolation-really-align-nohz_full-with-rcu_nocb.patch?h=yocto-6.1
https://git.yoctoproject.org/yocto-kernel-cache/tree/features/clear_warn_once/sched-isolation-really-align-nohz_full-with-rcu_nocb.patch?h=yocto-6.4

Thanks to Adrian for tracking this down and sending the fix!

Paul.
--

> 
> Thanks,
> Paul.
> --
> 
> > 
> > Signed-off-by: Adrian Cinal 
> > ---
> >  kernel/sched/isolation.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> > index 73386019efcb..b97d6e05013d 100644
> > --- a/kernel/sched/isolation.c
> > +++ b/kernel/sched/isolation.c
> > @@ -119,6 +119,12 @@ static int __init housekeeping_setup(char *str, 
> > unsigned long flags)
> > }
> > }
> >  
> > +   alloc_bootmem_cpumask_var(_housekeeping_mask);
> > +   if (cpulist_parse(str, non_housekeeping_mask) < 0) {
> > +   pr_warn("Housekeeping: nohz_full= or isolcpus= incorrect CPU 
> > range\n");
> > +   goto free_non_housekeeping_mask;
> > +   }
> > +
> > if (!cpumask_subset(non_housekeeping_mask, cpu_possible_mask)) {
> > pr_info("housekeeping: kernel parameter 'nohz_full=' or 
> > 'isolcpus=' contains nonexistent CPUs.\n");
> > cpumask_and(non_housekeeping_mask, cpu_possible_mask,
> > @@ -128,12 +134,6 @@ static int __init housekeeping_setup(char *str, 
> > unsigned long flags)
> > if (cpumask_empty(non_housekeeping_mask)) {
> > pr_info("housekeeping: kernel parameter 'nohz_full=' or 
> > 'isolcpus=' has no valid CPUs.\n");
> > free_bootmem_cpumask_var(non_housekeeping_mask);
> > -   return 0;
> > -   }
> > -
> > -   alloc_bootmem_cpumask_var(_housekeeping_mask);
> > -   if (cpulist_parse(str, non_housekeeping_mask) < 0) {
> > -   pr_warn("Housekeeping: nohz_full= or isolcpus= incorrect CPU 
> > range\n");
> > goto free_non_housekeeping_mask;
> > }
> >  
> > -- 
> > 2.41.0
> > 
> 
> > 
> > 
> > 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12975): 
https://lists.yoctoproject.org/g/linux-yocto/message/12975
Mute This Topic: https://lists.yoctoproject.org/mt/99772129/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] Trial merge of v5.15.126 v6.1.45 for linux-yocto

2023-08-14 Thread Kevin Hao
On Mon, Aug 14, 2023 at 12:37:49PM -0400, Bruce Ashfield wrote:
> I used my updated scripts to reference your merge commits. They should be
> closer this time. I did run into some git rerere issues on my end,
> which injected
> bad resolutions and that I had to manually fix. If I missed some manual 
> fixups,
> send patches and fix up the tree.

All the results look very good.

> 
> I've hopefully tweaked things in my flow to avoid that same thing next time.

This is really appreciated.

Thanks,
Kevin


signature.asc
Description: PGP signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12974): 
https://lists.yoctoproject.org/g/linux-yocto/message/12974
Mute This Topic: https://lists.yoctoproject.org/mt/100701313/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto] Trial merge of v5.15.126 v6.1.45 for linux-yocto

2023-08-14 Thread Bruce Ashfield
On Sat, Aug 12, 2023 at 9:49 AM Kevin Hao  wrote:
>
> Hi Bruce,
>
> This is a trial merge of the stable kernel v5.15.126 v6.1.45 for the 
> following branches in the linux-yocto.
>   41c926a2600e  v5.15/standard/sdkv5.10/axxia
>   ea99d17ddeec  v5.15/standard/preempt-rt/sdkv5.10/axxia
>   1863786b889c  v5.15/standard/base
>   b8684f6a203a  v5.15/standard/preempt-rt/base
>   06bb3203d0f0  v5.15/standard/cn-sdkv5.4/octeon
>   26f5c7eae8c7  v5.15/standard/preempt-rt/cn-sdkv5.4/octeon
>   47a72afd8c0f  v5.15/standard/cn-sdkv5.15/octeon 
>#Have textual conflicts
>   80ce5bdb5221  v5.15/standard/preempt-rt/cn-sdkv5.15/octeon  
>#Have textual conflicts
>   951bfe0dba00  v5.15/standard/ti-sdk-5.10/ti-j72xx
>   12faac84662c  v5.15/standard/preempt-rt/ti-sdk-5.10/ti-j72xx
>   a3fb5f19fe1b  v5.15/standard/nxp-sdk-5.15/nxp-soc
>   dedd3ddcfd3d  v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-soc
>   cf1fffd9ab98  v5.15/standard/bcm-2xxx-rpi
>   0bd46bc04312  v5.15/standard/preempt-rt/bcm-2xxx-rpi
>   aa12a285391d  v5.15/standard/nxp-sdk-5.15/nxp-s32g  
>#Have textual conflicts
>   8cb0cdb8793a  v5.15/standard/preempt-rt/nxp-sdk-5.15/nxp-s32g   
>#Have textual conflicts
>   a14be6884013  v5.15/standard/intel-sdk-5.15/intel-socfpga
>   78b5411d9baa  v5.15/standard/preempt-rt/intel-sdk-5.15/intel-socfpga
>   406155cefb20  v5.15/standard/x86
>   16c7e9124dea  v5.15/standard/preempt-rt/x86
>   36d825c29e88  v5.15/standard/sdkv5.15/xlnx-soc
>   5a3f7c3d57fe  v5.15/standard/preempt-rt/sdkv5.15/xlnx-soc
>   f22dbd8663c2  v6.1/standard/base
>   1257a3a80e25  v6.1/standard/preempt-rt/base
>   77b688e7aa05  v6.1/standard/ti-sdk-6.1/ti-j7xxx
>   06a35539dfd0  v6.1/standard/preempt-rt/ti-sdk-6.1/ti-j7xxx
>   e61ca2f13f5b  v6.1/standard/nxp-sdk-6.1/nxp-soc
>   815688210f63  v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc
>   c32a28befc98  v6.1/standard/cn-sdkv5.15/octeon  
>#Have textual conflicts
>   4252f10ce6c4  v6.1/standard/preempt-rt/cn-sdkv5.15/octeon   
>#Have textual conflicts
>   581710c04d29  v6.1/standard/bcm-2xxx-rpi
>   4aa1a2a51846  v6.1/standard/preempt-rt/bcm-2xxx-rpi
>   1cb4f02148f4  v6.1/standard/nxp-sdk-5.15/nxp-s32g   
>#Have textual and semantic conflicts
>   1c9a776ed930  v6.1/standard/preempt-rt/nxp-sdk-5.15/nxp-s32g
>#Have textual and semantic conflicts
>   a1dd781056dc  v6.1/standard/intel-sdk-6.1/intel-socfpga
>   ebdf62776f12  v6.1/standard/preempt-rt/intel-sdk-6.1/intel-socfpga
>   5595cd68425f  v6.1/standard/x86
>   75d25e00ac25  v6.1/standard/preempt-rt/x86
>   6e84707b7ada  v6.1/standard/sdkv6.1/xlnx-soc
>   54cb5129ccb8  v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc
>
> This stable release seems pretty normal. There are several merge conflicts,
> but none of them seems significant. The only thing to pay attention to is
> a semantic conflict in the v6.1 s32g branchs. All the branches have passed
> my build test. I have pushed all these branches to:
> https://github.com/haokexin/linux
>
> You can use this as a reference for the linux-yocto stable kernel bump.

Thanks Kevin,

I used my updated scripts to reference your merge commits. They should be
closer this time. I did run into some git rerere issues on my end,
which injected
bad resolutions and that I had to manually fix. If I missed some manual fixups,
send patches and fix up the tree.

I've hopefully tweaked things in my flow to avoid that same thing next time.

Bruce

>
> Thanks,
> Kevin



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12973): 
https://lists.yoctoproject.org/g/linux-yocto/message/12973
Mute This Topic: https://lists.yoctoproject.org/mt/100701313/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto]: [kernel/kernel-rt]: watchdog: core: stop watchdog when executing poweroff command

2023-08-14 Thread Bruce Ashfield
In message: [linux-yocto]: [kernel/kernel-rt]: watchdog: core: stop watchdog 
when executing poweroff command
on 14/08/2023 Meng Li wrote:

> From: Limeng 
> 
> Hi Bruce,
> 
> This patch is used to stop watchdog when executing poweroff command
> So, could you please help merge these patches into linux-ycoto kernel, both 
> below 2 branchs?
> v6.1/standard/nxp-sdk-6.1/nxp-soc
> v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc

merged.

Bruce

> 
> diffstat info as below:
> 
>  watchdog_core.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> thanks,
> Limeng

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12972): 
https://lists.yoctoproject.org/g/linux-yocto/message/12972
Mute This Topic: https://lists.yoctoproject.org/mt/100735099/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [linux-yocto][v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc][PATCH] arm64: dts: versal: add i2c devices

2023-08-14 Thread Bruce Ashfield
In message: [linux-yocto][v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc][PATCH] 
arm64: dts: versal: add i2c devices
on 14/08/2023 quanyang.w...@windriver.com wrote:

> From: Quanyang Wang 
> 
> The vck190/vmk180 boards are equipped with i2c devices:
>   - GPIO Expander: TCA6416
>   - I2C Switch: PCA9548
>   - Programmable XO/VCXO: SI570
>   - EEPROM: M24128-BR
>   - System Synchronizer for IEEE 1588: 8A34001
>   - Current & Power Monitor: INA226
>   - Fan Speed Controller: MAX6643
> 
> This patch add listed devices to dts.
> 
> Signed-off-by: Quanyang Wang 
> Signed-off-by: Bruce Ashfield 
> ---
> Hi Bruce,
> Would you please help merge this patch to the branches:
>   v6.1/standard/preempt-rt/sdkv6.1/xlnx-soc
>   v6.1/standard/sdkv6.1/xlnx-soc

merged.

Bruce

> Thanks,
> Quanyang
> ---
>  .../boot/dts/xilinx/versal-vmk180-revA.dts| 327 ++
>  1 file changed, 327 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/xilinx/versal-vmk180-revA.dts 
> b/arch/arm64/boot/dts/xilinx/versal-vmk180-revA.dts
> index 10c67c9339d3..db394ac081ac 100644
> --- a/arch/arm64/boot/dts/xilinx/versal-vmk180-revA.dts
> +++ b/arch/arm64/boot/dts/xilinx/versal-vmk180-revA.dts
> @@ -118,10 +118,337 @@  { /* PMC_MIO_49, LPD_MIO12-23 */
>  
>   { /* PMC_MIO46/47 */
>   status = "okay";
> +
> + tca6416_u233: gpio@20 {
> + compatible = "ti,tca6416";
> + reg = <0x20>;
> + gpio-controller; /* IRQ not connected */
> + #gpio-cells = <2>;
> + gpio-line-names = "MAX6643_OT_B", "MAX6643_FANFAIL_B", "", "", 
> "PMBUS2_INA226_ALERT", "", "",
> + "MAX6643_FULLSPD", "FMCP1_FMC_PRSNT_M2C_B", 
> "FMCP2_FMC_PRSNT_M2C_B",
> + "FMCP1_FMCP_PRSNT_M2C_B", 
> "FMCP2_FMCP_PRSNT_M2C_B", "VCCINT_VRHOT_B",
> + "8A34001_EXP_RST_B", "PMBUS_ALERT", 
> "PMBUS1_INA226_ALERT";
> + };
> +
> + i2c-mux@74 {
> + compatible = "nxp,pca9548"; /* u33 */
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <0x74>;
> +
> + i2c@0 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <0>;
> + /* PMBUS */
> + };
> + i2c@1 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <1>;
> + /* PMBUS1_INA226 */
> + u65: ina226@40 { /* u65 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u65";
> + reg = <0x40>;
> + shunt-resistor = <500>; /* R440 */
> + };
> + u161: ina226@41 { /* u161 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u161";
> + reg = <0x41>;
> + shunt-resistor = <500>; /* R1702 */
> + };
> + u163: ina226@42 { /* u163 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u163";
> + reg = <0x42>;
> + shunt-resistor = <5000>; /* R1214 */
> + };
> + u162: ina226@43 { /* u162 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u162";
> + reg = <0x43>;
> + shunt-resistor = <5000>; /* R1221 */
> + };
> + u165: ina226@44 { /* u165 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u165";
> + reg = <0x44>;
> + shunt-resistor = <5000>; /* R1216 */
> + };
> + u164: ina226@45 { /* u164 */
> + compatible = "ti,ina226";
> + #io-channel-cells = <1>;
> + label = "ina226-u164";
> + reg = <0x45>;
> + shunt-resistor = <5000>; /* R1219 */
> + };
> + };
> + /* 2 unconnected */
> + i2c@3 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <3>;
> + /* PMBUS2_INA226 */
> + u166: ina226@40 { /* u166 

[linux-yocto] [PATCH] watchdog: core: stop watchdog when executing poweroff command

2023-08-14 Thread Meng Li via lists.yoctoproject.org
On some platforms, for example, NXP ls1028 platform, the watchdog
is started in u-boot, and so kernel will create a timer and work to
keep watchdog alive. But when user executes commands "poweroff" or
"shutdown -h", the system is reset when watchdog triggers timeout even
if WDOG_STOP_ON_REBOOT is set in watchdog driver. The root cause is
that the watchdog is not stopped properly because the SYS_POWER_OFF case
is not supported in notify callback function. So, add this case to stop
watchdog when executing poweroff command.

Signed-off-by: Meng Li 
---
 drivers/watchdog/watchdog_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index c777a612d932..401d5d4db3fe 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -161,7 +161,7 @@ static int watchdog_reboot_notifier(struct notifier_block 
*nb,
struct watchdog_device *wdd;
 
wdd = container_of(nb, struct watchdog_device, reboot_nb);
-   if (code == SYS_DOWN || code == SYS_HALT) {
+   if (code == SYS_DOWN || code == SYS_HALT || code == SYS_POWER_OFF) {
if (watchdog_active(wdd) || watchdog_hw_running(wdd)) {
int ret;
 
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12970): 
https://lists.yoctoproject.org/g/linux-yocto/message/12970
Mute This Topic: https://lists.yoctoproject.org/mt/100735102/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto]: [kernel/kernel-rt]: watchdog: core: stop watchdog when executing poweroff command

2023-08-14 Thread Meng Li via lists.yoctoproject.org
From: Limeng 

Hi Bruce,

This patch is used to stop watchdog when executing poweroff command
So, could you please help merge these patches into linux-ycoto kernel, both 
below 2 branchs?
v6.1/standard/nxp-sdk-6.1/nxp-soc
v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc

diffstat info as below:

 watchdog_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


thanks,
Limeng

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12969): 
https://lists.yoctoproject.org/g/linux-yocto/message/12969
Mute This Topic: https://lists.yoctoproject.org/mt/100735099/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-