Linux 4.19.6

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.19.6 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/security-bugs.rst |   48 +-
 Documentation/devicetree/bindings/net/can/holt_hi311x.txt   |2 
 MAINTAINERS |1 
 Makefile|2 
 arch/powerpc/include/asm/io.h   |   20 
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/riscv/Makefile |4 
 arch/riscv/kernel/module.c  |   12 
 arch/x86/events/intel/uncore_snb.c  |  115 +
 block/bio.c |1 
 block/bounce.c  |1 
 crypto/simd.c   |5 
 drivers/acpi/acpica/dsopcode.c  |4 
 drivers/block/floppy.c  |3 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/libstub/Makefile   |3 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c  |7 
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c   |1 
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c  |2 
 drivers/gpu/drm/ast/ast_drv.c   |   21 
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/gpu/drm/drm_fb_helper.c |3 
 drivers/gpu/drm/i915/intel_pm.c |   41 +
 drivers/gpu/drm/vc4/vc4_kms.c   |6 
 drivers/hid/hid-steam.c |  154 ---
 drivers/infiniband/hw/hfi1/user_sdma.c  |   87 +--
 drivers/infiniband/hw/hfi1/user_sdma.h  |3 
 drivers/input/mouse/synaptics.c |4 
 drivers/media/i2c/ov5640.c  |  263 +++-
 drivers/mmc/host/sdhci-pci-core.c   |   86 +++
 drivers/net/can/dev.c   |   48 +-
 drivers/net/can/flexcan.c   |  108 ++--
 drivers/net/can/rx-offload.c|   51 ++
 drivers/net/can/spi/hi311x.c|2 
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/fw/acpi.h|4 
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c |   38 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/opp/ti-opp-supply.c |5 
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c  |2 
 drivers/pinctrl/meson/pinctrl-meson-gxl.c   |2 
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/pinctrl/meson/pinctrl-meson8.c  |2 
 drivers/pinctrl/meson/pinctrl-meson8b.c |2 
 drivers/rtc/rtc-cmos.c  |   16 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c  |2 
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c  |2 
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c  |2 
 drivers/scsi/lpfc/lpfc_debugfs.c|2 
 drivers/tty/n_tty.c |   20 
 drivers/tty/tty_buffer.c|6 
 drivers/usb/core/hub.c  |4 
 drivers/usb/dwc3/core.c |1 
 drivers/usb/dwc3/dwc3-pci.c |4 
 drivers/usb/dwc3/gadget.c   |8 
 drivers/usb/host/xhci-histb.c

Linux 4.19.6

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.19.6 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/security-bugs.rst |   48 +-
 Documentation/devicetree/bindings/net/can/holt_hi311x.txt   |2 
 MAINTAINERS |1 
 Makefile|2 
 arch/powerpc/include/asm/io.h   |   20 
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/riscv/Makefile |4 
 arch/riscv/kernel/module.c  |   12 
 arch/x86/events/intel/uncore_snb.c  |  115 +
 block/bio.c |1 
 block/bounce.c  |1 
 crypto/simd.c   |5 
 drivers/acpi/acpica/dsopcode.c  |4 
 drivers/block/floppy.c  |3 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/libstub/Makefile   |3 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c  |7 
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c   |1 
 drivers/gpu/drm/amd/amdgpu/vega10_ih.c  |2 
 drivers/gpu/drm/ast/ast_drv.c   |   21 
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/gpu/drm/drm_fb_helper.c |3 
 drivers/gpu/drm/i915/intel_pm.c |   41 +
 drivers/gpu/drm/vc4/vc4_kms.c   |6 
 drivers/hid/hid-steam.c |  154 ---
 drivers/infiniband/hw/hfi1/user_sdma.c  |   87 +--
 drivers/infiniband/hw/hfi1/user_sdma.h  |3 
 drivers/input/mouse/synaptics.c |4 
 drivers/media/i2c/ov5640.c  |  263 +++-
 drivers/mmc/host/sdhci-pci-core.c   |   86 +++
 drivers/net/can/dev.c   |   48 +-
 drivers/net/can/flexcan.c   |  108 ++--
 drivers/net/can/rx-offload.c|   51 ++
 drivers/net/can/spi/hi311x.c|2 
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/fw/acpi.h|4 
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c |   38 +
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/opp/ti-opp-supply.c |5 
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c  |2 
 drivers/pinctrl/meson/pinctrl-meson-gxl.c   |2 
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/pinctrl/meson/pinctrl-meson8.c  |2 
 drivers/pinctrl/meson/pinctrl-meson8b.c |2 
 drivers/rtc/rtc-cmos.c  |   16 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c  |2 
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c  |2 
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c  |2 
 drivers/scsi/lpfc/lpfc_debugfs.c|2 
 drivers/tty/n_tty.c |   20 
 drivers/tty/tty_buffer.c|6 
 drivers/usb/core/hub.c  |4 
 drivers/usb/dwc3/core.c |1 
 drivers/usb/dwc3/dwc3-pci.c |4 
 drivers/usb/dwc3/gadget.c   |8 
 drivers/usb/host/xhci-histb.c

Re: Linux 4.14.85

2018-12-01 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt 
b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
index 23aa94eab207..4e0ec14f7abf 100644
--- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
+++ b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
@@ -18,7 +18,7 @@ Example:
reg = <1>;
clocks = <>;
interrupt-parent = <>;
-   interrupts = <13 IRQ_TYPE_EDGE_RISING>;
+   interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
vdd-supply = <>;
xceiver-supply = <>;
};
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index 546beb6b0176..6cb70b853323 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12662,6 +12662,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/process/stable-kernel-rules.rst
diff --git a/Makefile b/Makefile
index 874d72a3e6a7..58a248264090 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 84
+SUBLEVEL = 85
 EXTRAVERSION =
 NAME = Petit Gorille
 
@@ -480,13 +480,15 @@ endif
 ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
 CLANG_TARGET   := --target=$(notdir $(CROSS_COMPILE:%-=%))
-GCC_TOOLCHAIN  := $(realpath $(dir $(shell which $(LD)))/..)
+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
+CLANG_PREFIX   := --prefix=$(GCC_TOOLCHAIN_DIR)
+GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 endif
 ifneq ($(GCC_TOOLCHAIN),)
 CLANG_GCC_TC   := --gcc-toolchain=$(GCC_TOOLCHAIN)
 endif
-KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
-KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
+KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
+KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
 KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
 KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
 endif
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 36ae4454554c..17e80f483281 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -106,7 +106,7 @@ tune-$(CONFIG_CPU_V6K)  =$(call 
cc-option,-mtune=arm1136j-s,-mtune=strongarm)
 tune-y := $(tune-y)
 
 ifeq ($(CONFIG_AEABI),y)
-CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
+CFLAGS_ABI :=-mabi=aapcs-linux -mfpu=vfp
 else
 CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call 
cc-option,-mno-thumb-interwork,)
 endif
diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index a5889238fc9f..746c8c575f98 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -113,7 +113,7 @@ CFLAGS_fdt_ro.o := $(nossp_flags)
 CFLAGS_fdt_rw.o := $(nossp_flags)
 CFLAGS_fdt_wip.o := $(nossp_flags)
 
-ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
+ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin 

Re: Linux 4.14.85

2018-12-01 Thread Greg KH
diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt 
b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
index 23aa94eab207..4e0ec14f7abf 100644
--- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
+++ b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
@@ -18,7 +18,7 @@ Example:
reg = <1>;
clocks = <>;
interrupt-parent = <>;
-   interrupts = <13 IRQ_TYPE_EDGE_RISING>;
+   interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
vdd-supply = <>;
xceiver-supply = <>;
};
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index 546beb6b0176..6cb70b853323 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12662,6 +12662,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/process/stable-kernel-rules.rst
diff --git a/Makefile b/Makefile
index 874d72a3e6a7..58a248264090 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 84
+SUBLEVEL = 85
 EXTRAVERSION =
 NAME = Petit Gorille
 
@@ -480,13 +480,15 @@ endif
 ifeq ($(cc-name),clang)
 ifneq ($(CROSS_COMPILE),)
 CLANG_TARGET   := --target=$(notdir $(CROSS_COMPILE:%-=%))
-GCC_TOOLCHAIN  := $(realpath $(dir $(shell which $(LD)))/..)
+GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
+CLANG_PREFIX   := --prefix=$(GCC_TOOLCHAIN_DIR)
+GCC_TOOLCHAIN  := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
 endif
 ifneq ($(GCC_TOOLCHAIN),)
 CLANG_GCC_TC   := --gcc-toolchain=$(GCC_TOOLCHAIN)
 endif
-KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
-KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
+KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
+KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
 KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
 KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
 endif
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 36ae4454554c..17e80f483281 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -106,7 +106,7 @@ tune-$(CONFIG_CPU_V6K)  =$(call 
cc-option,-mtune=arm1136j-s,-mtune=strongarm)
 tune-y := $(tune-y)
 
 ifeq ($(CONFIG_AEABI),y)
-CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
+CFLAGS_ABI :=-mabi=aapcs-linux -mfpu=vfp
 else
 CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call 
cc-option,-mno-thumb-interwork,)
 endif
diff --git a/arch/arm/boot/compressed/Makefile 
b/arch/arm/boot/compressed/Makefile
index a5889238fc9f..746c8c575f98 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -113,7 +113,7 @@ CFLAGS_fdt_ro.o := $(nossp_flags)
 CFLAGS_fdt_rw.o := $(nossp_flags)
 CFLAGS_fdt_wip.o := $(nossp_flags)
 
-ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
+ccflags-y := -fpic $(call cc-option,-mno-single-pic-base,) -fno-builtin 

Re: Linux 4.9.142

2018-12-01 Thread Greg KH
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index 63cefa62324c..4f559f5b3a89 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11469,6 +11469,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/stable_kernel_rules.txt
diff --git a/Makefile b/Makefile
index 8eba73521a7f..72ed8ff90329 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 141
+SUBLEVEL = 142
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 92110c2c6c59..ee94597773fa 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 GZFLAGS:=-9
 
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f6fda8482f60..3b10f532c28e 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -333,19 +333,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, 
const void *src,
  * their hooks, a bitfield is reserved for use by the platform near the
  * top of MMIO addresses (not PIO, those have to cope the hard way).
  *
- * This bit field is 12 bits and is at the top of the IO virtual
- * addresses PCI_IO_INDIRECT_TOKEN_MASK.
+ * The highest address in the kernel virtual space are:
  *
- * The kernel virtual space is thus:
+ *  d0003fff   # with Hash MMU
+ *  c00f   # with Radix MMU
  *
- *  0xD000 : vmalloc
- *  0xD800 : PCI PHB IO space
- *  0xD8008000 : ioremap
- *  0xDfff : end of ioremap region
- *
- * Since the top 4 bits are reserved as the region ID, we use thus
- * the next 12 bits and keep 4 bits available for the future if the
- * virtual address space is ever to be extended.
+ * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits
+ * that can be used for the field.
  *
  * The direct IO mapping operations will then mask off those bits
  * before doing the actual access, though that only happen when
@@ -357,8 +351,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const 
void *src,
  */
 
 #ifdef CONFIG_PPC_INDIRECT_MMIO
-#define PCI_IO_IND_TOKEN_MASK  0x0ffful
-#define PCI_IO_IND_TOKEN_SHIFT 48
+#define PCI_IO_IND_TOKEN_SHIFT 52
+#define PCI_IO_IND_TOKEN_MASK  (0xfful << PCI_IO_IND_TOKEN_SHIFT)
 #define PCI_FIX_ADDR(addr) \
