[PATCH v2] Documentation: Coccinelle: Improve command example for debugging patches
Modify Coccinelle documentation to clarify usage of make command to run coccicheck on a folder. Changes in v2: - Give example of folder instead of file - Add note Signed-off-by: Sumera Priyadarsini --- Documentation/dev-tools/coccinelle.rst | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Documentation/dev-tools/coccinelle.rst b/Documentation/dev-tools/coccinelle.rst index 74c5e6aeeff5..9c454de5a7f7 100644 --- a/Documentation/dev-tools/coccinelle.rst +++ b/Documentation/dev-tools/coccinelle.rst @@ -224,14 +224,21 @@ you may want to use:: rm -f err.log export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci -make coccicheck DEBUG_FILE="err.log" MODE=report SPFLAGS="--profile --show-trying" M=./drivers/mfd/arizona-irq.c +make coccicheck DEBUG_FILE="err.log" MODE=report SPFLAGS="--profile --show-trying" M=./drivers/mfd err.log will now have the profiling information, while stdout will provide some progress information as Coccinelle moves forward with work. +NOTE: + DEBUG_FILE support is only supported when using coccinelle >= 1.0.2. +Currently, DEBUG_FILE support is only available to check folders, and +not single files. This is because checking a single file requires spatch +to be called twice leading to DEBUG_FILE being set both times to the same value, +giving rise to an error. + .cocciconfig support -- 2.25.1
RE: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses
> -Original Message- > From: Miles Chen [mailto:miles.c...@mediatek.com] > Sent: Thursday, November 26, 2020 8:49 PM > To: Song Bao Hua (Barry Song) > Cc: Alexey Dobriyan ; Andrew Morton > ; linux-kernel@vger.kernel.org; > linux-fsde...@vger.kernel.org; linux-media...@lists.infradead.org; > wsd_upstr...@mediatek.com > Subject: RE: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read > addresses > > On Thu, 2020-11-26 at 07:16 +, Song Bao Hua (Barry Song) wrote: > > > > > -Original Message- > > > From: Miles Chen [mailto:miles.c...@mediatek.com] > > > Sent: Monday, November 23, 2020 7:39 PM > > > To: Alexey Dobriyan ; Andrew Morton > > > > > > Cc: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org; > > > linux-media...@lists.infradead.org; wsd_upstr...@mediatek.com; Miles > > > Chen > > > Subject: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read > > > addresses > > > > > > When we try to visit the pagemap of a tagged userspace pointer, we find > > > that the start_vaddr is not correct because of the tag. > > > To fix it, we should untag the usespace pointers in pagemap_read(). > > > > > > I tested with 5.10-rc4 and the issue remains. > > > > > > My test code is baed on [1]: > > > > > > A userspace pointer which has been tagged by 0xb4: 0xb47662f541c8 > > > > > > === userspace program === > > > > > > uint64 OsLayer::VirtualToPhysical(void *vaddr) { > > > uint64 frame, paddr, pfnmask, pagemask; > > > int pagesize = sysconf(_SC_PAGESIZE); > > > off64_t off = ((uintptr_t)vaddr) / pagesize * 8; // off = > > > 0xb47662f541c8 / pagesize * 8 = 0x5a3b317aa0 > > > int fd = open(kPagemapPath, O_RDONLY); > > > ... > > > > > > if (lseek64(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { > > > int err = errno; > > > string errtxt = ErrorString(err); > > > if (fd >= 0) > > > close(fd); > > > return 0; > > > } > > > ... > > > } > > > > > > === kernel fs/proc/task_mmu.c === > > > > > > static ssize_t pagemap_read(struct file *file, char __user *buf, > > > size_t count, loff_t *ppos) > > > { > > > ... > > > src = *ppos; > > > svpfn = src / PM_ENTRY_BYTES; // svpfn == 0xb47662f54 > > > start_vaddr = svpfn << PAGE_SHIFT; // start_vaddr == > > > 0xb47662f54000 > > > end_vaddr = mm->task_size; > > > > > > /* watch out for wraparound */ > > > // svpfn == 0xb47662f54 > > > // (mm->task_size >> PAGE) == 0x800 > > > if (svpfn > mm->task_size >> PAGE_SHIFT) // the condition is true > > > because > > > of the tag 0xb4 > > > start_vaddr = end_vaddr; > > > > > > ret = 0; > > > while (count && (start_vaddr < end_vaddr)) { // we cannot visit correct > > > entry because start_vaddr is set to end_vaddr > > > int len; > > > unsigned long end; > > > ... > > > } > > > ... > > > } > > > > > > [1] > > > > https://github.com/stressapptest/stressapptest/blob/master/src/os.cc#L158 > > > > > > Signed-off-by: Miles Chen > > > --- > > > fs/proc/task_mmu.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > > > index 217aa2705d5d..e9a70f7ee515 100644 > > > --- a/fs/proc/task_mmu.c > > > +++ b/fs/proc/task_mmu.c > > > @@ -1599,11 +1599,11 @@ static ssize_t pagemap_read(struct file *file, > char > > > __user *buf, > > > > > > src = *ppos; > > > svpfn = src / PM_ENTRY_BYTES; > > > - start_vaddr = svpfn << PAGE_SHIFT; > > > + start_vaddr = untagged_addr(svpfn << PAGE_SHIFT); > > > end_vaddr = mm->task_size; > > > > > > /* watch out for wraparound */ > > > - if (svpfn > mm->task_size >> PAGE_SHIFT) > > > + if (start_vaddr > mm->task_size) > > > start_vaddr = end_vaddr; > > > > Wouldn't the untag be done by the user reading pagemap file? > > With this patch, even users pass an illegal address, for example, > > users put a tag on a virtual address which hasn't really a tag, > > they will still get the right pagemap. > > > > > I run arm64 devices. > If the tagged pointer is enabled, the ARM top-byte Ignore is also > enabled. It means the top-byte is always be ignored. > > I think the kernel should not break existing userspace program, so it's > better to handle the tagged user pointer in kernel. > > grep 'untag' mm -RnH to see existing examples. I see your point. But the existing examples such as gup etc are receiving an address from userspace. pagemap isn't getting an address, it is getting a file offset which should be figured out by userspace correctly. While we read a file, we should make sure the offset is in the range of the file length. > > > thanks, > Miles > > > > > > > /* > > > -- > > > 2.18.0 > > Thanks Barry
RE: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses
On Thu, 2020-11-26 at 07:16 +, Song Bao Hua (Barry Song) wrote: > > > -Original Message- > > From: Miles Chen [mailto:miles.c...@mediatek.com] > > Sent: Monday, November 23, 2020 7:39 PM > > To: Alexey Dobriyan ; Andrew Morton > > > > Cc: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org; > > linux-media...@lists.infradead.org; wsd_upstr...@mediatek.com; Miles > > Chen > > Subject: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read > > addresses > > > > When we try to visit the pagemap of a tagged userspace pointer, we find > > that the start_vaddr is not correct because of the tag. > > To fix it, we should untag the usespace pointers in pagemap_read(). > > > > I tested with 5.10-rc4 and the issue remains. > > > > My test code is baed on [1]: > > > > A userspace pointer which has been tagged by 0xb4: 0xb47662f541c8 > > > > === userspace program === > > > > uint64 OsLayer::VirtualToPhysical(void *vaddr) { > > uint64 frame, paddr, pfnmask, pagemask; > > int pagesize = sysconf(_SC_PAGESIZE); > > off64_t off = ((uintptr_t)vaddr) / pagesize * 8; // off = > > 0xb47662f541c8 / pagesize * 8 = 0x5a3b317aa0 > > int fd = open(kPagemapPath, O_RDONLY); > > ... > > > > if (lseek64(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { > > int err = errno; > > string errtxt = ErrorString(err); > > if (fd >= 0) > > close(fd); > > return 0; > > } > > ... > > } > > > > === kernel fs/proc/task_mmu.c === > > > > static ssize_t pagemap_read(struct file *file, char __user *buf, > > size_t count, loff_t *ppos) > > { > > ... > > src = *ppos; > > svpfn = src / PM_ENTRY_BYTES; // svpfn == 0xb47662f54 > > start_vaddr = svpfn << PAGE_SHIFT; // start_vaddr == > > 0xb47662f54000 > > end_vaddr = mm->task_size; > > > > /* watch out for wraparound */ > > // svpfn == 0xb47662f54 > > // (mm->task_size >> PAGE) == 0x800 > > if (svpfn > mm->task_size >> PAGE_SHIFT) // the condition is true > > because > > of the tag 0xb4 > > start_vaddr = end_vaddr; > > > > ret = 0; > > while (count && (start_vaddr < end_vaddr)) { // we cannot visit correct > > entry because start_vaddr is set to end_vaddr > > int len; > > unsigned long end; > > ... > > } > > ... > > } > > > > [1] > > https://github.com/stressapptest/stressapptest/blob/master/src/os.cc#L158 > > > > Signed-off-by: Miles Chen > > --- > > fs/proc/task_mmu.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > > index 217aa2705d5d..e9a70f7ee515 100644 > > --- a/fs/proc/task_mmu.c > > +++ b/fs/proc/task_mmu.c > > @@ -1599,11 +1599,11 @@ static ssize_t pagemap_read(struct file *file, char > > __user *buf, > > > > src = *ppos; > > svpfn = src / PM_ENTRY_BYTES; > > - start_vaddr = svpfn << PAGE_SHIFT; > > + start_vaddr = untagged_addr(svpfn << PAGE_SHIFT); > > end_vaddr = mm->task_size; > > > > /* watch out for wraparound */ > > - if (svpfn > mm->task_size >> PAGE_SHIFT) > > + if (start_vaddr > mm->task_size) > > start_vaddr = end_vaddr; > > Wouldn't the untag be done by the user reading pagemap file? > With this patch, even users pass an illegal address, for example, > users put a tag on a virtual address which hasn't really a tag, > they will still get the right pagemap. > I run arm64 devices. If the tagged pointer is enabled, the ARM top-byte Ignore is also enabled. It means the top-byte is always be ignored. I think the kernel should not break existing userspace program, so it's better to handle the tagged user pointer in kernel. grep 'untag' mm -RnH to see existing examples. thanks, Miles > > > > /* > > -- > > 2.18.0 > > Thanks > Barry >
[PATCH v2] ARM: zynq: Add Z-turn board V5
From: Alexandre GRIVEAUX Adding Z-turn board V5 to resolve the change between: "Z-TURNBOARD_schematic.pdf" schematics state version 1 to 4 has Atheros AR8035 "Z-Turn_Board_sch_V15_20160303.pdf" schematics state version 5 has Micrel KSZ9031 Changes v1 -> v2: Instead of using new board, the v2 using a common devicetree for z-turn boards (zynq-zturn-common.dtsi) and for each board a specific DT Signed-off-by: Alexandre GRIVEAUX --- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/zynq-zturn-common.dtsi | 112 +++ arch/arm/boot/dts/zynq-zturn-v5.dts | 15 +++ arch/arm/boot/dts/zynq-zturn.dts | 101 +--- 4 files changed, 129 insertions(+), 100 deletions(-) create mode 100644 arch/arm/boot/dts/zynq-zturn-common.dtsi create mode 100644 arch/arm/boot/dts/zynq-zturn-v5.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index ce66ffd5a1bb..3de85fe42f76 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1302,6 +1302,7 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \ zynq-zc770-xm013.dtb \ zynq-zed.dtb \ zynq-zturn.dtb \ + zynq-zturn-v5.dtb \ zynq-zybo.dtb \ zynq-zybo-z7.dtb dtb-$(CONFIG_MACH_ARMADA_370) += \ diff --git a/arch/arm/boot/dts/zynq-zturn-common.dtsi b/arch/arm/boot/dts/zynq-zturn-common.dtsi new file mode 100644 index ..84f3c85c5bab --- /dev/null +++ b/arch/arm/boot/dts/zynq-zturn-common.dtsi @@ -0,0 +1,112 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2015 Andrea Merello + * Copyright (C) 2017 Alexander Graf + * + * Based on zynq-zed.dts which is: + * Copyright (C) 2011 - 2014 Xilinx + * Copyright (C) 2012 National Instruments Corp. + * + */ + +/dts-v1/; +/include/ "zynq-7000.dtsi" + +/ { + compatible = "xlnx,zynq-7000"; + + aliases { + ethernet0 = &gem0; + serial0 = &uart1; + serial1 = &uart0; + mmc0 = &sdhci0; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-leds { + compatible = "gpio-leds"; + usr-led1 { + label = "usr-led1"; + gpios = <&gpio0 0x0 0x1>; + default-state = "off"; + }; + + usr-led2 { + label = "usr-led2"; + gpios = <&gpio0 0x9 0x1>; + default-state = "off"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + K1 { + label = "K1"; + gpios = <&gpio0 0x32 0x1>; + linux,code = <0x66>; + wakeup-source; + autorepeat; + }; + }; +}; + +&clkc { + ps-clk-frequency = <>; +}; + +&gem0 { + status = "okay"; + phy-mode = "rgmii-id"; + phy-handle = <ðernet_phy>; + + ethernet_phy: ethernet-phy@0 { + }; +}; + +&sdhci0 { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&usb0 { + status = "okay"; + dr_mode = "host"; +}; + +&can0 { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = <40>; + + stlm75@49 { + status = "okay"; + compatible = "lm75"; + reg = <0x49>; + }; + + accelerometer@53 { + compatible = "adi,adxl345", "adxl345", "adi,adxl34x", "adxl34x"; + reg = <0x53>; + interrupt-parent = <&intc>; + interrupts = <0x0 0x1e 0x4>; + }; +}; diff --git a/arch/arm/boot/dts/zynq-zturn-v5.dts b/arch/arm/boot/dts/zynq-zturn-v5.dts new file mode 100644 index ..536632a09a25 --- /dev/null +++ b/arch/arm/boot/dts/zynq-zturn-v5.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 + +/dts-v1/; +/include/ "zynq-zturn-common.dtsi" + +/ { + model = "Zynq Z-Turn MYIR Board V5"; + compatible = "myir,zynq-zturn-v5", "xlnx,zynq-7000"; +}; + +&gem0 { + ethernet_phy: ethernet-phy@0 { + reg = <0x3>; + }; +}; diff --git a/arch/arm/boot/dts/zynq-zturn.dts b/arch/arm/boot/dts/zynq-zturn.dts index 5ec616ebca08..620b24a25e06 100644 --- a/arch/arm/boot/dts/zynq-zturn.dts +++ b/arch/arm/boot/dts/zynq-zturn.dts @@ -1,114 +1,15 @@ // SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2015 Andrea Merello - * Copyright (C) 2017 Alexander Graf - * - * Based on zynq-zed.dts which is: - * Copyright (C) 2011 - 2014 Xilinx - * Copyright (C) 2012 National Instruments Corp. - * - */ /dts-v1/; -/include/ "zynq-7000.dtsi" +/include/ "zynq-zturn-common.dtsi" / { model = "Z
[PATCH 3/3] arm64: dts: rockchip: rk3328-roc-cc: Enable analog audio
From: Chen-Yu Tsai Now that driver support for the RK3328's audio codec, and the plumbing is defined at the SoC level, we can enable analog audio at the board level. Enable analog audio by enabling the codec and the I2S interface connected and the simple-audio-card that binds them together. Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts index 697fce709031..19959bfba451 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts @@ -104,6 +104,14 @@ user_led: led-1 { }; }; +&analog_sound { + status = "okay"; +}; + +&codec { + status = "okay"; +}; + &cpu0 { cpu-supply = <&vdd_arm>; }; @@ -278,6 +286,10 @@ &i2s0 { status = "okay"; }; +&i2s1 { + status = "okay"; +}; + &io_domains { status = "okay"; -- 2.29.2
[PATCH 2/3] arm64: dts: rockchip: rk3328-roc-cc: Enable HDMI audio
From: Chen-Yu Tsai The RK3328-ROC-CC already has HDMI display output enabled. Now that audio for the HDMI controller is supported, it can be enabled as well. Enable the simple-audio-card, and the I2S interface the audio is fed from. Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts index b76282e704de..697fce709031 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts @@ -161,6 +161,10 @@ &hdmiphy { status = "okay"; }; +&hdmi_sound { + status = "okay"; +}; + &i2c1 { status = "okay"; @@ -270,6 +274,10 @@ regulator-state-mem { }; }; +&i2s0 { + status = "okay"; +}; + &io_domains { status = "okay"; -- 2.29.2
[PATCH 0/3] arm64: dts: rockchip: rk3328-roc-cc: Misc improvements
From: Chen-Yu Tsai Hi, Here are some improvements for the ROC-RK3328-CC. Patch 1 sets dr_mode to "host" for OTG. Since the board has a type A host port wired to the OTG controller, setting this is appropriate. Patch 2 enables HDMI audio. Patch 3 enables analog audio. I opted to use one simple-card for each audio interface since a) the definitions are already in the .dtsi file and b) having one card per interface with proper names makes them easier to identify. The changes are quite trivial. Hope they can be merged for the next release. Regards ChenYu Chen-Yu Tsai (3): arm64: dts: rockchip: rk3328-roc-cc: Set dr_mode to "host" for OTG arm64: dts: rockchip: rk3328-roc-cc: Enable HDMI audio arm64: dts: rockchip: rk3328-roc-cc: Enable analog audio .../arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 21 +++ 1 file changed, 21 insertions(+) -- 2.29.2
[PATCH 1/3] arm64: dts: rockchip: rk3328-roc-cc: Set dr_mode to "host" for OTG
From: Chen-Yu Tsai The board has a standard USB A female port connected to the USB OTG controller's data pins. Set dr_mode in the OTG controller node to indicate this usage, instead of having the implementation guess. Fixes: 2171f4fdac06 ("arm64: dts: rockchip: add roc-rk3328-cc board") Signed-off-by: Chen-Yu Tsai --- arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts index b70ffb1c6a63..b76282e704de 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts @@ -334,6 +334,7 @@ &uart2 { }; &usb20_otg { + dr_mode = "host"; status = "okay"; }; -- 2.29.2
[RESEND PATCH v4 0/6] Add GCC and RPMh clock support for SDX55
Hello, This series adds Global Clock Controller (GCC) and RPMh clock support for SDX55 SoC from Qualcomm with relevant DT bindings. This series has been tested on SDX55 MTP board. The dts patches will be posted separately. Thanks, Mani Changes in v4: * Made core_bi_pll_test_se clock optional in binding * Added GDSC patches Changes in v3: * Documented core_bi_pll_test_se clock in dt binding * Collected reviews Changes in v2: * Modified the GCC Kconfig symbol from GCC_SDX55 to SDX_GCC_55 * Added S-o-b tag to bindings patch * Incorporated review comments from Stephen on the gcc driver * Added review tag from Bjorn on RPMh patch Manivannan Sadhasivam (3): clk: qcom: Add support for SDX55 RPMh clocks dt-bindings: clock: Add GDSC in SDX55 GCC clk: qcom: Add GDSC support for SDX55 GCC Naveen Yadav (1): clk: qcom: Add SDX55 GCC support Vinod Koul (2): dt-bindings: clock: Add SDX55 GCC clock bindings dt-bindings: clock: Introduce RPMHCC bindings for SDX55 .../bindings/clock/qcom,gcc-sdx55.yaml| 77 + .../bindings/clock/qcom,rpmhcc.yaml |1 + drivers/clk/qcom/Kconfig |8 + drivers/clk/qcom/Makefile |1 + drivers/clk/qcom/clk-rpmh.c | 20 + drivers/clk/qcom/gcc-sdx55.c | 1659 + include/dt-bindings/clock/qcom,gcc-sdx55.h| 117 ++ include/dt-bindings/clock/qcom,rpmh.h |1 + 8 files changed, 1884 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml create mode 100644 drivers/clk/qcom/gcc-sdx55.c create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx55.h -- 2.25.1
[RESEND PATCH v4 4/6] clk: qcom: Add support for SDX55 RPMh clocks
Add support for following clocks maintained by RPMh in SDX55 SoCs. * BI TCXO * RF_CLK1 * RF_CLK1_AO * RF_CLK2 * RF_CLK2_AO * QPIC (Qualcomm Technologies, Inc. Parallel Interface Controller) Signed-off-by: Manivannan Sadhasivam Reviewed-by: Vinod Koul Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/clk-rpmh.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c index e2c669b08aff..fb72db957721 100644 --- a/drivers/clk/qcom/clk-rpmh.c +++ b/drivers/clk/qcom/clk-rpmh.c @@ -432,6 +432,25 @@ static const struct clk_rpmh_desc clk_rpmh_sm8250 = { .num_clks = ARRAY_SIZE(sm8250_rpmh_clocks), }; +DEFINE_CLK_RPMH_VRM(sdx55, rf_clk1, rf_clk1_ao, "rfclkd1", 1); +DEFINE_CLK_RPMH_VRM(sdx55, rf_clk2, rf_clk2_ao, "rfclkd2", 1); +DEFINE_CLK_RPMH_BCM(sdx55, qpic_clk, "QP0"); + +static struct clk_hw *sdx55_rpmh_clocks[] = { + [RPMH_CXO_CLK] = &sdm845_bi_tcxo.hw, + [RPMH_CXO_CLK_A]= &sdm845_bi_tcxo_ao.hw, + [RPMH_RF_CLK1] = &sdx55_rf_clk1.hw, + [RPMH_RF_CLK1_A]= &sdx55_rf_clk1_ao.hw, + [RPMH_RF_CLK2] = &sdx55_rf_clk2.hw, + [RPMH_RF_CLK2_A]= &sdx55_rf_clk2_ao.hw, + [RPMH_QPIC_CLK] = &sdx55_qpic_clk.hw, +}; + +static const struct clk_rpmh_desc clk_rpmh_sdx55 = { + .clks = sdx55_rpmh_clocks, + .num_clks = ARRAY_SIZE(sdx55_rpmh_clocks), +}; + static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec, void *data) { @@ -517,6 +536,7 @@ static int clk_rpmh_probe(struct platform_device *pdev) static const struct of_device_id clk_rpmh_match_table[] = { { .compatible = "qcom,sc7180-rpmh-clk", .data = &clk_rpmh_sc7180}, { .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845}, + { .compatible = "qcom,sdx55-rpmh-clk", .data = &clk_rpmh_sdx55}, { .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150}, { .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250}, { } -- 2.25.1
[RESEND PATCH v4 1/6] dt-bindings: clock: Add SDX55 GCC clock bindings
From: Vinod Koul Add device tree bindings for global clock controller on SDX55 SoCs. Signed-off-by: Vinod Koul Signed-off-by: Manivannan Sadhasivam Reviewed-by: Rob Herring --- .../bindings/clock/qcom,gcc-sdx55.yaml| 77 include/dt-bindings/clock/qcom,gcc-sdx55.h| 112 ++ 2 files changed, 189 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx55.h diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml new file mode 100644 index ..1121b3934cb9 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,gcc-sdx55.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Global Clock & Reset Controller Binding for SDX55 + +maintainers: + - Vinod Koul + - Manivannan Sadhasivam + +description: | + Qualcomm global clock control module which supports the clocks, resets and + power domains on SDX55 + + See also: + - dt-bindings/clock/qcom,gcc-sdx55.h + +properties: + compatible: +const: qcom,gcc-sdx55 + + clocks: +items: + - description: Board XO source + - description: Sleep clock source + - description: PLL test clock source (Optional clock) +minItems: 2 +maxItems: 3 + + clock-names: +items: + - const: bi_tcxo + - const: sleep_clk + - const: core_bi_pll_test_se # Optional clock +minItems: 2 +maxItems: 3 + + '#clock-cells': +const: 1 + + '#reset-cells': +const: 1 + + '#power-domain-cells': +const: 1 + + reg: +maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - reg + - '#clock-cells' + - '#reset-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | +#include +clock-controller@10 { + compatible = "qcom,gcc-sdx55"; + reg = <0x0010 0x1f>; + clocks = <&rpmhcc RPMH_CXO_CLK>, + <&sleep_clk>, <&pll_test_clk>; + clock-names = "bi_tcxo", "sleep_clk", "core_bi_pll_test_se"; + #clock-cells = <1>; + #reset-cells = <1>; + #power-domain-cells = <1>; +}; + +... diff --git a/include/dt-bindings/clock/qcom,gcc-sdx55.h b/include/dt-bindings/clock/qcom,gcc-sdx55.h new file mode 100644 index ..c372451b3461 --- /dev/null +++ b/include/dt-bindings/clock/qcom,gcc-sdx55.h @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, Linaro Ltd. + */ + +#ifndef _DT_BINDINGS_CLK_QCOM_GCC_SDX55_H +#define _DT_BINDINGS_CLK_QCOM_GCC_SDX55_H + +#define GPLL0 3 +#define GPLL0_OUT_EVEN 4 +#define GPLL4 5 +#define GPLL4_OUT_EVEN 6 +#define GPLL5 7 +#define GCC_AHB_PCIE_LINK_CLK 8 +#define GCC_BLSP1_AHB_CLK 9 +#define GCC_BLSP1_QUP1_I2C_APPS_CLK10 +#define GCC_BLSP1_QUP1_I2C_APPS_CLK_SRC11 +#define GCC_BLSP1_QUP1_SPI_APPS_CLK12 +#define GCC_BLSP1_QUP1_SPI_APPS_CLK_SRC13 +#define GCC_BLSP1_QUP2_I2C_APPS_CLK14 +#define GCC_BLSP1_QUP2_I2C_APPS_CLK_SRC15 +#define GCC_BLSP1_QUP2_SPI_APPS_CLK16 +#define GCC_BLSP1_QUP2_SPI_APPS_CLK_SRC17 +#define GCC_BLSP1_QUP3_I2C_APPS_CLK18 +#define GCC_BLSP1_QUP3_I2C_APPS_CLK_SRC19 +#define GCC_BLSP1_QUP3_SPI_APPS_CLK20 +#define GCC_BLSP1_QUP3_SPI_APPS_CLK_SRC21 +#define GCC_BLSP1_QUP4_I2C_APPS_CLK22 +#define GCC_BLSP1_QUP4_I2C_APPS_CLK_SRC23 +#define GCC_BLSP1_QUP4_SPI_APPS_CLK24 +#define GCC_BLSP1_QUP4_SPI_APPS_CLK_SRC25 +#define GCC_BLSP1_UART1_APPS_CLK 26 +#define GCC_BLSP1_UART1_APPS_CLK_SRC 27 +#define GCC_BLSP1_UART2_APPS_CLK 28 +#define GCC_BLSP1_UART2_APPS_CLK_SRC 29 +#define GCC_BLSP1_UART3_APPS_CLK 30 +#define GCC_BLSP1_UART3_APPS_CLK_SRC 31 +#define GCC_BLSP1_UART4_APPS_CLK 32 +#define GCC_BLS
[RESEND PATCH v4 3/6] dt-bindings: clock: Introduce RPMHCC bindings for SDX55
From: Vinod Koul Add compatible for SDX55 RPMHCC and DT include. Signed-off-by: Vinod Koul Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bjorn Andersson Acked-by: Rob Herring --- Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml | 1 + include/dt-bindings/clock/qcom,rpmh.h| 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml index a46a3a799a70..a54930f111ba 100644 --- a/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml @@ -19,6 +19,7 @@ properties: enum: - qcom,sc7180-rpmh-clk - qcom,sdm845-rpmh-clk + - qcom,sdx55-rpmh-clk - qcom,sm8150-rpmh-clk - qcom,sm8250-rpmh-clk diff --git a/include/dt-bindings/clock/qcom,rpmh.h b/include/dt-bindings/clock/qcom,rpmh.h index 2e6c54e65455..cd806eccb7dd 100644 --- a/include/dt-bindings/clock/qcom,rpmh.h +++ b/include/dt-bindings/clock/qcom,rpmh.h @@ -21,5 +21,6 @@ #define RPMH_IPA_CLK 12 #define RPMH_LN_BB_CLK113 #define RPMH_LN_BB_CLK1_A 14 +#define RPMH_QPIC_CLK 15 #endif -- 2.25.1
[RESEND PATCH v4 2/6] clk: qcom: Add SDX55 GCC support
From: Naveen Yadav Add Global Clock Controller (GCC) support for SDX55 SoCs from Qualcomm. Signed-off-by: Naveen Yadav [mani: converted to parent_data, commented critical clocks, cleanups] Signed-off-by: Manivannan Sadhasivam Reviewed-by: Vinod Koul --- drivers/clk/qcom/Kconfig |7 + drivers/clk/qcom/Makefile|1 + drivers/clk/qcom/gcc-sdx55.c | 1626 ++ 3 files changed, 1634 insertions(+) create mode 100644 drivers/clk/qcom/gcc-sdx55.c diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 3a965bd326d5..7897a3947e6d 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -413,6 +413,13 @@ config SDM_LPASSCC_845 Say Y if you want to use the LPASS branch clocks of the LPASS clock controller to reset the LPASS subsystem. +config SDX_GCC_55 + tristate "SDX55 Global Clock Controller" + help + Support for the global clock controller on SDX55 devices. + Say Y if you want to use peripheral devices such as UART, + SPI, I2C, USB, SD/UFS, PCIe etc. + config SM_DISPCC_8250 tristate "SM8150 and SM8250 Display Clock Controller" depends on SM_GCC_8150 || SM_GCC_8250 diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index 11ae86febe87..886b877e70c7 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -64,6 +64,7 @@ obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o +obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o diff --git a/drivers/clk/qcom/gcc-sdx55.c b/drivers/clk/qcom/gcc-sdx55.c new file mode 100644 index ..bf114165e24b --- /dev/null +++ b/drivers/clk/qcom/gcc-sdx55.c @@ -0,0 +1,1626 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, Linaro Ltd. + */ + +#include +#include +#include +#include + +#include + +#include "common.h" +#include "clk-alpha-pll.h" +#include "clk-branch.h" +#include "clk-pll.h" +#include "clk-rcg.h" +#include "clk-regmap.h" +#include "reset.h" + +enum { + P_BI_TCXO, + P_CORE_BI_PLL_TEST_SE, + P_GPLL0_OUT_EVEN, + P_GPLL0_OUT_MAIN, + P_GPLL4_OUT_EVEN, + P_GPLL5_OUT_MAIN, + P_SLEEP_CLK, +}; + +static const struct pll_vco lucid_vco[] = { + { 24960, 20, 0 }, +}; + +static struct clk_alpha_pll gpll0 = { + .offset = 0x0, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .vco_table = lucid_vco, + .num_vco = ARRAY_SIZE(lucid_vco), + .clkr = { + .enable_reg = 0x6d000, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gpll0", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + }, + .num_parents = 1, + .ops = &clk_alpha_pll_fixed_lucid_ops, + }, + }, +}; + +static const struct clk_div_table post_div_table_lucid_even[] = { + { 0x0, 1 }, + { 0x1, 2 }, + { 0x3, 4 }, + { 0x7, 8 }, + { } +}; + +static struct clk_alpha_pll_postdiv gpll0_out_even = { + .offset = 0x0, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .post_div_shift = 8, + .post_div_table = post_div_table_lucid_even, + .num_post_div = ARRAY_SIZE(post_div_table_lucid_even), + .width = 4, + .clkr.hw.init = &(struct clk_init_data){ + .name = "gpll0_out_even", + .parent_data = &(const struct clk_parent_data){ + .hw = &gpll0.clkr.hw, + }, + .num_parents = 1, + .ops = &clk_alpha_pll_postdiv_lucid_ops, + }, +}; + +static struct clk_alpha_pll gpll4 = { + .offset = 0x76000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .vco_table = lucid_vco, + .num_vco = ARRAY_SIZE(lucid_vco), + .clkr = { + .enable_reg = 0x6d000, + .enable_mask = BIT(4), + .hw.init = &(struct clk_init_data){ + .name = "gpll4", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + }, + .num_parents = 1, + .ops = &clk_alpha_pll_fixed_lucid_ops, + }, + }, +}; + +static struct clk_alpha_pll_postdiv gpll4_out_even = { + .offset = 0x76000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .post_div_shift = 8, + .post_
[RESEND PATCH v4 6/6] clk: qcom: Add GDSC support for SDX55 GCC
Add GDSC support to control the power supply of power domains in SDX55 GCC. Signed-off-by: Manivannan Sadhasivam --- drivers/clk/qcom/Kconfig | 1 + drivers/clk/qcom/gcc-sdx55.c | 33 + 2 files changed, 34 insertions(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 7897a3947e6d..05055fd18e6e 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -415,6 +415,7 @@ config SDM_LPASSCC_845 config SDX_GCC_55 tristate "SDX55 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SDX55 devices. Say Y if you want to use peripheral devices such as UART, diff --git a/drivers/clk/qcom/gcc-sdx55.c b/drivers/clk/qcom/gcc-sdx55.c index bf114165e24b..e3b9030b2bae 100644 --- a/drivers/clk/qcom/gcc-sdx55.c +++ b/drivers/clk/qcom/gcc-sdx55.c @@ -17,6 +17,7 @@ #include "clk-pll.h" #include "clk-rcg.h" #include "clk-regmap.h" +#include "gdsc.h" #include "reset.h" enum { @@ -1455,6 +1456,30 @@ static struct clk_branch gcc_xo_pcie_link_clk = { }, }; +static struct gdsc usb30_gdsc = { + .gdscr = 0x0b004, + .pd = { + .name = "usb30_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + +static struct gdsc pcie_gdsc = { + .gdscr = 0x37004, + .pd = { + .name = "pcie_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + +static struct gdsc emac_gdsc = { + .gdscr = 0x47004, + .pd = { + .name = "emac_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + static struct clk_regmap *gcc_sdx55_clocks[] = { [GCC_AHB_PCIE_LINK_CLK] = &gcc_ahb_pcie_link_clk.clkr, [GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr, @@ -1560,6 +1585,12 @@ static const struct qcom_reset_map gcc_sdx55_resets[] = { [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0xe000 }, }; +static struct gdsc *gcc_sdx55_gdscs[] = { + [USB30_GDSC] = &usb30_gdsc, + [PCIE_GDSC] = &pcie_gdsc, + [EMAC_GDSC] = &emac_gdsc, +}; + static const struct regmap_config gcc_sdx55_regmap_config = { .reg_bits = 32, .reg_stride = 4, @@ -1574,6 +1605,8 @@ static const struct qcom_cc_desc gcc_sdx55_desc = { .num_clks = ARRAY_SIZE(gcc_sdx55_clocks), .resets = gcc_sdx55_resets, .num_resets = ARRAY_SIZE(gcc_sdx55_resets), + .gdscs = gcc_sdx55_gdscs, + .num_gdscs = ARRAY_SIZE(gcc_sdx55_gdscs), }; static const struct of_device_id gcc_sdx55_match_table[] = { -- 2.25.1
[RESEND PATCH v4 5/6] dt-bindings: clock: Add GDSC in SDX55 GCC
Add GDSC instances in SDX55 GCC block. Signed-off-by: Manivannan Sadhasivam --- include/dt-bindings/clock/qcom,gcc-sdx55.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/dt-bindings/clock/qcom,gcc-sdx55.h b/include/dt-bindings/clock/qcom,gcc-sdx55.h index c372451b3461..fb9a5942f793 100644 --- a/include/dt-bindings/clock/qcom,gcc-sdx55.h +++ b/include/dt-bindings/clock/qcom,gcc-sdx55.h @@ -109,4 +109,9 @@ #define GCC_USB3PHY_PHY_BCR13 #define GCC_USB_PHY_CFG_AHB2PHY_BCR14 +/* GCC power domains */ +#define USB30_GDSC 0 +#define PCIE_GDSC 1 +#define EMAC_GDSC 2 + #endif -- 2.25.1
[PATCH RFC] checkpatch: add warning for unnecessary use of %h[xudi] and %hh[xudi]
Modifiers %h and %hh should never be used. Commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") specifies that: "Standard integer promotion is already done and %hx and %hhx is useless so do not encourage the use of %hh[xudi] or %h[xudi]." "The "h" and "hh" things should never be used. The only reason for them being used if you have an "int", but you want to print it out as a "char" (and honestly, that is a really bad reason, you'd be better off just using a proper cast to make the code more obvious)." Add a new check to emit a warning on finding an unneeded use of %h or %hh modifier. Link: https://lore.kernel.org/lkml/4910042649a4f3ab22fac93191b8c1fa0a2e17c3.ca...@perches.com/ Suggested-by: Lukas Bulwahn Signed-off-by: Dwaipayan Ray --- scripts/checkpatch.pl | 13 + 1 file changed, 13 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7dc094445d83..47c1017a9973 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6570,6 +6570,19 @@ sub process { } } +# check for unnecessary use of %h[xudi] and %hh[xudi] + if ($perl_version_ok && + defined $stat && + $line =~ /(?:[sd]?print[kfd]|(?:pr_|drm_)(?:info|debug|warn|error))/i) { + my $lc = $stat =~ tr@\n@@; + $lc = $lc + $linenr; + my $stat_real = get_stat_real($linenr, $lc); + if ($stat_real =~ /\"[^\"]*%[\d\.\*\-]*h+[idux].*\"/i) { + WARN("UNNECESSARY_MODIFIER", +"Unnecessary use of length modifiers %h[xudi] or %hh[xudi]\n" . "$here\n$stat_real\n"); + } + } + # check for naked sscanf if ($perl_version_ok && defined $stat && -- 2.27.0
[PATCH v4 5/6] dt-bindings: clock: Add GDSC in SDX55 GCC
Add GDSC instances in SDX55 GCC block. Signed-off-by: Manivannan Sadhasivam --- include/dt-bindings/clock/qcom,gcc-sdx55.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/dt-bindings/clock/qcom,gcc-sdx55.h b/include/dt-bindings/clock/qcom,gcc-sdx55.h index c372451b3461..fb9a5942f793 100644 --- a/include/dt-bindings/clock/qcom,gcc-sdx55.h +++ b/include/dt-bindings/clock/qcom,gcc-sdx55.h @@ -109,4 +109,9 @@ #define GCC_USB3PHY_PHY_BCR13 #define GCC_USB_PHY_CFG_AHB2PHY_BCR14 +/* GCC power domains */ +#define USB30_GDSC 0 +#define PCIE_GDSC 1 +#define EMAC_GDSC 2 + #endif -- 2.25.1
Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add
On Thu, Nov 26, 2020 at 02:39:03PM +0800, Alex Shi wrote: > > > 在 2020/11/26 下午12:52, Yu Zhao 写道: > >> */ > >> void __pagevec_lru_add(struct pagevec *pvec) > >> { > >> - int i; > >> - struct lruvec *lruvec = NULL; > >> + int i, nr_lruvec; > >>unsigned long flags = 0; > >> + struct page *page; > >> + struct lruvecs lruvecs; > >> > >> - for (i = 0; i < pagevec_count(pvec); i++) { > >> - struct page *page = pvec->pages[i]; > >> + nr_lruvec = sort_page_lruvec(&lruvecs, pvec); > > Simply looping pvec multiple times (15 at most) for different lruvecs > > would be better because 1) it requires no extra data structures and > > therefore has better cache locality (theoretically faster) 2) it only > > loops once when !CONFIG_MEMCG and !CONFIG_NUMA and therefore has no > > impact on Android and Chrome OS. > > > > With multiple memcgs, it do help a lot, I had gotten 30% grain on readtwice > case. but yes, w/o MEMCG and NUMA, it's good to keep old behavior. So > would you like has a proposal for this? Oh, no, I'm not against your idea. I was saying it doesn't seem necessary to sort -- a nested loop would just do the job given pagevec is small. diff --git a/mm/swap.c b/mm/swap.c index cb3794e13b48..1d238edc2907 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -996,15 +996,26 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec) */ void __pagevec_lru_add(struct pagevec *pvec) { - int i; + int i, j; struct lruvec *lruvec = NULL; unsigned long flags = 0; for (i = 0; i < pagevec_count(pvec); i++) { struct page *page = pvec->pages[i]; + if (!page) + continue; + lruvec = relock_page_lruvec_irqsave(page, lruvec, &flags); - __pagevec_lru_add_fn(page, lruvec); + + for (j = i; j < pagevec_count(pvec); j++) { + if (page_to_nid(pvec->pages[j]) != page_to_nid(page) || + page_memcg(pvec->pages[j]) != page_memcg(page)) + continue; + + __pagevec_lru_add_fn(pvec->pages[j], lruvec); + pvec->pages[j] = NULL; + } } if (lruvec) unlock_page_lruvec_irqrestore(lruvec, flags);
Re: linux-next: manual merge of the akpm tree with the arm64 tree
On Wed, Nov 25, 2020 at 11:06 PM Stephen Rothwell wrote: > > Hi all, > > Today's linux-next merge of the akpm tree got a conflict in: > > arch/arm64/mm/proc.S > > between commit: > > 49b3cf035edc ("kasan: arm64: set TCR_EL1.TBID1 when enabled") > > from the arm64 tree and commit: > > 68cd215d6529 ("arm64: kasan: allow enabling in-kernel MTE") > > from the akpm tree. > > I fixed it up (I think, see below) and can carry the fix as necessary. > This is now fixed as far as linux-next is concerned, but any non trivial > conflicts should be mentioned to your upstream maintainer when your tree > is submitted for merging. You may also want to consider cooperating > with the maintainer of the conflicting tree to minimise any particularly > complex conflicts. > > -- > Cheers, > Stephen Rothwell > > diff --cc arch/arm64/mm/proc.S > index a0831bf8a018,0d85e6df42bc.. > --- a/arch/arm64/mm/proc.S > +++ b/arch/arm64/mm/proc.S > @@@ -40,9 -40,15 +40,15 @@@ > #define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA > > #ifdef CONFIG_KASAN_SW_TAGS > - #define TCR_KASAN_FLAGS TCR_TBI1 | TCR_TBID1 > -#define TCR_KASAN_SW_FLAGS TCR_TBI1 > ++#define TCR_KASAN_SW_FLAGS TCR_TBI1 | TCR_TBID1 > #else > - #define TCR_KASAN_FLAGS 0 > + #define TCR_KASAN_SW_FLAGS 0 > + #endif > + > + #ifdef CONFIG_KASAN_HW_TAGS > -#define TCR_KASAN_HW_FLAGS SYS_TCR_EL1_TCMA1 | TCR_TBI1 > ++#define TCR_KASAN_HW_FLAGS SYS_TCR_EL1_TCMA1 | TCR_TBI1 | TCR_TBID1 > + #else > + #define TCR_KASAN_HW_FLAGS 0 > #endif > > /* Thanks Stephen, that resolution looks correct to me. Peter
[PATCH v4 6/6] clk: qcom: Add GDSC support for SDX55 GCC
Add GDSC support to control the power supply of power domains in SDX55 GCC. Signed-off-by: Manivannan Sadhasivam --- drivers/clk/qcom/Kconfig | 1 + drivers/clk/qcom/gcc-sdx55.c | 33 + 2 files changed, 34 insertions(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 7897a3947e6d..05055fd18e6e 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -415,6 +415,7 @@ config SDM_LPASSCC_845 config SDX_GCC_55 tristate "SDX55 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SDX55 devices. Say Y if you want to use peripheral devices such as UART, diff --git a/drivers/clk/qcom/gcc-sdx55.c b/drivers/clk/qcom/gcc-sdx55.c index bf114165e24b..e3b9030b2bae 100644 --- a/drivers/clk/qcom/gcc-sdx55.c +++ b/drivers/clk/qcom/gcc-sdx55.c @@ -17,6 +17,7 @@ #include "clk-pll.h" #include "clk-rcg.h" #include "clk-regmap.h" +#include "gdsc.h" #include "reset.h" enum { @@ -1455,6 +1456,30 @@ static struct clk_branch gcc_xo_pcie_link_clk = { }, }; +static struct gdsc usb30_gdsc = { + .gdscr = 0x0b004, + .pd = { + .name = "usb30_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + +static struct gdsc pcie_gdsc = { + .gdscr = 0x37004, + .pd = { + .name = "pcie_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + +static struct gdsc emac_gdsc = { + .gdscr = 0x47004, + .pd = { + .name = "emac_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, +}; + static struct clk_regmap *gcc_sdx55_clocks[] = { [GCC_AHB_PCIE_LINK_CLK] = &gcc_ahb_pcie_link_clk.clkr, [GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr, @@ -1560,6 +1585,12 @@ static const struct qcom_reset_map gcc_sdx55_resets[] = { [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0xe000 }, }; +static struct gdsc *gcc_sdx55_gdscs[] = { + [USB30_GDSC] = &usb30_gdsc, + [PCIE_GDSC] = &pcie_gdsc, + [EMAC_GDSC] = &emac_gdsc, +}; + static const struct regmap_config gcc_sdx55_regmap_config = { .reg_bits = 32, .reg_stride = 4, @@ -1574,6 +1605,8 @@ static const struct qcom_cc_desc gcc_sdx55_desc = { .num_clks = ARRAY_SIZE(gcc_sdx55_clocks), .resets = gcc_sdx55_resets, .num_resets = ARRAY_SIZE(gcc_sdx55_resets), + .gdscs = gcc_sdx55_gdscs, + .num_gdscs = ARRAY_SIZE(gcc_sdx55_gdscs), }; static const struct of_device_id gcc_sdx55_match_table[] = { -- 2.25.1
[PATCH v4 4/6] clk: qcom: Add support for SDX55 RPMh clocks
Add support for following clocks maintained by RPMh in SDX55 SoCs. * BI TCXO * RF_CLK1 * RF_CLK1_AO * RF_CLK2 * RF_CLK2_AO * QPIC (Qualcomm Technologies, Inc. Parallel Interface Controller) Signed-off-by: Manivannan Sadhasivam Reviewed-by: Vinod Koul Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/clk-rpmh.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c index e2c669b08aff..fb72db957721 100644 --- a/drivers/clk/qcom/clk-rpmh.c +++ b/drivers/clk/qcom/clk-rpmh.c @@ -432,6 +432,25 @@ static const struct clk_rpmh_desc clk_rpmh_sm8250 = { .num_clks = ARRAY_SIZE(sm8250_rpmh_clocks), }; +DEFINE_CLK_RPMH_VRM(sdx55, rf_clk1, rf_clk1_ao, "rfclkd1", 1); +DEFINE_CLK_RPMH_VRM(sdx55, rf_clk2, rf_clk2_ao, "rfclkd2", 1); +DEFINE_CLK_RPMH_BCM(sdx55, qpic_clk, "QP0"); + +static struct clk_hw *sdx55_rpmh_clocks[] = { + [RPMH_CXO_CLK] = &sdm845_bi_tcxo.hw, + [RPMH_CXO_CLK_A]= &sdm845_bi_tcxo_ao.hw, + [RPMH_RF_CLK1] = &sdx55_rf_clk1.hw, + [RPMH_RF_CLK1_A]= &sdx55_rf_clk1_ao.hw, + [RPMH_RF_CLK2] = &sdx55_rf_clk2.hw, + [RPMH_RF_CLK2_A]= &sdx55_rf_clk2_ao.hw, + [RPMH_QPIC_CLK] = &sdx55_qpic_clk.hw, +}; + +static const struct clk_rpmh_desc clk_rpmh_sdx55 = { + .clks = sdx55_rpmh_clocks, + .num_clks = ARRAY_SIZE(sdx55_rpmh_clocks), +}; + static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec, void *data) { @@ -517,6 +536,7 @@ static int clk_rpmh_probe(struct platform_device *pdev) static const struct of_device_id clk_rpmh_match_table[] = { { .compatible = "qcom,sc7180-rpmh-clk", .data = &clk_rpmh_sc7180}, { .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845}, + { .compatible = "qcom,sdx55-rpmh-clk", .data = &clk_rpmh_sdx55}, { .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150}, { .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250}, { } -- 2.25.1
[PATCH v4 2/6] clk: qcom: Add SDX55 GCC support
From: Naveen Yadav Add Global Clock Controller (GCC) support for SDX55 SoCs from Qualcomm. Signed-off-by: Naveen Yadav [mani: converted to parent_data, commented critical clocks, cleanups] Signed-off-by: Manivannan Sadhasivam Reviewed-by: Vinod Koul --- drivers/clk/qcom/Kconfig |7 + drivers/clk/qcom/Makefile|1 + drivers/clk/qcom/gcc-sdx55.c | 1626 ++ 3 files changed, 1634 insertions(+) create mode 100644 drivers/clk/qcom/gcc-sdx55.c diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index 3a965bd326d5..7897a3947e6d 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -413,6 +413,13 @@ config SDM_LPASSCC_845 Say Y if you want to use the LPASS branch clocks of the LPASS clock controller to reset the LPASS subsystem. +config SDX_GCC_55 + tristate "SDX55 Global Clock Controller" + help + Support for the global clock controller on SDX55 devices. + Say Y if you want to use peripheral devices such as UART, + SPI, I2C, USB, SD/UFS, PCIe etc. + config SM_DISPCC_8250 tristate "SM8150 and SM8250 Display Clock Controller" depends on SM_GCC_8150 || SM_GCC_8250 diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index 11ae86febe87..886b877e70c7 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -64,6 +64,7 @@ obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o obj-$(CONFIG_SDM_GPUCC_845) += gpucc-sdm845.o obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o +obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o diff --git a/drivers/clk/qcom/gcc-sdx55.c b/drivers/clk/qcom/gcc-sdx55.c new file mode 100644 index ..bf114165e24b --- /dev/null +++ b/drivers/clk/qcom/gcc-sdx55.c @@ -0,0 +1,1626 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, Linaro Ltd. + */ + +#include +#include +#include +#include + +#include + +#include "common.h" +#include "clk-alpha-pll.h" +#include "clk-branch.h" +#include "clk-pll.h" +#include "clk-rcg.h" +#include "clk-regmap.h" +#include "reset.h" + +enum { + P_BI_TCXO, + P_CORE_BI_PLL_TEST_SE, + P_GPLL0_OUT_EVEN, + P_GPLL0_OUT_MAIN, + P_GPLL4_OUT_EVEN, + P_GPLL5_OUT_MAIN, + P_SLEEP_CLK, +}; + +static const struct pll_vco lucid_vco[] = { + { 24960, 20, 0 }, +}; + +static struct clk_alpha_pll gpll0 = { + .offset = 0x0, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .vco_table = lucid_vco, + .num_vco = ARRAY_SIZE(lucid_vco), + .clkr = { + .enable_reg = 0x6d000, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gpll0", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + }, + .num_parents = 1, + .ops = &clk_alpha_pll_fixed_lucid_ops, + }, + }, +}; + +static const struct clk_div_table post_div_table_lucid_even[] = { + { 0x0, 1 }, + { 0x1, 2 }, + { 0x3, 4 }, + { 0x7, 8 }, + { } +}; + +static struct clk_alpha_pll_postdiv gpll0_out_even = { + .offset = 0x0, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .post_div_shift = 8, + .post_div_table = post_div_table_lucid_even, + .num_post_div = ARRAY_SIZE(post_div_table_lucid_even), + .width = 4, + .clkr.hw.init = &(struct clk_init_data){ + .name = "gpll0_out_even", + .parent_data = &(const struct clk_parent_data){ + .hw = &gpll0.clkr.hw, + }, + .num_parents = 1, + .ops = &clk_alpha_pll_postdiv_lucid_ops, + }, +}; + +static struct clk_alpha_pll gpll4 = { + .offset = 0x76000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .vco_table = lucid_vco, + .num_vco = ARRAY_SIZE(lucid_vco), + .clkr = { + .enable_reg = 0x6d000, + .enable_mask = BIT(4), + .hw.init = &(struct clk_init_data){ + .name = "gpll4", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + }, + .num_parents = 1, + .ops = &clk_alpha_pll_fixed_lucid_ops, + }, + }, +}; + +static struct clk_alpha_pll_postdiv gpll4_out_even = { + .offset = 0x76000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID], + .post_div_shift = 8, + .post_
[PATCH v4 3/6] dt-bindings: clock: Introduce RPMHCC bindings for SDX55
From: Vinod Koul Add compatible for SDX55 RPMHCC and DT include. Signed-off-by: Vinod Koul Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bjorn Andersson Acked-by: Rob Herring --- Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml | 1 + include/dt-bindings/clock/qcom,rpmh.h| 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml index a46a3a799a70..a54930f111ba 100644 --- a/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml @@ -19,6 +19,7 @@ properties: enum: - qcom,sc7180-rpmh-clk - qcom,sdm845-rpmh-clk + - qcom,sdx55-rpmh-clk - qcom,sm8150-rpmh-clk - qcom,sm8250-rpmh-clk diff --git a/include/dt-bindings/clock/qcom,rpmh.h b/include/dt-bindings/clock/qcom,rpmh.h index 2e6c54e65455..cd806eccb7dd 100644 --- a/include/dt-bindings/clock/qcom,rpmh.h +++ b/include/dt-bindings/clock/qcom,rpmh.h @@ -21,5 +21,6 @@ #define RPMH_IPA_CLK 12 #define RPMH_LN_BB_CLK113 #define RPMH_LN_BB_CLK1_A 14 +#define RPMH_QPIC_CLK 15 #endif -- 2.25.1
[tip:x86/urgent] BUILD SUCCESS 33fc379df76b4991e5ae312f07bcd6820811971e
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent branch HEAD: 33fc379df76b4991e5ae312f07bcd6820811971e x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb elapsed time: 722m configs tested: 91 configs skipped: 53 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig nios2 3c120_defconfig xtensaxip_kc705_defconfig mips db1xxx_defconfig armlart_defconfig armrealview_defconfig mips rt305x_defconfig mipsworkpad_defconfig arm ixp4xx_defconfig sh rts7751r2d1_defconfig armkeystone_defconfig powerpc tqm8540_defconfig microblaze defconfig sh ecovec24_defconfig sh se7206_defconfig armqcom_defconfig powerpcklondike_defconfig powerpc ppc64e_defconfig ia64 allmodconfig ia64defconfig ia64 allyesconfig m68k allmodconfig m68kdefconfig m68k allyesconfig nds32 defconfig nios2allyesconfig cskydefconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig arc defconfig sh allmodconfig nios2 defconfig arc allyesconfig nds32 allnoconfig c6x allyesconfig parisc defconfig s390 allyesconfig parisc allyesconfig s390defconfig i386 allyesconfig sparcallyesconfig sparc defconfig i386defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a004-20201125 i386 randconfig-a003-20201125 i386 randconfig-a002-20201125 i386 randconfig-a005-20201125 i386 randconfig-a001-20201125 i386 randconfig-a006-20201125 x86_64 randconfig-a015-20201125 x86_64 randconfig-a011-20201125 x86_64 randconfig-a014-20201125 x86_64 randconfig-a016-20201125 x86_64 randconfig-a012-20201125 x86_64 randconfig-a013-20201125 i386 randconfig-a012-20201125 i386 randconfig-a013-20201125 i386 randconfig-a011-20201125 i386 randconfig-a016-20201125 i386 randconfig-a014-20201125 i386 randconfig-a015-20201125 riscvnommu_k210_defconfig riscvallyesconfig riscvnommu_virt_defconfig riscv allnoconfig riscv defconfig riscv rv32_defconfig riscvallmodconfig x86_64 rhel x86_64 allyesconfig x86_64rhel-7.6-kselftests x86_64 defconfig x86_64 rhel-8.3 x86_64 kexec clang tested configs: x86_64 randconfig-a006-20201125 x86_64 randconfig-a003-20201125 x86_64 randconfig-a004-20201125 x86_64 randconfig-a005-20201125 x86_64 randconfig-a002-20201125 x86_64 randconfig-a001-20201125 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
[PATCH v4 1/6] dt-bindings: clock: Add SDX55 GCC clock bindings
From: Vinod Koul Add device tree bindings for global clock controller on SDX55 SoCs. Signed-off-by: Vinod Koul Signed-off-by: Manivannan Sadhasivam Reviewed-by: Rob Herring --- .../bindings/clock/qcom,gcc-sdx55.yaml| 77 include/dt-bindings/clock/qcom,gcc-sdx55.h| 112 ++ 2 files changed, 189 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx55.h diff --git a/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml b/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml new file mode 100644 index ..1121b3934cb9 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml @@ -0,0 +1,77 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,gcc-sdx55.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Global Clock & Reset Controller Binding for SDX55 + +maintainers: + - Vinod Koul + - Manivannan Sadhasivam + +description: | + Qualcomm global clock control module which supports the clocks, resets and + power domains on SDX55 + + See also: + - dt-bindings/clock/qcom,gcc-sdx55.h + +properties: + compatible: +const: qcom,gcc-sdx55 + + clocks: +items: + - description: Board XO source + - description: Sleep clock source + - description: PLL test clock source (Optional clock) +minItems: 2 +maxItems: 3 + + clock-names: +items: + - const: bi_tcxo + - const: sleep_clk + - const: core_bi_pll_test_se # Optional clock +minItems: 2 +maxItems: 3 + + '#clock-cells': +const: 1 + + '#reset-cells': +const: 1 + + '#power-domain-cells': +const: 1 + + reg: +maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - reg + - '#clock-cells' + - '#reset-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | +#include +clock-controller@10 { + compatible = "qcom,gcc-sdx55"; + reg = <0x0010 0x1f>; + clocks = <&rpmhcc RPMH_CXO_CLK>, + <&sleep_clk>, <&pll_test_clk>; + clock-names = "bi_tcxo", "sleep_clk", "core_bi_pll_test_se"; + #clock-cells = <1>; + #reset-cells = <1>; + #power-domain-cells = <1>; +}; + +... diff --git a/include/dt-bindings/clock/qcom,gcc-sdx55.h b/include/dt-bindings/clock/qcom,gcc-sdx55.h new file mode 100644 index ..c372451b3461 --- /dev/null +++ b/include/dt-bindings/clock/qcom,gcc-sdx55.h @@ -0,0 +1,112 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, Linaro Ltd. + */ + +#ifndef _DT_BINDINGS_CLK_QCOM_GCC_SDX55_H +#define _DT_BINDINGS_CLK_QCOM_GCC_SDX55_H + +#define GPLL0 3 +#define GPLL0_OUT_EVEN 4 +#define GPLL4 5 +#define GPLL4_OUT_EVEN 6 +#define GPLL5 7 +#define GCC_AHB_PCIE_LINK_CLK 8 +#define GCC_BLSP1_AHB_CLK 9 +#define GCC_BLSP1_QUP1_I2C_APPS_CLK10 +#define GCC_BLSP1_QUP1_I2C_APPS_CLK_SRC11 +#define GCC_BLSP1_QUP1_SPI_APPS_CLK12 +#define GCC_BLSP1_QUP1_SPI_APPS_CLK_SRC13 +#define GCC_BLSP1_QUP2_I2C_APPS_CLK14 +#define GCC_BLSP1_QUP2_I2C_APPS_CLK_SRC15 +#define GCC_BLSP1_QUP2_SPI_APPS_CLK16 +#define GCC_BLSP1_QUP2_SPI_APPS_CLK_SRC17 +#define GCC_BLSP1_QUP3_I2C_APPS_CLK18 +#define GCC_BLSP1_QUP3_I2C_APPS_CLK_SRC19 +#define GCC_BLSP1_QUP3_SPI_APPS_CLK20 +#define GCC_BLSP1_QUP3_SPI_APPS_CLK_SRC21 +#define GCC_BLSP1_QUP4_I2C_APPS_CLK22 +#define GCC_BLSP1_QUP4_I2C_APPS_CLK_SRC23 +#define GCC_BLSP1_QUP4_SPI_APPS_CLK24 +#define GCC_BLSP1_QUP4_SPI_APPS_CLK_SRC25 +#define GCC_BLSP1_UART1_APPS_CLK 26 +#define GCC_BLSP1_UART1_APPS_CLK_SRC 27 +#define GCC_BLSP1_UART2_APPS_CLK 28 +#define GCC_BLSP1_UART2_APPS_CLK_SRC 29 +#define GCC_BLSP1_UART3_APPS_CLK 30 +#define GCC_BLSP1_UART3_APPS_CLK_SRC 31 +#define GCC_BLSP1_UART4_APPS_CLK 32 +#define GCC_BLS
[PATCH v4 0/6] Add GCC and RPMh clock support for SDX55
Hello, This series adds Global Clock Controller (GCC) and RPMh clock support for SDX55 SoC from Qualcomm with relevant DT bindings. This series has been tested on SDX55 MTP board. The dts patches will be posted separately. Thanks, Mani Changes in v4: * Made core_bi_pll_test_se clock optional in binding * Added GDSC patches Changes in v3: * Documented core_bi_pll_test_se clock in dt binding * Collected reviews Changes in v2: * Modified the GCC Kconfig symbol from GCC_SDX55 to SDX_GCC_55 * Added S-o-b tag to bindings patch * Incorporated review comments from Stephen on the gcc driver * Added review tag from Bjorn on RPMh patch Manivannan Sadhasivam (3): clk: qcom: Add support for SDX55 RPMh clocks dt-bindings: clock: Add GDSC in SDX55 GCC clk: qcom: Add GDSC support for SDX55 GCC Naveen Yadav (1): clk: qcom: Add SDX55 GCC support Vinod Koul (2): dt-bindings: clock: Add SDX55 GCC clock bindings dt-bindings: clock: Introduce RPMHCC bindings for SDX55 .../bindings/clock/qcom,gcc-sdx55.yaml| 77 + .../bindings/clock/qcom,rpmhcc.yaml |1 + drivers/clk/qcom/Kconfig |8 + drivers/clk/qcom/Makefile |1 + drivers/clk/qcom/clk-rpmh.c | 20 + drivers/clk/qcom/gcc-sdx55.c | 1659 + include/dt-bindings/clock/qcom,gcc-sdx55.h| 117 ++ include/dt-bindings/clock/qcom,rpmh.h |1 + 8 files changed, 1884 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,gcc-sdx55.yaml create mode 100644 drivers/clk/qcom/gcc-sdx55.c create mode 100644 include/dt-bindings/clock/qcom,gcc-sdx55.h -- 2.25.1
RE: [PATCH v2 1/1] vfio/type1: Add vfio_group_domain()
On Thurs, Nov 26, 2020, at 9:27 AM, Lu Baolu wrote: > Add the API for getting the domain from a vfio group. This could be used > by the physical device drivers which rely on the vfio/mdev framework for > mediated device user level access. The typical use case like below: > > unsigned int pasid; > struct vfio_group *vfio_group; > struct iommu_domain *iommu_domain; > struct device *dev = mdev_dev(mdev); > struct device *iommu_device = mdev_get_iommu_device(dev); > > if (!iommu_device || > !iommu_dev_feature_enabled(iommu_device, IOMMU_DEV_FEAT_AUX)) > return -EINVAL; > > vfio_group = vfio_group_get_external_user_from_dev(dev);(dev); duplicate (dev); 😊other parts looks good to me. perhaps, you can also describe that the release function of a sub-device fd should also call vfio_group_put_external_user() to release its reference on the vfio_group. Regards, Yi Liu > if (IS_ERR_OR_NULL(vfio_group)) > return -EFAULT; > > iommu_domain = vfio_group_domain(vfio_group); > if (IS_ERR_OR_NULL(iommu_domain)) { > vfio_group_put_external_user(vfio_group); > return -EFAULT; > } > > pasid = iommu_aux_get_pasid(iommu_domain, iommu_device); > if (pasid < 0) { > vfio_group_put_external_user(vfio_group); > return -EFAULT; > } > > /* Program device context with pasid value. */ > ... > > Signed-off-by: Lu Baolu > --- > drivers/vfio/vfio.c | 18 ++ > drivers/vfio/vfio_iommu_type1.c | 23 +++ > include/linux/vfio.h| 3 +++ > 3 files changed, 44 insertions(+) > > Change log: > - v1: > https://lore.kernel.org/linux-iommu/20201112022407.2063896-1-baolu...@linux.intel.com/ > - Changed according to comments @ > https://lore.kernel.org/linux-iommu/20201116125631.2d043...@w520.home/ > > diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c > index 2151bc7f87ab..62c652111c88 100644 > --- a/drivers/vfio/vfio.c > +++ b/drivers/vfio/vfio.c > @@ -2331,6 +2331,24 @@ int vfio_unregister_notifier(struct device *dev, > enum vfio_notify_type type, > } > EXPORT_SYMBOL(vfio_unregister_notifier); > > +struct iommu_domain *vfio_group_domain(struct vfio_group *group) > +{ > + struct vfio_container *container; > + struct vfio_iommu_driver *driver; > + > + if (!group) > + return ERR_PTR(-EINVAL); > + > + container = group->container; > + driver = container->iommu_driver; > + if (likely(driver && driver->ops->group_domain)) > + return driver->ops->group_domain(container->iommu_data, > + group->iommu_group); > + else > + return ERR_PTR(-ENOTTY); > +} > +EXPORT_SYMBOL(vfio_group_domain); > + > /** > * Module/class support > */ > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index 67e827638995..783f18f21b95 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -2980,6 +2980,28 @@ static int vfio_iommu_type1_dma_rw(void *iommu_data, > dma_addr_t user_iova, > return ret; > } > > +static void *vfio_iommu_type1_group_domain(void *iommu_data, > +struct iommu_group *iommu_group) > +{ > + struct vfio_iommu *iommu = iommu_data; > + struct iommu_domain *domain = NULL; > + struct vfio_domain *d; > + > + if (!iommu || !iommu_group) > + return ERR_PTR(-EINVAL); > + > + mutex_lock(&iommu->lock); > + list_for_each_entry(d, &iommu->domain_list, next) { > + if (find_iommu_group(d, iommu_group)) { > + domain = d->domain; > + break; > + } > + } > + mutex_unlock(&iommu->lock); > + > + return domain; > +} > + > static const struct vfio_iommu_driver_ops vfio_iommu_driver_ops_type1 = { > .name = "vfio-iommu-type1", > .owner = THIS_MODULE, > @@ -2993,6 +3015,7 @@ static const struct vfio_iommu_driver_ops > vfio_iommu_driver_ops_type1 = { > .register_notifier = vfio_iommu_type1_register_notifier, > .unregister_notifier= vfio_iommu_type1_unregister_notifier, > .dma_rw = vfio_iommu_type1_dma_rw, > + .group_domain = vfio_iommu_type1_group_domain, > }; > > static int __init vfio_iommu_type1_init(void) > diff --git a/include/linux/vfio.h b/include/linux/vfio.h > index 38d3c6a8dc7e..a0613a6f21cc 100644 > --- a/include/linux/vfio.h > +++ b/include/linux/vfio.h > @@ -90,6 +90,7 @@ struct vfio_iommu_driver_ops { > struct notifier_block *nb); > int (*dma_rw)(void *iommu_data, dma_addr_t user_iova, > void *data, size_t count, bool write); > + void*(*group_domain)(void *
Re: [PATCH] drm/ttm: don't set page->mapping
On Wed, Nov 25, 2020 at 07:57:20PM -0400, Jason Gunthorpe wrote: > annotate is OK, I used that for a long time.. > > My main gripe was it didn't setup the to/cc until after the annotate > editor closes. I put the To/Cc into the cover letter text file.
Re: [PATCH] fs: export vfs_stat() and vfs_fstatat()
On Thu, Nov 26, 2020 at 03:15:48PM +0800, Yicong Yang wrote: > The public function vfs_stat() and vfs_fstatat() are > unexported after moving out of line in > commit 09f1bde4017e ("fs: move vfs_fstatat out of line"), > which will prevent the using in kernel modules. > So make them exported. And why would you want to use them in kernel module? Please explain that in the patch that exports them, and please send that patch in the same series as the patches adding the users.
[PATCH] fs: export vfs_stat() and vfs_fstatat()
The public function vfs_stat() and vfs_fstatat() are unexported after moving out of line in commit 09f1bde4017e ("fs: move vfs_fstatat out of line"), which will prevent the using in kernel modules. So make them exported. Fixes: 09f1bde4017e ("fs: move vfs_fstatat out of line") Reported-by: Yang Shen Signed-off-by: Yicong Yang --- fs/stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/stat.c b/fs/stat.c index dacecdd..7d690c6 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -147,6 +147,7 @@ int vfs_fstat(int fd, struct kstat *stat) fdput(f); return error; } +EXPORT_SYMBOL(vfs_fstat); /** * vfs_statx - Get basic and extra attributes by filename @@ -207,6 +208,7 @@ int vfs_fstatat(int dfd, const char __user *filename, return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT, stat, STATX_BASIC_STATS); } +EXPORT_SYMBOL(vfs_fstatat); #ifdef __ARCH_WANT_OLD_STAT -- 2.8.1
RE: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read addresses
> -Original Message- > From: Miles Chen [mailto:miles.c...@mediatek.com] > Sent: Monday, November 23, 2020 7:39 PM > To: Alexey Dobriyan ; Andrew Morton > > Cc: linux-kernel@vger.kernel.org; linux-fsde...@vger.kernel.org; > linux-media...@lists.infradead.org; wsd_upstr...@mediatek.com; Miles > Chen > Subject: [RESEND PATCH v1] proc: use untagged_addr() for pagemap_read > addresses > > When we try to visit the pagemap of a tagged userspace pointer, we find > that the start_vaddr is not correct because of the tag. > To fix it, we should untag the usespace pointers in pagemap_read(). > > I tested with 5.10-rc4 and the issue remains. > > My test code is baed on [1]: > > A userspace pointer which has been tagged by 0xb4: 0xb47662f541c8 > > === userspace program === > > uint64 OsLayer::VirtualToPhysical(void *vaddr) { > uint64 frame, paddr, pfnmask, pagemask; > int pagesize = sysconf(_SC_PAGESIZE); > off64_t off = ((uintptr_t)vaddr) / pagesize * 8; // off = > 0xb47662f541c8 / pagesize * 8 = 0x5a3b317aa0 > int fd = open(kPagemapPath, O_RDONLY); > ... > > if (lseek64(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { > int err = errno; > string errtxt = ErrorString(err); > if (fd >= 0) > close(fd); > return 0; > } > ... > } > > === kernel fs/proc/task_mmu.c === > > static ssize_t pagemap_read(struct file *file, char __user *buf, > size_t count, loff_t *ppos) > { > ... > src = *ppos; > svpfn = src / PM_ENTRY_BYTES; // svpfn == 0xb47662f54 > start_vaddr = svpfn << PAGE_SHIFT; // start_vaddr == > 0xb47662f54000 > end_vaddr = mm->task_size; > > /* watch out for wraparound */ > // svpfn == 0xb47662f54 > // (mm->task_size >> PAGE) == 0x800 > if (svpfn > mm->task_size >> PAGE_SHIFT) // the condition is true > because > of the tag 0xb4 > start_vaddr = end_vaddr; > > ret = 0; > while (count && (start_vaddr < end_vaddr)) { // we cannot visit correct > entry because start_vaddr is set to end_vaddr > int len; > unsigned long end; > ... > } > ... > } > > [1] > https://github.com/stressapptest/stressapptest/blob/master/src/os.cc#L158 > > Signed-off-by: Miles Chen > --- > fs/proc/task_mmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > index 217aa2705d5d..e9a70f7ee515 100644 > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -1599,11 +1599,11 @@ static ssize_t pagemap_read(struct file *file, char > __user *buf, > > src = *ppos; > svpfn = src / PM_ENTRY_BYTES; > - start_vaddr = svpfn << PAGE_SHIFT; > + start_vaddr = untagged_addr(svpfn << PAGE_SHIFT); > end_vaddr = mm->task_size; > > /* watch out for wraparound */ > - if (svpfn > mm->task_size >> PAGE_SHIFT) > + if (start_vaddr > mm->task_size) > start_vaddr = end_vaddr; Wouldn't the untag be done by the user reading pagemap file? With this patch, even users pass an illegal address, for example, users put a tag on a virtual address which hasn't really a tag, they will still get the right pagemap. > > /* > -- > 2.18.0 Thanks Barry
[PATCH v1] gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend()
Following Calltrace is found when running echo freeze > /sys/power/state. [ 272.755506] Unable to handle kernel NULL pointer dereference at virtual address 0010 [ 272.755508] Mem abort info: [ 272.755508] ESR = 0x9606 [ 272.755510] EC = 0x25: DABT (current EL), IL = 32 bits [ 272.755511] SET = 0, FnV = 0 [ 272.755512] EA = 0, S1PTW = 0 [ 272.755513] Data abort info: [ 272.755514] ISV = 0, ISS = 0x0006 [ 272.755515] CM = 0, WnR = 0 [ 272.755517] user pgtable: 4k pages, 48-bit VAs, pgdp=0020a3b66000 [ 272.755519] [0010] pgd=0020a5ebe003, p4d=0020a5ebe003, pud=002093cd3003, pmd= [ 272.755525] Internal error: Oops: 9606 [#1] PREEMPT SMP [ 272.755527] Modules linked in: [ 272.755532] CPU: 2 PID: 3523 Comm: bash Not tainted 5.10.0-rc1-109487-g2893d0937cea-dirty #936 [ 272.755533] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 2280-V2 CS V3.B160.01 03/10/2020 [ 272.755535] pstate: 6049 (nZCv daif +PAN -UAO -TCO BTYPE=--) [ 272.755544] pc : dwapb_gpio_suspend+0x18/0x318 [ 272.70] lr : pm_generic_suspend+0x2c/0x48 [ 272.71] sp : 80002f0aba90 [ 272.72] x29: 80002f0aba90 x28: [ 272.75] x27: bc08c155c000 x26: 0002 [ 272.77] x25: bc08c155c5f8 x24: bc08c1621000 [ 272.79] x23: x22: bc08c15cc000 [ 272.755561] x21: 357204472410 x20: bc08bfd6a7a0 [ 272.755563] x19: x18: [ 272.755565] x17: x16: [ 272.755567] x15: 004a5f1918b8 x14: 0219 [ 272.755570] x13: 0219 x12: [ 272.755572] x11: x10: [ 272.755574] x9 : x8 : 15729beb6180 [ 272.755576] x7 : x6 : 000b [ 272.755578] x5 : 15729dbd4600 x4 : [ 272.755580] x3 : 357204472504 x2 : bc08bfcefef0 [ 272.755582] x1 : x0 : 357204472410 [ 272.755585] Call trace: [ 272.755587] dwapb_gpio_suspend+0x18/0x318 [ 272.755588] pm_generic_suspend+0x2c/0x48 [ 272.755595] acpi_subsys_suspend+0x60/0x70 [ 272.755599] dpm_run_callback.isra.18+0x40/0xe0 [ 272.755601] __device_suspend+0xf4/0x360 [ 272.755603] dpm_suspend+0xf0/0x1f8 [ 272.755605] dpm_suspend_start+0xa0/0xa8 [ 272.755610] suspend_devices_and_enter+0xe0/0x618 [ 272.755612] pm_suspend+0x250/0x308 [ 272.755613] state_store+0x8c/0x118 [ 272.755621] kobj_attr_store+0x18/0x30 [ 272.755625] sysfs_kf_write+0x40/0x58 [ 272.755626] kernfs_fop_write+0x148/0x240 [ 272.755630] vfs_write+0xc0/0x230 [ 272.755632] ksys_write+0x6c/0x100 [ 272.755633] __arm64_sys_write+0x1c/0x28 [ 272.755639] el0_svc_common.constprop.3+0x68/0x170 [ 272.755641] do_el0_svc+0x24/0x90 [ 272.755646] el0_sync_handler+0x118/0x168 [ 272.755647] el0_sync+0x158/0x180 [ 272.755651] Code: 910003fd f9000bf3 f9001ff8 f9403c13 (f9400a78) [ 272.755724] ---[ end trace afcb0e834c241837 ]--- [ 272.937286] Kernel panic - not syncing: Oops: Fatal exception [ 273.210068] SMP: stopping secondary CPUs [ 273.214006] Kernel Offset: 0x3c08af7b from 0x80001000 [ 273.220071] PHYS_OFFSET: 0xeaae [ 273.224235] CPU features: 0x0040002,62808a38 [ 273.228486] Memory Limit: none [ 273.234390] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]--- The reason is platform_set_drvdata() is deleted, and dwapb_gpio_suspend() get *gpio by dev_get_drvdata(). Fixes: feeaefd378ca ("gpio: dwapb: Use resource managed GPIO-chip add data method") Signed-off-by: Luo Jiaxing --- drivers/gpio/gpio-dwapb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index 2a9046c..4275c18 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -724,6 +724,8 @@ static int dwapb_gpio_probe(struct platform_device *pdev) return err; } + platform_set_drvdata(pdev, gpio); + return 0; } -- 2.7.4
[PATCH] NFC:Fix Warning: Comparison to bool
This patch uses the shdlc->rnr variable as a judgment condition of statement, rather than compares with bool. Signed-off-by: Runzhe Wang Reported-by: Abaci --- net/nfc/hci/llc_shdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c index 0eb4ddc..f178a42 100644 --- a/net/nfc/hci/llc_shdlc.c +++ b/net/nfc/hci/llc_shdlc.c @@ -319,7 +319,7 @@ static void llc_shdlc_rcv_s_frame(struct llc_shdlc *shdlc, switch (s_frame_type) { case S_FRAME_RR: llc_shdlc_rcv_ack(shdlc, nr); - if (shdlc->rnr == true) { /* see SHDLC 10.7.7 */ + if (shdlc->rnr) { /* see SHDLC 10.7.7 */ shdlc->rnr = false; if (shdlc->send_q.qlen == 0) { skb = llc_shdlc_alloc_skb(shdlc, 0); -- 1.8.3.1
[PATCH] kvm:svm: Return the correct error code
The return value of sev_asid_new is assigned to the variable asid, which should be returned directly if the asid is an error code. Fixes: 1654efcbc431 ("KVM: SVM: Add KVM_SEV_INIT command") Signed-off-by: Peng Hao --- arch/x86/kvm/svm/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 566f4d18185b..41cea6b69860 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -174,7 +174,7 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) asid = sev_asid_new(); if (asid < 0) - return ret; + return asid; ret = sev_platform_init(&argp->error); if (ret) -- 2.18.4
Re: [PATCH AUTOSEL 5.9 33/33] xfs: don't allow NOWAIT DIO across extent boundaries
On Wed, Nov 25, 2020 at 06:46:54PM -0500, Sasha Levin wrote: > On Thu, Nov 26, 2020 at 08:52:47AM +1100, Dave Chinner wrote: > > We've already had one XFS upstream kernel regression in this -rc > > cycle propagated to the stable kernels in 5.9.9 because the stable > > process picked up a bunch of random XFS fixes within hours of them > > being merged by Linus. One of those commits was a result of a > > thinko, and despite the fact we found it and reverted it within a > > few days, users of stable kernels have been exposed to it for a > > couple of weeks. That *should never have happened*. > > No, what shouldn't have happened is a commit that never went out for a review > on the public mailing lists nor spending any time in linux-next ending > up in Linus's tree. I think you've got your wires crossed somewhere, Sasha, because none of that happened here. From the public record, the patch was first posted here by Darrick: https://lore.kernel.org/linux-xfs/160494584816.772693.2490433010759557816.stgit@magnolia/ on Nov 9, and was reviewed by Christoph a day later. It was merged into the XFS tree on Nov 10, with the rvb tag: https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git/commit/?h=for-next&id=6ff646b2ceb0eec916101877f38da0b73e3a5b7f Which means it should have been in linux-next on Nov 11, 12 and 13, when Darrick sent the pull request: https://lore.kernel.org/linux-xfs/20201113231738.GX9695@magnolia/ It was merged into Linus's tree an hour later. So, in contrast to your claims, the evidence is that the patch was, in fact, publicly posted, reviewed, and spent time in linux-next before ending up in Linus's tree. FWIW, on November 17, GregKH sent the patch to lkml for stable review after being selected by the stable process for a stable backport. This was not cc'd to the XFS list, and it was committed without comment into the 5.9.x tree is on November 18. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/xfs?h=linux-5.9.y&id=0ca9a072112b18efc9ba9d3a9b77e9dae60f93ac IOWs, the XFS developers didn't ask for it to be backported to stable kernels - the commit did not contain a "cc: sta...@kernel.org", nor was the original patch posting cc'd to the stable list. The fact is that entire decision to backport this commit was made by stable maintainers and/or their tools, and the stable maintainers themselves chose not to tell the XFS list they had selected it for backport. Hence: > It's ridiculous that you see a failure in the maintainership workflow of > XFS and turn around to blame it somehow on the stable process. I think you really need to have another look at the evidence before you dig yourself a deeper hole and waste more of my time > > This has happened before, and *again* we were lucky this wasn't > > worse than it was. We were saved by the flaw being caught by own > > internal pre-write corruption verifiers (which exist because we > > don't trust our code to be bug-free, let alone the collections of > > random, poorly tested backports) so that it only resulted in > > corruption shutdowns rather than permanent on-disk damage and data > > loss. > > > > Put simply: the stable process is flawed because it shortcuts the > > necessary stabilisation testing for new code. It doesn't matter if > > The stable process assumes that commits that ended up upstream were > reviewed and tested; the stable process doesn't offer much in the way of > in-depth review of specific patches but mostly focuses on testing the > product of backporting hundreds of patches into each stable branch. And I've lost count of the number of times I've told the stable maintainers that this is an invalid assumption. Yet here we are again. How many times do we have to make the same mistake before we learn from it? > Release candidate cycles are here to squash the bugs that went in during > the merge window, not to introduce new "thinkos" in the way of pulling > patches out of your hip in the middle of the release cycle. "pulling patches out of your hip" Nice insult. Avoids profanity filters and everything. But I don't know why you're trying to insult me over something I played no part in. Seriously, merging critical fixes discovered in the -rc cycle happens *all the time* and has been done for as long as we've had -rc cycles. Even Linus himself does this. The fact is that the -rc process is intended to accomodate merging fixes quickly whilst still allowing sufficient testing time to be confident that no regressions were introduced or have been found and addressed before release. And that's the whole point of having an iterative integration testing phase in the release cycle - it can be adapted in duration to the current state of the code base and the fixes that are being made late in the cycle. You *should* know all this Sasha, so I'm not sure why you are claiming that long standing, well founded software engineering practices are suddenly a problem... > > the merged commits have a
[PATCH] selftests/clone3: Add gun99 to compile in Makefile.
CFLAGS add -std=gnu99. Fllowing build error: test_core.c: In function ‘test_cgcore_destroy’: test_core.c:87:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < 10; i++) { ^ test_core.c:87:2: note: use option -std=c99 or -std=gnu99 to compile your code Signed-off-by: Xingxing Su --- tools/testing/selftests/clone3/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/clone3/Makefile b/tools/testing/selftests/clone3/Makefile index ef7564c..88354a8 100644 --- a/tools/testing/selftests/clone3/Makefile +++ b/tools/testing/selftests/clone3/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS += -g -I../../../../usr/include/ +CFLAGS += -g -std=gnu99 -I../../../../usr/include/ LDLIBS += -lcap TEST_GEN_PROGS := clone3 clone3_clear_sighand clone3_set_tid \ -- 1.8.3.1
Re: [RFC PATCH 0/4] crypto: add CRYPTO_TFM_REQ_DMA flag
On Wed, 25 Nov 2020 at 22:39, Iuliana Prodan wrote: > > On 11/25/2020 11:16 PM, Ard Biesheuvel wrote: > > On Wed, 25 Nov 2020 at 22:14, Iuliana Prodan (OSS) > > wrote: > >> > >> From: Iuliana Prodan > >> > >> Add the option to allocate the crypto request object plus any extra space > >> needed by the driver into a DMA-able memory. > >> > >> Add CRYPTO_TFM_REQ_DMA flag to be used by backend implementations to > >> indicate to crypto API the need to allocate GFP_DMA memory > >> for private contexts of the crypto requests. > >> > > > > These are always directional DMA mappings, right? So why can't we use > > bounce buffering here? > > > The idea was to avoid allocating any memory in crypto drivers. > We want to be able to use dm-crypt with CAAM, which needs DMA-able > memory and increasing reqsize is not enough. But what does 'needs DMA-able memory' mean? DMA operations are asynchronous by definition, and so the DMA layer should be able to allocate bounce buffers when needed. This will cost some performance in cases where the hardware cannot address all of memory directly, but this is a consequence of the design, and I don't think we should burden the generic API with this. > It started from here > https://lore.kernel.org/linux-crypto/71b6f739-d4a8-8b26-bf78-ce9acf9a0...@nxp.com/T/#m39684173a2f0f4b83d8bcbec223e98169273d1e4 > > >> For IPsec use cases, CRYPTO_TFM_REQ_DMA flag is also checked in > >> esp_alloc_tmp() function for IPv4 and IPv6. > >> > >> This series includes an example of how a driver can use > >> CRYPTO_TFM_REQ_DMA flag while setting reqsize to a larger value > >> to avoid allocating memory at crypto request runtime. > >> The extra size needed by the driver is added to the reqsize field > >> that indicates how much memory could be needed per request. > >> > >> Iuliana Prodan (4): > >>crypto: add CRYPTO_TFM_REQ_DMA flag > >>net: esp: check CRYPTO_TFM_REQ_DMA flag when allocating crypto request > >>crypto: caam - avoid allocating memory at crypto request runtime for > >> skcipher > >>crypto: caam - avoid allocating memory at crypto request runtime for > >> aead > >> > >> drivers/crypto/caam/caamalg.c | 130 +- > >> include/crypto/aead.h | 4 ++ > >> include/crypto/akcipher.h | 21 ++ > >> include/crypto/hash.h | 4 ++ > >> include/crypto/skcipher.h | 4 ++ > >> include/linux/crypto.h| 1 + > >> net/ipv4/esp4.c | 7 +- > >> net/ipv6/esp6.c | 7 +- > >> 8 files changed, 144 insertions(+), 34 deletions(-) > >> > >> -- > >> 2.17.1 > >>
Re: [PATCH] perf script: Fix overrun issue for dynamically-allocated pmu type number
Hi Adrian, On 11/26/2020 2:51 PM, Adrian Hunter wrote: On 26/11/20 5:24 am, Jin Yao wrote: When unpacking the event which is from dynamic pmu, the array output[OUTPUT_TYPE_MAX] may be overrun. For example, type number of SKL uncore_imc is 10, but OUTPUT_TYPE_MAX is 7 now (OUTPUT_TYPE_MAX = PERF_TYPE_MAX + 1). /* In builtin-script.c */ process_event() { unsigned int type = output_type(attr->type); if (output[type].fields == 0) return; } output[10] is overrun. Create a type OUTPUT_TYPE_OTHER for dynamic pmu events, then output_type(attr->type) will return OUTPUT_TYPE_OTHER here. Note that if PERF_TYPE_MAX ever changed, then there would be a conflict between old perf.data files that had a dynamicaliy allocated PMU number that would then be the same as a fixed PERF_TYPE. Example: perf record --switch-events -C 0 -e "{cpu-clock,uncore_imc/data_reads/,uncore_imc/data_writes/}:SD" -a -- sleep 1 perf script Before: swapper 0 [000] 1479253.987551: 277766 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.987797: 246709 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.988127: 329883 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.988273: 146393 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.988523: 249977 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.988877: 354090 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.989023: 145940 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.989383: 359856 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1479253.989523: 140082 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) After: swapper 0 [000] 1397040.402011: 272384 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1397040.402011: 5396 uncore_imc/data_reads/: swapper 0 [000] 1397040.402011:967 uncore_imc/data_writes/: swapper 0 [000] 1397040.402259: 249153 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1397040.402259: 7231 uncore_imc/data_reads/: swapper 0 [000] 1397040.402259: 1297 uncore_imc/data_writes/: swapper 0 [000] 1397040.402508: 249108 cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) swapper 0 [000] 1397040.402508: 5333 uncore_imc/data_reads/: swapper 0 [000] 1397040.402508: 1008 uncore_imc/data_writes/: Fixes: 1405720d4f26 ("perf script: Add 'synth' event type for synthesized events") It does not look to me like the problem was introduced by that commit. Are you sure this Fixes tag is correct? Commit 1405720d4f26 added the change: @@ -1215,8 +1253,9 @@ static void process_event(struct perf_script *script, { struct thread *thread = al->thread; struct perf_event_attr *attr = &evsel->attr; + unsigned int type = output_type(attr->type); - if (output[attr->type].fields == 0) + if (output[type].fields == 0) return; But of course, we can also say the original "output[attr->type].fields" introduced the issue, I'm not sure. Maybe Arnaldo can help to make the decision. :) Thanks Jin Yao
linux-next: manual merge of the akpm tree with the arm64 tree
Hi all, Today's linux-next merge of the akpm tree got a conflict in: arch/arm64/mm/proc.S between commit: 49b3cf035edc ("kasan: arm64: set TCR_EL1.TBID1 when enabled") from the arm64 tree and commit: 68cd215d6529 ("arm64: kasan: allow enabling in-kernel MTE") from the akpm tree. I fixed it up (I think, see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc arch/arm64/mm/proc.S index a0831bf8a018,0d85e6df42bc.. --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@@ -40,9 -40,15 +40,15 @@@ #define TCR_CACHE_FLAGS TCR_IRGN_WBWA | TCR_ORGN_WBWA #ifdef CONFIG_KASAN_SW_TAGS - #define TCR_KASAN_FLAGS TCR_TBI1 | TCR_TBID1 -#define TCR_KASAN_SW_FLAGS TCR_TBI1 ++#define TCR_KASAN_SW_FLAGS TCR_TBI1 | TCR_TBID1 #else - #define TCR_KASAN_FLAGS 0 + #define TCR_KASAN_SW_FLAGS 0 + #endif + + #ifdef CONFIG_KASAN_HW_TAGS -#define TCR_KASAN_HW_FLAGS SYS_TCR_EL1_TCMA1 | TCR_TBI1 ++#define TCR_KASAN_HW_FLAGS SYS_TCR_EL1_TCMA1 | TCR_TBI1 | TCR_TBID1 + #else + #define TCR_KASAN_HW_FLAGS 0 #endif /* pgpPAeGNp6ynl.pgp Description: OpenPGP digital signature
Re: [PATCH] drm/nouveau: fix relocations applying logic and a double-free
On Mon, Nov 23, 2020 at 10:51:25AM +0100, Daniel Vetter wrote: > On Fri, Nov 20, 2020 at 4:23 PM Matti Hamalainen wrote: > > > > Commit 03e0d26fcf79 ("drm/nouveau: slowpath for pushbuf ioctl") included > > a logic-bug which results in the relocations not actually getting > > applied at all as the call to nouveau_gem_pushbuf_reloc_apply() is > > never reached. This causes a regression with graphical corruption, > > triggered when relocations need to be done (for example after a > > suspend/resume cycle.) > > > > Fix by setting *apply_relocs value only if there were more than 0 > > relocations. > > > > Additionally, the never reached code had a leftover u_free() call, > > which, after fixing the logic, now got called and resulted in a > > double-free. Fix by removing one u_free(), moving the other > > and adding check for errors. > > > > Cc: Daniel Vetter > > Cc: Ben Skeggs > > Cc: nouv...@lists.freedesktop.org > > Cc: dri-de...@lists.freedesktop.org > > Signed-off-by: Matti Hamalainen > > Fixes: 03e0d26fcf79 ("drm/nouveau: slowpath for pushbuf ioctl") > > Link: https://gitlab.freedesktop.org/drm/nouveau/-/issues/11 > > Link: is for the mailing list submission of the patch itself (to link > the git log to the mailing list discussions), this should be > References: or similar. Aside from this: > > Reviewed-by: Daniel Vetter > > Ben, I'm assuming you'll push this through your tree. Ok Dave asked me to just push it into drm-misc-fixes. Thanks for your patch! -Daniel > -Daniel > > > > --- > > drivers/gpu/drm/nouveau/nouveau_gem.c | 8 +--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c > > b/drivers/gpu/drm/nouveau/nouveau_gem.c > > index 549bc67feabb..c2051380d18c 100644 > > --- a/drivers/gpu/drm/nouveau/nouveau_gem.c > > +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c > > @@ -558,8 +558,10 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel > > *chan, > > NV_PRINTK(err, cli, "validating bo list\n"); > > validate_fini(op, chan, NULL, NULL); > > return ret; > > + } else if (ret > 0) { > > + *apply_relocs = true; > > } > > - *apply_relocs = ret; > > + > > return 0; > > } > > > > @@ -662,7 +664,6 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, > > nouveau_bo_wr32(nvbo, r->reloc_bo_offset >> 2, data); > > } > > > > - u_free(reloc); > > return ret; > > } > > > > @@ -872,9 +873,10 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void > > *data, > > break; > > } > > } > > - u_free(reloc); > > } > > out_prevalid: > > + if (!IS_ERR(reloc)) > > + u_free(reloc); > > u_free(bo); > > u_free(push); > > > > > > base-commit: 3494d58865ad4a47611dbb427b214cc5227fa5eb > > -- > > 2.29.2 > > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH] e1000e: Assign DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to speed up s2ram
On Thu, Nov 26, 2020 at 02:36:42PM +0800, Kai-Heng Feng wrote: > > > > On Nov 25, 2020, at 18:36, Chen Yu wrote: > > > > Hi Kai-Heng, > > On Wed, Nov 25, 2020 at 01:17:28AM +0800, Kai-Heng Feng wrote: > >> Hi Yu, > >> > >>> On Nov 24, 2020, at 23:32, Chen Yu wrote: > >>> > >>> The NIC is put in runtime suspend status when there is no wire connected. > >>> As a result, it is safe to keep this NIC in runtime suspended during s2ram > >>> because the system does not rely on the NIC plug event nor WOL to wake up > >>> the system. Unlike the s2idle, s2ram does not need to manipulate S0ix > >>> settings > >>> during suspend. > >> > >> Please see below for the reason why I explicitly disable direct-complete > >> in the driver. > >> > > Okay. > >>> > >>> This patch assigns DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME > >>> to the e1000e driver so that the s2ram could skip the .suspend_late(), > >>> .suspend_noirq() and .resume_noirq() .resume_early() when possible. > >>> Also skip .suspend() and .resume() if dev_pm_skip_suspend() and > >>> dev_pm_skip_resume() return true, so as to speed up the s2ram. > >> > >> If we really want direct-complete here, maybe always set current WoL > >> setting in runtime suspend routine? > >> > > Indeed, that would be a choice. > >>> > >>> Signed-off-by: Chen Yu > >>> --- > >>> drivers/base/power/main.c | 2 ++ > >>> drivers/net/ethernet/intel/e1000e/netdev.c | 14 +- > >>> 2 files changed, 15 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c > >>> index c7ac49042cee..9cd8abba8612 100644 > >>> --- a/drivers/base/power/main.c > >>> +++ b/drivers/base/power/main.c > >>> @@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev) > >>> > >>> return !dev->power.must_resume; > >>> } > >>> +EXPORT_SYMBOL_GPL(dev_pm_skip_resume); > >> > >> I don't think it's a good idea to use this predicate out side of PM core, > >> must_resume may change during suspend process. > >> > > The dev_pm_skip_resume() is used during system resume, not during suspend, > > so > > there would be no race condition I suppose? > > I think it's better to let PM core to decide. > Humm, drivers/acpi/acpi_lpss.c alread used it in acpi_lpss_resume_early(), so e1000e is not the only one that wants to leverage this interface : ) > >>> > >>> /** > >>> * device_resume_noirq - Execute a "noirq resume" callback for given > >>> device. > >>> @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev) > >>> return dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) && > >>> pm_runtime_status_suspended(dev); > >>> } > >>> +EXPORT_SYMBOL_GPL(dev_pm_skip_suspend); > >>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c > >>> b/drivers/net/ethernet/intel/e1000e/netdev.c > >>> index b30f00891c03..d79fddabc553 100644 > >>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c > >>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c > >>> @@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct > >>> device *dev) > >>> struct e1000_hw *hw = &adapter->hw; > >>> int rc; > >>> > >>> + /* Runtime suspended means that there is no wired connection > >>> + * and it has nothing to do with WOL that, we don't need to > >>> + * adjust the WOL settings. So it is safe to put NIC in > >>> + * runtime suspend while doing system suspend. > >>> + */ > >> > >> What about plugging ethernet cable and using WoL after system is suspended? > >> Commit "e1000e: Exclude device from suspend direct complete optimization" > >> was to address that scenario. > >> > > Yes, this is what I concerned previously. So in order to support this case, > > let's adjust this by checking > > if (device_may_wakeup() && dev_pm_skip_suspend()) > > > > so that if the user has disabled WOL via sysfs then we do not fall > > into this optimization > > commit 6bf6be1127f7 ("e1000e: Do not wake up the system via WOL if > > device wakeup is disabled") > > I don't think this is right. > Isn't E1000_WUFC_LNKC already set for runtime suspend? > What if WoL doesn't have it set? > I did not quite get what your meaning is. First, it was a typo, please check v2 patch set, it is: if (dev_pm_skip_suspend() && !device_may_wakeup(dev)) if the NIC is runtime suspended, it means that, device_may_wakeup() return true, the code will continue to execute. In summary, if the NIC is a wake up device, we don't fall into the optimization. > >>> + if (dev_pm_skip_suspend(dev)) > >>> + return 0; > >>> + > >>> e1000e_flush_lpic(pdev); > >>> > >>> e1000e_pm_freeze(dev); > >>> @@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct > >>> device *dev) > >>> struct e1000_hw *hw = &adapter->hw; > >>> int rc; > >>> > >>> + if (dev_pm_skip_resume(dev)) > >>> + return 0; > >>> + > >>> /* Introduce S0ix implementation */ > >>> if (hw->mac.type >= e1000_pch_cnp && > >>> !e1000e_chec
Re: [PATCH 4/4] Documentation/admin-guide/module-signing.rst: add openssl command option example for CodeSign EKU
Hi Randy, Thanks for your review! I will update it in next version. Joey Lee On Wed, Nov 25, 2020 at 09:25:51AM -0800, Randy Dunlap wrote: > Hi-- > > On 11/24/20 11:26 PM, Lee, Chun-Yi wrote: > > Add an openssl command option example for generating CodeSign extended > > key usage in X.509 when CONFIG_CHECK_CODESIGN_EKU be enabled. > > is enabled. > > > > > Signed-off-by: "Lee, Chun-Yi" > > --- > > Documentation/admin-guide/module-signing.rst | 6 ++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/Documentation/admin-guide/module-signing.rst > > b/Documentation/admin-guide/module-signing.rst > > index f8b584179cff..bc184124d646 100644 > > --- a/Documentation/admin-guide/module-signing.rst > > +++ b/Documentation/admin-guide/module-signing.rst > > @@ -170,6 +170,12 @@ generate the public/private key files:: > >-config x509.genkey -outform PEM -out kernel_key.pem \ > >-keyout kernel_key.pem > > > > +When ``CONFIG_CHECK_CODESIGN_EKU`` option be enabled, the following openssl > > is enabled, > > > +command option should be added for generating CodeSign extended key usage > > in > > +X.509:: > > + > > +-addext "extendedKeyUsage=codeSigning" > > + > > The full pathname for the resulting kernel_key.pem file can then be > > specified > > in the ``CONFIG_MODULE_SIG_KEY`` option, and the certificate and key > > therein will > > be used instead of an autogenerated keypair. > > > > > -- > ~Randy
Re: [PATCH] tomoyo: Avoid potential null pointer access
On 2020/11/26 15:33, Zheng Zengkai wrote: > As your say, I found the function tomoyo_assign_namespace( ) > > in security/tomoyo/domain.c has the similar situation, > > Can I add __GFP_NOWARN for both and remove the null check for _entry_ in > tomoyo_assign_namespace( )? > Good catch. Yes, please send as a patch.
Re: linux-next: build warning after merge of the v4l-dvb tree
Hi all, On Wed, 18 Nov 2020 16:29:34 +1100 Stephen Rothwell wrote: > > After merging the v4l-dvb tree, today's linux-next build (htmldocs) > produced this warning: > > Documentation/output/lirc.h.rst:6: WARNING: undefined label: rc-proto-max (if > the link has no caption the label must precede a section header) > > Introduced by commit > > 72e637fec558 ("media: rc: validate that "rc_proto" is reasonable") I am still getting this - despite commit cea357bc2571 ("media: lirc: ensure RC_PROTO_MAX has documentation") and today I got a second copy of the warning ... -- Cheers, Stephen Rothwell pgp4IYm4r1fF5.pgp Description: OpenPGP digital signature
Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE
Daeho, On 2020/11/26 14:35, Daeho Jeong wrote: Chao, A little bit wired, why not failing cluster_may_compress() for user mode, and let writepages write cluster as raw blocks, in-where we can update i_compr_blocks and global compr block stats correctly. For decompression ioctl, I've made f2fs_need_compress_data() return "false" to prevent compression write, so we don't use f2fs_write_compressed_pages() anymore in this case. Because of this, I manually updated i_compr_blocks. Do you have any suggestions on this? I meant, we can control condition to call into below stack, then i_compr_blocks can be updated correctly. - f2fs_ioc_decompress_file - writepages - f2fs_write_multi_pages - cluster_may_compress return false when ioc_decompress is in-process. - f2fs_write_raw_pages - f2fs_do_write_data_page - f2fs_i_compr_blocks_update Thanks, 2020년 11월 26일 (목) 오후 2:04, Daeho Jeong 님이 작성: Eric, do_page_cache_ra() is defined in mm/internal.h for internal use between in mm, so we cannot use this one right now. So, I think we could use page_cache_ra_unbounded(), because we already check i_size boundary on our own. What do you think? 2020년 11월 24일 (화) 오후 12:05, Chao Yu 님이 작성: On 2020/11/23 11:17, Daeho Jeong wrote: From: Daeho Jeong Added two ioctl to decompress/compress explicitly the compression enabled file in "compress_mode=user-based" mount option. Using these two ioctls, the users can make a control of compression and decompression of their files. Signed-off-by: Daeho Jeong --- fs/f2fs/file.c| 181 +- include/uapi/linux/f2fs.h | 2 + 2 files changed, 182 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index be8db06aca27..e8f142470e87 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4026,6 +4026,180 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) return ret; } +static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) +{ + DEFINE_READAHEAD(ractl, NULL, inode->i_mapping, page_idx); + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + struct address_space *mapping = inode->i_mapping; + struct page *page; + pgoff_t redirty_idx = page_idx; + int i, page_len = 0, ret = 0; + + page_cache_ra_unbounded(&ractl, len, 0); + + for (i = 0; i < len; i++, page_idx++) { + page = read_cache_page(mapping, page_idx, NULL, NULL); + if (IS_ERR(page)) { + ret = PTR_ERR(page); + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " + "couldn't be read (errno:%d).\n", + __func__, inode->i_ino, page_idx, ret); This is a common error case during calling read_cache_page(), IMO, this looks more like a debug log, so I prefer to print nothing here, or at least using f2fs_debug() instead. + break; + } + page_len++; + } + + for (i = 0; i < page_len; i++, redirty_idx++) { + page = find_lock_page(mapping, redirty_idx); + if (!page) { + ret = -ENOENT; + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " + "couldn't be found (errno:%d).\n", + __func__, inode->i_ino, redirty_idx, ret); Ditto. + } + set_page_dirty(page); + f2fs_put_page(page, 1); + f2fs_put_page(page, 0); + } + + return ret; +} + +static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) +{ + struct inode *inode = file_inode(filp); + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + struct f2fs_inode_info *fi = F2FS_I(inode); + pgoff_t page_idx = 0, last_idx; + int cluster_size = F2FS_I(inode)->i_cluster_size; + int count, ret; + + if (!f2fs_sb_has_compression(sbi)) + return -EOPNOTSUPP; + + if (!(filp->f_mode & FMODE_WRITE)) + return -EBADF; + + if (!f2fs_compressed_file(inode)) + return -EINVAL; Before compressubg/decompressing file, should we check whether current inode's compress algorithm backend is available in f2fs module? + + f2fs_balance_fs(F2FS_I_SB(inode), true); + + file_start_write(filp); + inode_lock(inode); + + if (f2fs_is_mmap_file(inode)) { + ret = -EBUSY; + goto out; + } + + ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); + if (ret) + goto out; + + if (!atomic_read(&fi->i_compr_blocks)) + goto out; + + last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); + + count = last_idx - page_idx; + while (count) { + int len = min(cluster_size, count); + + ret = redirty_blocks(inode, page_idx, len); + unneeded blank line.. + if (ret < 0) + break; +
Re: [PATCH] perf script: Fix overrun issue for dynamically-allocated pmu type number
On 26/11/20 5:24 am, Jin Yao wrote: > When unpacking the event which is from dynamic pmu, the array > output[OUTPUT_TYPE_MAX] may be overrun. For example, type number of > SKL uncore_imc is 10, but OUTPUT_TYPE_MAX is 7 now (OUTPUT_TYPE_MAX = > PERF_TYPE_MAX + 1). > > /* In builtin-script.c */ > process_event() > { > unsigned int type = output_type(attr->type); > > if (output[type].fields == 0) > return; > } > > output[10] is overrun. > > Create a type OUTPUT_TYPE_OTHER for dynamic pmu events, then > output_type(attr->type) will return OUTPUT_TYPE_OTHER here. > > Note that if PERF_TYPE_MAX ever changed, then there would be a conflict > between old perf.data files that had a dynamicaliy allocated PMU number > that would then be the same as a fixed PERF_TYPE. > > Example: > > perf record --switch-events -C 0 -e > "{cpu-clock,uncore_imc/data_reads/,uncore_imc/data_writes/}:SD" -a -- sleep 1 > perf script > > Before: > swapper 0 [000] 1479253.987551: 277766 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.987797: 246709 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.988127: 329883 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.988273: 146393 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.988523: 249977 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.988877: 354090 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.989023: 145940 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.989383: 359856 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1479253.989523: 140082 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > > After: > swapper 0 [000] 1397040.402011: 272384 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1397040.402011: 5396 > uncore_imc/data_reads/: > swapper 0 [000] 1397040.402011:967 > uncore_imc/data_writes/: > swapper 0 [000] 1397040.402259: 249153 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1397040.402259: 7231 > uncore_imc/data_reads/: > swapper 0 [000] 1397040.402259: 1297 > uncore_imc/data_writes/: > swapper 0 [000] 1397040.402508: 249108 > cpu-clock: 9d4ddb6f cpuidle_enter_state+0xdf ([kernel.kallsyms]) > swapper 0 [000] 1397040.402508: 5333 > uncore_imc/data_reads/: > swapper 0 [000] 1397040.402508: 1008 > uncore_imc/data_writes/: > > Fixes: 1405720d4f26 ("perf script: Add 'synth' event type for synthesized > events") It does not look to me like the problem was introduced by that commit. Are you sure this Fixes tag is correct?
linux-next: build warnings after merge of the arm64 tree
Hi all, After merging the arm64 tree, today's linux-next build (htmldocs) produced these warnings: Documentation/ABI/testing/sysfs-kernel-iommu_groups:38: WARNING: Unexpected indentation. Documentation/ABI/testing/sysfs-kernel-iommu_groups:38: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/ABI/testing/sysfs-kernel-iommu_groups:38: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/ABI/testing/sysfs-kernel-iommu_groups:38: WARNING: Unexpected indentation. Documentation/ABI/testing/sysfs-kernel-iommu_groups:38: WARNING: Block quote ends without a blank line; unexpected unindent. Caused by commit 63a816749d86 ("iommu: Document usage of "/sys/kernel/iommu_groups//type" file") -- Cheers, Stephen Rothwell pgpUgwcEwQFUK.pgp Description: OpenPGP digital signature
[PATCH] ASoC: hdmi-codec: Add RX support
HDMI interface can also be used as receiver, this patch is to add such support. The most difference compare with TX is that RX don't need to get edid information. Signed-off-by: Shengjiu Wang --- sound/soc/codecs/hdmi-codec.c | 33 - 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index e8410b2433de..d5fcc4db8284 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -282,6 +282,7 @@ struct hdmi_codec_priv { static const struct snd_soc_dapm_widget hdmi_widgets[] = { SND_SOC_DAPM_OUTPUT("TX"), + SND_SOC_DAPM_OUTPUT("RX"), }; enum { @@ -389,6 +390,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; int ret = 0; mutex_lock(&hcp->lock); @@ -404,7 +406,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, goto err; } - if (hcp->hcd.ops->get_eld) { + if (tx && hcp->hcd.ops->get_eld) { ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data, hcp->eld, sizeof(hcp->eld)); if (ret) @@ -660,14 +662,20 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) { struct snd_soc_dapm_context *dapm; struct hdmi_codec_daifmt *daifmt; - struct snd_soc_dapm_route route = { - .sink = "TX", - .source = dai->driver->playback.stream_name, + struct snd_soc_dapm_route route[] = { + { + .sink = "TX", + .source = dai->driver->playback.stream_name, + }, + { + .sink = dai->driver->capture.stream_name, + .source = "RX", + }, }; int ret; dapm = snd_soc_component_get_dapm(dai->component); - ret = snd_soc_dapm_add_routes(dapm, &route, 1); + ret = snd_soc_dapm_add_routes(dapm, route, 2); if (ret) return ret; @@ -757,6 +765,14 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = { .formats = I2S_FORMATS, .sig_bits = 24, }, + .capture = { + .stream_name = "Capture", + .channels_min = 2, + .channels_max = 8, + .rates = HDMI_RATES, + .formats = I2S_FORMATS, + .sig_bits = 24, + }, .ops = &hdmi_codec_i2s_dai_ops, .pcm_new = hdmi_codec_pcm_new, }; @@ -773,6 +789,13 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .rates = HDMI_RATES, .formats = SPDIF_FORMATS, }, + .capture = { + .stream_name = "Capture", + .channels_min = 2, + .channels_max = 2, + .rates = HDMI_RATES, + .formats = SPDIF_FORMATS, + }, .ops = &hdmi_codec_spdif_dai_ops, .pcm_new = hdmi_codec_pcm_new, }; -- 2.27.0
linux-next: build warnings after merge of the rcu tree
Hi all, After merging the rcu tree, today's linux-next build (htmldocs) produced these warnings: include/linux/rcupdate.h:872: warning: Excess function parameter 'ptr' description in 'kfree_rcu' include/linux/rcupdate.h:872: warning: Excess function parameter 'rhf' description in 'kfree_rcu' Introduced by commit beba8bdf2f16 ("rcu: Introduce kfree_rcu() single-argument macro") -- Cheers, Stephen Rothwell pgppcYuxTrJUA.pgp Description: OpenPGP digital signature
linux-next: build warning after merge of the net-next tree
Hi all, After merging the net-next tree, today's linux-next build (htmldocs) produced this warning: include/linux/phy.h:869: warning: Function parameter or member 'config_intr' not described in 'phy_driver' Introduced by commit 6527b938426f ("net: phy: remove the .did_interrupt() and .ack_interrupt() callback") -- Cheers, Stephen Rothwell pgp8LOgSXUpS9.pgp Description: OpenPGP digital signature
Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add
在 2020/11/26 下午12:52, Yu Zhao 写道: >> */ >> void __pagevec_lru_add(struct pagevec *pvec) >> { >> -int i; >> -struct lruvec *lruvec = NULL; >> +int i, nr_lruvec; >> unsigned long flags = 0; >> +struct page *page; >> +struct lruvecs lruvecs; >> >> -for (i = 0; i < pagevec_count(pvec); i++) { >> -struct page *page = pvec->pages[i]; >> +nr_lruvec = sort_page_lruvec(&lruvecs, pvec); > Simply looping pvec multiple times (15 at most) for different lruvecs > would be better because 1) it requires no extra data structures and > therefore has better cache locality (theoretically faster) 2) it only > loops once when !CONFIG_MEMCG and !CONFIG_NUMA and therefore has no > impact on Android and Chrome OS. > With multiple memcgs, it do help a lot, I had gotten 30% grain on readtwice case. but yes, w/o MEMCG and NUMA, it's good to keep old behavior. So would you like has a proposal for this? Thanks Alex
Re: [stable 4.9] PANIC: double fault, error_code: 0x0 - clang boot failed on x86_64
On Thu, Nov 26, 2020 at 10:14:43AM +0530, Naresh Kamboju wrote: > Linaro recently started building and testing with stable branches with clang. > Stable 4.9 branch kernel built with clang 10 boot crashed on x86 and qemu_x86. > We do not have base line results to compare with. > > steps to build and boot: > # build kernel with tuxmake > # sudo pip3 install -U tuxmake > # tuxmake --runtime docker --target-arch x86 --toolchain clang-10 > --kconfig defconfig --kconfig-add > https://builds.tuxbuild.com/1kgtX7QEDmhvj6OfbZBdlGaEple/config > # boot qemu_x86_64 > # /usr/bin/qemu-system-x86_64 -cpu host -enable-kvm -nographic -net > nic,model=virtio,macaddr=DE:AD:BE:EF:66:14 -net tap -m 1024 -monitor > none -kernel kernel/bzImage --append "root=/dev/sda rootwait > console=ttyS0,115200" -hda > rootfs/rpb-console-image-lkft-intel-corei7-64-20201022181159-3085.rootfs.ext4 > -m 4096 -smp 4 -nographic > > Crash log: > --- > [ 14.121499] Freeing unused kernel memory: 1896K > [ 14.126962] random: fast init done > [ 14.206005] PANIC: double fault, error_code: 0x0 > [ 14.210633] CPU: 1 PID: 1 Comm: systemd Not tainted 4.9.246-rc1 #2 > [ 14.216809] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS > 2.2 05/23/2018 > [ 14.224196] task: 88026e2c task.stack: c902 > [ 14.230105] RIP: 0010:[] [] > proc_dostring+0x13b/0x1e0 > [ 14.238374] RSP: 0018:000c EFLAGS: 00010297 > [ 14.243676] RAX: 5638939fb850 RBX: 000c RCX: > 5638939fb850 > [ 14.250799] RDX: 000c RSI: RDI: > 007f > [ 14.257925] RBP: c9023d98 R08: c9023ef8 R09: > 5638939fb850 > [ 14.265049] R10: R11: 8117f9e0 R12: > 82479cf0 > [ 14.272171] R13: c9023ef8 R14: c9023dd8 R15: > 007f > [ 14.279298] FS: 7f57fbce8840() GS:88027788() > knlGS: > [ 14.287384] CS: 0010 DS: ES: CR0: 80050033 > [ 14.293120] CR2: fff8 CR3: 00026d58a000 CR4: > 00360670 > [ 14.300243] DR0: DR1: DR2: > > [ 14.307368] DR3: DR6: fffe0ff0 DR7: > 0400 > [ 14.314491] Stack: > [ 14.316504] Call Trace: > [ 14.318955] Code: c3 49 8b 10 31 f6 48 01 da 49 89 10 49 83 3e 00 > 74 49 41 83 c7 ff 49 63 ff 4c 89 c9 0f 1f 40 00 48 39 fe 73 36 48 89 > c8 48 89 dc b0 9d 3a 00 85 c0 0f 85 8c 00 00 00 84 d2 74 1f 80 fa > 0a 74 > [ 14.338906] Kernel panic - not syncing: Machine halted. > [ 14.344123] CPU: 1 PID: 1 Comm: systemd Not tainted 4.9.246-rc1 #2 > [ 14.350291] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS > 2.2 05/23/2018 > [ 14.357677] 880277888e80 81518ae9 880277888e98 > 82971a10 > [ 14.365129] 000f 0086 > 820c5d57 > [ 14.372584] 880277888f08 81175736 0038 > 880277888f18 > [ 14.380038] Call Trace: > [ 14.382481] <#DF> [ 14.384406] [] > dump_stack+0xa9/0x100 > [ 14.389641] [] panic+0xe6/0x2a0 > [ 14.394432] [] df_debug+0x31/0x40 > [ 14.399389] [] do_double_fault+0x102/0x140 > [ 14.405128] [] double_fault+0x27/0x30 > [ 14.410440] [] ? proc_put_long+0xc0/0xc0 > [ 14.416004] [] ? proc_dostring+0x13b/0x1e0 > [ 14.421739] [ 14.423703] Kernel Offset: disabled > [ 14.427209] ---[ end Kernel panic - not syncing: Machine halted. > > Reported-by: Naresh Kamboju > > full test log, > https://lkft.validation.linaro.org/scheduler/job/1978901#L916 > https://lkft.validation.linaro.org/scheduler/job/1980839#L578 Is the mainline 4.9 tree supposed to work with clang? I didn't think that upstream effort started until 4.19 or so. thanks, greg k-h
Re: [PATCH] e1000e: Assign DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME to speed up s2ram
> On Nov 25, 2020, at 18:36, Chen Yu wrote: > > Hi Kai-Heng, > On Wed, Nov 25, 2020 at 01:17:28AM +0800, Kai-Heng Feng wrote: >> Hi Yu, >> >>> On Nov 24, 2020, at 23:32, Chen Yu wrote: >>> >>> The NIC is put in runtime suspend status when there is no wire connected. >>> As a result, it is safe to keep this NIC in runtime suspended during s2ram >>> because the system does not rely on the NIC plug event nor WOL to wake up >>> the system. Unlike the s2idle, s2ram does not need to manipulate S0ix >>> settings >>> during suspend. >> >> Please see below for the reason why I explicitly disable direct-complete in >> the driver. >> > Okay. >>> >>> This patch assigns DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME >>> to the e1000e driver so that the s2ram could skip the .suspend_late(), >>> .suspend_noirq() and .resume_noirq() .resume_early() when possible. >>> Also skip .suspend() and .resume() if dev_pm_skip_suspend() and >>> dev_pm_skip_resume() return true, so as to speed up the s2ram. >> >> If we really want direct-complete here, maybe always set current WoL setting >> in runtime suspend routine? >> > Indeed, that would be a choice. >>> >>> Signed-off-by: Chen Yu >>> --- >>> drivers/base/power/main.c | 2 ++ >>> drivers/net/ethernet/intel/e1000e/netdev.c | 14 +- >>> 2 files changed, 15 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c >>> index c7ac49042cee..9cd8abba8612 100644 >>> --- a/drivers/base/power/main.c >>> +++ b/drivers/base/power/main.c >>> @@ -580,6 +580,7 @@ bool dev_pm_skip_resume(struct device *dev) >>> >>> return !dev->power.must_resume; >>> } >>> +EXPORT_SYMBOL_GPL(dev_pm_skip_resume); >> >> I don't think it's a good idea to use this predicate out side of PM core, >> must_resume may change during suspend process. >> > The dev_pm_skip_resume() is used during system resume, not during suspend, so > there would be no race condition I suppose? I think it's better to let PM core to decide. >>> >>> /** >>> * device_resume_noirq - Execute a "noirq resume" callback for given device. >>> @@ -2010,3 +2011,4 @@ bool dev_pm_skip_suspend(struct device *dev) >>> return dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) && >>> pm_runtime_status_suspended(dev); >>> } >>> +EXPORT_SYMBOL_GPL(dev_pm_skip_suspend); >>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c >>> b/drivers/net/ethernet/intel/e1000e/netdev.c >>> index b30f00891c03..d79fddabc553 100644 >>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c >>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c >>> @@ -6965,6 +6965,14 @@ static __maybe_unused int e1000e_pm_suspend(struct >>> device *dev) >>> struct e1000_hw *hw = &adapter->hw; >>> int rc; >>> >>> + /* Runtime suspended means that there is no wired connection >>> +* and it has nothing to do with WOL that, we don't need to >>> +* adjust the WOL settings. So it is safe to put NIC in >>> +* runtime suspend while doing system suspend. >>> +*/ >> >> What about plugging ethernet cable and using WoL after system is suspended? >> Commit "e1000e: Exclude device from suspend direct complete optimization" >> was to address that scenario. >> > Yes, this is what I concerned previously. So in order to support this case, > let's adjust this by checking > if (device_may_wakeup() && dev_pm_skip_suspend()) > > so that if the user has disabled WOL via sysfs then we do not fall > into this optimization > commit 6bf6be1127f7 ("e1000e: Do not wake up the system via WOL if > device wakeup is disabled") I don't think this is right. Isn't E1000_WUFC_LNKC already set for runtime suspend? What if WoL doesn't have it set? >>> + if (dev_pm_skip_suspend(dev)) >>> + return 0; >>> + >>> e1000e_flush_lpic(pdev); >>> >>> e1000e_pm_freeze(dev); >>> @@ -6989,6 +6997,9 @@ static __maybe_unused int e1000e_pm_resume(struct >>> device *dev) >>> struct e1000_hw *hw = &adapter->hw; >>> int rc; >>> >>> + if (dev_pm_skip_resume(dev)) >>> + return 0; >>> + >>> /* Introduce S0ix implementation */ >>> if (hw->mac.type >= e1000_pch_cnp && >>> !e1000e_check_me(hw->adapter->pdev->device)) >>> @@ -7665,7 +7676,8 @@ static int e1000_probe(struct pci_dev *pdev, const >>> struct pci_device_id *ent) >>> >>> e1000_print_device_info(adapter); >>> >>> - dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE); >>> + dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE | >>> + DPM_FLAG_SMART_SUSPEND | >>> DPM_FLAG_MAY_SKIP_RESUME); >>> >>> if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) >>> pm_runtime_put_noidle(&pdev->dev); >> >> Also, most e1000e device on modern platforms doesn't runtime suspend at all >> after commit "e1000e: Disable runtime PM on CNP+". >> > Yes, I did some hack on this to make runtime suspend work. > As w
[PATCH net-next v7 5/5] net/x25: remove x25_kill_by_device()
Remove obsolete function x25_kill_by_device(). It's not used any more. Signed-off-by: Martin Schiller --- net/x25/af_x25.c | 16 1 file changed, 16 deletions(-) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 313a6222ded9..1432a05805ab 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -199,22 +199,6 @@ static void x25_remove_socket(struct sock *sk) write_unlock_bh(&x25_list_lock); } -/* - * Kill all bound sockets on a dropped device. - */ -static void x25_kill_by_device(struct net_device *dev) -{ - struct sock *s; - - write_lock_bh(&x25_list_lock); - - sk_for_each(s, &x25_list) - if (x25_sk(s)->neighbour && x25_sk(s)->neighbour->dev == dev) - x25_disconnect(s, ENETUNREACH, 0, 0); - - write_unlock_bh(&x25_list_lock); -} - /* * Handle device status changes. */ -- 2.20.1
[PATCH net-next v7 3/5] net/lapb: fix t1 timer handling for LAPB_STATE_0
1. DTE interface changes immediately to LAPB_STATE_1 and start sending SABM(E). 2. DCE interface sends N2-times DM and changes to LAPB_STATE_1 afterwards if there is no response in the meantime. Signed-off-by: Martin Schiller --- net/lapb/lapb_timer.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/lapb/lapb_timer.c b/net/lapb/lapb_timer.c index 8f5b17001a07..baa247fe4ed0 100644 --- a/net/lapb/lapb_timer.c +++ b/net/lapb/lapb_timer.c @@ -85,11 +85,18 @@ static void lapb_t1timer_expiry(struct timer_list *t) switch (lapb->state) { /* -* If we are a DCE, keep going DM .. DM .. DM +* If we are a DCE, send DM up to N2 times, then switch to +* STATE_1 and send SABM(E). */ case LAPB_STATE_0: - if (lapb->mode & LAPB_DCE) + if (lapb->mode & LAPB_DCE && + lapb->n2count != lapb->n2) { + lapb->n2count++; lapb_send_control(lapb, LAPB_DM, LAPB_POLLOFF, LAPB_RESPONSE); + } else { + lapb->state = LAPB_STATE_1; + lapb_establish_data_link(lapb); + } break; /* -- 2.20.1
[PATCH net-next v7 4/5] net/x25: fix restart request/confirm handling
We have to take the actual link state into account to handle restart requests/confirms well. Signed-off-by: Martin Schiller --- net/x25/x25_link.c | 41 + 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index 11e868aa625d..f92073f3cb11 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -74,16 +74,43 @@ void x25_link_control(struct sk_buff *skb, struct x25_neigh *nb, switch (frametype) { case X25_RESTART_REQUEST: - confirm = !x25_t20timer_pending(nb); - x25_stop_t20timer(nb); - nb->state = X25_LINK_STATE_3; - if (confirm) + switch (nb->state) { + case X25_LINK_STATE_2: + confirm = !x25_t20timer_pending(nb); + x25_stop_t20timer(nb); + nb->state = X25_LINK_STATE_3; + if (confirm) + x25_transmit_restart_confirmation(nb); + break; + case X25_LINK_STATE_3: + /* clear existing virtual calls */ + x25_kill_by_neigh(nb); + x25_transmit_restart_confirmation(nb); + break; + } break; case X25_RESTART_CONFIRMATION: - x25_stop_t20timer(nb); - nb->state = X25_LINK_STATE_3; + switch (nb->state) { + case X25_LINK_STATE_2: + if (x25_t20timer_pending(nb)) { + x25_stop_t20timer(nb); + nb->state = X25_LINK_STATE_3; + } else { + x25_transmit_restart_request(nb); + x25_start_t20timer(nb); + } + break; + case X25_LINK_STATE_3: + /* clear existing virtual calls */ + x25_kill_by_neigh(nb); + + x25_transmit_restart_request(nb); + nb->state = X25_LINK_STATE_2; + x25_start_t20timer(nb); + break; + } break; case X25_DIAGNOSTIC: @@ -214,8 +241,6 @@ void x25_link_established(struct x25_neigh *nb) { switch (nb->state) { case X25_LINK_STATE_0: - nb->state = X25_LINK_STATE_2; - break; case X25_LINK_STATE_1: x25_transmit_restart_request(nb); nb->state = X25_LINK_STATE_2; -- 2.20.1
[PATCH net-next v7 1/5] net/x25: handle additional netdev events
1. Add / remove x25_link_device by NETDEV_REGISTER/UNREGISTER and also by NETDEV_POST_TYPE_CHANGE/NETDEV_PRE_TYPE_CHANGE. This change is needed so that the x25_neigh struct for an interface is already created when it shows up and is kept independently if the interface goes UP or DOWN. This is used in an upcomming commit, where x25 params of an neighbour will get configurable through ioctls. 2. NETDEV_CHANGE event makes it possible to handle carrier loss and detection. If carrier is lost, clean up everything related to this neighbour by calling x25_link_terminated(). 3. Also call x25_link_terminated() for NETDEV_DOWN events and remove the call to x25_clear_forward_by_dev() in x25_route_device_down(), as this is already called by x25_kill_by_neigh() which gets called by x25_link_terminated(). 4. Do nothing for NETDEV_UP and NETDEV_GOING_DOWN events, as these will be handled in layer 2 (LAPB) and layer3 (X.25) will be informed by layer2 when layer2 link is established and layer3 link should be initiated. Signed-off-by: Martin Schiller --- net/x25/af_x25.c| 22 -- net/x25/x25_link.c | 6 +++--- net/x25/x25_route.c | 3 --- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 046d3fee66a9..313a6222ded9 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -233,21 +233,31 @@ static int x25_device_event(struct notifier_block *this, unsigned long event, #endif ) { switch (event) { - case NETDEV_UP: + case NETDEV_REGISTER: + case NETDEV_POST_TYPE_CHANGE: x25_link_device_up(dev); break; - case NETDEV_GOING_DOWN: + case NETDEV_DOWN: nb = x25_get_neigh(dev); if (nb) { - x25_terminate_link(nb); + x25_link_terminated(nb); x25_neigh_put(nb); } - break; - case NETDEV_DOWN: - x25_kill_by_device(dev); x25_route_device_down(dev); + break; + case NETDEV_PRE_TYPE_CHANGE: + case NETDEV_UNREGISTER: x25_link_device_down(dev); break; + case NETDEV_CHANGE: + if (!netif_carrier_ok(dev)) { + nb = x25_get_neigh(dev); + if (nb) { + x25_link_terminated(nb); + x25_neigh_put(nb); + } + } + break; } } diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index fdae054b7dc1..11e868aa625d 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -232,6 +232,9 @@ void x25_link_established(struct x25_neigh *nb) void x25_link_terminated(struct x25_neigh *nb) { nb->state = X25_LINK_STATE_0; + skb_queue_purge(&nb->queue); + x25_stop_t20timer(nb); + /* Out of order: clear existing virtual calls (X.25 03/93 4.6.3) */ x25_kill_by_neigh(nb); } @@ -277,9 +280,6 @@ void x25_link_device_up(struct net_device *dev) */ static void __x25_remove_neigh(struct x25_neigh *nb) { - skb_queue_purge(&nb->queue); - x25_stop_t20timer(nb); - if (nb->node.next) { list_del(&nb->node); x25_neigh_put(nb); diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 00e46c9a5280..ec2a39e9b3e6 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -115,9 +115,6 @@ void x25_route_device_down(struct net_device *dev) __x25_remove_route(rt); } write_unlock_bh(&x25_route_list_lock); - - /* Remove any related forwarding */ - x25_clear_forward_by_dev(dev); } /* -- 2.20.1
[PATCH net-next v7 2/5] net/lapb: support netdev events
This patch allows layer2 (LAPB) to react to netdev events itself and avoids the detour via layer3 (X.25). 1. Establish layer2 on NETDEV_UP events, if the carrier is already up. 2. Call lapb_disconnect_request() on NETDEV_GOING_DOWN events to signal the peer that the connection will go down. (Only when the carrier is up.) 3. When a NETDEV_DOWN event occur, clear all queues, enter state LAPB_STATE_0 and stop all timers. 4. The NETDEV_CHANGE event makes it possible to handle carrier loss and detection. In case of Carrier Loss, clear all queues, enter state LAPB_STATE_0 and stop all timers. In case of Carrier Detection, we start timer t1 on a DCE interface, and on a DTE interface we change to state LAPB_STATE_1 and start sending SABM(E). Signed-off-by: Martin Schiller --- net/lapb/lapb_iface.c | 82 ++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 3c03f6512c5f..213ea7abc9ab 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -418,14 +418,94 @@ int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb) return used; } +/* Handle device status changes. */ +static int lapb_device_event(struct notifier_block *this, unsigned long event, +void *ptr) +{ + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct lapb_cb *lapb; + + if (!net_eq(dev_net(dev), &init_net)) + return NOTIFY_DONE; + + if (dev->type != ARPHRD_X25) + return NOTIFY_DONE; + + lapb = lapb_devtostruct(dev); + if (!lapb) + return NOTIFY_DONE; + + switch (event) { + case NETDEV_UP: + lapb_dbg(0, "(%p) Interface up: %s\n", dev, dev->name); + + if (netif_carrier_ok(dev)) { + lapb_dbg(0, "(%p): Carrier is already up: %s\n", dev, +dev->name); + if (lapb->mode & LAPB_DCE) { + lapb_start_t1timer(lapb); + } else { + if (lapb->state == LAPB_STATE_0) { + lapb->state = LAPB_STATE_1; + lapb_establish_data_link(lapb); + } + } + } + break; + case NETDEV_GOING_DOWN: + if (netif_carrier_ok(dev)) + lapb_disconnect_request(dev); + break; + case NETDEV_DOWN: + lapb_dbg(0, "(%p) Interface down: %s\n", dev, dev->name); + lapb_dbg(0, "(%p) S%d -> S0\n", dev, lapb->state); + lapb_clear_queues(lapb); + lapb->state = LAPB_STATE_0; + lapb->n2count = 0; + lapb_stop_t1timer(lapb); + lapb_stop_t2timer(lapb); + break; + case NETDEV_CHANGE: + if (netif_carrier_ok(dev)) { + lapb_dbg(0, "(%p): Carrier detected: %s\n", dev, +dev->name); + if (lapb->mode & LAPB_DCE) { + lapb_start_t1timer(lapb); + } else { + if (lapb->state == LAPB_STATE_0) { + lapb->state = LAPB_STATE_1; + lapb_establish_data_link(lapb); + } + } + } else { + lapb_dbg(0, "(%p) Carrier lost: %s\n", dev, dev->name); + lapb_dbg(0, "(%p) S%d -> S0\n", dev, lapb->state); + lapb_clear_queues(lapb); + lapb->state = LAPB_STATE_0; + lapb->n2count = 0; + lapb_stop_t1timer(lapb); + lapb_stop_t2timer(lapb); + } + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block lapb_dev_notifier = { + .notifier_call = lapb_device_event, +}; + static int __init lapb_init(void) { - return 0; + return register_netdevice_notifier(&lapb_dev_notifier); } static void __exit lapb_exit(void) { WARN_ON(!list_empty(&lapb_list)); + + unregister_netdevice_notifier(&lapb_dev_notifier); } MODULE_AUTHOR("Jonathan Naylor "); -- 2.20.1
[PATCH net-next v7 0/5] net/x25: netdev event handling
--- Changes to v6: o integrated some code styling suggestions by Jakub. Changes to v5: o fix numbering in commit message of patch 2/5. Changes to v4: o also establish layer2 (LAPB) on NETDEV_UP events, if the carrier is already UP. Changes to v3: o another complete rework of the patch-set to split event handling for layer2 (LAPB) and layer3 (X.25) Changes to v2: o restructure complete patch-set o keep netdev event handling in layer3 (X.25) o add patch to fix lapb_connect_request() for DCE o add patch to handle carrier loss correctly in lapb o drop patch for x25_neighbour param handling this may need fixes/cleanup and will be resubmitted later. Changes to v1: o fix 'subject_prefix' and 'checkpatch' warnings --- Martin Schiller (5): net/x25: handle additional netdev events net/lapb: support netdev events net/lapb: fix t1 timer handling for LAPB_STATE_0 net/x25: fix restart request/confirm handling net/x25: remove x25_kill_by_device() net/lapb/lapb_iface.c | 82 ++- net/lapb/lapb_timer.c | 11 -- net/x25/af_x25.c | 38 +--- net/x25/x25_link.c| 47 +++-- net/x25/x25_route.c | 3 -- 5 files changed, 142 insertions(+), 39 deletions(-) -- 2.20.1
Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE
Chao, > A little bit wired, why not failing cluster_may_compress() for user mode, and > let writepages write cluster as raw blocks, in-where we can update > i_compr_blocks > and global compr block stats correctly. For decompression ioctl, I've made f2fs_need_compress_data() return "false" to prevent compression write, so we don't use f2fs_write_compressed_pages() anymore in this case. Because of this, I manually updated i_compr_blocks. Do you have any suggestions on this? 2020년 11월 26일 (목) 오후 2:04, Daeho Jeong 님이 작성: > > Eric, > > do_page_cache_ra() is defined in mm/internal.h for internal use > between in mm, so we cannot use this one right now. > So, I think we could use page_cache_ra_unbounded(), because we already > check i_size boundary on our own. > What do you think? > > 2020년 11월 24일 (화) 오후 12:05, Chao Yu 님이 작성: > > > > On 2020/11/23 11:17, Daeho Jeong wrote: > > > From: Daeho Jeong > > > > > > Added two ioctl to decompress/compress explicitly the compression > > > enabled file in "compress_mode=user-based" mount option. > > > > > > Using these two ioctls, the users can make a control of compression > > > and decompression of their files. > > > > > > Signed-off-by: Daeho Jeong > > > --- > > > fs/f2fs/file.c| 181 +- > > > include/uapi/linux/f2fs.h | 2 + > > > 2 files changed, 182 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > > index be8db06aca27..e8f142470e87 100644 > > > --- a/fs/f2fs/file.c > > > +++ b/fs/f2fs/file.c > > > @@ -4026,6 +4026,180 @@ static int f2fs_ioc_set_compress_option(struct > > > file *filp, unsigned long arg) > > > return ret; > > > } > > > > > > +static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) > > > +{ > > > + DEFINE_READAHEAD(ractl, NULL, inode->i_mapping, page_idx); > > > + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > > > + struct address_space *mapping = inode->i_mapping; > > > + struct page *page; > > > + pgoff_t redirty_idx = page_idx; > > > + int i, page_len = 0, ret = 0; > > > + > > > + page_cache_ra_unbounded(&ractl, len, 0); > > > + > > > + for (i = 0; i < len; i++, page_idx++) { > > > + page = read_cache_page(mapping, page_idx, NULL, NULL); > > > + if (IS_ERR(page)) { > > > + ret = PTR_ERR(page); > > > + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " > > > + "couldn't be read (errno:%d).\n", > > > + __func__, inode->i_ino, page_idx, ret); > > > > This is a common error case during calling read_cache_page(), IMO, this > > looks > > more like a debug log, so I prefer to print nothing here, or at least using > > f2fs_debug() instead. > > > > > + break; > > > + } > > > + page_len++; > > > + } > > > + > > > + for (i = 0; i < page_len; i++, redirty_idx++) { > > > + page = find_lock_page(mapping, redirty_idx); > > > + if (!page) { > > > + ret = -ENOENT; > > > + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " > > > + "couldn't be found (errno:%d).\n", > > > + __func__, inode->i_ino, redirty_idx, ret); > > > > Ditto. > > > > > + } > > > + set_page_dirty(page); > > > + f2fs_put_page(page, 1); > > > + f2fs_put_page(page, 0); > > > + } > > > + > > > + return ret; > > > +} > > > + > > > +static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) > > > +{ > > > + struct inode *inode = file_inode(filp); > > > + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > > > + struct f2fs_inode_info *fi = F2FS_I(inode); > > > + pgoff_t page_idx = 0, last_idx; > > > + int cluster_size = F2FS_I(inode)->i_cluster_size; > > > + int count, ret; > > > + > > > + if (!f2fs_sb_has_compression(sbi)) > > > + return -EOPNOTSUPP; > > > + > > > + if (!(filp->f_mode & FMODE_WRITE)) > > > + return -EBADF; > > > + > > > + if (!f2fs_compressed_file(inode)) > > > + return -EINVAL; > > > > Before compressubg/decompressing file, should we check whether current > > inode's > > compress algorithm backend is available in f2fs module? > > > > > + > > > + f2fs_balance_fs(F2FS_I_SB(inode), true); > > > + > > > + file_start_write(filp); > > > + inode_lock(inode); > > > + > > > + if (f2fs_is_mmap_file(inode)) { > > > + ret = -EBUSY; > > > + goto out; > > > + } > > > + > > > + ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); > > > + if (ret) > > > + goto out; > > > + > > > + if (!atomic_read(&fi->i_compr_blocks)) > > > + goto out; > > > + > > > + last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); > > > + > >
[PATCH] pinctrl: aspeed: Fix GPIO requests on pass-through banks
Commit 6726fbff19bf ("pinctrl: aspeed: Fix GPI only function problem.") fixes access to GPIO banks T and U on the AST2600. Both banks contain input-only pins and the GPIO pin function is named GPITx and GPIUx respectively. Unfortunately the fix had a negative impact on GPIO banks D and E for the AST2400 and AST2500 where the GPIO pass-through functions take similar "GPI"-style names. The net effect on the older SoCs was that when the GPIO subsystem requested a pin in banks D or E be muxed for GPIO, they were instead muxed for pass-through mode. Mistakenly muxing pass-through mode e.g. breaks booting the host on IBM's Witherspoon (AC922) platform where GPIOE0 is used for FSI. Further exploit the names in the provided expression structure to differentiate pass-through from pin-specific GPIO modes. This follow-up fix gives the expected behaviour for the following tests: Witherspoon BMC (AST2500): 1. Power-on the Witherspoon host 2. Request GPIOD1 be muxed via /sys/class/gpio/export 3. Request GPIOE1 be muxed via /sys/class/gpio/export 4. Request the balls for GPIOs E2 and E3 be muxed as GPIO pass-through ("GPIE2" mode) via a pinctrl hog in the devicetree Rainier BMC (AST2600): 5. Request GPIT0 be muxed via /sys/class/gpio/export 6. Request GPIU0 be muxed via /sys/class/gpio/export Together the tests demonstrate that all three pieces of functionality (general GPIOs via 1, 2 and 3, input-only GPIOs via 5 and 6, pass-through mode via 4) operate as desired across old and new SoCs. Fixes: 6726fbff19bf ("pinctrl: aspeed: Fix GPI only function problem.") Cc: Billy Tsai Cc: Joel Stanley Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/pinctrl-aspeed.c | 74 +++-- drivers/pinctrl/aspeed/pinmux-aspeed.h | 7 ++- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c index 1d603732903f..9c44ef11b567 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c @@ -286,14 +286,76 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, static bool aspeed_expr_is_gpio(const struct aspeed_sig_expr *expr) { /* -* The signal type is GPIO if the signal name has "GPI" as a prefix. -* strncmp (rather than strcmp) is used to implement the prefix -* requirement. +* We need to differentiate between GPIO and non-GPIO signals to +* implement the gpio_request_enable() interface. For better or worse +* the ASPEED pinctrl driver uses the expression names to determine +* whether an expression will mux a pin for GPIO. * -* expr->signal might look like "GPIOB1" in the GPIO case. -* expr->signal might look like "GPIT0" in the GPI case. +* Generally we have the following - A GPIO such as B1 has: +* +*- expr->signal set to "GPIOB1" +*- expr->function set to "GPIOB1" +* +* Using this fact we can determine whether the provided expression is +* a GPIO expression by testing the signal name for the string prefix +* "GPIO". +* +* However, some GPIOs are input-only, and the ASPEED datasheets name +* them differently. An input-only GPIO such as T0 has: +* +*- expr->signal set to "GPIT0" +*- expr->function set to "GPIT0" +* +* It's tempting to generalise the prefix test from "GPIO" to "GPI" to +* account for both GPIOs and GPIs, but in doing so we run aground on +* another feature: +* +* Some pins in the ASPEED BMC SoCs have a "pass-through" GPIO +* function where the input state of one pin is replicated as the +* output state of another (as if they were shorted together - a mux +* configuration that is typically enabled by hardware strapping). +* This feature allows the BMC to pass e.g. power button state through +* to the host while the BMC is yet to boot, but take control of the +* button state once the BMC has booted by muxing each pin as a +* separate, pin-specific GPIO. +* +* Conceptually this pass-through mode is a form of GPIO and is named +* as such in the datasheets, e.g. "GPID0". This naming similarity +* trips us up with the simple GPI-prefixed-signal-name scheme +* discussed above, as the pass-through configuration is not what we +* want when muxing a pin as GPIO for the GPIO subsystem. +* +* On e.g. the AST2400, a pass-through function "GPID0" is grouped on +* balls A18 and D16, where we have: +* +*For ball A18: +*- expr->signal set to "GPID0IN" +*- expr->function set to "GPID0" +* +*For ball D16: +*- expr->signal set to "GPID0OUT" +*- expr->function set to "GPID0" +
Re: [PATCH] tomoyo: Avoid potential null pointer access
Hello, Tetsuo Got it , Thank you for your explanation. Hello, Zheng. Thank you for a patch, but I won't apply this patch. Expected behavior is that tomoyo_warn_oom() is called if tomoyo_memory_ok() is called with entry == NULL. Adding __GFP_NOWARN might be OK, but returning without tomoyo_warn_oom() is NG. On 2020/11/25 21:10, Zheng Zengkai wrote: Calls to kzalloc() should be null-checked in order to avoid any potential failures or unnecessary code execution. Fix this by adding null checks for _entry_ right after allocation. Fixes: 57c2590fb7fd ("TOMOYO: Update profile structure") Reported-by: Hulk Robot Signed-off-by: Zheng Zengkai Nacked-by: Tetsuo Handa As your say, I found the function tomoyo_assign_namespace( ) in security/tomoyo/domain.c has the similar situation, Can I add __GFP_NOWARN for both and remove the null check for _entry_ in tomoyo_assign_namespace( )? diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..bc54d3c8c70a 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -498,7 +498,7 @@ static struct tomoyo_profile *tomoyo_assign_profile ptr = ns->profile_ptr[profile]; if (ptr) return ptr; - entry = kzalloc(sizeof(*entry), GFP_NOFS); + entry = kzalloc(sizeof(*entry), GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(&tomoyo_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index dc4ecc0b2038..c6e5cc5cc7cd 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c @@ -473,9 +473,7 @@ struct tomoyo_policy_namespace *tomoyo_assign_namespace(const char *domainname) return ptr; if (len >= TOMOYO_EXEC_TMPSIZE - 10 || !tomoyo_domain_def(domainname)) return NULL; - entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS); - if (!entry) - return NULL; + entry = kzalloc(sizeof(*entry) + len + 1, GFP_NOFS | __GFP_NOWARN); if (mutex_lock_interruptible(&tomoyo_policy_lock)) goto out; ptr = tomoyo_find_namespace(domainname, len); --- security/tomoyo/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 4bee32bfe16d..99b4fafcb100 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -499,6 +499,8 @@ static struct tomoyo_profile *tomoyo_assign_profile if (ptr) return ptr; entry = kzalloc(sizeof(*entry), GFP_NOFS); + if (!entry) + return NULL; if (mutex_lock_interruptible(&tomoyo_policy_lock)) goto out; ptr = ns->profile_ptr[profile]; .
Re: [RFC][PATCH 00/18] crypto: Add generic Kerberos library
On Thu, Nov 12, 2020 at 12:57:45PM +, David Howells wrote: > > Hi Herbert, Bruce, > > Here's my first cut at a generic Kerberos crypto library in the kernel so > that I can share code between rxrpc and sunrpc (and cifs?). Hi David: I can't find the bit where you are actually sharing this code with sunrpc, am I missing something? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
[rcu:rcu/next] BUILD SUCCESS d33e4f0afdb2a1eb2890e0ea2ba4bb9101d92da5
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/next branch HEAD: d33e4f0afdb2a1eb2890e0ea2ba4bb9101d92da5 torture: Make torture.sh refscale runs use verbose_batched module parameter elapsed time: 727m configs tested: 122 configs skipped: 2 The following configs have been built successfully. More configs may be tested in the coming days. gcc tested configs: arm defconfig arm64allyesconfig arm64 defconfig arm allyesconfig arm allmodconfig mips cu1830-neo_defconfig mips rm200_defconfig xtensa audio_kc705_defconfig arm pxa910_defconfig powerpc ppc44x_defconfig riscvallyesconfig powerpc wii_defconfig arm h5000_defconfig m68k sun3_defconfig arm pxa168_defconfig powerpc xes_mpc85xx_defconfig mips loongson1c_defconfig m68k m5275evb_defconfig mipsgpr_defconfig sh rsk7201_defconfig nios2 3c120_defconfig xtensaxip_kc705_defconfig mips db1xxx_defconfig armlart_defconfig armrealview_defconfig m68k hp300_defconfig arcvdk_hs38_defconfig armqcom_defconfig m68kmvme147_defconfig armdove_defconfig sh rts7751r2dplus_defconfig mips rt305x_defconfig mipsworkpad_defconfig arm ixp4xx_defconfig sh rts7751r2d1_defconfig armkeystone_defconfig powerpc tqm8540_defconfig microblaze defconfig sh ecovec24_defconfig powerpc tqm8541_defconfig mips pic32mzda_defconfig armneponset_defconfig s390 zfcpdump_defconfig sh j2_defconfig arm64alldefconfig mips bmips_stb_defconfig sh se7206_defconfig powerpcklondike_defconfig powerpc ppc64e_defconfig arm cm_x300_defconfig powerpc ep88xc_defconfig powerpc mpc8540_ads_defconfig powerpc lite5200b_defconfig h8300h8300h-sim_defconfig ia64 allmodconfig ia64defconfig ia64 allyesconfig m68k allmodconfig m68kdefconfig m68k allyesconfig nios2 defconfig arc allyesconfig nds32 allnoconfig c6x allyesconfig nds32 defconfig nios2allyesconfig cskydefconfig alpha defconfig alphaallyesconfig xtensa allyesconfig h8300allyesconfig arc defconfig sh allmodconfig parisc defconfig s390 allyesconfig parisc allyesconfig s390defconfig i386 allyesconfig sparcallyesconfig sparc defconfig i386defconfig mips allyesconfig mips allmodconfig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig i386 randconfig-a004-20201125 i386 randconfig-a003-20201125 i386 randconfig-a002-20201125 i386 randconfig-a005-20201125 i386 randconfig-a001-20201125 i386 randconfig-a006-20201125 x86_64 randconfig-a015-20201125 x86_64 randconfig-a011-20201125 x86_64 randconfig-a014-20201125 x86_64 randconfig-a016-20201125 x86_64 randconfig-a012-20201125 x86_64 randconfig-a013-20201125 i386 randconfig-a012-20201125 i386 randconfig-a013
[PATCH 3/3] clear_warn_once: add a warn_once_reset= boot parameter
In the event debugfs is not mounted, or if built with the .config setting DEBUG_FS_ALLOW_NONE chosen, this gives the sysadmin access to reset the WARN_ONCE() state on a periodic basis. Cc: Andi Kleen Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Signed-off-by: Paul Gortmaker --- .../admin-guide/kernel-parameters.txt | 8 +++ kernel/panic.c| 21 +++ 2 files changed, 29 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 44fde25bb221..89f5fee7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5863,6 +5863,14 @@ vt.underline= [VT] Default color for underlined text; 0-15. Default: 3 = cyan. + warn_once_reset= + [KNL] + Set the WARN_ONCE reset period in seconds. Normally + a WARN_ONCE() will only ever emit a message once per + boot, but for example, setting this to 3600 would + effectively rate-limit WARN_ONCE to once per hour. + Default: 0 = never. + watchdog timers [HW,WDT] For information on watchdog timers, see Documentation/watchdog/watchdog-parameters.rst or other driver-specific files in the diff --git a/kernel/panic.c b/kernel/panic.c index a23eb239fb17..f813ca3a5cd5 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -716,10 +716,31 @@ static __init int register_warn_debugfs(void) /* Don't care about failure */ debugfs_create_file_unsafe("clear_warn_once", 0600, NULL, &warn_once_reset, &clear_warn_once_fops); + + /* if a bootarg was used, set the initial timer */ + if (warn_once_reset) + warn_once_set(NULL, warn_once_reset); + return 0; } device_initcall(register_warn_debugfs); + +static int __init warn_once_setup(char *s) +{ + int r; + + if (!s) + return -EINVAL; + + r = kstrtoull(s, 0, &warn_once_reset); + if (r) + return r; + + return 1; +} +__setup("warn_once_reset=", warn_once_setup); + #endif #ifdef CONFIG_STACKPROTECTOR -- 2.25.1
[PATCH 2/3] clear_warn_once: bind a timer to written reset value
Existing documentation has a write of "1" to clear/reset all the WARN_ONCE and similar to the as-booted state, so they can possibly be re-triggered again during debugging/testing. But having them auto-reset once a day, or once a week, might shed valuable information to a sysadmin on what the system is doing. Here we extend the existing debugfs variable to bind a timer to the written value N, so that it will reset every N seconds, for N>1. Writing a zero will clear any previously set timer value. The pre-existing behaviour of writing N=1 will do a one-shot clear. Cc: Andi Kleen Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Signed-off-by: Paul Gortmaker --- .../admin-guide/clearing-warn-once.rst| 9 ++ kernel/panic.c| 32 +++ 2 files changed, 41 insertions(+) diff --git a/Documentation/admin-guide/clearing-warn-once.rst b/Documentation/admin-guide/clearing-warn-once.rst index 211fd926cf00..93cf3ba0b57d 100644 --- a/Documentation/admin-guide/clearing-warn-once.rst +++ b/Documentation/admin-guide/clearing-warn-once.rst @@ -7,3 +7,12 @@ echo 1 > /sys/kernel/debug/clear_warn_once clears the state and allows the warnings to print once again. This can be useful after test suite runs to reproduce problems. + +Values greater than one set a timer for a periodic state reset; e.g. + +echo 3600 > /sys/kernel/debug/clear_warn_once + +will establish an hourly state reset, effectively turning WARN_ONCE +into a long period rate-limited warning. + +Writing a value of zero (or one) will remove any previously set timer. diff --git a/kernel/panic.c b/kernel/panic.c index 1d425970a50c..a23eb239fb17 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -655,6 +655,7 @@ EXPORT_SYMBOL(__warn_printk); /* Support resetting WARN*_ONCE state */ static u64 warn_once_reset; +static bool warn_timer_active; static void do_clear_warn_once(void) { @@ -662,6 +663,14 @@ static void do_clear_warn_once(void) memset(__start_once, 0, __end_once - __start_once); } +static void timer_warn_once(struct timer_list *timer) +{ + do_clear_warn_once(); + timer->expires = jiffies + warn_once_reset * HZ; + add_timer(timer); +} +static DEFINE_TIMER(warn_reset_timer, timer_warn_once); + static int warn_once_get(void *data, u64 *val) { *val = warn_once_reset; @@ -672,6 +681,29 @@ static int warn_once_set(void *data, u64 val) { warn_once_reset = val; + if (val > 1) { /* set/reset new timer */ + unsigned long expires = jiffies + val * HZ; + + if (warn_timer_active) { + mod_timer(&warn_reset_timer, expires); + } else { + warn_timer_active = 1; + warn_reset_timer.expires = expires; + add_timer(&warn_reset_timer); + } + return 0; + } + + if (warn_timer_active) { + del_timer_sync(&warn_reset_timer); + warn_timer_active = 0; + } + warn_once_reset = 0; + + if (val == 0) /* cleared timer, we are done */ + return 0; + + /* Getting here means val == 1 ---> so clear existing data */ do_clear_warn_once(); return 0; } -- 2.25.1
[PATCH 1/3] clear_warn_once: expand debugfs to include read support
The existing clear_warn_once variable is write-only; used as per the documentation to reset the warn_once to as-booted state with: echo 1 > /sys/kernel/debug/clear_warn_once The objective is to expand on that functionality, which requires the debugfs variable to be read/write and not just write-only. Here, we deal with the debugfs boilerplate associated with converting it from write-only to read-write, in order to factor that out for easier review, and for what may be a possible future useful bisect point. Existing functionality is unchanged - the only difference is that we have tied in a variable that lets you now read the variable and see the last value written. Cc: Andi Kleen Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Signed-off-by: Paul Gortmaker --- kernel/panic.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index 332736a72a58..1d425970a50c 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -654,21 +654,36 @@ EXPORT_SYMBOL(__warn_printk); /* Support resetting WARN*_ONCE state */ -static int clear_warn_once_set(void *data, u64 val) +static u64 warn_once_reset; + +static void do_clear_warn_once(void) { generic_bug_clear_once(); memset(__start_once, 0, __end_once - __start_once); +} + +static int warn_once_get(void *data, u64 *val) +{ + *val = warn_once_reset; + return 0; +} + +static int warn_once_set(void *data, u64 val) +{ + warn_once_reset = val; + + do_clear_warn_once(); return 0; } -DEFINE_DEBUGFS_ATTRIBUTE(clear_warn_once_fops, NULL, clear_warn_once_set, -"%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(clear_warn_once_fops, warn_once_get, warn_once_set, +"%llu\n"); static __init int register_warn_debugfs(void) { /* Don't care about failure */ - debugfs_create_file_unsafe("clear_warn_once", 0200, NULL, NULL, - &clear_warn_once_fops); + debugfs_create_file_unsafe("clear_warn_once", 0600, NULL, + &warn_once_reset, &clear_warn_once_fops); return 0; } -- 2.25.1
[PATCH 0/3] clear_warn_once: add timed interval resetting
The existing clear_warn_once functionality is currently a manually issued state reset via the file /sys/kernel/debug/clear_warn_once when debugfs is mounted. The idea being that a developer would be running some tests, like LTP or similar, and want to check reproducibility without having to reboot. But you currently can't make use of clear_warn_once unless you've got debugfs enabled and mounted - which may not be desired by some people in some deployment situations. The functionality added here allows for periodic resets in addition to the one-shot reset it already had. Then we allow for a boot-time setting of the periodic resets so it can be used even when debugfs isn't mounted. By having a periodic reset, we also open the door for having the various "once" functions act as long period ratelimited messages, where a sysadmin can pick an hour or a day reset if they are facing an issue and are wondering "did this just happen once, or am I only being informed once?" Tested with DEBUG_FS_ALLOW_ALL and DEBUG_FS_ALLOW_NONE on an otherwise defconfig. --- Cc: Andi Kleen Cc: Petr Mladek Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: John Ogness Paul Gortmaker (3): clear_warn_once: expand debugfs to include read support clear_warn_once: bind a timer to written reset value clear_warn_once: add a warn_once_reset= boot parameter .../admin-guide/clearing-warn-once.rst| 9 +++ .../admin-guide/kernel-parameters.txt | 8 ++ kernel/panic.c| 78 +-- 3 files changed, 90 insertions(+), 5 deletions(-) -- 2.25.1
Re: [PATCH 2/3] venus: Limit HFI sessions to the maximum supported
On Wed, Nov 25, 2020 at 10:01 PM Stanimir Varbanov wrote: > > > > On 11/25/20 5:46 AM, Alexandre Courbot wrote: > > On Fri, Nov 20, 2020 at 9:12 AM Stanimir Varbanov > > wrote: > >> > >> Currently we rely on firmware to return error when we reach the maximum > >> supported number of sessions. But this errors are happened at reqbuf > >> time which is a bit later. The more reasonable way looks like is to > >> return the error on driver open. > >> > >> To achieve that modify hfi_session_create to return error when we reach > >> maximum count of sessions and thus refuse open. > >> > >> Signed-off-by: Stanimir Varbanov > >> --- > >> drivers/media/platform/qcom/venus/core.h | 1 + > >> drivers/media/platform/qcom/venus/hfi.c | 19 +++ > >> .../media/platform/qcom/venus/hfi_parser.c| 3 +++ > >> 3 files changed, 19 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/media/platform/qcom/venus/core.h > >> b/drivers/media/platform/qcom/venus/core.h > >> index db0e6738281e..3a477fcdd3a8 100644 > >> --- a/drivers/media/platform/qcom/venus/core.h > >> +++ b/drivers/media/platform/qcom/venus/core.h > >> @@ -96,6 +96,7 @@ struct venus_format { > >> #define MAX_CAP_ENTRIES32 > >> #define MAX_ALLOC_MODE_ENTRIES 16 > >> #define MAX_CODEC_NUM 32 > >> +#define MAX_SESSIONS 16 > >> > >> struct raw_formats { > >> u32 buftype; > >> diff --git a/drivers/media/platform/qcom/venus/hfi.c > >> b/drivers/media/platform/qcom/venus/hfi.c > >> index 638ed5cfe05e..8420be6d3991 100644 > >> --- a/drivers/media/platform/qcom/venus/hfi.c > >> +++ b/drivers/media/platform/qcom/venus/hfi.c > >> @@ -175,6 +175,7 @@ static int wait_session_msg(struct venus_inst *inst) > >> int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops > >> *ops) > >> { > >> struct venus_core *core = inst->core; > >> + int ret; > >> > >> if (!ops) > >> return -EINVAL; > >> @@ -183,12 +184,22 @@ int hfi_session_create(struct venus_inst *inst, > >> const struct hfi_inst_ops *ops) > >> init_completion(&inst->done); > >> inst->ops = ops; > >> > >> - mutex_lock(&core->lock); > >> - list_add_tail(&inst->list, &core->instances); > >> - atomic_inc(&core->insts_count); > >> + ret = mutex_lock_interruptible(&core->lock); > >> + if (ret) > >> + return ret; > > > > Why do we change to mutex_lock_interruptible() here? This makes this > > Because mutex_lock_interruptible is preferable in kernel docs, but I > agree that changing mutex_lock with mutex_lock_interruptible should be > subject of another lock related patches. I will drop this in next patch > version. > > > function return an error even though we could obtain the lock just by > > trying a bit harder. > > I didn't get that. The behavior of mutex_lock_interruptible is that same > as mutex_lock, i.e. the it will sleep to acquire the lock. The > difference is that the sleep could be interrupted by a signal. You might > think about mutex_trylock? Unless that mutex can be held by someone else for a rather long time (i.e. to the point where we may want to give priority to signals when userspace opens the device, since that's where hfi_session_create() is called), I am not convinced this change is necessary? It may confuse userspace into thinking there was a serious error while there is none. Granted, userspace should manage this case, and from what I can see this code is correct, but I'm not sure we would gain anything by adding this extra complexity. > > > > >> + > >> + ret = atomic_read(&core->insts_count); > >> + if (ret + 1 > core->max_sessions_supported) { > >> + ret = -EAGAIN; > >> + } else { > >> + atomic_inc(&core->insts_count); > >> + list_add_tail(&inst->list, &core->instances); > >> + ret = 0; > >> + } > >> + > >> mutex_unlock(&core->lock); > >> > >> - return 0; > >> + return ret; > >> } > >> EXPORT_SYMBOL_GPL(hfi_session_create); > >> > >> diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c > >> b/drivers/media/platform/qcom/venus/hfi_parser.c > >> index 363ee2a65453..52898633a8e6 100644 > >> --- a/drivers/media/platform/qcom/venus/hfi_parser.c > >> +++ b/drivers/media/platform/qcom/venus/hfi_parser.c > >> @@ -276,6 +276,9 @@ u32 hfi_parser(struct venus_core *core, struct > >> venus_inst *inst, void *buf, > >> words_count--; > >> } > >> > >> + if (!core->max_sessions_supported) > >> + core->max_sessions_supported = MAX_SESSIONS; > >> + > >> parser_fini(inst, codecs, domain); > >> > >> return HFI_ERR_NONE; > >> -- > >> 2.17.1 > >> > > -- > regards, > Stan
Re: [PATCH bpf-next v3 3/3] bpf: Add a selftest for bpf_ima_inode_hash
On 11/24/20 7:12 AM, KP Singh wrote: From: KP Singh The test does the following: - Mounts a loopback filesystem and appends the IMA policy to measure executions only on this file-system. Restricting the IMA policy to a particular filesystem prevents a system-wide IMA policy change. - Executes an executable copied to this loopback filesystem. - Calls the bpf_ima_inode_hash in the bprm_committed_creds hook and checks if the call succeeded and checks if a hash was calculated. The test shells out to the added ima_setup.sh script as the setup is better handled in a shell script and is more complicated to do in the test program or even shelling out individual commands from C. The list of required configs (i.e. IMA, SECURITYFS, IMA_{WRITE,READ}_POLICY) for running this test are also updated. Signed-off-by: KP Singh --- tools/testing/selftests/bpf/config| 4 + tools/testing/selftests/bpf/ima_setup.sh | 80 +++ .../selftests/bpf/prog_tests/test_ima.c | 74 + tools/testing/selftests/bpf/progs/ima.c | 28 +++ 4 files changed, 186 insertions(+) create mode 100644 tools/testing/selftests/bpf/ima_setup.sh create mode 100644 tools/testing/selftests/bpf/prog_tests/test_ima.c create mode 100644 tools/testing/selftests/bpf/progs/ima.c diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config index 2118e23ac07a..365bf9771b07 100644 --- a/tools/testing/selftests/bpf/config +++ b/tools/testing/selftests/bpf/config @@ -39,3 +39,7 @@ CONFIG_BPF_JIT=y CONFIG_BPF_LSM=y CONFIG_SECURITY=y CONFIG_LIRC=y +CONFIG_IMA=y +CONFIG_SECURITYFS=y +CONFIG_IMA_WRITE_POLICY=y +CONFIG_IMA_READ_POLICY=y diff --git a/tools/testing/selftests/bpf/ima_setup.sh b/tools/testing/selftests/bpf/ima_setup.sh new file mode 100644 index ..15490ccc5e55 --- /dev/null +++ b/tools/testing/selftests/bpf/ima_setup.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +set -e +set -u + +IMA_POLICY_FILE="/sys/kernel/security/ima/policy" +TEST_BINARY="/bin/true" + +usage() +{ +echo "Usage: $0 " +exit 1 +} + +setup() +{ +local tmp_dir="$1" +local mount_img="${tmp_dir}/test.img" +local mount_dir="${tmp_dir}/mnt" +local copied_bin_path="${mount_dir}/$(basename ${TEST_BINARY})" +mkdir -p ${mount_dir} + +dd if=/dev/zero of="${mount_img}" bs=1M count=10 + +local loop_device="$(losetup --find --show ${mount_img})" + +mkfs.ext4 "${loop_device}" +mount "${loop_device}" "${mount_dir}" + +cp "${TEST_BINARY}" "${mount_dir}" +local mount_uuid="$(blkid -s UUID -o value ${loop_device})" +echo "measure func=BPRM_CHECK fsuuid=${mount_uuid}" > ${IMA_POLICY_FILE} +} + +cleanup() { +local tmp_dir="$1" +local mount_img="${tmp_dir}/test.img" +local mount_dir="${tmp_dir}/mnt" + +local loop_devices=$(losetup -j ${mount_img} -O NAME --noheadings) +for loop_dev in "${loop_devices}"; do +losetup -d $loop_dev +done + +umount ${mount_dir} +rm -rf ${tmp_dir} +} + +run() +{ +local tmp_dir="$1" +local mount_dir="${tmp_dir}/mnt" +local copied_bin_path="${mount_dir}/$(basename ${TEST_BINARY})" + +exec "${copied_bin_path}" +} + +main() +{ +[[ $# -ne 2 ]] && usage + +local action="$1" +local tmp_dir="$2" + +[[ ! -d "${tmp_dir}" ]] && echo "Directory ${tmp_dir} doesn't exist" && exit 1 + +if [[ "${action}" == "setup" ]]; then +setup "${tmp_dir}" +elif [[ "${action}" == "cleanup" ]]; then +cleanup "${tmp_dir}" +elif [[ "${action}" == "run" ]]; then +run "${tmp_dir}" +else +echo "Unknown action: ${action}" +exit 1 +fi +} + +main "$@" diff --git a/tools/testing/selftests/bpf/prog_tests/test_ima.c b/tools/testing/selftests/bpf/prog_tests/test_ima.c new file mode 100644 index ..61fca681d524 --- /dev/null +++ b/tools/testing/selftests/bpf/prog_tests/test_ima.c @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Copyright (C) 2020 Google LLC. + */ + +#include +#include +#include +#include +#include + +#include "ima.skel.h" + +static int run_measured_process(const char *measured_dir, u32 *monitored_pid) +{ + int child_pid, child_status; + + child_pid = fork(); + if (child_pid == 0) { + *monitored_pid = getpid(); + execlp("./ima_setup.sh", "./ima_setup.sh", "run", measured_dir, + NULL); + exit(errno); Running test_progs-no-alu32, the test failed as: root@arch-fb-vm1:~/net-next/net-next/tools/testing/selftests/bpf ./test_progs-no_alu32 -t test_ima sh: ./ima_setup.sh: No such file or directory sh: ./ima_setup.sh: No such file or directory test_test_ima:PASS:sk
[PATCH] ASoC: fsl: Fix config name of CONFIG_ARCH_MXC
CONFIG_ARCH_MXC should be ARCH_MXC Fixes: 674226db62ec ("ASoC: fsl: SND_SOC_FSL_AUD2HTX should depend on ARCH_MXC") Signed-off-by: Shengjiu Wang --- sound/soc/fsl/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 7d48f4f98e8b..835a14821360 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -107,7 +107,7 @@ config SND_SOC_FSL_XCVR config SND_SOC_FSL_AUD2HTX tristate "AUDIO TO HDMI TX module support" - depends on CONFIG_ARCH_MXC || COMPILE_TEST + depends on ARCH_MXC || COMPILE_TEST help Say Y if you want to add AUDIO TO HDMI TX support for NXP. -- 2.27.0
Re: [PATCH v4 2/3] fscrypt: Have filesystems handle their d_ops
> > This change has the side-effect of removing the capability of the root > directory from being case-insensitive. It is not a backward > incompatible change because there is no way to make the root directory > CI at the moment (it is never empty). But this restriction seems > artificial. Is there a real reason to prevent the root inode from being > case-insensitive? > I don't have a use case where I need a root directory to be CI. In > fact, when I first implemented CI, I did want to block the root directory > from being made CI, just to prevent people from doing "chattr +F /" and > complaining afterwards when /usr/lib breaks. > > My concern with the curent patch was whether this side-effect was > considered, but I'm happy with either semantics. > > -- > Gabriel Krisman Bertazi That's just from the lost+found directory right? If you remove it you can still change it, and then add the lost+found directory back. Isn't that how it works currently? I definitely didn't intend to change any behavior around non-encrypted casefolding there. I should look at what fsck does if you do that and have a LoSt+fOuNd folder... -Daniel Rosenberg
Re: [PATCH v2] char: tpm: add i2c driver for cr50
On Thu, 2020-11-26 at 05:30 +0200, Jarkko Sakkinen wrote: > On Tue, 2020-11-24 at 10:14 -0300, Ezequiel Garcia wrote: > > Hi Jarkko, > > > > Thanks for your review. > > > > On Tue, 2020-11-24 at 00:06 +0200, Jarkko Sakkinen wrote: > > > On Fri, Nov 20, 2020 at 07:23:45PM +0200, Adrian Ratiu wrote: > > > > From: "dlau...@chromium.org" > > > > > > > > Add TPM 2.0 compatible I2C interface for chips with cr50 > > > > firmware. > > > > > > > > The firmware running on the currently supported H1 MCU requires a > > > > special driver to handle its specific protocol, and this makes it > > > > unsuitable to use tpm_tis_core_* and instead it must implement > > > > the > > > > underlying TPM protocol similar to the other I2C TPM drivers. > > > > > > > > - All 4 byes of status register must be read/written at once. > > > > - FIFO and burst count is limited to 63 and must be drained by > > > > AP. > > > > - Provides an interrupt to indicate when read response data is > > > > ready > > > > and when the TPM is finished processing write data. > > > > > > > > This driver is based on the existing infineon I2C TPM driver, > > > > which > > > > most closely matches the cr50 i2c protocol behavior. > > > > > > > > Cc: Helen Koike > > > > Signed-off-by: Duncan Laurie > > > > [swb...@chromium.org: Depend on i2c even if it's a module, > > > > replace > > > > boilier plate with SPDX tag, drop asm/byteorder.h include, > > > > simplify > > > > return from probe] > > > > Signed-off-by: Stephen Boyd > > > > Signed-off-by: Fabien Lahoudere > > > > Signed-off-by: Adrian Ratiu > > > > --- > > > > Changes in v2: > > > > - Various small fixes all over (reorder includes, MAX_BUFSIZE, > > > > comments, etc) > > > > - Reworked return values of i2c_wait_tpm_ready() to fix timeout > > > > mis-handling > > > > so ret == 0 now means success, the wait period jiffies is ignored > > > > because that > > > > number is meaningless and return a proper timeout error in case > > > > jiffies == 0. > > > > - Make i2c default to 1 message per transfer (requested by > > > > Helen) > > > > - Move -EIO error reporting to transfer function to cleanup > > > > transfer() itself > > > > and its R/W callers > > > > - Remove magic value hardcodings and introduce enum > > > > force_release. > > > > > > > > v1 posted at https://lkml.org/lkml/2020/2/25/349 > > > > > > > > Applies on next-20201120, tested on Chromebook EVE. > > > > --- > > > > drivers/char/tpm/Kconfig| 10 + > > > > drivers/char/tpm/Makefile | 2 + > > > > drivers/char/tpm/tpm_tis_i2c_cr50.c | 768 > > > > > > > > 3 files changed, 780 insertions(+) > > > > create mode 100644 drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > > > > > diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig > > > > index a18c314da211..4308f9ca7a43 100644 > > > > --- a/drivers/char/tpm/Kconfig > > > > +++ b/drivers/char/tpm/Kconfig > > > > @@ -86,6 +86,16 @@ config TCG_TIS_SYNQUACER > > > > To compile this driver as a module, choose M here; > > > > the module will be called tpm_tis_synquacer. > > > > > > > > +config TCG_TIS_I2C_CR50 > > > > + tristate "TPM Interface Specification 2.0 Interface (I2C > > > > - CR50)" > > > > + depends on I2C > > > > + select TCG_CR50 > > > > + help > > > > + This is a driver for the Google cr50 I2C TPM interface > > > > which is a > > > > + custom microcontroller and requires a custom i2c > > > > protocol interface > > > > + to handle the limitations of the hardware. To compile > > > > this driver > > > > + as a module, choose M here; the module will be called > > > > tcg_tis_i2c_cr50. > > > > + > > > > config TCG_TIS_I2C_ATMEL > > > > tristate "TPM Interface Specification 1.2 Interface (I2C > > > > - Atmel)" > > > > depends on I2C > > > > diff --git a/drivers/char/tpm/Makefile > > > > b/drivers/char/tpm/Makefile > > > > index 84db4fb3a9c9..66d39ea6bd10 100644 > > > > --- a/drivers/char/tpm/Makefile > > > > +++ b/drivers/char/tpm/Makefile > > > > @@ -27,6 +27,8 @@ obj-$(CONFIG_TCG_TIS_SPI) += tpm_tis_spi.o > > > > tpm_tis_spi-y := tpm_tis_spi_main.o > > > > tpm_tis_spi-$(CONFIG_TCG_TIS_SPI_CR50) += tpm_tis_spi_cr50.o > > > > > > > > +obj-$(CONFIG_TCG_TIS_I2C_CR50) += tpm_tis_i2c_cr50.o > > > > + > > > > obj-$(CONFIG_TCG_TIS_I2C_ATMEL) += tpm_i2c_atmel.o > > > > obj-$(CONFIG_TCG_TIS_I2C_INFINEON) += tpm_i2c_infineon.o > > > > obj-$(CONFIG_TCG_TIS_I2C_NUVOTON) += tpm_i2c_nuvoton.o > > > > diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > b/drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > new file mode 100644 > > > > index ..37555dafdca0 > > > > --- /dev/null > > > > +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c > > > > @@ -0,0 +1,768 @@ > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > +/* > > > > + * Copyright 2016 Google Inc. > > > > + * > > > > + * Based on Linux Kernel TPM driver by > > > > + *
Re: [PATCH] drm/omap: dmm_tiler: fix return error code in omap_dmm_probe()
On 17/11/2020 15:41, Thomas Zimmermann wrote: > Hi > > Am 17.11.20 um 07:10 schrieb Yang Yingliang: >> Return -ENOMEM when allocating refill memory failed. >> >> Fixes: 71e8831f6407 ("drm/omap: DMM/TILER support for OMAP4+ platform") >> Reported-by: Hulk Robot >> Signed-off-by: Yang Yingliang >> --- >> drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> index 42ec51bb7b1b..7f4317248812 100644 >> --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c >> @@ -889,6 +889,7 @@ static int omap_dmm_probe(struct platform_device *dev) >> &omap_dmm->refill_pa, GFP_KERNEL); >> if (!omap_dmm->refill_va) { >> dev_err(&dev->dev, "could not allocate refill memory\n"); >> +ret = -ENOMEM; > > Reviewed-by: Thomas Zimmermann > > Thanks for the patch. I'll add it to drm-misc-next. There are more such > errors here. If the very first allocation fails, the function returns > -EFAULT, which makes no sense. Indeed. -EFAULT is quite an odd default value for ret... I'll drop the default and assign a real error value where needed. Tomi -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Re: [PATCH net-next v6 2/5] net/lapb: support netdev events
On 2020-11-26 01:08, Xie He wrote: Hi Martin, Since we are going to assume lapb->state would remain in LAPB_STATE_0 when the carrier is down (as understood by me. Right?), could we add a check in lapb_connect_request to reject the upper layer's "connect" instruction when the carrier is down? Like this: No, because this will break the considered "on demand" calling feature. diff --git a/include/linux/lapb.h b/include/linux/lapb.h index eb56472f23b2..7923b1c6fc6a 100644 --- a/include/linux/lapb.h +++ b/include/linux/lapb.h @@ -14,6 +14,7 @@ #defineLAPB_REFUSED5 #defineLAPB_TIMEDOUT 6 #defineLAPB_NOMEM 7 +#defineLAPB_NOCARRIER 8 #defineLAPB_STANDARD 0x00 #defineLAPB_EXTENDED 0x01 diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 3c03f6512c5f..c909d8db1bef 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -270,6 +270,10 @@ int lapb_connect_request(struct net_device *dev) if (!lapb) goto out; + rc = LAPB_NOCARRIER; + if (!netif_carrier_ok(dev)) + goto out_put; + rc = LAPB_OK; if (lapb->state == LAPB_STATE_1) goto out_put; Also, since we are going to assume the lapb->state would remain in LAPB_STATE_0 when the carrier is down, are the "lapb->state == LAPB_STATE_0" checks in carrier-up/device-up event handling necessary? If they are not necessary, it might be better to remove them because it may confuse people reading the code. They are still necessary, because if the link setup is initiated by upper layers, we've already entered the respective state by lapb_connect_request(). Every suggestion for improvement is really welcome, but please let this patch set pass now, if you don't find any more gross errors. Martin
Fair Pay Icon - The Space Lab.
I have chosen the Space Lab, as the Fair Pay Initiative OS Icon. See https://www.youtube.com/channel/UCR3gmLVjHS5A702wo4bol_Q Serenity! Ywe Cærlyn
Re: [RFC PATCH 5/9] cxl/mem: Find device capabilities
On 11/11/20 12:43 AM, Ben Widawsky wrote: + case CXL_CAPABILITIES_CAP_ID_SECONDARY_MAILBOX: + dev_dbg(&cxlm->pdev->dev, + "found UNSUPPORTED Secondary Mailbox capability\n"); Per spec, the secondary mailbox is intended for use by platform firmware, so Linux should never be using it anyway. Maybe that message is slightly misleading? Jon. P.S. Related - I've severe doubts about the mailbox approach being proposed by CXL and have begun to push back through the spec org. -- Computer Architect
Re: [PATCH net-next v6 2/5] net/lapb: support netdev events
On 2020-11-25 22:49, Jakub Kicinski wrote: On Tue, 24 Nov 2020 10:39:35 +0100 Martin Schiller wrote: This patch allows layer2 (LAPB) to react to netdev events itself and avoids the detour via layer3 (X.25). 1. Establish layer2 on NETDEV_UP events, if the carrier is already up. 2. Call lapb_disconnect_request() on NETDEV_GOING_DOWN events to signal the peer that the connection will go down. (Only when the carrier is up.) 3. When a NETDEV_DOWN event occur, clear all queues, enter state LAPB_STATE_0 and stop all timers. 4. The NETDEV_CHANGE event makes it possible to handle carrier loss and detection. In case of Carrier Loss, clear all queues, enter state LAPB_STATE_0 and stop all timers. In case of Carrier Detection, we start timer t1 on a DCE interface, and on a DTE interface we change to state LAPB_STATE_1 and start sending SABM(E). Signed-off-by: Martin Schiller +/* Handle device status changes. */ +static int lapb_device_event(struct notifier_block *this, unsigned long event, +void *ptr) +{ + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + struct lapb_cb *lapb; + + if (!net_eq(dev_net(dev), &init_net)) + return NOTIFY_DONE; + + if (dev->type == ARPHRD_X25) { Flip condition, save indentation. if (dev->type != ARPHRD_X25) return NOTIFY_DONE; You can also pull out of all the cases: lapb = lapb_devtostruct(dev); if (!lapb) return NOTIFY_DONE; right? + switch (event) { + case NETDEV_UP: + lapb_dbg(0, "(%p) Interface up: %s\n", dev, +dev->name); + + if (netif_carrier_ok(dev)) { + lapb = lapb_devtostruct(dev); + if (!lapb) + break; static int __init lapb_init(void) { + register_netdevice_notifier(&lapb_dev_notifier); This can fail, so: return register_netdevice_notifier(&lapb_dev_notifier); return 0; } static void __exit lapb_exit(void) { WARN_ON(!list_empty(&lapb_list)); + + unregister_netdevice_notifier(&lapb_dev_notifier); } MODULE_AUTHOR("Jonathan Naylor "); Thanks for your hints! I will send an update.
Re: Potential Issue in Tracing Ring Buffer
On Tue, Nov 24, 2020 at 10:39:17PM +, J. Avila wrote: > Hello, > > In the ftrace logs we've collected internally, we have found that there are > situations where time seems to go backwards; this breaks userspace tools which > expect time to always go forward in these logs. For example, in this snippet > from a db845c running a 5.10-rc4 kernel[1] (thanks for getting us the trace, > John!), we see: Does the patch at: https://lore.kernel.org/r/20201125225654.1618966-1-minc...@kernel.org resolve this issue for you? thanks, greg kh-
Re: [PATCH] tracing: Fix align of static buffer
On Wed, Nov 25, 2020 at 02:56:54PM -0800, Minchan Kim wrote: > With 5.9 kernel on ARM64, I found ftrace_dump output was broken but > it had no problem with normal output "cat /sys/kernel/debug/tracing/trace". > > With investigation, it seems coping the data into temporal buffer seems to > break the align binary printf expects if the static buffer is not aligned > with 4-byte. IIUC, get_arg in bstr_printf expects that args has already > right align to be decoded and seq_buf_bprintf says ``the arguments are saved > in a 32bit word array that is defined by the format string constraints``. > So if we don't keep the align under copy to temporal buffer, the output > will be broken by shifting some bytes. > > This patch fixes it. Does this resolve the issue reported at: https://lore.kernel.org/r/20201124223917.795844-1-elav...@google.com ? thanks, greg k-h
[PATCH v1 2/3] scsi: ufs: Refine error history functions
Nowadays UFS error history does not only have "history of errors" but also have history of some other events which are not defined as errors. This patch fixes the confused naming of related functions, and change the way for updating and printing history as preparation of next patch. This patch shall not change any functionality. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 118 +- drivers/scsi/ufs/ufshcd.h | 71 ++- 2 files changed, 97 insertions(+), 92 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 28e4def13f21..7194bed1f10b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -413,20 +413,25 @@ static void ufshcd_print_clk_freqs(struct ufs_hba *hba) } } -static void ufshcd_print_err_hist(struct ufs_hba *hba, - struct ufs_err_reg_hist *err_hist, - char *err_name) +static void ufshcd_print_evt(struct ufs_hba *hba, u32 id, +char *err_name) { int i; bool found = false; + struct ufs_event_hist *e; - for (i = 0; i < UFS_ERR_REG_HIST_LENGTH; i++) { - int p = (i + err_hist->pos) % UFS_ERR_REG_HIST_LENGTH; + if (id >= UFS_EVT_CNT) + return; + + e = &hba->ufs_stats.event[id]; - if (err_hist->tstamp[p] == 0) + for (i = 0; i < UFS_EVENT_HIST_LENGTH; i++) { + int p = (i + e->pos) % UFS_EVENT_HIST_LENGTH; + + if (e->tstamp[p] == 0) continue; dev_err(hba->dev, "%s[%d] = 0x%x at %lld us\n", err_name, p, - err_hist->reg[p], ktime_to_us(err_hist->tstamp[p])); + e->val[p], ktime_to_us(e->tstamp[p])); found = true; } @@ -434,26 +439,26 @@ static void ufshcd_print_err_hist(struct ufs_hba *hba, dev_err(hba->dev, "No record of %s\n", err_name); } -static void ufshcd_print_host_regs(struct ufs_hba *hba) +static void ufshcd_print_evt_hist(struct ufs_hba *hba) { ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); - ufshcd_print_err_hist(hba, &hba->ufs_stats.pa_err, "pa_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.dl_err, "dl_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.nl_err, "nl_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.tl_err, "tl_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.dme_err, "dme_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.auto_hibern8_err, - "auto_hibern8_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.fatal_err, "fatal_err"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.link_startup_err, - "link_startup_fail"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.resume_err, "resume_fail"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.suspend_err, - "suspend_fail"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.dev_reset, "dev_reset"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.host_reset, "host_reset"); - ufshcd_print_err_hist(hba, &hba->ufs_stats.task_abort, "task_abort"); + ufshcd_print_evt(hba, UFS_EVT_PA_ERR, "pa_err"); + ufshcd_print_evt(hba, UFS_EVT_DL_ERR, "dl_err"); + ufshcd_print_evt(hba, UFS_EVT_NL_ERR, "nl_err"); + ufshcd_print_evt(hba, UFS_EVT_TL_ERR, "tl_err"); + ufshcd_print_evt(hba, UFS_EVT_DME_ERR, "dme_err"); + ufshcd_print_evt(hba, UFS_EVT_AUTO_HIBERN8_ERR, +"auto_hibern8_err"); + ufshcd_print_evt(hba, UFS_EVT_FATAL_ERR, "fatal_err"); + ufshcd_print_evt(hba, UFS_EVT_LINK_STARTUP_FAIL, +"link_startup_fail"); + ufshcd_print_evt(hba, UFS_EVT_RESUME_ERR, "resume_fail"); + ufshcd_print_evt(hba, UFS_EVT_SUSPEND_ERR, +"suspend_fail"); + ufshcd_print_evt(hba, UFS_EVT_DEV_RESET, "dev_reset"); + ufshcd_print_evt(hba, UFS_EVT_HOST_RESET, "host_reset"); + ufshcd_print_evt(hba, UFS_EVT_ABORT, "task_abort"); ufshcd_vops_dbg_register_dump(hba); } @@ -3856,7 +3861,7 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) if (ret) { ufshcd_print_host_state(hba); ufshcd_print_pwr_info(hba); - ufshcd_print_host_regs(hba); + ufshcd_print_evt_hist(hba); } spin_lock_irqsave(hba->host->host_lock, flags); @@ -4468,14 +4473,19 @@ static inline int ufshcd_disable_device_tx_lcc(struct ufs_hba *hba) return ufshcd_disable_tx_lcc(hba, true); } -void ufshcd_update_reg_hist(struct ufs_err_reg_hist *reg_hist, - u32 reg) +void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val) { - reg_hist->reg[reg_hist->pos] = r
[PATCH v1 0/3] Refine error history and introduce notify_event vop
Hi, This series refines error history functions and introduce a new notify_event vop to allow vendor to get notified of important events. Stanley Chu (3): scsi: ufs: Add error history for abort event in UFS Device W-LUN scsi: ufs: Refine error history functions scsi: ufs: Introduce notify_event variant function drivers/scsi/ufs/ufshcd.c | 122 ++ drivers/scsi/ufs/ufshcd.h | 82 - 2 files changed, 112 insertions(+), 92 deletions(-) -- 2.18.0
[PATCH v1 3/3] scsi: ufs: Introduce notify_event variant function
Introduce notify_event variant function to allow vendor to get notified of important events and connect to any proprietary debugging facilities. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7194bed1f10b..63fe37e1c908 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4484,6 +4484,8 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val) e->val[e->pos] = val; e->tstamp[e->pos] = ktime_get(); e->pos = (e->pos + 1) % UFS_EVENT_HIST_LENGTH; + + ufshcd_vops_notify_event(hba, id, &val); } EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 82c2fc5597bb..a81ca36c1715 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -317,6 +317,7 @@ struct ufs_pwr_mode_info { * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device * @program_key: program or evict an inline encryption key + * @notify_event: called to notify important events */ struct ufs_hba_variant_ops { const char *name; @@ -352,6 +353,8 @@ struct ufs_hba_variant_ops { void *data); int (*program_key)(struct ufs_hba *hba, const union ufs_crypto_cfg_entry *cfg, int slot); + void(*notify_event)(struct ufs_hba *hba, + enum ufs_event_type evt, void *data); }; /* clock gating state */ @@ -1097,6 +1100,14 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline void ufshcd_vops_notify_event(struct ufs_hba *hba, + enum ufs_event_type evt, + void *data) +{ + if (hba->vops && hba->vops->notify_event) + hba->vops->notify_event(hba, evt, data); +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, enum ufs_notify_change_status status) { -- 2.18.0
Re: [PATCH -tip 18/32] kernel/entry: Add support for core-wide protection of kernel-mode
On Tue, Nov 17, 2020 at 06:19:48PM -0500, Joel Fernandes (Google) wrote: > Core-scheduling prevents hyperthreads in usermode from attacking each > other, but it does not do anything about one of the hyperthreads > entering the kernel for any reason. This leaves the door open for MDS > and L1TF attacks with concurrent execution sequences between > hyperthreads. > > This patch therefore adds support for protecting all syscall and IRQ > kernel mode entries. Care is taken to track the outermost usermode exit > and entry using per-cpu counters. In cases where one of the hyperthreads > enter the kernel, no additional IPIs are sent. Further, IPIs are avoided > when not needed - example: idle and non-cookie HTs do not need to be > forced into kernel mode. > > More information about attacks: > For MDS, it is possible for syscalls, IRQ and softirq handlers to leak > data to either host or guest attackers. For L1TF, it is possible to leak > to guest attackers. There is no possible mitigation involving flushing > of buffers to avoid this since the execution of attacker and victims > happen concurrently on 2 or more HTs. > > Reviewed-by: Alexandre Chartre > Tested-by: Julien Desfossez > Cc: Julien Desfossez > Cc: Tim Chen > Cc: Aaron Lu > Cc: Aubrey Li > Cc: Tim Chen > Cc: Paul E. McKenney > Co-developed-by: Vineeth Pillai > Signed-off-by: Vineeth Pillai > Signed-off-by: Joel Fernandes (Google) > --- > .../admin-guide/kernel-parameters.txt | 11 + > include/linux/entry-common.h | 12 +- > include/linux/sched.h | 12 + > kernel/entry/common.c | 28 +- > kernel/sched/core.c | 241 ++ > kernel/sched/sched.h | 3 + > 6 files changed, 304 insertions(+), 3 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt > b/Documentation/admin-guide/kernel-parameters.txt > index bd1a5b87a5e2..b185c6ed4aba 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -4678,6 +4678,17 @@ > > sbni= [NET] Granch SBNI12 leased line adapter > > + sched_core_protect_kernel= > + [SCHED_CORE] Pause SMT siblings of a core running in > + user mode, if at least one of the siblings of the core > + is running in kernel mode. This is to guarantee that > + kernel data is not leaked to tasks which are not trusted > + by the kernel. A value of 0 disables protection, 1 > + enables protection. The default is 1. Note that > protection > + depends on the arch defining the _TIF_UNSAFE_RET flag. > + Further, for protecting VMEXIT, arch needs to call > + KVM entry/exit hooks. > + > sched_debug [KNL] Enables verbose scheduler debug messages. > > schedstats= [KNL,X86] Enable or disable scheduled statistics. > diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h > index 1a128baf3628..022e1f114157 100644 > --- a/include/linux/entry-common.h > +++ b/include/linux/entry-common.h > @@ -33,6 +33,10 @@ > # define _TIF_PATCH_PENDING (0) > #endif > > +#ifndef _TIF_UNSAFE_RET > +# define _TIF_UNSAFE_RET (0) > +#endif > + > #ifndef _TIF_UPROBE > # define _TIF_UPROBE (0) > #endif > @@ -74,7 +78,7 @@ > #define EXIT_TO_USER_MODE_WORK > \ > (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ >_TIF_NEED_RESCHED | _TIF_PATCH_PENDING | _TIF_NOTIFY_SIGNAL | \ > - ARCH_EXIT_TO_USER_MODE_WORK) > + _TIF_UNSAFE_RET | ARCH_EXIT_TO_USER_MODE_WORK) > > /** > * arch_check_user_regs - Architecture specific sanity check for user mode > regs > @@ -444,4 +448,10 @@ irqentry_state_t noinstr irqentry_nmi_enter(struct > pt_regs *regs); > */ > void noinstr irqentry_nmi_exit(struct pt_regs *regs, irqentry_state_t > irq_state); > > +/* entry_kernel_protected - Is kernel protection on entry/exit into kernel > supported? */ > +static inline bool entry_kernel_protected(void) > +{ > + return IS_ENABLED(CONFIG_SCHED_CORE) && sched_core_kernel_protected() > + && _TIF_UNSAFE_RET != 0; > +} > #endif > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 7efce9c9d9cf..a60868165590 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -2076,4 +2076,16 @@ int sched_trace_rq_nr_running(struct rq *rq); > > const struct cpumask *sched_trace_rd_span(struct root_domain *rd); > > +#ifdef CONFIG_SCHED_CORE > +void sched_core_unsafe_enter(void); > +void sched_core_unsafe_exit(void); > +bool sched_core_wait_till_safe(unsigned long ti_check); > +bool sched_core_kernel_protected(void); > +#else > +#define sched_core_unsafe_enter(ignore) d
[PATCH v1 1/3] scsi: ufs: Add error history for abort event in UFS Device W-LUN
Add error history for abort event in UFS Device W-LUN. Besides, use specified value as parameter of ufshcd_update_reg_hist() to identify the aborted tag or LUNs. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 0e5473d4699b..28e4def13f21 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6742,8 +6742,10 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) * To avoid these unnecessary/illegal step we skip to the last error * handling stage: reset and restore. */ - if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN) + if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN) { + ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, lrbp->lun); return ufshcd_eh_host_reset_handler(cmd); + } ufshcd_hold(hba, false); reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); @@ -6767,7 +6769,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) */ scsi_print_command(hba->lrb[tag].cmd); if (!hba->req_abort_count) { - ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, 0); + ufshcd_update_reg_hist(&hba->ufs_stats.task_abort, tag); ufshcd_print_host_regs(hba); ufshcd_print_host_state(hba); ufshcd_print_pwr_info(hba); -- 2.18.0
[PATCH -V6 1/3] numa balancing: Migrate on fault among multiple bound nodes
Now, NUMA balancing can only optimize the page placement among the NUMA nodes if the default memory policy is used. Because the memory policy specified explicitly should take precedence. But this seems too strict in some situations. For example, on a system with 4 NUMA nodes, if the memory of an application is bound to the node 0 and 1, NUMA balancing can potentially migrate the pages between the node 0 and 1 to reduce cross-node accessing without breaking the explicit memory binding policy. So in this patch, we add MPOL_F_NUMA_BALANCING mode flag to set_mempolicy(). With the flag specified, NUMA balancing will be enabled within the thread to optimize the page placement within the constrains of the specified memory binding policy. With the newly added flag, the NUMA balancing control mechanism becomes, - sysctl knob numa_balancing can enable/disable the NUMA balancing globally. - even if sysctl numa_balancing is enabled, the NUMA balancing will be disabled for the memory areas or applications with the explicit memory policy by default. - MPOL_F_NUMA_BALANCING can be used to enable the NUMA balancing for the applications when specifying the explicit memory policy. Various page placement optimization based on the NUMA balancing can be done with these flags. As the first step, in this patch, if the memory of the application is bound to multiple nodes (MPOL_BIND), and in the hint page fault handler the accessing node are in the policy nodemask, the page will be tried to be migrated to the accessing node to reduce the cross-node accessing. If the newly added MPOL_F_NUMA_BALANCING flag is specified by an application on an old kernel version without its support, set_mempolicy() will return -1 and errno will be set to EINVAL. The application can use this behavior to run on both old and new kernel versions. In the previous version of the patch, we tried to reuse MPOL_MF_LAZY for mbind(). But that flag is tied to MPOL_MF_MOVE.*, so it seems not a good API/ABI for the purpose of the patch. And because it's not clear whether it's necessary to enable NUMA balancing for a specific memory area inside an application, so we only add the flag at the thread level (set_mempolicy()) instead of the memory area level (mbind()). We can do that when it become necessary. To test the patch, we run a test case as follows on a 4-node machine with 192 GB memory (48 GB per node). 1. Change pmbench memory accessing benchmark to call set_mempolicy() to bind its memory to node 1 and 3 and enable NUMA balancing. Some related code snippets are as follows, #include #include struct bitmask *bmp; int ret; bmp = numa_parse_nodestring("1,3"); ret = set_mempolicy(MPOL_BIND | MPOL_F_NUMA_BALANCING, bmp->maskp, bmp->size + 1); /* If MPOL_F_NUMA_BALANCING isn't supported, fall back to MPOL_BIND */ if (ret < 0 && errno == EINVAL) ret = set_mempolicy(MPOL_BIND, bmp->maskp, bmp->size + 1); if (ret < 0) { perror("Failed to call set_mempolicy"); exit(-1); } 2. Run a memory eater on node 3 to use 40 GB memory before running pmbench. 3. Run pmbench with 64 processes, the working-set size of each process is 640 MB, so the total working-set size is 64 * 640 MB = 40 GB. The CPU and the memory (as in step 1.) of all pmbench processes is bound to node 1 and 3. So, after CPU usage is balanced, some pmbench processes run on the CPUs of the node 3 will access the memory of the node 1. 4. After the pmbench processes run for 100 seconds, kill the memory eater. Now it's possible for some pmbench processes to migrate their pages from node 1 to node 3 to reduce cross-node accessing. Test results show that, with the patch, the pages can be migrated from node 1 to node 3 after killing the memory eater, and the pmbench score can increase about 17.5%. Signed-off-by: "Huang, Ying" Cc: Andrew Morton Cc: Ingo Molnar Cc: Mel Gorman Cc: Rik van Riel Cc: Johannes Weiner Cc: "Matthew Wilcox (Oracle)" Cc: Dave Hansen Cc: Andi Kleen Cc: Michal Hocko Cc: David Rientjes Cc: linux-...@vger.kernel.org --- include/uapi/linux/mempolicy.h | 4 +++- mm/mempolicy.c | 9 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h index 3354774af61e..8948467b3992 100644 --- a/include/uapi/linux/mempolicy.h +++ b/include/uapi/linux/mempolicy.h @@ -28,12 +28,14 @@ enum { /* Flags for set_mempolicy */ #define MPOL_F_STATIC_NODES(1 << 15) #define MPOL_F_RELATIVE_NODES (1 << 14) +#define MPOL_F_NUMA_BALANCING (1 << 13) /* Optimize with NUMA balancing if possible */ /* * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to * either set_mempolicy() or mbind(). */ -#define MPOL_MODE_FLAGS(MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES) +#de
Re: [PATCH] regmap: sdw: add required header files
On Wed, Nov 25, 2020 at 09:01:28PM +0800, Bard Liao wrote: > From: Pierre-Louis Bossart > > Explicitly add header files used by regmap SoundWire support. What is failing to build without this? thanks, greg k-h
[PATCH -V6 0/3] autonuma: Migrate on fault among multiple bound nodes
To make it possible to optimize cross-socket memory accessing with AutoNUMA even if the memory of the application is bound to multiple NUMA nodes. Patch [2/3] and [3/3] are NOT kernel patches. Instead, they are patches for man-pages and numactl respectively. They are sent together to make it easy to review the newly added kernel API. Changes: v6: - Rebased on latest upstream kernel 5.10-rc5 - Added some benchmark data and example in patch description of [1/3] - Rename AutoNUMA to NUMA Balancing - Add patches to man-pages [2/3] and numactl [3/3] v5: - Remove mbind() support, because it's not clear that it's necessary. v4: - Use new flags instead of reuse MPOL_MF_LAZY. v3: - Rebased on latest upstream (v5.10-rc3) - Revised the change log. v2: - Rebased on latest upstream (v5.10-rc1) Best Regards, Huang, Ying
[PATCH -V6 3/3] NOT kernel/numactl: Support to enable Linux kernel NUMA balancing
From: Huang Ying A new API: numa_set_membind_balancing() is added to libnuma. It is same as numa_set_membind() except that the Linux kernel NUMA balancing will be enabled for the task if the feature is supported by the kernel. At the same time, a new option: --balancing (-b) is added to numactl. Which can be used before the memory policy options in the command line. With it, the Linux kernel NUMA balancing will be enabled for the process if the feature is supported by the kernel. Signed-off-by: "Huang, Ying" --- libnuma.c | 14 ++ numa.3| 15 +++ numa.h| 4 numactl.8 | 9 + numactl.c | 17 ++--- numaif.h | 3 +++ versions.ldscript | 8 7 files changed, 67 insertions(+), 3 deletions(-) diff --git a/libnuma.c b/libnuma.c index 88f479b..f073c50 100644 --- a/libnuma.c +++ b/libnuma.c @@ -1064,6 +1064,20 @@ numa_set_membind_v2(struct bitmask *bmp) make_internal_alias(numa_set_membind_v2); +void +numa_set_membind_balancing(struct bitmask *bmp) +{ + /* MPOL_F_NUMA_BALANCING: ignore if unsupported */ + if (set_mempolicy(MPOL_BIND | MPOL_F_NUMA_BALANCING, + bmp->maskp, bmp->size + 1) < 0) { + if (errno == EINVAL) { + errno = 0; + numa_set_membind_v2(bmp); + } else + numa_error("set_mempolicy"); + } +} + /* * copy a bitmask map body to a numa.h nodemask_t structure */ diff --git a/numa.3 b/numa.3 index 3e18098..c44ee50 100644 --- a/numa.3 +++ b/numa.3 @@ -80,6 +80,8 @@ numa \- NUMA policy library .br .BI "void numa_set_membind(struct bitmask *" nodemask ); .br +.BI "void numa_set_membind_balancing(struct bitmask *" nodemask ); +.br .B struct bitmask *numa_get_membind(void); .sp .BI "void *numa_alloc_onnode(size_t " size ", int " node ); @@ -538,6 +540,19 @@ that contains nodes other than those in the mask returned by .IR numa_get_mems_allowed () will result in an error. +.BR numa_set_membind_balancing () +sets the memory allocation mask and enable the Linux kernel NUMA +balancing for the task if the feature is supported by the kernel. The +task will only allocate memory from the nodes set in +.IR nodemask . +Passing an empty +.I nodemask +or a +.I nodemask +that contains nodes other than those in the mask returned by +.IR numa_get_mems_allowed () +will result in an error. + .BR numa_get_membind () returns the mask of nodes from which memory can currently be allocated. If the returned mask is equal to diff --git a/numa.h b/numa.h index bd1d676..5d8543a 100644 --- a/numa.h +++ b/numa.h @@ -192,6 +192,10 @@ void numa_set_localalloc(void); /* Only allocate memory from the nodes set in mask. 0 to turn off */ void numa_set_membind(struct bitmask *nodemask); +/* Only allocate memory from the nodes set in mask. Optimize page + placement with Linux kernel NUMA balancing if possible. 0 to turn off */ +void numa_set_membind_balancing(struct bitmask *bmp); + /* Return current membind */ struct bitmask *numa_get_membind(void); diff --git a/numactl.8 b/numactl.8 index f3bb22b..109dd8f 100644 --- a/numactl.8 +++ b/numactl.8 @@ -25,6 +25,8 @@ numactl \- Control NUMA policy for processes or shared memory [ .B \-\-all ] [ +.B \-\-balancing +] [ .B \-\-interleave nodes ] [ .B \-\-preferred node @@ -168,6 +170,9 @@ but if memory cannot be allocated there fall back to other nodes. This option takes only a single node number. Relative notation may be used. .TP +.B \-\-balancing, \-b +Enable Linux kernel NUMA balancing for the process if it is supported by kernel. +.TP .B \-\-show, \-s Show NUMA policy settings of the current process. .TP @@ -278,6 +283,10 @@ numactl \-\-cpunodebind=0 \-\-membind=0,1 -- process -l Run process as above, but with an option (-l) that would be confused with a numactl option. +numactl \-\-cpunodebind=0 \-\-balancing \-\-membind=0,1 process +Run process on node 0 with memory allocated on node 0 and 1. Optimize the +page placement with Linux kernel NUMA balancing mechanism if possible. + numactl \-\-cpunodebind=netdev:eth0 \-\-membind=netdev:eth0 network-server Run network-server on the node of network device eth0 with its memory also in the same node. diff --git a/numactl.c b/numactl.c index df9dbcb..5a9d2df 100644 --- a/numactl.c +++ b/numactl.c @@ -45,6 +45,7 @@ struct option opts[] = { {"membind", 1, 0, 'm'}, {"show", 0, 0, 's' }, {"localalloc", 0,0, 'l'}, + {"balancing", 0, 0, 'b'}, {"hardware", 0,0,'H' }, {"shm", 1, 0, 'S'}, @@ -65,9 +66,10 @@ struct option opts[] = { void usage(void) { fprintf(stderr, - "usage: numactl [--all | -a] [--interleave= | -i ] [--preferred= | -p ]\n" - " [--physcpubind= | -C ] [--cpunodebind= | -N ]\n" - " [--membind= | -m ] [--locala
[PATCH -v6 2/3] NOT kernel/man-pages man2/set_mempolicy.2: Add mode flag MPOL_F_NUMA_BALANCING
From: Huang Ying Signed-off-by: "Huang, Ying" --- man2/set_mempolicy.2 | 8 1 file changed, 8 insertions(+) diff --git a/man2/set_mempolicy.2 b/man2/set_mempolicy.2 index 68011eecb..fb16bb351 100644 --- a/man2/set_mempolicy.2 +++ b/man2/set_mempolicy.2 @@ -113,6 +113,11 @@ A nonempty .I nodemask specifies node IDs that are relative to the set of node IDs allowed by the process's current cpuset. +.TP +.BR MPOL_F_NUMA_BALANCING " (since Linux 5.11)" +Enable the Linux kernel NUMA balancing for the task if it is supported +by kernel. If the flag isn't supported by Linux kernel, return -1 and +errno is set to EINVAL. .PP .I nodemask points to a bit mask of node IDs that contains up to @@ -293,6 +298,9 @@ argument specified both .B MPOL_F_STATIC_NODES and .BR MPOL_F_RELATIVE_NODES . +Or, the +.B MPOL_F_NUMA_BALANCING +isn't supported by the Linux kernel. .TP .B ENOMEM Insufficient kernel memory was available. -- 2.29.2
[PATCHv2] arm64: dts: qcom: sm8150: Add Coresight support
Add coresight components found on Qualcomm Technologies, Inc. SM8150 SoC. Signed-off-by: Sai Prakash Ranjan Reviewed-by: Mathieu Poirier --- Changes in v2: * Rebase on top of qcom for-next branch * Add reviewed-by tag collected from previous version --- arch/arm64/boot/dts/qcom/sm8150.dtsi | 591 +++ 1 file changed, 591 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi index 8dac11c6012e..5270bda7418f 100644 --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi @@ -798,6 +798,597 @@ glink-edge { }; }; + stm@6002000 { + compatible = "arm,coresight-stm", "arm,primecell"; + reg = <0 0x06002000 0 0x1000>, + <0 0x1628 0 0x18>; + reg-names = "stm-base", "stm-stimulus-base"; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; + + out-ports { + port { + stm_out: endpoint { + remote-endpoint = <&funnel0_in7>; + }; + }; + }; + }; + + funnel@6041000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0 0x06041000 0 0x1000>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; + + out-ports { + port { + funnel0_out: endpoint { + remote-endpoint = <&merge_funnel_in0>; + }; + }; + }; + + in-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@7 { + reg = <7>; + funnel0_in7: endpoint { + remote-endpoint = <&stm_out>; + }; + }; + }; + }; + + funnel@6042000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0 0x06042000 0 0x1000>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; + + out-ports { + port { + funnel1_out: endpoint { + remote-endpoint = <&merge_funnel_in1>; + }; + }; + }; + + in-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@4 { + reg = <4>; + funnel1_in4: endpoint { + remote-endpoint = <&swao_replicator_out>; + }; + }; + }; + }; + + funnel@6043000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0 0x06043000 0 0x1000>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; + + out-ports { + port { + funnel2_out: endpoint { + remote-endpoint = <&merge_funnel_in2>; + }; + }; + }; + + in-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@2 { + reg = <2>; + funnel2_in2: endpoint { + remote-endpoint = <&apss_merge_funnel_out>; + }; + }; + }; + }; + + funnel@6045000 { + compatible = "arm,coresight-dynamic-funnel", "arm,primecell"; + reg = <0 0x06045000 0 0x1000>; + + clocks = <&aoss_qmp>; +
linux-next: manual merge of the userns tree with the bpf-next tree
Hi all, Today's linux-next merge of the userns tree got a conflict in: kernel/bpf/task_iter.c between commit: 91b2db27d3ff ("bpf: Simplify task_file_seq_get_next()") from the bpf-next tree and commit: edc52f17257a ("bpf/task_iter: In task_file_seq_get_next use task_lookup_next_fd_rcu") from the userns tree. I fixed it up (I think, see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. -- Cheers, Stephen Rothwell diff --cc kernel/bpf/task_iter.c index 0458a40edf10,4ec63170c741.. --- a/kernel/bpf/task_iter.c +++ b/kernel/bpf/task_iter.c @@@ -136,41 -135,29 +135,30 @@@ struct bpf_iter_seq_task_file_info }; static struct file * -task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info, - struct task_struct **task) +task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info) { struct pid_namespace *ns = info->common.ns; - u32 curr_tid = info->tid, max_fds; - struct files_struct *curr_files; + u32 curr_tid = info->tid; struct task_struct *curr_task; - int curr_fd = info->fd; + unsigned int curr_fd = info->fd; /* If this function returns a non-NULL file object, -* it held a reference to the task/files_struct/file. +* it held a reference to the task/file. * Otherwise, it does not hold any reference. */ again: - if (*task) { - curr_task = *task; + if (info->task) { + curr_task = info->task; - curr_files = info->files; curr_fd = info->fd; } else { curr_task = task_seq_get_next(ns, &curr_tid, true); - if (!curr_task) + if (!curr_task) { + info->task = NULL; - info->files = NULL; return NULL; + } - curr_files = get_files_struct(curr_task); - if (!curr_files) { - put_task_struct(curr_task); - curr_tid = ++(info->tid); - info->fd = 0; - goto again; - } - - info->files = curr_files; + /* set *task and info->tid */ - *task = curr_task; + info->task = curr_task; if (curr_tid == info->tid) { curr_fd = info->fd; } else { @@@ -198,10 -183,8 +184,8 @@@ /* the current task is done, go to the next task */ rcu_read_unlock(); - put_files_struct(curr_files); put_task_struct(curr_task); - *task = NULL; + info->task = NULL; - info->files = NULL; info->fd = 0; curr_tid = ++(info->tid); goto again; @@@ -210,13 -193,18 +194,12 @@@ static void *task_file_seq_start(struct seq_file *seq, loff_t *pos) { struct bpf_iter_seq_task_file_info *info = seq->private; - struct task_struct *task = NULL; struct file *file; - file = task_file_seq_get_next(info, &task); - if (!file) { - info->task = NULL; - return NULL; - } - - if (*pos == 0) + info->task = NULL; - info->files = NULL; + file = task_file_seq_get_next(info); + if (file && *pos == 0) ++*pos; - info->task = task; return file; } pgpPkCWqP6uI2.pgp Description: OpenPGP digital signature
Re: [f2fs-dev] [PATCH 2/2] f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE
Eric, do_page_cache_ra() is defined in mm/internal.h for internal use between in mm, so we cannot use this one right now. So, I think we could use page_cache_ra_unbounded(), because we already check i_size boundary on our own. What do you think? 2020년 11월 24일 (화) 오후 12:05, Chao Yu 님이 작성: > > On 2020/11/23 11:17, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Added two ioctl to decompress/compress explicitly the compression > > enabled file in "compress_mode=user-based" mount option. > > > > Using these two ioctls, the users can make a control of compression > > and decompression of their files. > > > > Signed-off-by: Daeho Jeong > > --- > > fs/f2fs/file.c| 181 +- > > include/uapi/linux/f2fs.h | 2 + > > 2 files changed, 182 insertions(+), 1 deletion(-) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index be8db06aca27..e8f142470e87 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -4026,6 +4026,180 @@ static int f2fs_ioc_set_compress_option(struct file > > *filp, unsigned long arg) > > return ret; > > } > > > > +static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) > > +{ > > + DEFINE_READAHEAD(ractl, NULL, inode->i_mapping, page_idx); > > + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > > + struct address_space *mapping = inode->i_mapping; > > + struct page *page; > > + pgoff_t redirty_idx = page_idx; > > + int i, page_len = 0, ret = 0; > > + > > + page_cache_ra_unbounded(&ractl, len, 0); > > + > > + for (i = 0; i < len; i++, page_idx++) { > > + page = read_cache_page(mapping, page_idx, NULL, NULL); > > + if (IS_ERR(page)) { > > + ret = PTR_ERR(page); > > + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " > > + "couldn't be read (errno:%d).\n", > > + __func__, inode->i_ino, page_idx, ret); > > This is a common error case during calling read_cache_page(), IMO, this looks > more like a debug log, so I prefer to print nothing here, or at least using > f2fs_debug() instead. > > > + break; > > + } > > + page_len++; > > + } > > + > > + for (i = 0; i < page_len; i++, redirty_idx++) { > > + page = find_lock_page(mapping, redirty_idx); > > + if (!page) { > > + ret = -ENOENT; > > + f2fs_warn(sbi, "%s: inode (%lu) : page_index (%lu) " > > + "couldn't be found (errno:%d).\n", > > + __func__, inode->i_ino, redirty_idx, ret); > > Ditto. > > > + } > > + set_page_dirty(page); > > + f2fs_put_page(page, 1); > > + f2fs_put_page(page, 0); > > + } > > + > > + return ret; > > +} > > + > > +static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) > > +{ > > + struct inode *inode = file_inode(filp); > > + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); > > + struct f2fs_inode_info *fi = F2FS_I(inode); > > + pgoff_t page_idx = 0, last_idx; > > + int cluster_size = F2FS_I(inode)->i_cluster_size; > > + int count, ret; > > + > > + if (!f2fs_sb_has_compression(sbi)) > > + return -EOPNOTSUPP; > > + > > + if (!(filp->f_mode & FMODE_WRITE)) > > + return -EBADF; > > + > > + if (!f2fs_compressed_file(inode)) > > + return -EINVAL; > > Before compressubg/decompressing file, should we check whether current inode's > compress algorithm backend is available in f2fs module? > > > + > > + f2fs_balance_fs(F2FS_I_SB(inode), true); > > + > > + file_start_write(filp); > > + inode_lock(inode); > > + > > + if (f2fs_is_mmap_file(inode)) { > > + ret = -EBUSY; > > + goto out; > > + } > > + > > + ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); > > + if (ret) > > + goto out; > > + > > + if (!atomic_read(&fi->i_compr_blocks)) > > + goto out; > > + > > + last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); > > + > > + count = last_idx - page_idx; > > + while (count) { > > + int len = min(cluster_size, count); > > + > > + ret = redirty_blocks(inode, page_idx, len); > > + > > unneeded blank line.. > > > + if (ret < 0) > > + break; > > + > > + page_idx += len; > > + count -= len; > > Considering there isn't so many memory in low-end device, how about calling > filemap_fdatawrite() to writeback cluster after redirty several clusters > or xxMB? > > > + } > > + > > + if (!ret) > > + ret = filemap_write_and_wait_range(inode->i_mapping, 0, > > + LLONG_MAX); > > + > > + if (!ret) { > > + stat_sub_compr_blocks(inode,
[PATCH] arm64: dts: meson: add KHAMSIN IR remote node to SML5442TW
Set the IR keymap to the KHAMSIN remote shipped with the SML5442TW. Signed-off-by: Christian Hewitt --- The rc-khamsin keymap is queued (or in the process of being picked) via the media tree [0] so it would be nice to add this within the 5.11 cycle. [0] https://patchwork.linuxtv.org/project/linux-media/patch/20201125161413.ga...@gofer.mess.org/ arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts index 0b95e9ecbef0..ad6d72254150 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905d-sml5442tw.dts @@ -63,6 +63,10 @@ pinctrl-names = "default"; }; +&ir { +linux,rc-map-name = "rc-khamsin"; +}; + /* This is connected to the Bluetooth module: */ &uart_A { status = "okay"; -- 2.17.1
Re: [PATCH] [v7] wireless: Initial driver submission for pureLiFi STA devices
> I haven't had a chance to review this yet but we have some documentation for > new drivers: > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#new_driver > Is the firmware publically available? Thanks Kalle, We will make the firmware available in our website for public access and share the details. Regards Srini
RE: [EXT] Re: [PATCH v1 1/2] mmc: Support kmsg dumper based on pstore/blk
Sure, I will tune to those discussions and would wait for that. - Bhaskara >-Original Message- >From: Christoph Hellwig >Sent: Tuesday, November 24, 2020 9:49 PM >To: Ulf Hansson >Cc: Bhaskara Budiredla ; Kees Cook >; Colin Cross ; Tony Luck >; Sunil Kovvuri Goutham ; >linux-...@vger.kernel.org; Linux Kernel Mailing List ker...@vger.kernel.org>; Christoph Hellwig >Subject: Re: [EXT] Re: [PATCH v1 1/2] mmc: Support kmsg dumper based on >pstore/blk > >On Tue, Nov 24, 2020 at 03:40:21PM +0100, Ulf Hansson wrote: >> It looks like Christoph is planning for some rewrite of the pstore >> code, so let's see what that means in regards to this. > >Here is what I posted last month: > >https://urldefense.proofpoint.com/v2/url?u=http- >3A__git.infradead.org_users_hch_misc.git_shortlog_refs_heads_pstore&d= >DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=9P_lSljSO7KnQNkCGsgu9x_Op4ms >tSdqWN3Olr4bUv0&m=q8IjbcWL5TERE5I_titSsMtZA2l6QrRmBgu0lc8wpko&s= >T6P9lsMAsulOHqb4szJ553K0z2eYB5Tliq7UqFMth-g&e= > >Kees wanted to chime in with a few thing he'd like to see done differently, >but I've not seen the actual comments yet. > >In respect to the eMMC support what I've done should mostly just work, it >would have to adopt to the slightly different registration interface and just >call >register_pstore_device() with its own ops.
Re: [PATCH next] mm/swap.c: reduce lock contention in lru_cache_add
On Fri, Nov 20, 2020 at 04:27:27PM +0800, Alex Shi wrote: > The current relock logical will change lru_lock when found a new > lruvec, so if 2 memcgs are reading file or alloc page at same time, > they could hold the lru_lock alternately, and wait for each other for > fairness attribute of ticket spin lock. > > This patch will sort that all lru_locks and only hold them once in > above scenario. That could reduce fairness waiting for lock reget. > Than, vm-scalability/case-lru-file-readtwice could get ~5% performance > gain on my 2P*20core*HT machine. > > Suggested-by: Konstantin Khlebnikov > Signed-off-by: Alex Shi > Cc: Konstantin Khlebnikov > Cc: Andrew Morton > Cc: Hugh Dickins > Cc: Yu Zhao > Cc: Michal Hocko > Cc: linux...@kvack.org > Cc: linux-kernel@vger.kernel.org > --- > mm/swap.c | 57 +++ > 1 file changed, 49 insertions(+), 8 deletions(-) > > diff --git a/mm/swap.c b/mm/swap.c > index 490553f3f9ef..c787b38bf9c0 100644 > --- a/mm/swap.c > +++ b/mm/swap.c > @@ -1009,24 +1009,65 @@ static void __pagevec_lru_add_fn(struct page *page, > struct lruvec *lruvec) > trace_mm_lru_insertion(page, lru); > } > > +struct lruvecs { > + struct list_head lists[PAGEVEC_SIZE]; > + struct lruvec *vecs[PAGEVEC_SIZE]; > +}; > + > +/* Sort pvec pages on their lruvec */ > +int sort_page_lruvec(struct lruvecs *lruvecs, struct pagevec *pvec) > +{ > + int i, j, nr_lruvec; > + struct page *page; > + struct lruvec *lruvec = NULL; > + > + lruvecs->vecs[0] = NULL; > + for (i = nr_lruvec = 0; i < pagevec_count(pvec); i++) { > + page = pvec->pages[i]; > + lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page)); > + > + /* Try to find a same lruvec */ > + for (j = 0; j <= nr_lruvec; j++) > + if (lruvec == lruvecs->vecs[j]) > + break; > + > + /* A new lruvec */ > + if (j > nr_lruvec) { > + INIT_LIST_HEAD(&lruvecs->lists[nr_lruvec]); > + lruvecs->vecs[nr_lruvec] = lruvec; > + j = nr_lruvec++; > + lruvecs->vecs[nr_lruvec] = 0; > + } > + > + list_add_tail(&page->lru, &lruvecs->lists[j]); > + } > + > + return nr_lruvec; > +} > + > /* > * Add the passed pages to the LRU, then drop the caller's refcount > * on them. Reinitialises the caller's pagevec. > */ > void __pagevec_lru_add(struct pagevec *pvec) > { > - int i; > - struct lruvec *lruvec = NULL; > + int i, nr_lruvec; > unsigned long flags = 0; > + struct page *page; > + struct lruvecs lruvecs; > > - for (i = 0; i < pagevec_count(pvec); i++) { > - struct page *page = pvec->pages[i]; > + nr_lruvec = sort_page_lruvec(&lruvecs, pvec); Simply looping pvec multiple times (15 at most) for different lruvecs would be better because 1) it requires no extra data structures and therefore has better cache locality (theoretically faster) 2) it only loops once when !CONFIG_MEMCG and !CONFIG_NUMA and therefore has no impact on Android and Chrome OS. > - lruvec = relock_page_lruvec_irqsave(page, lruvec, &flags); > - __pagevec_lru_add_fn(page, lruvec); > + for (i = 0; i < nr_lruvec; i++) { > + spin_lock_irqsave(&lruvecs.vecs[i]->lru_lock, flags); > + while (!list_empty(&lruvecs.lists[i])) { > + page = lru_to_page(&lruvecs.lists[i]); > + list_del(&page->lru); > + __pagevec_lru_add_fn(page, lruvecs.vecs[i]); > + } > + spin_unlock_irqrestore(&lruvecs.vecs[i]->lru_lock, flags); > } > - if (lruvec) > - unlock_page_lruvec_irqrestore(lruvec, flags); > + > release_pages(pvec->pages, pvec->nr); > pagevec_reinit(pvec); > } > -- > 2.29.GIT >
Re: [PATCH v9 2/2] Add Intel LGM SoC DMA support.
On 25-11-20, 18:39, Reddy, MallikarjunaX wrote: > > > > > desc needs to be configure for each dma channel and the remapped > > > > > address of > > > > > the IGP & EGP is desc base adress. > > > > Why should this address not passed as src_addr/dst_addr? > > > src_addr/dst_addr is the data pointer. Data pointer indicates address > > > pointer of data buffer. > > > > > > ldma_chan_desc_cfg() carries the descriptor address. > > > > > > The descriptor list entry contains the data pointer, which points to the > > > data section in the memory. > > > > > > So we should not use src_addr/dst_addr as desc base address. > > Okay sounds reasonable. why is this using in API here? > descriptor base address needs to be write into the dma register (DMA_CDBA). Why cant descriptor be allocated by damenegine driver, passed to client as we normally do in prep_* callbacks ? Why do you need a custom API -- ~Vinod
Re: [PATCH 22/25] perf buildid-cache: Add support to add build ids from perf data
On Thu, Nov 26, 2020 at 1:36 AM Jiri Olsa wrote: > > On Wed, Nov 25, 2020 at 10:00:10PM +0900, Namhyung Kim wrote: > > On Tue, Nov 24, 2020 at 8:06 AM Jiri Olsa wrote: > > > > > > Adding support to specify perf data file as -a option file > > > argument, > > > > > > If the file is detected to be perf data file, it is processed > > > and all dso objects with sample hit are stored to the build > > > id cache. > > > > > > $ DEBUGINFOD_URLS=http://192.168.122.174:8002 perf buildid-cache -a > > > perf.data > > > OK 5dcec522abf136fcfd3128f47e131f2365834dd7 > > > /home/jolsa/.debug/.build-id/5d/cec522abf136fcfd3128f47e131f2365834dd7/elf > > > OK 5784f813b727a50cfd3363234aef9fcbab685cc4 > > > /lib/modules/5.10.0-rc2speed+/kernel/fs/xfs/xfs.ko > > > > > > By default we store only dso with hits, but it's possible to > > > specify 'all' to store all dso objects, like: > > > -a perf.data,all > > > > I think we can add -A/--add-all like we have -p and -P. > > hm, the thing is that 'all' is specific for perf data file: '-a perf.data' > hence -A 'file' would make no sense, only for '-A perf.data', so the current > 'all' parameter seems less confusing to me Yeah, I also thought about the '-A perf.data' form. But I won't insist on it strongly, it's up to you. :) Thanks, Namhyung
[stable 4.9] PANIC: double fault, error_code: 0x0 - clang boot failed on x86_64
Linaro recently started building and testing with stable branches with clang. Stable 4.9 branch kernel built with clang 10 boot crashed on x86 and qemu_x86. We do not have base line results to compare with. steps to build and boot: # build kernel with tuxmake # sudo pip3 install -U tuxmake # tuxmake --runtime docker --target-arch x86 --toolchain clang-10 --kconfig defconfig --kconfig-add https://builds.tuxbuild.com/1kgtX7QEDmhvj6OfbZBdlGaEple/config # boot qemu_x86_64 # /usr/bin/qemu-system-x86_64 -cpu host -enable-kvm -nographic -net nic,model=virtio,macaddr=DE:AD:BE:EF:66:14 -net tap -m 1024 -monitor none -kernel kernel/bzImage --append "root=/dev/sda rootwait console=ttyS0,115200" -hda rootfs/rpb-console-image-lkft-intel-corei7-64-20201022181159-3085.rootfs.ext4 -m 4096 -smp 4 -nographic Crash log: --- [ 14.121499] Freeing unused kernel memory: 1896K [ 14.126962] random: fast init done [ 14.206005] PANIC: double fault, error_code: 0x0 [ 14.210633] CPU: 1 PID: 1 Comm: systemd Not tainted 4.9.246-rc1 #2 [ 14.216809] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 14.224196] task: 88026e2c task.stack: c902 [ 14.230105] RIP: 0010:[] [] proc_dostring+0x13b/0x1e0 [ 14.238374] RSP: 0018:000c EFLAGS: 00010297 [ 14.243676] RAX: 5638939fb850 RBX: 000c RCX: 5638939fb850 [ 14.250799] RDX: 000c RSI: RDI: 007f [ 14.257925] RBP: c9023d98 R08: c9023ef8 R09: 5638939fb850 [ 14.265049] R10: R11: 8117f9e0 R12: 82479cf0 [ 14.272171] R13: c9023ef8 R14: c9023dd8 R15: 007f [ 14.279298] FS: 7f57fbce8840() GS:88027788() knlGS: [ 14.287384] CS: 0010 DS: ES: CR0: 80050033 [ 14.293120] CR2: fff8 CR3: 00026d58a000 CR4: 00360670 [ 14.300243] DR0: DR1: DR2: [ 14.307368] DR3: DR6: fffe0ff0 DR7: 0400 [ 14.314491] Stack: [ 14.316504] Call Trace: [ 14.318955] Code: c3 49 8b 10 31 f6 48 01 da 49 89 10 49 83 3e 00 74 49 41 83 c7 ff 49 63 ff 4c 89 c9 0f 1f 40 00 48 39 fe 73 36 48 89 c8 48 89 dc b0 9d 3a 00 85 c0 0f 85 8c 00 00 00 84 d2 74 1f 80 fa 0a 74 [ 14.338906] Kernel panic - not syncing: Machine halted. [ 14.344123] CPU: 1 PID: 1 Comm: systemd Not tainted 4.9.246-rc1 #2 [ 14.350291] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS 2.2 05/23/2018 [ 14.357677] 880277888e80 81518ae9 880277888e98 82971a10 [ 14.365129] 000f 0086 820c5d57 [ 14.372584] 880277888f08 81175736 0038 880277888f18 [ 14.380038] Call Trace: [ 14.382481] <#DF> [ 14.384406] [] dump_stack+0xa9/0x100 [ 14.389641] [] panic+0xe6/0x2a0 [ 14.394432] [] df_debug+0x31/0x40 [ 14.399389] [] do_double_fault+0x102/0x140 [ 14.405128] [] double_fault+0x27/0x30 [ 14.410440] [] ? proc_put_long+0xc0/0xc0 [ 14.416004] [] ? proc_dostring+0x13b/0x1e0 [ 14.421739] [ 14.423703] Kernel Offset: disabled [ 14.427209] ---[ end Kernel panic - not syncing: Machine halted. Reported-by: Naresh Kamboju full test log, https://lkft.validation.linaro.org/scheduler/job/1978901#L916 https://lkft.validation.linaro.org/scheduler/job/1980839#L578 -- Linaro LKFT https://lkft.linaro.org