((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
 #define PCI_GET_ADDR_TOKEN(addr)   \
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 2e0e67ef3544..e8cedf32345a 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h

Linux 4.14.85

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.14.85 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/net/can/holt_hi311x.txt   |2 
 Documentation/sysctl/fs.txt |   36 +++
 MAINTAINERS |1 
 Makefile|   10 -
 arch/arm/Makefile   |2 
 arch/arm/boot/compressed/Makefile   |2 
 arch/arm/boot/dts/exynos5420-peach-pit.dts  |4 
 arch/arm/boot/dts/exynos5800-peach-pi.dts   |4 
 arch/arm/firmware/trusted_foundations.c |   14 -
 arch/arm64/Makefile |2 
 arch/powerpc/include/asm/io.h   |   20 --
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/s390/mm/gmap.c |2 
 arch/x86/events/intel/uncore_snb.c  |  115 +++-
 crypto/simd.c   |5 
 drivers/base/core.c |2 
 drivers/block/floppy.c  |3 
 drivers/bus/arm-cci.c   |2 
 drivers/clk/samsung/clk-exynos5250.c|6 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/libstub/Makefile   |3 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/ast/ast_drv.c   |   21 ++
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/gpu/drm/mediatek/mtk_hdmi.c |5 
 drivers/infiniband/core/verbs.c |5 
 drivers/infiniband/hw/hfi1/user_sdma.c  |   87 -
 drivers/infiniband/hw/hfi1/user_sdma.h  |3 
 drivers/infiniband/hw/i40iw/i40iw_verbs.c   |2 
 drivers/input/joystick/xpad.c   |   45 ++--
 drivers/input/mouse/synaptics.c |4 
 drivers/mmc/host/sdhci-pci-core.c   |7 
 drivers/mtd/nand/atmel/nand-controller.c|   11 -
 drivers/mtd/ubi/build.c |1 
 drivers/mtd/ubi/eba.c   |4 
 drivers/mtd/ubi/fastmap.c   |   20 ++
 drivers/mtd/ubi/ubi.h   |   11 +
 drivers/mtd/ubi/vmt.c   |1 
 drivers/mtd/ubi/vtbl.c  |   16 +
 drivers/net/can/dev.c   |   48 +++--
 drivers/net/can/flexcan.c   |4 
 drivers/net/can/rx-offload.c|   51 +
 drivers/net/can/spi/hi311x.c|2 
 drivers/net/ethernet/broadcom/genet/bcmmii.c|2 
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c   |1 
 drivers/net/usb/lan78xx.c   |   42 ++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c |   40 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 -
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/nfc/nfcmrvl/uart.c  |5 
 drivers/of/base.c   |   25 ++
 drivers/pci/endpoint/pci-ep-cfs.c   |   14 -
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/power/supply/twl4030_charger.c  |5 
 drivers/rtc/rtc-omap.c  |3 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/tty/n_tty.c |   20 +-
 drivers/tty/tty_buffer.c   

Re: Linux 4.4.166

2018-12-01 Thread Greg KH
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index ab65bbecb159..f4d4a5544dc1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10135,6 +10135,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/stable_kernel_rules.txt
diff --git a/Makefile b/Makefile
index 441a760dc5a4..64521458d35e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 165
+SUBLEVEL = 166
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index c10bb98144b0..fb4ac87fc398 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 OBJCOPYFLAGS   :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 GZFLAGS:=-9
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 2e0e67ef3544..e8cedf32345a 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -5,8 +5,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace
 
 /*
  * Tracepoint for guest mode entry.
@@ -119,4 +117,10 @@ TRACE_EVENT(kvm_check_requests,
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+
 #include 
diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h
index 7ec534d1db9f..7eadbf449a1f 100644
--- a/arch/powerpc/kvm/trace_booke.h
+++ b/arch/powerpc/kvm/trace_booke.h
@@ -5,8 +5,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_booke
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_booke
 
 #define kvm_trace_symbol_exit \
{0, "CRITICAL"}, \
@@ -217,4 +215,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio,
 #endif
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_booke
+
 #include 
diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
index 33d9daff5783..d1bfe017d751 100644
--- a/arch/powerpc/kvm/trace_hv.h
+++ b/arch/powerpc/kvm/trace_hv.h
@@ -8,8 +8,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_hv
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_hv
 
 #define kvm_trace_symbol_hcall \
{H_REMOVE,  "H_REMOVE"}, \
@@ -474,4 +472,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
 #endif /* _TRACE_KVM_HV_H */
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_hv
+
 #include 
diff --git a/arch/powerpc/kvm/trace_pr.h 

Linux 4.14.85

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.14.85 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/devicetree/bindings/net/can/holt_hi311x.txt   |2 
 Documentation/sysctl/fs.txt |   36 +++
 MAINTAINERS |1 
 Makefile|   10 -
 arch/arm/Makefile   |2 
 arch/arm/boot/compressed/Makefile   |2 
 arch/arm/boot/dts/exynos5420-peach-pit.dts  |4 
 arch/arm/boot/dts/exynos5800-peach-pi.dts   |4 
 arch/arm/firmware/trusted_foundations.c |   14 -
 arch/arm64/Makefile |2 
 arch/powerpc/include/asm/io.h   |   20 --
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/s390/mm/gmap.c |2 
 arch/x86/events/intel/uncore_snb.c  |  115 +++-
 crypto/simd.c   |5 
 drivers/base/core.c |2 
 drivers/block/floppy.c  |3 
 drivers/bus/arm-cci.c   |2 
 drivers/clk/samsung/clk-exynos5250.c|6 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/libstub/Makefile   |3 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/ast/ast_drv.c   |   21 ++
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/gpu/drm/mediatek/mtk_hdmi.c |5 
 drivers/infiniband/core/verbs.c |5 
 drivers/infiniband/hw/hfi1/user_sdma.c  |   87 -
 drivers/infiniband/hw/hfi1/user_sdma.h  |3 
 drivers/infiniband/hw/i40iw/i40iw_verbs.c   |2 
 drivers/input/joystick/xpad.c   |   45 ++--
 drivers/input/mouse/synaptics.c |4 
 drivers/mmc/host/sdhci-pci-core.c   |7 
 drivers/mtd/nand/atmel/nand-controller.c|   11 -
 drivers/mtd/ubi/build.c |1 
 drivers/mtd/ubi/eba.c   |4 
 drivers/mtd/ubi/fastmap.c   |   20 ++
 drivers/mtd/ubi/ubi.h   |   11 +
 drivers/mtd/ubi/vmt.c   |1 
 drivers/mtd/ubi/vtbl.c  |   16 +
 drivers/net/can/dev.c   |   48 +++--
 drivers/net/can/flexcan.c   |4 
 drivers/net/can/rx-offload.c|   51 +
 drivers/net/can/spi/hi311x.c|2 
 drivers/net/ethernet/broadcom/genet/bcmmii.c|2 
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c   |1 
 drivers/net/usb/lan78xx.c   |   42 ++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c |   40 +++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 -
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/nfc/nfcmrvl/uart.c  |5 
 drivers/of/base.c   |   25 ++
 drivers/pci/endpoint/pci-ep-cfs.c   |   14 -
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/power/supply/twl4030_charger.c  |5 
 drivers/rtc/rtc-omap.c  |3 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/tty/n_tty.c |   20 +-
 drivers/tty/tty_buffer.c   

Re: Linux 4.4.166

2018-12-01 Thread Greg KH
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index ab65bbecb159..f4d4a5544dc1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10135,6 +10135,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/stable_kernel_rules.txt
diff --git a/Makefile b/Makefile
index 441a760dc5a4..64521458d35e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 165
+SUBLEVEL = 166
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index c10bb98144b0..fb4ac87fc398 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 OBJCOPYFLAGS   :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 GZFLAGS:=-9
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 2e0e67ef3544..e8cedf32345a 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -5,8 +5,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace
 
 /*
  * Tracepoint for guest mode entry.
@@ -119,4 +117,10 @@ TRACE_EVENT(kvm_check_requests,
 #endif /* _TRACE_KVM_H */
 
 /* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+
 #include 
diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h
index 7ec534d1db9f..7eadbf449a1f 100644
--- a/arch/powerpc/kvm/trace_booke.h
+++ b/arch/powerpc/kvm/trace_booke.h
@@ -5,8 +5,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_booke
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_booke
 
 #define kvm_trace_symbol_exit \
{0, "CRITICAL"}, \
@@ -217,4 +215,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio,
 #endif
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_booke
+
 #include 
diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
index 33d9daff5783..d1bfe017d751 100644
--- a/arch/powerpc/kvm/trace_hv.h
+++ b/arch/powerpc/kvm/trace_hv.h
@@ -8,8 +8,6 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM kvm_hv
-#define TRACE_INCLUDE_PATH .
-#define TRACE_INCLUDE_FILE trace_hv
 
 #define kvm_trace_symbol_hcall \
{H_REMOVE,  "H_REMOVE"}, \
@@ -474,4 +472,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
 #endif /* _TRACE_KVM_HV_H */
 
 /* This part must be outside protection */
+
+#undef TRACE_INCLUDE_PATH
+#undef TRACE_INCLUDE_FILE
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace_hv
+
 #include 
diff --git a/arch/powerpc/kvm/trace_pr.h 

Re: Linux 4.9.142

2018-12-01 Thread Greg KH
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 35e17f748ca7..af5859b2d0f9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -34,7 +34,9 @@ Currently, these files are in /proc/sys/fs:
 - overflowgid
 - pipe-user-pages-hard
 - pipe-user-pages-soft
+- protected_fifos
 - protected_hardlinks
+- protected_regular
 - protected_symlinks
 - suid_dumpable
 - super-max
@@ -182,6 +184,24 @@ applied.
 
 ==
 
+protected_fifos:
+
+The intent of this protection is to avoid unintentional writes to
+an attacker-controlled FIFO, where a program expected to create a regular
+file.
+
+When set to "0", writing to FIFOs is unrestricted.
+
+When set to "1" don't allow O_CREAT open on FIFOs that we don't own
+in world writable sticky directories, unless they are owned by the
+owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+This protection is based on the restrictions in Openwall.
+
+==
+
 protected_hardlinks:
 
 A long-standing class of security issues is the hardlink-based
@@ -202,6 +222,22 @@ This protection is based on the restrictions in Openwall 
and grsecurity.
 
 ==
 
+protected_regular:
+
+This protection is similar to protected_fifos, but it
+avoids writes to an attacker-controlled regular file, where a program
+expected to create one.
+
+When set to "0", writing to regular files is unrestricted.
+
+When set to "1" don't allow O_CREAT open on regular files that we
+don't own in world writable sticky directories, unless they are
+owned by the owner of the directory.
+
+When set to "2" it also applies to group writable sticky directories.
+
+==
+
 protected_symlinks:
 
 A long-standing class of security issues is the symlink-based
diff --git a/MAINTAINERS b/MAINTAINERS
index 63cefa62324c..4f559f5b3a89 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11469,6 +11469,7 @@ F:  arch/alpha/kernel/srm_env.c
 
 STABLE BRANCH
 M: Greg Kroah-Hartman 
+M: Sasha Levin 
 L: sta...@vger.kernel.org
 S: Supported
 F: Documentation/stable_kernel_rules.txt
diff --git a/Makefile b/Makefile
index 8eba73521a7f..72ed8ff90329 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 141
+SUBLEVEL = 142
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 92110c2c6c59..ee94597773fa 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 GZFLAGS:=-9
 
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index f6fda8482f60..3b10f532c28e 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -333,19 +333,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, 
const void *src,
  * their hooks, a bitfield is reserved for use by the platform near the
  * top of MMIO addresses (not PIO, those have to cope the hard way).
  *
- * This bit field is 12 bits and is at the top of the IO virtual
- * addresses PCI_IO_INDIRECT_TOKEN_MASK.
+ * The highest address in the kernel virtual space are:
  *
- * The kernel virtual space is thus:
+ *  d0003fff   # with Hash MMU
+ *  c00f   # with Radix MMU
  *
- *  0xD000 : vmalloc
- *  0xD800 : PCI PHB IO space
- *  0xD8008000 : ioremap
- *  0xDfff : end of ioremap region
- *
- * Since the top 4 bits are reserved as the region ID, we use thus
- * the next 12 bits and keep 4 bits available for the future if the
- * virtual address space is ever to be extended.
+ * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits
+ * that can be used for the field.
  *
  * The direct IO mapping operations will then mask off those bits
  * before doing the actual access, though that only happen when
@@ -357,8 +351,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const 
void *src,
  */
 
 #ifdef CONFIG_PPC_INDIRECT_MMIO
-#define PCI_IO_IND_TOKEN_MASK  0x0ffful
-#define PCI_IO_IND_TOKEN_SHIFT 48
+#define PCI_IO_IND_TOKEN_SHIFT 52
+#define PCI_IO_IND_TOKEN_MASK  (0xfful << PCI_IO_IND_TOKEN_SHIFT)
 #define PCI_FIX_ADDR(addr) \
((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
 #define PCI_GET_ADDR_TOKEN(addr)   \
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 2e0e67ef3544..e8cedf32345a 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h

Linux 4.9.142

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.9.142 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/sysctl/fs.txt |   36 
 MAINTAINERS |1 
 Makefile|2 
 arch/arm64/Makefile |2 
 arch/powerpc/include/asm/io.h   |   20 
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/s390/mm/gmap.c |2 
 arch/x86/events/intel/uncore_snb.c  |  115 ++
 drivers/block/floppy.c  |3 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/ast/ast_drv.c   |   21 
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/infiniband/core/verbs.c |4 
 drivers/infiniband/hw/hfi1/user_sdma.c  |  106 +-
 drivers/input/joystick/xpad.c   |  471 +---
 drivers/net/can/dev.c   |   48 -
 drivers/net/ethernet/broadcom/genet/bcmmii.c|2 
 drivers/net/usb/lan78xx.c   |   42 -
 drivers/net/wireless/ath/ath10k/mac.c   |6 
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/net/wireless/marvell/mwifiex/cfg80211.c |   10 
 drivers/net/wireless/marvell/mwifiex/pcie.c |   19 
 drivers/net/wireless/marvell/mwifiex/wmm.c  |   12 
 drivers/net/wireless/st/cw1200/wsm.c|   16 
 drivers/nfc/nfcmrvl/uart.c  |5 
 drivers/of/base.c   |   25 
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/scsi/ufs/ufs.h  |3 
 drivers/scsi/ufs/ufshcd-pci.c   |2 
 drivers/scsi/ufs/ufshcd-pltfrm.c|5 
 drivers/scsi/ufs/ufshcd.c   |   75 +
 drivers/tty/n_tty.c |   20 
 drivers/tty/tty_buffer.c|2 
 drivers/usb/core/hub.c  |4 
 drivers/usb/dwc3/core.c |1 
 drivers/usb/host/xhci-hub.c |   66 +
 drivers/usb/host/xhci-ring.c|2 
 drivers/usb/host/xhci.h |2 
 fs/9p/vfs_dir.c |   11 
 fs/bfs/inode.c  |9 
 fs/gfs2/ops_fstype.c|2 
 fs/namei.c  |   53 +
 include/linux/can/dev.h |1 
 include/linux/fs.h  |2 
 include/linux/integrity.h   |1 
 include/linux/of.h  |8 
 include/linux/pfn_t.h   |2 
 kernel/debug/kdb/kdb_io.c   |   15 
 kernel/debug/kdb/kdb_private.h  |2 
 kernel/debug/kdb/kdb_support.c  |   10 
 kernel/sched/core.c |4 
 kernel/sysctl.c |   18 
 mm/shmem.c  |4 
 mm/slab.c   |4 
 mm/slab_common.c|   12 
 

Linux 4.9.142

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.9.142 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/sysctl/fs.txt |   36 
 MAINTAINERS |1 
 Makefile|2 
 arch/arm64/Makefile |2 
 arch/powerpc/include/asm/io.h   |   20 
 arch/powerpc/kvm/trace.h|8 
 arch/powerpc/kvm/trace_booke.h  |9 
 arch/powerpc/kvm/trace_hv.h |9 
 arch/powerpc/kvm/trace_pr.h |9 
 arch/powerpc/mm/numa.c  |2 
 arch/s390/mm/gmap.c |2 
 arch/x86/events/intel/uncore_snb.c  |  115 ++
 drivers/block/floppy.c  |3 
 drivers/cpufreq/imx6q-cpufreq.c |7 
 drivers/firmware/efi/arm-init.c |4 
 drivers/firmware/efi/arm-runtime.c  |2 
 drivers/firmware/efi/memmap.c   |3 
 drivers/gpio/gpiolib.c  |5 
 drivers/gpu/drm/ast/ast_drv.c   |   21 
 drivers/gpu/drm/ast/ast_mode.c  |3 
 drivers/infiniband/core/verbs.c |4 
 drivers/infiniband/hw/hfi1/user_sdma.c  |  106 +-
 drivers/input/joystick/xpad.c   |  471 +---
 drivers/net/can/dev.c   |   48 -
 drivers/net/ethernet/broadcom/genet/bcmmii.c|2 
 drivers/net/usb/lan78xx.c   |   42 -
 drivers/net/wireless/ath/ath10k/mac.c   |6 
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |3 
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c   |   12 
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c|5 
 drivers/net/wireless/marvell/mwifiex/cfg80211.c |   10 
 drivers/net/wireless/marvell/mwifiex/pcie.c |   19 
 drivers/net/wireless/marvell/mwifiex/wmm.c  |   12 
 drivers/net/wireless/st/cw1200/wsm.c|   16 
 drivers/nfc/nfcmrvl/uart.c  |5 
 drivers/of/base.c   |   25 
 drivers/pinctrl/meson/pinctrl-meson.c   |2 
 drivers/rtc/rtc-pcf2127.c   |3 
 drivers/scsi/ufs/ufs.h  |3 
 drivers/scsi/ufs/ufshcd-pci.c   |2 
 drivers/scsi/ufs/ufshcd-pltfrm.c|5 
 drivers/scsi/ufs/ufshcd.c   |   75 +
 drivers/tty/n_tty.c |   20 
 drivers/tty/tty_buffer.c|2 
 drivers/usb/core/hub.c  |4 
 drivers/usb/dwc3/core.c |1 
 drivers/usb/host/xhci-hub.c |   66 +
 drivers/usb/host/xhci-ring.c|2 
 drivers/usb/host/xhci.h |2 
 fs/9p/vfs_dir.c |   11 
 fs/bfs/inode.c  |9 
 fs/gfs2/ops_fstype.c|2 
 fs/namei.c  |   53 +
 include/linux/can/dev.h |1 
 include/linux/fs.h  |2 
 include/linux/integrity.h   |1 
 include/linux/of.h  |8 
 include/linux/pfn_t.h   |2 
 kernel/debug/kdb/kdb_io.c   |   15 
 kernel/debug/kdb/kdb_private.h  |2 
 kernel/debug/kdb/kdb_support.c  |   10 
 kernel/sched/core.c |4 
 kernel/sysctl.c |   18 
 mm/shmem.c  |4 
 mm/slab.c   |4 
 mm/slab_common.c|   12 
 

Linux 4.4.166

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.4.166 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/sysctl/fs.txt  |   36 +
 MAINTAINERS  |1 
 Makefile |2 
 arch/arm64/Makefile  |2 
 arch/powerpc/kvm/trace.h |8 
 arch/powerpc/kvm/trace_booke.h   |9 
 arch/powerpc/kvm/trace_hv.h  |9 
 arch/powerpc/kvm/trace_pr.h  |9 
 arch/powerpc/mm/numa.c   |2 
 arch/s390/mm/pgtable.c   |2 
 arch/x86/entry/entry_64.S|   20 
 drivers/cpufreq/imx6q-cpufreq.c  |7 
 drivers/gpu/drm/ast/ast_drv.c|   21 
 drivers/gpu/drm/ast/ast_mode.c   |3 
 drivers/input/joystick/xpad.c|  810 +--
 drivers/net/can/dev.c|   48 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c |2 
 drivers/net/wireless/ath/ath10k/mac.c|6 
 drivers/net/wireless/cw1200/wsm.c|   16 
 drivers/net/wireless/iwlwifi/mvm/mac80211.c  |   12 
 drivers/net/wireless/iwlwifi/mvm/nvm.c   |5 
 drivers/net/wireless/mwifiex/cfg80211.c  |   10 
 drivers/net/wireless/mwifiex/wmm.c   |   12 
 drivers/nfc/nfcmrvl/uart.c   |5 
 drivers/of/base.c|   25 
 drivers/scsi/qla2xxx/qla_os.c|5 
 drivers/scsi/ufs/ufs.h   |3 
 drivers/scsi/ufs/ufshcd-pci.c|2 
 drivers/scsi/ufs/ufshcd-pltfrm.c |5 
 drivers/scsi/ufs/ufshcd.c|   75 ++
 drivers/tty/n_tty.c  |   19 
 drivers/tty/tty_buffer.c |2 
 drivers/usb/core/hub.c   |4 
 drivers/usb/host/xhci-hub.c  |   66 +-
 drivers/usb/host/xhci-ring.c |2 
 drivers/usb/host/xhci.h  |2 
 fs/9p/vfs_dir.c  |   11 
 fs/bfs/inode.c   |9 
 fs/btrfs/extent-tree.c   |   10 
 fs/btrfs/ioctl.c |   11 
 fs/gfs2/ops_fstype.c |2 
 fs/namei.c   |   53 +
 include/linux/can/dev.h  |1 
 include/linux/fs.h   |2 
 include/linux/of.h   |8 
 kernel/debug/kdb/kdb_io.c|   15 
 kernel/debug/kdb/kdb_private.h   |2 
 kernel/debug/kdb/kdb_support.c   |   10 
 kernel/sched/core.c  |4 
 kernel/sysctl.c  |   18 
 mm/shmem.c   |4 
 net/llc/af_llc.c |   11 
 net/netfilter/nf_tables_api.c|1 
 net/sctp/associola.c |   10 
 net/sunrpc/auth_generic.c|8 
 55 files changed, 1118 insertions(+), 339 deletions(-)

Aaron Ma (2):
  usb: xhci: fix timeout for transition from RExit to U0
  usb: xhci: fix uninitialized completion when USB3 port got wrong status

Amitkumar Karwar (1):
  mwifiex: Fix NULL pointer dereference in skb_dequeue()

Andrew Price (1):
  gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd

Andy Lutomirski (1):
  x86/entry/64: Remove %ebx handling from error_entry/exit

Anson Huang (1):
  cpufreq: imx6q: add return value check for voltage scale

Arnd Bergmann (1):
  Input: xpad - remove unused function

Arvind Yadav (1):
  Input: xpad - constify usb_device_id

Benjamin Valentin (5):
  Input: xpad - sort supported devices by USB ID
  Input: xpad - sync supported devices with xboxdrv
  Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth
  Input: xpad - sync supported devices with 360Controller
  Input: xpad - sync supported devices with XBCD

Cameron Gutman (11):
  Input: xpad - prevent spurious input from wired Xbox 360 controllers
  Input: xpad - fix rumble on Xbox One controllers with 2015 firmware
  Input: xpad - power off wireless 360 controllers on suspend
  Input: xpad - add product ID for Xbox One S pad
  Input: xpad - fix Xbox One rumble stopping after 2.5 secs
  Input: xpad - don't depend on endpoint order
  Input: xpad - fix stuck mode button on Xbox One S pad
  Input: xpad - restore LED state after device resume
  Input: xpad - support some quirky Xbox One pads
 

Linux 4.4.166

2018-12-01 Thread Greg KH
I'm announcing the release of the 4.4.166 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.4.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/sysctl/fs.txt  |   36 +
 MAINTAINERS  |1 
 Makefile |2 
 arch/arm64/Makefile  |2 
 arch/powerpc/kvm/trace.h |8 
 arch/powerpc/kvm/trace_booke.h   |9 
 arch/powerpc/kvm/trace_hv.h  |9 
 arch/powerpc/kvm/trace_pr.h  |9 
 arch/powerpc/mm/numa.c   |2 
 arch/s390/mm/pgtable.c   |2 
 arch/x86/entry/entry_64.S|   20 
 drivers/cpufreq/imx6q-cpufreq.c  |7 
 drivers/gpu/drm/ast/ast_drv.c|   21 
 drivers/gpu/drm/ast/ast_mode.c   |3 
 drivers/input/joystick/xpad.c|  810 +--
 drivers/net/can/dev.c|   48 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c |2 
 drivers/net/wireless/ath/ath10k/mac.c|6 
 drivers/net/wireless/cw1200/wsm.c|   16 
 drivers/net/wireless/iwlwifi/mvm/mac80211.c  |   12 
 drivers/net/wireless/iwlwifi/mvm/nvm.c   |5 
 drivers/net/wireless/mwifiex/cfg80211.c  |   10 
 drivers/net/wireless/mwifiex/wmm.c   |   12 
 drivers/nfc/nfcmrvl/uart.c   |5 
 drivers/of/base.c|   25 
 drivers/scsi/qla2xxx/qla_os.c|5 
 drivers/scsi/ufs/ufs.h   |3 
 drivers/scsi/ufs/ufshcd-pci.c|2 
 drivers/scsi/ufs/ufshcd-pltfrm.c |5 
 drivers/scsi/ufs/ufshcd.c|   75 ++
 drivers/tty/n_tty.c  |   19 
 drivers/tty/tty_buffer.c |2 
 drivers/usb/core/hub.c   |4 
 drivers/usb/host/xhci-hub.c  |   66 +-
 drivers/usb/host/xhci-ring.c |2 
 drivers/usb/host/xhci.h  |2 
 fs/9p/vfs_dir.c  |   11 
 fs/bfs/inode.c   |9 
 fs/btrfs/extent-tree.c   |   10 
 fs/btrfs/ioctl.c |   11 
 fs/gfs2/ops_fstype.c |2 
 fs/namei.c   |   53 +
 include/linux/can/dev.h  |1 
 include/linux/fs.h   |2 
 include/linux/of.h   |8 
 kernel/debug/kdb/kdb_io.c|   15 
 kernel/debug/kdb/kdb_private.h   |2 
 kernel/debug/kdb/kdb_support.c   |   10 
 kernel/sched/core.c  |4 
 kernel/sysctl.c  |   18 
 mm/shmem.c   |4 
 net/llc/af_llc.c |   11 
 net/netfilter/nf_tables_api.c|1 
 net/sctp/associola.c |   10 
 net/sunrpc/auth_generic.c|8 
 55 files changed, 1118 insertions(+), 339 deletions(-)

Aaron Ma (2):
  usb: xhci: fix timeout for transition from RExit to U0
  usb: xhci: fix uninitialized completion when USB3 port got wrong status

Amitkumar Karwar (1):
  mwifiex: Fix NULL pointer dereference in skb_dequeue()

Andrew Price (1):
  gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd

Andy Lutomirski (1):
  x86/entry/64: Remove %ebx handling from error_entry/exit

Anson Huang (1):
  cpufreq: imx6q: add return value check for voltage scale

Arnd Bergmann (1):
  Input: xpad - remove unused function

Arvind Yadav (1):
  Input: xpad - constify usb_device_id

Benjamin Valentin (5):
  Input: xpad - sort supported devices by USB ID
  Input: xpad - sync supported devices with xboxdrv
  Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth
  Input: xpad - sync supported devices with 360Controller
  Input: xpad - sync supported devices with XBCD

Cameron Gutman (11):
  Input: xpad - prevent spurious input from wired Xbox 360 controllers
  Input: xpad - fix rumble on Xbox One controllers with 2015 firmware
  Input: xpad - power off wireless 360 controllers on suspend
  Input: xpad - add product ID for Xbox One S pad
  Input: xpad - fix Xbox One rumble stopping after 2.5 secs
  Input: xpad - don't depend on endpoint order
  Input: xpad - fix stuck mode button on Xbox One S pad
  Input: xpad - restore LED state after device resume
  Input: xpad - support some quirky Xbox One pads
 

Re: Linux 3.18.128

2018-12-01 Thread Greg KH
diff --git a/Makefile b/Makefile
index 7c78eb797de8..9060189af162 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 18
-SUBLEVEL = 127
+SUBLEVEL = 128
 EXTRAVERSION =
 NAME = Diseased Newt
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 37c4fd6aeb7a..42065599d014 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 OBJCOPYFLAGS   :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 GZFLAGS:=-9
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b9d1dfdbe5bb..ae9d3bf79612 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1479,7 +1479,7 @@ static long vphn_get_associativity(unsigned long cpu,
 
switch (rc) {
case H_FUNCTION:
-   printk(KERN_INFO
+   printk_once(KERN_INFO
"VPHN is not supported. Disabling polling...\n");
stop_topology_update();
break;
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index c2d30765bf3d..a4ede00483d1 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -105,8 +105,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, 
unsigned int index)
/* Ensure the arm clock divider is what we expect */
ret = clk_set_rate(arm_clk, new_freq * 1000);
if (ret) {
+   int ret1;
+
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
-   regulator_set_voltage_tol(arm_reg, volt_old, 0);
+   ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0);
+   if (ret1)
+   dev_warn(cpu_dev,
+"failed to restore vddarm voltage: %d\n", 
ret1);
return ret;
}
 
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 9a32d9dfdd26..011700262824 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = {
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+   struct apertures_struct *ap;
+   bool primary = false;
+
+   ap = alloc_apertures(1);
+   if (!ap)
+   return;
+
+   ap->ranges[0].base = pci_resource_start(pdev, 0);
+   ap->ranges[0].size = pci_resource_len(pdev, 0);
+
+#ifdef CONFIG_X86
+   primary = pdev->resource[PCI_ROM_RESOURCE].flags & 
IORESOURCE_ROM_SHADOW;
+#endif
+   remove_conflicting_framebuffers(ap, "astdrmfb", primary);
+   kfree(ap);
+}
+
 static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+   ast_kick_out_firmware_fb(pdev);
+
return drm_get_pci_dev(pdev, ent, );
 }
 
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 9dc0fd5c1ea4..a43d81b6d5d1 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -549,6 +549,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
}
ast_bo_unreserve(bo);
 
+   ast_set_offset_reg(crtc);
ast_set_start_address_crt1(crtc, (u32)gpu_addr);
 
return 0;
@@ -1246,7 +1247,7 @@ static int ast_cursor_move(struct drm_crtc *crtc,
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
 
/* dummy write to fire HWC */
-   ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00);
+   ast_show_cursor(crtc);
 
return 0;
 }
diff --git a/drivers/input/gameport/gameport.c 
b/drivers/input/gameport/gameport.c
index e29c04e2aff4..e853a2134680 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -527,14 +527,14 @@ EXPORT_SYMBOL(gameport_set_phys);
  */
 static void gameport_init_port(struct gameport *gameport)
 {
-   static atomic_t gameport_no = ATOMIC_INIT(0);
+   static atomic_t gameport_no = ATOMIC_INIT(-1);
 
__module_get(THIS_MODULE);
 
mutex_init(>drv_mutex);
device_initialize(>dev);
dev_set_name(>dev, "gameport%lu",
-   (unsigned long)atomic_inc_return(_no) - 1);
+   (unsigned long)atomic_inc_return(_no));
gameport->dev.bus = _bus;
gameport->dev.release = gameport_release_port;
if (gameport->parent)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 1a728f310b27..2e52015634f9 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -31,12 +31,14 @@
  *  - the iForce driverdrivers/char/joystick/iforce.c
  *  - the skeleton-driver  drivers/usb/usb-skeleton.c
  *  - Xbox 360 information http://www.free60.org/wiki/Gamepad
+ *  - Xbox One 

Re: Linux 3.18.128

2018-12-01 Thread Greg KH
diff --git a/Makefile b/Makefile
index 7c78eb797de8..9060189af162 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 18
-SUBLEVEL = 127
+SUBLEVEL = 128
 EXTRAVERSION =
 NAME = Diseased Newt
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 37c4fd6aeb7a..42065599d014 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -10,7 +10,7 @@
 #
 # Copyright (C) 1995-2001 by Russell King
 
-LDFLAGS_vmlinux:=-p --no-undefined -X
+LDFLAGS_vmlinux:=--no-undefined -X
 CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
 OBJCOPYFLAGS   :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 GZFLAGS:=-9
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b9d1dfdbe5bb..ae9d3bf79612 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1479,7 +1479,7 @@ static long vphn_get_associativity(unsigned long cpu,
 
switch (rc) {
case H_FUNCTION:
-   printk(KERN_INFO
+   printk_once(KERN_INFO
"VPHN is not supported. Disabling polling...\n");
stop_topology_update();
break;
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c
index c2d30765bf3d..a4ede00483d1 100644
--- a/drivers/cpufreq/imx6q-cpufreq.c
+++ b/drivers/cpufreq/imx6q-cpufreq.c
@@ -105,8 +105,13 @@ static int imx6q_set_target(struct cpufreq_policy *policy, 
unsigned int index)
/* Ensure the arm clock divider is what we expect */
ret = clk_set_rate(arm_clk, new_freq * 1000);
if (ret) {
+   int ret1;
+
dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
-   regulator_set_voltage_tol(arm_reg, volt_old, 0);
+   ret1 = regulator_set_voltage_tol(arm_reg, volt_old, 0);
+   if (ret1)
+   dev_warn(cpu_dev,
+"failed to restore vddarm voltage: %d\n", 
ret1);
return ret;
}
 
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 9a32d9dfdd26..011700262824 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -60,8 +60,29 @@ static const struct pci_device_id pciidlist[] = {
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
+static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+   struct apertures_struct *ap;
+   bool primary = false;
+
+   ap = alloc_apertures(1);
+   if (!ap)
+   return;
+
+   ap->ranges[0].base = pci_resource_start(pdev, 0);
+   ap->ranges[0].size = pci_resource_len(pdev, 0);
+
+#ifdef CONFIG_X86
+   primary = pdev->resource[PCI_ROM_RESOURCE].flags & 
IORESOURCE_ROM_SHADOW;
+#endif
+   remove_conflicting_framebuffers(ap, "astdrmfb", primary);
+   kfree(ap);
+}
+
 static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+   ast_kick_out_firmware_fb(pdev);
+
return drm_get_pci_dev(pdev, ent, );
 }
 
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 9dc0fd5c1ea4..a43d81b6d5d1 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -549,6 +549,7 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc,
}
ast_bo_unreserve(bo);
 
+   ast_set_offset_reg(crtc);
ast_set_start_address_crt1(crtc, (u32)gpu_addr);
 
return 0;
@@ -1246,7 +1247,7 @@ static int ast_cursor_move(struct drm_crtc *crtc,
ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xc7, ((y >> 8) & 0x07));
 
/* dummy write to fire HWC */
-   ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xCB, 0xFF, 0x00);
+   ast_show_cursor(crtc);
 
return 0;
 }
diff --git a/drivers/input/gameport/gameport.c 
b/drivers/input/gameport/gameport.c
index e29c04e2aff4..e853a2134680 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -527,14 +527,14 @@ EXPORT_SYMBOL(gameport_set_phys);
  */
 static void gameport_init_port(struct gameport *gameport)
 {
-   static atomic_t gameport_no = ATOMIC_INIT(0);
+   static atomic_t gameport_no = ATOMIC_INIT(-1);
 
__module_get(THIS_MODULE);
 
mutex_init(>drv_mutex);
device_initialize(>dev);
dev_set_name(>dev, "gameport%lu",
-   (unsigned long)atomic_inc_return(_no) - 1);
+   (unsigned long)atomic_inc_return(_no));
gameport->dev.bus = _bus;
gameport->dev.release = gameport_release_port;
if (gameport->parent)
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 1a728f310b27..2e52015634f9 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -31,12 +31,14 @@
  *  - the iForce driverdrivers/char/joystick/iforce.c
  *  - the skeleton-driver  drivers/usb/usb-skeleton.c
  *  - Xbox 360 information http://www.free60.org/wiki/Gamepad
+ *  - Xbox One 

Linux 3.18.128

2018-12-01 Thread Greg KH
I'm announcing the release of the 3.18.128 kernel.

All users of the 3.18 kernel series must upgrade.

The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.18.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 arch/arm64/Makefile   |2 
 arch/powerpc/mm/numa.c|2 
 drivers/cpufreq/imx6q-cpufreq.c   |7 
 drivers/gpu/drm/ast/ast_drv.c |   21 
 drivers/gpu/drm/ast/ast_mode.c|3 
 drivers/input/gameport/gameport.c |4 
 drivers/input/joystick/xpad.c | 1422 --
 drivers/input/misc/ims-pcu.c  |4 
 drivers/input/serio/serio.c   |4 
 drivers/input/serio/serio_raw.c   |4 
 drivers/net/can/dev.c |   48 -
 drivers/net/wireless/cw1200/wsm.c |   16 
 drivers/scsi/qla2xxx/qla_os.c |5 
 drivers/scsi/ufs/ufs.h|3 
 drivers/scsi/ufs/ufshcd.c |   72 +
 drivers/tty/n_tty.c   |   19 
 drivers/tty/tty_buffer.c  |2 
 drivers/usb/core/hub.c|4 
 fs/9p/vfs_dir.c   |   11 
 fs/bfs/inode.c|9 
 fs/gfs2/ops_fstype.c  |2 
 include/linux/can/dev.h   |1 
 kernel/debug/kdb/kdb_io.c |   15 
 kernel/debug/kdb/kdb_private.h|2 
 kernel/debug/kdb/kdb_support.c|   10 
 mm/shmem.c|4 
 net/llc/af_llc.c  |   11 
 net/sctp/associola.c  |   10 
 net/sunrpc/auth_generic.c |8 
 net/unix/af_unix.c|   27 
 31 files changed, 1289 insertions(+), 465 deletions(-)

Andrew Price (1):
  gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd

Aniroop Mathur (1):
  Input: initialize device counter variables with -1

Anson Huang (1):
  cpufreq: imx6q: add return value check for voltage scale

Arnd Bergmann (1):
  Input: xpad - remove unused function

Arvind Yadav (1):
  Input: xpad - constify usb_device_id

Benjamin Valentin (5):
  Input: xpad - sort supported devices by USB ID
  Input: xpad - sync supported devices with xboxdrv
  Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth
  Input: xpad - sync supported devices with 360Controller
  Input: xpad - sync supported devices with XBCD

Cameron Gutman (12):
  Input: xpad - prevent spurious input from wired Xbox 360 controllers
  Input: xpad - fix rumble on Xbox One controllers with 2015 firmware
  Input: xpad - fix oops when attaching an unknown Xbox One gamepad
  Input: xpad - power off wireless 360 controllers on suspend
  Input: xpad - add product ID for Xbox One S pad
  Input: xpad - fix Xbox One rumble stopping after 2.5 secs
  Input: xpad - don't depend on endpoint order
  Input: xpad - fix stuck mode button on Xbox One S pad
  Input: xpad - restore LED state after device resume
  Input: xpad - support some quirky Xbox One pads
  Input: xpad - fix PowerA init quirk for some gamepad models
  Input: xpad - validate USB endpoint type during probe

Clement Calmels (1):
  Input: xpad - remove spurious events of wireless xpad 360 controller

Daniel Tobias (2):
  Input: xpad - correctly sort vendor id's
  Input: xpad - move reporting xbox one home button to common function

Dario Scarpa (1):
  Input: xpad - fix Razer Atrox Arcade Stick button mapping

Dennis Wassenberg (1):
  usb: core: Fix hub port connection events lost

Dmitry Torokhov (1):
  Input: xpad - use LED API when identifying wireless controllers

Dominique Martinet (1):
  v9fs_dir_readdir: fix double-free on p9stat_read error

Enno Boland (1):
  Input: xpad - fix GPD Win 2 controller name

Eric Dumazet (1):
  llc: do not use sk_eat_skb()

Erik Lundgren (1):
  Input: xpad - add Covert Forces edition of the Xbox One controller

Ethan Lee (1):
  Input: xpad - add GPD Win 2 Controller USB IDs

Francis Therien (1):
  Input: xpad - add PDP device id 0x02a4

Greg Hackmann (1):
  arm64: remove no-op -p linker flag

Greg Kroah-Hartman (2):
  tty: wipe buffer if not echoing data
  Linux 3.18.128

Johannes Thumshirn (1):
  cw1200: Don't leak memory if krealloc failes

Leo Sperling (1):
  Input: xpad - fix some coding style issues

Linus Torvalds (1):
  tty: wipe buffer.

Marc Kleine-Budde (4):
  can: dev: can_get_echo_skb(): factor out non sending code to 
__can_get_echo_skb()
  can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame 
to access frame length
  can: dev: __can_get_echo_skb(): Don't crash the kernel if 
can_priv::echo_skb is accessed out of bounds
  can: dev: __can_get_echo_skb(): print error message, if trying to echo 
non 

Linux 3.18.128

2018-12-01 Thread Greg KH
I'm announcing the release of the 3.18.128 kernel.

All users of the 3.18 kernel series must upgrade.

The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-3.18.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 arch/arm64/Makefile   |2 
 arch/powerpc/mm/numa.c|2 
 drivers/cpufreq/imx6q-cpufreq.c   |7 
 drivers/gpu/drm/ast/ast_drv.c |   21 
 drivers/gpu/drm/ast/ast_mode.c|3 
 drivers/input/gameport/gameport.c |4 
 drivers/input/joystick/xpad.c | 1422 --
 drivers/input/misc/ims-pcu.c  |4 
 drivers/input/serio/serio.c   |4 
 drivers/input/serio/serio_raw.c   |4 
 drivers/net/can/dev.c |   48 -
 drivers/net/wireless/cw1200/wsm.c |   16 
 drivers/scsi/qla2xxx/qla_os.c |5 
 drivers/scsi/ufs/ufs.h|3 
 drivers/scsi/ufs/ufshcd.c |   72 +
 drivers/tty/n_tty.c   |   19 
 drivers/tty/tty_buffer.c  |2 
 drivers/usb/core/hub.c|4 
 fs/9p/vfs_dir.c   |   11 
 fs/bfs/inode.c|9 
 fs/gfs2/ops_fstype.c  |2 
 include/linux/can/dev.h   |1 
 kernel/debug/kdb/kdb_io.c |   15 
 kernel/debug/kdb/kdb_private.h|2 
 kernel/debug/kdb/kdb_support.c|   10 
 mm/shmem.c|4 
 net/llc/af_llc.c  |   11 
 net/sctp/associola.c  |   10 
 net/sunrpc/auth_generic.c |8 
 net/unix/af_unix.c|   27 
 31 files changed, 1289 insertions(+), 465 deletions(-)

Andrew Price (1):
  gfs2: Don't leave s_fs_info pointing to freed memory in init_sbd

Aniroop Mathur (1):
  Input: initialize device counter variables with -1

Anson Huang (1):
  cpufreq: imx6q: add return value check for voltage scale

Arnd Bergmann (1):
  Input: xpad - remove unused function

Arvind Yadav (1):
  Input: xpad - constify usb_device_id

Benjamin Valentin (5):
  Input: xpad - sort supported devices by USB ID
  Input: xpad - sync supported devices with xboxdrv
  Input: xpad - add USB IDs for Mad Catz Brawlstick and Razer Sabertooth
  Input: xpad - sync supported devices with 360Controller
  Input: xpad - sync supported devices with XBCD

Cameron Gutman (12):
  Input: xpad - prevent spurious input from wired Xbox 360 controllers
  Input: xpad - fix rumble on Xbox One controllers with 2015 firmware
  Input: xpad - fix oops when attaching an unknown Xbox One gamepad
  Input: xpad - power off wireless 360 controllers on suspend
  Input: xpad - add product ID for Xbox One S pad
  Input: xpad - fix Xbox One rumble stopping after 2.5 secs
  Input: xpad - don't depend on endpoint order
  Input: xpad - fix stuck mode button on Xbox One S pad
  Input: xpad - restore LED state after device resume
  Input: xpad - support some quirky Xbox One pads
  Input: xpad - fix PowerA init quirk for some gamepad models
  Input: xpad - validate USB endpoint type during probe

Clement Calmels (1):
  Input: xpad - remove spurious events of wireless xpad 360 controller

Daniel Tobias (2):
  Input: xpad - correctly sort vendor id's
  Input: xpad - move reporting xbox one home button to common function

Dario Scarpa (1):
  Input: xpad - fix Razer Atrox Arcade Stick button mapping

Dennis Wassenberg (1):
  usb: core: Fix hub port connection events lost

Dmitry Torokhov (1):
  Input: xpad - use LED API when identifying wireless controllers

Dominique Martinet (1):
  v9fs_dir_readdir: fix double-free on p9stat_read error

Enno Boland (1):
  Input: xpad - fix GPD Win 2 controller name

Eric Dumazet (1):
  llc: do not use sk_eat_skb()

Erik Lundgren (1):
  Input: xpad - add Covert Forces edition of the Xbox One controller

Ethan Lee (1):
  Input: xpad - add GPD Win 2 Controller USB IDs

Francis Therien (1):
  Input: xpad - add PDP device id 0x02a4

Greg Hackmann (1):
  arm64: remove no-op -p linker flag

Greg Kroah-Hartman (2):
  tty: wipe buffer if not echoing data
  Linux 3.18.128

Johannes Thumshirn (1):
  cw1200: Don't leak memory if krealloc failes

Leo Sperling (1):
  Input: xpad - fix some coding style issues

Linus Torvalds (1):
  tty: wipe buffer.

Marc Kleine-Budde (4):
  can: dev: can_get_echo_skb(): factor out non sending code to 
__can_get_echo_skb()
  can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame 
to access frame length
  can: dev: __can_get_echo_skb(): Don't crash the kernel if 
can_priv::echo_skb is accessed out of bounds
  can: dev: __can_get_echo_skb(): print error message, if trying to echo 
non 

Re: [PATCH] drop silly "static inline asmlinkage" from dump_stack()

2018-12-01 Thread Joey Pabalinas
On Sat, Nov 24, 2018 at 12:35:30PM +0300, Alexey Dobriyan wrote:
> -static inline asmlinkage void dump_stack(void)
> +static inline void dump_stack(void)

Why is it "silly"? An explanation in the commit message would be useful.

> Signed-off-by: Alexey Dobriyan 
> ---
> 
>  include/linux/printk.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -269,7 +269,7 @@ static inline void show_regs_print_info(const char 
> *log_lvl)
>  {
>  }
>  
> -static inline asmlinkage void dump_stack(void)
> +static inline void dump_stack(void)
>  {
>  }
>  

-- 
Cheers,
Joey Pabalinas


signature.asc
Description: PGP signature


Re: [PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Frank Lee
On Sun, Dec 2, 2018 at 3:18 PM Boris Brezillon
 wrote:
>
> On Sat,  1 Dec 2018 20:54:17 -0500
> Yangtao Li  wrote:
>
> > We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
> > such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
> > to simplify some code.
> >
> > Signed-off-by: Yangtao Li 
> > ---
> > Changes in v2:
> > -Remove a missing DEBUGFS_RO_ATTR
> > ---
> >  drivers/mtd/devices/docg3.c| 20 
> >  drivers/mtd/devices/docg3.h| 11 ---
> >  drivers/mtd/mtdswap.c  | 12 +---
> >  drivers/mtd/nand/raw/nandsim.c | 16 +++-
> >  4 files changed, 16 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> > index 512bd4c2eec0..80143972963e 100644
> > --- a/drivers/mtd/devices/docg3.c
> > +++ b/drivers/mtd/devices/docg3.c
> > @@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct 
> > platform_device *pdev,
> >  /*
> >   * Debug sysfs entries
> >   */
> > -static int dbg_flashctrl_show(struct seq_file *s, void *p)
> > +static int flashcontrol_show(struct seq_file *s, void *p)
> >  {
> >   struct docg3 *docg3 = (struct docg3 *)s->private;
> >
> > @@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, 
> > void *p)
> >
> >   return 0;
> >  }
> > -DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
> >
> > -static int dbg_asicmode_show(struct seq_file *s, void *p)
> > +DEFINE_SHOW_ATTRIBUTE(flashcontrol);
>
> Just nitpicking, but can you remove the blank line between the function
> definition and DEFINE_SHOW_ATTRIBUTE()?
The third edition has been sent, can you review it?

Yours,
Yangtao


Re: [PATCH] [repost] Drivers: hv: vmbus: Offload the handling of channels to two workqueues

2018-12-01 Thread gre...@linuxfoundation.org
On Fri, Nov 30, 2018 at 06:09:54PM +, Dexuan Cui wrote:
> > From: KY Srinivasan 
> > Sent: Friday, November 30, 2018 9:31 AM
> > > From: Dexuan Cui 
> > > Sent: Thursday, November 29, 2018 12:17 AM
> > > To: gre...@linuxfoundation.org
> > > Cc: KY Srinivasan ; Haiyang Zhang
> > > ; Stephen Hemminger
> > > ; linux-kernel@vger.kernel.org;
> > > de...@linuxdriverproject.org; a...@canonical.com; vkuznets
> > > ; o...@aepfle.de; jasow...@redhat.com; Michael
> > > Kelley 
> > > Subject: RE: [PATCH] [repost] Drivers: hv: vmbus: Offload the handling of
> > > channels to two workqueues
> > >
> > > > From: gre...@linuxfoundation.org 
> > > > Sent: Wednesday, November 28, 2018 11:45 PM
> > > > >
> > > > > There is no change in this repost. I just rebased this patch to 
> > > > > today's
> > > > > char-misc's char-misc-next branch. Previously KY posted the patch with
> > > his
> > > > > Signed-off-by (which is kept in this repost), but there was a 
> > > > > conflict issue.
> > > > >
> > > > > Note: the patch can't be cleanly applied to char-misc's 
> > > > > char-misc-linus
> > > branch
> > > > --
> > > > > to do that, we need to cherry-pick the supporting patch first:
> > > > > 4d3c5c69191f ("Drivers: hv: vmbus: Remove the useless API
> > > > vmbus_get_outgoing_channel()")
> > > >
> > > > That is not going to work for the obvious reason that this dependant
> > > > patch is not going to be merged into 4.20-final.
> > >
> > > It looks the dependent patch (4d3c5c69191f) is going to miss the v4.20
> > > release.
> > > This is not a big issue, as the dependent patch isn't really important.
> > >
> > > > So, what do you expect us to do here?  The only way this can be accepted
> > > > is to have it go into my -next branch, which means it will show up in
> > > > 4.21-rc1, is that ok?
> > >
> > > Is there any chance for this patch ("Drivers: hv: vmbus: Offload the 
> > > handling
> > > ...") to
> > > go into v4.20?
> > >
> > > If yes, I can quickly do a rebase to char-misc's char-misc-linus branch,
> > > because actually the conflict can be very easily fixed. And I can help to 
> > > fix any
> > > conflict when the dependent patch is backported to v4.20.1.
> > 
> > This patch fixes an important bug while the patch this depends on is not
> > critical.
> > I suggest we revert the patch that this patch depends on
> > and we can submit a new version of this patch that can go in now - into 4.20
> > release.
> > 
> > K. Y
> 
> I agree.
> 
> Hi Greg,
> Please let us know what we can do to try to push this important fix into 
> v4.20.
> 
> Actually it's straightforward, though it looks big. And, we ave done a full 
> testing
> with the patch.

Ok, you all need to figure this out on your own, sorry.  Please give me
a patch that I can actually apply to the tree if you need it merged into
4.20-final.  This shouldn't be tough, you all have been doing this long
enough by now...

I have no bandwidth to do this myself for you,

greg k-h


Re: [PATCH] drop silly "static inline asmlinkage" from dump_stack()

2018-12-01 Thread Joey Pabalinas
On Sat, Nov 24, 2018 at 12:35:30PM +0300, Alexey Dobriyan wrote:
> -static inline asmlinkage void dump_stack(void)
> +static inline void dump_stack(void)

Why is it "silly"? An explanation in the commit message would be useful.

> Signed-off-by: Alexey Dobriyan 
> ---
> 
>  include/linux/printk.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -269,7 +269,7 @@ static inline void show_regs_print_info(const char 
> *log_lvl)
>  {
>  }
>  
> -static inline asmlinkage void dump_stack(void)
> +static inline void dump_stack(void)
>  {
>  }
>  

-- 
Cheers,
Joey Pabalinas


signature.asc
Description: PGP signature


Re: [PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Frank Lee
On Sun, Dec 2, 2018 at 3:18 PM Boris Brezillon
 wrote:
>
> On Sat,  1 Dec 2018 20:54:17 -0500
> Yangtao Li  wrote:
>
> > We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
> > such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
> > to simplify some code.
> >
> > Signed-off-by: Yangtao Li 
> > ---
> > Changes in v2:
> > -Remove a missing DEBUGFS_RO_ATTR
> > ---
> >  drivers/mtd/devices/docg3.c| 20 
> >  drivers/mtd/devices/docg3.h| 11 ---
> >  drivers/mtd/mtdswap.c  | 12 +---
> >  drivers/mtd/nand/raw/nandsim.c | 16 +++-
> >  4 files changed, 16 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> > index 512bd4c2eec0..80143972963e 100644
> > --- a/drivers/mtd/devices/docg3.c
> > +++ b/drivers/mtd/devices/docg3.c
> > @@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct 
> > platform_device *pdev,
> >  /*
> >   * Debug sysfs entries
> >   */
> > -static int dbg_flashctrl_show(struct seq_file *s, void *p)
> > +static int flashcontrol_show(struct seq_file *s, void *p)
> >  {
> >   struct docg3 *docg3 = (struct docg3 *)s->private;
> >
> > @@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, 
> > void *p)
> >
> >   return 0;
> >  }
> > -DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
> >
> > -static int dbg_asicmode_show(struct seq_file *s, void *p)
> > +DEFINE_SHOW_ATTRIBUTE(flashcontrol);
>
> Just nitpicking, but can you remove the blank line between the function
> definition and DEFINE_SHOW_ATTRIBUTE()?
The third edition has been sent, can you review it?

Yours,
Yangtao


Re: [PATCH] [repost] Drivers: hv: vmbus: Offload the handling of channels to two workqueues

2018-12-01 Thread gre...@linuxfoundation.org
On Fri, Nov 30, 2018 at 06:09:54PM +, Dexuan Cui wrote:
> > From: KY Srinivasan 
> > Sent: Friday, November 30, 2018 9:31 AM
> > > From: Dexuan Cui 
> > > Sent: Thursday, November 29, 2018 12:17 AM
> > > To: gre...@linuxfoundation.org
> > > Cc: KY Srinivasan ; Haiyang Zhang
> > > ; Stephen Hemminger
> > > ; linux-kernel@vger.kernel.org;
> > > de...@linuxdriverproject.org; a...@canonical.com; vkuznets
> > > ; o...@aepfle.de; jasow...@redhat.com; Michael
> > > Kelley 
> > > Subject: RE: [PATCH] [repost] Drivers: hv: vmbus: Offload the handling of
> > > channels to two workqueues
> > >
> > > > From: gre...@linuxfoundation.org 
> > > > Sent: Wednesday, November 28, 2018 11:45 PM
> > > > >
> > > > > There is no change in this repost. I just rebased this patch to 
> > > > > today's
> > > > > char-misc's char-misc-next branch. Previously KY posted the patch with
> > > his
> > > > > Signed-off-by (which is kept in this repost), but there was a 
> > > > > conflict issue.
> > > > >
> > > > > Note: the patch can't be cleanly applied to char-misc's 
> > > > > char-misc-linus
> > > branch
> > > > --
> > > > > to do that, we need to cherry-pick the supporting patch first:
> > > > > 4d3c5c69191f ("Drivers: hv: vmbus: Remove the useless API
> > > > vmbus_get_outgoing_channel()")
> > > >
> > > > That is not going to work for the obvious reason that this dependant
> > > > patch is not going to be merged into 4.20-final.
> > >
> > > It looks the dependent patch (4d3c5c69191f) is going to miss the v4.20
> > > release.
> > > This is not a big issue, as the dependent patch isn't really important.
> > >
> > > > So, what do you expect us to do here?  The only way this can be accepted
> > > > is to have it go into my -next branch, which means it will show up in
> > > > 4.21-rc1, is that ok?
> > >
> > > Is there any chance for this patch ("Drivers: hv: vmbus: Offload the 
> > > handling
> > > ...") to
> > > go into v4.20?
> > >
> > > If yes, I can quickly do a rebase to char-misc's char-misc-linus branch,
> > > because actually the conflict can be very easily fixed. And I can help to 
> > > fix any
> > > conflict when the dependent patch is backported to v4.20.1.
> > 
> > This patch fixes an important bug while the patch this depends on is not
> > critical.
> > I suggest we revert the patch that this patch depends on
> > and we can submit a new version of this patch that can go in now - into 4.20
> > release.
> > 
> > K. Y
> 
> I agree.
> 
> Hi Greg,
> Please let us know what we can do to try to push this important fix into 
> v4.20.
> 
> Actually it's straightforward, though it looks big. And, we ave done a full 
> testing
> with the patch.

Ok, you all need to figure this out on your own, sorry.  Please give me
a patch that I can actually apply to the tree if you need it merged into
4.20-final.  This shouldn't be tough, you all have been doing this long
enough by now...

I have no bandwidth to do this myself for you,

greg k-h


[PATCH v3] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Yangtao Li
We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
to simplify some code.

Signed-off-by: Yangtao Li 
---
changes in v3:
-remove the blank line between the function
 definition and DEFINE_SHOW_ATTRIBUTE()
---
 drivers/mtd/devices/docg3.c| 16 
 drivers/mtd/devices/docg3.h| 11 ---
 drivers/mtd/mtdswap.c  | 13 +
 drivers/mtd/nand/raw/nandsim.c | 17 +++--
 4 files changed, 12 insertions(+), 45 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 512bd4c2eec0..4c94fc096696 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
*pdev,
 /*
  * Debug sysfs entries
  */
-static int dbg_flashctrl_show(struct seq_file *s, void *p)
+static int flashcontrol_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1623,9 +1623,9 @@ static int dbg_flashctrl_show(struct seq_file *s, void *p)
 
return 0;
 }
-DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
+DEFINE_SHOW_ATTRIBUTE(flashcontrol);
 
-static int dbg_asicmode_show(struct seq_file *s, void *p)
+static int asic_mode_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1660,9 +1660,9 @@ static int dbg_asicmode_show(struct seq_file *s, void *p)
seq_puts(s, ")\n");
return 0;
 }
-DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
+DEFINE_SHOW_ATTRIBUTE(asic_mode);
 
-static int dbg_device_id_show(struct seq_file *s, void *p)
+static int device_id_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int id;
@@ -1674,9 +1674,9 @@ static int dbg_device_id_show(struct seq_file *s, void *p)
seq_printf(s, "DeviceId = %d\n", id);
return 0;
 }
-DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
+DEFINE_SHOW_ATTRIBUTE(device_id);
 
-static int dbg_protection_show(struct seq_file *s, void *p)
+static int protection_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int protect, dps0, dps0_low, dps0_high, dps1, dps1_low, dps1_high;
@@ -1726,7 +1726,7 @@ static int dbg_protection_show(struct seq_file *s, void 
*p)
   !!(dps1 & DOC_DPS_KEY_OK));
return 0;
 }
-DEBUGFS_RO_ATTR(protection, dbg_protection_show);
+DEFINE_SHOW_ATTRIBUTE(protection);
 
 static void __init doc_dbg_register(struct mtd_info *floor)
 {
diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h
index e99946575398..e16dca23655b 100644
--- a/drivers/mtd/devices/docg3.h
+++ b/drivers/mtd/devices/docg3.h
@@ -317,17 +317,6 @@ struct docg3 {
 #define doc_info(fmt, arg...) dev_info(docg3->dev, (fmt), ## arg)
 #define doc_dbg(fmt, arg...) dev_dbg(docg3->dev, (fmt), ## arg)
 #define doc_vdbg(fmt, arg...) dev_vdbg(docg3->dev, (fmt), ## arg)
-
-#define DEBUGFS_RO_ATTR(name, show_fct) \
-   static int name##_open(struct inode *inode, struct file *file) \
-   { return single_open(file, show_fct, inode->i_private); }  \
-   static const struct file_operations name##_fops = { \
-   .owner = THIS_MODULE, \
-   .open = name##_open, \
-   .llseek = seq_lseek, \
-   .read = seq_read, \
-   .release = single_release \
-   };
 #endif
 
 /*
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index d9dcb2d051b4..d162d1717fad 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1265,18 +1265,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
 
return 0;
 }
-
-static int mtdswap_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, mtdswap_show, inode->i_private);
-}
-
-static const struct file_operations mtdswap_fops = {
-   .open   = mtdswap_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(mtdswap);
 
 static int mtdswap_add_debugfs(struct mtdswap_dev *d)
 {
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index c452819f6123..ef8721418f2d 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -443,7 +443,7 @@ static unsigned long total_wear = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static int nandsim_debugfs_show(struct seq_file *m, void *private)
+static int nandsim_show(struct seq_file *m, void *private)
 {
unsigned long wmin = -1, wmax = 0, avg;
unsigned long deciles[10], decile_max[10], tot = 0;
@@ -494,18 +494,7 @@ static int nandsim_debugfs_show(struct seq_file *m, void 
*private)
 
return 0;
 }
-
-static int nandsim_debugfs_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, 

[PATCH v3] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Yangtao Li
We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
to simplify some code.

Signed-off-by: Yangtao Li 
---
changes in v3:
-remove the blank line between the function
 definition and DEFINE_SHOW_ATTRIBUTE()
---
 drivers/mtd/devices/docg3.c| 16 
 drivers/mtd/devices/docg3.h| 11 ---
 drivers/mtd/mtdswap.c  | 13 +
 drivers/mtd/nand/raw/nandsim.c | 17 +++--
 4 files changed, 12 insertions(+), 45 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 512bd4c2eec0..4c94fc096696 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
*pdev,
 /*
  * Debug sysfs entries
  */
-static int dbg_flashctrl_show(struct seq_file *s, void *p)
+static int flashcontrol_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1623,9 +1623,9 @@ static int dbg_flashctrl_show(struct seq_file *s, void *p)
 
return 0;
 }
-DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
+DEFINE_SHOW_ATTRIBUTE(flashcontrol);
 
-static int dbg_asicmode_show(struct seq_file *s, void *p)
+static int asic_mode_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1660,9 +1660,9 @@ static int dbg_asicmode_show(struct seq_file *s, void *p)
seq_puts(s, ")\n");
return 0;
 }
-DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
+DEFINE_SHOW_ATTRIBUTE(asic_mode);
 
-static int dbg_device_id_show(struct seq_file *s, void *p)
+static int device_id_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int id;
@@ -1674,9 +1674,9 @@ static int dbg_device_id_show(struct seq_file *s, void *p)
seq_printf(s, "DeviceId = %d\n", id);
return 0;
 }
-DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
+DEFINE_SHOW_ATTRIBUTE(device_id);
 
-static int dbg_protection_show(struct seq_file *s, void *p)
+static int protection_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int protect, dps0, dps0_low, dps0_high, dps1, dps1_low, dps1_high;
@@ -1726,7 +1726,7 @@ static int dbg_protection_show(struct seq_file *s, void 
*p)
   !!(dps1 & DOC_DPS_KEY_OK));
return 0;
 }
-DEBUGFS_RO_ATTR(protection, dbg_protection_show);
+DEFINE_SHOW_ATTRIBUTE(protection);
 
 static void __init doc_dbg_register(struct mtd_info *floor)
 {
diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h
index e99946575398..e16dca23655b 100644
--- a/drivers/mtd/devices/docg3.h
+++ b/drivers/mtd/devices/docg3.h
@@ -317,17 +317,6 @@ struct docg3 {
 #define doc_info(fmt, arg...) dev_info(docg3->dev, (fmt), ## arg)
 #define doc_dbg(fmt, arg...) dev_dbg(docg3->dev, (fmt), ## arg)
 #define doc_vdbg(fmt, arg...) dev_vdbg(docg3->dev, (fmt), ## arg)
-
-#define DEBUGFS_RO_ATTR(name, show_fct) \
-   static int name##_open(struct inode *inode, struct file *file) \
-   { return single_open(file, show_fct, inode->i_private); }  \
-   static const struct file_operations name##_fops = { \
-   .owner = THIS_MODULE, \
-   .open = name##_open, \
-   .llseek = seq_lseek, \
-   .read = seq_read, \
-   .release = single_release \
-   };
 #endif
 
 /*
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index d9dcb2d051b4..d162d1717fad 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1265,18 +1265,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
 
return 0;
 }
-
-static int mtdswap_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, mtdswap_show, inode->i_private);
-}
-
-static const struct file_operations mtdswap_fops = {
-   .open   = mtdswap_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(mtdswap);
 
 static int mtdswap_add_debugfs(struct mtdswap_dev *d)
 {
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index c452819f6123..ef8721418f2d 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -443,7 +443,7 @@ static unsigned long total_wear = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static int nandsim_debugfs_show(struct seq_file *m, void *private)
+static int nandsim_show(struct seq_file *m, void *private)
 {
unsigned long wmin = -1, wmax = 0, avg;
unsigned long deciles[10], decile_max[10], tot = 0;
@@ -494,18 +494,7 @@ static int nandsim_debugfs_show(struct seq_file *m, void 
*private)
 
return 0;
 }
-
-static int nandsim_debugfs_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, 

Re: [PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Boris Brezillon
On Sat,  1 Dec 2018 20:54:17 -0500
Yangtao Li  wrote:

> We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
> such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
> to simplify some code.
> 
> Signed-off-by: Yangtao Li 
> ---
> Changes in v2:
> -Remove a missing DEBUGFS_RO_ATTR
> ---
>  drivers/mtd/devices/docg3.c| 20 
>  drivers/mtd/devices/docg3.h| 11 ---
>  drivers/mtd/mtdswap.c  | 12 +---
>  drivers/mtd/nand/raw/nandsim.c | 16 +++-
>  4 files changed, 16 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> index 512bd4c2eec0..80143972963e 100644
> --- a/drivers/mtd/devices/docg3.c
> +++ b/drivers/mtd/devices/docg3.c
> @@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
> *pdev,
>  /*
>   * Debug sysfs entries
>   */
> -static int dbg_flashctrl_show(struct seq_file *s, void *p)
> +static int flashcontrol_show(struct seq_file *s, void *p)
>  {
>   struct docg3 *docg3 = (struct docg3 *)s->private;
>  
> @@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, void 
> *p)
>  
>   return 0;
>  }
> -DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
>  
> -static int dbg_asicmode_show(struct seq_file *s, void *p)
> +DEFINE_SHOW_ATTRIBUTE(flashcontrol);

Just nitpicking, but can you remove the blank line between the function
definition and DEFINE_SHOW_ATTRIBUTE()?


Re: [PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Boris Brezillon
On Sat,  1 Dec 2018 20:54:17 -0500
Yangtao Li  wrote:

> We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
> such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
> to simplify some code.
> 
> Signed-off-by: Yangtao Li 
> ---
> Changes in v2:
> -Remove a missing DEBUGFS_RO_ATTR
> ---
>  drivers/mtd/devices/docg3.c| 20 
>  drivers/mtd/devices/docg3.h| 11 ---
>  drivers/mtd/mtdswap.c  | 12 +---
>  drivers/mtd/nand/raw/nandsim.c | 16 +++-
>  4 files changed, 16 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
> index 512bd4c2eec0..80143972963e 100644
> --- a/drivers/mtd/devices/docg3.c
> +++ b/drivers/mtd/devices/docg3.c
> @@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
> *pdev,
>  /*
>   * Debug sysfs entries
>   */
> -static int dbg_flashctrl_show(struct seq_file *s, void *p)
> +static int flashcontrol_show(struct seq_file *s, void *p)
>  {
>   struct docg3 *docg3 = (struct docg3 *)s->private;
>  
> @@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, void 
> *p)
>  
>   return 0;
>  }
> -DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
>  
> -static int dbg_asicmode_show(struct seq_file *s, void *p)
> +DEFINE_SHOW_ATTRIBUTE(flashcontrol);

Just nitpicking, but can you remove the blank line between the function
definition and DEFINE_SHOW_ATTRIBUTE()?


RE: Fwd: [Bug 201647] New: Intel Wireless card 3165 does not get detected but bluetooth works

2018-12-01 Thread Grumbach, Emmanuel
> 
> [+cc Emmanuel, LKML]
> 
> On Fri, Nov 09, 2018 at 03:43:06PM -0600, Bjorn Helgaas wrote:
> > -- Forwarded message -
> > From: 
> > Date: Fri, Nov 9, 2018 at 4:10 AM
> > Subject: [Bug 201647] New: Intel Wireless card 3165 does not get
> > detected but bluetooth works
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=201647
> >
> > Bug ID: 201647
> >Summary: Intel Wireless card 3165 does not get detected but
> > bluetooth works
> >Product: Drivers
> >Version: 2.5
> > Kernel Version: 4.19.1
> >   Hardware: Intel
> > OS: Linux
> >   Tree: Mainline
> > Status: NEW
> >   Severity: high
> >   Priority: P1
> >  Component: PCI
> >   Assignee: drivers_...@kernel-bugs.osdl.org
> >   Reporter: mertar...@gmail.com
> > Regression: No
> >
> > This bug affects most of the devices with a Celeron N4000 and an Intel
> > wifi 3165 Ac adapter.
> >
> > When using Linux wifi is not working however, Bluetooth is working
> > fine.  Also, Bluetooth part of this chip is connected via btusb and
> > the wifi part of this chip is connected via PCIe.
> 
> Can you attach a screenshot of the Windows 10 device manager info for the
> wifi adapter to the bugzilla?  If you can get a raw hex dump of its config
> space, that would be awesome.
> 
> Also attach a copy of your kernel .config file (typically in /boot/).
> 
> My only guess is that maybe the system keeps wifi completely powered
> down and uses hotplug to add it when needed.  [1] mentions wifi being on
> pcibus 1 under Windows.  Your lspci does show bridge 00:13.0 leading to bus
> 01, but Linux doesn't find any devices on bus 01.
> 
> Hotplug could be done via either acpiphp (ACPI mediated hotplug) or pciehp
> (native PCIe hotplug).  Your dmesg shows you do have acpiphp.
> 
> I can't tell about pciehp (your .config will show that), but I think pciehp 
> will
> only claim bridges where SltCap contains HotPlug+, and yours shows HotPlug-
> , so I don't think pciehp will do anything on your system.
> 
> Even if the system does use hotplug, I don't know what mechanism the OS
> would use to wake up the device, since we don't know it even exists.  I guess
> there could be some magic switch accessible via USB.
> But if that were the case, I'm sure Emmanuel would know about it.
> 

Hm... Don't be so sure... :)
I don't think we have anything as fancy as this.
I guess you can try to dig into the BIOS settings?
I have heard of such a switch that would make the device disappear.



RE: Fwd: [Bug 201647] New: Intel Wireless card 3165 does not get detected but bluetooth works

2018-12-01 Thread Grumbach, Emmanuel
> 
> [+cc Emmanuel, LKML]
> 
> On Fri, Nov 09, 2018 at 03:43:06PM -0600, Bjorn Helgaas wrote:
> > -- Forwarded message -
> > From: 
> > Date: Fri, Nov 9, 2018 at 4:10 AM
> > Subject: [Bug 201647] New: Intel Wireless card 3165 does not get
> > detected but bluetooth works
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=201647
> >
> > Bug ID: 201647
> >Summary: Intel Wireless card 3165 does not get detected but
> > bluetooth works
> >Product: Drivers
> >Version: 2.5
> > Kernel Version: 4.19.1
> >   Hardware: Intel
> > OS: Linux
> >   Tree: Mainline
> > Status: NEW
> >   Severity: high
> >   Priority: P1
> >  Component: PCI
> >   Assignee: drivers_...@kernel-bugs.osdl.org
> >   Reporter: mertar...@gmail.com
> > Regression: No
> >
> > This bug affects most of the devices with a Celeron N4000 and an Intel
> > wifi 3165 Ac adapter.
> >
> > When using Linux wifi is not working however, Bluetooth is working
> > fine.  Also, Bluetooth part of this chip is connected via btusb and
> > the wifi part of this chip is connected via PCIe.
> 
> Can you attach a screenshot of the Windows 10 device manager info for the
> wifi adapter to the bugzilla?  If you can get a raw hex dump of its config
> space, that would be awesome.
> 
> Also attach a copy of your kernel .config file (typically in /boot/).
> 
> My only guess is that maybe the system keeps wifi completely powered
> down and uses hotplug to add it when needed.  [1] mentions wifi being on
> pcibus 1 under Windows.  Your lspci does show bridge 00:13.0 leading to bus
> 01, but Linux doesn't find any devices on bus 01.
> 
> Hotplug could be done via either acpiphp (ACPI mediated hotplug) or pciehp
> (native PCIe hotplug).  Your dmesg shows you do have acpiphp.
> 
> I can't tell about pciehp (your .config will show that), but I think pciehp 
> will
> only claim bridges where SltCap contains HotPlug+, and yours shows HotPlug-
> , so I don't think pciehp will do anything on your system.
> 
> Even if the system does use hotplug, I don't know what mechanism the OS
> would use to wake up the device, since we don't know it even exists.  I guess
> there could be some magic switch accessible via USB.
> But if that were the case, I'm sure Emmanuel would know about it.
> 

Hm... Don't be so sure... :)
I don't think we have anything as fancy as this.
I guess you can try to dig into the BIOS settings?
I have heard of such a switch that would make the device disappear.



Re: [PATCH v2 5/5] x86/mm: Drop usage of __flush_tlb_all() in kernel_physical_mapping_init()

2018-12-01 Thread Sasha Levin

On Fri, Nov 30, 2018 at 04:35:32PM -0800, Dan Williams wrote:

Commit f77084d96355 "x86/mm/pat: Disable preemption around
__flush_tlb_all()" addressed a case where __flush_tlb_all() is called
without preemption being disabled. It also left a warning to catch other
cases where preemption is not disabled. That warning triggers for the
memory hotplug path which is also used for persistent memory enabling:

WARNING: CPU: 35 PID: 911 at ./arch/x86/include/asm/tlbflush.h:460
RIP: 0010:__flush_tlb_all+0x1b/0x3a
[..]
Call Trace:
 phys_pud_init+0x29c/0x2bb
 kernel_physical_mapping_init+0xfc/0x219
 init_memory_mapping+0x1a5/0x3b0
 arch_add_memory+0x2c/0x50
 devm_memremap_pages+0x3aa/0x610
 pmem_attach_disk+0x585/0x700 [nd_pmem]

Andy wondered why a path that can sleep was using __flush_tlb_all() [1]
and Dave confirmed the expectation for TLB flush is for modifying /
invalidating existing pte entries, but not initial population [2]. Drop
the usage of __flush_tlb_all() in phys_{p4d,pud,pmd}_init() on the
expectation that this path is only ever populating empty entries for the
linear map. Note, at linear map teardown time there is a call to the
all-cpu flush_tlb_all() to invalidate the removed mappings.

[1]: 
https://lore.kernel.org/lkml/9dfd717d-857d-493d-a606-b635d72ba...@amacapital.net
[2]: https://lore.kernel.org/lkml/749919a4-cdb1-48a3-adb4-adb81a5fa...@intel.com

Fixes: f77084d96355 ("x86/mm/pat: Disable preemption around __flush_tlb_all()")
Cc: Kirill A. Shutemov 
Cc: Sebastian Andrzej Siewior 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: Borislav Petkov 
Cc: 
Reported-by: Andy Lutomirski 
Suggested-by: Dave Hansen 
Signed-off-by: Dan Williams 


Hi Dan,

This patch on it's own doesn't apply to any of the stable trees, does it
maybe depend on some of the previous patches in this series?

--
Thanks,
Sasha


Re: [PATCH v2 5/5] x86/mm: Drop usage of __flush_tlb_all() in kernel_physical_mapping_init()

2018-12-01 Thread Sasha Levin

On Fri, Nov 30, 2018 at 04:35:32PM -0800, Dan Williams wrote:

Commit f77084d96355 "x86/mm/pat: Disable preemption around
__flush_tlb_all()" addressed a case where __flush_tlb_all() is called
without preemption being disabled. It also left a warning to catch other
cases where preemption is not disabled. That warning triggers for the
memory hotplug path which is also used for persistent memory enabling:

WARNING: CPU: 35 PID: 911 at ./arch/x86/include/asm/tlbflush.h:460
RIP: 0010:__flush_tlb_all+0x1b/0x3a
[..]
Call Trace:
 phys_pud_init+0x29c/0x2bb
 kernel_physical_mapping_init+0xfc/0x219
 init_memory_mapping+0x1a5/0x3b0
 arch_add_memory+0x2c/0x50
 devm_memremap_pages+0x3aa/0x610
 pmem_attach_disk+0x585/0x700 [nd_pmem]

Andy wondered why a path that can sleep was using __flush_tlb_all() [1]
and Dave confirmed the expectation for TLB flush is for modifying /
invalidating existing pte entries, but not initial population [2]. Drop
the usage of __flush_tlb_all() in phys_{p4d,pud,pmd}_init() on the
expectation that this path is only ever populating empty entries for the
linear map. Note, at linear map teardown time there is a call to the
all-cpu flush_tlb_all() to invalidate the removed mappings.

[1]: 
https://lore.kernel.org/lkml/9dfd717d-857d-493d-a606-b635d72ba...@amacapital.net
[2]: https://lore.kernel.org/lkml/749919a4-cdb1-48a3-adb4-adb81a5fa...@intel.com

Fixes: f77084d96355 ("x86/mm/pat: Disable preemption around __flush_tlb_all()")
Cc: Kirill A. Shutemov 
Cc: Sebastian Andrzej Siewior 
Cc: Thomas Gleixner 
Cc: Peter Zijlstra 
Cc: Borislav Petkov 
Cc: 
Reported-by: Andy Lutomirski 
Suggested-by: Dave Hansen 
Signed-off-by: Dan Williams 


Hi Dan,

This patch on it's own doesn't apply to any of the stable trees, does it
maybe depend on some of the previous patches in this series?

--
Thanks,
Sasha


[PATCH v2 3/9] drivers/firewire/core-iso.c: Convert to use vm_insert_range

2018-12-01 Thread Souptick Joarder
Convert to use vm_insert_range to map range of kernel memory
to user vma.

Signed-off-by: Souptick Joarder 
Reviewed-by: Matthew Wilcox 
---
 drivers/firewire/core-iso.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 35e784c..7bf28bb 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -107,19 +107,8 @@ int fw_iso_buffer_init(struct fw_iso_buffer *buffer, 
struct fw_card *card,
 int fw_iso_buffer_map_vma(struct fw_iso_buffer *buffer,
  struct vm_area_struct *vma)
 {
-   unsigned long uaddr;
-   int i, err;
-
-   uaddr = vma->vm_start;
-   for (i = 0; i < buffer->page_count; i++) {
-   err = vm_insert_page(vma, uaddr, buffer->pages[i]);
-   if (err)
-   return err;
-
-   uaddr += PAGE_SIZE;
-   }
-
-   return 0;
+   return vm_insert_range(vma, vma->vm_start, buffer->pages,
+   buffer->page_count);
 }
 
 void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
-- 
1.9.1



[PATCH v2 3/9] drivers/firewire/core-iso.c: Convert to use vm_insert_range

2018-12-01 Thread Souptick Joarder
Convert to use vm_insert_range to map range of kernel memory
to user vma.

Signed-off-by: Souptick Joarder 
Reviewed-by: Matthew Wilcox 
---
 drivers/firewire/core-iso.c | 15 ++-
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 35e784c..7bf28bb 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -107,19 +107,8 @@ int fw_iso_buffer_init(struct fw_iso_buffer *buffer, 
struct fw_card *card,
 int fw_iso_buffer_map_vma(struct fw_iso_buffer *buffer,
  struct vm_area_struct *vma)
 {
-   unsigned long uaddr;
-   int i, err;
-
-   uaddr = vma->vm_start;
-   for (i = 0; i < buffer->page_count; i++) {
-   err = vm_insert_page(vma, uaddr, buffer->pages[i]);
-   if (err)
-   return err;
-
-   uaddr += PAGE_SIZE;
-   }
-
-   return 0;
+   return vm_insert_range(vma, vma->vm_start, buffer->pages,
+   buffer->page_count);
 }
 
 void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
-- 
1.9.1



[PATCH v2 2/9] arch/arm/mm/dma-mapping.c: Convert to use vm_insert_range

2018-12-01 Thread Souptick Joarder
Convert to use vm_insert_range() to map range of kernel
memory to user vma.

Signed-off-by: Souptick Joarder 
---
 arch/arm/mm/dma-mapping.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 661fe48..4eec323 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1582,31 +1582,24 @@ static int __arm_iommu_mmap_attrs(struct device *dev, 
struct vm_area_struct *vma
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)
 {
-   unsigned long uaddr = vma->vm_start;
-   unsigned long usize = vma->vm_end - vma->vm_start;
+   unsigned long page_count = vma_pages(vma);
struct page **pages = __iommu_get_pages(cpu_addr, attrs);
unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
unsigned long off = vma->vm_pgoff;
+   int err;
 
if (!pages)
return -ENXIO;
 
-   if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off)
+   if (off >= nr_pages || page_count > nr_pages - off)
return -ENXIO;
 
pages += off;
+   err = vm_insert_range(vma, vma->vm_start, pages, page_count);
+   if (err)
+   pr_err("Remapping memory failed: %d\n", err);
 
-   do {
-   int ret = vm_insert_page(vma, uaddr, *pages++);
-   if (ret) {
-   pr_err("Remapping memory failed: %d\n", ret);
-   return ret;
-   }
-   uaddr += PAGE_SIZE;
-   usize -= PAGE_SIZE;
-   } while (usize > 0);
-
-   return 0;
+   return err;
 }
 static int arm_iommu_mmap_attrs(struct device *dev,
struct vm_area_struct *vma, void *cpu_addr,
-- 
1.9.1



[PATCH v2 2/9] arch/arm/mm/dma-mapping.c: Convert to use vm_insert_range

2018-12-01 Thread Souptick Joarder
Convert to use vm_insert_range() to map range of kernel
memory to user vma.

Signed-off-by: Souptick Joarder 
---
 arch/arm/mm/dma-mapping.c | 21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 661fe48..4eec323 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1582,31 +1582,24 @@ static int __arm_iommu_mmap_attrs(struct device *dev, 
struct vm_area_struct *vma
void *cpu_addr, dma_addr_t dma_addr, size_t size,
unsigned long attrs)
 {
-   unsigned long uaddr = vma->vm_start;
-   unsigned long usize = vma->vm_end - vma->vm_start;
+   unsigned long page_count = vma_pages(vma);
struct page **pages = __iommu_get_pages(cpu_addr, attrs);
unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
unsigned long off = vma->vm_pgoff;
+   int err;
 
if (!pages)
return -ENXIO;
 
-   if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off)
+   if (off >= nr_pages || page_count > nr_pages - off)
return -ENXIO;
 
pages += off;
+   err = vm_insert_range(vma, vma->vm_start, pages, page_count);
+   if (err)
+   pr_err("Remapping memory failed: %d\n", err);
 
-   do {
-   int ret = vm_insert_page(vma, uaddr, *pages++);
-   if (ret) {
-   pr_err("Remapping memory failed: %d\n", ret);
-   return ret;
-   }
-   uaddr += PAGE_SIZE;
-   usize -= PAGE_SIZE;
-   } while (usize > 0);
-
-   return 0;
+   return err;
 }
 static int arm_iommu_mmap_attrs(struct device *dev,
struct vm_area_struct *vma, void *cpu_addr,
-- 
1.9.1



Re: [PATCH] printk: don't unconditionally shortcut print_time()

2018-12-01 Thread Tetsuo Handa
On 2018/12/02 8:49, kbuild test robot wrote:
>> kernel/printk/printk.c:2396:5: error: 'printk_time' undeclared (first use in 
>> this function)
^~~
Thanks. printk_time depends on CONFIG_PRINTK=y. Added a dummy definition.



>From f903b9fa36159472a207f93e2405e45e3999f650 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa 
Date: Sun, 2 Dec 2018 13:57:01 +0900
Subject: [PATCH v2] printk: fix printk_time race.

Since printk_time can be toggled via /sys/module/printk/parameters/time ,
it is not safe to assume that output length does not change across
multiple msg_print_text() calls. If we hit this race, we can observe
failures such as SYSLOG_ACTION_READ_ALL writes more bytes than userspace
has supplied, SYSLOG_ACTION_SIZE_UNREAD returns -EFAULT when succeeded,
SYSLOG_ACTION_READ reads garbage memory or even triggers an kernel oops
at _copy_to_user() due to integer overflow.

To close this race, get a snapshot value of printk_time and pass it to
SYSLOG_ACTION_READ, SYSLOG_ACTION_READ_ALL, SYSLOG_ACTION_SIZE_UNREAD and
kmsg_dump_get_buffer().

Signed-off-by: Tetsuo Handa 
Signed-off-by: Petr Mladek 
---
 kernel/printk/printk.c | 69 +++---
 1 file changed, 38 insertions(+), 31 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5c2079d..0b47e34 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -403,6 +403,7 @@ __packed __aligned(4)
 static u64 syslog_seq;
 static u32 syslog_idx;
 static size_t syslog_partial;
+static bool syslog_time;
 
 /* index and sequence number of the first record stored in the buffer */
 static u64 log_first_seq;
@@ -1228,12 +1229,7 @@ static inline void boot_delay_msec(int level)
 
 static size_t print_time(u64 ts, char *buf)
 {
-   unsigned long rem_nsec;
-
-   if (!printk_time)
-   return 0;
-
-   rem_nsec = do_div(ts, 10);
+   unsigned long rem_nsec = do_div(ts, 10);
 
if (!buf)
return snprintf(NULL, 0, "[%5lu.00] ", (unsigned long)ts);
@@ -1242,7 +1238,8 @@ static size_t print_time(u64 ts, char *buf)
   (unsigned long)ts, rem_nsec / 1000);
 }
 
-static size_t print_prefix(const struct printk_log *msg, bool syslog, char 
*buf)
+static size_t print_prefix(const struct printk_log *msg, bool syslog,
+  bool time, char *buf)
 {
size_t len = 0;
unsigned int prefix = (msg->facility << 3) | msg->level;
@@ -1261,11 +1258,13 @@ static size_t print_prefix(const struct printk_log 
*msg, bool syslog, char *buf)
}
}
 
-   len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
+   if (time)
+   len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
return len;
 }
 
-static size_t msg_print_text(const struct printk_log *msg, bool syslog, char 
*buf, size_t size)
+static size_t msg_print_text(const struct printk_log *msg, bool syslog,
+bool time, char *buf, size_t size)
 {
const char *text = log_text(msg);
size_t text_size = msg->text_len;
@@ -1284,17 +1283,17 @@ static size_t msg_print_text(const struct printk_log 
*msg, bool syslog, char *bu
}
 
if (buf) {
-   if (print_prefix(msg, syslog, NULL) +
+   if (print_prefix(msg, syslog, time, NULL) +
text_len + 1 >= size - len)
break;
 
-   len += print_prefix(msg, syslog, buf + len);
+   len += print_prefix(msg, syslog, time, buf + len);
memcpy(buf + len, text, text_len);
len += text_len;
buf[len++] = '\n';
} else {
/* SYSLOG_ACTION_* buffer size only calculation */
-   len += print_prefix(msg, syslog, NULL);
+   len += print_prefix(msg, syslog, time, NULL);
len += text_len;
len++;
}
@@ -1331,9 +1330,17 @@ static int syslog_print(char __user *buf, int size)
break;
}
 
+   /*
+* To keep reading/counting partial line consistent,
+* use printk_time value as of the biginning of a line.
+*/
+   if (!syslog_partial)
+   syslog_time = printk_time;
+
skip = syslog_partial;
msg = log_from_idx(syslog_idx);
-   n = msg_print_text(msg, true, text, LOG_LINE_MAX + PREFIX_MAX);
+   n = msg_print_text(msg, true, syslog_time, text,
+  LOG_LINE_MAX + PREFIX_MAX);
if (n - syslog_partial <= size) {
/* message fits into buffer, move forward */
syslog_idx = log_next(syslog_idx);
@@ -1373,11 

Re: [PATCH] printk: don't unconditionally shortcut print_time()

2018-12-01 Thread Tetsuo Handa
On 2018/12/02 8:49, kbuild test robot wrote:
>> kernel/printk/printk.c:2396:5: error: 'printk_time' undeclared (first use in 
>> this function)
^~~
Thanks. printk_time depends on CONFIG_PRINTK=y. Added a dummy definition.



>From f903b9fa36159472a207f93e2405e45e3999f650 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa 
Date: Sun, 2 Dec 2018 13:57:01 +0900
Subject: [PATCH v2] printk: fix printk_time race.

Since printk_time can be toggled via /sys/module/printk/parameters/time ,
it is not safe to assume that output length does not change across
multiple msg_print_text() calls. If we hit this race, we can observe
failures such as SYSLOG_ACTION_READ_ALL writes more bytes than userspace
has supplied, SYSLOG_ACTION_SIZE_UNREAD returns -EFAULT when succeeded,
SYSLOG_ACTION_READ reads garbage memory or even triggers an kernel oops
at _copy_to_user() due to integer overflow.

To close this race, get a snapshot value of printk_time and pass it to
SYSLOG_ACTION_READ, SYSLOG_ACTION_READ_ALL, SYSLOG_ACTION_SIZE_UNREAD and
kmsg_dump_get_buffer().

Signed-off-by: Tetsuo Handa 
Signed-off-by: Petr Mladek 
---
 kernel/printk/printk.c | 69 +++---
 1 file changed, 38 insertions(+), 31 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5c2079d..0b47e34 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -403,6 +403,7 @@ __packed __aligned(4)
 static u64 syslog_seq;
 static u32 syslog_idx;
 static size_t syslog_partial;
+static bool syslog_time;
 
 /* index and sequence number of the first record stored in the buffer */
 static u64 log_first_seq;
@@ -1228,12 +1229,7 @@ static inline void boot_delay_msec(int level)
 
 static size_t print_time(u64 ts, char *buf)
 {
-   unsigned long rem_nsec;
-
-   if (!printk_time)
-   return 0;
-
-   rem_nsec = do_div(ts, 10);
+   unsigned long rem_nsec = do_div(ts, 10);
 
if (!buf)
return snprintf(NULL, 0, "[%5lu.00] ", (unsigned long)ts);
@@ -1242,7 +1238,8 @@ static size_t print_time(u64 ts, char *buf)
   (unsigned long)ts, rem_nsec / 1000);
 }
 
-static size_t print_prefix(const struct printk_log *msg, bool syslog, char 
*buf)
+static size_t print_prefix(const struct printk_log *msg, bool syslog,
+  bool time, char *buf)
 {
size_t len = 0;
unsigned int prefix = (msg->facility << 3) | msg->level;
@@ -1261,11 +1258,13 @@ static size_t print_prefix(const struct printk_log 
*msg, bool syslog, char *buf)
}
}
 
-   len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
+   if (time)
+   len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
return len;
 }
 
-static size_t msg_print_text(const struct printk_log *msg, bool syslog, char 
*buf, size_t size)
+static size_t msg_print_text(const struct printk_log *msg, bool syslog,
+bool time, char *buf, size_t size)
 {
const char *text = log_text(msg);
size_t text_size = msg->text_len;
@@ -1284,17 +1283,17 @@ static size_t msg_print_text(const struct printk_log 
*msg, bool syslog, char *bu
}
 
if (buf) {
-   if (print_prefix(msg, syslog, NULL) +
+   if (print_prefix(msg, syslog, time, NULL) +
text_len + 1 >= size - len)
break;
 
-   len += print_prefix(msg, syslog, buf + len);
+   len += print_prefix(msg, syslog, time, buf + len);
memcpy(buf + len, text, text_len);
len += text_len;
buf[len++] = '\n';
} else {
/* SYSLOG_ACTION_* buffer size only calculation */
-   len += print_prefix(msg, syslog, NULL);
+   len += print_prefix(msg, syslog, time, NULL);
len += text_len;
len++;
}
@@ -1331,9 +1330,17 @@ static int syslog_print(char __user *buf, int size)
break;
}
 
+   /*
+* To keep reading/counting partial line consistent,
+* use printk_time value as of the biginning of a line.
+*/
+   if (!syslog_partial)
+   syslog_time = printk_time;
+
skip = syslog_partial;
msg = log_from_idx(syslog_idx);
-   n = msg_print_text(msg, true, text, LOG_LINE_MAX + PREFIX_MAX);
+   n = msg_print_text(msg, true, syslog_time, text,
+  LOG_LINE_MAX + PREFIX_MAX);
if (n - syslog_partial <= size) {
/* message fits into buffer, move forward */
syslog_idx = log_next(syslog_idx);
@@ -1373,11 

Re: [PATCH v2 -next] platform/x86: intel-ips: fix 'passing zero to PTR_ERR()' warning

2018-12-01 Thread kbuild test robot
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20181126]

url:
https://github.com/0day-ci/linux/commits/YueHaibing/platform-x86-intel-ips-fix-passing-zero-to-PTR_ERR-warning/20181126-213205
config: x86_64-rhel-7.2-clear (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/platform/x86/intel_ips.c: In function 'ips_debugfs_init':
>> drivers/platform/x86/intel_ips.c:1315:3: error: expected ';' before 'return'
  return;
  ^~

vim +1315 drivers/platform/x86/intel_ips.c

aa7ffc01 Jesse Barnes 2010-05-14  1307  
aa7ffc01 Jesse Barnes 2010-05-14  1308  static void ips_debugfs_init(struct 
ips_driver *ips)
aa7ffc01 Jesse Barnes 2010-05-14  1309  {
aa7ffc01 Jesse Barnes 2010-05-14  1310  int i;
aa7ffc01 Jesse Barnes 2010-05-14  1311  
aa7ffc01 Jesse Barnes 2010-05-14  1312  ips->debug_root = 
debugfs_create_dir("ips", NULL);
aa7ffc01 Jesse Barnes 2010-05-14  1313  if (!ips->debug_root) {
895c026e YueHaibing   2018-11-26  1314  dev_err(ips->dev, 
"failed to create debugfs entries\n")
aa7ffc01 Jesse Barnes 2010-05-14 @1315  return;
aa7ffc01 Jesse Barnes 2010-05-14  1316  }
aa7ffc01 Jesse Barnes 2010-05-14  1317  
aa7ffc01 Jesse Barnes 2010-05-14  1318  for (i = 0; i < 
ARRAY_SIZE(ips_debug_files); i++) {
aa7ffc01 Jesse Barnes 2010-05-14  1319  struct dentry *ent;
aa7ffc01 Jesse Barnes 2010-05-14  1320  struct ips_debugfs_node 
*node = _debug_files[i];
aa7ffc01 Jesse Barnes 2010-05-14  1321  
aa7ffc01 Jesse Barnes 2010-05-14  1322  node->ips = ips;
aa7ffc01 Jesse Barnes 2010-05-14  1323  ent = 
debugfs_create_file(node->name, S_IFREG | S_IRUGO,
aa7ffc01 Jesse Barnes 2010-05-14  1324  
  ips->debug_root, node,
aa7ffc01 Jesse Barnes 2010-05-14  1325  
  _debugfs_ops);
aa7ffc01 Jesse Barnes 2010-05-14  1326  if (!ent) {
895c026e YueHaibing   2018-11-26  1327  
dev_err(ips->dev, "failed to create debug file\n");
aa7ffc01 Jesse Barnes 2010-05-14  1328  goto 
err_cleanup;
aa7ffc01 Jesse Barnes 2010-05-14  1329  }
aa7ffc01 Jesse Barnes 2010-05-14  1330  }
aa7ffc01 Jesse Barnes 2010-05-14  1331  
aa7ffc01 Jesse Barnes 2010-05-14  1332  return;
aa7ffc01 Jesse Barnes 2010-05-14  1333  
aa7ffc01 Jesse Barnes 2010-05-14  1334  err_cleanup:
aa7ffc01 Jesse Barnes 2010-05-14  1335  ips_debugfs_cleanup(ips);
aa7ffc01 Jesse Barnes 2010-05-14  1336  return;
aa7ffc01 Jesse Barnes 2010-05-14  1337  }
aa7ffc01 Jesse Barnes 2010-05-14  1338  #endif /* CONFIG_DEBUG_FS */
aa7ffc01 Jesse Barnes 2010-05-14  1339  

:: The code at line 1315 was first introduced by commit
:: aa7ffc01d254c91a36bf854d57a14049c6134c72 x86 platform driver: 
intelligent power sharing driver

:: TO: Jesse Barnes 
:: CC: Matthew Garrett 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v2 -next] platform/x86: intel-ips: fix 'passing zero to PTR_ERR()' warning

2018-12-01 Thread kbuild test robot
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20181126]

url:
https://github.com/0day-ci/linux/commits/YueHaibing/platform-x86-intel-ips-fix-passing-zero-to-PTR_ERR-warning/20181126-213205
config: x86_64-rhel-7.2-clear (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/platform/x86/intel_ips.c: In function 'ips_debugfs_init':
>> drivers/platform/x86/intel_ips.c:1315:3: error: expected ';' before 'return'
  return;
  ^~

vim +1315 drivers/platform/x86/intel_ips.c

aa7ffc01 Jesse Barnes 2010-05-14  1307  
aa7ffc01 Jesse Barnes 2010-05-14  1308  static void ips_debugfs_init(struct 
ips_driver *ips)
aa7ffc01 Jesse Barnes 2010-05-14  1309  {
aa7ffc01 Jesse Barnes 2010-05-14  1310  int i;
aa7ffc01 Jesse Barnes 2010-05-14  1311  
aa7ffc01 Jesse Barnes 2010-05-14  1312  ips->debug_root = 
debugfs_create_dir("ips", NULL);
aa7ffc01 Jesse Barnes 2010-05-14  1313  if (!ips->debug_root) {
895c026e YueHaibing   2018-11-26  1314  dev_err(ips->dev, 
"failed to create debugfs entries\n")
aa7ffc01 Jesse Barnes 2010-05-14 @1315  return;
aa7ffc01 Jesse Barnes 2010-05-14  1316  }
aa7ffc01 Jesse Barnes 2010-05-14  1317  
aa7ffc01 Jesse Barnes 2010-05-14  1318  for (i = 0; i < 
ARRAY_SIZE(ips_debug_files); i++) {
aa7ffc01 Jesse Barnes 2010-05-14  1319  struct dentry *ent;
aa7ffc01 Jesse Barnes 2010-05-14  1320  struct ips_debugfs_node 
*node = _debug_files[i];
aa7ffc01 Jesse Barnes 2010-05-14  1321  
aa7ffc01 Jesse Barnes 2010-05-14  1322  node->ips = ips;
aa7ffc01 Jesse Barnes 2010-05-14  1323  ent = 
debugfs_create_file(node->name, S_IFREG | S_IRUGO,
aa7ffc01 Jesse Barnes 2010-05-14  1324  
  ips->debug_root, node,
aa7ffc01 Jesse Barnes 2010-05-14  1325  
  _debugfs_ops);
aa7ffc01 Jesse Barnes 2010-05-14  1326  if (!ent) {
895c026e YueHaibing   2018-11-26  1327  
dev_err(ips->dev, "failed to create debug file\n");
aa7ffc01 Jesse Barnes 2010-05-14  1328  goto 
err_cleanup;
aa7ffc01 Jesse Barnes 2010-05-14  1329  }
aa7ffc01 Jesse Barnes 2010-05-14  1330  }
aa7ffc01 Jesse Barnes 2010-05-14  1331  
aa7ffc01 Jesse Barnes 2010-05-14  1332  return;
aa7ffc01 Jesse Barnes 2010-05-14  1333  
aa7ffc01 Jesse Barnes 2010-05-14  1334  err_cleanup:
aa7ffc01 Jesse Barnes 2010-05-14  1335  ips_debugfs_cleanup(ips);
aa7ffc01 Jesse Barnes 2010-05-14  1336  return;
aa7ffc01 Jesse Barnes 2010-05-14  1337  }
aa7ffc01 Jesse Barnes 2010-05-14  1338  #endif /* CONFIG_DEBUG_FS */
aa7ffc01 Jesse Barnes 2010-05-14  1339  

:: The code at line 1315 was first introduced by commit
:: aa7ffc01d254c91a36bf854d57a14049c6134c72 x86 platform driver: 
intelligent power sharing driver

:: TO: Jesse Barnes 
:: CC: Matthew Garrett 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: WARNING: CPU: 0 PID: 0 at drivers/irqchip/irq-gic-v3-its.c

2018-12-01 Thread Qian Cai



On 11/12/18 3:39 AM, Marc Zyngier wrote:
> On Fri, 09 Nov 2018 18:41:03 +,
> Qian Cai  wrote:
>>
>>
>>
>>> On Nov 9, 2018, at 12:41 PM, Marc Zyngier  wrote:
>>>
>>> On 09/11/18 17:28, Sudeep Holla wrote:
 On Fri, Nov 9, 2018 at 4:10 PM Marc Zyngier  wrote:
>
 [...]

>
> See bb42ca474010 and d003d029cea8 for details.
>
> Now, activating this workaround leads to lockdep being really angry,
> most likely because the cpus_read_lock is not taken, which is a change
> in behaviour...
>
> I'm trying to dig into this now.
>

 Yes we found similar issue in kernel/sched/core.c sched_init_smp
 There's a fix with detailed description in -next
 (Commit 40fa3780bac2 ("sched/core: Take the hotplug lock in 
 sched_init_smp()")

 The behaviour changed since  commit cb538267ea1e ("jump_label/lockdep:
 Assert we hold the hotplug lock for _cpuslocked() operations")
>>>
>>> I indeed came to the same conclusion, but the fix is slightly less than
>>> obvious. I have the following arm64-specific crap, but it is pretty
>>> terrible:
>>>
>>> diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
>>> index f258636273c9..9e96e9eaca9b 100644
>>> --- a/arch/arm64/kernel/time.c
>>> +++ b/arch/arm64/kernel/time.c
>>> @@ -36,6 +36,7 @@
>>> #include 
>>> #include 
>>> #include 
>>> +#include 
>>>
>>> #include 
>>>
>>> @@ -69,7 +70,9 @@ void __init time_init(void)
>>> u32 arch_timer_rate;
>>>
>>> of_clk_init(NULL);
>>> +   cpus_read_lock();
>>> timer_probe();
>>> +   cpus_read_unlock();
>>>
>>> tick_setup_hrtimer_broadcast();
>>>
>>> Qian, can you please let me know if this helps? If it does, we'll have
>>> to think of something a bit better…
>> After applied the above patch, the original warning is gone but there
>> Is now a new warning.
> 
> [...]
> 
> Which was ful;ly expected, given that I've taken the cpu lock at some
> semi-random location. I'll try to talk to PeterZ this week to try and
> solve this.
> 

Marc, did you have a chance to investigate this further? I have still seen it in
the latest mainline today. This is the only warning left on this Huawei TaiShan
2280 server now after confirmed that those GICv3 warnings were gone.


Re: WARNING: CPU: 0 PID: 0 at drivers/irqchip/irq-gic-v3-its.c

2018-12-01 Thread Qian Cai



On 11/12/18 3:39 AM, Marc Zyngier wrote:
> On Fri, 09 Nov 2018 18:41:03 +,
> Qian Cai  wrote:
>>
>>
>>
>>> On Nov 9, 2018, at 12:41 PM, Marc Zyngier  wrote:
>>>
>>> On 09/11/18 17:28, Sudeep Holla wrote:
 On Fri, Nov 9, 2018 at 4:10 PM Marc Zyngier  wrote:
>
 [...]

>
> See bb42ca474010 and d003d029cea8 for details.
>
> Now, activating this workaround leads to lockdep being really angry,
> most likely because the cpus_read_lock is not taken, which is a change
> in behaviour...
>
> I'm trying to dig into this now.
>

 Yes we found similar issue in kernel/sched/core.c sched_init_smp
 There's a fix with detailed description in -next
 (Commit 40fa3780bac2 ("sched/core: Take the hotplug lock in 
 sched_init_smp()")

 The behaviour changed since  commit cb538267ea1e ("jump_label/lockdep:
 Assert we hold the hotplug lock for _cpuslocked() operations")
>>>
>>> I indeed came to the same conclusion, but the fix is slightly less than
>>> obvious. I have the following arm64-specific crap, but it is pretty
>>> terrible:
>>>
>>> diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
>>> index f258636273c9..9e96e9eaca9b 100644
>>> --- a/arch/arm64/kernel/time.c
>>> +++ b/arch/arm64/kernel/time.c
>>> @@ -36,6 +36,7 @@
>>> #include 
>>> #include 
>>> #include 
>>> +#include 
>>>
>>> #include 
>>>
>>> @@ -69,7 +70,9 @@ void __init time_init(void)
>>> u32 arch_timer_rate;
>>>
>>> of_clk_init(NULL);
>>> +   cpus_read_lock();
>>> timer_probe();
>>> +   cpus_read_unlock();
>>>
>>> tick_setup_hrtimer_broadcast();
>>>
>>> Qian, can you please let me know if this helps? If it does, we'll have
>>> to think of something a bit better…
>> After applied the above patch, the original warning is gone but there
>> Is now a new warning.
> 
> [...]
> 
> Which was ful;ly expected, given that I've taken the cpu lock at some
> semi-random location. I'll try to talk to PeterZ this week to try and
> solve this.
> 

Marc, did you have a chance to investigate this further? I have still seen it in
the latest mainline today. This is the only warning left on this Huawei TaiShan
2280 server now after confirmed that those GICv3 warnings were gone.


[PATCH v11 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das
Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
 .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
 1 file changed, 172 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..2b82965
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "alternate".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+   qcom,freq-domain = <_hw 1>;
+   L2_400: l2-cache {
+   compatible = "cache";
+   next-level-cache = 

[PATCH v11 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das
The CPUfreq HW present in some QCOM chipsets offloads the steps necessary
for changing the frequency of CPUs. The driver implements the cpufreq
driver interface for this hardware engine.

Signed-off-by: Saravana Kannan 
Signed-off-by: Stephen Boyd 
Signed-off-by: Taniya Das 
---
 drivers/cpufreq/Kconfig.arm   |  11 ++
 drivers/cpufreq/Makefile  |   1 +
 drivers/cpufreq/qcom-cpufreq-hw.c | 334 ++
 3 files changed, 346 insertions(+)
 create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 4e1131e..688f102 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -114,6 +114,17 @@ config ARM_QCOM_CPUFREQ_KRYO

  If in doubt, say N.

+config ARM_QCOM_CPUFREQ_HW
+   tristate "QCOM CPUFreq HW driver"
+   depends on ARCH_QCOM || COMPILE_TEST
+   help
+ Support for the CPUFreq HW driver.
+ Some QCOM chipsets have a HW engine to offload the steps
+ necessary for changing the frequency of the CPUs. Firmware loaded
+ in this engine exposes a programming interface to the OS.
+ The driver implements the cpufreq interface for this HW engine.
+ Say Y if you want to support CPUFreq HW.
+
 config ARM_S3C_CPUFREQ
bool
help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..08c071b 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_MACH_MVEBU_V7)   += mvebu-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)   += pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)   += pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o
 obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)+= qcom-cpufreq-kryo.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)  += s3c2410-cpufreq.o
 obj-$(CONFIG_ARM_S3C2412_CPUFREQ)  += s3c2412-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..8dc6b73
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,334 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define LUT_SRCGENMASK(31, 30)
+#define LUT_L_VAL  GENMASK(7, 0)
+#define LUT_CORE_COUNT GENMASK(18, 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_state_reg;
+   cpumask_t related_cpus;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+   unsigned int index)
+{
+   void __iomem *perf_state_reg = policy->driver_data;
+
+   writel_relaxed(index, perf_state_reg);
+
+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   void __iomem *perf_state_reg;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   perf_state_reg = policy->driver_data;
+
+   index = readl_relaxed(perf_state_reg);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   void __iomem *perf_state_reg = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, perf_state_reg);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   policy->fast_switch_possible = true;
+   policy->freq_table = c->table;
+   policy->driver_data = c->perf_state_reg;
+
+   return 0;
+}
+
+static struct freq_attr *qcom_cpufreq_hw_attr[] = {
+   _freq_attr_scaling_available_freqs,
+   _freq_attr_scaling_boost_freqs,
+   NULL
+};
+
+static struct cpufreq_driver cpufreq_qcom_hw_driver = {
+   .flags  = 

[PATCH v11 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das
Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
 .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
 1 file changed, 172 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..2b82965
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "alternate".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+   qcom,freq-domain = <_hw 1>;
+   L2_400: l2-cache {
+   compatible = "cache";
+   next-level-cache = 

[PATCH v11 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das
The CPUfreq HW present in some QCOM chipsets offloads the steps necessary
for changing the frequency of CPUs. The driver implements the cpufreq
driver interface for this hardware engine.

Signed-off-by: Saravana Kannan 
Signed-off-by: Stephen Boyd 
Signed-off-by: Taniya Das 
---
 drivers/cpufreq/Kconfig.arm   |  11 ++
 drivers/cpufreq/Makefile  |   1 +
 drivers/cpufreq/qcom-cpufreq-hw.c | 334 ++
 3 files changed, 346 insertions(+)
 create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 4e1131e..688f102 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -114,6 +114,17 @@ config ARM_QCOM_CPUFREQ_KRYO

  If in doubt, say N.

+config ARM_QCOM_CPUFREQ_HW
+   tristate "QCOM CPUFreq HW driver"
+   depends on ARCH_QCOM || COMPILE_TEST
+   help
+ Support for the CPUFreq HW driver.
+ Some QCOM chipsets have a HW engine to offload the steps
+ necessary for changing the frequency of the CPUs. Firmware loaded
+ in this engine exposes a programming interface to the OS.
+ The driver implements the cpufreq interface for this HW engine.
+ Say Y if you want to support CPUFreq HW.
+
 config ARM_S3C_CPUFREQ
bool
help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..08c071b 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_MACH_MVEBU_V7)   += mvebu-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)   += pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)   += pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o
 obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)+= qcom-cpufreq-kryo.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)  += s3c2410-cpufreq.o
 obj-$(CONFIG_ARM_S3C2412_CPUFREQ)  += s3c2412-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..8dc6b73
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,334 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define LUT_SRCGENMASK(31, 30)
+#define LUT_L_VAL  GENMASK(7, 0)
+#define LUT_CORE_COUNT GENMASK(18, 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_state_reg;
+   cpumask_t related_cpus;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+   unsigned int index)
+{
+   void __iomem *perf_state_reg = policy->driver_data;
+
+   writel_relaxed(index, perf_state_reg);
+
+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   void __iomem *perf_state_reg;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   perf_state_reg = policy->driver_data;
+
+   index = readl_relaxed(perf_state_reg);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   void __iomem *perf_state_reg = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, perf_state_reg);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   policy->fast_switch_possible = true;
+   policy->freq_table = c->table;
+   policy->driver_data = c->perf_state_reg;
+
+   return 0;
+}
+
+static struct freq_attr *qcom_cpufreq_hw_attr[] = {
+   _freq_attr_scaling_available_freqs,
+   _freq_attr_scaling_boost_freqs,
+   NULL
+};
+
+static struct cpufreq_driver cpufreq_qcom_hw_driver = {
+   .flags  = 

[PATCH v11 0/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW

2018-12-01 Thread Taniya Das
 [v11]
   * Updated the code logic as per Stephen.
   * Default boost enabled is removed.
   * Update the clock name to use "alternate" for GPLL0 source in code and
 Documentation binding.
   * Module description updated.
   * perf_base updated to perf_state_reg.

 [v10]
  * Update Documentation binding for cpufreq node.
  * Make the driver 'tristate' instead of 'bool' and update code.
  * Update the clock name to reflect the hardware name.
  * Remove support for varying offset.

 [v9]
  * Update the Documentation binding for freq-domain-cells & cpufreq node.
  * Address comments in Kconfig.arm & Makefile.
  * Remove include file & MODULE_DESCRIPTION not required.
  * Fix the code for 'of_node_put(cpu_np)'.

 [v8]
   * Address comments to update code to take cpufreq_hw phandle and index from
 the CPU nodes.
   * Updated the Documentation for the above change in DT.
   * Updated logic for assigning 'qcom_freq_domain_map' for related CPUs.
   * Clock input to the HW block is taken from DT which has been updated in
 code and Device tree documentation.

 [v7]
   * Updated the logic to check for related CPUs.

 [v6]
   * Renamed match table 'qcom_cpufreq_hw_match'.
   * Renamed 'qcom_read_lut' to 'qcom_cpufreq_hw_read_lut'.
   * Updated the logic to check for related CPUs at the beginning of the
 'qcom_cpu_resources_init'.
   * Use devm_ioremap_resource instead of devm_ioremap.
   * Update the use of of_node_put to handle error conditions.
   * Use policy->cached_resolved_idx in fast switch callback.
   * Keep precalculated offsets 'reg_bases'.
   * XO clock is taken from Device tree.
   * Update documentation binding for clocks/clock-names.
   * Minor comments in Kconfig.arm.
   * Comments to move dev_info to dev_dbg.

 [v5]
   * Remove mapping different register regions of perf/lut/enable,
 instead map the entire HW region.
   * Add reg_offset/cpufreq_qcom_std_offsets to be supplied as device data.
   * Check of src == 0 during lut read.
   * Add of_node_put(cpu_np) in qcom_get_related_cpus
   * Update the qcom_cpu_resources_init for register offset data,
 and cleanup the related cpus to keep a single copy of CPUfreq.
   * Replace FW with HW, update Kconfig, rename filename qcom-cpufreq-hw.c
   * Update the documentation binding to reflect the changes of mapping the
   * entire HW region.

 [v4]
   * Fixed console messages as per comments.
   * Return error from qcom_resources_init()
 in the cases where failed to get frequency domain.
   * Rename cpu_dev to cpu_np in qcom_resources_init,
 qcom_get_related_cpus(). Also use temp variable freq_np in
 qcom_get_related_cpus().
   * Update qcom_cpufreq_fw_get() to use the policy data to incoporate
 the hotplug use case.
   * Update code to use of fast_switching.
   * Check for !c->max_cores instead of cpumask_empty in
 qcom_get_related_cpus().
   * Update the logic of assigning 'c' to qcom_freq_domain_map[cpu].

 [v3]
   * Remove index check from 'qcom_cpufreq_fw_target_index'.
   * Update the Documentation binding to add the platform specific properties in
 the CPU nodes, node name "qcom,freq-domain".
   * Update return value to '0' from -ENODEV from 'qcom_cpufreq_fw_get'.
   * Update the logic for boost frequency to use local variables instead of
 cpufreq driver data in 'qcom_read_lut'.
   * Update the logic in 'qcom_get_related_cpus' to find the related cpus.
   * Update the reg-names to remove "_base" and also update the binding with the
 description of these registers.
   * Update the logic in 'qcom_resources_init' to address the new device tree
 notation of handling the frequency domain phandles.

 [v2]
   * Fixed the alignment issues in "qcom_cpufreq_fw_target_index" for dev_err 
and
 also for "qcom_cpu_resources_init".
   * Removed ret = 0 from qcom_get_related_cpus and added to check for
 cpu_mask_empty to return -ENOENT.
   * Fixes qcom_cpu_resources_init function
   * Remove initialization of 'index'
   * Check for valid 'c'
   * Removed initialization of 'prev_cc' from 'qcom_read_lut'.

Taniya Das (2):
  dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings
  cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

 .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +++
 drivers/cpufreq/Kconfig.arm|  11 +
 drivers/cpufreq/Makefile   |   1 +
 drivers/cpufreq/qcom-cpufreq-hw.c  | 334 +
 4 files changed, 518 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
 create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the  Linux Foundation.



[PATCH v11 0/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW

2018-12-01 Thread Taniya Das
 [v11]
   * Updated the code logic as per Stephen.
   * Default boost enabled is removed.
   * Update the clock name to use "alternate" for GPLL0 source in code and
 Documentation binding.
   * Module description updated.
   * perf_base updated to perf_state_reg.

 [v10]
  * Update Documentation binding for cpufreq node.
  * Make the driver 'tristate' instead of 'bool' and update code.
  * Update the clock name to reflect the hardware name.
  * Remove support for varying offset.

 [v9]
  * Update the Documentation binding for freq-domain-cells & cpufreq node.
  * Address comments in Kconfig.arm & Makefile.
  * Remove include file & MODULE_DESCRIPTION not required.
  * Fix the code for 'of_node_put(cpu_np)'.

 [v8]
   * Address comments to update code to take cpufreq_hw phandle and index from
 the CPU nodes.
   * Updated the Documentation for the above change in DT.
   * Updated logic for assigning 'qcom_freq_domain_map' for related CPUs.
   * Clock input to the HW block is taken from DT which has been updated in
 code and Device tree documentation.

 [v7]
   * Updated the logic to check for related CPUs.

 [v6]
   * Renamed match table 'qcom_cpufreq_hw_match'.
   * Renamed 'qcom_read_lut' to 'qcom_cpufreq_hw_read_lut'.
   * Updated the logic to check for related CPUs at the beginning of the
 'qcom_cpu_resources_init'.
   * Use devm_ioremap_resource instead of devm_ioremap.
   * Update the use of of_node_put to handle error conditions.
   * Use policy->cached_resolved_idx in fast switch callback.
   * Keep precalculated offsets 'reg_bases'.
   * XO clock is taken from Device tree.
   * Update documentation binding for clocks/clock-names.
   * Minor comments in Kconfig.arm.
   * Comments to move dev_info to dev_dbg.

 [v5]
   * Remove mapping different register regions of perf/lut/enable,
 instead map the entire HW region.
   * Add reg_offset/cpufreq_qcom_std_offsets to be supplied as device data.
   * Check of src == 0 during lut read.
   * Add of_node_put(cpu_np) in qcom_get_related_cpus
   * Update the qcom_cpu_resources_init for register offset data,
 and cleanup the related cpus to keep a single copy of CPUfreq.
   * Replace FW with HW, update Kconfig, rename filename qcom-cpufreq-hw.c
   * Update the documentation binding to reflect the changes of mapping the
   * entire HW region.

 [v4]
   * Fixed console messages as per comments.
   * Return error from qcom_resources_init()
 in the cases where failed to get frequency domain.
   * Rename cpu_dev to cpu_np in qcom_resources_init,
 qcom_get_related_cpus(). Also use temp variable freq_np in
 qcom_get_related_cpus().
   * Update qcom_cpufreq_fw_get() to use the policy data to incoporate
 the hotplug use case.
   * Update code to use of fast_switching.
   * Check for !c->max_cores instead of cpumask_empty in
 qcom_get_related_cpus().
   * Update the logic of assigning 'c' to qcom_freq_domain_map[cpu].

 [v3]
   * Remove index check from 'qcom_cpufreq_fw_target_index'.
   * Update the Documentation binding to add the platform specific properties in
 the CPU nodes, node name "qcom,freq-domain".
   * Update return value to '0' from -ENODEV from 'qcom_cpufreq_fw_get'.
   * Update the logic for boost frequency to use local variables instead of
 cpufreq driver data in 'qcom_read_lut'.
   * Update the logic in 'qcom_get_related_cpus' to find the related cpus.
   * Update the reg-names to remove "_base" and also update the binding with the
 description of these registers.
   * Update the logic in 'qcom_resources_init' to address the new device tree
 notation of handling the frequency domain phandles.

 [v2]
   * Fixed the alignment issues in "qcom_cpufreq_fw_target_index" for dev_err 
and
 also for "qcom_cpu_resources_init".
   * Removed ret = 0 from qcom_get_related_cpus and added to check for
 cpu_mask_empty to return -ENOENT.
   * Fixes qcom_cpu_resources_init function
   * Remove initialization of 'index'
   * Check for valid 'c'
   * Removed initialization of 'prev_cc' from 'qcom_read_lut'.

Taniya Das (2):
  dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings
  cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

 .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +++
 drivers/cpufreq/Kconfig.arm|  11 +
 drivers/cpufreq/Makefile   |   1 +
 drivers/cpufreq/qcom-cpufreq-hw.c  | 334 +
 4 files changed, 518 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
 create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the  Linux Foundation.



Re: [PATCH v10 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das

Hello Stephen,

Thanks for the patch, I have updated the latest series with the patch 
and few comments from Matthias.


On 11/21/2018 11:53 PM, Stephen Boyd wrote:

Quoting Taniya Das (2018-11-21 02:42:47)

diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..789b2e0 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)   += omap-cpufreq.o
  obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)   += pxa2xx-cpufreq.o
  obj-$(CONFIG_PXA3xx)   += pxa3xx-cpufreq.o
  obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)+= qcom-cpufreq-kryo.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o


This isn't alphabetically sorted.


  obj-$(CONFIG_ARM_S3C2410_CPUFREQ)  += s3c2410-cpufreq.o
  obj-$(CONFIG_ARM_S3C2412_CPUFREQ)  += s3c2412-cpufreq.o
  obj-$(CONFIG_ARM_S3C2416_CPUFREQ)  += s3c2416-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..6390e85
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,346 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define CORE_COUNT_VAL(val)(((val) & (GENMASK(18, 16))) >> 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_base;
+   cpumask_t related_cpus;
+   unsigned int max_cores;
+   unsigned long xo_rate;
+   unsigned long cpu_hw_rate;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int
+qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+unsigned int index)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+
+   writel_relaxed(index, c->perf_base);
+


This isn't using the pointer directly though.


+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   struct cpufreq_qcom *c;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   c = policy->driver_data;
+
+   index = readl_relaxed(c->perf_base);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int
+qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, c->perf_base);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   policy->fast_switch_possible = true;
+   policy->freq_table = c->table;
+   policy->driver_data = c;
+
+   return 0;
+}
+
+static struct freq_attr *qcom_cpufreq_hw_attr[] = {
+   _freq_attr_scaling_available_freqs,
+   _freq_attr_scaling_boost_freqs,
+   NULL
+};
+
+static struct cpufreq_driver cpufreq_qcom_hw_driver = {
+   .flags  = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK |
+ CPUFREQ_HAVE_GOVERNOR_PER_POLICY,
+   .verify = cpufreq_generic_frequency_table_verify,
+   .target_index   = qcom_cpufreq_hw_target_index,
+   .get= qcom_cpufreq_hw_get,
+   .init   = qcom_cpufreq_hw_cpu_init,
+   .fast_switch= qcom_cpufreq_hw_fast_switch,
+   .name   = "qcom-cpufreq-hw",
+   .attr   = qcom_cpufreq_hw_attr,
+   .boost_enabled  = true,
+};
+
+static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
+   struct cpufreq_qcom *c, void __iomem *base)
+{
+   struct device *dev = >dev;
+   u32 data, src, lval, i, core_count, prev_cc, prev_freq, cur_freq;
+
+   c->table = devm_kcalloc(dev, LUT_MAX_ENTRIES + 1,
+   sizeof(*c->table), GFP_KERNEL);
+   if (!c->table)
+   return -ENOMEM;
+
+   for (i = 0; i < LUT_MAX_ENTRIES; i++) {
+   data = readl_relaxed(base + REG_LUT_TABLE + i * LUT_ROW_SIZE);
+   src = (data & GENMASK(31, 30)) >> 30;
+   

Re: [PATCH v10 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das

Hello Stephen,

Thanks for the patch, I have updated the latest series with the patch 
and few comments from Matthias.


On 11/21/2018 11:53 PM, Stephen Boyd wrote:

Quoting Taniya Das (2018-11-21 02:42:47)

diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..789b2e0 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)   += omap-cpufreq.o
  obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)   += pxa2xx-cpufreq.o
  obj-$(CONFIG_PXA3xx)   += pxa3xx-cpufreq.o
  obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)+= qcom-cpufreq-kryo.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o


This isn't alphabetically sorted.


  obj-$(CONFIG_ARM_S3C2410_CPUFREQ)  += s3c2410-cpufreq.o
  obj-$(CONFIG_ARM_S3C2412_CPUFREQ)  += s3c2412-cpufreq.o
  obj-$(CONFIG_ARM_S3C2416_CPUFREQ)  += s3c2416-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..6390e85
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,346 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define CORE_COUNT_VAL(val)(((val) & (GENMASK(18, 16))) >> 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_base;
+   cpumask_t related_cpus;
+   unsigned int max_cores;
+   unsigned long xo_rate;
+   unsigned long cpu_hw_rate;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int
+qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+unsigned int index)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+
+   writel_relaxed(index, c->perf_base);
+


This isn't using the pointer directly though.


+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   struct cpufreq_qcom *c;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   c = policy->driver_data;
+
+   index = readl_relaxed(c->perf_base);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int
+qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, c->perf_base);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   policy->fast_switch_possible = true;
+   policy->freq_table = c->table;
+   policy->driver_data = c;
+
+   return 0;
+}
+
+static struct freq_attr *qcom_cpufreq_hw_attr[] = {
+   _freq_attr_scaling_available_freqs,
+   _freq_attr_scaling_boost_freqs,
+   NULL
+};
+
+static struct cpufreq_driver cpufreq_qcom_hw_driver = {
+   .flags  = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK |
+ CPUFREQ_HAVE_GOVERNOR_PER_POLICY,
+   .verify = cpufreq_generic_frequency_table_verify,
+   .target_index   = qcom_cpufreq_hw_target_index,
+   .get= qcom_cpufreq_hw_get,
+   .init   = qcom_cpufreq_hw_cpu_init,
+   .fast_switch= qcom_cpufreq_hw_fast_switch,
+   .name   = "qcom-cpufreq-hw",
+   .attr   = qcom_cpufreq_hw_attr,
+   .boost_enabled  = true,
+};
+
+static int qcom_cpufreq_hw_read_lut(struct platform_device *pdev,
+   struct cpufreq_qcom *c, void __iomem *base)
+{
+   struct device *dev = >dev;
+   u32 data, src, lval, i, core_count, prev_cc, prev_freq, cur_freq;
+
+   c->table = devm_kcalloc(dev, LUT_MAX_ENTRIES + 1,
+   sizeof(*c->table), GFP_KERNEL);
+   if (!c->table)
+   return -ENOMEM;
+
+   for (i = 0; i < LUT_MAX_ENTRIES; i++) {
+   data = readl_relaxed(base + REG_LUT_TABLE + i * LUT_ROW_SIZE);
+   src = (data & GENMASK(31, 30)) >> 30;
+   

Re: [PATCH v10 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das

Hello Matthias,

On 11/22/2018 12:11 AM, Matthias Kaehlcke wrote:

Hi Taniya,

thanks for respinning, a few nits inline.

On Wed, Nov 21, 2018 at 04:12:47PM +0530, Taniya Das wrote:

The CPUfreq HW present in some QCOM chipsets offloads the steps necessary
for changing the frequency of CPUs. The driver implements the cpufreq
driver interface for this hardware engine.

Signed-off-by: Saravana Kannan 
Signed-off-by: Taniya Das 
---
  drivers/cpufreq/Kconfig.arm   |  11 ++
  drivers/cpufreq/Makefile  |   1 +
  drivers/cpufreq/qcom-cpufreq-hw.c | 346 ++
  3 files changed, 358 insertions(+)
  create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 4e1131e..688f102 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -114,6 +114,17 @@ config ARM_QCOM_CPUFREQ_KRYO

  If in doubt, say N.

+config ARM_QCOM_CPUFREQ_HW
+   tristate "QCOM CPUFreq HW driver"
+   depends on ARCH_QCOM || COMPILE_TEST
+   help
+ Support for the CPUFreq HW driver.
+ Some QCOM chipsets have a HW engine to offload the steps
+ necessary for changing the frequency of the CPUs. Firmware loaded
+ in this engine exposes a programming interface to the OS.
+ The driver implements the cpufreq interface for this HW engine.
+ Say Y if you want to support CPUFreq HW.
+
  config ARM_S3C_CPUFREQ
bool
help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..789b2e0 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)   += omap-cpufreq.o
  obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)  += pxa2xx-cpufreq.o
  obj-$(CONFIG_PXA3xx)  += pxa3xx-cpufreq.o
  obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)   += qcom-cpufreq-kryo.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o
  obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o
  obj-$(CONFIG_ARM_S3C2412_CPUFREQ) += s3c2412-cpufreq.o
  obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..6390e85
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,346 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define CORE_COUNT_VAL(val)(((val) & (GENMASK(18, 16))) >> 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_base;


nit: is this really a base address? It's the address of the perf state
register, right? Better name it 'perf_state_reg'/'reg_perf_state' or
similar (just 'perf_state' might be confusing, I'd expect a variable
with this name to hold a state, not an address).



I have updated the name to "perf_state_reg".


+   cpumask_t related_cpus;
+   unsigned int max_cores;
+   unsigned long xo_rate;
+   unsigned long cpu_hw_rate;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int
+qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+unsigned int index)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+
+   writel_relaxed(index, c->perf_base);
+
+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   struct cpufreq_qcom *c;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   c = policy->driver_data;
+
+   index = readl_relaxed(c->perf_base);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int
+qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, c->perf_base);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   

Re: [PATCH v10 2/2] cpufreq: qcom-hw: Add support for QCOM cpufreq HW driver

2018-12-01 Thread Taniya Das

Hello Matthias,

On 11/22/2018 12:11 AM, Matthias Kaehlcke wrote:

Hi Taniya,

thanks for respinning, a few nits inline.

On Wed, Nov 21, 2018 at 04:12:47PM +0530, Taniya Das wrote:

The CPUfreq HW present in some QCOM chipsets offloads the steps necessary
for changing the frequency of CPUs. The driver implements the cpufreq
driver interface for this hardware engine.

Signed-off-by: Saravana Kannan 
Signed-off-by: Taniya Das 
---
  drivers/cpufreq/Kconfig.arm   |  11 ++
  drivers/cpufreq/Makefile  |   1 +
  drivers/cpufreq/qcom-cpufreq-hw.c | 346 ++
  3 files changed, 358 insertions(+)
  create mode 100644 drivers/cpufreq/qcom-cpufreq-hw.c

diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 4e1131e..688f102 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -114,6 +114,17 @@ config ARM_QCOM_CPUFREQ_KRYO

  If in doubt, say N.

+config ARM_QCOM_CPUFREQ_HW
+   tristate "QCOM CPUFreq HW driver"
+   depends on ARCH_QCOM || COMPILE_TEST
+   help
+ Support for the CPUFreq HW driver.
+ Some QCOM chipsets have a HW engine to offload the steps
+ necessary for changing the frequency of the CPUs. Firmware loaded
+ in this engine exposes a programming interface to the OS.
+ The driver implements the cpufreq interface for this HW engine.
+ Say Y if you want to support CPUFreq HW.
+
  config ARM_S3C_CPUFREQ
bool
help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index d5ee456..789b2e0 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)   += omap-cpufreq.o
  obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)  += pxa2xx-cpufreq.o
  obj-$(CONFIG_PXA3xx)  += pxa3xx-cpufreq.o
  obj-$(CONFIG_ARM_QCOM_CPUFREQ_KRYO)   += qcom-cpufreq-kryo.o
+obj-$(CONFIG_ARM_QCOM_CPUFREQ_HW)  += qcom-cpufreq-hw.o
  obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o
  obj-$(CONFIG_ARM_S3C2412_CPUFREQ) += s3c2412-cpufreq.o
  obj-$(CONFIG_ARM_S3C2416_CPUFREQ) += s3c2416-cpufreq.o
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c 
b/drivers/cpufreq/qcom-cpufreq-hw.c
new file mode 100644
index 000..6390e85
--- /dev/null
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -0,0 +1,346 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LUT_MAX_ENTRIES40U
+#define CORE_COUNT_VAL(val)(((val) & (GENMASK(18, 16))) >> 16)
+#define LUT_ROW_SIZE   32
+#define CLK_HW_DIV 2
+
+/* Register offsets */
+#define REG_ENABLE 0x0
+#define REG_LUT_TABLE  0x110
+#define REG_PERF_STATE 0x920
+
+struct cpufreq_qcom {
+   struct cpufreq_frequency_table *table;
+   void __iomem *perf_base;


nit: is this really a base address? It's the address of the perf state
register, right? Better name it 'perf_state_reg'/'reg_perf_state' or
similar (just 'perf_state' might be confusing, I'd expect a variable
with this name to hold a state, not an address).



I have updated the name to "perf_state_reg".


+   cpumask_t related_cpus;
+   unsigned int max_cores;
+   unsigned long xo_rate;
+   unsigned long cpu_hw_rate;
+};
+
+static struct cpufreq_qcom *qcom_freq_domain_map[NR_CPUS];
+
+static int
+qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
+unsigned int index)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+
+   writel_relaxed(index, c->perf_base);
+
+   return 0;
+}
+
+static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
+{
+   struct cpufreq_qcom *c;
+   struct cpufreq_policy *policy;
+   unsigned int index;
+
+   policy = cpufreq_cpu_get_raw(cpu);
+   if (!policy)
+   return 0;
+
+   c = policy->driver_data;
+
+   index = readl_relaxed(c->perf_base);
+   index = min(index, LUT_MAX_ENTRIES - 1);
+
+   return policy->freq_table[index].frequency;
+}
+
+static unsigned int
+qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
+   unsigned int target_freq)
+{
+   struct cpufreq_qcom *c = policy->driver_data;
+   int index;
+
+   index = policy->cached_resolved_idx;
+   if (index < 0)
+   return 0;
+
+   writel_relaxed(index, c->perf_base);
+
+   return policy->freq_table[index].frequency;
+}
+
+static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
+{
+   struct cpufreq_qcom *c;
+
+   c = qcom_freq_domain_map[policy->cpu];
+   if (!c) {
+   pr_err("No scaling support for CPU%d\n", policy->cpu);
+   return -ENODEV;
+   }
+
+   cpumask_copy(policy->cpus, >related_cpus);
+
+   

Re: [PATCH v10 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das

Hello Matthias,

On 11/21/2018 11:32 PM, Matthias Kaehlcke wrote:

On Wed, Nov 21, 2018 at 04:12:46PM +0530, Taniya Das wrote:

Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
  .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
  1 file changed, 172 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..90e396b
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "cpu_clk".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+   qcom,freq-domain = <_hw 1>;
+ 

Re: [PATCH v10 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das

Hello Matthias,

On 11/21/2018 11:32 PM, Matthias Kaehlcke wrote:

On Wed, Nov 21, 2018 at 04:12:46PM +0530, Taniya Das wrote:

Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
  .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
  1 file changed, 172 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..90e396b
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "cpu_clk".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+   qcom,freq-domain = <_hw 1>;
+ 

Re: [PATCH v10 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das

Hello Rob,

On 11/27/2018 12:28 AM, Rob Herring wrote:

On Wed, Nov 21, 2018 at 10:02:36AM -0800, Matthias Kaehlcke wrote:

On Wed, Nov 21, 2018 at 04:12:46PM +0530, Taniya Das wrote:

Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
  .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
  1 file changed, 172 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..90e396b
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "cpu_clk".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+

Re: [PATCH v10 1/2] dt-bindings: cpufreq: Introduce QCOM CPUFREQ Firmware bindings

2018-12-01 Thread Taniya Das

Hello Rob,

On 11/27/2018 12:28 AM, Rob Herring wrote:

On Wed, Nov 21, 2018 at 10:02:36AM -0800, Matthias Kaehlcke wrote:

On Wed, Nov 21, 2018 at 04:12:46PM +0530, Taniya Das wrote:

Add QCOM cpufreq firmware device bindings for Qualcomm Technology Inc's
SoCs. This is required for managing the cpu frequency transitions which are
controlled by the hardware engine.

Signed-off-by: Taniya Das 
---
  .../bindings/cpufreq/cpufreq-qcom-hw.txt   | 172 +
  1 file changed, 172 insertions(+)
  create mode 100644 
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt 
b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
new file mode 100644
index 000..90e396b
--- /dev/null
+++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
@@ -0,0 +1,172 @@
+Qualcomm Technologies, Inc. CPUFREQ Bindings
+
+CPUFREQ HW is a hardware engine used by some Qualcomm Technologies, Inc. (QTI)
+SoCs to manage frequency in hardware. It is capable of controlling frequency
+for multiple clusters.
+
+Properties:
+- compatible
+   Usage:  required
+   Value type: 
+   Definition: must be "qcom,cpufreq-hw".
+
+- clocks
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: clock handle for XO clock and GPLL0 clock.
+
+- clock-names
+   Usage:  required
+   Value type:  From common clock binding.
+   Definition: must be "xo", "cpu_clk".
+
+- reg
+   Usage:  required
+   Value type: 
+   Definition: Addresses and sizes for the memory of the HW bases in
+   each frequency domain.
+- reg-names
+   Usage:  Optional
+   Value type: 
+   Definition: Frequency domain name i.e.
+   "freq-domain0", "freq-domain1".
+
+- freq-domain-cells:
+   Usage:  required.
+   Definition: Number of cells in a freqency domain specifier.
+
+* Property qcom,freq-domain
+Devices supporting freq-domain must set their "qcom,freq-domain" property with
+phandle to a cpufreq_hw followed by the Domain ID(0/1) in the CPU DT node.
+
+
+Example:
+
+Example 1: Dual-cluster, Quad-core per cluster. CPUs within a cluster switch
+DCVS state together.
+
+/ {
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@0 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x0>;
+   enable-method = "psci";
+   next-level-cache = <_0>;
+   qcom,freq-domain = <_hw 0>;
+   L2_0: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   L3_0: l3-cache {
+ compatible = "cache";
+   };
+   };
+   };
+
+   CPU1: cpu@100 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   next-level-cache = <_100>;
+   qcom,freq-domain = <_hw 0>;
+   L2_100: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU2: cpu@200 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x200>;
+   enable-method = "psci";
+   next-level-cache = <_200>;
+   qcom,freq-domain = <_hw 0>;
+   L2_200: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU3: cpu@300 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x300>;
+   enable-method = "psci";
+   next-level-cache = <_300>;
+   qcom,freq-domain = <_hw 0>;
+   L2_300: l2-cache {
+   compatible = "cache";
+   next-level-cache = <_0>;
+   };
+   };
+
+   CPU4: cpu@400 {
+   device_type = "cpu";
+   compatible = "qcom,kryo385";
+   reg = <0x0 0x400>;
+   enable-method = "psci";
+   next-level-cache = <_400>;
+

[PATCH] s390: convert to DEFINE_SHOW_ATTRIBUTE

2018-12-01 Thread Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li 
---
 drivers/s390/block/dasd.c | 15 +--
 drivers/s390/cio/qdio_debug.c | 16 ++--
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 5e9ebdb0594c..397af07e4d88 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1192,20 +1192,7 @@ static int dasd_hosts_show(struct seq_file *m, void *v)
return rc;
 }
 
-static int dasd_hosts_open(struct inode *inode, struct file *file)
-{
-   struct dasd_device *device = inode->i_private;
-
-   return single_open(file, dasd_hosts_show, device);
-}
-
-static const struct file_operations dasd_hosts_fops = {
-   .owner  = THIS_MODULE,
-   .open   = dasd_hosts_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(dasd_hosts);
 
 static void dasd_hosts_exit(struct dasd_device *device)
 {
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index 68a82f3e2e92..040061f2bfff 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -190,19 +190,7 @@ static int qstat_show(struct seq_file *m, void *v)
return 0;
 }
 
-static int qstat_seq_open(struct inode *inode, struct file *filp)
-{
-   return single_open(filp, qstat_show,
-  file_inode(filp)->i_private);
-}
-
-static const struct file_operations debugfs_fops = {
-   .owner   = THIS_MODULE,
-   .open= qstat_seq_open,
-   .read= seq_read,
-   .llseek  = seq_lseek,
-   .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qstat);
 
 static char *qperf_names[] = {
"Assumed adapter interrupts",
@@ -306,7 +294,7 @@ static void setup_debugfs_entry(struct qdio_q *q)
 q->is_input_q ? "input" : "output",
 q->nr);
q->debugfs_q = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,
-   q->irq_ptr->debugfs_dev, q, _fops);
+   q->irq_ptr->debugfs_dev, q, _fops);
if (IS_ERR(q->debugfs_q))
q->debugfs_q = NULL;
 }
-- 
2.17.0



[PATCH] s390: convert to DEFINE_SHOW_ATTRIBUTE

2018-12-01 Thread Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li 
---
 drivers/s390/block/dasd.c | 15 +--
 drivers/s390/cio/qdio_debug.c | 16 ++--
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 5e9ebdb0594c..397af07e4d88 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1192,20 +1192,7 @@ static int dasd_hosts_show(struct seq_file *m, void *v)
return rc;
 }
 
-static int dasd_hosts_open(struct inode *inode, struct file *file)
-{
-   struct dasd_device *device = inode->i_private;
-
-   return single_open(file, dasd_hosts_show, device);
-}
-
-static const struct file_operations dasd_hosts_fops = {
-   .owner  = THIS_MODULE,
-   .open   = dasd_hosts_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(dasd_hosts);
 
 static void dasd_hosts_exit(struct dasd_device *device)
 {
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
index 68a82f3e2e92..040061f2bfff 100644
--- a/drivers/s390/cio/qdio_debug.c
+++ b/drivers/s390/cio/qdio_debug.c
@@ -190,19 +190,7 @@ static int qstat_show(struct seq_file *m, void *v)
return 0;
 }
 
-static int qstat_seq_open(struct inode *inode, struct file *filp)
-{
-   return single_open(filp, qstat_show,
-  file_inode(filp)->i_private);
-}
-
-static const struct file_operations debugfs_fops = {
-   .owner   = THIS_MODULE,
-   .open= qstat_seq_open,
-   .read= seq_read,
-   .llseek  = seq_lseek,
-   .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(qstat);
 
 static char *qperf_names[] = {
"Assumed adapter interrupts",
@@ -306,7 +294,7 @@ static void setup_debugfs_entry(struct qdio_q *q)
 q->is_input_q ? "input" : "output",
 q->nr);
q->debugfs_q = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,
-   q->irq_ptr->debugfs_dev, q, _fops);
+   q->irq_ptr->debugfs_dev, q, _fops);
if (IS_ERR(q->debugfs_q))
q->debugfs_q = NULL;
 }
-- 
2.17.0



Re: [PATCH RFC 14/15] lib: replace **** with a hug

2018-12-01 Thread Sergey Senozhatsky
On (11/30/18 12:59), Jarkko Sakkinen wrote:
> On Fri, Nov 30, 2018 at 02:41:11PM -0500, Steven Rostedt wrote:
> > Since the code has been greatly modified since that comment was added,
> > I would say the comment is simply out of date.
> > 
> > Just nuke the comment, and that will be an accurate change with or
> > without CoC.
> 
> Thanks, will do.

Well, nuking the comment is OK.

Could you please help me understand one thing:
  Linus has made a comment; in his own words, about his own
  code. Why would anyone be offended by this?


More importantly, if this is now non-CoC-complaint, will I face
any penalties for
"Yikes! I'm a moron; my patch broke NMI printk, sorry!"
email?

-ss


Re: [PATCH RFC 14/15] lib: replace **** with a hug

2018-12-01 Thread Sergey Senozhatsky
On (11/30/18 12:59), Jarkko Sakkinen wrote:
> On Fri, Nov 30, 2018 at 02:41:11PM -0500, Steven Rostedt wrote:
> > Since the code has been greatly modified since that comment was added,
> > I would say the comment is simply out of date.
> > 
> > Just nuke the comment, and that will be an accurate change with or
> > without CoC.
> 
> Thanks, will do.

Well, nuking the comment is OK.

Could you please help me understand one thing:
  Linus has made a comment; in his own words, about his own
  code. Why would anyone be offended by this?


More importantly, if this is now non-CoC-complaint, will I face
any penalties for
"Yikes! I'm a moron; my patch broke NMI printk, sorry!"
email?

-ss


[PATCH] mfd: convert to DEFINE_SHOW_ATTRIBUTE

2018-12-01 Thread Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li 
---
 drivers/mfd/ab3100-core.c | 15 ++-
 drivers/mfd/ab3100-otp.c  | 16 +++-
 drivers/mfd/tps65010.c| 14 ++
 3 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 099635bed188..3fe448a29389 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -451,7 +451,7 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)
 /*
  * Some debugfs entries only exposed if we're using debug
  */
-static int ab3100_registers_print(struct seq_file *s, void *p)
+static int ab3100_registers_show(struct seq_file *s, void *p)
 {
struct ab3100 *ab3100 = s->private;
u8 value;
@@ -466,18 +466,7 @@ static int ab3100_registers_print(struct seq_file *s, void 
*p)
return 0;
 }
 
-static int ab3100_registers_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, ab3100_registers_print, inode->i_private);
-}
-
-static const struct file_operations ab3100_registers_fops = {
-   .open = ab3100_registers_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_registers);
 
 struct ab3100_get_set_reg_priv {
struct ab3100 *ab3100;
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c
index 55b207a4b336..24873e1ae865 100644
--- a/drivers/mfd/ab3100-otp.c
+++ b/drivers/mfd/ab3100-otp.c
@@ -96,7 +96,7 @@ static int __init ab3100_otp_read(struct ab3100_otp *otp)
  * the contents of the OTP.
  */
 #ifdef CONFIG_DEBUG_FS
-static int ab3100_show_otp(struct seq_file *s, void *v)
+static int ab3100_otp_show(struct seq_file *s, void *v)
 {
struct ab3100_otp *otp = s->private;
 
@@ -110,24 +110,14 @@ static int ab3100_show_otp(struct seq_file *s, void *v)
return 0;
 }
 
-static int ab3100_otp_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, ab3100_show_otp, inode->i_private);
-}
-
-static const struct file_operations ab3100_otp_operations = {
-   .open   = ab3100_otp_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_otp);
 
 static int __init ab3100_otp_init_debugfs(struct device *dev,
  struct ab3100_otp *otp)
 {
otp->debugfs = debugfs_create_file("ab3100_otp", S_IFREG | S_IRUGO,
   NULL, otp,
-  _otp_operations);
+  _otp_fops);
if (!otp->debugfs) {
dev_err(dev, "AB3100 debugfs OTP file registration failed!\n");
return -ENOENT;
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 2ab67386b4ef..4202b5c40f18 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -192,7 +192,7 @@ static inline void show_chgconfig(int por, const char 
*label, u8 chgconfig) { }
 
 #ifdef CONFIG_DEBUG_FS
 
-static int dbg_show(struct seq_file *s, void *_)
+static int debug_show(struct seq_file *s, void *_)
 {
struct tps65010 *tps = s->private;
u8  value, v2;
@@ -296,17 +296,7 @@ static int dbg_show(struct seq_file *s, void *_)
return 0;
 }
 
-static int dbg_tps_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dbg_show, inode->i_private);
-}
-
-static const struct file_operations debug_fops = {
-   .open   = dbg_tps_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(debug);
 
 #defineDEBUG_FOPS  _fops
 
-- 
2.17.0



[PATCH] mfd: convert to DEFINE_SHOW_ATTRIBUTE

2018-12-01 Thread Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li 
---
 drivers/mfd/ab3100-core.c | 15 ++-
 drivers/mfd/ab3100-otp.c  | 16 +++-
 drivers/mfd/tps65010.c| 14 ++
 3 files changed, 7 insertions(+), 38 deletions(-)

diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 099635bed188..3fe448a29389 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -451,7 +451,7 @@ static irqreturn_t ab3100_irq_handler(int irq, void *data)
 /*
  * Some debugfs entries only exposed if we're using debug
  */
-static int ab3100_registers_print(struct seq_file *s, void *p)
+static int ab3100_registers_show(struct seq_file *s, void *p)
 {
struct ab3100 *ab3100 = s->private;
u8 value;
@@ -466,18 +466,7 @@ static int ab3100_registers_print(struct seq_file *s, void 
*p)
return 0;
 }
 
-static int ab3100_registers_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, ab3100_registers_print, inode->i_private);
-}
-
-static const struct file_operations ab3100_registers_fops = {
-   .open = ab3100_registers_open,
-   .read = seq_read,
-   .llseek = seq_lseek,
-   .release = single_release,
-   .owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_registers);
 
 struct ab3100_get_set_reg_priv {
struct ab3100 *ab3100;
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c
index 55b207a4b336..24873e1ae865 100644
--- a/drivers/mfd/ab3100-otp.c
+++ b/drivers/mfd/ab3100-otp.c
@@ -96,7 +96,7 @@ static int __init ab3100_otp_read(struct ab3100_otp *otp)
  * the contents of the OTP.
  */
 #ifdef CONFIG_DEBUG_FS
-static int ab3100_show_otp(struct seq_file *s, void *v)
+static int ab3100_otp_show(struct seq_file *s, void *v)
 {
struct ab3100_otp *otp = s->private;
 
@@ -110,24 +110,14 @@ static int ab3100_show_otp(struct seq_file *s, void *v)
return 0;
 }
 
-static int ab3100_otp_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, ab3100_show_otp, inode->i_private);
-}
-
-static const struct file_operations ab3100_otp_operations = {
-   .open   = ab3100_otp_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(ab3100_otp);
 
 static int __init ab3100_otp_init_debugfs(struct device *dev,
  struct ab3100_otp *otp)
 {
otp->debugfs = debugfs_create_file("ab3100_otp", S_IFREG | S_IRUGO,
   NULL, otp,
-  _otp_operations);
+  _otp_fops);
if (!otp->debugfs) {
dev_err(dev, "AB3100 debugfs OTP file registration failed!\n");
return -ENOENT;
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 2ab67386b4ef..4202b5c40f18 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -192,7 +192,7 @@ static inline void show_chgconfig(int por, const char 
*label, u8 chgconfig) { }
 
 #ifdef CONFIG_DEBUG_FS
 
-static int dbg_show(struct seq_file *s, void *_)
+static int debug_show(struct seq_file *s, void *_)
 {
struct tps65010 *tps = s->private;
u8  value, v2;
@@ -296,17 +296,7 @@ static int dbg_show(struct seq_file *s, void *_)
return 0;
 }
 
-static int dbg_tps_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, dbg_show, inode->i_private);
-}
-
-static const struct file_operations debug_fops = {
-   .open   = dbg_tps_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(debug);
 
 #defineDEBUG_FOPS  _fops
 
-- 
2.17.0



[PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Yangtao Li
We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
to simplify some code.

Signed-off-by: Yangtao Li 
---
Changes in v2:
-Remove a missing DEBUGFS_RO_ATTR
---
 drivers/mtd/devices/docg3.c| 20 
 drivers/mtd/devices/docg3.h| 11 ---
 drivers/mtd/mtdswap.c  | 12 +---
 drivers/mtd/nand/raw/nandsim.c | 16 +++-
 4 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 512bd4c2eec0..80143972963e 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
*pdev,
 /*
  * Debug sysfs entries
  */
-static int dbg_flashctrl_show(struct seq_file *s, void *p)
+static int flashcontrol_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, void 
*p)
 
return 0;
 }
-DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
 
-static int dbg_asicmode_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(flashcontrol);
+
+static int asic_mode_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1660,9 +1661,10 @@ static int dbg_asicmode_show(struct seq_file *s, void *p)
seq_puts(s, ")\n");
return 0;
 }
-DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
 
-static int dbg_device_id_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(asic_mode);
+
+static int device_id_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int id;
@@ -1674,9 +1676,10 @@ static int dbg_device_id_show(struct seq_file *s, void 
*p)
seq_printf(s, "DeviceId = %d\n", id);
return 0;
 }
-DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
 
-static int dbg_protection_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(device_id);
+
+static int protection_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int protect, dps0, dps0_low, dps0_high, dps1, dps1_low, dps1_high;
@@ -1726,7 +1729,8 @@ static int dbg_protection_show(struct seq_file *s, void 
*p)
   !!(dps1 & DOC_DPS_KEY_OK));
return 0;
 }
-DEBUGFS_RO_ATTR(protection, dbg_protection_show);
+
+DEFINE_SHOW_ATTRIBUTE(protection);
 
 static void __init doc_dbg_register(struct mtd_info *floor)
 {
diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h
index e99946575398..e16dca23655b 100644
--- a/drivers/mtd/devices/docg3.h
+++ b/drivers/mtd/devices/docg3.h
@@ -317,17 +317,6 @@ struct docg3 {
 #define doc_info(fmt, arg...) dev_info(docg3->dev, (fmt), ## arg)
 #define doc_dbg(fmt, arg...) dev_dbg(docg3->dev, (fmt), ## arg)
 #define doc_vdbg(fmt, arg...) dev_vdbg(docg3->dev, (fmt), ## arg)
-
-#define DEBUGFS_RO_ATTR(name, show_fct) \
-   static int name##_open(struct inode *inode, struct file *file) \
-   { return single_open(file, show_fct, inode->i_private); }  \
-   static const struct file_operations name##_fops = { \
-   .owner = THIS_MODULE, \
-   .open = name##_open, \
-   .llseek = seq_lseek, \
-   .read = seq_read, \
-   .release = single_release \
-   };
 #endif
 
 /*
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index d9dcb2d051b4..3afda6c95d62 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1266,17 +1266,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
return 0;
 }
 
-static int mtdswap_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, mtdswap_show, inode->i_private);
-}
-
-static const struct file_operations mtdswap_fops = {
-   .open   = mtdswap_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(mtdswap);
 
 static int mtdswap_add_debugfs(struct mtdswap_dev *d)
 {
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index c452819f6123..2d5532042803 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -443,7 +443,7 @@ static unsigned long total_wear = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static int nandsim_debugfs_show(struct seq_file *m, void *private)
+static int nandsim_show(struct seq_file *m, void *private)
 {
unsigned long wmin = -1, wmax = 0, avg;
unsigned long deciles[10], decile_max[10], tot = 0;
@@ -495,17 +495,7 @@ static int nandsim_debugfs_show(struct seq_file *m, void 
*private)
return 0;
 }
 
-static int nandsim_debugfs_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, nandsim_debugfs_show, inode->i_private);
-}
-

[PATCH v2] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread Yangtao Li
We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
such a macro,so remove DEBUGFS_RO_ATTR.Also use DEFINE_SHOW_ATTRIBUTE
to simplify some code.

Signed-off-by: Yangtao Li 
---
Changes in v2:
-Remove a missing DEBUGFS_RO_ATTR
---
 drivers/mtd/devices/docg3.c| 20 
 drivers/mtd/devices/docg3.h| 11 ---
 drivers/mtd/mtdswap.c  | 12 +---
 drivers/mtd/nand/raw/nandsim.c | 16 +++-
 4 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 512bd4c2eec0..80143972963e 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1603,7 +1603,7 @@ static void doc_unregister_sysfs(struct platform_device 
*pdev,
 /*
  * Debug sysfs entries
  */
-static int dbg_flashctrl_show(struct seq_file *s, void *p)
+static int flashcontrol_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1623,9 +1623,10 @@ static int dbg_flashctrl_show(struct seq_file *s, void 
*p)
 
return 0;
 }
-DEBUGFS_RO_ATTR(flashcontrol, dbg_flashctrl_show);
 
-static int dbg_asicmode_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(flashcontrol);
+
+static int asic_mode_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
 
@@ -1660,9 +1661,10 @@ static int dbg_asicmode_show(struct seq_file *s, void *p)
seq_puts(s, ")\n");
return 0;
 }
-DEBUGFS_RO_ATTR(asic_mode, dbg_asicmode_show);
 
-static int dbg_device_id_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(asic_mode);
+
+static int device_id_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int id;
@@ -1674,9 +1676,10 @@ static int dbg_device_id_show(struct seq_file *s, void 
*p)
seq_printf(s, "DeviceId = %d\n", id);
return 0;
 }
-DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
 
-static int dbg_protection_show(struct seq_file *s, void *p)
+DEFINE_SHOW_ATTRIBUTE(device_id);
+
+static int protection_show(struct seq_file *s, void *p)
 {
struct docg3 *docg3 = (struct docg3 *)s->private;
int protect, dps0, dps0_low, dps0_high, dps1, dps1_low, dps1_high;
@@ -1726,7 +1729,8 @@ static int dbg_protection_show(struct seq_file *s, void 
*p)
   !!(dps1 & DOC_DPS_KEY_OK));
return 0;
 }
-DEBUGFS_RO_ATTR(protection, dbg_protection_show);
+
+DEFINE_SHOW_ATTRIBUTE(protection);
 
 static void __init doc_dbg_register(struct mtd_info *floor)
 {
diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h
index e99946575398..e16dca23655b 100644
--- a/drivers/mtd/devices/docg3.h
+++ b/drivers/mtd/devices/docg3.h
@@ -317,17 +317,6 @@ struct docg3 {
 #define doc_info(fmt, arg...) dev_info(docg3->dev, (fmt), ## arg)
 #define doc_dbg(fmt, arg...) dev_dbg(docg3->dev, (fmt), ## arg)
 #define doc_vdbg(fmt, arg...) dev_vdbg(docg3->dev, (fmt), ## arg)
-
-#define DEBUGFS_RO_ATTR(name, show_fct) \
-   static int name##_open(struct inode *inode, struct file *file) \
-   { return single_open(file, show_fct, inode->i_private); }  \
-   static const struct file_operations name##_fops = { \
-   .owner = THIS_MODULE, \
-   .open = name##_open, \
-   .llseek = seq_lseek, \
-   .read = seq_read, \
-   .release = single_release \
-   };
 #endif
 
 /*
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index d9dcb2d051b4..3afda6c95d62 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -1266,17 +1266,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
return 0;
 }
 
-static int mtdswap_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, mtdswap_show, inode->i_private);
-}
-
-static const struct file_operations mtdswap_fops = {
-   .open   = mtdswap_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(mtdswap);
 
 static int mtdswap_add_debugfs(struct mtdswap_dev *d)
 {
diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index c452819f6123..2d5532042803 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -443,7 +443,7 @@ static unsigned long total_wear = 0;
 /* MTD structure for NAND controller */
 static struct mtd_info *nsmtd;
 
-static int nandsim_debugfs_show(struct seq_file *m, void *private)
+static int nandsim_show(struct seq_file *m, void *private)
 {
unsigned long wmin = -1, wmax = 0, avg;
unsigned long deciles[10], decile_max[10], tot = 0;
@@ -495,17 +495,7 @@ static int nandsim_debugfs_show(struct seq_file *m, void 
*private)
return 0;
 }
 
-static int nandsim_debugfs_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, nandsim_debugfs_show, inode->i_private);
-}
-

Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-01 Thread Andy Lutomirski
On Sat, Dec 1, 2018 at 4:07 PM Eric W. Biederman  wrote:
>
> Andy Lutomirski  writes:
>
> >> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman  
> >> wrote:
> >>
> >>
> >> It just occurs to me that the simple way to implement
> >> procfd_sigqueueinfo info is like:
> >>
> >> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t *uinfo)
> >> {
> >> #ifdef CONFIG_COMPAT
> >>if (in_compat_syscall)
> >>return copy_siginfo_from_user32(info, uinfo);
> >> #endif
> >>return copy_siginfo_from_user(info, uinfo);
> >> }
> >>
> >> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo)
> >> {
> >>kernel_siginfo info;
> >>
> >>if (copy_siginfo_from_user_any(, uinfo))
> >>return -EFAULT;
> >>...;
> >> }
> >>
> >> It looks like there is already a place in ptrace.c that already
> >> hand rolls copy_siginfo_from_user_any.
> >>
> >> So while I would love to figure out the subset of siginfo_t tha we can
> >> just pass through, as I think that would make a better more forward
> >> compatible copy_siginfo_from_user32.
> >
> > Seems reasonable to me. It’s less code overall than any other suggestion, 
> > too.
> >
> >>  I think for this use case we just
> >> add the in_compat_syscall test and then we just need to ensure this new
> >> system call is placed in the proper places in the syscall table.
> >>
> >> Because we will need 3 call sights: x86_64, x32 and ia32.  As the layout
> >> changes between those three subarchitecuters.
> >>
> >>
> >
> > If it’s done this way, it can just be “common” in the 64-bit
> > table. And we kick the can a bit farther down the road :)
> >
> > I’m working on patches to clean up x86’s syscall mess. It’s slow
> > because I keep finding new messes.  So far I have rt_sigreturn working
> > like every other syscall — whee.
> >
> > Also, Eric, for your edification, I have a draft patch set to
> > radically simplify x86’s signal delivery and return.  Once that’s
> > done, I can trivially speed up delivery by a ton by using sysret.
>
> Nice.
>
> Do we care about the performance of synchronous signal delivery (AKA
> hardware exceptions) vs ordinary signal delivery.  I get the feeling
> there are serious simplifications to be had in that case.
>


I dunno what user code cares about.  Linux's support for synchronous
exception handling is so far behind, say, Windows, that I don't know
if it's even used for anything very serious.  We should probably
profile it after I finish my changes and we can see how bad it is.  We
can't do anything at all about the time it takes the CPU to deliver
the exception, and trying to avoid IRET when we return would be tricky
at best, although siglongjmp() might end up skipping it.


Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-01 Thread Andy Lutomirski
On Sat, Dec 1, 2018 at 4:07 PM Eric W. Biederman  wrote:
>
> Andy Lutomirski  writes:
>
> >> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman  
> >> wrote:
> >>
> >>
> >> It just occurs to me that the simple way to implement
> >> procfd_sigqueueinfo info is like:
> >>
> >> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t *uinfo)
> >> {
> >> #ifdef CONFIG_COMPAT
> >>if (in_compat_syscall)
> >>return copy_siginfo_from_user32(info, uinfo);
> >> #endif
> >>return copy_siginfo_from_user(info, uinfo);
> >> }
> >>
> >> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo)
> >> {
> >>kernel_siginfo info;
> >>
> >>if (copy_siginfo_from_user_any(, uinfo))
> >>return -EFAULT;
> >>...;
> >> }
> >>
> >> It looks like there is already a place in ptrace.c that already
> >> hand rolls copy_siginfo_from_user_any.
> >>
> >> So while I would love to figure out the subset of siginfo_t tha we can
> >> just pass through, as I think that would make a better more forward
> >> compatible copy_siginfo_from_user32.
> >
> > Seems reasonable to me. It’s less code overall than any other suggestion, 
> > too.
> >
> >>  I think for this use case we just
> >> add the in_compat_syscall test and then we just need to ensure this new
> >> system call is placed in the proper places in the syscall table.
> >>
> >> Because we will need 3 call sights: x86_64, x32 and ia32.  As the layout
> >> changes between those three subarchitecuters.
> >>
> >>
> >
> > If it’s done this way, it can just be “common” in the 64-bit
> > table. And we kick the can a bit farther down the road :)
> >
> > I’m working on patches to clean up x86’s syscall mess. It’s slow
> > because I keep finding new messes.  So far I have rt_sigreturn working
> > like every other syscall — whee.
> >
> > Also, Eric, for your edification, I have a draft patch set to
> > radically simplify x86’s signal delivery and return.  Once that’s
> > done, I can trivially speed up delivery by a ton by using sysret.
>
> Nice.
>
> Do we care about the performance of synchronous signal delivery (AKA
> hardware exceptions) vs ordinary signal delivery.  I get the feeling
> there are serious simplifications to be had in that case.
>


I dunno what user code cares about.  Linux's support for synchronous
exception handling is so far behind, say, Windows, that I don't know
if it's even used for anything very serious.  We should probably
profile it after I finish my changes and we can see how bad it is.  We
can't do anything at all about the time it takes the CPU to deliver
the exception, and trying to avoid IRET when we return would be tricky
at best, although siglongjmp() might end up skipping it.


Re:

2018-12-01 Thread Ahmed Adama
-- 
I solicit your cooperation in a $7 Million transaction business that
will benefit both of us and i need your trust reply for more details.

Kind regards
Ahmed.


Re:

2018-12-01 Thread Ahmed Adama
-- 
I solicit your cooperation in a $7 Million transaction business that
will benefit both of us and i need your trust reply for more details.

Kind regards
Ahmed.


Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-01 Thread Eric W. Biederman
Andy Lutomirski  writes:

>> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman  wrote:
>> 
>> 
>> It just occurs to me that the simple way to implement
>> procfd_sigqueueinfo info is like:
>> 
>> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t *uinfo)
>> {
>> #ifdef CONFIG_COMPAT
>>if (in_compat_syscall)
>>return copy_siginfo_from_user32(info, uinfo);
>> #endif
>>return copy_siginfo_from_user(info, uinfo);
>> }
>> 
>> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo)
>> {
>>kernel_siginfo info;
>> 
>>if (copy_siginfo_from_user_any(, uinfo))
>>return -EFAULT;
>>...;
>> }
>> 
>> It looks like there is already a place in ptrace.c that already
>> hand rolls copy_siginfo_from_user_any.
>> 
>> So while I would love to figure out the subset of siginfo_t tha we can
>> just pass through, as I think that would make a better more forward
>> compatible copy_siginfo_from_user32.
>
> Seems reasonable to me. It’s less code overall than any other suggestion, too.
>
>>  I think for this use case we just
>> add the in_compat_syscall test and then we just need to ensure this new
>> system call is placed in the proper places in the syscall table.
>> 
>> Because we will need 3 call sights: x86_64, x32 and ia32.  As the layout
>> changes between those three subarchitecuters.
>> 
>> 
>
> If it’s done this way, it can just be “common” in the 64-bit
> table. And we kick the can a bit farther down the road :)
>
> I’m working on patches to clean up x86’s syscall mess. It’s slow
> because I keep finding new messes.  So far I have rt_sigreturn working
> like every other syscall — whee.
>
> Also, Eric, for your edification, I have a draft patch set to
> radically simplify x86’s signal delivery and return.  Once that’s
> done, I can trivially speed up delivery by a ton by using sysret.

Nice.

Do we care about the performance of synchronous signal delivery (AKA
hardware exceptions) vs ordinary signal delivery.  I get the feeling
there are serious simplifications to be had in that case.

Eric




Re: [PATCH v2] signal: add procfd_signal() syscall

2018-12-01 Thread Eric W. Biederman
Andy Lutomirski  writes:

>> On Dec 1, 2018, at 7:28 AM, Eric W. Biederman  wrote:
>> 
>> 
>> It just occurs to me that the simple way to implement
>> procfd_sigqueueinfo info is like:
>> 
>> int copy_siginfo_from_user_any(kernel_siginfo_t *info, siginfo_t *uinfo)
>> {
>> #ifdef CONFIG_COMPAT
>>if (in_compat_syscall)
>>return copy_siginfo_from_user32(info, uinfo);
>> #endif
>>return copy_siginfo_from_user(info, uinfo);
>> }
>> 
>> long procfd_sigqueueinfo(int fd, siginfo_t *uinfo)
>> {
>>kernel_siginfo info;
>> 
>>if (copy_siginfo_from_user_any(, uinfo))
>>return -EFAULT;
>>...;
>> }
>> 
>> It looks like there is already a place in ptrace.c that already
>> hand rolls copy_siginfo_from_user_any.
>> 
>> So while I would love to figure out the subset of siginfo_t tha we can
>> just pass through, as I think that would make a better more forward
>> compatible copy_siginfo_from_user32.
>
> Seems reasonable to me. It’s less code overall than any other suggestion, too.
>
>>  I think for this use case we just
>> add the in_compat_syscall test and then we just need to ensure this new
>> system call is placed in the proper places in the syscall table.
>> 
>> Because we will need 3 call sights: x86_64, x32 and ia32.  As the layout
>> changes between those three subarchitecuters.
>> 
>> 
>
> If it’s done this way, it can just be “common” in the 64-bit
> table. And we kick the can a bit farther down the road :)
>
> I’m working on patches to clean up x86’s syscall mess. It’s slow
> because I keep finding new messes.  So far I have rt_sigreturn working
> like every other syscall — whee.
>
> Also, Eric, for your edification, I have a draft patch set to
> radically simplify x86’s signal delivery and return.  Once that’s
> done, I can trivially speed up delivery by a ton by using sysret.

Nice.

Do we care about the performance of synchronous signal delivery (AKA
hardware exceptions) vs ordinary signal delivery.  I get the feeling
there are serious simplifications to be had in that case.

Eric




Re: [PATCH] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread kbuild test robot
Hi Yangtao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Yangtao-Li/mtd-remove-DEBUGFS_RO_ATTR/20181202-065958
base:   git://git.infradead.org/linux-mtd.git master
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

   drivers/mtd/devices/docg3.c:1679:1: warning: data definition has no type or 
storage class
DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
^~~
   drivers/mtd/devices/docg3.c:1679:1: error: type defaults to 'int' in 
declaration of 'DEBUGFS_RO_ATTR' [-Werror=implicit-int]
   drivers/mtd/devices/docg3.c:1679:1: warning: parameter names (without types) 
in function declaration
   drivers/mtd/devices/docg3.c: In function 'doc_dbg_register':
>> drivers/mtd/devices/docg3.c:1752:9: error: 'device_id_fops' undeclared 
>> (first use in this function)
   _id_fops);
^~
   drivers/mtd/devices/docg3.c:1752:9: note: each undeclared identifier is 
reported only once for each function it appears in
   At top level:
   drivers/mtd/devices/docg3.c:1667:12: warning: 'dbg_device_id_show' defined 
but not used [-Wunused-function]
static int dbg_device_id_show(struct seq_file *s, void *p)
   ^~
   cc1: some warnings being treated as errors

vim +/device_id_fops +1752 drivers/mtd/devices/docg3.c

efa2ca73 Robert Jarzmik  2011-10-05  1666  
efa2ca73 Robert Jarzmik  2011-10-05  1667  static int dbg_device_id_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1668  {
efa2ca73 Robert Jarzmik  2011-10-05  1669   struct docg3 *docg3 = (struct 
docg3 *)s->private;
7b0e67f6 Robert Jarzmik  2012-03-22  1670   int id;
7b0e67f6 Robert Jarzmik  2012-03-22  1671  
7b0e67f6 Robert Jarzmik  2012-03-22  1672   
mutex_lock(>cascade->lock);
7b0e67f6 Robert Jarzmik  2012-03-22  1673   id = doc_register_readb(docg3, 
DOC_DEVICESELECT);
7b0e67f6 Robert Jarzmik  2012-03-22  1674   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1675  
8c98d255 Joe Perches 2014-09-29  1676   seq_printf(s, "DeviceId = 
%d\n", id);
8c98d255 Joe Perches 2014-09-29  1677   return 0;
efa2ca73 Robert Jarzmik  2011-10-05  1678  }
efa2ca73 Robert Jarzmik  2011-10-05 @1679  DEBUGFS_RO_ATTR(device_id, 
dbg_device_id_show);
efa2ca73 Robert Jarzmik  2011-10-05  1680  
34e778aa Yangtao Li  2018-12-01  1681  static int protection_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1682  {
efa2ca73 Robert Jarzmik  2011-10-05  1683   struct docg3 *docg3 = (struct 
docg3 *)s->private;
dbc26d98 Robert Jarzmik  2011-11-19  1684   int protect, dps0, dps0_low, 
dps0_high, dps1, dps1_low, dps1_high;
dbc26d98 Robert Jarzmik  2011-11-19  1685  
7b0e67f6 Robert Jarzmik  2012-03-22  1686   
mutex_lock(>cascade->lock);
dbc26d98 Robert Jarzmik  2011-11-19  1687   protect = 
doc_register_readb(docg3, DOC_PROTECTION);
dbc26d98 Robert Jarzmik  2011-11-19  1688   dps0 = 
doc_register_readb(docg3, DOC_DPS0_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1689   dps0_low = 
doc_register_readw(docg3, DOC_DPS0_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1690   dps0_high = 
doc_register_readw(docg3, DOC_DPS0_ADDRHIGH);
dbc26d98 Robert Jarzmik  2011-11-19  1691   dps1 = 
doc_register_readb(docg3, DOC_DPS1_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1692   dps1_low = 
doc_register_readw(docg3, DOC_DPS1_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1693   dps1_high = 
doc_register_readw(docg3, DOC_DPS1_ADDRHIGH);
7b0e67f6 Robert Jarzmik  2012-03-22  1694   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1695  
8c98d255 Joe Perches 2014-09-29  1696   seq_printf(s, "Protection = 
0x%02x (", protect);
efa2ca73 Robert Jarzmik  2011-10-05  1697   if (protect & 
DOC_PROTECT_FOUNDRY_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1698   seq_puts(s, 
"FOUNDRY_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1699   if (protect & 
DOC_PROTECT_CUSTOMER_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1700   seq_puts(s, 
"CUSTOMER_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1701   if (protect & 
DOC_PROTECT_LOCK_INPUT)
8c98d255 Joe Perches 2014-09-29  1702   seq_puts(s, 
"LOCK_INPUT,");
efa2ca73 Robert Jarzmik  2011-10-05  1703   if (protect & 
DOC_PROTECT_STICKY_LOCK)
8c98d255 Joe Perches 2014-09-29  1704 

Re: [PATCH] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread kbuild test robot
Hi Yangtao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Yangtao-Li/mtd-remove-DEBUGFS_RO_ATTR/20181202-065958
base:   git://git.infradead.org/linux-mtd.git master
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

   drivers/mtd/devices/docg3.c:1679:1: warning: data definition has no type or 
storage class
DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
^~~
   drivers/mtd/devices/docg3.c:1679:1: error: type defaults to 'int' in 
declaration of 'DEBUGFS_RO_ATTR' [-Werror=implicit-int]
   drivers/mtd/devices/docg3.c:1679:1: warning: parameter names (without types) 
in function declaration
   drivers/mtd/devices/docg3.c: In function 'doc_dbg_register':
>> drivers/mtd/devices/docg3.c:1752:9: error: 'device_id_fops' undeclared 
>> (first use in this function)
   _id_fops);
^~
   drivers/mtd/devices/docg3.c:1752:9: note: each undeclared identifier is 
reported only once for each function it appears in
   At top level:
   drivers/mtd/devices/docg3.c:1667:12: warning: 'dbg_device_id_show' defined 
but not used [-Wunused-function]
static int dbg_device_id_show(struct seq_file *s, void *p)
   ^~
   cc1: some warnings being treated as errors

vim +/device_id_fops +1752 drivers/mtd/devices/docg3.c

efa2ca73 Robert Jarzmik  2011-10-05  1666  
efa2ca73 Robert Jarzmik  2011-10-05  1667  static int dbg_device_id_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1668  {
efa2ca73 Robert Jarzmik  2011-10-05  1669   struct docg3 *docg3 = (struct 
docg3 *)s->private;
7b0e67f6 Robert Jarzmik  2012-03-22  1670   int id;
7b0e67f6 Robert Jarzmik  2012-03-22  1671  
7b0e67f6 Robert Jarzmik  2012-03-22  1672   
mutex_lock(>cascade->lock);
7b0e67f6 Robert Jarzmik  2012-03-22  1673   id = doc_register_readb(docg3, 
DOC_DEVICESELECT);
7b0e67f6 Robert Jarzmik  2012-03-22  1674   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1675  
8c98d255 Joe Perches 2014-09-29  1676   seq_printf(s, "DeviceId = 
%d\n", id);
8c98d255 Joe Perches 2014-09-29  1677   return 0;
efa2ca73 Robert Jarzmik  2011-10-05  1678  }
efa2ca73 Robert Jarzmik  2011-10-05 @1679  DEBUGFS_RO_ATTR(device_id, 
dbg_device_id_show);
efa2ca73 Robert Jarzmik  2011-10-05  1680  
34e778aa Yangtao Li  2018-12-01  1681  static int protection_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1682  {
efa2ca73 Robert Jarzmik  2011-10-05  1683   struct docg3 *docg3 = (struct 
docg3 *)s->private;
dbc26d98 Robert Jarzmik  2011-11-19  1684   int protect, dps0, dps0_low, 
dps0_high, dps1, dps1_low, dps1_high;
dbc26d98 Robert Jarzmik  2011-11-19  1685  
7b0e67f6 Robert Jarzmik  2012-03-22  1686   
mutex_lock(>cascade->lock);
dbc26d98 Robert Jarzmik  2011-11-19  1687   protect = 
doc_register_readb(docg3, DOC_PROTECTION);
dbc26d98 Robert Jarzmik  2011-11-19  1688   dps0 = 
doc_register_readb(docg3, DOC_DPS0_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1689   dps0_low = 
doc_register_readw(docg3, DOC_DPS0_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1690   dps0_high = 
doc_register_readw(docg3, DOC_DPS0_ADDRHIGH);
dbc26d98 Robert Jarzmik  2011-11-19  1691   dps1 = 
doc_register_readb(docg3, DOC_DPS1_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1692   dps1_low = 
doc_register_readw(docg3, DOC_DPS1_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1693   dps1_high = 
doc_register_readw(docg3, DOC_DPS1_ADDRHIGH);
7b0e67f6 Robert Jarzmik  2012-03-22  1694   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1695  
8c98d255 Joe Perches 2014-09-29  1696   seq_printf(s, "Protection = 
0x%02x (", protect);
efa2ca73 Robert Jarzmik  2011-10-05  1697   if (protect & 
DOC_PROTECT_FOUNDRY_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1698   seq_puts(s, 
"FOUNDRY_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1699   if (protect & 
DOC_PROTECT_CUSTOMER_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1700   seq_puts(s, 
"CUSTOMER_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1701   if (protect & 
DOC_PROTECT_LOCK_INPUT)
8c98d255 Joe Perches 2014-09-29  1702   seq_puts(s, 
"LOCK_INPUT,");
efa2ca73 Robert Jarzmik  2011-10-05  1703   if (protect & 
DOC_PROTECT_STICKY_LOCK)
8c98d255 Joe Perches 2014-09-29  1704 

Re: [PATCH] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread kbuild test robot
Hi Yangtao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Yangtao-Li/mtd-remove-DEBUGFS_RO_ATTR/20181202-065958
base:   git://git.infradead.org/linux-mtd.git master
config: x86_64-randconfig-x013-201848 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> drivers/mtd/devices/docg3.c:1679:1: warning: data definition has no type or 
>> storage class
DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
^~~
>> drivers/mtd/devices/docg3.c:1679:1: error: type defaults to 'int' in 
>> declaration of 'DEBUGFS_RO_ATTR' [-Werror=implicit-int]
>> drivers/mtd/devices/docg3.c:1679:1: warning: parameter names (without types) 
>> in function declaration
   drivers/mtd/devices/docg3.c: In function 'doc_dbg_register':
>> drivers/mtd/devices/docg3.c:1752:9: error: 'device_id_fops' undeclared 
>> (first use in this function); did you mean 'device_add_groups'?
   _id_fops);
^~
device_add_groups
   drivers/mtd/devices/docg3.c:1752:9: note: each undeclared identifier is 
reported only once for each function it appears in
   At top level:
   drivers/mtd/devices/docg3.c:1667:12: warning: 'dbg_device_id_show' defined 
but not used [-Wunused-function]
static int dbg_device_id_show(struct seq_file *s, void *p)
   ^~
   cc1: some warnings being treated as errors

vim +1679 drivers/mtd/devices/docg3.c

efa2ca73 Robert Jarzmik  2011-10-05  1666  
efa2ca73 Robert Jarzmik  2011-10-05  1667  static int dbg_device_id_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1668  {
efa2ca73 Robert Jarzmik  2011-10-05  1669   struct docg3 *docg3 = (struct 
docg3 *)s->private;
7b0e67f6 Robert Jarzmik  2012-03-22  1670   int id;
7b0e67f6 Robert Jarzmik  2012-03-22  1671  
7b0e67f6 Robert Jarzmik  2012-03-22  1672   
mutex_lock(>cascade->lock);
7b0e67f6 Robert Jarzmik  2012-03-22  1673   id = doc_register_readb(docg3, 
DOC_DEVICESELECT);
7b0e67f6 Robert Jarzmik  2012-03-22  1674   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1675  
8c98d255 Joe Perches 2014-09-29  1676   seq_printf(s, "DeviceId = 
%d\n", id);
8c98d255 Joe Perches 2014-09-29  1677   return 0;
efa2ca73 Robert Jarzmik  2011-10-05  1678  }
efa2ca73 Robert Jarzmik  2011-10-05 @1679  DEBUGFS_RO_ATTR(device_id, 
dbg_device_id_show);
efa2ca73 Robert Jarzmik  2011-10-05  1680  
34e778aa Yangtao Li  2018-12-01  1681  static int protection_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1682  {
efa2ca73 Robert Jarzmik  2011-10-05  1683   struct docg3 *docg3 = (struct 
docg3 *)s->private;
dbc26d98 Robert Jarzmik  2011-11-19  1684   int protect, dps0, dps0_low, 
dps0_high, dps1, dps1_low, dps1_high;
dbc26d98 Robert Jarzmik  2011-11-19  1685  
7b0e67f6 Robert Jarzmik  2012-03-22  1686   
mutex_lock(>cascade->lock);
dbc26d98 Robert Jarzmik  2011-11-19  1687   protect = 
doc_register_readb(docg3, DOC_PROTECTION);
dbc26d98 Robert Jarzmik  2011-11-19  1688   dps0 = 
doc_register_readb(docg3, DOC_DPS0_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1689   dps0_low = 
doc_register_readw(docg3, DOC_DPS0_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1690   dps0_high = 
doc_register_readw(docg3, DOC_DPS0_ADDRHIGH);
dbc26d98 Robert Jarzmik  2011-11-19  1691   dps1 = 
doc_register_readb(docg3, DOC_DPS1_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1692   dps1_low = 
doc_register_readw(docg3, DOC_DPS1_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1693   dps1_high = 
doc_register_readw(docg3, DOC_DPS1_ADDRHIGH);
7b0e67f6 Robert Jarzmik  2012-03-22  1694   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1695  
8c98d255 Joe Perches 2014-09-29  1696   seq_printf(s, "Protection = 
0x%02x (", protect);
efa2ca73 Robert Jarzmik  2011-10-05  1697   if (protect & 
DOC_PROTECT_FOUNDRY_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1698   seq_puts(s, 
"FOUNDRY_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1699   if (protect & 
DOC_PROTECT_CUSTOMER_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1700   seq_puts(s, 
"CUSTOMER_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1701   if (protect & 
DOC_PROTECT_LOCK_INPUT)
8c98d255 Joe Perches 2014-09-29  1702   seq_puts(s, 
"LOCK_INPUT,");
efa2ca73 Robert Jarzmik  2011-10-05  1703   if (protect & 
DOC_PROTECT_STICKY_LOCK)
8c98d255 Joe Perches 2014-09-29  1704   seq_puts(s, 
"STICKY_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1705   if 

Re: [PATCH] mtd: remove DEBUGFS_RO_ATTR()

2018-12-01 Thread kbuild test robot
Hi Yangtao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Yangtao-Li/mtd-remove-DEBUGFS_RO_ATTR/20181202-065958
base:   git://git.infradead.org/linux-mtd.git master
config: x86_64-randconfig-x013-201848 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> drivers/mtd/devices/docg3.c:1679:1: warning: data definition has no type or 
>> storage class
DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
^~~
>> drivers/mtd/devices/docg3.c:1679:1: error: type defaults to 'int' in 
>> declaration of 'DEBUGFS_RO_ATTR' [-Werror=implicit-int]
>> drivers/mtd/devices/docg3.c:1679:1: warning: parameter names (without types) 
>> in function declaration
   drivers/mtd/devices/docg3.c: In function 'doc_dbg_register':
>> drivers/mtd/devices/docg3.c:1752:9: error: 'device_id_fops' undeclared 
>> (first use in this function); did you mean 'device_add_groups'?
   _id_fops);
^~
device_add_groups
   drivers/mtd/devices/docg3.c:1752:9: note: each undeclared identifier is 
reported only once for each function it appears in
   At top level:
   drivers/mtd/devices/docg3.c:1667:12: warning: 'dbg_device_id_show' defined 
but not used [-Wunused-function]
static int dbg_device_id_show(struct seq_file *s, void *p)
   ^~
   cc1: some warnings being treated as errors

vim +1679 drivers/mtd/devices/docg3.c

efa2ca73 Robert Jarzmik  2011-10-05  1666  
efa2ca73 Robert Jarzmik  2011-10-05  1667  static int dbg_device_id_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1668  {
efa2ca73 Robert Jarzmik  2011-10-05  1669   struct docg3 *docg3 = (struct 
docg3 *)s->private;
7b0e67f6 Robert Jarzmik  2012-03-22  1670   int id;
7b0e67f6 Robert Jarzmik  2012-03-22  1671  
7b0e67f6 Robert Jarzmik  2012-03-22  1672   
mutex_lock(>cascade->lock);
7b0e67f6 Robert Jarzmik  2012-03-22  1673   id = doc_register_readb(docg3, 
DOC_DEVICESELECT);
7b0e67f6 Robert Jarzmik  2012-03-22  1674   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1675  
8c98d255 Joe Perches 2014-09-29  1676   seq_printf(s, "DeviceId = 
%d\n", id);
8c98d255 Joe Perches 2014-09-29  1677   return 0;
efa2ca73 Robert Jarzmik  2011-10-05  1678  }
efa2ca73 Robert Jarzmik  2011-10-05 @1679  DEBUGFS_RO_ATTR(device_id, 
dbg_device_id_show);
efa2ca73 Robert Jarzmik  2011-10-05  1680  
34e778aa Yangtao Li  2018-12-01  1681  static int protection_show(struct 
seq_file *s, void *p)
efa2ca73 Robert Jarzmik  2011-10-05  1682  {
efa2ca73 Robert Jarzmik  2011-10-05  1683   struct docg3 *docg3 = (struct 
docg3 *)s->private;
dbc26d98 Robert Jarzmik  2011-11-19  1684   int protect, dps0, dps0_low, 
dps0_high, dps1, dps1_low, dps1_high;
dbc26d98 Robert Jarzmik  2011-11-19  1685  
7b0e67f6 Robert Jarzmik  2012-03-22  1686   
mutex_lock(>cascade->lock);
dbc26d98 Robert Jarzmik  2011-11-19  1687   protect = 
doc_register_readb(docg3, DOC_PROTECTION);
dbc26d98 Robert Jarzmik  2011-11-19  1688   dps0 = 
doc_register_readb(docg3, DOC_DPS0_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1689   dps0_low = 
doc_register_readw(docg3, DOC_DPS0_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1690   dps0_high = 
doc_register_readw(docg3, DOC_DPS0_ADDRHIGH);
dbc26d98 Robert Jarzmik  2011-11-19  1691   dps1 = 
doc_register_readb(docg3, DOC_DPS1_STATUS);
dbc26d98 Robert Jarzmik  2011-11-19  1692   dps1_low = 
doc_register_readw(docg3, DOC_DPS1_ADDRLOW);
dbc26d98 Robert Jarzmik  2011-11-19  1693   dps1_high = 
doc_register_readw(docg3, DOC_DPS1_ADDRHIGH);
7b0e67f6 Robert Jarzmik  2012-03-22  1694   
mutex_unlock(>cascade->lock);
efa2ca73 Robert Jarzmik  2011-10-05  1695  
8c98d255 Joe Perches 2014-09-29  1696   seq_printf(s, "Protection = 
0x%02x (", protect);
efa2ca73 Robert Jarzmik  2011-10-05  1697   if (protect & 
DOC_PROTECT_FOUNDRY_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1698   seq_puts(s, 
"FOUNDRY_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1699   if (protect & 
DOC_PROTECT_CUSTOMER_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29  1700   seq_puts(s, 
"CUSTOMER_OTP_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1701   if (protect & 
DOC_PROTECT_LOCK_INPUT)
8c98d255 Joe Perches 2014-09-29  1702   seq_puts(s, 
"LOCK_INPUT,");
efa2ca73 Robert Jarzmik  2011-10-05  1703   if (protect & 
DOC_PROTECT_STICKY_LOCK)
8c98d255 Joe Perches 2014-09-29  1704   seq_puts(s, 
"STICKY_LOCK,");
efa2ca73 Robert Jarzmik  2011-10-05  1705   if 

Bcachefs status update, current work

2018-12-01 Thread Kent Overstreet
So, since I've been pretty quiet since LSF I thought I ought to give an update
on where bcachefs is at - and in particular talk about what sorts of problems
and improvements are currently being worked on.

As of last LSF, there was still a lot of work to be done before we had fast
mount times that don't require walking all metadata. There were two main work
items:
 - atomicity of filesystem operations. Any filesystem operation that had
   anything to do with i_nlink wasn't atomic (but they were ordered so that
   filesystem consistency wasn't an issue) - on startup we'd have to scan and
   recalculate i_nlink and also delete no longer referenced inodes.
 - allocation information wasn't persisted (per bucket sector counts) - so on
   startup we have to walk all the extents and recalculate all the disk space
   accounting.

#1 is done. For those curious about the details, if you've seen how bcachefs
implements rename (with multiple linked btree iterators), it's based off of
that. Basically, there's a new btree transaction context widget for allocating
btree iterators out of, and queuing up updates to be done at transaction commit
- so that different code paths (e.g. inode create, dirent create, xattr create)
can be used together without having to manually write code to keep track of all
the iterators that need to be used and kept locked, etc. I think it's pretty
neat how clean it turned out.

So basically, everything's fully atomic now except for fallocate/fcollapse/etc. 
-
and after unclean shutdown we do have to scan just the inodes btree for inodes
that have been deleted. Eventually we'll have to implement a linked list of
deleted inodes like xfs does (or perhaps fake hidden directory), but inodes are
small in bcachefs, < 100 bytes, so it's a low priority.

Erasure coding is about 80% done now. I'm quite happy with how erasure coding
turned out - there's no write hole (we never update existing stripes in place),
and we also don't fragment writes like zfs does. Instead, foreground writes are
replicated (raid10 style), and as soon as we have a stripe of new data we write
out p/q blocks and then update the extents with a pointer to the stripe and drop
the now unneeded replicas. Right now it's just reed solomon (raid5/6), but
weaver codes or something else could be added in the future if anyone wants to.
The part that still needs to be implemented before it'll be useful is stripe
level compaction - when we have stripes with some empty blocks (all the data in
them was overwritten), we need to use the remaining data blocks when creating
new stripes so that we can drop the old stripe (and stop pinning the empty
blocks). I'm leaving that off until later though because that won't impact the
on disk format at all, and there's other stuff I want to get done first.

My current priority is reflink - as that will be highly useful to the company
that's funding bcachefs development. That's more or less requiring me to do
persistent allocation information first though, so that's become my current
project (the reflinked extent refcounts will be much too big to keep in memory
like I am now for bucket sector counts, so they'll have to be kept in a btree
and updated whenever doing extent updates - and the infrastructure I need to
make that happen is also what I need for making all the other disk space
accounting persistent).

So, bcachefs will have fast mounts (including after unclean shutdown) soon.

At the very moment what I'm working on (leading up to fast mounts after clean
shutdowns, first) is some improvements to disk space accounting for multi device
filesystems.

The background to this is that in order to know whether you can safely mount in
degraded mode, you have to store a list of all the combinations of disks that
have data replicated across them (or are in an erasure coded stripe) - this is
assuming you don't have any kind of fixed layout, like regular RAID does. That
is, if you've got 8 disks in your filesystem, and you're running with
replicas=2, and two of your disks are offline, you need to know whether you have
any data that's replicated across those two particular disks.

bcachefs has such a table kept in the superblock, but entries in it aren't
refcounted - we create new entries if necessary when inserting new extents into
the extents btree, but we need a gc pass to delete them, generally triggered by
device removal. That's kind of lame, since it means we might fail mounts that
are actually safe.

So, before writing the code to persist the filesystem level sector counts I'm
changing it to track them broken out by replicas entry - i.e. per unique
combination of disks the data lies on. Which also means you'll be able to see in
a multi device filesystem how your data is laid out in a really fine grained
way.

Re: upstreaming - my current thinking is that since so much of the current
development involves on disk format changes/additions it probably make sense to
hold off until reflink is done, which I'm 

Bcachefs status update, current work

2018-12-01 Thread Kent Overstreet
So, since I've been pretty quiet since LSF I thought I ought to give an update
on where bcachefs is at - and in particular talk about what sorts of problems
and improvements are currently being worked on.

As of last LSF, there was still a lot of work to be done before we had fast
mount times that don't require walking all metadata. There were two main work
items:
 - atomicity of filesystem operations. Any filesystem operation that had
   anything to do with i_nlink wasn't atomic (but they were ordered so that
   filesystem consistency wasn't an issue) - on startup we'd have to scan and
   recalculate i_nlink and also delete no longer referenced inodes.
 - allocation information wasn't persisted (per bucket sector counts) - so on
   startup we have to walk all the extents and recalculate all the disk space
   accounting.

#1 is done. For those curious about the details, if you've seen how bcachefs
implements rename (with multiple linked btree iterators), it's based off of
that. Basically, there's a new btree transaction context widget for allocating
btree iterators out of, and queuing up updates to be done at transaction commit
- so that different code paths (e.g. inode create, dirent create, xattr create)
can be used together without having to manually write code to keep track of all
the iterators that need to be used and kept locked, etc. I think it's pretty
neat how clean it turned out.

So basically, everything's fully atomic now except for fallocate/fcollapse/etc. 
-
and after unclean shutdown we do have to scan just the inodes btree for inodes
that have been deleted. Eventually we'll have to implement a linked list of
deleted inodes like xfs does (or perhaps fake hidden directory), but inodes are
small in bcachefs, < 100 bytes, so it's a low priority.

Erasure coding is about 80% done now. I'm quite happy with how erasure coding
turned out - there's no write hole (we never update existing stripes in place),
and we also don't fragment writes like zfs does. Instead, foreground writes are
replicated (raid10 style), and as soon as we have a stripe of new data we write
out p/q blocks and then update the extents with a pointer to the stripe and drop
the now unneeded replicas. Right now it's just reed solomon (raid5/6), but
weaver codes or something else could be added in the future if anyone wants to.
The part that still needs to be implemented before it'll be useful is stripe
level compaction - when we have stripes with some empty blocks (all the data in
them was overwritten), we need to use the remaining data blocks when creating
new stripes so that we can drop the old stripe (and stop pinning the empty
blocks). I'm leaving that off until later though because that won't impact the
on disk format at all, and there's other stuff I want to get done first.

My current priority is reflink - as that will be highly useful to the company
that's funding bcachefs development. That's more or less requiring me to do
persistent allocation information first though, so that's become my current
project (the reflinked extent refcounts will be much too big to keep in memory
like I am now for bucket sector counts, so they'll have to be kept in a btree
and updated whenever doing extent updates - and the infrastructure I need to
make that happen is also what I need for making all the other disk space
accounting persistent).

So, bcachefs will have fast mounts (including after unclean shutdown) soon.

At the very moment what I'm working on (leading up to fast mounts after clean
shutdowns, first) is some improvements to disk space accounting for multi device
filesystems.

The background to this is that in order to know whether you can safely mount in
degraded mode, you have to store a list of all the combinations of disks that
have data replicated across them (or are in an erasure coded stripe) - this is
assuming you don't have any kind of fixed layout, like regular RAID does. That
is, if you've got 8 disks in your filesystem, and you're running with
replicas=2, and two of your disks are offline, you need to know whether you have
any data that's replicated across those two particular disks.

bcachefs has such a table kept in the superblock, but entries in it aren't
refcounted - we create new entries if necessary when inserting new extents into
the extents btree, but we need a gc pass to delete them, generally triggered by
device removal. That's kind of lame, since it means we might fail mounts that
are actually safe.

So, before writing the code to persist the filesystem level sector counts I'm
changing it to track them broken out by replicas entry - i.e. per unique
combination of disks the data lies on. Which also means you'll be able to see in
a multi device filesystem how your data is laid out in a really fine grained
way.

Re: upstreaming - my current thinking is that since so much of the current
development involves on disk format changes/additions it probably make sense to
hold off until reflink is done, which I'm 

Re: [PATCH v7 1/4] dt-bindings: pps: descriptor-based gpio, capture-clear addition

2018-12-01 Thread tom burkart

Quoting Rob Herring :


On Wed, Nov 28, 2018 at 8:05 PM tom burkart  wrote:


Quoting Rob Herring :

> On Mon, Nov 26, 2018 at 9:57 PM tom burkart  wrote:
>>
>> Quoting Rob Herring :
>>
>> > On Sat, Nov 17, 2018 at 6:35 PM tom burkart  wrote:
>> >>
>> >> Quoting Rob Herring :
>> >>
>> >> > On Sat, Nov 17, 2018 at 4:35 AM tom burkart  wrote:
>> >> >>
>> >> >> Quoting Rob Herring :
>> >> >>
>> >> >> > On Wed, Nov 14, 2018 at 11:54:29PM +1100, Tom Burkart wrote:
>> >> >> >> This patch changes the devicetree bindings for the  
pps-gpio driver

>> >> >> >> from the integer based ABI to the descriptor based ABI.
>> >> >> > ? That has nothing to do with DT.
>> >> >>
>> >> >> I believe it does, as the change in ABI forces a rename in the DT
>> >> >> naming convention.
>> >> >> This is due to the descriptor based ABI appending "-gpio" or
>> >> "-gpios" (see
>> >> >> Documentation/gpio/base.txt.)
>> >> >> Admittedly, I may have called it by the wrong name due to  
ignorance,

>> >> >> my apologies.
>> >> >
>> >> > If what you say is correct, then you can't change this  
driver. You'll

>> >> > break compatibility with any existing DT.
>> >> >
>> >> > Changing the binding reasoning should purely be that this is the
>> >> > preferred form. Bindings must be independent from changing kernel
>> >> > APIs.
>> >>
>> >> See comments from Philip Zabel.  I misread the documentation and this
>> >> has now been corrected in v8 of the patch.  I hope that eliminates all
>> >> comments made above.
>> >>
>> >> >> >>  It also adds
>> >> >> >> documentation for the device tree capture-clear option.  
 The legacy

>> >> >> >> device tree entry for the GPIO pin is supported.
>> >> >> >>
>> >> >> >> Signed-off-by: Tom Burkart 
>> >> >> >> ---
>> >> >> >>  Documentation/devicetree/bindings/pps/pps-gpio.txt | 8 ++--
>> >> >> >>  1 file changed, 6 insertions(+), 2 deletions(-)
>> >> >> >>
>> >> >> >> diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> b/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> index 3683874832ae..6c9fc0998d94 100644
>> >> >> >> --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> @@ -5,19 +5,23 @@ a GPIO pin.
>> >> >> >>
>> >> >> >>  Required properties:
>> >> >> >>  - compatible: should be "pps-gpio"
>> >> >> >> -- gpios: one PPS GPIO in the format described by  
../gpio/gpio.txt

>> >> >> >> +- pps-gpios: one PPS GPIO in the format described by
>> ../gpio/gpio.txt
>> >> >> >> +Alternatively (DEPRECATED), instead of pps-gpios above,
>> it may have:
>> >> >> >> +- gpios: one PPS GPIO as above
>> >> >> >>
>> >> >> >>  Optional properties:
>> >> >> >>  - assert-falling-edge: when present, assert is indicated by a
>> >> >> falling edge
>> >> >> >> (instead of by a rising edge)
>> >> >> >> +- capture-clear: when present, also capture the PPS clear event
>> >> >> >
>> >> >> > Is this a h/w thing? or driver configuration?
>> >> >>
>> >> >> Driver configuration.  Most of the code was present in the  
driver, yet

>> >> >> it was not documented, or usable due to a two line (code) omission
>> >> >> (the value was not being fetched from DT).
>> >> >
>> >> > So what determines how you want to configure this? If the user will
>> >> > want to change it, then it should be a sysfs attr and exposed to
>> >> > userspace. If it depends on h/w config for a board then it can be in
>> >> > DT.
>> >>
>> >> Sorry, I misled you somewhat.  If the PPS pulse active transition from
>> >> the hardware is on the falling edge, this flag is required to get the
>> >> OS to use that as the active transition.  This would not change at the
>> >> user's whim but rather it is dependent on connected hardware.
>> >
>> > This description sounds more like 'assert-falling-edge' than
>> 'capture-clear'.
>> >
>> > I'm still not clear on what 'capture-clear' is.
>>
>> Ignoring my patch for a minute, the pps_gpio_irq_handler will only
>> report a pps PPS_CAPTURECLEAR event if 'capture-clear' is set.  As the
>> current pps-gpio driver is not able to set this flag, it cannot ever
>> report a PPS_CAPTURECLEAR event.
>>
>> My patch adds the ability to set this flag and adds the documentation
>> to go with it.
>> Admittedly, I do not require this functionality for what I want, but
>> working with the code, I noticed the omission and decided to add it
>> for someone else to use it, if they need it.
>>
>> I am happy to remove this out of my patch, if you feel this to be the
>> best way forward.
>
> I found this prior discussion on adding this[1]. Seems to me this
> should be userspace configurable if the GPIO line can interrupt on
> both edges. We shouldn't need a DT property to determine that.
>
> Rob
>
> [1] https://lore.kernel.org/patchwork/patch/557781/

Hi Rob,
the fact that prior knowledge of board/CPU/SOC specifics is required
is the most compelling argument for this to be in the DT.  This is not
something a 

Re: [PATCH v7 1/4] dt-bindings: pps: descriptor-based gpio, capture-clear addition

2018-12-01 Thread tom burkart

Quoting Rob Herring :


On Wed, Nov 28, 2018 at 8:05 PM tom burkart  wrote:


Quoting Rob Herring :

> On Mon, Nov 26, 2018 at 9:57 PM tom burkart  wrote:
>>
>> Quoting Rob Herring :
>>
>> > On Sat, Nov 17, 2018 at 6:35 PM tom burkart  wrote:
>> >>
>> >> Quoting Rob Herring :
>> >>
>> >> > On Sat, Nov 17, 2018 at 4:35 AM tom burkart  wrote:
>> >> >>
>> >> >> Quoting Rob Herring :
>> >> >>
>> >> >> > On Wed, Nov 14, 2018 at 11:54:29PM +1100, Tom Burkart wrote:
>> >> >> >> This patch changes the devicetree bindings for the  
pps-gpio driver

>> >> >> >> from the integer based ABI to the descriptor based ABI.
>> >> >> > ? That has nothing to do with DT.
>> >> >>
>> >> >> I believe it does, as the change in ABI forces a rename in the DT
>> >> >> naming convention.
>> >> >> This is due to the descriptor based ABI appending "-gpio" or
>> >> "-gpios" (see
>> >> >> Documentation/gpio/base.txt.)
>> >> >> Admittedly, I may have called it by the wrong name due to  
ignorance,

>> >> >> my apologies.
>> >> >
>> >> > If what you say is correct, then you can't change this  
driver. You'll

>> >> > break compatibility with any existing DT.
>> >> >
>> >> > Changing the binding reasoning should purely be that this is the
>> >> > preferred form. Bindings must be independent from changing kernel
>> >> > APIs.
>> >>
>> >> See comments from Philip Zabel.  I misread the documentation and this
>> >> has now been corrected in v8 of the patch.  I hope that eliminates all
>> >> comments made above.
>> >>
>> >> >> >>  It also adds
>> >> >> >> documentation for the device tree capture-clear option.  
 The legacy

>> >> >> >> device tree entry for the GPIO pin is supported.
>> >> >> >>
>> >> >> >> Signed-off-by: Tom Burkart 
>> >> >> >> ---
>> >> >> >>  Documentation/devicetree/bindings/pps/pps-gpio.txt | 8 ++--
>> >> >> >>  1 file changed, 6 insertions(+), 2 deletions(-)
>> >> >> >>
>> >> >> >> diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> b/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> index 3683874832ae..6c9fc0998d94 100644
>> >> >> >> --- a/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> +++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt
>> >> >> >> @@ -5,19 +5,23 @@ a GPIO pin.
>> >> >> >>
>> >> >> >>  Required properties:
>> >> >> >>  - compatible: should be "pps-gpio"
>> >> >> >> -- gpios: one PPS GPIO in the format described by  
../gpio/gpio.txt

>> >> >> >> +- pps-gpios: one PPS GPIO in the format described by
>> ../gpio/gpio.txt
>> >> >> >> +Alternatively (DEPRECATED), instead of pps-gpios above,
>> it may have:
>> >> >> >> +- gpios: one PPS GPIO as above
>> >> >> >>
>> >> >> >>  Optional properties:
>> >> >> >>  - assert-falling-edge: when present, assert is indicated by a
>> >> >> falling edge
>> >> >> >> (instead of by a rising edge)
>> >> >> >> +- capture-clear: when present, also capture the PPS clear event
>> >> >> >
>> >> >> > Is this a h/w thing? or driver configuration?
>> >> >>
>> >> >> Driver configuration.  Most of the code was present in the  
driver, yet

>> >> >> it was not documented, or usable due to a two line (code) omission
>> >> >> (the value was not being fetched from DT).
>> >> >
>> >> > So what determines how you want to configure this? If the user will
>> >> > want to change it, then it should be a sysfs attr and exposed to
>> >> > userspace. If it depends on h/w config for a board then it can be in
>> >> > DT.
>> >>
>> >> Sorry, I misled you somewhat.  If the PPS pulse active transition from
>> >> the hardware is on the falling edge, this flag is required to get the
>> >> OS to use that as the active transition.  This would not change at the
>> >> user's whim but rather it is dependent on connected hardware.
>> >
>> > This description sounds more like 'assert-falling-edge' than
>> 'capture-clear'.
>> >
>> > I'm still not clear on what 'capture-clear' is.
>>
>> Ignoring my patch for a minute, the pps_gpio_irq_handler will only
>> report a pps PPS_CAPTURECLEAR event if 'capture-clear' is set.  As the
>> current pps-gpio driver is not able to set this flag, it cannot ever
>> report a PPS_CAPTURECLEAR event.
>>
>> My patch adds the ability to set this flag and adds the documentation
>> to go with it.
>> Admittedly, I do not require this functionality for what I want, but
>> working with the code, I noticed the omission and decided to add it
>> for someone else to use it, if they need it.
>>
>> I am happy to remove this out of my patch, if you feel this to be the
>> best way forward.
>
> I found this prior discussion on adding this[1]. Seems to me this
> should be userspace configurable if the GPIO line can interrupt on
> both edges. We shouldn't need a DT property to determine that.
>
> Rob
>
> [1] https://lore.kernel.org/patchwork/patch/557781/

Hi Rob,
the fact that prior knowledge of board/CPU/SOC specifics is required
is the most compelling argument for this to be in the DT.  This is not
something a 

Re: [GIT pull] x86/pti: Cure the STIBP fallout

2018-12-01 Thread pr-tracker-bot
The pull request you sent on Sat, 1 Dec 2018 21:34:38 +0100 (CET):

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-pti-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4b78317679c4f3782a3cff0ddb269c1fcfde7621

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [GIT pull] x86/pti: Cure the STIBP fallout

2018-12-01 Thread pr-tracker-bot
The pull request you sent on Sat, 1 Dec 2018 21:34:38 +0100 (CET):

> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-pti-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/4b78317679c4f3782a3cff0ddb269c1fcfde7621

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [PATCH] sched/fair: Fix assignment of boolean variables

2018-12-01 Thread Joey Pabalinas
On Sat, Dec 01, 2018 at 05:09:36PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
> 
> This also makes the code more readable.
> 
> Signed-off-by: Wen Yang 
> CC: Ingo Molnar 
> CC: Peter Zijlstra 
> CC: linux-kernel@vger.kernel.org

Ack, earlier assignments in the function like:

if (nr_running > 1)
*overload = true;

use `= true`, so this change keeps things consistent.

Reviewed-by: Joey Pabalinas 

> ---
>  kernel/sched/fair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a2e8160968cb..f19aa66f9b15 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env 
> *env,
>   if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
>   sgs->group_misfit_task_load < rq->misfit_task_load) {
>   sgs->group_misfit_task_load = rq->misfit_task_load;
> - *overload = 1;
> + *overload = true;
>   }
>   }
>  
> -- 
> 2.19.1
> 

-- 
Cheers,
Joey Pabalinas


signature.asc
Description: PGP signature


Re: [PATCH] sched/fair: Fix assignment of boolean variables

2018-12-01 Thread Joey Pabalinas
On Sat, Dec 01, 2018 at 05:09:36PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> kernel//sched/fair.c:7958:3-12: WARNING: Assignment of bool to 0/1
> 
> This also makes the code more readable.
> 
> Signed-off-by: Wen Yang 
> CC: Ingo Molnar 
> CC: Peter Zijlstra 
> CC: linux-kernel@vger.kernel.org

Ack, earlier assignments in the function like:

if (nr_running > 1)
*overload = true;

use `= true`, so this change keeps things consistent.

Reviewed-by: Joey Pabalinas 

> ---
>  kernel/sched/fair.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index a2e8160968cb..f19aa66f9b15 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -7955,7 +7955,7 @@ static inline void update_sg_lb_stats(struct lb_env 
> *env,
>   if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
>   sgs->group_misfit_task_load < rq->misfit_task_load) {
>   sgs->group_misfit_task_load = rq->misfit_task_load;
> - *overload = 1;
> + *overload = true;
>   }
>   }
>  
> -- 
> 2.19.1
> 

-- 
Cheers,
Joey Pabalinas


signature.asc
Description: PGP signature


Re: linux-next: manual merge of the selinux tree with the vfs tree

2018-12-01 Thread Ondrej Mosnacek
On Thu, Nov 29, 2018 at 11:07 AM Ondrej Mosnacek  wrote:
> On Wed, Nov 28, 2018 at 10:52 PM Paul Moore  wrote:
> > On Tue, Nov 27, 2018 at 6:50 AM Stephen Rothwell  
> > wrote:
> > > Hi Ondrej,
> > >
> > > On Tue, 27 Nov 2018 09:53:32 +0100 Ondrej Mosnacek  
> > > wrote:
> > > >
> > > > Hm... seems that there was some massive overhaul in the VFS code right
> > > > at the wrong moment... There are new hooks for mounting now and the
> > >
> > > The mount changes have been in linux-next since before the last
> > > release ...
> > >
> > > > code that our commit changes is now here:
> > > >
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/tree/security/selinux/hooks.c?h=for-next#n3131
> > > >
> > > > It seems that the logic is still the same, just now our patch (or the
> > > > VFS one) needs to be updated to change the above line as such
> > > > (untested pseudo-patch):
> > > >
> > > > - if (fc->purpose == FS_CONTEXT_FOR_KERNEL_MOUNT)
> > > > + if (fc->purpose == 
> > > > (FS_CONTEXT_FOR_KERNEL_MOUNT|FS_CONTEXT_FOR_SUBMOUNT))
> > >
> > > OK, so from tomorrow I will use that merge resolution.  Someone needs
> > > to remember to tell Linus about this when the latter of the vfs and
> > > selinux trees reach him.
> >
> > I will, or at least I'll do my best to remember; since we only have a
> > few more week until the merge window I like my odds.  FWIW, I
> > typically do a test merge on top of Linus' tree before sending the
> > SELinux PR just to verify that everything is relatively clean and
> > there are no surprises.
> >
> > Ondrej, please work with David Howells to ensure that submounts are
> > handled correctly in his mount rework.
>
> OK, I will verify that the SELinux submount fix rebased on top of
> vfs/work.mount in the way I suggested above passes the same testing
> (seliinux-testsuite + NFS crossmnt reproducer). I am now building two
> kernels (vfs/work.mount with and without the fix) to test. Let me know
> if there is anything more to do.

I tested the proposed patch ([1]; fixed as per correction from David
Howells) applied on top of patches v4.19-rc3..vfs/work.mount applied
on top of the 4.19.5-300 Fedora 29 kernel.

However, the submount test was still failing, so I looked again at the
list of the possible 'purpose' values and it turns out the value used
by NFS et al. is actually FS_CONTEXT_FOR_ROOT_MOUNT (it is actually
documented nicely in Documentation/filesystems/mount_api.txt). So I'll
need to build a new test kernel with updated patch ([2]) and retest...

BTW, the vfs/work.mount changes alone seem to cause some overlay test
failures (I didn't test a clean 4.19.5 so it may be due to some stable
patch as well):

Test Summary Report
---
overlay/test  (Wstat: 3072 Tests: 119 Failed: 12)
 Failed tests:  66, 74, 76-77, 79, 87, 95, 103, 108, 110-111
   117
 Non-zero exit status: 12

The failing tests are all in the context mount section, but I don't
think this is (directly) related to [3] because there are much more
tests failing and the kernel I was testing didn't include the
problematic OverlayFS patch. Perhaps the VFS patches somehow broke the
parsing of the context= mount option?

[1] 
https://gitlab.com/omos/linux-public/commit/fe5478717ddde92e3ea599e14051ad57522fdf47
[2] 
https://gitlab.com/omos/linux-public/commit/f5c58adc7babd62e4bfe8cda799459d263dc5186
[3] https://github.com/SELinuxProject/selinux-kernel/issues/43

--
Ondrej Mosnacek 
Associate Software Engineer, Security Technologies
Red Hat, Inc.


Re: linux-next: manual merge of the selinux tree with the vfs tree

2018-12-01 Thread Ondrej Mosnacek
On Thu, Nov 29, 2018 at 11:07 AM Ondrej Mosnacek  wrote:
> On Wed, Nov 28, 2018 at 10:52 PM Paul Moore  wrote:
> > On Tue, Nov 27, 2018 at 6:50 AM Stephen Rothwell  
> > wrote:
> > > Hi Ondrej,
> > >
> > > On Tue, 27 Nov 2018 09:53:32 +0100 Ondrej Mosnacek  
> > > wrote:
> > > >
> > > > Hm... seems that there was some massive overhaul in the VFS code right
> > > > at the wrong moment... There are new hooks for mounting now and the
> > >
> > > The mount changes have been in linux-next since before the last
> > > release ...
> > >
> > > > code that our commit changes is now here:
> > > >
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/tree/security/selinux/hooks.c?h=for-next#n3131
> > > >
> > > > It seems that the logic is still the same, just now our patch (or the
> > > > VFS one) needs to be updated to change the above line as such
> > > > (untested pseudo-patch):
> > > >
> > > > - if (fc->purpose == FS_CONTEXT_FOR_KERNEL_MOUNT)
> > > > + if (fc->purpose == 
> > > > (FS_CONTEXT_FOR_KERNEL_MOUNT|FS_CONTEXT_FOR_SUBMOUNT))
> > >
> > > OK, so from tomorrow I will use that merge resolution.  Someone needs
> > > to remember to tell Linus about this when the latter of the vfs and
> > > selinux trees reach him.
> >
> > I will, or at least I'll do my best to remember; since we only have a
> > few more week until the merge window I like my odds.  FWIW, I
> > typically do a test merge on top of Linus' tree before sending the
> > SELinux PR just to verify that everything is relatively clean and
> > there are no surprises.
> >
> > Ondrej, please work with David Howells to ensure that submounts are
> > handled correctly in his mount rework.
>
> OK, I will verify that the SELinux submount fix rebased on top of
> vfs/work.mount in the way I suggested above passes the same testing
> (seliinux-testsuite + NFS crossmnt reproducer). I am now building two
> kernels (vfs/work.mount with and without the fix) to test. Let me know
> if there is anything more to do.

I tested the proposed patch ([1]; fixed as per correction from David
Howells) applied on top of patches v4.19-rc3..vfs/work.mount applied
on top of the 4.19.5-300 Fedora 29 kernel.

However, the submount test was still failing, so I looked again at the
list of the possible 'purpose' values and it turns out the value used
by NFS et al. is actually FS_CONTEXT_FOR_ROOT_MOUNT (it is actually
documented nicely in Documentation/filesystems/mount_api.txt). So I'll
need to build a new test kernel with updated patch ([2]) and retest...

BTW, the vfs/work.mount changes alone seem to cause some overlay test
failures (I didn't test a clean 4.19.5 so it may be due to some stable
patch as well):

Test Summary Report
---
overlay/test  (Wstat: 3072 Tests: 119 Failed: 12)
 Failed tests:  66, 74, 76-77, 79, 87, 95, 103, 108, 110-111
   117
 Non-zero exit status: 12

The failing tests are all in the context mount section, but I don't
think this is (directly) related to [3] because there are much more
tests failing and the kernel I was testing didn't include the
problematic OverlayFS patch. Perhaps the VFS patches somehow broke the
parsing of the context= mount option?

[1] 
https://gitlab.com/omos/linux-public/commit/fe5478717ddde92e3ea599e14051ad57522fdf47
[2] 
https://gitlab.com/omos/linux-public/commit/f5c58adc7babd62e4bfe8cda799459d263dc5186
[3] https://github.com/SELinuxProject/selinux-kernel/issues/43

--
Ondrej Mosnacek 
Associate Software Engineer, Security Technologies
Red Hat, Inc.


Re: [PATCH 04/24] dt-bindings: leds: Add function and color properties

2018-12-01 Thread Jacek Anaszewski
On 11/30/2018 11:19 PM, Rob Herring wrote:
> On Fri, Nov 30, 2018 at 3:08 PM Pavel Machek  wrote:
>>
>> Hi!
>>
 Pavel gave following examples:

 eth0:green:link
 adsl0:green:link
 adsl0:red:error

 So we would have e.g.:

 associated-vl42-device = <>;
 associated-network-device = <>;
 associated-block-device = <>;
>>>
>>> Variable property names are kind of a pain to parse.
>>
>> Ok, would it be enough to have associated-device = <>?
> 
> Yeah, but I though you needed the device type name in there.
> 
>>> Perhaps when LEDs are associated with a device, we shouldn't care
>>> within the context of the LED subsystem what the name is. The
>>> association is more important and if you have that exposed, then you
>>> don't really need to care what the name is. You still have to deal
>>> with a device with more than 1 LED, but that becomes a problem local
>>> to that device.
>>>
>>> What I'm getting at is following a more standard binding pattern of
>>> providers and consumers like we have for gpios, clocks, etc. So we'd
>>> have something like this:
>>>
>>> ethernet {
>>>   ...
>>>   leds = <_led>, <_led>;
>>>   led-names = "link", "err";
>>> };
>>
>> Basically every single device could have a LED associated with it
>> ("activity"). Would doing it like this mean we'd have to modify every
>> single driver to parse leds / led-names properties?
> 
> Normally, that's how properties like this would work. A driver is also
> what knows how the leds should function. 

This is not true in case of associations where LED controller is
an independent device, as in Pavel's example [0].

> A driver can retrieve the led
> and associate it with the 'foo-bar' function. The 'foo-bar' function
> then doesn't have to be defined in DT nor exposed to userspace. It
> wouldn't even have to be driver specific. The driver's subsystem could
> handle it all if the led functions are standardized. Though then you'd
> be back to needing standard names for 'led-names', but that's no worse
> that trigger names. This model would also allow getting rid of
> 'linux,default-trigger' properties in a lot of cases which wouldn't be
> a bad thing.
> 
> However, having drivers handle this is not required. You can iterate
> thru the tree for nodes with 'leds' and find the node which has a
> phandle to the led node you care about. 

This way of discovering associations between devices and LEDs
would be more reliable than by devicename part of LED class device
as discussed previously.

However, I've just tried to verify how it works, but
I can't find the way to get the of_node phandle from sysfs.

The "of_node" link in per-device dirs in /sys/devices point
to the directories containing DT properties of the node, but
I see no way to obtain the node phandle.

> Sure, it's not that efficient,
> but it does work and it's only done once. Basically, as long as the
> linkage is there, we can make it work. I think using
> 'associated-device' might work better for the current implementation
> of Linux LED support, but leds/led-names would be more inline with
> other DT bindings. The current Linux implementation shouldn't dictate
> the binding design.

[0] https://lkml.org/lkml/2018/11/13/103

-- 
Best regards,
Jacek Anaszewski


Re: [PATCH 04/24] dt-bindings: leds: Add function and color properties

2018-12-01 Thread Jacek Anaszewski
On 11/30/2018 11:19 PM, Rob Herring wrote:
> On Fri, Nov 30, 2018 at 3:08 PM Pavel Machek  wrote:
>>
>> Hi!
>>
 Pavel gave following examples:

 eth0:green:link
 adsl0:green:link
 adsl0:red:error

 So we would have e.g.:

 associated-vl42-device = <>;
 associated-network-device = <>;
 associated-block-device = <>;
>>>
>>> Variable property names are kind of a pain to parse.
>>
>> Ok, would it be enough to have associated-device = <>?
> 
> Yeah, but I though you needed the device type name in there.
> 
>>> Perhaps when LEDs are associated with a device, we shouldn't care
>>> within the context of the LED subsystem what the name is. The
>>> association is more important and if you have that exposed, then you
>>> don't really need to care what the name is. You still have to deal
>>> with a device with more than 1 LED, but that becomes a problem local
>>> to that device.
>>>
>>> What I'm getting at is following a more standard binding pattern of
>>> providers and consumers like we have for gpios, clocks, etc. So we'd
>>> have something like this:
>>>
>>> ethernet {
>>>   ...
>>>   leds = <_led>, <_led>;
>>>   led-names = "link", "err";
>>> };
>>
>> Basically every single device could have a LED associated with it
>> ("activity"). Would doing it like this mean we'd have to modify every
>> single driver to parse leds / led-names properties?
> 
> Normally, that's how properties like this would work. A driver is also
> what knows how the leds should function. 

This is not true in case of associations where LED controller is
an independent device, as in Pavel's example [0].

> A driver can retrieve the led
> and associate it with the 'foo-bar' function. The 'foo-bar' function
> then doesn't have to be defined in DT nor exposed to userspace. It
> wouldn't even have to be driver specific. The driver's subsystem could
> handle it all if the led functions are standardized. Though then you'd
> be back to needing standard names for 'led-names', but that's no worse
> that trigger names. This model would also allow getting rid of
> 'linux,default-trigger' properties in a lot of cases which wouldn't be
> a bad thing.
> 
> However, having drivers handle this is not required. You can iterate
> thru the tree for nodes with 'leds' and find the node which has a
> phandle to the led node you care about. 

This way of discovering associations between devices and LEDs
would be more reliable than by devicename part of LED class device
as discussed previously.

However, I've just tried to verify how it works, but
I can't find the way to get the of_node phandle from sysfs.

The "of_node" link in per-device dirs in /sys/devices point
to the directories containing DT properties of the node, but
I see no way to obtain the node phandle.

> Sure, it's not that efficient,
> but it does work and it's only done once. Basically, as long as the
> linkage is there, we can make it work. I think using
> 'associated-device' might work better for the current implementation
> of Linux LED support, but leds/led-names would be more inline with
> other DT bindings. The current Linux implementation shouldn't dictate
> the binding design.

[0] https://lkml.org/lkml/2018/11/13/103

-- 
Best regards,
Jacek Anaszewski


Re: [PATCH] workqueue: remove some duplicated includes

2018-12-01 Thread Nikolay Borisov



On 1.12.18 г. 8:46 ч., Frank Lee wrote:
> It seems that the trivial tree has not been maintained for some time.
> Are there aother tree to choose?


perhaps mmotm, maintained by Andrew (cc'ed)
> 
> MBR,
> Yangtao
> On Sat, Dec 1, 2018 at 2:36 AM Tejun Heo  wrote:
>>
>> On Mon, Nov 26, 2018 at 09:33:26AM -0500, Yangtao Li wrote:
>>> workqueue.h and kthread.h are included twice.It's unnecessary.
>>> hence just remove them.
>>>
>>> Signed-off-by: Yangtao Li 
>>
>> Acked-by: Tejun Heo 
>>
>> Can you route this through the trivial tree?
>>
>> Thanks.
>>
>> --
>> tejun


Re: [PATCH] workqueue: remove some duplicated includes

2018-12-01 Thread Nikolay Borisov



On 1.12.18 г. 8:46 ч., Frank Lee wrote:
> It seems that the trivial tree has not been maintained for some time.
> Are there aother tree to choose?


perhaps mmotm, maintained by Andrew (cc'ed)
> 
> MBR,
> Yangtao
> On Sat, Dec 1, 2018 at 2:36 AM Tejun Heo  wrote:
>>
>> On Mon, Nov 26, 2018 at 09:33:26AM -0500, Yangtao Li wrote:
>>> workqueue.h and kthread.h are included twice.It's unnecessary.
>>> hence just remove them.
>>>
>>> Signed-off-by: Yangtao Li 
>>
>> Acked-by: Tejun Heo 
>>
>> Can you route this through the trivial tree?
>>
>> Thanks.
>>
>> --
>> tejun


Re: [PATCH] locktorture: style fix - spaces required around

2018-12-01 Thread Paul E. McKenney
On Sat, Dec 01, 2018 at 04:40:39PM +0800, Wen Yang wrote:
> This patch fixes the following checkpatch.pl errors:
> 
> ERROR: spaces required around that ':' (ctx:VxW)
> +torture_type, tag, cxt.debug_lock ? " [debug]": "",
>^
> 
> Signed-off-by: Wen Yang 
> CC: Davidlohr Bueso 
> CC: "Paul E. McKenney" 
> CC: Josh Triplett 
> CC: linux-kernel@vger.kernel.org

Adding the current maintainers on CC.

Thanx, Paul

> ---
>  kernel/locking/locktorture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index cd95c01491d8..d1d8356b770a 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -790,7 +790,7 @@ lock_torture_print_module_parms(struct lock_torture_ops 
> *cur_ops,
>  {
>   pr_alert("%s" TORTURE_FLAG
>"--- %s%s: nwriters_stress=%d nreaders_stress=%d 
> stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d 
> onoff_interval=%d onoff_holdoff=%d\n",
> -  torture_type, tag, cxt.debug_lock ? " [debug]": "",
> +  torture_type, tag, cxt.debug_lock ? " [debug]" : "",
>cxt.nrealwriters_stress, cxt.nrealreaders_stress, 
> stat_interval,
>verbose, shuffle_interval, stutter, shutdown_secs,
>onoff_interval, onoff_holdoff);
> -- 
> 2.19.1
> 



Re: [PATCH] locktorture: style fix - spaces required around

2018-12-01 Thread Paul E. McKenney
On Sat, Dec 01, 2018 at 04:40:39PM +0800, Wen Yang wrote:
> This patch fixes the following checkpatch.pl errors:
> 
> ERROR: spaces required around that ':' (ctx:VxW)
> +torture_type, tag, cxt.debug_lock ? " [debug]": "",
>^
> 
> Signed-off-by: Wen Yang 
> CC: Davidlohr Bueso 
> CC: "Paul E. McKenney" 
> CC: Josh Triplett 
> CC: linux-kernel@vger.kernel.org

Adding the current maintainers on CC.

Thanx, Paul

> ---
>  kernel/locking/locktorture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index cd95c01491d8..d1d8356b770a 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -790,7 +790,7 @@ lock_torture_print_module_parms(struct lock_torture_ops 
> *cur_ops,
>  {
>   pr_alert("%s" TORTURE_FLAG
>"--- %s%s: nwriters_stress=%d nreaders_stress=%d 
> stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d 
> onoff_interval=%d onoff_holdoff=%d\n",
> -  torture_type, tag, cxt.debug_lock ? " [debug]": "",
> +  torture_type, tag, cxt.debug_lock ? " [debug]" : "",
>cxt.nrealwriters_stress, cxt.nrealreaders_stress, 
> stat_interval,
>verbose, shuffle_interval, stutter, shutdown_secs,
>onoff_interval, onoff_holdoff);
> -- 
> 2.19.1
> 



Re: [PATCH] locktorture: Fix assignment of boolean variables

2018-12-01 Thread Paul E. McKenney
On Sat, Dec 01, 2018 at 04:31:49PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> 
> kernel/locking/locktorture.c:703:6-10: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:918:2-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:949:3-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:682:2-19: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:688:2-19: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:648:2-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:654:2-20: WARNING: Assignment of bool to 0/1
> 
> This patch also makes the code more readable.
> 
> Signed-off-by: Wen Yang 
> CC: Davidlohr Bueso 
> CC: "Paul E. McKenney" 
> CC: Josh Triplett 
> CC: linux-kernel@vger.kernel.org

Adding the current maintainers on CC.

Thanx, Paul

> ---
>  kernel/locking/locktorture.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index 7d0b0ed74404..cd95c01491d8 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -645,13 +645,13 @@ static int lock_torture_writer(void *arg)
>   cxt.cur_ops->writelock();
>   if (WARN_ON_ONCE(lock_is_write_held))
>   lwsp->n_lock_fail++;
> - lock_is_write_held = 1;
> + lock_is_write_held = true;
>   if (WARN_ON_ONCE(lock_is_read_held))
>   lwsp->n_lock_fail++; /* rare, but... */
>  
>   lwsp->n_lock_acquired++;
>   cxt.cur_ops->write_delay();
> - lock_is_write_held = 0;
> + lock_is_write_held = false;
>   cxt.cur_ops->writeunlock();
>  
>   stutter_wait("lock_torture_writer");
> @@ -679,13 +679,13 @@ static int lock_torture_reader(void *arg)
>   schedule_timeout_uninterruptible(1);
>  
>   cxt.cur_ops->readlock();
> - lock_is_read_held = 1;
> + lock_is_read_held = true;
>   if (WARN_ON_ONCE(lock_is_write_held))
>   lrsp->n_lock_fail++; /* rare, but... */
>  
>   lrsp->n_lock_acquired++;
>   cxt.cur_ops->read_delay();
> - lock_is_read_held = 0;
> + lock_is_read_held = false;
>   cxt.cur_ops->readunlock();
>  
>   stutter_wait("lock_torture_reader");
> @@ -700,7 +700,7 @@ static int lock_torture_reader(void *arg)
>  static void __torture_print_stats(char *page,
> struct lock_stress_stats *statp, bool write)
>  {
> - bool fail = 0;
> + bool fail = false;
>   int i, n_stress;
>   long max = 0, min = statp ? statp[0].n_lock_acquired : 0;
>   long long sum = 0;
> @@ -915,7 +915,7 @@ static int __init lock_torture_init(void)
>  
>   /* Initialize the statistics so that each run gets its own numbers. */
>   if (nwriters_stress) {
> - lock_is_write_held = 0;
> + lock_is_write_held = false;
>   cxt.lwsa = kmalloc_array(cxt.nrealwriters_stress,
>sizeof(*cxt.lwsa),
>GFP_KERNEL);
> @@ -946,7 +946,7 @@ static int __init lock_torture_init(void)
>   }
>  
>   if (nreaders_stress) {
> - lock_is_read_held = 0;
> + lock_is_read_held = false;
>   cxt.lrsa = kmalloc_array(cxt.nrealreaders_stress,
>sizeof(*cxt.lrsa),
>GFP_KERNEL);
> -- 
> 2.19.1
> 



Re: [PATCH] locktorture: Fix assignment of boolean variables

2018-12-01 Thread Paul E. McKenney
On Sat, Dec 01, 2018 at 04:31:49PM +0800, Wen Yang wrote:
> Fix the following warnings reported by coccinelle:
> 
> kernel/locking/locktorture.c:703:6-10: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:918:2-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:949:3-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:682:2-19: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:688:2-19: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:648:2-20: WARNING: Assignment of bool to 0/1
> kernel/locking/locktorture.c:654:2-20: WARNING: Assignment of bool to 0/1
> 
> This patch also makes the code more readable.
> 
> Signed-off-by: Wen Yang 
> CC: Davidlohr Bueso 
> CC: "Paul E. McKenney" 
> CC: Josh Triplett 
> CC: linux-kernel@vger.kernel.org

Adding the current maintainers on CC.

Thanx, Paul

> ---
>  kernel/locking/locktorture.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
> index 7d0b0ed74404..cd95c01491d8 100644
> --- a/kernel/locking/locktorture.c
> +++ b/kernel/locking/locktorture.c
> @@ -645,13 +645,13 @@ static int lock_torture_writer(void *arg)
>   cxt.cur_ops->writelock();
>   if (WARN_ON_ONCE(lock_is_write_held))
>   lwsp->n_lock_fail++;
> - lock_is_write_held = 1;
> + lock_is_write_held = true;
>   if (WARN_ON_ONCE(lock_is_read_held))
>   lwsp->n_lock_fail++; /* rare, but... */
>  
>   lwsp->n_lock_acquired++;
>   cxt.cur_ops->write_delay();
> - lock_is_write_held = 0;
> + lock_is_write_held = false;
>   cxt.cur_ops->writeunlock();
>  
>   stutter_wait("lock_torture_writer");
> @@ -679,13 +679,13 @@ static int lock_torture_reader(void *arg)
>   schedule_timeout_uninterruptible(1);
>  
>   cxt.cur_ops->readlock();
> - lock_is_read_held = 1;
> + lock_is_read_held = true;
>   if (WARN_ON_ONCE(lock_is_write_held))
>   lrsp->n_lock_fail++; /* rare, but... */
>  
>   lrsp->n_lock_acquired++;
>   cxt.cur_ops->read_delay();
> - lock_is_read_held = 0;
> + lock_is_read_held = false;
>   cxt.cur_ops->readunlock();
>  
>   stutter_wait("lock_torture_reader");
> @@ -700,7 +700,7 @@ static int lock_torture_reader(void *arg)
>  static void __torture_print_stats(char *page,
> struct lock_stress_stats *statp, bool write)
>  {
> - bool fail = 0;
> + bool fail = false;
>   int i, n_stress;
>   long max = 0, min = statp ? statp[0].n_lock_acquired : 0;
>   long long sum = 0;
> @@ -915,7 +915,7 @@ static int __init lock_torture_init(void)
>  
>   /* Initialize the statistics so that each run gets its own numbers. */
>   if (nwriters_stress) {
> - lock_is_write_held = 0;
> + lock_is_write_held = false;
>   cxt.lwsa = kmalloc_array(cxt.nrealwriters_stress,
>sizeof(*cxt.lwsa),
>GFP_KERNEL);
> @@ -946,7 +946,7 @@ static int __init lock_torture_init(void)
>   }
>  
>   if (nreaders_stress) {
> - lock_is_read_held = 0;
> + lock_is_read_held = false;
>   cxt.lrsa = kmalloc_array(cxt.nrealreaders_stress,
>sizeof(*cxt.lrsa),
>GFP_KERNEL);
> -- 
> 2.19.1
> 



[GIT pull] x86/pti: Cure the STIBP fallout

2018-12-01 Thread Thomas Gleixner
Linus,

please pull the latest x86-pti-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-pti-for-linus

The performance destruction department finally got it's act together and
came up with a cure for the STIPB regression:

  - Provide a command line option to control the spectre v2 user space
mitigations. Default is either seccomp or prctl (if seccomp is disabled
in Kconfig). prctl allows mitigation opt-in, seccomp enables the
migitation for sandboxed processes.

  - Rework the code to handle the conditional STIBP/IBPB control and remove
the now unused ptrace_may_access_sched() optimization attempt

  - Disable STIBP automatically when SMT is disabled

  - Optimize the switch_to() logic to avoid MSR writes and invocations of
__switch_to_xtra().

  - Make the asynchronous speculation TIF updates synchronous to prevent
stale mitigation state.

As a general cleanup this also makes retpoline directly depend on compiler
support and removes the 'minimal retpoline' option which just pretended to
provide some form of security while providing none.

Thanks,

tglx

-->
Peter Zijlstra (Intel) (1):
  sched/smt: Make sched_smt_present track topology

Thomas Gleixner (21):
  x86/speculation: Rename SSBD update functions
  x86/Kconfig: Select SCHED_SMT if SMP enabled
  sched/smt: Expose sched_smt_present static key
  x86/speculation: Rework SMT state change
  x86/l1tf: Show actual SMT state
  x86/speculation: Reorder the spec_v2 code
  x86/speculation: Mark string arrays const correctly
  x86/speculataion: Mark command line parser data __initdata
  x86/speculation: Unify conditional spectre v2 print functions
  x86/speculation: Add command line control for indirect branch speculation
  x86/process: Consolidate and simplify switch_to_xtra() code
  x86/speculation: Avoid __switch_to_xtra() calls
  x86/speculation: Prepare for conditional IBPB in switch_mm()
  ptrace: Remove unused ptrace_may_access_sched() and MODE_IBRS
  x86/speculation: Split out TIF update
  x86/speculation: Prevent stale SPEC_CTRL msr content
  x86/speculation: Prepare arch_smt_update() for PRCTL mode
  x86/speculation: Add prctl() control for indirect branch speculation
  x86/speculation: Enable prctl mode for spectre_v2_user
  x86/speculation: Add seccomp Spectre v2 user space protection mode
  x86/speculation: Provide IBPB always command line options

Tim Chen (7):
  x86/speculation: Update the TIF_SSBD comment
  x86/speculation: Clean up spectre_v2_parse_cmdline()
  x86/speculation: Remove unnecessary ret variable in cpu_show_common()
  x86/speculation: Move STIPB/IBPB string conditionals out of 
cpu_show_common()
  x86/speculation: Disable STIBP when enhanced IBRS is in use
  x86/speculation: Reorganize speculation control MSRs update
  x86/speculation: Prepare for per task indirect branch speculation control

Zhenzhong Duan (2):
  x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support
  x86/retpoline: Remove minimal retpoline support


 Documentation/admin-guide/kernel-parameters.txt |  56 ++-
 Documentation/userspace-api/spec_ctrl.rst   |   9 +
 arch/x86/Kconfig|  12 +-
 arch/x86/Makefile   |   5 +-
 arch/x86/include/asm/msr-index.h|   5 +-
 arch/x86/include/asm/nospec-branch.h|  26 +-
 arch/x86/include/asm/spec-ctrl.h|  20 +-
 arch/x86/include/asm/switch_to.h|   3 -
 arch/x86/include/asm/thread_info.h  |  20 +-
 arch/x86/include/asm/tlbflush.h |   8 +-
 arch/x86/kernel/cpu/bugs.c  | 525 +---
 arch/x86/kernel/process.c   | 101 -
 arch/x86/kernel/process.h   |  39 ++
 arch/x86/kernel/process_32.c|  10 +-
 arch/x86/kernel/process_64.c|  10 +-
 arch/x86/mm/tlb.c   | 115 --
 include/linux/ptrace.h  |  17 -
 include/linux/sched.h   |   9 +
 include/linux/sched/smt.h   |  20 +
 include/uapi/linux/prctl.h  |   1 +
 kernel/cpu.c|  15 +-
 kernel/ptrace.c |  10 -
 kernel/sched/core.c |  19 +-
 kernel/sched/sched.h|   4 +-
 scripts/Makefile.build  |   2 -
 tools/include/uapi/linux/prctl.h|   1 +
 26 files changed, 780 insertions(+), 282 deletions(-)
 create mode 100644 arch/x86/kernel/process.h
 create mode 100644 include/linux/sched/smt.h

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 19f4423e70d9..05a252e5178d 

[GIT pull] x86/pti: Cure the STIBP fallout

2018-12-01 Thread Thomas Gleixner
Linus,

please pull the latest x86-pti-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-pti-for-linus

The performance destruction department finally got it's act together and
came up with a cure for the STIPB regression:

  - Provide a command line option to control the spectre v2 user space
mitigations. Default is either seccomp or prctl (if seccomp is disabled
in Kconfig). prctl allows mitigation opt-in, seccomp enables the
migitation for sandboxed processes.

  - Rework the code to handle the conditional STIBP/IBPB control and remove
the now unused ptrace_may_access_sched() optimization attempt

  - Disable STIBP automatically when SMT is disabled

  - Optimize the switch_to() logic to avoid MSR writes and invocations of
__switch_to_xtra().

  - Make the asynchronous speculation TIF updates synchronous to prevent
stale mitigation state.

As a general cleanup this also makes retpoline directly depend on compiler
support and removes the 'minimal retpoline' option which just pretended to
provide some form of security while providing none.

Thanks,

tglx

-->
Peter Zijlstra (Intel) (1):
  sched/smt: Make sched_smt_present track topology

Thomas Gleixner (21):
  x86/speculation: Rename SSBD update functions
  x86/Kconfig: Select SCHED_SMT if SMP enabled
  sched/smt: Expose sched_smt_present static key
  x86/speculation: Rework SMT state change
  x86/l1tf: Show actual SMT state
  x86/speculation: Reorder the spec_v2 code
  x86/speculation: Mark string arrays const correctly
  x86/speculataion: Mark command line parser data __initdata
  x86/speculation: Unify conditional spectre v2 print functions
  x86/speculation: Add command line control for indirect branch speculation
  x86/process: Consolidate and simplify switch_to_xtra() code
  x86/speculation: Avoid __switch_to_xtra() calls
  x86/speculation: Prepare for conditional IBPB in switch_mm()
  ptrace: Remove unused ptrace_may_access_sched() and MODE_IBRS
  x86/speculation: Split out TIF update
  x86/speculation: Prevent stale SPEC_CTRL msr content
  x86/speculation: Prepare arch_smt_update() for PRCTL mode
  x86/speculation: Add prctl() control for indirect branch speculation
  x86/speculation: Enable prctl mode for spectre_v2_user
  x86/speculation: Add seccomp Spectre v2 user space protection mode
  x86/speculation: Provide IBPB always command line options

Tim Chen (7):
  x86/speculation: Update the TIF_SSBD comment
  x86/speculation: Clean up spectre_v2_parse_cmdline()
  x86/speculation: Remove unnecessary ret variable in cpu_show_common()
  x86/speculation: Move STIPB/IBPB string conditionals out of 
cpu_show_common()
  x86/speculation: Disable STIBP when enhanced IBRS is in use
  x86/speculation: Reorganize speculation control MSRs update
  x86/speculation: Prepare for per task indirect branch speculation control

Zhenzhong Duan (2):
  x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support
  x86/retpoline: Remove minimal retpoline support


 Documentation/admin-guide/kernel-parameters.txt |  56 ++-
 Documentation/userspace-api/spec_ctrl.rst   |   9 +
 arch/x86/Kconfig|  12 +-
 arch/x86/Makefile   |   5 +-
 arch/x86/include/asm/msr-index.h|   5 +-
 arch/x86/include/asm/nospec-branch.h|  26 +-
 arch/x86/include/asm/spec-ctrl.h|  20 +-
 arch/x86/include/asm/switch_to.h|   3 -
 arch/x86/include/asm/thread_info.h  |  20 +-
 arch/x86/include/asm/tlbflush.h |   8 +-
 arch/x86/kernel/cpu/bugs.c  | 525 +---
 arch/x86/kernel/process.c   | 101 -
 arch/x86/kernel/process.h   |  39 ++
 arch/x86/kernel/process_32.c|  10 +-
 arch/x86/kernel/process_64.c|  10 +-
 arch/x86/mm/tlb.c   | 115 --
 include/linux/ptrace.h  |  17 -
 include/linux/sched.h   |   9 +
 include/linux/sched/smt.h   |  20 +
 include/uapi/linux/prctl.h  |   1 +
 kernel/cpu.c|  15 +-
 kernel/ptrace.c |  10 -
 kernel/sched/core.c |  19 +-
 kernel/sched/sched.h|   4 +-
 scripts/Makefile.build  |   2 -
 tools/include/uapi/linux/prctl.h|   1 +
 26 files changed, 780 insertions(+), 282 deletions(-)
 create mode 100644 arch/x86/kernel/process.h
 create mode 100644 include/linux/sched/smt.h

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 19f4423e70d9..05a252e5178d 

Re: [PATCH 22/27] locking/lockdep: Reuse list entries that are no longer in use

2018-12-01 Thread Peter Zijlstra
On Thu, Nov 29, 2018 at 08:48:50AM -0800, Bart Van Assche wrote:
> On Thu, 2018-11-29 at 13:01 +0100, Peter Zijlstra wrote:
> > On Thu, Nov 29, 2018 at 11:49:02AM +0100, Peter Zijlstra wrote:
> > > On Wed, Nov 28, 2018 at 03:43:20PM -0800, Bart Van Assche wrote:
> > > > /*
> > > >  * Remove all dependencies this lock is
> > > >  * involved in:
> > > >  */
> > > > +   list_for_each_entry_safe(entry, tmp, _list_entries, 
> > > > alloc_entry) {
> > > > if (entry->class != class && entry->links_to != class)
> > > > continue;
> > > > links_to = entry->links_to;
> > > > WARN_ON_ONCE(entry->class == links_to);
> > > > list_del_rcu(>lock_order_entry);
> > > > +   list_move(>alloc_entry, _list_entries);
> > > > entry->class = NULL;
> > > > entry->links_to = NULL;
> > > > check_free_class(zapped_classes, class);
> > > 
> > > Hurm.. I'm confused here.
> > > 
> > > The reason you cannot re-use lock_order_entry for the free list is
> > > because list_del_rcu(), right? But if so, then what ensures the
> > > list_entry is not re-used before it's grace-period?
> > 
> > Also; if you have to grow lock_list by 16 bytes just to be able to free
> > it, a bitmap allocator is much cheaper, space wise.
> > 
> > Some people seem to really care about the static image size, and
> > lockdep's .data section does matter to them.
> 
> How about addressing this by moving removed list entries to a "zapped_entries"
> list and only moving list entries from the zapped_entries list to the
> free_list_entries list after an RCU grace period? I'm not sure that it is
> possible to implement that approach without introducing a new list_head in
> struct lock_list.

I think we can do this with a free bitmap and an array of 2 pending
bitmaps and an index. Add newly freed entries to the pending bitmap
indicated by the current index, when complete flip the index -- such
that further new bits go to the other pending bitmap -- and call_rcu().

Then, on the call_rcu() callback, ie. after a GP has happened, OR our
pending bitmap into the free bitmap, and when the other pending bitmap
isn't empty, flip the index again and start it all again.

This ensures there is at least one full GP between setting a bit and it
landing in the free mask.



Re: [PATCH 22/27] locking/lockdep: Reuse list entries that are no longer in use

2018-12-01 Thread Peter Zijlstra
On Thu, Nov 29, 2018 at 08:48:50AM -0800, Bart Van Assche wrote:
> On Thu, 2018-11-29 at 13:01 +0100, Peter Zijlstra wrote:
> > On Thu, Nov 29, 2018 at 11:49:02AM +0100, Peter Zijlstra wrote:
> > > On Wed, Nov 28, 2018 at 03:43:20PM -0800, Bart Van Assche wrote:
> > > > /*
> > > >  * Remove all dependencies this lock is
> > > >  * involved in:
> > > >  */
> > > > +   list_for_each_entry_safe(entry, tmp, _list_entries, 
> > > > alloc_entry) {
> > > > if (entry->class != class && entry->links_to != class)
> > > > continue;
> > > > links_to = entry->links_to;
> > > > WARN_ON_ONCE(entry->class == links_to);
> > > > list_del_rcu(>lock_order_entry);
> > > > +   list_move(>alloc_entry, _list_entries);
> > > > entry->class = NULL;
> > > > entry->links_to = NULL;
> > > > check_free_class(zapped_classes, class);
> > > 
> > > Hurm.. I'm confused here.
> > > 
> > > The reason you cannot re-use lock_order_entry for the free list is
> > > because list_del_rcu(), right? But if so, then what ensures the
> > > list_entry is not re-used before it's grace-period?
> > 
> > Also; if you have to grow lock_list by 16 bytes just to be able to free
> > it, a bitmap allocator is much cheaper, space wise.
> > 
> > Some people seem to really care about the static image size, and
> > lockdep's .data section does matter to them.
> 
> How about addressing this by moving removed list entries to a "zapped_entries"
> list and only moving list entries from the zapped_entries list to the
> free_list_entries list after an RCU grace period? I'm not sure that it is
> possible to implement that approach without introducing a new list_head in
> struct lock_list.

I think we can do this with a free bitmap and an array of 2 pending
bitmaps and an index. Add newly freed entries to the pending bitmap
indicated by the current index, when complete flip the index -- such
that further new bits go to the other pending bitmap -- and call_rcu().

Then, on the call_rcu() callback, ie. after a GP has happened, OR our
pending bitmap into the free bitmap, and when the other pending bitmap
isn't empty, flip the index again and start it all again.

This ensures there is at least one full GP between setting a bit and it
landing in the free mask.



Re: BUG: corrupted list in freeary

2018-12-01 Thread Manfred Spraul

Hi Dmitry,

On 11/30/18 6:58 PM, Dmitry Vyukov wrote:

On Thu, Nov 29, 2018 at 9:13 AM, Manfred Spraul
 wrote:

Hello together,

On 11/27/18 4:52 PM, syzbot wrote:

Hello,

syzbot found the following crash on:

HEAD commit:e195ca6cb6f2 Merge branch 'for-linus' of git://git.kernel...
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10d3e6a340

[...]

Isn't this a kernel stack overrun?

RSP: 0x..83e008. Assuming 8 kB kernel stack, and 8 kB alignment, we have
used up everything.

I don't exact answer, that's just the kernel output that we captured
from console.

FWIW with KASAN stacks are 16K:
https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/page_64_types.h#L10
Ok, thanks. And stack overrun detection is enabled as well -> a real 
stack overrun is unlikely.

Well, generally everything except for kernel crashes is expected.

We actually sandbox it with memcg quite aggressively:
https://github.com/google/syzkaller/blob/master/executor/common_linux.h#L2159
But it seems to manage to either break the limits, or cause some
massive memory leaks. The nature of that is yet unknown.


Is it possible to start from that side?

Are there other syzcaller runs where the OOM killer triggers that much?




- Which stress tests are enabled? By chance, I found:

[  433.304586] FAULT_INJECTION: forcing a failure.^M
[  433.304586] name fail_page_alloc, interval 1, probability 0, space 0,
times 0^M
[  433.316471] CPU: 1 PID: 19653 Comm: syz-executor4 Not tainted 4.20.0-rc3+
#348^M
[  433.323841] Hardware name: Google Google Compute Engine/Google Compute
Engine, BIOS Google 01/01/2011^M

I need some more background, then I can review the code.

What exactly do you mean by "Which stress tests"?
Fault injection is enabled. Also random workload from userspace.



Right now, I would put it into my "unknown syzcaller finding" folder.


One more idea: Are there further syzcaller runs that end up with 
0x01 in a pointer?


From what I see, the sysv sem code that is used is trivial, I don't see 
that it could cause the observed behavior.



--

    Manfred



Re: BUG: corrupted list in freeary

2018-12-01 Thread Manfred Spraul

Hi Dmitry,

On 11/30/18 6:58 PM, Dmitry Vyukov wrote:

On Thu, Nov 29, 2018 at 9:13 AM, Manfred Spraul
 wrote:

Hello together,

On 11/27/18 4:52 PM, syzbot wrote:

Hello,

syzbot found the following crash on:

HEAD commit:e195ca6cb6f2 Merge branch 'for-linus' of git://git.kernel...
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10d3e6a340

[...]

Isn't this a kernel stack overrun?

RSP: 0x..83e008. Assuming 8 kB kernel stack, and 8 kB alignment, we have
used up everything.

I don't exact answer, that's just the kernel output that we captured
from console.

FWIW with KASAN stacks are 16K:
https://elixir.bootlin.com/linux/latest/source/arch/x86/include/asm/page_64_types.h#L10
Ok, thanks. And stack overrun detection is enabled as well -> a real 
stack overrun is unlikely.

Well, generally everything except for kernel crashes is expected.

We actually sandbox it with memcg quite aggressively:
https://github.com/google/syzkaller/blob/master/executor/common_linux.h#L2159
But it seems to manage to either break the limits, or cause some
massive memory leaks. The nature of that is yet unknown.


Is it possible to start from that side?

Are there other syzcaller runs where the OOM killer triggers that much?




- Which stress tests are enabled? By chance, I found:

[  433.304586] FAULT_INJECTION: forcing a failure.^M
[  433.304586] name fail_page_alloc, interval 1, probability 0, space 0,
times 0^M
[  433.316471] CPU: 1 PID: 19653 Comm: syz-executor4 Not tainted 4.20.0-rc3+
#348^M
[  433.323841] Hardware name: Google Google Compute Engine/Google Compute
Engine, BIOS Google 01/01/2011^M

I need some more background, then I can review the code.

What exactly do you mean by "Which stress tests"?
Fault injection is enabled. Also random workload from userspace.



Right now, I would put it into my "unknown syzcaller finding" folder.


One more idea: Are there further syzcaller runs that end up with 
0x01 in a pointer?


From what I see, the sysv sem code that is used is trivial, I don't see 
that it could cause the observed behavior.



--

    Manfred



Re: [GIT PULL] PCI fixes for v4.20

2018-12-01 Thread pr-tracker-bot
The pull request you sent on Fri, 30 Nov 2018 23:59:53 -0600:

> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git 
> tags/pci-v4.20-fixes-2

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c734b42583bc391d86ed64e3be25fd5f2c464124

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


Re: [GIT PULL] PCI fixes for v4.20

2018-12-01 Thread pr-tracker-bot
The pull request you sent on Fri, 30 Nov 2018 23:59:53 -0600:

> git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git 
> tags/pci-v4.20-fixes-2

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c734b42583bc391d86ed64e3be25fd5f2c464124

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker


  1   2   3   4   >