[PATCH] dt-bindings: nand: denali: reduce the register space in the example

2017-09-14 Thread Masahiro Yamada
This example allocates too much for register regions.  Especially,
there are only two registers in the "nand_data" interface of this
hardware (ADDR: 0x00, DATA: 0x10).

Signed-off-by: Masahiro Yamada 
---

 Documentation/devicetree/bindings/mtd/denali-nand.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt 
b/Documentation/devicetree/bindings/mtd/denali-nand.txt
index 504291d..0ee8edb 100644
--- a/Documentation/devicetree/bindings/mtd/denali-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt
@@ -29,7 +29,7 @@ nand: nand@ff90 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "altr,socfpga-denali-nand";
-   reg = <0xff90 0x10>, <0xffb8 0x1>;
+   reg = <0xff90 0x20>, <0xffb8 0x1000>;
reg-names = "nand_data", "denali_reg";
interrupts = <0 144 4>;
 };
-- 
2.7.4



Re: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

2017-09-14 Thread Sergey Senozhatsky
On (09/08/17 20:28), Helge Deller wrote:
[..]
> I don't like this kind of trying to figure out at runtime at all.
> It's too much guessing in here IMHO.

well, may be we can avoid any guessing by checking that the
pointer belongs to .opd section.

for kernel we can add 2 new unsigned longs - __opd_start __opd_end -- and
tweak the corresponding arch/${FOO}/kernel/vmlinux.lds.S file to set those
two, the same way text, unwinding, etc. are set.

 wait a second.

arch/ia64/kernel/vmlinux.lds.S  already handles .opd section

.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
*(.opd)
}

it just doesn't save start/end addresses. so all we need to to
is

.opd : AT(ADDR(.opd) - LOAD_OFFSET) {
+   __opd_start = .;
*(.opd)
+   __opd_end = .;
}

and tweak symbol dereference

 static inline void *dereference_function_descriptor(void *ptr)
 {
struct fdesc *desc = ptr;
void *p;
 
+   if (prt < (void *)__start_opd || (void *)__end_opd < ptr)
+   return ptr;
+
if (!probe_kernel_address(>ip, p))
ptr = p;
return ptr;



now, the modules.

module_frob_arch_sections() has the following lines

else if (strcmp(".opd", secstrings + s->sh_name) == 0)
mod->arch.opd = s;

so, once, again, we keep the .opd section info in memory. and we
also have the size of that section

mod->arch.opd->sh_size = fdescs * sizeof(struct fdesc);

so it seems that we've got what we need. need to provide arch callback
(same way as we do with dereference_function_descriptor() to properly
dereference modules' symbols).


so I think we almost have what we need to make ps/pS smart enough
on ppc64/ia64/parisc.

powerpc and parisc handle kernel .opd section as well:

arch/powerpc/kernel/vmlinux.lds.S:  .opd
arch/parisc/kernel/vmlinux.lds.S:   .opd


need to check more.


> What about this idea:
> For %pF we always have pointers to functions, e.g.: 
> printk("Going to call: %pF\n", gettimeofday);
> printk("Going to call: %pF\n", p->func);
> 
> and for %pS most (if not all) usages use some kind of casting 
> from "unsigned long" to "void *", e.g.:
> printk("%s: called from %pS\n", __func__, (void *)_RET_IP_);
> printk("%s: called from %pS\n", __func__, (void 
> *)__builtin_return_address(0));
> printk("Faulted at %pS\n", (void *)regs->ip);
> 
> So, what if we for the %pS case simply take the type as it is 
> (unsigned long) and introduce a new printk-format, e.g. "%luS" ?
> The %pS examples above then become:
> printk("%s: called from %luS\n", __func__, _RET_IP_);
> printk("%s: called from %luS\n", __func__, 
> __builtin_return_address(0));
> printk("Faulted at %luS\n", regs->ip);
> 
> That way we don't need type-casting, gain compile-time type 
> checks from the compiler, and we could add a checkpatch (or occinelle)
> check which checks for the combination of %pF/%pS and "void*" keyword
> and suggest to use %luS.
> 
> Opinions?

hm. sounds interesting. but I'm afraid people won't be so happy
to learn a new printk format specifier.

-ss


[PATCH 1/2] clocksource: stm32: rework driver to use only one timer

2017-09-14 Thread Benjamin Gaignard
Rework driver code to use only one timer for both clocksource
and clockevent.
This patch also forbids to use 16 bits timers because they are
not enough accurate.
Do some clean up in structures and functions names too.

Signed-off-by: Ludovic Barre 
Signed-off-by: Benjamin Gaignard 
---
 drivers/clocksource/timer-stm32.c | 259 +++---
 1 file changed, 155 insertions(+), 104 deletions(-)

diff --git a/drivers/clocksource/timer-stm32.c 
b/drivers/clocksource/timer-stm32.c
index 8f24237..648c10a 100644
--- a/drivers/clocksource/timer-stm32.c
+++ b/drivers/clocksource/timer-stm32.c
@@ -16,175 +16,226 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #define TIM_CR10x00
 #define TIM_DIER   0x0c
 #define TIM_SR 0x10
 #define TIM_EGR0x14
+#define TIM_CNT0x24
 #define TIM_PSC0x28
 #define TIM_ARR0x2c
+#define TIM_CCR1   0x34
 
 #define TIM_CR1_CENBIT(0)
-#define TIM_CR1_OPMBIT(3)
+#define TIM_CR1_UDIS   BIT(1)
 #define TIM_CR1_ARPE   BIT(7)
 
-#define TIM_DIER_UIE   BIT(0)
-
-#define TIM_SR_UIF BIT(0)
+#define TIM_DIER_CC1IE BIT(1)
 
 #define TIM_EGR_UG BIT(0)
 
-struct stm32_clock_event_ddata {
+struct stm32_clock_event {
struct clock_event_device evtdev;
unsigned periodic_top;
-   void __iomem *base;
+   void __iomem *regs;
 };
 
 static int stm32_clock_event_shutdown(struct clock_event_device *evtdev)
 {
-   struct stm32_clock_event_ddata *data =
-   container_of(evtdev, struct stm32_clock_event_ddata, evtdev);
-   void *base = data->base;
+   struct stm32_clock_event *ce =
+   container_of(evtdev, struct stm32_clock_event, evtdev);
+
+   writel_relaxed(0, ce->regs + TIM_DIER);
 
-   writel_relaxed(0, base + TIM_CR1);
return 0;
 }
 
-static int stm32_clock_event_set_periodic(struct clock_event_device *evtdev)
+static int stm32_clock_event_set_next_event(unsigned long evt,
+   struct clock_event_device *evtdev)
 {
-   struct stm32_clock_event_ddata *data =
-   container_of(evtdev, struct stm32_clock_event_ddata, evtdev);
-   void *base = data->base;
+   struct stm32_clock_event *ce =
+   container_of(evtdev, struct stm32_clock_event, evtdev);
+   unsigned long cnt;
+
+   cnt = readl_relaxed(ce->regs + TIM_CNT);
+   writel_relaxed(cnt + evt, ce->regs + TIM_CCR1);
+   writel_relaxed(TIM_DIER_CC1IE, ce->regs + TIM_DIER);
 
-   writel_relaxed(data->periodic_top, base + TIM_ARR);
-   writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, base + TIM_CR1);
return 0;
 }
 
-static int stm32_clock_event_set_next_event(unsigned long evt,
-   struct clock_event_device *evtdev)
+static int stm32_clock_event_set_periodic(struct clock_event_device *evtdev)
 {
-   struct stm32_clock_event_ddata *data =
-   container_of(evtdev, struct stm32_clock_event_ddata, evtdev);
+   struct stm32_clock_event *ce =
+   container_of(evtdev, struct stm32_clock_event, evtdev);
 
-   writel_relaxed(evt, data->base + TIM_ARR);
-   writel_relaxed(TIM_CR1_ARPE | TIM_CR1_OPM | TIM_CR1_CEN,
-  data->base + TIM_CR1);
+   return stm32_clock_event_set_next_event(ce->periodic_top, evtdev);
+}
 
-   return 0;
+static int stm32_clock_event_set_oneshot(struct clock_event_device *evtdev)
+{
+   return stm32_clock_event_set_next_event(0, evtdev);
 }
 
 static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id)
 {
-   struct stm32_clock_event_ddata *data = dev_id;
+   struct stm32_clock_event *ce = dev_id;
+
+   writel_relaxed(0, ce->regs + TIM_SR);
 
-   writel_relaxed(0, data->base + TIM_SR);
+   if (clockevent_state_periodic(>evtdev))
+   stm32_clock_event_set_periodic(>evtdev);
 
-   data->evtdev.event_handler(>evtdev);
+   if (clockevent_state_oneshot(>evtdev))
+   stm32_clock_event_shutdown(>evtdev);
+
+   ce->evtdev.event_handler(>evtdev);
 
return IRQ_HANDLED;
 }
 
-static struct stm32_clock_event_ddata clock_event_ddata = {
-   .evtdev = {
-   .name = "stm32 clockevent",
-   .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
-   .set_state_shutdown = stm32_clock_event_shutdown,
-   .set_state_periodic = stm32_clock_event_set_periodic,
-   .set_state_oneshot = stm32_clock_event_shutdown,
-   .tick_resume = stm32_clock_event_shutdown,
-   .set_next_event = stm32_clock_event_set_next_event,
-   .rating = 200,
-   },
-};
+static int __init stm32_clockevent_init(struct device_node *np,
+   void __iomem *base,
+   struct 

Re: [Patch v2 2/2] libiscsi: Remove iscsi_destroy_session

2017-09-14 Thread Johannes Thumshirn
On Wed, Sep 13, 2017 at 05:09:03PM -0700, Lee Duncan wrote:
> On 07/13/2017 09:11 AM, Khazhismel Kumykov wrote:
> > iscsi_session_teardown was the only user of this function. Function
> > currently is just short for iscsi_remove_session + iscsi_free_session.
> > 
> > Signed-off-by: Khazhismel Kumykov 
> 
> Why is this needed? I dislike changes that don't fix anything.

The function has no more users left after patch 1, so why keep it bitrotting?

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


[PATCH 2/2] arm: dts: stm32: remove useless clocksource nodes

2017-09-14 Thread Benjamin Gaignard
16 bits timers aren't accurate enough to be used as
clocksource, remove them from stm32f4 and stm32f7 devicetree.

Signed-off-by: Benjamin Gaignard 
---
 arch/arm/boot/dts/stm32f429.dtsi | 32 
 arch/arm/boot/dts/stm32f746.dtsi | 32 
 2 files changed, 64 deletions(-)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index a8113dc..fd211cb 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -108,14 +108,6 @@
};
};
 
-   timer3: timer@4400 {
-   compatible = "st,stm32-timer";
-   reg = <0x4400 0x400>;
-   interrupts = <29>;
-   clocks = < 0 STM32F4_APB1_CLOCK(TIM3)>;
-   status = "disabled";
-   };
-
timers3: timers@4400 {
#address-cells = <1>;
#size-cells = <0>;
@@ -137,14 +129,6 @@
};
};
 
-   timer4: timer@4800 {
-   compatible = "st,stm32-timer";
-   reg = <0x4800 0x400>;
-   interrupts = <30>;
-   clocks = < 0 STM32F4_APB1_CLOCK(TIM4)>;
-   status = "disabled";
-   };
-
timers4: timers@4800 {
#address-cells = <1>;
#size-cells = <0>;
@@ -194,14 +178,6 @@
};
};
 
-   timer6: timer@40001000 {
-   compatible = "st,stm32-timer";
-   reg = <0x40001000 0x400>;
-   interrupts = <54>;
-   clocks = < 0 STM32F4_APB1_CLOCK(TIM6)>;
-   status = "disabled";
-   };
-
timers6: timers@40001000 {
#address-cells = <1>;
#size-cells = <0>;
@@ -218,14 +194,6 @@
};
};
 
-   timer7: timer@40001400 {
-   compatible = "st,stm32-timer";
-   reg = <0x40001400 0x400>;
-   interrupts = <55>;
-   clocks = < 0 STM32F4_APB1_CLOCK(TIM7)>;
-   status = "disabled";
-   };
-
timers7: timers@40001400 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/arch/arm/boot/dts/stm32f746.dtsi b/arch/arm/boot/dts/stm32f746.dtsi
index 4506eb9..c4d0273 100644
--- a/arch/arm/boot/dts/stm32f746.dtsi
+++ b/arch/arm/boot/dts/stm32f746.dtsi
@@ -82,22 +82,6 @@
status = "disabled";
};
 
-   timer3: timer@4400 {
-   compatible = "st,stm32-timer";
-   reg = <0x4400 0x400>;
-   interrupts = <29>;
-   clocks = < 0 STM32F7_APB1_CLOCK(TIM3)>;
-   status = "disabled";
-   };
-
-   timer4: timer@4800 {
-   compatible = "st,stm32-timer";
-   reg = <0x4800 0x400>;
-   interrupts = <30>;
-   clocks = < 0 STM32F7_APB1_CLOCK(TIM4)>;
-   status = "disabled";
-   };
-
timer5: timer@4c00 {
compatible = "st,stm32-timer";
reg = <0x4c00 0x400>;
@@ -105,22 +89,6 @@
clocks = < 0 STM32F7_APB1_CLOCK(TIM5)>;
};
 
-   timer6: timer@40001000 {
-   compatible = "st,stm32-timer";
-   reg = <0x40001000 0x400>;
-   interrupts = <54>;
-   clocks = < 0 STM32F7_APB1_CLOCK(TIM6)>;
-   status = "disabled";
-   };
-
-   timer7: timer@40001400 {
-   compatible = "st,stm32-timer";
-   reg = <0x40001400 0x400>;
-   interrupts = <55>;
-   clocks = < 0 STM32F7_APB1_CLOCK(TIM7)>;
-   status = "disabled";
-   };
-
rtc: rtc@40002800 {
compatible = "st,stm32-rtc";
reg = <0x40002800 0x400>;
-- 
2.7.4



[PATCH 0/2] stm32 clocksource driver rework

2017-09-14 Thread Benjamin Gaignard
These patch implements clocksource and clockevent by using only one hardware 
block.
It also limits usage of clocksource to 32 bits timers because 16 bits ones
aren't enough accurate.
Series includes minor clean up in structures, function prototypes and driver 
name.

Since 16 bits timers become useless it also removes them from stm32f4 and
stm32f7 devicetree.

Benjamin Gaignard (2):
  clocksource: stm32: rework driver to use only one timer
  arm: dts: stm32: remove useless clocksource nodes

 arch/arm/boot/dts/stm32f429.dtsi  |  32 -
 arch/arm/boot/dts/stm32f746.dtsi  |  32 -
 drivers/clocksource/timer-stm32.c | 259 +++---
 3 files changed, 155 insertions(+), 168 deletions(-)

-- 
2.7.4



Re: [PATCH v3 04/20] mm: VMA sequence count

2017-09-14 Thread Sergey Senozhatsky
Hi,

On (09/14/17 09:55), Laurent Dufour wrote:
[..]
> > so if there are two CPUs, one doing write_seqcount() and the other one
> > doing read_seqcount() then what can happen is something like this
> > 
> > CPU0CPU1
> > 
> > fs_reclaim_acquire()
> > write_seqcount_begin()
> > fs_reclaim_acquire()read_seqcount_begin()
> > write_seqcount_end()
> > 
> > CPU0 can't write_seqcount_end() because of fs_reclaim_acquire() from
> > CPU1, CPU1 can't read_seqcount_begin() because CPU0 did 
> > write_seqcount_begin()
> > and now waits for fs_reclaim_acquire(). makes sense?
> 
> Yes, this makes sense.
> 
> But in the case of this series, there is no call to
> __read_seqcount_begin(), and the reader (the speculative page fault
> handler), is just checking for (vm_seq & 1) and if this is true, simply
> exit the speculative path without waiting.
> So there is no deadlock possibility.

probably lockdep just knows that those locks interleave at some
point.


by the way, I think there is one path that can spin

find_vma_srcu()
 read_seqbegin()
  read_seqcount_begin()
   raw_read_seqcount_begin()
__read_seqcount_begin()

-ss


Re: [PATCH 2/4] xen: limit grant v2 interface to the v1 functionality

2017-09-14 Thread Juergen Gross
On 13/09/17 18:20, Boris Ostrovsky wrote:
> On 09/13/2017 10:45 AM, Juergen Gross wrote:
>> On 13/09/17 15:50, Boris Ostrovsky wrote:
>>> On 09/13/2017 09:38 AM, Juergen Gross wrote:
 On 13/09/17 15:22, Boris Ostrovsky wrote:
> On 09/12/2017 02:18 PM, Juergen Gross wrote:
>> On 12/09/17 18:21, Boris Ostrovsky wrote:
>>> On 09/12/2017 12:09 PM, Juergen Gross wrote:
 On 12/09/17 18:05, Boris Ostrovsky wrote:
> On 09/12/2017 11:50 AM, Juergen Gross wrote:
>> On 12/09/17 17:44, Boris Ostrovsky wrote:
>>> On 09/08/2017 10:48 AM, Juergen Gross wrote:
 As there is currently no user for sub-page grants or transient 
 grants
 remove that functionality. This at once makes it possible to switch
 from grant v2 to grant v1 without restrictions, as there is no 
 loss of
 functionality other than the limited frame number width related to
 the switch.
>>> But isn't that ABI violation? v2 is expected to support this (XSAs
>>> notwithstanding)
>> No, I don't think so.
>>
>> The hypervisor still supports it, but the domU (or dom0) isn't 
>> required
>> to make use of all the features IMHO. Or are you aware of any backend
>> querying the grant version of a frontend and acting in another way 
>> if v2
>> is detected?
> I am not aware of any but that doesn't mean that they don't (or won't)
> exist.
 But isn't the frontend the one which is defining what is granted in
 which way? How should there be an ABI breakage when the frontend just
 isn't using sub-page or transitive grants?
>>> People may provide both front and backend drivers and frontends, knowing
>>> that v2 is available, could decide to use those features.
>> No, without the functions to use them it will be impossible.
> I don't follow this. Which functions? The ones this patch is removing?
 Yes, just after having been added one patch earlier.

 Right now the Linux kernel doesn't support grant V2 at all. So there
 surely is no driver making use of V2 features right now.

 Ican merge patches 1 and 2 in case you want. I just thought a pure
 revert of the former V2 remove patch would be easier to review,
 taking into account that the former V2 support was working in
 production environments (and even back then there was no user of
 sub-page or transient grants).
>>> No, I don't have problems with *how* you are doing this (revert fully
>>> first and then remove).
>>>
>>> I am just not sure that removing these functions is the way to go
>>> because we are ending up with partial implementation of v2. The fact
>>> that noone is/has been using these features is IMO not particularly
>>> relevant.
>>>
>>> If these two were optional features then it would have been reasonable
>>> to drop them.
>> Why does the kernel need to support all features of an interface?
>>
>> I'm quite sure there are lots of interfaces supported only partially in
>> the kernel.
> 
> I don't think partially supported interface is a supported interface.
> It's just something that has been working until now.
> 
>> Having support for functionality in the kernel not being used at all is
>> just adding dead code with a high potential to bitrot. I can't even test
>> this functionality right now, as there are no users of it. So I'd risk
>> adding something which is broken from the beginning. 
> 
> OK. That I haven't considered that.
> 
> BTW, why are you not removing (*update_trans_entry) definition from
> gnttab_ops? You are taking (*update_subpage_entry) out.

Just for having a reason to send V2. ;-)

Thanks for catching it.


Juergen



Re: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

2017-09-14 Thread Sergey Senozhatsky
On (09/14/17 10:39), Helge Deller wrote:
[..]
> The basic concept of your proposal may work, and since it will avoid such
> coding issues in the future I think it's probably the best solution.
> 
> Will you come up with a patch ? (I won't have time the next few days).
> If yes,I'd be happy to test it on parisc.

cool.

I think I can try to come up with something. I don't have any access
to affected H/W, so if I won't be able to bring up qemu images I'll
be happy to just hand it over to platform maintainers: arch-s like
parisc64 are way to exotic ;)  my aim is a removal of %pf/%pF here.

let's hear from ia64 and ppc64 guys.

-ss


[GIT PULL] dmi fixes for v4.14

2017-09-14 Thread Jean Delvare
Hi Linus,

Please pull dmi subsystem fixes for Linux v4.14 from:

git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git dmi-for-linus

 arch/x86/kernel/acpi/boot.c | 4 ++--
 arch/x86/kernel/apm_32.c| 2 +-
 arch/x86/kernel/io_delay.c  | 2 +-
 arch/x86/kernel/reboot.c| 2 +-
 arch/x86/pci/irq.c  | 2 +-
 arch/x86/power/cpu.c| 2 +-
 drivers/acpi/acpi_video.c   | 2 +-
 drivers/acpi/blacklist.c| 4 ++--
 drivers/acpi/bus.c  | 4 ++--
 drivers/acpi/ec.c   | 2 +-
 drivers/acpi/osi.c  | 2 +-
 drivers/acpi/pci_slot.c | 2 +-
 drivers/acpi/processor_pdc.c| 2 +-
 drivers/acpi/sleep.c| 2 +-
 drivers/acpi/thermal.c  | 2 +-
 drivers/char/sonypi.c   | 2 +-
 drivers/cpufreq/powernow-k7.c   | 2 +-
 drivers/firmware/google/gsmi.c  | 2 +-
 drivers/firmware/google/memconsole-x86-legacy.c | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c | 2 +-
 drivers/hwmon/acpi_power_meter.c| 2 +-
 drivers/hwmon/applesmc.c| 2 +-
 drivers/hwmon/dell-smm-hwmon.c  | 4 ++--
 drivers/input/touchscreen/htcpen.c  | 2 +-
 drivers/leds/leds-clevo-mail.c  | 2 +-
 drivers/leds/leds-ss4200.c  | 2 +-
 drivers/mfd/kempld-core.c   | 2 +-
 drivers/net/ethernet/marvell/skge.c | 2 +-
 drivers/net/ethernet/via/via-rhine.c| 2 +-
 drivers/pci/pcie/portdrv_pci.c  | 2 +-
 drivers/pci/quirks.c| 2 +-
 drivers/platform/chrome/chromeos_laptop.c   | 2 +-
 drivers/platform/chrome/chromeos_pstore.c   | 2 +-
 drivers/platform/chrome/cros_ec_lpc.c   | 2 +-
 drivers/platform/x86/compal-laptop.c| 2 +-
 drivers/platform/x86/hdaps.c| 2 +-
 drivers/platform/x86/ibm_rtl.c  | 2 +-
 drivers/platform/x86/intel_oaktrail.c   | 2 +-
 drivers/platform/x86/mlx-platform.c | 2 +-
 drivers/platform/x86/msi-laptop.c   | 2 +-
 drivers/platform/x86/samsung-laptop.c   | 2 +-
 drivers/platform/x86/samsung-q10.c  | 2 +-
 drivers/platform/x86/sony-laptop.c  | 2 +-
 drivers/platform/x86/toshiba-wmi.c  | 2 +-
 drivers/pnp/pnpbios/core.c  | 2 +-
 drivers/tty/serial/pch_uart.c   | 2 +-
 drivers/video/backlight/kb3886_bl.c | 2 +-
 sound/soc/codecs/rt5645.c   | 2 +-
 48 files changed, 52 insertions(+), 52 deletions(-)

---

Christoph Hellwig (1):
  dmi: Mark all struct dmi_system_id instances const

Thanks,
-- 
Jean Delvare
SUSE L3 Support


Re: [RFC Part2 PATCH v3 17/26] KVM: SVM: Add support for SEV LAUNCH_MEASURE command

2017-09-14 Thread Borislav Petkov
On Mon, Jul 24, 2017 at 03:02:54PM -0500, Brijesh Singh wrote:
> The command is used to retrieve the measurement of memory encrypted
> through the LAUNCH_UPDATE_DATA command. This measurement can be used
> for attestation purposes.
> 
> Signed-off-by: Brijesh Singh 
> ---
>  arch/x86/kvm/svm.c | 52 
>  1 file changed, 52 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 91b070f..9b672eb 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -5957,6 +5957,54 @@ static int sev_launch_update_data(struct kvm *kvm, 
> struct kvm_sev_cmd *argp)
>   return ret;
>  }
>  
> +static int sev_launch_measure(struct kvm *kvm, struct kvm_sev_cmd *argp)
> +{
> + struct sev_data_launch_measure *data = NULL;
> + struct kvm_sev_launch_measure params;
> + void *addr = NULL;
> + int ret;
> +
> + if (!sev_guest(kvm))
> + return -ENOTTY;
> +
> + if (copy_from_user(, (void *)argp->data,
> + sizeof(struct kvm_sev_launch_measure)))
> + return -EFAULT;
> +
> + data = kzalloc(sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + if (params.address && params.length) {


Same notes as before: check userspace data and make data a stack var.

Thx.

-- 
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 
(AG Nürnberg)
-- 


[tip:core/urgent] watchdog/core: Split out cpumask write function

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  05ba3de74a3f499dcaa37b186220aaf174c95a4b
Gitweb: http://git.kernel.org/tip/05ba3de74a3f499dcaa37b186220aaf174c95a4b
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:08 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:06 +0200

watchdog/core: Split out cpumask write function

Split the write part of the cpumask proc handler out into a separate helper
to avoid deep indentation. This also reduces the patch complexity in the
following cleanups.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.218075...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 40 +---
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index a9bdfde..cedf45a 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -792,10 +792,29 @@ static int watchdog_update_cpus(void)
if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
return smpboot_update_cpumask_percpu_thread(_threads,
_cpumask);
+   __lockup_detector_cleanup();
}
return 0;
 }
 
+static void proc_watchdog_cpumask_update(void)
+{
+   /* Remove impossible cpus to keep sysctl output clean. */
+   cpumask_and(_cpumask, _cpumask, cpu_possible_mask);
+
+   if (watchdog_running) {
+   /*
+* Failure would be due to being unable to allocate a
+* temporary cpumask, so we are likely not in a position to
+* do much else to make things better.
+*/
+   if (watchdog_update_cpus() != 0)
+   pr_err("cpumask update failed\n");
+   }
+
+   watchdog_nmi_reconfigure();
+}
+
 /*
  * The cpumask is the mask of possible cpus that the watchdog can run
  * on, not the mask of cpus it is actually running on.  This allows the
@@ -811,30 +830,13 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
mutex_lock(_mutex);
 
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
-   if (!err && write) {
-   /* Remove impossible cpus to keep sysctl output cleaner. */
-   cpumask_and(_cpumask, _cpumask,
-   cpu_possible_mask);
-
-   if (watchdog_running) {
-   /*
-* Failure would be due to being unable to allocate
-* a temporary cpumask, so we are likely not in a
-* position to do much else to make things better.
-*/
-   if (watchdog_update_cpus() != 0)
-   pr_err("cpumask update failed\n");
-   }
-
-   watchdog_nmi_reconfigure();
-   __lockup_detector_cleanup();
-   }
+   if (!err && write)
+   proc_watchdog_cpumask_update();
 
mutex_unlock(_mutex);
cpu_hotplug_enable();
return err;
 }
-
 #endif /* CONFIG_SYSCTL */
 
 void __init lockup_detector_init(void)


[tip:core/urgent] watchdog/core: Clean up stub functions

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  2b9d7f233b835663cbc7b6b3f88dd20f61118d1e
Gitweb: http://git.kernel.org/tip/2b9d7f233b835663cbc7b6b3f88dd20f61118d1e
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:06 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:05 +0200

watchdog/core: Clean up stub functions

Having stub functions which take a full page is not helping the
readablility of code.

Condense them and move the doubled #ifdef variant into the SYSFS section.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.045545...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 68 ++-
 1 file changed, 22 insertions(+), 46 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index c290135..af37c04 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -125,10 +125,7 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
  * - sysctl_hardlockup_all_cpu_backtrace
  * - hardlockup_panic
  */
-void __weak watchdog_nmi_reconfigure(void)
-{
-}
-
+void __weak watchdog_nmi_reconfigure(void) { }
 
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
 
@@ -136,6 +133,11 @@ void __weak watchdog_nmi_reconfigure(void)
 #define for_each_watchdog_cpu(cpu) \
for_each_cpu_and((cpu), cpu_online_mask, _cpumask)
 
+/* Global variables, exported for sysctl */
+unsigned int __read_mostly softlockup_panic =
+   CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
+int __read_mostly soft_watchdog_enabled;
+
 static u64 __read_mostly sample_period;
 
 static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
@@ -149,13 +151,9 @@ static DEFINE_PER_CPU(struct task_struct *, 
softlockup_task_ptr_saved);
 static DEFINE_PER_CPU(unsigned long, hrtimer_interrupts_saved);
 static unsigned long soft_lockup_nmi_warn;
 
-unsigned int __read_mostly softlockup_panic =
-   CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
-
 static int __init softlockup_panic_setup(char *str)
 {
softlockup_panic = simple_strtoul(str, NULL, 0);
-
return 1;
 }
 __setup("softlockup_panic=", softlockup_panic_setup);
@@ -593,44 +591,13 @@ static void watchdog_disable_all_cpus(void)
}
 }
 
-#ifdef CONFIG_SYSCTL
-static int watchdog_update_cpus(void)
-{
-   return smpboot_update_cpumask_percpu_thread(
-   _threads, _cpumask);
-}
-#endif
-
-#else /* SOFTLOCKUP */
-static int watchdog_park_threads(void)
-{
-   return 0;
-}
-
-static void watchdog_unpark_threads(void)
-{
-}
-
-static int watchdog_enable_all_cpus(void)
-{
-   return 0;
-}
-
-static void watchdog_disable_all_cpus(void)
-{
-}
-
-#ifdef CONFIG_SYSCTL
-static int watchdog_update_cpus(void)
-{
-   return 0;
-}
-#endif
-
-static void set_sample_period(void)
-{
-}
-#endif /* SOFTLOCKUP */
+#else /* CONFIG_SOFTLOCKUP_DETECTOR */
+static inline int watchdog_park_threads(void) { return 0; }
+static inline void watchdog_unpark_threads(void) { }
+static inline int watchdog_enable_all_cpus(void) { return 0; }
+static inline void watchdog_disable_all_cpus(void) { }
+static inline void set_sample_period(void) { }
+#endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
 
 static void __lockup_detector_cleanup(void)
 {
@@ -827,6 +794,15 @@ out:
return err;
 }
 
+static int watchdog_update_cpus(void)
+{
+   if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
+   return smpboot_update_cpumask_percpu_thread(_threads,
+   _cpumask);
+   }
+   return 0;
+}
+
 /*
  * The cpumask is the mask of possible cpus that the watchdog can run
  * on, not the mask of cpus it is actually running on.  This allows the


[tip:core/urgent] watchdog/core: Clean up the #ifdef maze

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  368a7e2ce8ff0ddcdcb37eadb76530b033f6eb2d
Gitweb: http://git.kernel.org/tip/368a7e2ce8ff0ddcdcb37eadb76530b033f6eb2d
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:07 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:05 +0200

watchdog/core: Clean up the #ifdef maze

The #ifdef maze in this file is horrible, group stuff at least a bit so one
can figure out what belongs to what.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.139629...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 33 +
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index af37c04..a9bdfde 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -41,7 +41,6 @@ unsigned long __read_mostly watchdog_enabled = 
SOFT_WATCHDOG_ENABLED;
 #endif
 
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
-/* boot commands */
 /*
  * Should we panic when a soft-lockup or hard-lockup occurs:
  */
@@ -74,19 +73,21 @@ static int __init hardlockup_panic_setup(char *str)
 }
 __setup("nmi_watchdog=", hardlockup_panic_setup);
 
-#endif
+# ifdef CONFIG_SMP
+int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
 
-#ifdef CONFIG_SOFTLOCKUP_DETECTOR
-int __read_mostly soft_watchdog_enabled;
-#endif
+static int __init hardlockup_all_cpu_backtrace_setup(char *str)
+{
+   sysctl_hardlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
+   return 1;
+}
+__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
+# endif /* CONFIG_SMP */
+#endif /* CONFIG_HARDLOCKUP_DETECTOR */
 
 int __read_mostly watchdog_user_enabled;
 int __read_mostly watchdog_thresh = 10;
 
-#ifdef CONFIG_SMP
-int __read_mostly sysctl_softlockup_all_cpu_backtrace;
-int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
-#endif
 struct cpumask watchdog_cpumask __read_mostly;
 unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask);
 
@@ -173,22 +174,14 @@ static int __init nosoftlockup_setup(char *str)
 __setup("nosoftlockup", nosoftlockup_setup);
 
 #ifdef CONFIG_SMP
+int __read_mostly sysctl_softlockup_all_cpu_backtrace;
+
 static int __init softlockup_all_cpu_backtrace_setup(char *str)
 {
-   sysctl_softlockup_all_cpu_backtrace =
-   !!simple_strtol(str, NULL, 0);
+   sysctl_softlockup_all_cpu_backtrace = !!simple_strtol(str, NULL, 0);
return 1;
 }
 __setup("softlockup_all_cpu_backtrace=", softlockup_all_cpu_backtrace_setup);
-#ifdef CONFIG_HARDLOCKUP_DETECTOR
-static int __init hardlockup_all_cpu_backtrace_setup(char *str)
-{
-   sysctl_hardlockup_all_cpu_backtrace =
-   !!simple_strtol(str, NULL, 0);
-   return 1;
-}
-__setup("hardlockup_all_cpu_backtrace=", hardlockup_all_cpu_backtrace_setup);
-#endif
 #endif
 
 static void __lockup_detector_cleanup(void);


[PATCH] [media] rcar_drif: fix potential uninitialized variable use

2017-09-14 Thread Arnd Bergmann
Older compilers like gcc-4.6 may run into a case that returns
an uninitialized variable from rcar_drif_enable_rx() if that
function was ever called with an empty cur_ch_mask:

drivers/media/platform/rcar_drif.c:658:2: error: ‘ret’ may be used 
uninitialized in this function [-Werror=uninitialized]

Newer compilers don't have that problem as they optimize the
'ret' variable away and just return zero in that case.

This changes the function to return -EINVAL for this particular
failure, to make it consistent across all compiler versions.
In case gcc gets changed to report a warning for it in the
future, it's also a good idea to shut it up now.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203
Signed-off-by: Arnd Bergmann 
---
 drivers/media/platform/rcar_drif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar_drif.c 
b/drivers/media/platform/rcar_drif.c
index 522364ff0d5d..2c6afd38b78a 100644
--- a/drivers/media/platform/rcar_drif.c
+++ b/drivers/media/platform/rcar_drif.c
@@ -630,7 +630,7 @@ static int rcar_drif_enable_rx(struct rcar_drif_sdr *sdr)
 {
unsigned int i;
u32 ctr;
-   int ret;
+   int ret = -EINVAL;
 
/*
 * When both internal channels are enabled, they can be synchronized
-- 
2.9.0



[PATCH] mtd: spi-nor: stm32-quadspi: avoid unintialized return code

2017-09-14 Thread Arnd Bergmann
If we send zero-length data to stm32_qspi_tx_poll() on older
compiler versions such as gcc-4.6, we get warned that the
return code is uninitialized:

drivers/mtd/spi-nor/stm32-quadspi.c:248:2: error: ‘ret’ may be used 
uninitialized in this function [-Werror=uninitialized]

On newer compiler versions, the return code is always zero
in this case, as the local variable gets optimized away and
is assumed to be zero after the loop completes without error.

This changes the function to instead return -EINVAL if it
ever gets called with a zero length buffer.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82203
Signed-off-by: Arnd Bergmann 
---
 drivers/mtd/spi-nor/stm32-quadspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/stm32-quadspi.c 
b/drivers/mtd/spi-nor/stm32-quadspi.c
index 86c0931543c5..711cfe7aa4bf 100644
--- a/drivers/mtd/spi-nor/stm32-quadspi.c
+++ b/drivers/mtd/spi-nor/stm32-quadspi.c
@@ -227,7 +227,7 @@ static int stm32_qspi_tx_poll(struct stm32_qspi *qspi,
void (*tx_fifo)(u8 *, void __iomem *);
u32 len = cmd->len, sr;
u8 *buf = cmd->buf;
-   int ret;
+   int ret = -EINVAL;
 
if (cmd->qspimode == CCR_FMODE_INDW)
tx_fifo = stm32_qspi_write_fifo;
-- 
2.9.0



Re: [RFC Part2 PATCH v3 19/26] KVM: svm: Add support for SEV GUEST_STATUS command

2017-09-14 Thread Brijesh Singh


On 9/14/17 5:35 AM, Borislav Petkov wrote:
...

> +
>> +if (copy_from_user(, (void *) argp->data,
>> +sizeof(struct kvm_sev_guest_status)))
> Let me try to understand what's going on here. You copy user data into
> params...

This is wrong -- since all the parameters in GET_STATUS is "OUT" hence
we don't need to perform copy_from_user. I will fix it. thanks

>
>> +return -EFAULT;
>> +
>> +data = kzalloc(sizeof(*data), GFP_KERNEL);
>> +if (!data)
>> +return -ENOMEM;
>> +
>> +data->handle = sev_get_handle(kvm);
>> +ret = sev_issue_cmd(kvm, SEV_CMD_GUEST_STATUS, data, >error);
>> +if (ret)
>> +goto e_free;
>> +
>> +params.policy = data->policy;
>> +params.state = data->state;
>> +params.handle = data->handle;
> ... *overwrite* the copied data which means, the copy meant *absolutely*
> *nothing* at all! ...
>
> Also, why does userspace need to know the firmware ->handle?


SEV firmware supports key-sharing, if guest policy allows sharing the
key between VMs then we need the firmware->handle. If key-sharing
feature is used then firmware->handle of the 1st VM will be passed into
the LAUNCH_START of  2nd VM.  I still have not coded up anything in qemu
for key-sharing and also I am using GET_STATUS command in qemu yet. But
wanted to make sure that if we decide to add "info sev-status" command
in qemu-monitor to retrieve the SEV state information and then all the
information is available to us.






BUG: Sporadic crashes with current Linus tree

2017-09-14 Thread Thomas Gleixner
Hi!

I've seen the following crash sporadically with commit 46c1e79fee:

Have not seen that with 3882a734c19b, though I saw the PCID warnings on
that machine.

I have no idea how to reproduce so bisecting is pretty much pointless. Any
idea what to do?

Thanks,

tglx


BUG: unable to handle kernel paging request at ffd8
IP: __memmove+0x24/0x1a0
PGD 1e17c0c067 P4D 1e17c0c067 PUD 1e17c0e067 PMD 0
Oops: 0002 [#1] SMP
CPU: 43 PID: 1958 Comm: rsyslogd Tainted: GW   4.13.0+ #184
task: 9eb5e8780080 task.stack: b648a08cc000
RIP: 0010:__memmove+0x24/0x1a0
RSP: 0018:b648a08cfef0 EFLAGS: 00252097
RAX: ffd8 RBX: ff50 RCX: 0028
RDX: 0028 RSI: b648a08cffd8 RDI: ffd8
RBP: b648a08cff10 R08: b648a08d R09: 
R10:  R11: 0293 R12: 
R13: b648a08cff20 R14: 7fffef2ed9a8 R15: 
FS:  7f05281eff80() GS:9eb5ff5c() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: ffd8 CR3: 00302857c002 CR4: 001606e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
? fixup_bad_iret+0x3c/0x60
  error_entry+0xb4/0xc0
? general_protection+0xc/0x30
Code: 90 90 90 90 90 90 90 48 89 f8 48 83 fa 20 0f 82 03 01 00 00 48 39 fe 7d 
0f 49 89 f0 49 01 d0 49 39 f8 0f 8f 9f 00 00 00 48 89 d1  a4 c3 48 81 fa a8 
02 00 00 72 05 40 38 fe 74 3b 48 83 ea 20
RIP: __memmove+0x24/0x1a0 RSP: b648a08cfef0
CR2: ffd8
[ end trace 72d77f3e20344f94 ]---



Re: [PATCH v2 RESEND 1/2] x86/UV: Introduce a helper function to check UV system at earlier stage

2017-09-14 Thread Dave Young
On 09/14/17 at 03:29pm, Baoquan He wrote:
> Add Dave to the CC list, he may have concerns about the code change.

Baoquan, thanks for cc me

> 
> On 09/07/17 at 03:42pm, Baoquan He wrote:
> > The BIOS on SGI UV system will report a UV system table which describes
> > specific firmware capabilities available to the Linux kernel at runtime.
> > This UV system table only exists on SGI UV system. And it's detected
> > in efi_init() which is at very early stage.
> > 
> > So introduce a new helper function is_early_uv_system() to identify if
> > a system is UV system. Later we will use it to check if the running
> > system is UV system in mm KASLR code.
> > 
> > Signed-off-by: Baoquan He 
> > Acked-by: Mike Travis 
> > ---
> >  arch/x86/include/asm/uv/uv.h | 6 ++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
> > index b5a32231abd8..93d7ad8763ba 100644
> > --- a/arch/x86/include/asm/uv/uv.h
> > +++ b/arch/x86/include/asm/uv/uv.h
> > @@ -18,6 +18,11 @@ extern void uv_nmi_init(void);
> >  extern void uv_system_init(void);
> >  extern const struct cpumask *uv_flush_tlb_others(const struct cpumask 
> > *cpumask,
> >  const struct flush_tlb_info 
> > *info);
> > +#include 
> > +static inline int is_early_uv_system(void)
> > +{
> > +   return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab);
> > +}


Sorry for jumping in late, I have two questions about the patch:

1) For efi tables, the only invalid value is EFI_INVALID_TABLE_ADDR, and
efi struct is initialized as EFI_INVALID_TABLE_ADDR by default so no
need to check "|| !efi.uv_systab". Do we have any UV firmware specific
assumption that "0" is also possible to be assigned?

2) It seems adding this function in uv.h for separating this for uv
system only purpose. But I feel it is better to put it in efi.h instead.

uv_systab is already a member of struct efi, it is in efi.h so it is
natural to check the table exist or not. Then just include efi.h in
kaslr.c and use the function.

something like drivers/firmware/efi/esrt.c: esrt_table_exists()

Anyway I have no strong opinon, it looks more natural to me though.

> >  
> >  #else  /* X86_UV */
> >  
> > @@ -30,6 +35,7 @@ static inline const struct cpumask *
> >  uv_flush_tlb_others(const struct cpumask *cpumask,
> > const struct flush_tlb_info *info)
> >  { return cpumask; }
> > +static inline int is_early_uv_system(void) { return 0; }
> >  
> >  #endif /* X86_UV */
> >  
> > -- 
> > 2.5.5
> > 

Thanks
Dave


Re: [PATCH v3 04/20] mm: VMA sequence count

2017-09-14 Thread Sergey Senozhatsky
On (09/14/17 10:58), Laurent Dufour wrote:
[..]
> That's right, but here this is the  sequence counter mm->mm_seq, not the
> vm_seq one.

d'oh... you are right.

-ss


Re: [RFC PATCH 1/2] autofs: set compat flag on sbi when daemon uses 32bit addressation

2017-09-14 Thread Stanislav Kinsburskiy


14.09.2017 02:38, Ian Kent пишет:
> On 01/09/17 19:21, Stanislav Kinsburskiy wrote:
>> Signed-off-by: Stanislav Kinsburskiy 
>> ---
>>  fs/autofs4/autofs_i.h  |3 +++
>>  fs/autofs4/dev-ioctl.c |3 +++
>>  fs/autofs4/inode.c |4 +++-
>>  3 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
>> index 4737615..3da105f 100644
>> --- a/fs/autofs4/autofs_i.h
>> +++ b/fs/autofs4/autofs_i.h
>> @@ -120,6 +120,9 @@ struct autofs_sb_info {
>>  struct list_head active_list;
>>  struct list_head expiring_list;
>>  struct rcu_head rcu;
>> +#ifdef CONFIG_COMPAT
>> +unsigned is32bit:1;
>> +#endif
>>  };
>>  
>>  static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
>> diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
>> index b7c816f..467d6c4 100644
>> --- a/fs/autofs4/dev-ioctl.c
>> +++ b/fs/autofs4/dev-ioctl.c
>> @@ -397,6 +397,9 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
>>  sbi->pipefd = pipefd;
>>  sbi->pipe = pipe;
>>  sbi->catatonic = 0;
>> +#ifdef CONFIG_COMPAT
>> +sbi->is32bit = is_compat_task();
>> +#endif
>>  }
>>  out:
>>  put_pid(new_pid);
>> diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
>> index 09e7d68..21d3c0b 100644
>> --- a/fs/autofs4/inode.c
>> +++ b/fs/autofs4/inode.c
>> @@ -301,7 +301,9 @@ int autofs4_fill_super(struct super_block *s, void 
>> *data, int silent)
>>  } else {
>>  sbi->oz_pgrp = get_task_pid(current, PIDTYPE_PGID);
>>  }
>> -
>> +#ifdef CONFIG_COMPAT
>> +sbi->is32bit = is_compat_task();
>> +#endif
>>  if (autofs_type_trigger(sbi->type))
>>  __managed_dentry_set_managed(root);
>>  
>>
> 
> Not sure about this.
> 
> Don't you think it would be better to avoid the in code #ifdefs by doing some
> checks and defines in the header file and defining what's need to just use
> is_compat_task().
> 

Yes, might be...

> Not sure 2 patches are needed for this either ..
> 

Well, I found this issue occasionally.
And, frankly speaking, it's not clear to me, whether this issue is important at 
all, so I wanted to clarify this first.
Thanks to O_DIRECT, the only way to catch the issue is to try to read more, 
than expected, in compat task (that's how I found it).
I don't see any other flaw so far. And if so, that, probably, we shouldn't care 
about the issue at all.
What do you think?


> Ian
> 


 


[PATCH] fs/proc: report eip/esp in /prod/PID/stat for coredumping

2017-09-14 Thread John Ogness
Commit 0a1eb2d474ed ("fs/proc: Stop reporting eip and esp in
/proc/PID/stat") stopped reporting eip/esp because it is
racey and dangerous for executing tasks. The comment adds:

As far as I know, there are no use programs that make any
material use of these fields, so just get rid of them.

However, existing userspace core-dump-handler applications (for
example, minicoredumper) are using these fields since they
provide an excellent cross-platform interface to these valuable
pointers. So that commit introduced a user space visible
regression.

Partially revert the change and make the readout possible for
tasks with the proper permissions and only if the target task
has the PF_DUMPCORE flag set.

Reported-by: Marco Felsch 
Signed-off-by: John Ogness 
Cc: sta...@vger.kernel.org
Fixes: 0a1eb2d474ed ("fs/proc: Stop reporting eip and esp in> /proc/PID/stat")
---
 fs/proc/array.c |8 
 1 file changed, 8 insertions(+)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 88c3555..696cc68 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -421,7 +421,15 @@ static int do_task_stat(struct seq_file *m, struct 
pid_namespace *ns,
 * esp and eip are intentionally zeroed out.  There is no
 * non-racy way to read them without freezing the task.
 * Programs that need reliable values can use ptrace(2).
+*
+* The only exception is if the task is core dumping because
+* a program is not able to use ptrace(2) in that case. It is
+* safe because the task has stopped executing permanently.
 */
+   if (permitted && (task->flags & PF_DUMPCORE)) {
+   eip = KSTK_EIP(task);
+   esp = KSTK_ESP(task);
+   }
}
 
get_task_comm(tcomm, task);
-- 
1.7.10.4


Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support

2017-09-14 Thread Quan Xu



On 2017/9/14 17:19, Wanpeng Li wrote:

2017-09-14 16:36 GMT+08:00 Quan Xu :


on 2017/9/13 19:56, Yang Zhang wrote:

On 2017/8/29 22:56, Michael S. Tsirkin wrote:

On Tue, Aug 29, 2017 at 11:46:34AM +, Yang Zhang wrote:

Some latency-intensive workload will see obviously performance
drop when running inside VM.


But are we trading a lot of CPU for a bit of lower latency?


The main reason is that the overhead
is amplified when running inside VM. The most cost i have seen is
inside idle path.

This patch introduces a new mechanism to poll for a while before
entering idle state. If schedule is needed during poll, then we
don't need to goes through the heavy overhead path.


Isn't it the job of an idle driver to find the best way to
halt the CPU?

It looks like just by adding a cstate we can make it
halt at higher latencies only. And at lower latencies,
if it's doing a good job we can hopefully use mwait to
stop the CPU.

In fact I have been experimenting with exactly that.
Some initial results are encouraging but I could use help
with testing and especially tuning. If you can help
pls let me know!


Quan, Can you help to test it and give result? Thanks.


Hi, MST

I have tested the patch "intel_idle: add pv cstates when running on kvm"  on
a recent host that allows guests
to execute mwait without an exit. also I have tested our patch "[RFC PATCH
v2 0/7] x86/idle: add halt poll support",
upstream linux, and  idle=poll.

the following is the result (which seems better than ever berfore, as I ran
test case on a more powerful machine):

for __netperf__,  the first column is trans. rate per sec, the second column
is CPU utilzation.

1. upstream linux

This "upstream linux" means that disables the kvm adaptive
halt-polling after confirm with Xu Quan.



upstream linux -- the source code is just from upstream linux, without 
our patch or MST's patch..
yes, we disable kvm halt-polling(halt_poll_ns=0) for _all_of_ following 
cases.


Quan



Regards,
Wanpeng Li


   28371.7 bits/s -- 76.6 %CPU

2. idle=poll

   34372 bit/s -- 999.3 %CPU

3. "[RFC PATCH v2 0/7] x86/idle: add halt poll support",  with different
values of parameter 'halt_poll_threshold':

   28362.7 bits/s -- 74.7  %CPU (halt_poll_threshold=1)
   32949.5 bits/s -- 82.5  %CPU (halt_poll_threshold=2)
   39717.9 bits/s -- 104.1 %CPU (halt_poll_threshold=3)
   40137.9 bits/s -- 104.4 %CPU (halt_poll_threshold=4)
   40079.8 bits/s -- 105.6 %CPU (halt_poll_threshold=5)


4. "intel_idle: add pv cstates when running on kvm"

   33041.8 bits/s  -- 999.4 %CPU





for __ctxsw__, the first column is the time per process context switches,
the second column is CPU utilzation..

1. upstream linux

   3624.19 ns/ctxsw -- 191.9 %CPU

2. idle=poll

   3419.66 ns/ctxsw -- 999.2 %CPU

3. "[RFC PATCH v2 0/7] x86/idle: add halt poll support", with different
values of parameter 'halt_poll_threshold':

   1123.40 ns/ctxsw -- 199.6 %CPU (halt_poll_threshold=1)
   1127.38 ns/ctxsw -- 199.7 %CPU (halt_poll_threshold=2)
   1113.58 ns/ctxsw -- 199.6 %CPU (halt_poll_threshold=3)
   1117.12 ns/ctxsw -- 199.6 %CPU (halt_poll_threshold=4)
   1121.62 ns/ctxsw -- 199.6 %CPU (halt_poll_threshold=5)

  4.  "intel_idle: add pv cstates when running on kvm"

   3427.59 ns/ctxsw -- 999.4 %CPU

-Quan




答复: [PATCH] mfd: rtsx: Add support for RTS5260

2017-09-14 Thread 冯锐
On Fri, 08 Sep 2017, rui_f...@realsil.com.cn wrote:

> From: rui_feng 
> 
> Add support for new chip rts5260.

You are adding over 600 lines in this patch.  It desearves a more forthcoming 
commit message.

What is it?
What functionality does it provide?
What other subsystems are involved?
Could it break something else?
Does it have any dependencies?
Etc etc.

> Signed-off-by: Rui Feng 
> ---
>  drivers/mfd/Makefile |   2 +-
>  drivers/mfd/rts5260.c| 543 
> +++
>  drivers/mfd/rtsx_pcr.c   |   8 +
>  drivers/mfd/rtsx_pcr.h   |   1 +
>  include/linux/mfd/rtsx_pci.h |  81 ++-
>  5 files changed, 631 insertions(+), 4 deletions(-)  create mode 
> 100644 drivers/mfd/rts5260.c
> 
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 
> 080793b..d0f06a3 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -17,7 +17,7 @@ obj-$(CONFIG_MFD_CROS_EC_I2C)   += cros_ec_i2c.o
>  obj-$(CONFIG_MFD_CROS_EC_SPI)+= cros_ec_spi.o
>  obj-$(CONFIG_MFD_EXYNOS_LPASS)   += exynos-lpass.o
>  
> -rtsx_pci-objs:= rtsx_pcr.o rts5209.o rts5229.o 
> rtl8411.o rts5227.o rts5249.o
> +rtsx_pci-objs:= rtsx_pcr.o rts5209.o rts5229.o 
> rtl8411.o rts5227.o rts5249.o rts5260.o
>  obj-$(CONFIG_MFD_RTSX_PCI)   += rtsx_pci.o
>  obj-$(CONFIG_MFD_RTSX_USB)   += rtsx_usb.o
>  
> diff --git a/drivers/mfd/rts5260.c b/drivers/mfd/rts5260.c new file 
> mode 100644 index 000..53f2838
> --- /dev/null
> +++ b/drivers/mfd/rts5260.c

There is way too much code in this file to be an MFD driver.

It's a card reader driver (as stated below).

I think this entire file needs relocating somewhere else.

Many other drivers, such as rts5209, rts5227, rts5229, rts5249 and so on, are 
in the same place.
If I put rts5260 somewhere else, other drivers should also be relocated, this 
will lead to a much bigger modification.
So I think put rts5260.c here is better suited.

> @@ -0,0 +1,543 @@
> +/* Driver for Realtek PCI-Express card reader
> + *
> + * Copyright(c) 2016-2017 Realtek Semiconductor Corp. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2, or (at your option) any
> + * later version.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + *
> + * Author:
> + *   Steven FENG 
> + *   Rui FENG 
> + *   Wei WANG 
> + */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

--Please consider the environment before printing this e-mail.


Re: [PATCH v4 11/18] fpga: region: add fpga-region.h header

2017-09-14 Thread Wu Hao
On Thu, Sep 14, 2017 at 04:48:34AM +0800, Alan Tull wrote:
> * Create fpga-region.h.
> * Export fpga_region_program_fpga.
> * Move struct fpga_region and other things to the header.
> 
> This is a step in separating FPGA region common code
> from Device Tree support.
> 
> Signed-off-by: Alan Tull 
> ---
> v2: split out from another patch
> update author email
> v3: changes due to fpga_region_program_fpga() removed info param
> v4: no change to this patch in this version of patchset
> ---
>  drivers/fpga/fpga-region.c   | 24 
>  include/linux/fpga/fpga-region.h | 28 
>  2 files changed, 32 insertions(+), 20 deletions(-)
>  create mode 100644 include/linux/fpga/fpga-region.h
> 
> diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
> index 2a8621d..402d0b6 100644
> --- a/drivers/fpga/fpga-region.c
> +++ b/drivers/fpga/fpga-region.c
> @@ -18,6 +18,7 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -26,24 +27,6 @@
>  #include 
>  #include 
>  
> -/**
> - * struct fpga_region - FPGA Region structure
> - * @dev: FPGA Region device
> - * @mutex: enforces exclusive reference to region
> - * @bridge_list: list of FPGA bridges specified in region
> - * @mgr: FPGA manager
> - * @info: fpga image specific information
> - */
> -struct fpga_region {
> - struct device dev;
> - struct mutex mutex; /* for exclusive reference to region */
> - struct list_head bridge_list;
> - struct fpga_manager *mgr;
> - struct fpga_image_info *info;
> -};
> -
> -#define to_fpga_region(d) container_of(d, struct fpga_region, dev)
> -
>  static DEFINE_IDA(fpga_region_ida);
>  static struct class *fpga_region_class;
>  
> @@ -226,7 +209,7 @@ static int fpga_region_get_bridges(struct fpga_region 
> *region,
>   * Program an FPGA using fpga image info (region->info).
>   * Return 0 for success or negative error code.
>   */
> -static int fpga_region_program_fpga(struct fpga_region *region)
> +int fpga_region_program_fpga(struct fpga_region *region)
>  {
>   struct device *dev = >dev;
>   struct fpga_image_info *info = region->info;
> @@ -282,6 +265,7 @@ static int fpga_region_program_fpga(struct fpga_region 
> *region)
>  
>   return ret;
>  }
> +EXPORT_SYMBOL_GPL(fpga_region_program_fpga);
>  
>  /**
>   * child_regions_with_firmware
> @@ -667,5 +651,5 @@ subsys_initcall(fpga_region_init);
>  module_exit(fpga_region_exit);
>  
>  MODULE_DESCRIPTION("FPGA Region");
> -MODULE_AUTHOR("Alan Tull ");
> +MODULE_AUTHOR("Alan Tull ");
>  MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/fpga/fpga-region.h 
> b/include/linux/fpga/fpga-region.h
> new file mode 100644
> index 000..f84a2e1
> --- /dev/null
> +++ b/include/linux/fpga/fpga-region.h
> @@ -0,0 +1,28 @@
> +#include 
> +#include 
> +#include 
> +
> +#ifndef _FPGA_REGION_H
> +#define _FPGA_REGION_H

Hi Alan

I think it may be better to move #ifndef check to the beginning of this
header files (before include other header files). :)

Thanks
Hao

> +
> +/**
> + * struct fpga_region - FPGA Region structure
> + * @dev: FPGA Region device
> + * @mutex: enforces exclusive reference to region
> + * @bridge_list: list of FPGA bridges specified in region
> + * @mgr: FPGA manager
> + * @info: FPGA image info
> + */
> +struct fpga_region {
> + struct device dev;
> + struct mutex mutex; /* for exclusive reference to region */
> + struct list_head bridge_list;
> + struct fpga_manager *mgr;
> + struct fpga_image_info *info;
> +};
> +
> +#define to_fpga_region(d) container_of(d, struct fpga_region, dev)
> +
> +int fpga_region_program_fpga(struct fpga_region *region);
> +
> +#endif /* _FPGA_REGION_H */
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] [media] ttusb_dec: Fine-tuning for some function implementations

2017-09-14 Thread SF Markus Elfring
From: Markus Elfring 
Date: Thu, 14 Sep 2017 12:26:24 +0200

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (8):
  Use common error handling code in ttusb_dec_init_dvb()
  Adjust five checks for null pointers
  Improve a size determination in three functions
  Delete an error message for a failed memory allocation in ttusb_dec_probe()
  Move an assignment in ttusb_dec_probe()
  Reduce the scope for three variables in ttusb_dec_process_urb()
  Add spaces for better code readability
  Delete four unwanted spaces

 drivers/media/usb/ttusb-dec/ttusb_dec.c | 175 ++--
 1 file changed, 79 insertions(+), 96 deletions(-)

-- 
2.14.1



[PATCH 5/5] lightnvm: pblk: remove checks on mempool alloc.

2017-09-14 Thread Javier González
As part of the mempool audit on pblk, remove unnecessary mempool
allocation checks on mempools.

Reported-by: Jens Axboe 
Signed-off-by: Javier González 
---
 drivers/lightnvm/pblk-core.c |  4 
 drivers/lightnvm/pblk-read.c |  8 
 drivers/lightnvm/pblk-recovery.c | 35 +++
 drivers/lightnvm/pblk-write.c| 24 +---
 4 files changed, 12 insertions(+), 59 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index bb53fe416d4e..3004e9252a11 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -206,8 +206,6 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, 
gfp_t flags,
 
for (i = 0; i < nr_pages; i++) {
page = mempool_alloc(pblk->page_bio_pool, flags);
-   if (!page)
-   goto err;
 
ret = bio_add_pc_page(q, bio, page, PBLK_EXPOSED_PAGE_SIZE, 0);
if (ret != PBLK_EXPOSED_PAGE_SIZE) {
@@ -1653,8 +1651,6 @@ void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line 
*line, void *priv,
struct pblk_line_ws *line_ws;
 
line_ws = mempool_alloc(pblk->gen_ws_pool, gfp_mask);
-   if (!line_ws)
-   return;
 
line_ws->pblk = pblk;
line_ws->line = line;
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 402c732f0970..d2b6e2a7d7d5 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -168,10 +168,6 @@ static int pblk_fill_partial_read_bio(struct pblk *pblk, 
struct nvm_rq *rqd,
DECLARE_COMPLETION_ONSTACK(wait);
 
new_bio = bio_alloc(GFP_KERNEL, nr_holes);
-   if (!new_bio) {
-   pr_err("pblk: could not alloc read bio\n");
-   return NVM_IO_ERR;
-   }
 
if (pblk_bio_add_pages(pblk, new_bio, GFP_KERNEL, nr_holes))
goto err;
@@ -321,10 +317,6 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
bitmap_zero(_bitmap, nr_secs);
 
rqd = pblk_alloc_rqd(pblk, READ);
-   if (IS_ERR(rqd)) {
-   pr_err_ratelimited("pblk: not able to alloc rqd");
-   return NVM_IO_ERR;
-   }
 
rqd->opcode = NVM_OP_PREAD;
rqd->bio = bio;
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 10eef9281a27..573085bdb7e5 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -34,10 +34,6 @@ void pblk_submit_rec(struct work_struct *work)
max_secs);
 
bio = bio_alloc(GFP_KERNEL, nr_rec_secs);
-   if (!bio) {
-   pr_err("pblk: not able to create recovery bio\n");
-   return;
-   }
 
bio->bi_iter.bi_sector = 0;
bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
@@ -85,11 +81,6 @@ int pblk_recov_setup_rq(struct pblk *pblk, struct pblk_c_ctx 
*c_ctx,
int nr_entries = c_ctx->nr_valid + c_ctx->nr_padded;
 
rec_rqd = pblk_alloc_rqd(pblk, WRITE);
-   if (IS_ERR(rec_rqd)) {
-   pr_err("pblk: could not create recovery req.\n");
-   return -ENOMEM;
-   }
-
rec_ctx = nvm_rq_to_pdu(rec_rqd);
 
/* Copy completion bitmap, but exclude the first X completed entries */
@@ -404,22 +395,18 @@ static int pblk_recov_pad_oob(struct pblk *pblk, struct 
pblk_line *line,
ppa_list = (void *)(meta_list) + pblk_dma_meta_size;
dma_ppa_list = dma_meta_list + pblk_dma_meta_size;
 
-   rqd = pblk_alloc_rqd(pblk, WRITE);
-   if (IS_ERR(rqd)) {
-   ret = PTR_ERR(rqd);
-   goto fail_free_meta;
-   }
-
bio = pblk_bio_map_addr(pblk, data, rq_ppas, rq_len,
PBLK_VMALLOC_META, GFP_KERNEL);
if (IS_ERR(bio)) {
ret = PTR_ERR(bio);
-   goto fail_free_rqd;
+   goto fail_free_meta;
}
 
bio->bi_iter.bi_sector = 0; /* internal bio */
bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
 
+   rqd = pblk_alloc_rqd(pblk, WRITE);
+
rqd->bio = bio;
rqd->opcode = NVM_OP_PWRITE;
rqd->flags = pblk_set_progr_mode(pblk, WRITE);
@@ -490,8 +477,6 @@ static int pblk_recov_pad_oob(struct pblk *pblk, struct 
pblk_line *line,
 
 fail_free_bio:
bio_put(bio);
-fail_free_rqd:
-   pblk_free_rqd(pblk, rqd, WRITE);
 fail_free_meta:
nvm_dev_dma_free(dev->parent, meta_list, dma_meta_list);
 fail_free_pad:
@@ -785,15 +770,9 @@ static int pblk_recov_l2p_from_oob(struct pblk *pblk, 
struct pblk_line *line)
dma_addr_t dma_ppa_list, dma_meta_list;
int done, ret = 0;
 
-   rqd = pblk_alloc_rqd(pblk, READ);
-   if (IS_ERR(rqd))
-   return PTR_ERR(rqd);
-
meta_list = nvm_dev_dma_alloc(dev->parent, GFP_KERNEL, _meta_list);
-   if (!meta_list) 

[PATCH 3/5] lightnvm: pblk: decouple read/erase mempools

2017-09-14 Thread Javier González
Since read and erase paths offer different guarantees for inflight I/Os,
separate the mempools to set the right min_nr for each on creation.

Reported-by: Jens Axboe 
Signed-off-by: Javier González 
---
 drivers/lightnvm/pblk-core.c | 12 
 drivers/lightnvm/pblk-init.c | 22 +++---
 drivers/lightnvm/pblk.h  |  5 +++--
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index b7a6b223b1a5..9e35ec7c1d9f 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -64,7 +64,7 @@ static void pblk_end_io_erase(struct nvm_rq *rqd)
struct pblk *pblk = rqd->private;
 
__pblk_end_io_erase(pblk, rqd);
-   mempool_free(rqd, pblk->g_rq_pool);
+   mempool_free(rqd, pblk->e_rq_pool);
 }
 
 void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line,
@@ -161,13 +161,11 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int rw)
pool = pblk->w_rq_pool;
rq_size = pblk_w_rq_size;
} else {
-   pool = pblk->g_rq_pool;
+   pool = pblk->r_rq_pool;
rq_size = pblk_g_rq_size;
}
 
rqd = mempool_alloc(pool, GFP_KERNEL);
-   if (!rqd)
-   return NULL;
memset(rqd, 0, rq_size);
 
return rqd;
@@ -180,7 +178,7 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, 
int rw)
if (rw == WRITE)
pool = pblk->w_rq_pool;
else
-   pool = pblk->g_rq_pool;
+   pool = pblk->r_rq_pool;
 
mempool_free(rqd, pool);
 }
@@ -1479,9 +1477,7 @@ int pblk_blk_erase_async(struct pblk *pblk, struct 
ppa_addr ppa)
struct nvm_rq *rqd;
int err;
 
-   rqd = mempool_alloc(pblk->g_rq_pool, GFP_KERNEL);
-   if (!rqd)
-   return -ENOMEM;
+   rqd = mempool_alloc(pblk->e_rq_pool, GFP_KERNEL);
memset(rqd, 0, pblk_g_rq_size);
 
pblk_setup_e_rq(pblk, rqd, ppa);
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 0c65abb96dc6..5f8a9fd2f29a 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -261,15 +261,20 @@ static int pblk_core_init(struct pblk *pblk)
if (!pblk->rec_pool)
goto free_gen_ws_pool;
 
-   pblk->g_rq_pool = mempool_create_slab_pool(PBLK_READ_REQ_POOL_SIZE,
+   pblk->r_rq_pool = mempool_create_slab_pool(geo->nr_luns,
pblk_g_rq_cache);
-   if (!pblk->g_rq_pool)
+   if (!pblk->r_rq_pool)
goto free_rec_pool;
 
-   pblk->w_rq_pool = mempool_create_slab_pool(geo->nr_luns * 2,
+   pblk->e_rq_pool = mempool_create_slab_pool(geo->nr_luns,
+   pblk_g_rq_cache);
+   if (!pblk->e_rq_pool)
+   goto free_r_rq_pool;
+
+   pblk->w_rq_pool = mempool_create_slab_pool(geo->nr_luns,
pblk_w_rq_cache);
if (!pblk->w_rq_pool)
-   goto free_g_rq_pool;
+   goto free_e_rq_pool;
 
pblk->line_meta_pool =
mempool_create_slab_pool(PBLK_META_POOL_SIZE,
@@ -304,8 +309,10 @@ static int pblk_core_init(struct pblk *pblk)
mempool_destroy(pblk->line_meta_pool);
 free_w_rq_pool:
mempool_destroy(pblk->w_rq_pool);
-free_g_rq_pool:
-   mempool_destroy(pblk->g_rq_pool);
+free_e_rq_pool:
+   mempool_destroy(pblk->e_rq_pool);
+free_r_rq_pool:
+   mempool_destroy(pblk->r_rq_pool);
 free_rec_pool:
mempool_destroy(pblk->rec_pool);
 free_gen_ws_pool:
@@ -326,7 +333,8 @@ static void pblk_core_free(struct pblk *pblk)
mempool_destroy(pblk->page_bio_pool);
mempool_destroy(pblk->gen_ws_pool);
mempool_destroy(pblk->rec_pool);
-   mempool_destroy(pblk->g_rq_pool);
+   mempool_destroy(pblk->r_rq_pool);
+   mempool_destroy(pblk->e_rq_pool);
mempool_destroy(pblk->w_rq_pool);
mempool_destroy(pblk->line_meta_pool);
 
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index dee8f66e6ce2..0120e0ade703 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -41,7 +41,6 @@
 #define PBLK_MAX_REQ_ADDRS_PW (6)
 
 #define PBLK_META_POOL_SIZE (128)
-#define PBLK_READ_REQ_POOL_SIZE (1024)
 
 #define PBLK_NR_CLOSE_JOBS (4)
 
@@ -60,6 +59,7 @@
 
 #define ERASE 2 /* READ = 0, WRITE = 1 */
 
+/* Static pool sizes */
 #define PBLK_GEN_WS_POOL_SIZE (2)
 
 enum {
@@ -623,8 +623,9 @@ struct pblk {
mempool_t *page_bio_pool;
mempool_t *gen_ws_pool;
mempool_t *rec_pool;
-   mempool_t *g_rq_pool;
+   mempool_t *r_rq_pool;
mempool_t *w_rq_pool;
+   mempool_t *e_rq_pool;
mempool_t *line_meta_pool;
 
struct workqueue_struct *close_wq;
-- 
2.7.4



[PATCH 4/5] lightnvm: pblk: do not use a mempool for line bitmaps

2017-09-14 Thread Javier González
pblk holds two sector bitmaps: one to keep track of the mapped sectors
while the line is active and another one to keep track of the invalid
sectors. The latter is kept during the whole live of the line, until it
is recycled. Since we cannot guarantee forward progress for the mempool
in this case, get rid of the mempool and simply allocate memory through
kmalloc.

Reported-by: Jens Axboe 
Signed-off-by: Javier González 
---
 drivers/lightnvm/pblk-core.c | 26 ++
 drivers/lightnvm/pblk-init.c | 29 ++---
 drivers/lightnvm/pblk-recovery.c |  2 +-
 drivers/lightnvm/pblk-write.c|  4 +---
 drivers/lightnvm/pblk.h  |  3 ---
 5 files changed, 14 insertions(+), 50 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 9e35ec7c1d9f..bb53fe416d4e 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1093,25 +1093,21 @@ static int pblk_line_prepare(struct pblk *pblk, struct 
pblk_line *line)
struct pblk_line_meta *lm = >lm;
int blk_in_line = atomic_read(>blk_in_line);
 
-   line->map_bitmap = mempool_alloc(pblk->line_meta_pool, GFP_ATOMIC);
+   line->map_bitmap = kzalloc(lm->sec_bitmap_len, GFP_ATOMIC);
if (!line->map_bitmap)
return -ENOMEM;
-   memset(line->map_bitmap, 0, lm->sec_bitmap_len);
 
-   /* invalid_bitmap is special since it is used when line is closed. No
-* need to zeroized; it will be initialized using bb info form
-* map_bitmap
-*/
-   line->invalid_bitmap = mempool_alloc(pblk->line_meta_pool, GFP_ATOMIC);
+   /* will be initialized using bb info from map_bitmap */
+   line->invalid_bitmap = kmalloc(lm->sec_bitmap_len, GFP_ATOMIC);
if (!line->invalid_bitmap) {
-   mempool_free(line->map_bitmap, pblk->line_meta_pool);
+   kfree(line->map_bitmap);
return -ENOMEM;
}
 
spin_lock(>lock);
if (line->state != PBLK_LINESTATE_FREE) {
-   mempool_free(line->invalid_bitmap, pblk->line_meta_pool);
-   mempool_free(line->map_bitmap, pblk->line_meta_pool);
+   kfree(line->map_bitmap);
+   kfree(line->invalid_bitmap);
spin_unlock(>lock);
WARN(1, "pblk: corrupted line %d, state %d\n",
line->id, line->state);
@@ -1163,7 +1159,7 @@ int pblk_line_recov_alloc(struct pblk *pblk, struct 
pblk_line *line)
 
 void pblk_line_recov_close(struct pblk *pblk, struct pblk_line *line)
 {
-   mempool_free(line->map_bitmap, pblk->line_meta_pool);
+   kfree(line->map_bitmap);
line->map_bitmap = NULL;
line->smeta = NULL;
line->emeta = NULL;
@@ -1438,10 +1434,8 @@ void pblk_line_replace_data(struct pblk *pblk)
 
 void pblk_line_free(struct pblk *pblk, struct pblk_line *line)
 {
-   if (line->map_bitmap)
-   mempool_free(line->map_bitmap, pblk->line_meta_pool);
-   if (line->invalid_bitmap)
-   mempool_free(line->invalid_bitmap, pblk->line_meta_pool);
+   kfree(line->map_bitmap);
+   kfree(line->invalid_bitmap);
 
*line->vsc = cpu_to_le32(EMPTY_ENTRY);
 
@@ -1582,7 +1576,7 @@ void pblk_line_close(struct pblk *pblk, struct pblk_line 
*line)
 
list_add_tail(>list, move_list);
 
-   mempool_free(line->map_bitmap, pblk->line_meta_pool);
+   kfree(line->map_bitmap);
line->map_bitmap = NULL;
line->smeta = NULL;
line->emeta = NULL;
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 5f8a9fd2f29a..df86cf98ef4d 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -21,7 +21,7 @@
 #include "pblk.h"
 
 static struct kmem_cache *pblk_ws_cache, *pblk_rec_cache, *pblk_g_rq_cache,
-   *pblk_w_rq_cache, *pblk_line_meta_cache;
+   *pblk_w_rq_cache;
 static DECLARE_RWSEM(pblk_lock);
 struct bio_set *pblk_bio_set;
 
@@ -181,8 +181,6 @@ static int pblk_set_ppaf(struct pblk *pblk)
 
 static int pblk_init_global_caches(struct pblk *pblk)
 {
-   char cache_name[PBLK_CACHE_NAME_LEN];
-
down_write(_lock);
pblk_ws_cache = kmem_cache_create("pblk_blk_ws",
sizeof(struct pblk_line_ws), 0, 0, NULL);
@@ -217,19 +215,6 @@ static int pblk_init_global_caches(struct pblk *pblk)
up_write(_lock);
return -ENOMEM;
}
-
-   snprintf(cache_name, sizeof(cache_name), "pblk_line_m_%s",
-   pblk->disk->disk_name);
-   pblk_line_meta_cache = kmem_cache_create(cache_name,
-   pblk->lm.sec_bitmap_len, 0, 0, NULL);
-   if (!pblk_line_meta_cache) {
-   kmem_cache_destroy(pblk_ws_cache);
-   

[PATCH] libata: Add new med_power_with_dipm link_power_management_policy setting

2017-09-14 Thread Hans de Goede
As described by Matthew Garret quite a while back:
https://mjg59.dreamwidth.org/34868.html

Intel CPUs starting with the Haswell generation need SATA links to power
down for the "package" part of the CPU to reach low power-states like
PC7 / P8 which bring a significant power-saving with them.

The default max_performance lpm policy does not allow for these high
PC states, both the medium_power and min_power policies do allow this.

The min_power policy saves significantly more power, but there are some
reports of some disks / SSDs not liking min_power leading to system
crashes and in some cases even data corruption has been reported.

Matthew has found a document documenting the default settings of
Intel's IRST Windows driver with which most laptops ship:
https://www-ssl.intel.com/content/dam/doc/reference-guide/sata-devices-implementation-recommendations.pdf

Matthew wrote a patch changing med_power to match those defaults, but
that never got anywhere as some people where reporting issues with the
patch-set that patch was a part of.

This commit is another attempt to make the default IRST driver settings
available under Linux, but instead of changing medium_power and
potentially introducing regressions, this commit adds a new
med_power_with_dipm setting which is identical to the existing
medium_power accept that it enables dipm on top, which makes it match
the Windows IRST driver settings, which should hopefully be safe to
use on most devices.

The med_power_with_dipm setting is close to min_power, except that:
a) It does not use host-initiated slumber mode (ASP not set),
   but it does allow device-initiated slumber
b) It does not enable DevSlp mode

On my T440s test laptop I get the following power savings when idle:
medium_power0.9W
med_power_with_dipm 1.2W
min_power   1.2W

Suggested-by: Matthew Garrett 
Cc: Matthew Garrett 
Signed-off-by: Hans de Goede 
---
 drivers/ata/libata-core.c |  1 +
 drivers/ata/libata-eh.c   | 10 +-
 drivers/ata/libata-scsi.c |  9 +
 include/linux/libata.h|  1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 1945a8ea2099..f165d95c780f 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3964,6 +3964,7 @@ int sata_link_scr_lpm(struct ata_link *link, enum 
ata_lpm_policy policy,
scontrol &= ~(0x1 << 8);
scontrol |= (0x6 << 8);
break;
+   case ATA_LPM_MED_POWER_WITH_DIPM:
case ATA_LPM_MIN_POWER:
if (ata_link_nr_enabled(link) > 0)
/* no restrictions on LPM transitions */
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 3dbd05532c09..aefe9a9971ad 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3456,9 +3456,9 @@ static int ata_eh_maybe_retry_flush(struct ata_device 
*dev)
  * @r_failed_dev: out parameter for failed device
  *
  * Enable SATA Interface power management.  This will enable
- * Device Interface Power Management (DIPM) for min_power
- * policy, and then call driver specific callbacks for
- * enabling Host Initiated Power management.
+ * Device Interface Power Management (DIPM) for min_power and
+ * medium_power_with_dipm policies, and then call driver specific
+ * callbacks for enabling Host Initiated Power management.
  *
  * LOCKING:
  * EH context.
@@ -3504,7 +3504,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum 
ata_lpm_policy policy,
hints &= ~ATA_LPM_HIPM;
 
/* disable DIPM before changing link config */
-   if (policy != ATA_LPM_MIN_POWER && dipm) {
+   if (policy < ATA_LPM_MED_POWER_WITH_DIPM && dipm) {
err_mask = ata_dev_set_feature(dev,
SETFEATURES_SATA_DISABLE, SATA_DIPM);
if (err_mask && err_mask != AC_ERR_DEV) {
@@ -3547,7 +3547,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum 
ata_lpm_policy policy,
 
/* host config updated, enable DIPM if transitioning to MIN_POWER */
ata_for_each_dev(dev, link, ENABLED) {
-   if (policy == ATA_LPM_MIN_POWER && !no_dipm &&
+   if (policy >= ATA_LPM_MED_POWER_WITH_DIPM && !no_dipm &&
ata_id_has_dipm(dev->id)) {
err_mask = ata_dev_set_feature(dev,
SETFEATURES_SATA_ENABLE, SATA_DIPM);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 44ba292f2cd7..673e72f438eb 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -106,10 +106,11 @@ static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {
 };
 
 static const char *ata_lpm_policy_names[] = {
-   [ATA_LPM_UNKNOWN]   = "max_performance",
-   

Re: [RFC Part2 PATCH v3 19/26] KVM: svm: Add support for SEV GUEST_STATUS command

2017-09-14 Thread Borislav Petkov
On Mon, Jul 24, 2017 at 03:02:56PM -0500, Brijesh Singh wrote:
> The command is used for querying the SEV guest status.
> 
> Signed-off-by: Brijesh Singh 
> ---
>  arch/x86/kvm/svm.c | 38 ++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 7a77197..21f85e1 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -6024,6 +6024,40 @@ static int sev_launch_finish(struct kvm *kvm, struct 
> kvm_sev_cmd *argp)
>   return ret;
>  }
>  
> +static int sev_guest_status(struct kvm *kvm, struct kvm_sev_cmd *argp)
> +{
> + struct kvm_sev_guest_status params;
> + struct sev_data_guest_status *data;
> + int ret;
> +
> + if (!sev_guest(kvm))
> + return -ENOTTY;
> +
> + if (copy_from_user(, (void *) argp->data,
> + sizeof(struct kvm_sev_guest_status)))

Let me try to understand what's going on here. You copy user data into
params...

> + return -EFAULT;
> +
> + data = kzalloc(sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + data->handle = sev_get_handle(kvm);
> + ret = sev_issue_cmd(kvm, SEV_CMD_GUEST_STATUS, data, >error);
> + if (ret)
> + goto e_free;
> +
> + params.policy = data->policy;
> + params.state = data->state;
> + params.handle = data->handle;

... *overwrite* the copied data which means, the copy meant *absolutely*
*nothing* at all! ...

Also, why does userspace need to know the firmware ->handle?

> +
> + if (copy_to_user((void *) argp->data, ,
> + sizeof(struct kvm_sev_guest_status)))

... and here you copy it back. And the caller svm_memory_encryption_op()
copies sev_cmd yet again! Probably for the sev_cmd.error value.
Ok, looking at other commands, they use more members like fd in
sev_guest_init(), for example.

But please audit all that shuffling of data back and forth and bring it
down to a mininum. No useless work pls.

-- 
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 
(AG Nürnberg)
-- 


[tip:core/urgent] watchdog/core: Mark hardlockup_detector_disable() __init

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  7a3558200739e1378800a7a6d7f63c031115f7a4
Gitweb: http://git.kernel.org/tip/7a3558200739e1378800a7a6d7f63c031115f7a4
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:02 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:04 +0200

watchdog/core: Mark hardlockup_detector_disable() __init

The function is only used by the KVM init code. Mark it __init to prevent
creative abuse.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.727134...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7c3a0a7..1c185d9 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -55,7 +55,7 @@ unsigned int __read_mostly hardlockup_panic =
  * kernel command line parameters are parsed, because otherwise it is not
  * possible to override this in hardlockup_panic_setup().
  */
-void hardlockup_detector_disable(void)
+void __init hardlockup_detector_disable(void)
 {
watchdog_enabled &= ~NMI_WATCHDOG_ENABLED;
 }


[tip:core/urgent] watchdog/core: Remove broken suspend/resume interfaces

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  5490125d77a43016b26f629d4b485e2c62172551
Gitweb: http://git.kernel.org/tip/5490125d77a43016b26f629d4b485e2c62172551
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:36:59 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:04 +0200

watchdog/core: Remove broken suspend/resume interfaces

This interface has several issues:

 - It's causing recursive locking of the hotplug lock.

 - It's complete overkill to teardown all threads and then recreate them

The same can be achieved with the simple hardlockup_detector_perf_stop /
restart() interfaces. The abuse from the busy looping poweroff() loop of
PARISC has been solved as well.

Remove the cruft.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.487537...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 arch/powerpc/kernel/watchdog.c |  3 --
 include/linux/nmi.h| 12 --
 kernel/watchdog.c  | 89 +-
 3 files changed, 1 insertion(+), 103 deletions(-)

diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 2f6eadd..5ded171 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -310,9 +310,6 @@ static int start_wd_on_cpu(unsigned int cpu)
if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
return 0;
 
-   if (watchdog_suspended)
-   return 0;
-
if (!cpumask_test_cpu(cpu, _cpumask))
return 0;
 
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 85bb268b..7eefe7a 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -164,7 +164,6 @@ extern int watchdog_thresh;
 extern unsigned long watchdog_enabled;
 extern struct cpumask watchdog_cpumask;
 extern unsigned long *watchdog_cpumask_bits;
-extern int __read_mostly watchdog_suspended;
 #ifdef CONFIG_SMP
 extern int sysctl_softlockup_all_cpu_backtrace;
 extern int sysctl_hardlockup_all_cpu_backtrace;
@@ -192,17 +191,6 @@ extern int proc_watchdog_thresh(struct ctl_table *, int ,
void __user *, size_t *, loff_t *);
 extern int proc_watchdog_cpumask(struct ctl_table *, int,
 void __user *, size_t *, loff_t *);
-extern int lockup_detector_suspend(void);
-extern void lockup_detector_resume(void);
-#else
-static inline int lockup_detector_suspend(void)
-{
-   return 0;
-}
-
-static inline void lockup_detector_resume(void)
-{
-}
 #endif
 
 #ifdef CONFIG_HAVE_ACPI_APEI_NMI
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index f23e373..b2d4675 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -97,19 +97,6 @@ unsigned long *watchdog_cpumask_bits = 
cpumask_bits(_cpumask);
  * unregistered/stopped, so it is an indicator whether the threads exist.
  */
 static int __read_mostly watchdog_running;
-/*
- * If a subsystem has a need to deactivate the watchdog temporarily, it
- * can use the suspend/resume interface to achieve this. The content of
- * the 'watchdog_suspended' variable reflects this state. Existing threads
- * are parked/unparked by the lockup_detector_{suspend|resume} functions
- * (see comment blocks pertaining to those functions for further details).
- *
- * 'watchdog_suspended' also prevents threads from being registered/started
- * or unregistered/stopped via parameters in /proc/sys/kernel, so the state
- * of 'watchdog_running' cannot change while the watchdog is deactivated
- * temporarily (see related code in 'proc' handlers).
- */
-int __read_mostly watchdog_suspended;
 
 /*
  * These functions can be overridden if an architecture implements its
@@ -136,7 +123,6 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
  * - watchdog_cpumask
  * - sysctl_hardlockup_all_cpu_backtrace
  * - hardlockup_panic
- * - watchdog_suspended
  */
 void __weak watchdog_nmi_reconfigure(void)
 {
@@ -672,61 +658,6 @@ void lockup_detector_soft_poweroff(void)
watchdog_enabled = 0;
 }
 
-/*
- * Suspend the hard and soft lockup detector by parking the watchdog threads.
- */
-int lockup_detector_suspend(void)
-{
-   int ret = 0;
-
-   get_online_cpus();
-   mutex_lock(_proc_mutex);
-   /*
-* Multiple suspend requests can be active in parallel (counted by
-* the 'watchdog_suspended' variable). If the watchdog threads are
-* running, the first caller takes care that they will be parked.
-* The state of 'watchdog_running' cannot change while a suspend
-* request is active 

[tip:core/urgent] watchdog/core: Rework CPU hotplug locking

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  b7a349819d4b9b5db64e523351e66a79a758eaa5
Gitweb: http://git.kernel.org/tip/b7a349819d4b9b5db64e523351e66a79a758eaa5
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:00 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:04 +0200

watchdog/core: Rework CPU hotplug locking

The watchdog proc interface causes extensive recursive locking of the CPU
hotplug percpu rwsem, which is deadlock prone.

Replace the get/put_online_cpus() pairs with cpu_hotplug_disable()/enable()
calls for now. Later patches will remove that requirement completely.

Reported-by: Borislav Petkov 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.568079...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b2d4675..cd79f64 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -703,7 +703,7 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
int err, old, new;
int *watchdog_param = (int *)table->data;
 
-   get_online_cpus();
+   cpu_hotplug_disable();
mutex_lock(_proc_mutex);
 
/*
@@ -752,7 +752,7 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
}
 out:
mutex_unlock(_proc_mutex);
-   put_online_cpus();
+   cpu_hotplug_enable();
return err;
 }
 
@@ -794,7 +794,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
 {
int err, old, new;
 
-   get_online_cpus();
+   cpu_hotplug_disable();
mutex_lock(_proc_mutex);
 
old = ACCESS_ONCE(watchdog_thresh);
@@ -818,7 +818,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
}
 out:
mutex_unlock(_proc_mutex);
-   put_online_cpus();
+   cpu_hotplug_enable();
return err;
 }
 
@@ -833,7 +833,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
 {
int err;
 
-   get_online_cpus();
+   cpu_hotplug_disable();
mutex_lock(_proc_mutex);
 
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
@@ -856,7 +856,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
}
 
mutex_unlock(_proc_mutex);
-   put_online_cpus();
+   cpu_hotplug_enable();
return err;
 }
 


[PATCH] KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously

2017-09-14 Thread Wanpeng Li
From: Wanpeng Li 

qemu-system-x86-8600  [004] d..1  7205.687530: kvm_entry: vcpu 2
qemu-system-x86-8600  [004]   7205.687532: kvm_exit: reason EXCEPTION_NMI 
rip 0xa921297d info eb2c0e44e018 8b0e
qemu-system-x86-8600  [004]   7205.687532: kvm_page_fault: address 
eb2c0e44e018 error_code 0
qemu-system-x86-8600  [004]   7205.687620: kvm_try_async_get_page: gva = 
0xeb2c0e44e018, gfn = 0x427e4e
qemu-system-x86-8600  [004] .N..  7205.687628: kvm_async_pf_not_present: token 
0x8b002 gva 0xeb2c0e44e018
kworker/4:2-7814  [004]   7205.687655: kvm_async_pf_completed: gva 
0xeb2c0e44e018 address 0x7fcc30c4e000
qemu-system-x86-8600  [004]   7205.687703: kvm_async_pf_ready: token 
0x8b002 gva 0xeb2c0e44e018
qemu-system-x86-8600  [004] d..1  7205.687711: kvm_entry: vcpu 2

After running some memory intensive workload in guest, I catch the kworker 
which completes the GUP too quickly, and queues an "Page Ready" #PF exception 
after the "Page not Present" exception before the next vmentry as the above 
trace which will result in #DF injected to guest.

This patch fixes it by clearing the queue for "Page not Present" if "Page Ready"
occurs before the next vmentry since the GUP has already got the required page 
and shadow page table has already been fixed by "Page Ready" handler.

Cc: Paolo Bonzini 
Cc: Radim Krčmář 
Signed-off-by: Wanpeng Li 
---
 arch/x86/kvm/x86.c | 37 -
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 6069af8..16c14c9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8619,6 +8619,13 @@ static int apf_put_user(struct kvm_vcpu *vcpu, u32 val)
  sizeof(val));
 }
 
+static int apf_get_user(struct kvm_vcpu *vcpu, u32 *val)
+{
+
+   return kvm_write_guest_cached(vcpu->kvm, >arch.apf.data, val,
+ sizeof(u32));
+}
+
 void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
 struct kvm_async_pf *work)
 {
@@ -8646,6 +8653,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
 struct kvm_async_pf *work)
 {
struct x86_exception fault;
+   u32 val;
 
if (work->wakeup_all)
work->arch.token = ~0; /* broadcast wakeup */
@@ -8653,15 +8661,26 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
kvm_del_async_pf_gfn(vcpu, work->arch.gfn);
trace_kvm_async_pf_ready(work->arch.token, work->gva);
 
-   if ((vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED) &&
-   !apf_put_user(vcpu, KVM_PV_REASON_PAGE_READY)) {
-   fault.vector = PF_VECTOR;
-   fault.error_code_valid = true;
-   fault.error_code = 0;
-   fault.nested_page_fault = false;
-   fault.address = work->arch.token;
-   fault.async_page_fault = true;
-   kvm_inject_page_fault(vcpu, );
+   if (vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED) {
+   if (!apf_get_user(vcpu, )) {
+   if (val == KVM_PV_REASON_PAGE_NOT_PRESENT &&
+   vcpu->arch.exception.pending &&
+   vcpu->arch.exception.nr == PF_VECTOR &&
+   !apf_put_user(vcpu, 0)) {
+   vcpu->arch.exception.pending = false;
+   vcpu->arch.exception.nr = 0;
+   vcpu->arch.exception.has_error_code = false;
+   vcpu->arch.exception.error_code = 0;
+   } else if (!apf_put_user(vcpu, 
KVM_PV_REASON_PAGE_READY)) {
+   fault.vector = PF_VECTOR;
+   fault.error_code_valid = true;
+   fault.error_code = 0;
+   fault.nested_page_fault = false;
+   fault.address = work->arch.token;
+   fault.async_page_fault = true;
+   kvm_inject_page_fault(vcpu, );
+   }
+   }
}
vcpu->arch.apf.halted = false;
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
-- 
2.7.4




[tip:core/urgent] watchdog/core: Rename watchdog_proc_mutex

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  946d197794b23202b8b46c43016747c72fe23393
Gitweb: http://git.kernel.org/tip/946d197794b23202b8b46c43016747c72fe23393
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:01 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:04 +0200

watchdog/core: Rename watchdog_proc_mutex

Following patches will use the mutex for other purposes as well. Rename it
as it is not longer a proc specific thing.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.647714...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index cd79f64..7c3a0a7 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -29,8 +29,7 @@
 #include 
 #include 
 
-/* Watchdog configuration */
-static DEFINE_MUTEX(watchdog_proc_mutex);
+static DEFINE_MUTEX(watchdog_mutex);
 
 int __read_mostly nmi_watchdog_enabled;
 
@@ -704,7 +703,7 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
int *watchdog_param = (int *)table->data;
 
cpu_hotplug_disable();
-   mutex_lock(_proc_mutex);
+   mutex_lock(_mutex);
 
/*
 * If the parameter is being read return the state of the corresponding
@@ -751,7 +750,7 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
err = proc_watchdog_update();
}
 out:
-   mutex_unlock(_proc_mutex);
+   mutex_unlock(_mutex);
cpu_hotplug_enable();
return err;
 }
@@ -795,7 +794,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
int err, old, new;
 
cpu_hotplug_disable();
-   mutex_lock(_proc_mutex);
+   mutex_lock(_mutex);
 
old = ACCESS_ONCE(watchdog_thresh);
err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
@@ -817,7 +816,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
set_sample_period();
}
 out:
-   mutex_unlock(_proc_mutex);
+   mutex_unlock(_mutex);
cpu_hotplug_enable();
return err;
 }
@@ -834,7 +833,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
int err;
 
cpu_hotplug_disable();
-   mutex_lock(_proc_mutex);
+   mutex_lock(_mutex);
 
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
if (!err && write) {
@@ -855,7 +854,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
watchdog_nmi_reconfigure();
}
 
-   mutex_unlock(_proc_mutex);
+   mutex_unlock(_mutex);
cpu_hotplug_enable();
return err;
 }


[tip:core/urgent] watchdog/core, powerpc: Make watchdog_nmi_reconfigure() two stage

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  6592ad2fcc8f15b4f99b36c1db7d9f65510c203b
Gitweb: http://git.kernel.org/tip/6592ad2fcc8f15b4f99b36c1db7d9f65510c203b
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:16 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:07 +0200

watchdog/core, powerpc: Make watchdog_nmi_reconfigure() two stage

Both the perf reconfiguration and the powerpc watchdog_nmi_reconfigure()
need to be done in two steps.

 1) Stop all NMIs
 2) Read the new parameters and start NMIs

Right now watchdog_nmi_reconfigure() is a combination of both. To allow a
clean reconfiguration add a 'run' argument and split the functionality in
powerpc.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Benjamin Herrenschmidt 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Cc: linuxppc-...@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20170912194147.862865...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 arch/powerpc/kernel/watchdog.c | 17 +
 include/linux/nmi.h|  2 ++
 kernel/watchdog.c  | 31 ++-
 3 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 5ded171..291af79 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -355,17 +355,18 @@ static void watchdog_calc_timeouts(void)
wd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5;
 }
 
-void watchdog_nmi_reconfigure(void)
+void watchdog_nmi_reconfigure(bool run)
 {
int cpu;
 
-   watchdog_calc_timeouts();
-
-   for_each_cpu(cpu, _cpus_enabled)
-   stop_wd_on_cpu(cpu);
-
-   for_each_cpu_and(cpu, cpu_online_mask, _cpumask)
-   start_wd_on_cpu(cpu);
+   if (!run) {
+   for_each_cpu(cpu, _cpus_enabled)
+   stop_wd_on_cpu(cpu);
+   } else {
+   watchdog_calc_timeouts();
+   for_each_cpu_and(cpu, cpu_online_mask, _cpumask)
+   start_wd_on_cpu(cpu);
+   }
 }
 
 /*
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 4a8d103..eee255b 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -103,6 +103,8 @@ static inline void arch_touch_nmi_watchdog(void) {}
 #endif
 #endif
 
+void watchdog_nmi_reconfigure(bool run);
+
 /**
  * touch_nmi_watchdog - restart NMI watchdog timeout.
  *
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index baae9fc..5693afd 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,17 +112,25 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
hardlockup_detector_perf_disable();
 }
 
-/*
- * watchdog_nmi_reconfigure can be implemented to be notified after any
- * watchdog configuration change. The arch hardlockup watchdog should
- * respond to the following variables:
+/**
+ * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs
+ * @run:   If false stop the watchdogs on all enabled CPUs
+ * If true start the watchdogs on all enabled CPUs
+ *
+ * The core call order is:
+ * watchdog_nmi_reconfigure(false);
+ * update_variables();
+ * watchdog_nmi_reconfigure(true);
+ *
+ * The second call which starts the watchdogs again guarantees that the
+ * following variables are stable across the call.
  * - watchdog_enabled
  * - watchdog_thresh
  * - watchdog_cpumask
- * - sysctl_hardlockup_all_cpu_backtrace
- * - hardlockup_panic
+ *
+ * After the call the variables can be changed again.
  */
-void __weak watchdog_nmi_reconfigure(void) { }
+void __weak watchdog_nmi_reconfigure(bool run) { }
 
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
 
@@ -515,10 +523,12 @@ static void softlockup_unpark_threads(void)
 
 static void softlockup_reconfigure_threads(bool enabled)
 {
+   watchdog_nmi_reconfigure(false);
softlockup_park_all_threads();
set_sample_period();
if (enabled)
softlockup_unpark_threads();
+   watchdog_nmi_reconfigure(true);
 }
 
 /*
@@ -559,7 +569,11 @@ static inline void watchdog_unpark_threads(void) { }
 static inline int watchdog_enable_all_cpus(void) { return 0; }
 static inline void watchdog_disable_all_cpus(void) { }
 static inline void softlockup_init_threads(void) { }
-static inline void softlockup_reconfigure_threads(bool enabled) { }
+static void softlockup_reconfigure_threads(bool enabled)
+{
+   watchdog_nmi_reconfigure(false);
+   watchdog_nmi_reconfigure(true);
+}
 #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */
 
 static void 

[tip:core/urgent] watchdog/hardlockup/perf: Use new perf CPU enable mechanism

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  146c9d0e9dfdb62ed6afd43cc263efafbbfd1dcf
Gitweb: http://git.kernel.org/tip/146c9d0e9dfdb62ed6afd43cc263efafbbfd1dcf
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:21 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:08 +0200

watchdog/hardlockup/perf: Use new perf CPU enable mechanism

Get rid of the hodgepodge which tries to be smart about perf being
unavailable and error printout rate limiting.

That's all not required simply because this is never invoked when the perf
NMI watchdog is not functional.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194148.259651...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c |  4 ++-
 kernel/watchdog_hld.c | 88 +++
 2 files changed, 8 insertions(+), 84 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index fd8a998..5eb1196 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -107,6 +107,7 @@ __setup("hardlockup_all_cpu_backtrace=", 
hardlockup_all_cpu_backtrace_setup);
  */
 int __weak watchdog_nmi_enable(unsigned int cpu)
 {
+   hardlockup_detector_perf_enable();
return 0;
 }
 
@@ -465,7 +466,8 @@ static void watchdog_enable(unsigned int cpu)
/* Initialize timestamp */
__touch_watchdog();
/* Enable the perf event */
-   watchdog_nmi_enable(cpu);
+   if (watchdog_enabled & NMI_WATCHDOG_ENABLED)
+   watchdog_nmi_enable(cpu);
 
watchdog_set_prio(SCHED_FIFO, MAX_RT_PRIO - 1);
 }
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 99a3f22..509bb6b 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -25,7 +25,7 @@ static DEFINE_PER_CPU(struct perf_event *, dead_event);
 static struct cpumask dead_events_mask;
 
 static unsigned long hardlockup_allcpu_dumped;
-static bool hardlockup_detector_disabled;
+static unsigned int watchdog_cpus;
 
 void arch_touch_nmi_watchdog(void)
 {
@@ -160,84 +160,6 @@ static void watchdog_overflow_callback(struct perf_event 
*event,
return;
 }
 
-/*
- * People like the simple clean cpu node info on boot.
- * Reduce the watchdog noise by only printing messages
- * that are different from what cpu0 displayed.
- */
-static unsigned long firstcpu_err;
-static atomic_t watchdog_cpus;
-
-int watchdog_nmi_enable(unsigned int cpu)
-{
-   struct perf_event_attr *wd_attr;
-   struct perf_event *event = per_cpu(watchdog_ev, cpu);
-   int firstcpu = 0;
-
-   /* nothing to do if the hard lockup detector is disabled */
-   if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
-   goto out;
-
-   /* A failure disabled the hardlockup detector permanently */
-   if (hardlockup_detector_disabled)
-   return -ENODEV;
-
-   /* is it already setup and enabled? */
-   if (event && event->state > PERF_EVENT_STATE_OFF)
-   goto out;
-
-   /* it is setup but not enabled */
-   if (event != NULL)
-   goto out_enable;
-
-   if (atomic_inc_return(_cpus) == 1)
-   firstcpu = 1;
-
-   wd_attr = _hw_attr;
-   wd_attr->sample_period = hw_nmi_get_sample_period(watchdog_thresh);
-
-   /* Try to register using hardware perf events */
-   event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, 
watchdog_overflow_callback, NULL);
-
-   /* save the first cpu's error for future comparision */
-   if (firstcpu && IS_ERR(event))
-   firstcpu_err = PTR_ERR(event);
-
-   if (!IS_ERR(event)) {
-   /* only print for the first cpu initialized */
-   if (firstcpu || firstcpu_err)
-   pr_info("enabled on all CPUs, permanently consumes one 
hw-PMU counter.\n");
-   goto out_save;
-   }
-
-   /* skip displaying the same error again */
-   if (!firstcpu && (PTR_ERR(event) == firstcpu_err))
-   return PTR_ERR(event);
-
-   /* vary the KERN level based on the returned errno */
-   if (PTR_ERR(event) == -EOPNOTSUPP)
-   pr_info("disabled (cpu%i): not supported (no LAPIC?)\n", cpu);
-   else if (PTR_ERR(event) == -ENOENT)
-   pr_warn("disabled (cpu%i): hardware events not enabled\n",
-cpu);
-   else
-   pr_err("disabled (cpu%i): unable to create perf event: %ld\n",
-   cpu, PTR_ERR(event));
-
-   pr_info("Disabling hard lockup detector permanently\n");
-   

[tip:core/urgent] watchdog/hardlockup/perf: Implement CPU enable replacement

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  2a1b8ee4f5665b4291e43e4a25d964c3eb2f4c32
Gitweb: http://git.kernel.org/tip/2a1b8ee4f5665b4291e43e4a25d964c3eb2f4c32
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:20 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:08 +0200

watchdog/hardlockup/perf: Implement CPU enable replacement

watchdog_nmi_enable() is an unparseable mess, Provide a clean perf specific
implementation, which will be used when the existing setup/teardown mess is
replaced.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194148.180215...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/nmi.h   |  2 ++
 kernel/watchdog_hld.c | 11 +++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 72c62a8..89ba8b2 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -92,12 +92,14 @@ extern void arch_touch_nmi_watchdog(void);
 extern void hardlockup_detector_perf_stop(void);
 extern void hardlockup_detector_perf_restart(void);
 extern void hardlockup_detector_perf_disable(void);
+extern void hardlockup_detector_perf_enable(void);
 extern void hardlockup_detector_perf_cleanup(void);
 extern int hardlockup_detector_perf_init(void);
 #else
 static inline void hardlockup_detector_perf_stop(void) { }
 static inline void hardlockup_detector_perf_restart(void) { }
 static inline void hardlockup_detector_perf_disable(void) { }
+static inline void hardlockup_detector_perf_enable(void) { }
 static inline void hardlockup_detector_perf_cleanup(void) { }
 # if !defined(CONFIG_HAVE_NMI_WATCHDOG)
 static inline int hardlockup_detector_perf_init(void) { return -ENODEV; }
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index f7e752e..99a3f22 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -260,6 +260,17 @@ static int hardlockup_detector_event_create(void)
 }
 
 /**
+ * hardlockup_detector_perf_enable - Enable the local event
+ */
+void hardlockup_detector_perf_enable(void)
+{
+   if (hardlockup_detector_event_create())
+   return;
+
+   perf_event_enable(this_cpu_read(watchdog_ev));
+}
+
+/**
  * hardlockup_detector_perf_disable - Disable the local event
  */
 void hardlockup_detector_perf_disable(void)


[tip:core/urgent] watchdog/hardlockup/perf: Implement init time detection of perf

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  a994a3147e4c0c9c50a46e6cace7586254975e20
Gitweb: http://git.kernel.org/tip/a994a3147e4c0c9c50a46e6cace7586254975e20
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:19 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:08 +0200

watchdog/hardlockup/perf: Implement init time detection of perf

Use the init time detection of the perf NMI watchdog to determine whether
the perf NMI watchdog is functional. If not disable it permanentely. It
won't come back magically at runtime.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194148.099799...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 8488631..fd8a998 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -44,6 +44,7 @@ int __read_mostly watchdog_user_enabled = 1;
 int __read_mostly nmi_watchdog_user_enabled = NMI_WATCHDOG_DEFAULT;
 int __read_mostly soft_watchdog_user_enabled = 1;
 int __read_mostly watchdog_thresh = 10;
+int __read_mostly nmi_watchdog_available;
 
 struct cpumask watchdog_allowed_mask __read_mostly;
 static bool softlockup_threads_initialized __read_mostly;
@@ -114,6 +115,12 @@ void __weak watchdog_nmi_disable(unsigned int cpu)
hardlockup_detector_perf_disable();
 }
 
+/* Return 0, if a NMI watchdog is available. Error code otherwise */
+int __weak __init watchdog_nmi_probe(void)
+{
+   return hardlockup_detector_perf_init();
+}
+
 /**
  * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs
  * @run:   If false stop the watchdogs on all enabled CPUs
@@ -145,7 +152,7 @@ static void lockup_detector_update_enable(void)
watchdog_enabled = 0;
if (!watchdog_user_enabled)
return;
-   if (nmi_watchdog_user_enabled)
+   if (nmi_watchdog_available && nmi_watchdog_user_enabled)
watchdog_enabled |= NMI_WATCHDOG_ENABLED;
if (soft_watchdog_user_enabled)
watchdog_enabled |= SOFT_WATCHDOG_ENABLED;
@@ -692,6 +699,8 @@ int proc_watchdog(struct ctl_table *table, int write,
 int proc_nmi_watchdog(struct ctl_table *table, int write,
  void __user *buffer, size_t *lenp, loff_t *ppos)
 {
+   if (!nmi_watchdog_available && write)
+   return -ENOTSUPP;
return proc_watchdog_common(NMI_WATCHDOG_ENABLED,
table, write, buffer, lenp, ppos);
 }
@@ -764,5 +773,7 @@ void __init lockup_detector_init(void)
cpumask_copy(_cpumask, cpu_possible_mask);
 #endif
 
+   if (!watchdog_nmi_probe())
+   nmi_watchdog_available = true;
softlockup_init_threads();
 }


[tip:core/urgent] watchdog/hardlockup: Clean up hotplug locking mess

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  ab5fe3ff38ff9653490910cc71dbbedc95a86e41
Gitweb: http://git.kernel.org/tip/ab5fe3ff38ff9653490910cc71dbbedc95a86e41
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:23 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:09 +0200

watchdog/hardlockup: Clean up hotplug locking mess

All watchdog thread related functions are delegated to the smpboot thread
infrastructure, which handles serialization against CPU hotplug correctly.

The sysctl interface is completely decoupled from anything which requires
CPU hotplug protection.

No need to protect the sysctl writes against cpu hotplug anymore. Remove it
and add the now required protection to the powerpc arch_nmi_watchdog
implementation.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Benjamin Herrenschmidt 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Michael Ellerman 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Cc: linuxppc-...@lists.ozlabs.org
Link: http://lkml.kernel.org/r/20170912194148.418497...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 arch/powerpc/kernel/watchdog.c | 2 ++
 kernel/watchdog.c  | 6 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 291af79..dfb0677 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -359,6 +359,7 @@ void watchdog_nmi_reconfigure(bool run)
 {
int cpu;
 
+   cpus_read_lock();
if (!run) {
for_each_cpu(cpu, _cpus_enabled)
stop_wd_on_cpu(cpu);
@@ -367,6 +368,7 @@ void watchdog_nmi_reconfigure(bool run)
for_each_cpu_and(cpu, cpu_online_mask, _cpumask)
start_wd_on_cpu(cpu);
}
+   cpus_read_unlock();
 }
 
 /*
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 5eb1196..f6ef163 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -664,7 +664,6 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
 {
int err, old, *param = table->data;
 
-   cpu_hotplug_disable();
mutex_lock(_mutex);
 
if (!write) {
@@ -681,7 +680,6 @@ static int proc_watchdog_common(int which, struct ctl_table 
*table, int write,
proc_watchdog_update();
}
mutex_unlock(_mutex);
-   cpu_hotplug_enable();
return err;
 }
 
@@ -725,7 +723,6 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
 {
int err, old;
 
-   cpu_hotplug_disable();
mutex_lock(_mutex);
 
old = READ_ONCE(watchdog_thresh);
@@ -735,7 +732,6 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
proc_watchdog_update();
 
mutex_unlock(_mutex);
-   cpu_hotplug_enable();
return err;
 }
 
@@ -750,7 +746,6 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
 {
int err;
 
-   cpu_hotplug_disable();
mutex_lock(_mutex);
 
err = proc_do_large_bitmap(table, write, buffer, lenp, ppos);
@@ -758,7 +753,6 @@ int proc_watchdog_cpumask(struct ctl_table *table, int 
write,
proc_watchdog_update();
 
mutex_unlock(_mutex);
-   cpu_hotplug_enable();
return err;
 }
 #endif /* CONFIG_SYSCTL */


Re: [PATCH 1/1] Coccinelle: array_size: report even if include is missing

2017-09-14 Thread Julia Lawall


On Wed, 13 Sep 2017, Jérémy Lefaure wrote:

> Rule r does not depend on rule i (which is the include of
> linux/kernel.h) so the output should not depend on i in
> org and report mode.
>
> Signed-off-by: Jérémy Lefaure 

Acked-by: Julia Lawall 

I guess that if the incude is missing, the person updating the code can
always add it.


> ---
>
> I have tested this patch in report mode on the file
> drivers/staging/rtlwifi/phydm/rtl8822b/halhwimg8822b_rf.c which does not
> use ARRAY_SIZE and does not include linux/kernel.h.
>
>  scripts/coccinelle/misc/array_size.cocci | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/array_size.cocci 
> b/scripts/coccinelle/misc/array_size.cocci
> index 6ec05710b017..09520f0941f0 100644
> --- a/scripts/coccinelle/misc/array_size.cocci
> +++ b/scripts/coccinelle/misc/array_size.cocci
> @@ -72,13 +72,13 @@ position p;
>   (sizeof(E)@p /sizeof(T))
>  )
>
> -@script:python depends on i&@
> +@script:python depends on org@
>  p << r.p;
>  @@
>
>  coccilib.org.print_todo(p[0], "WARNING should use ARRAY_SIZE")
>
> -@script:python depends on i&@
> +@script:python depends on report@
>  p << r.p;
>  @@
>
> --
> 2.14.1
>
>

Re: [patch 00/52] x86: Rework the vector management

2017-09-14 Thread Juergen Gross
On 13/09/17 23:29, Thomas Gleixner wrote:
> Sorry for the large CC list, but this is a major surgery.
> 
> The vector management in x86 including the surrounding code is a
> conglomorate of ancient bits and pieces which have been subject to
> 'modernization' and featuritis over the years. The most obscure parts are
> the vector allocation mechanics, the cleanup vector handling and the cpu
> hotplug machinery. Replacing these pieces of art was on my todo list for a
> long time.
> 
> Recent attempts to 'solve' CPU offline / hibernation issues which are
> partially caused by the current vector management implementation made me
> look for real. Further information in this thread:
> 
> http://lkml.kernel.org/r/cover.1504235838.git.yu.c.c...@intel.com
> 
> Aside of drivers allocating gazillion of interrupts, there are quite some
> things which can be addressed in the x86 vector management and in the core
> code.
> 
>   - Multi CPU affinities:
> 
> A dubious property which is not available on all machines and causes
> major complexity both in the allocator and the cleanup/hotplug
> management. See:
> 
>http://lkml.kernel.org/r/alpine.DEB.2.20.1709071045440.1827@nanos
> 
>   - Priority level spreading:
> 
> An obscure and undocumented property which I think is sufficiently
> argued to be not required in:
> 
>http://lkml.kernel.org/r/alpine.DEB.2.20.1709071045440.1827@nanos
> 
>   - Allocation of vectors when interrupt descriptors are allocated.
> 
> This is a historical implementation detail, which is not really
> required when the vector allocation is delayed up to the point when
> request_irq() is invoked. This might make request_irq() fail, when the
> vector space is exhausted, but drivers should handle request_irq()
> fails anyway.
> 
> The upside of changing this is that the active vector space becomes
> smaller especially on hibernation/cpu offline when drivers shut down
> queue interrupts of outgoing CPUs.
> 
> Some of this is already addressed with the managed interrupt facility,
> but that was bolted on top of the existing vector management because
> proper integration was not possible at that point. I take the blame
> for this, but the tradeoff of not doing it would have been more
> broken driver boiler plate code all over the place. So I went for the
> lesser of two evils.
> 
>   - Allocation of vectors on the wrong place
> 
> Even for managed interrupts the vector allocation at descriptor
> allocation happens on the wrong place and gets fixed after the fact
> with a call to set_affinity(). In case of not remapped interrupts
> this results in at least one interrupt on the wrong CPU before it is
> migrated to the desired target.
> 
>   - Lack of instrumentation
>  
> All of this is a black box which allows no insight into the actual
> vector usage.
> 
> The series addresses these points and converts the x86 vector management to
> a bitmap based allocator which provides proper reservation management for
> 'managed interrupts' and best effort reservation for regular interrupts.
> The latter allows overcommitment, which 'fixes' some of hotplug/hibernation
> problems in a clean way. It can't fix all of them depending on the driver
> involved.
> 
> This rework is no excuse for driver writers to do exhaustive vector
> allocations instead of utilizing the managed interrupt infrastructure, but
> it addresses long standing issues in this code with the side effect of
> mitigating some of the driver oddities. The proper solution for multi queue
> management are 'managed interrupts' which has been proven in the block-mq
> work as they solve issues which are worked around in other drivers in
> creative ways with lots of copied code and often enough broken attempts to
> handle interrupt affinity and CPU hotplug problems.
> 
> The new bitmap allocator and the x86 vector management code are
> instrumented with tracepoints and the irq domain debugfs files allow deep
> insight into the vector allocation and reservations.
> 
> The patches work on machines with and without interrupt remapping and
> inside of KVM guests of various flavours, though I have no idea what I
> broke on the way with other hypervisors, posted interrupts etc. So I kindly
> ask for your support in testing and review.
> 
> The series applies on top of Linus tree and is available as git branch:
> 
>git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/apic
> 
> Note, that this branch is Linus tree plus scheduler and x86 fixes which I
> required to do proper testing. They have outstanding pull requests and
> might be merged already when you read this.
> 
> Thanks,
> 
>   tglx
> ---
>  arch/x86/include/asm/x2apic.h  |   49 -
>  b/arch/x86/Kconfig |1 
>  b/arch/x86/include/asm/apic.h  |  255 +-
>  b/arch/x86/include/asm/desc.h  |2 
>  

Re: [PATCH v7 2/8] mfd: wm97xx-core: core support for wm97xx Codec

2017-09-14 Thread Lee Jones
On Wed, 13 Sep 2017, Robert Jarzmik wrote:

> The WM9705, WM9712 and WM9713 are highly integrated codecs, with an
> audio codec, DAC and ADC, GPIO unit and a touchscreen interface.
> 
> Historically the support was spread across drivers/input/touchscreen and
> sound/soc/codecs. The sharing was done through ac97 bus sharing. This
> model will not withstand the new AC97 bus model, where codecs are
> discovered on runtime.
> 
> Signed-off-by: Robert Jarzmik 
> Acked-by: Charles Keepax 
> Acked-by: Lee Jones 
> ---
> Since v3:
>  - added a "depends on AC97_BUS_NEW" Kconfig statement
>  - added default values for wm9705, wm9712 per Charles's comment
> Since v4:
>  - added Charles's ack
> Since v5:
>  - took into account Lee's comments
> Since v6:
>  - took into account Lee's comments
> ---
>  drivers/mfd/Kconfig|  14 ++
>  drivers/mfd/Makefile   |   1 +
>  drivers/mfd/wm97xx-core.c  | 366 
> +
>  include/linux/mfd/wm97xx.h |  25 
>  4 files changed, 406 insertions(+)
>  create mode 100644 drivers/mfd/wm97xx-core.c
>  create mode 100644 include/linux/mfd/wm97xx.h

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks

2017-09-14 Thread romain izard
2017-09-13 19:03 GMT+02:00 Alexandre Belloni
:
> On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote:
>> On 08/09/2017 at 17:35, Romain Izard wrote:
>> > From: Romain Izard 
>> >
>> > Save and restore the System Clock and Programmable Clock register for
>> > the backup use case.
>>
>> "System Clock" seems to be handled in another patch.
>>
>> > Signed-off-by: Romain Izard 
>> > ---
>> >  drivers/clk/at91/pmc.c | 5 +
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
>> > index 07dc2861ad3f..5421b03553ec 100644
>> > --- a/drivers/clk/at91/pmc.c
>> > +++ b/drivers/clk/at91/pmc.c
>> > @@ -66,6 +66,7 @@ static struct
>> > u32 pcr[PMC_MAX_IDS];
>> > u32 audio_pll0;
>> > u32 audio_pll1;
>> > +   u32 pckr[3];
>>
>> Some products have different numbers of PCK (only 2 on at91sam9x5 for
>> instance)...
>>
>
> My opinion is that it will be time to change that when multiple SoCs will
> need to save their registers.
>
For the next version, I'll add a #define. But as this code requires a
device tree node with the compatible string "atmel,sama5d2-pmc", I believe
that we can ignore other chips for now.


-- 
Romain Izard


Re: [PATCH] ARM: sun7i: a20: enable ac/battery power supplies for Lamobo R1 board

2017-09-14 Thread Maxime Ripard
On Wed, Sep 13, 2017 at 09:21:30PM +0800, Icenowy Zheng wrote:
> The Lamobo R1 board connected the ACIN of the AXP209 PMIC to a MicroUSB
> port, and the battery input is connected to a generic connector.
> 
> Enable these two power supplies in the device tree.
> 
> Signed-off-by: Icenowy Zheng 

Applied for 4.15, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

2017-09-14 Thread Sergey Senozhatsky
On (09/14/17 16:40), Sergey Senozhatsky wrote:
[..]
> powerpc and parisc handle kernel .opd section as well:
> 
> arch/powerpc/kernel/vmlinux.lds.S:  .opd
> arch/parisc/kernel/vmlinux.lds.S:   .opd

for modules, arch-s define mod_arch_specific struct.

parisc has .opd

(fdesc offset should be the start of .opd,
 fdesc_offset + sizeof(fdesc) * fdesc_count should be the .opd address range)

struct mod_arch_specific
{
unsigned long got_offset, got_count, got_max;
unsigned long fdesc_offset, fdesc_count, fdesc_max;
struct {
unsigned long stub_offset;
unsigned int stub_entries;
} *section;
int unwind_section;
struct unwind_table *unwind;
};


ia64 has .opd

struct mod_arch_specific {
struct elf64_shdr *core_plt;/* core PLT section */
struct elf64_shdr *init_plt;/* init PLT section */
struct elf64_shdr *got; /* global offset table */
struct elf64_shdr *opd; /* official procedure descriptors */
struct elf64_shdr *unwind;  /* unwind-table section */
unsigned long gp;   /* global-pointer for module */

void *core_unw_table;   /* core unwind-table cookie returned by 
unwinder */
void *init_unw_table;   /* init unwind-table cookie returned by 
unwinder */
unsigned int next_got_entry;/* index of next available got entry */
};


powerpc does not keep track of .opd, need to add

struct mod_arch_specific {
#ifdef __powerpc64__
unsigned int stubs_section; /* Index of stubs section in module */
unsigned int toc_section;   /* What section is the TOC? */
bool toc_fixed; /* Have we fixed up .TOC.? */
#ifdef CONFIG_DYNAMIC_FTRACE
unsigned long toc;
unsigned long tramp;
#endif

#else /* powerpc64 */
/* Indices of PLT sections within module. */
unsigned int core_plt_section;
unsigned int init_plt_section;
#ifdef CONFIG_DYNAMIC_FTRACE
unsigned long tramp;
#endif
#endif /* powerpc64 */

/* List of BUG addresses, source line numbers and filenames */
struct list_head bug_list;
struct bug_entry *bug_table;
unsigned int num_bugs;
};


seems like we are looking at a solution here.

thoughts?

-ss


Re: [PATCH] dt-bindings: nand: denali: reduce the register space in the example

2017-09-14 Thread Masahiro Yamada
Hi.


2017-09-14 17:04 GMT+09:00 Oleksij Rempel :
> Hi,
>
> i assume arch/arm/boot/dts/socfpga.dtsi should be update as well. Right?

I think so.
(also arch/arm/boot/dts/socfpga_arria10.dtsi in the same way)

The wrong property "dma-mask" was removed by
commit 60d920d32ca40660e382cf9ccbc236599a49e607.



> On 14.09.2017 09:17, Masahiro Yamada wrote:
>>
>> This example allocates too much for register regions.  Especially,
>> there are only two registers in the "nand_data" interface of this
>> hardware (ADDR: 0x00, DATA: 0x10).
>>
>> Signed-off-by: Masahiro Yamada 
>> ---
>>
>>   Documentation/devicetree/bindings/mtd/denali-nand.txt | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt
>> b/Documentation/devicetree/bindings/mtd/denali-nand.txt
>> index 504291d..0ee8edb 100644
>> --- a/Documentation/devicetree/bindings/mtd/denali-nand.txt
>> +++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt
>> @@ -29,7 +29,7 @@ nand: nand@ff90 {
>> #address-cells = <1>;
>> #size-cells = <1>;
>> compatible = "altr,socfpga-denali-nand";
>> -   reg = <0xff90 0x10>, <0xffb8 0x1>;
>> +   reg = <0xff90 0x20>, <0xffb8 0x1000>;
>> reg-names = "nand_data", "denali_reg";
>> interrupts = <0 144 4>;
>>   };
>>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best Regards
Masahiro Yamada


Re: [PATCH v4 13/18] fpga: region: add register/unregister functions

2017-09-14 Thread Wu Hao
On Thu, Sep 14, 2017 at 04:48:36AM +0800, Alan Tull wrote:
> Another step in separating common code from device tree specific
> code for FPGA regions.
> 
> * add FPGA region register/unregister functions.
> * add the register/unregister functions to the header
> * use devm_kzalloc to alloc the region.
> * add a method for getting bridges to the region struct
> * add priv to the region struct
> * use region->info in of_fpga_region_get_bridges
> 
> Signed-off-by: Alan Tull 
> ---
> v2: split out from another patch
> v3: use region->info, remove info param where applicable
> v4: no change to this patch in this version of patchset
> ---
>  drivers/fpga/fpga-region.c   | 106 
> ---
>  include/linux/fpga/fpga-region.h |   7 +++
>  2 files changed, 72 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
> index 92ab216..ce57383 100644
> --- a/drivers/fpga/fpga-region.c
> +++ b/drivers/fpga/fpga-region.c
> @@ -143,7 +143,6 @@ static struct fpga_manager *of_fpga_region_get_mgr(struct 
> device_node *np)
>  /**
>   * of_fpga_region_get_bridges - create a list of bridges
>   * @region: FPGA region
> - * @info: FPGA image info
>   *
>   * Create a list of bridges including the parent bridge and the bridges
>   * specified by "fpga-bridges" property.  Note that the
> @@ -156,11 +155,11 @@ static struct fpga_manager 
> *of_fpga_region_get_mgr(struct device_node *np)
>   * Return 0 for success (even if there are no bridges specified)
>   * or -EBUSY if any of the bridges are in use.
>   */
> -static int of_fpga_region_get_bridges(struct fpga_region *region,
> -   struct fpga_image_info *info)
> +static int of_fpga_region_get_bridges(struct fpga_region *region)
>  {
>   struct device *dev = >dev;
>   struct device_node *region_np = dev->of_node;
> + struct fpga_image_info *info = region->info;
>   struct device_node *br, *np, *parent_br = NULL;
>   int i, ret;
>  
> @@ -192,7 +191,7 @@ static int of_fpga_region_get_bridges(struct fpga_region 
> *region,
>   continue;
>  
>   /* If node is a bridge, get it and add to list */
> - ret = of_fpga_bridge_get_to_list(br, region->info,
> + ret = of_fpga_bridge_get_to_list(br, info,
>>bridge_list);
>  
>   /* If any of the bridges are in use, give up */
> @@ -229,10 +228,16 @@ int fpga_region_program_fpga(struct fpga_region *region)
>   goto err_put_region;
>   }
>  
> - ret = of_fpga_region_get_bridges(region, info);
> - if (ret) {
> - dev_err(dev, "failed to get FPGA bridges\n");
> - goto err_unlock_mgr;
> + /*
> +  * In some cases, we already have a list of bridges in the
> +  * fpga region struct.  Or we don't have any bridges.
> +  */
> + if (region->get_bridges) {
> + ret = region->get_bridges(region);
> + if (ret) {
> + dev_err(dev, "failed to get fpga region bridges\n");
> + goto err_unlock_mgr;
> + }
>   }
>  
>   ret = fpga_bridges_disable(>bridge_list);
> @@ -259,7 +264,8 @@ int fpga_region_program_fpga(struct fpga_region *region)
>   return 0;
>  
>  err_put_br:
> - fpga_bridges_put(>bridge_list);
> + if (region->get_bridges)
> + fpga_bridges_put(>bridge_list);
>  err_unlock_mgr:
>   fpga_mgr_unlock(region->mgr);
>  err_put_region:
> @@ -522,39 +528,20 @@ static struct notifier_block fpga_region_of_nb = {
>   .notifier_call = of_fpga_region_notify,
>  };
>  
> -static int of_fpga_region_probe(struct platform_device *pdev)
> +int fpga_region_register(struct device *dev, struct fpga_region *region)
>  {
> - struct device *dev = >dev;
> - struct device_node *np = dev->of_node;
> - struct fpga_region *region;
> - struct fpga_manager *mgr;
>   int id, ret = 0;
>  
> - mgr = of_fpga_region_get_mgr(np);
> - if (IS_ERR(mgr))
> - return -EPROBE_DEFER;
> -
> - region = kzalloc(sizeof(*region), GFP_KERNEL);
> - if (!region) {
> - ret = -ENOMEM;
> - goto err_put_mgr;
> - }
> -
> - region->mgr = mgr;
> -
>   id = ida_simple_get(_region_ida, 0, 0, GFP_KERNEL);
> - if (id < 0) {
> - ret = id;
> - goto err_kfree;
> - }
> + if (id < 0)
> + return id;
>  
>   mutex_init(>mutex);
>   INIT_LIST_HEAD(>bridge_list);
> -
>   device_initialize(>dev);
>   region->dev.class = fpga_region_class;
>   region->dev.parent = dev;
> - region->dev.of_node = np;
> + region->dev.of_node = dev->of_node;
>   region->dev.id = id;
>   dev_set_drvdata(dev, region);
>  
> @@ -566,19 +553,58 @@ static int of_fpga_region_probe(struct platform_device 
> *pdev)
>   if (ret)
>   

Re: [tpmdd-devel] [PATCH v2 2/3] efi: call get_event_log before ExitBootServices

2017-09-14 Thread Javier Martinez Canillas
On 09/11/2017 12:00 PM, Thiebaud Weksteen via tpmdd-devel wrote:
> With TPM 2.0 specification, the event logs may only be accessible by
> calling an EFI Boot Service. Modify the EFI stub to copy the log area to
> a new Linux-specific EFI configuration table so it remains accessible
> once booted.
> 
> When calling this service, it is possible to specify the expected format
> of the logs: TPM 1.2 (SHA1) or TPM 2.0 ("Crypto Agile"). For now, only the
> first format is retrieved.
> 
> Signed-off-by: Thiebaud Weksteen 
> ---

[snip]

> +void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
> +{

[snip]

> +
> + /* Allocate space for the logs and copy them. */
> + status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
> + sizeof(*log_tbl) + log_size,
> + (void **) _tbl);
> +
> + if (status != EFI_SUCCESS) {
> + efi_printk(sys_table_arg,
> +"Unable to allocate memory for event log\n");
> + return;
> + }

If this fails or any previous error that will prevent the event log table + logs
to be allocated, shouldn't tpm_read_log_efi() be notified somehow? Since AFAICT
it will still try to access them even if the EFI allocate_pool did not succeed.

> + */
> +int __init efi_tpm_eventlog_init(void)
> +{
> + struct linux_efi_tpm_eventlog *tbl;
> + unsigned int tbl_size;
> +

The functions efi_retrieve_tpm2_eventlog_1_2() and tpm_read_log_efi() are using
log_tbl as variable name, so I would use it here too for consistency.

> + if (efi.tpm_log == EFI_INVALID_TABLE_ADDR)
> + return 0;
> +
> + tbl = early_memremap(efi.tpm_log, sizeof(*tbl));
> + if (!tbl) {
> + pr_err("Failed to map TPM Event Log table @ 0x%lx\n",
> + efi.tpm_log);
> + return -ENOMEM;
> + }
> +

Same question than before, if this fails then the table + logs memory won't be
reserved but tpm_read_log_efi() will still try to access it. I'm not sure what
is the correct way to notify though, maybe setting efi.tpm_log to 0 and then in
tpm_read_log_efi() check efi.tpm_log for 0 or EFI_INVALID_TABLE_ADDR instead?

> + tbl_size = sizeof(*tbl) + tbl->size;
> + memblock_reserve(efi.tpm_log, tbl_size);
> + early_memunmap(tbl, sizeof(*tbl));
> + return 0;

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat


[PATCH] drivers: of: static DT reservations incorrectly added to dynamic list

2017-09-14 Thread Stewart Smith
There are two types of memory reservations firmware can ask the kernel
to make in the device tree: static and dynamic.
See Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt

If you have greater than 16 entries in /reserved-memory (as we do on
POWER9 systems) you would get this scary looking error message:
[0.00] OF: reserved mem: not enough space all defined regions.

This is harmless if all your reservations are static (which with OPAL on
POWER9, they are).

It is not harmless if you have any dynamic reservations after the 16th.

In the first pass over the fdt to find reservations, the child nodes of
/reserved-memory are added to a static array in of_reserved_mem.c so that
memory can be reserved in a 2nd pass. The array has 16 entries. This is why,
on my dual socket POWER9 system, I get that error 4 times with 20 static
reservations.

We don't have a problem on ppc though, as in arch/powerpc/kernel/prom.c
we look at the new style /reserved-ranges property to do reservations,
and this logic was introduced in 0962e8004e974 (well before any powernv
system shipped).

Google shows up no occurances of that exact error message, so we're probably
safe in that no machine that people use has memory not being reserved when
it should be.

The fix is simple, as there's a different code path for static and dynamic
allocations, we just don't add the region to the list if it's static. Since
it's a static *OR* dynamic region, this is a perfectly valid thing to do
(although I have not checked every real world device tree on the planet
for this condition)

Fixes: 3f0c8206644836e4f10a6b9fc47cda6a9a372f9b
Signed-off-by: Stewart Smith 
---
NOTE: I've done only fairly limited testing of this on POWER, I
certainly haven't tested on ARM or *anything* with dynamic
allocations. So, testing and comments welcome.
---
 drivers/of/fdt.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ce30c9a588a4..a9a44099ed69 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -587,7 +587,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long 
node,
phys_addr_t base, size;
int len;
const __be32 *prop;
-   int nomap, first = 1;
+   int nomap;
 
prop = of_get_flat_dt_prop(node, "reg", );
if (!prop)
@@ -614,10 +614,6 @@ static int __init __reserved_mem_reserve_reg(unsigned long 
node,
uname, , (unsigned long)size / SZ_1M);
 
len -= t_len;
-   if (first) {
-   fdt_reserved_mem_save_node(node, uname, base, size);
-   first = 0;
-   }
}
return 0;
 }
-- 
2.13.5



[tip:core/urgent] watchdog/sysctl: Clean up sysctl variable name space

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  7feeb9cd4f5b34476ffb9e6d58d58c5416375b19
Gitweb: http://git.kernel.org/tip/7feeb9cd4f5b34476ffb9e6d58d58c5416375b19
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:15 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:07 +0200

watchdog/sysctl: Clean up sysctl variable name space

Reflect that these variables are user interface related and remove the
whitespace damage in the sysctl table while at it.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.783210...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/nmi.h | 16 
 kernel/sysctl.c | 16 
 kernel/watchdog.c   | 41 -
 3 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 5774b443..4a8d103 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -17,8 +17,8 @@ void lockup_detector_cleanup(void);
 bool is_hardlockup(void);
 
 extern int watchdog_user_enabled;
-extern int nmi_watchdog_enabled;
-extern int soft_watchdog_enabled;
+extern int nmi_watchdog_user_enabled;
+extern int soft_watchdog_user_enabled;
 extern int watchdog_thresh;
 extern unsigned long watchdog_enabled;
 
@@ -62,12 +62,12 @@ static inline void reset_hung_task_detector(void) { }
  * 'watchdog_enabled' variable. Each lockup detector has its dedicated bit -
  * bit 0 for the hard lockup detector and bit 1 for the soft lockup detector.
  *
- * 'watchdog_user_enabled', 'nmi_watchdog_enabled' and 'soft_watchdog_enabled'
- * are variables that are only used as an 'interface' between the parameters
- * in /proc/sys/kernel and the internal state bits in 'watchdog_enabled'. The
- * 'watchdog_thresh' variable is handled differently because its value is not
- * boolean, and the lockup detectors are 'suspended' while 'watchdog_thresh'
- * is equal zero.
+ * 'watchdog_user_enabled', 'nmi_watchdog_user_enabled' and
+ * 'soft_watchdog_user_enabled' are variables that are only used as an
+ * 'interface' between the parameters in /proc/sys/kernel and the internal
+ * state bits in 'watchdog_enabled'. The 'watchdog_thresh' variable is
+ * handled differently because its value is not boolean, and the lockup
+ * detectors are 'suspended' while 'watchdog_thresh' is equal zero.
  */
 #define NMI_WATCHDOG_ENABLED_BIT   0
 #define SOFT_WATCHDOG_ENABLED_BIT  1
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 539cb4e..4c08ed4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -871,9 +871,9 @@ static struct ctl_table kern_table[] = {
 #if defined(CONFIG_LOCKUP_DETECTOR)
{
.procname   = "watchdog",
-   .data   = _user_enabled,
-   .maxlen = sizeof (int),
-   .mode   = 0644,
+   .data   = _user_enabled,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
.proc_handler   = proc_watchdog,
.extra1 = ,
.extra2 = ,
@@ -889,8 +889,8 @@ static struct ctl_table kern_table[] = {
},
{
.procname   = "nmi_watchdog",
-   .data   = _watchdog_enabled,
-   .maxlen = sizeof (int),
+   .data   = _watchdog_user_enabled,
+   .maxlen = sizeof(int),
.mode   = NMI_WATCHDOG_SYSCTL_PERM,
.proc_handler   = proc_nmi_watchdog,
.extra1 = ,
@@ -906,9 +906,9 @@ static struct ctl_table kern_table[] = {
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
{
.procname   = "soft_watchdog",
-   .data   = _watchdog_enabled,
-   .maxlen = sizeof (int),
-   .mode   = 0644,
+   .data   = _watchdog_user_enabled,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
.proc_handler   = proc_soft_watchdog,
.extra1 = ,
.extra2 = ,
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index ca87472..baae9fc 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -31,8 +31,6 @@
 
 static DEFINE_MUTEX(watchdog_mutex);
 
-int __read_mostly nmi_watchdog_enabled;
-
 #if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG)
 unsigned long __read_mostly watchdog_enabled = SOFT_WATCHDOG_ENABLED |

[tip:core/urgent] watchdog/sysctl: Get rid of the #ifdeffery

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  51d4052b01ca555e0d1d5fe297b309beb6c64aa0
Gitweb: http://git.kernel.org/tip/51d4052b01ca555e0d1d5fe297b309beb6c64aa0
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:14 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:07 +0200

watchdog/sysctl: Get rid of the #ifdeffery

The sysctl of the nmi_watchdog file prevents writes by setting:

min = max = 0

if none of the users is enabled. That involves ifdeffery and is competely
non obvious.

If none of the facilities is enabeld, then the file can simply be made read
only. Move the ifdeffery into the header and use a constant for file
permissions.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.706073...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/nmi.h | 6 ++
 kernel/sysctl.c | 6 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index cfebb3b..5774b443 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -81,6 +81,12 @@ extern unsigned int hardlockup_panic;
 static inline void hardlockup_detector_disable(void) {}
 #endif
 
+#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
+# define NMI_WATCHDOG_SYSCTL_PERM  0644
+#else
+# define NMI_WATCHDOG_SYSCTL_PERM  0444
+#endif
+
 #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
 extern void arch_touch_nmi_watchdog(void);
 extern void hardlockup_detector_perf_stop(void);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6648fbb..539cb4e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -891,14 +891,10 @@ static struct ctl_table kern_table[] = {
.procname   = "nmi_watchdog",
.data   = _watchdog_enabled,
.maxlen = sizeof (int),
-   .mode   = 0644,
+   .mode   = NMI_WATCHDOG_SYSCTL_PERM,
.proc_handler   = proc_nmi_watchdog,
.extra1 = ,
-#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)
.extra2 = ,
-#else
-   .extra2 = ,
-#endif
},
{
.procname   = "watchdog_cpumask",


Re: [PATCH] block,bfq: Disable writeback throttling

2017-09-14 Thread oleksandr

Tested-by: Oleksandr Natalenko 


Similarly to CFQ, BFQ has its write-throttling heuristics, and it
is better not to combine them with further write-throttling
heuristics of a different nature.
So this commit disables write-back throttling for a device if BFQ
is used as I/O scheduler for that device.

Signed-off-by: Luca Miccio 
Signed-off-by: Paolo Valente 
---
 block/bfq-iosched.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


[PATCH] net: phy: Fix mask value write on gmii2rgmii converter speed register.

2017-09-14 Thread Fahad Kunnathadi
To clear Speed Selection in MDIO control register(0x10),
ie, clear bits 6 and 13 to zero while keeping other bits same.
Before AND operation,The Mask value has to be perform with bitwise NOT
operation (ie, ~ operator)

This patch clears current speed selection before writing the
new speed settings to gmii2rgmii converter

Signed-off-by: Fahad Kunnathadi 
---
 drivers/net/phy/xilinx_gmii2rgmii.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c 
b/drivers/net/phy/xilinx_gmii2rgmii.c
index d15dd39..2e5150b 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -44,7 +44,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
priv->phy_drv->read_status(phydev);
 
val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG);
-   val &= XILINX_GMII2RGMII_SPEED_MASK;
+   val &= ~XILINX_GMII2RGMII_SPEED_MASK;
 
if (phydev->speed == SPEED_1000)
val |= BMCR_SPEED1000;
-- 
1.9.1



Re: [PATCH v3 2/3] mmc: sdhci-omap: Add OMAP SDHCI driver

2017-09-14 Thread Adrian Hunter
On 06/09/17 14:45, Kishon Vijay Abraham I wrote:
> Create a new sdhci-omap driver to configure the eMMC/SD/SDIO controller
> in TI's OMAP SoCs making use of the SDHCI core library. For OMAP specific
> configurations, populate sdhci_ops with OMAP specific callbacks and use
> SDHCI quirks.
> Enable only high speed mode for both SD and eMMC here and add other
> UHS mode support later.
> 
> Signed-off-by: Kishon Vijay Abraham I 

Acked-by: Adrian Hunter 


Re: [PATCH] dt-bindings: nand: denali: reduce the register space in the example

2017-09-14 Thread Oleksij Rempel

Hi,

i assume arch/arm/boot/dts/socfpga.dtsi should be update as well. Right?

On 14.09.2017 09:17, Masahiro Yamada wrote:

This example allocates too much for register regions.  Especially,
there are only two registers in the "nand_data" interface of this
hardware (ADDR: 0x00, DATA: 0x10).

Signed-off-by: Masahiro Yamada 
---

  Documentation/devicetree/bindings/mtd/denali-nand.txt | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt 
b/Documentation/devicetree/bindings/mtd/denali-nand.txt
index 504291d..0ee8edb 100644
--- a/Documentation/devicetree/bindings/mtd/denali-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt
@@ -29,7 +29,7 @@ nand: nand@ff90 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "altr,socfpga-denali-nand";
-   reg = <0xff90 0x10>, <0xffb8 0x1>;
+   reg = <0xff90 0x20>, <0xffb8 0x1000>;
reg-names = "nand_data", "denali_reg";
interrupts = <0 144 4>;
  };



[PATCH v1 2/2] ARM: socfpga: dtsi: add dw-wdt reset lines

2017-09-14 Thread Oleksij Rempel
From: Steffen Trumtrar 

Signed-off-by: Steffen Trumtrar 
Signed-off-by: Oleksij Rempel 
Cc: Dinh Nguyen 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm/boot/dts/socfpga.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 7e24dc8e82d4..6e49cee084b8 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -924,6 +924,7 @@
reg = <0xffd02000 0x1000>;
interrupts = <0 171 4>;
clocks = <>;
+   resets = < L4WD0_RESET>;
status = "disabled";
};
 
@@ -932,6 +933,7 @@
reg = <0xffd03000 0x1000>;
interrupts = <0 172 4>;
clocks = <>;
+   resets = < L4WD1_RESET>;
status = "disabled";
};
};
-- 
2.11.0



[PATCH v1 1/2] watchdog: dw_wdt: add stop watchdog operation

2017-09-14 Thread Oleksij Rempel
From: Steffen Trumtrar 

The only way of stopping the watchdog is by resetting it.
Add the watchdog op for stopping the device and reset if
a reset line is provided.

Signed-off-by: Steffen Trumtrar 
Signed-off-by: Oleksij Rempel 
Cc: Wim Van Sebroeck 
Cc: Guenter Roeck 
Cc: linux-watch...@vger.kernel.org
---
 drivers/watchdog/dw_wdt.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 36be987ff9ef..50d8a6a5b5ac 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -135,6 +135,21 @@ static int dw_wdt_start(struct watchdog_device *wdd)
return 0;
 }
 
+static int dw_wdt_stop(struct watchdog_device *wdd)
+{
+   struct dw_wdt *dw_wdt = to_dw_wdt(wdd);
+
+   if (IS_ERR(dw_wdt->rst)) {
+   dev_warn(wdd->parent, "No reset line. Will not stop.\n");
+   return PTR_ERR(dw_wdt->rst);
+   }
+
+   reset_control_assert(dw_wdt->rst);
+   reset_control_deassert(dw_wdt->rst);
+
+   return 0;
+}
+
 static int dw_wdt_restart(struct watchdog_device *wdd,
  unsigned long action, void *data)
 {
@@ -173,6 +188,7 @@ static const struct watchdog_info dw_wdt_ident = {
 static const struct watchdog_ops dw_wdt_ops = {
.owner  = THIS_MODULE,
.start  = dw_wdt_start,
+   .stop   = dw_wdt_stop,
.ping   = dw_wdt_ping,
.set_timeout= dw_wdt_set_timeout,
.get_timeleft   = dw_wdt_get_timeleft,
-- 
2.11.0



Re: [PATCH 00/14] Fix wrong %pF and %pS printk format specifier usages

2017-09-14 Thread Helge Deller

On 14.09.2017 10:03, Sergey Senozhatsky wrote:

On (09/14/17 16:40), Sergey Senozhatsky wrote:
[..]

powerpc and parisc handle kernel .opd section as well:

arch/powerpc/kernel/vmlinux.lds.S:  .opd
arch/parisc/kernel/vmlinux.lds.S:   .opd


for modules, arch-s define mod_arch_specific struct.

parisc has .opd

(fdesc offset should be the start of .opd,
  fdesc_offset + sizeof(fdesc) * fdesc_count should be the .opd address range)

struct mod_arch_specific
{
 unsigned long got_offset, got_count, got_max;
 unsigned long fdesc_offset, fdesc_count, fdesc_max;
 struct {
 unsigned long stub_offset;
 unsigned int stub_entries;
 } *section;
 int unwind_section;
 struct unwind_table *unwind;
};


ia64 has .opd

struct mod_arch_specific {
 struct elf64_shdr *core_plt;/* core PLT section */
 struct elf64_shdr *init_plt;/* init PLT section */
 struct elf64_shdr *got; /* global offset table */
 struct elf64_shdr *opd; /* official procedure descriptors */
 struct elf64_shdr *unwind;  /* unwind-table section */
 unsigned long gp;   /* global-pointer for module */

 void *core_unw_table;   /* core unwind-table cookie returned 
by unwinder */
 void *init_unw_table;   /* init unwind-table cookie returned 
by unwinder */
 unsigned int next_got_entry;/* index of next available got entry */
};


powerpc does not keep track of .opd, need to add

struct mod_arch_specific {
#ifdef __powerpc64__
 unsigned int stubs_section; /* Index of stubs section in module */
 unsigned int toc_section;   /* What section is the TOC? */
 bool toc_fixed; /* Have we fixed up .TOC.? */
#ifdef CONFIG_DYNAMIC_FTRACE
 unsigned long toc;
 unsigned long tramp;
#endif

#else /* powerpc64 */
 /* Indices of PLT sections within module. */
 unsigned int core_plt_section;
 unsigned int init_plt_section;
#ifdef CONFIG_DYNAMIC_FTRACE
 unsigned long tramp;
#endif
#endif /* powerpc64 */

 /* List of BUG addresses, source line numbers and filenames */
 struct list_head bug_list;
 struct bug_entry *bug_table;
 unsigned int num_bugs;
};


seems like we are looking at a solution here.

thoughts?


The basic concept of your proposal may work, and since it will avoid such
coding issues in the future I think it's probably the best solution.

Will you come up with a patch ? (I won't have time the next few days).
If yes,I'd be happy to test it on parisc.

Helge


Re: [PATCH v2] net: smsc911x: Quieten netif during suspend

2017-09-14 Thread Geert Uytterhoeven
Hi Florian,

On Thu, Sep 14, 2017 at 1:28 AM, Florian Fainelli  wrote:
> On 09/13/2017 10:42 AM, Geert Uytterhoeven wrote:
>> If the network interface is kept running during suspend, the net core
>> may call net_device_ops.ndo_start_xmit() while the Ethernet device is
>> still suspended, which may lead to a system crash.
>>
>> E.g. on sh73a0/kzm9g and r8a73a4/ape6evm, the external Ethernet chip is
>> driven by a PM controlled clock.  If the Ethernet registers are accessed
>> while the clock is not running, the system will crash with an imprecise
>> external abort.
>>
>> As this is a race condition with a small time window, it is not so easy
>> to trigger at will.  Using pm_test may increase your chances:
>>
>> # echo 0 > /sys/module/printk/parameters/console_suspend
>> # echo platform > /sys/power/pm_test
>> # echo mem > /sys/power/state
>>
>> To fix this, make sure the network interface is quietened during
>> suspend.
>>
>> Signed-off-by: Geert Uytterhoeven 

> Reviewed-by: Florian Fainelli 

Thank you!

> You may want to take the opportunity to suspend the PHY device
> (conversely resume it) if WoL is not enabled on this device.

Despite the WoL comment visible in the context below, I believe this driver
doesn't support WoL yet (ethtool_ops.[gs]et_wol() not implemented).

>> --- a/drivers/net/ethernet/smsc/smsc911x.c
>> +++ b/drivers/net/ethernet/smsc/smsc911x.c
>> @@ -2595,6 +2595,11 @@ static int smsc911x_suspend(struct device *dev)
>>   struct net_device *ndev = dev_get_drvdata(dev);
>>   struct smsc911x_data *pdata = netdev_priv(ndev);
>>
>> + if (netif_running(ndev)) {
>> + netif_stop_queue(ndev);
>> + netif_device_detach(ndev);
>> + }
>> +
>>   /* enable wake on LAN, energy detection and the external PME
>>* signal. */
>>   smsc911x_reg_write(pdata, PMT_CTRL,

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 2/2] mfd: tps65218: Introduce dependency on CONFIG_OF

2017-09-14 Thread Lee Jones
On Wed, 13 Sep 2017, Keerthy wrote:

> Currently the driver boots only via device tree hence add a
> dependency on CONFIG_OF. This leaves with a bunch of unused code
> so clean that up.
> 
> Signed-off-by: Keerthy 
> ---
>  drivers/mfd/Kconfig| 2 +-
>  drivers/mfd/tps65218.c | 8 
>  2 files changed, 1 insertion(+), 9 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH 1/2] mfd: tps65218: Correct the config description

2017-09-14 Thread Lee Jones
On Wed, 13 Sep 2017, Keerthy wrote:

> When the initial support was added for this PMIC was added
> only regulator support was present. Now we have GPIO and Powerbutton
> support as well. Hence correct the description of MFD_TPS65218 config
> option.
> 
> Signed-off-by: Keerthy 
> ---
>  drivers/mfd/Kconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S files

2017-09-14 Thread Ingo Molnar

* Ingo Molnar  wrote:

> 1)
> 
> Note how R12 is used immediately, right in the next instruction:
> 
> vpaddq  (TBL), Y_0, XFER
> 
> I.e. the RBP fixes lengthen the program order data dependencies - that's a 
> new 
> constraint and a few extra cycles per loop iteration if the workload is 
> address-generator bandwidth limited on that.
> 
> A simple way to ease that constraint would be to move the 'TLB' load up into 
> the 
> loop, body, to the point where 'T1' is used for the last time - which is:
> 
> 
> mov a, T1   # T1 = a# MAJB
> and c, T1   # T1 = a  # MAJB
> 
> add y0, y2  # y2 = S1 + CH  # --
> or  T1, y3  # y3 = MAJ = (a|c))|(a) # MAJ
> 
> +   mov frame_TBL(%rsp), TBL
> 
> add y1, h   # h = k + w + h + S0# --
> 
> add y2, d   # d = k + w + h + d + S1 + CH = d + t1  # --
> 
> add y2, h   # h = k + w + h + S0 + S1 + CH = t1 + S0# --
> add y3, h   # h = t1 + S0 + MAJ # --
> 
> Note how this moves up the 'TLB' reload by 4 instructions.

Note that in this case 'TBL' would have to be initialized before the 1st 
iteration, via something like:

movq$4, frame_SRND(%rsp)

+   mov frame_TBL(%rsp), TBL

.align 16
loop1:
vpaddq  (TBL), Y_0, XFER
vmovdqa XFER, frame_XFER(%rsp)
FOUR_ROUNDS_AND_SCHED

Thanks,

Ingo


Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks

2017-09-14 Thread Nicolas Ferre
On 14/09/2017 at 09:41, romain izard wrote:
> 2017-09-13 19:03 GMT+02:00 Alexandre Belloni
> :
>> On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote:
>>> On 08/09/2017 at 17:35, Romain Izard wrote:
 From: Romain Izard 

 Save and restore the System Clock and Programmable Clock register for
 the backup use case.
>>>
>>> "System Clock" seems to be handled in another patch.
>>>
 Signed-off-by: Romain Izard 
 ---
  drivers/clk/at91/pmc.c | 5 +
  1 file changed, 5 insertions(+)

 diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
 index 07dc2861ad3f..5421b03553ec 100644
 --- a/drivers/clk/at91/pmc.c
 +++ b/drivers/clk/at91/pmc.c
 @@ -66,6 +66,7 @@ static struct
 u32 pcr[PMC_MAX_IDS];
 u32 audio_pll0;
 u32 audio_pll1;
 +   u32 pckr[3];
>>>
>>> Some products have different numbers of PCK (only 2 on at91sam9x5 for
>>> instance)...
>>>
>>
>> My opinion is that it will be time to change that when multiple SoCs will
>> need to save their registers.
>>
> For the next version, I'll add a #define. But as this code requires a
> device tree node with the compatible string "atmel,sama5d2-pmc", I believe
> that we can ignore other chips for now.

Fair enough, let's go for this.

Bye,
-- 
Nicolas Ferre


Re: [PATCH] checkpatch: support function pointers for unnamed function definition arguments

2017-09-14 Thread Miles Chen
On Wed, 2017-09-13 at 22:33 -0700, Joe Perches wrote:
> On Thu, 2017-09-14 at 11:01 +0800, Miles Chen wrote:
> > Current unnamed function definition argument does not include function
> > pointer cases and it reports warnings like:
> > 
> > WARNING: function definition argument 'void' should also have an identifier 
> > name
> 
> > 
> > Support function pointers for unnamed function arguments.
> > 
> > Signed-off-by: Miles Chen 
> > ---
> >  scripts/checkpatch.pl | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index dd2c262..dc6da15 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5957,7 +5957,7 @@ sub process {
> >  
> >  # check for function declarations that have arguments without identifier 
> > names
> > if (defined $stat &&
> > -   $stat =~ 
> > /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
> > +   $stat =~ 
> > /^.\s*(?:extern\s+)?$Type\s*\(?\s*\*?\s*$Ident\s*\)\s*\(\s*([^{]+)\s*\)\s*;/s
> >  &&
> 
> Better would be to specifically support function pointers like:
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 05dd72693621..7289c1eb0b19 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5957,7 +5957,7 @@ sub process {
>  
>  # check for function declarations that have arguments without identifier 
> names
>   if (defined $stat &&
> - $stat =~ 
> /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s &&
> + $stat =~ 
> /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s
>  &&

Hi Joe,

thanks for the advise, it looks better.
I'll verify this patch and submit it again

Miles
>   $1 ne "void") {
>   my $args = trim($1);
>   while ($args =~ 
> m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
> 




Re: [RFC Part2 PATCH v3 18/26] KVM: SVM: Add support for SEV LAUNCH_FINISH command

2017-09-14 Thread Borislav Petkov
On Mon, Jul 24, 2017 at 03:02:55PM -0500, Brijesh Singh wrote:
> The command is used for finializing the SEV guest launch process.
> 
> Signed-off-by: Brijesh Singh 
> ---
>  arch/x86/kvm/svm.c | 23 +++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 9b672eb..7a77197 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -6005,6 +6005,25 @@ static int sev_launch_measure(struct kvm *kvm, struct 
> kvm_sev_cmd *argp)
>   return ret;
>  }
>  
> +static int sev_launch_finish(struct kvm *kvm, struct kvm_sev_cmd *argp)
> +{
> + struct sev_data_launch_finish *data;

This one is a very good example why you should do this on the stack:
this struct has a single u32 handle; member. The amount of operations to
do kzalloc and kfree for a single u32 are simply not justified.

-- 
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 
(AG Nürnberg)
-- 


[PATCH 0/5] lightnvm: pblk: audit mempool usage

2017-09-14 Thread Javier González
As suggested by Jens [1], I audited all mempools on pblk.

This patche series (i) fixes bad mempool allocations that did not
guarantee forward progress and downsizes the sizes of some overused
mempools, (ii) removes unnecessary checks, and (iii) eliminates some
mempools that where introduced in early versions of pblk.

[1] https://patchwork.kernel.org/patch/9940973/

Javier González (5):
  lightnvm: pblk: fix min size for page mempool
  lightnvm: pblk: simplify work_queue mempool
  lightnvm: pblk: decouple read/erase mempools
  lightnvm: pblk: do not use a mempool for line bitmaps
  lightnvm: pblk: remove checks on mempool alloc.

 drivers/lightnvm/pblk-core.c | 61 ++
 drivers/lightnvm/pblk-gc.c   | 32 +++---
 drivers/lightnvm/pblk-init.c | 94 +---
 drivers/lightnvm/pblk-read.c | 10 +
 drivers/lightnvm/pblk-recovery.c | 37 
 drivers/lightnvm/pblk-write.c| 32 --
 drivers/lightnvm/pblk.h  | 21 +
 7 files changed, 106 insertions(+), 181 deletions(-)

-- 
2.7.4



[PATCH 6/8] [media] ttusb_dec: Reduce the scope for three variables in ttusb_dec_process_urb()

2017-09-14 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 13 Sep 2017 21:23:29 +0200

* Move the definition for the local variables "b", "d" and "length" into
  an if branch so that the corresponding setting will only be performed
  if a memory allocation succeeded in this function.

* Adjust their data types.

Signed-off-by: Markus Elfring 
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c 
b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 7759de653ee9..e9fe4c6142a5 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -812,19 +812,18 @@ static void ttusb_dec_process_urb(struct urb *urb)
int i;
 
for (i = 0; i < FRAMES_PER_ISO_BUF; i++) {
-   struct usb_iso_packet_descriptor *d;
-   u8 *b;
-   int length;
struct urb_frame *frame;
 
-   d = >iso_frame_desc[i];
-   b = urb->transfer_buffer + d->offset;
-   length = d->actual_length;
-
frame = kmalloc(sizeof(*frame), GFP_ATOMIC);
if (frame) {
unsigned long flags;
+   struct usb_iso_packet_descriptor const *d;
+   u8 const *b;
+   unsigned int length;
 
+   d = >iso_frame_desc[i];
+   b = urb->transfer_buffer + d->offset;
+   length = d->actual_length;
memcpy(frame->data, b, length);
frame->length = length;
 
-- 
2.14.1



[PATCH 0/1] libata: Add new med_power_with_dipm link_power_management_policy setting

2017-09-14 Thread Hans de Goede
Hi All,

As described by Matthew Garret quite a while back:
https://mjg59.dreamwidth.org/34868.html

On Intel CPUs starting with the Haswell generation SATA link power
management can save a significant amount of power.

Previous attempts to try and enable SATA LPM by default have gotten stuck
on ome reports of some disks / SSDs not liking min_power leading to system
crashes and in some cases even data corruption has been reported.

This patch is another attempt to make the default Windows IRST driver
settings Matthew found available under Linux, but instead of changing
medium_power and potentially introducing regressions, this commit adds
a new med_power_with_dipm setting.

I've done a blog post asking people to test this new settings on laptops:
https://hansdegoede.livejournal.com/18412.html

As mentioned there my goal is to enable med_power_with_dipm as default
LPM setting for laptops for Fedora 28 (to be released aprox. May 2018).

How exactly this will be done is still up for debate, one option would
be a kernel patch which recognizes the mobile variant of Intel's chipset
and changes the default on those, another option is punting this to
userspace.

Regards,

Hans


[PATCH 1/5] lightnvm: pblk: fix min size for page mempool

2017-09-14 Thread Javier González
pblk uses an internal page mempool for allocating pages on internal
bios. The main two users of this memory pool are partial reads (reads
with some sectors in cache and some on media) and padded writes, which
need to add dummy pages to an existing bio already containing valid
data (and with a large enough bioset allocated). In both cases, the
maximum number of pages per bio is defined by the maximum number of
physical sectors supported by the underlying device.

This patch fixes a bad mempool allocation, where the min_nr of elements
on the pool was fixed (to 16), which is lower than the maximum number
of sectors supported by NVMe (as of the time for this patch). Instead,
use the maximum number of allowed sectors reported by the device.

Reported-by: Jens Axboe 
Signed-off-by: Javier González 
---
 drivers/lightnvm/pblk-core.c |  6 +++---
 drivers/lightnvm/pblk-init.c | 15 ---
 drivers/lightnvm/pblk-read.c |  2 +-
 drivers/lightnvm/pblk.h  |  2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 84bff271abd8..b114b57af0c3 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -194,7 +194,7 @@ void pblk_bio_free_pages(struct pblk *pblk, struct bio 
*bio, int off,
 
for (i = off; i < nr_pages + off; i++) {
bv = bio->bi_io_vec[i];
-   mempool_free(bv.bv_page, pblk->page_pool);
+   mempool_free(bv.bv_page, pblk->page_bio_pool);
}
 }
 
@@ -206,14 +206,14 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio 
*bio, gfp_t flags,
int i, ret;
 
for (i = 0; i < nr_pages; i++) {
-   page = mempool_alloc(pblk->page_pool, flags);
+   page = mempool_alloc(pblk->page_bio_pool, flags);
if (!page)
goto err;
 
ret = bio_add_pc_page(q, bio, page, PBLK_EXPOSED_PAGE_SIZE, 0);
if (ret != PBLK_EXPOSED_PAGE_SIZE) {
pr_err("pblk: could not add page to bio\n");
-   mempool_free(page, pblk->page_pool);
+   mempool_free(page, pblk->page_bio_pool);
goto err;
}
}
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 12c05aebac16..19cb1906a56a 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -132,7 +132,6 @@ static int pblk_rwb_init(struct pblk *pblk)
 }
 
 /* Minimum pages needed within a lun */
-#define PAGE_POOL_SIZE 16
 #define ADDR_POOL_SIZE 64
 
 static int pblk_set_ppaf(struct pblk *pblk)
@@ -247,14 +246,16 @@ static int pblk_core_init(struct pblk *pblk)
if (pblk_init_global_caches(pblk))
return -ENOMEM;
 
-   pblk->page_pool = mempool_create_page_pool(PAGE_POOL_SIZE, 0);
-   if (!pblk->page_pool)
+   /* internal bios can be at most the sectors signaled by the device. */
+   pblk->page_bio_pool = mempool_create_page_pool(nvm_max_phys_sects(dev),
+   0);
+   if (!pblk->page_bio_pool)
return -ENOMEM;
 
pblk->line_ws_pool = mempool_create_slab_pool(PBLK_WS_POOL_SIZE,
pblk_blk_ws_cache);
if (!pblk->line_ws_pool)
-   goto free_page_pool;
+   goto free_page_bio_pool;
 
pblk->rec_pool = mempool_create_slab_pool(geo->nr_luns, pblk_rec_cache);
if (!pblk->rec_pool)
@@ -309,8 +310,8 @@ static int pblk_core_init(struct pblk *pblk)
mempool_destroy(pblk->rec_pool);
 free_blk_ws_pool:
mempool_destroy(pblk->line_ws_pool);
-free_page_pool:
-   mempool_destroy(pblk->page_pool);
+free_page_bio_pool:
+   mempool_destroy(pblk->page_bio_pool);
return -ENOMEM;
 }
 
@@ -322,7 +323,7 @@ static void pblk_core_free(struct pblk *pblk)
if (pblk->bb_wq)
destroy_workqueue(pblk->bb_wq);
 
-   mempool_destroy(pblk->page_pool);
+   mempool_destroy(pblk->page_bio_pool);
mempool_destroy(pblk->line_ws_pool);
mempool_destroy(pblk->rec_pool);
mempool_destroy(pblk->g_rq_pool);
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index ee8efb55b330..402c732f0970 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -238,7 +238,7 @@ static int pblk_fill_partial_read_bio(struct pblk *pblk, 
struct nvm_rq *rqd,
kunmap_atomic(src_p);
kunmap_atomic(dst_p);
 
-   mempool_free(src_bv.bv_page, pblk->page_pool);
+   mempool_free(src_bv.bv_page, pblk->page_bio_pool);
 
hole = find_next_zero_bit(read_bitmap, nr_secs, hole + 1);
} while (hole < nr_secs);
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 

[PATCH 5/8] [media] ttusb_dec: Move an assignment in ttusb_dec_probe()

2017-09-14 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 13 Sep 2017 20:32:25 +0200

Assign a pointer to a data structure member without using an intermediate
local variable.

Signed-off-by: Markus Elfring 
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c 
b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 26d637684b30..7759de653ee9 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -1650,14 +1650,10 @@ static const struct ttusbdecfe_config fe_config = {
 static int ttusb_dec_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
 {
-   struct usb_device *udev;
struct ttusb_dec *dec;
int result;
 
dprintk("%s\n", __func__);
-
-   udev = interface_to_usbdev(intf);
-
dec = kzalloc(sizeof(*dec), GFP_KERNEL);
if (!dec)
return -ENOMEM;
@@ -1678,7 +1674,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
break;
}
 
-   dec->udev = udev;
+   dec->udev = interface_to_usbdev(intf);
 
result = ttusb_dec_init_usb(dec);
if (result)
-- 
2.14.1



[tip:core/urgent] perf/x86/intel, watchdog/core: Sanitize PMU HT bug workaround

2017-09-14 Thread tip-bot for Peter Zijlstra
Commit-ID:  2406e3b166eee42777a6b0b38f52f924454474d7
Gitweb: http://git.kernel.org/tip/2406e3b166eee42777a6b0b38f52f924454474d7
Author: Peter Zijlstra 
AuthorDate: Tue, 12 Sep 2017 21:36:56 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:03 +0200

perf/x86/intel, watchdog/core: Sanitize PMU HT bug workaround

The lockup_detector_suspend/resume() interface is broken in several ways
especially as it results in recursive locking of the CPU hotplug lock.

Use the new stop/restart interface in the perf NMI watchdog to temporarily
disable and reenable the already active watchdog events. That's enough to
handle it.

Signed-off-by: Peter Zijlstra 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.247141...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 arch/x86/events/intel/core.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 829e89c..9fb9a1f 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4409,10 +4409,9 @@ static __init int fixup_ht_bug(void)
return 0;
}
 
-   if (lockup_detector_suspend() != 0) {
-   pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 
workaround\n");
-   return 0;
-   }
+   cpus_read_lock();
+
+   hardlockup_detector_perf_stop();
 
x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED);
 
@@ -4420,9 +4419,7 @@ static __init int fixup_ht_bug(void)
x86_pmu.commit_scheduling = NULL;
x86_pmu.stop_scheduling = NULL;
 
-   lockup_detector_resume();
-
-   cpus_read_lock();
+   hardlockup_detector_perf_restart();
 
for_each_online_cpu(c)
free_excl_cntrs(c);


[tip:core/urgent] watchdog/core: Provide interface to stop from poweroff()

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  6554fd8cf06db86f861bb24d7487b2873ca444c4
Gitweb: http://git.kernel.org/tip/6554fd8cf06db86f861bb24d7487b2873ca444c4
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:36:57 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:03 +0200

watchdog/core: Provide interface to stop from poweroff()

PARISC has a a busy looping power off routine. If the watchdog is enabled
the watchdog timer will still fire, but the thread is not running, which
causes the softlockup watchdog to trigger.

Provide a interface which allows to turn the watchdog off.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Helge Deller 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Cc: linux-par...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170912194146.327343...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/nmi.h |  6 +++---
 kernel/watchdog.c   | 14 +-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index b24d4a5..85bb268b 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -12,10 +12,10 @@
 
 #ifdef CONFIG_LOCKUP_DETECTOR
 void lockup_detector_init(void);
+void lockup_detector_soft_poweroff(void);
 #else
-static inline void lockup_detector_init(void)
-{
-}
+static inline void lockup_detector_init(void) { }
+static inline void lockup_detector_soft_poweroff(void) { }
 #endif
 
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index f5d5202..f23e373 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -333,7 +333,8 @@ static enum hrtimer_restart watchdog_timer_fn(struct 
hrtimer *hrtimer)
int duration;
int softlockup_all_cpu_backtrace = sysctl_softlockup_all_cpu_backtrace;
 
-   if (atomic_read(_park_in_progress) != 0)
+   if (!watchdog_enabled ||
+   atomic_read(_park_in_progress) != 0)
return HRTIMER_NORESTART;
 
/* kick the hardlockup detector */
@@ -660,6 +661,17 @@ static void set_sample_period(void)
 }
 #endif /* SOFTLOCKUP */
 
+/**
+ * lockup_detector_soft_poweroff - Interface to stop lockup detector(s)
+ *
+ * Special interface for parisc. It prevents lockup detector warnings from
+ * the default pm_poweroff() function which busy loops forever.
+ */
+void lockup_detector_soft_poweroff(void)
+{
+   watchdog_enabled = 0;
+}
+
 /*
  * Suspend the hard and soft lockup detector by parking the watchdog threads.
  */


[tip:core/urgent] watchdog/hardlockup: Provide interface to stop/restart perf events

2017-09-14 Thread tip-bot for Peter Zijlstra
Commit-ID:  d0b6e0a8ef24b1b07078ababe5d91bcdf4f4264a
Gitweb: http://git.kernel.org/tip/d0b6e0a8ef24b1b07078ababe5d91bcdf4f4264a
Author: Peter Zijlstra 
AuthorDate: Tue, 12 Sep 2017 21:36:55 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:03 +0200

watchdog/hardlockup: Provide interface to stop/restart perf events

Provide an interface to stop and restart perf NMI watchdog events on all
CPUs. This is only usable during init and especially for handling the perf
HT bug on Intel machines. It's safe to use it this way as nothing can
start/stop the NMI watchdog in parallel.

Signed-off-by: Peter Zijlstra 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194146.167649...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/nmi.h   |  4 
 kernel/watchdog_hld.c | 41 +
 2 files changed, 45 insertions(+)

diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index a36abe2..b24d4a5 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -75,7 +75,11 @@ static inline void hardlockup_detector_disable(void) {}
 
 #if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
 extern void arch_touch_nmi_watchdog(void);
+extern void hardlockup_detector_perf_stop(void);
+extern void hardlockup_detector_perf_restart(void);
 #else
+static inline void hardlockup_detector_perf_stop(void) { }
+static inline void hardlockup_detector_perf_restart(void) { }
 #if !defined(CONFIG_HAVE_NMI_WATCHDOG)
 static inline void arch_touch_nmi_watchdog(void) {}
 #endif
diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 3a09ea1..c9586eb 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -261,3 +261,44 @@ void watchdog_nmi_disable(unsigned int cpu)
firstcpu_err = 0;
}
 }
+
+/**
+ * hardlockup_detector_perf_stop - Globally stop watchdog events
+ *
+ * Special interface for x86 to handle the perf HT bug.
+ */
+void __init hardlockup_detector_perf_stop(void)
+{
+   int cpu;
+
+   lockdep_assert_cpus_held();
+
+   for_each_online_cpu(cpu) {
+   struct perf_event *event = per_cpu(watchdog_ev, cpu);
+
+   if (event)
+   perf_event_disable(event);
+   }
+}
+
+/**
+ * hardlockup_detector_perf_restart - Globally restart watchdog events
+ *
+ * Special interface for x86 to handle the perf HT bug.
+ */
+void __init hardlockup_detector_perf_restart(void)
+{
+   int cpu;
+
+   lockdep_assert_cpus_held();
+
+   if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED))
+   return;
+
+   for_each_online_cpu(cpu) {
+   struct perf_event *event = per_cpu(watchdog_ev, cpu);
+
+   if (event)
+   perf_event_enable(event);
+   }
+}


[tip:core/urgent] parisc, watchdog/core: Use lockup_detector_stop()

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  47bb4baf7df43ac8bbc51c24022466972ba29ef1
Gitweb: http://git.kernel.org/tip/47bb4baf7df43ac8bbc51c24022466972ba29ef1
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:36:58 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:03 +0200

parisc, watchdog/core: Use lockup_detector_stop()

The broken lockup_detector_suspend/resume() interface is going away. Use
the new lockup_detector_soft_poweroff() interface to stop the watchdog from
the busy looping power off routine.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Helge Deller 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Cc: linux-par...@vger.kernel.org
Link: http://lkml.kernel.org/r/20170912194146.407385...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 arch/parisc/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index a45a67d..30f9239 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -146,7 +146,7 @@ void machine_power_off(void)
 
/* prevent soft lockup/stalled CPU messages for endless loop. */
rcu_sysrq_start();
-   lockup_detector_suspend();
+   lockup_detector_soft_poweroff();
for (;;);
 }
 


[PATCH] selftests: intel_pstate: compile programs if executable not found

2017-09-14 Thread naresh . kamboju
From: Naresh Kamboju 

Test exit due to aperf.c: No such file or directory
./run.sh
gcc: error: aperf.c: No such file or directory
Problem compiling aperf.c.

The Makefile installs executable programs "aperf" and "msr"
so skip compile on target.

Signed-off-by: Naresh Kamboju 
---
 tools/testing/selftests/intel_pstate/run.sh | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/intel_pstate/run.sh 
b/tools/testing/selftests/intel_pstate/run.sh
index 7868c106b8b1..2149b9b5876a 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -31,11 +31,16 @@ EVALUATE_ONLY=0
 
 max_cpus=$(($(nproc)-1))
 
-# compile programs
-gcc aperf.c -Wall -D_GNU_SOURCE -o aperf  -lm
-[ $? -ne 0 ] && echo "Problem compiling aperf.c." && exit 1
-gcc -o msr msr.c -lm
-[ $? -ne 0 ] && echo "Problem compiling msr.c." && exit 1
+# Compile programs if executable not found
+if [ ! -x aperf ]; then
+   gcc aperf.c -Wall -D_GNU_SOURCE -o aperf  -lm
+   [ $? -ne 0 ] && echo "Problem compiling aperf.c." && exit 1
+fi
+
+if [ ! -x msr ]; then
+   gcc -o msr msr.c -lm
+   [ $? -ne 0 ] && echo "Problem compiling msr.c." && exit 1
+fi
 
 function run_test () {
 
-- 
2.13.0



[tip:core/urgent] watchdog/core: Get rid of the thread teardown/setup dance

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  d57108d4f6791291e89d980e7f7a3566c32ab188
Gitweb: http://git.kernel.org/tip/d57108d4f6791291e89d980e7f7a3566c32ab188
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:11 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:06 +0200

watchdog/core: Get rid of the thread teardown/setup dance

The lockup detector reconfiguration tears down all watchdog threads when
the watchdog is disabled and sets them up again when its enabled.

That's a pointless exercise. The watchdog threads are not consuming an
insane amount of resources, so it's enough to set them up at init time and
keep them in parked position when the watchdog is disabled and unpark them
when it is reenabled. The smpboot thread infrastructure takes care of
keeping the force parked threads in place even across cpu hotplug.

Aside of that the code implements the park/unpark facility of smp hotplug
threads on its own, which is even more pointless. We have functionality in
the smpboot thread code to do so.

Use the new thread management functions and get rid of the unholy mess.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.470370...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 190 ++
 1 file changed, 19 insertions(+), 171 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b355183..762d3ed 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -92,13 +92,6 @@ struct cpumask watchdog_cpumask __read_mostly;
 unsigned long *watchdog_cpumask_bits = cpumask_bits(_cpumask);
 
 /*
- * The 'watchdog_running' variable is set to 1 when the watchdog threads
- * are registered/started and is set to 0 when the watchdog threads are
- * unregistered/stopped, so it is an indicator whether the threads exist.
- */
-static int __read_mostly watchdog_running;
-
-/*
  * These functions can be overridden if an architecture implements its
  * own hardlockup detector.
  *
@@ -130,10 +123,6 @@ void __weak watchdog_nmi_reconfigure(void) { }
 
 #ifdef CONFIG_SOFTLOCKUP_DETECTOR
 
-/* Helper for online, unparked cpus. */
-#define for_each_watchdog_cpu(cpu) \
-   for_each_cpu_and((cpu), cpu_online_mask, _cpumask)
-
 /* Global variables, exported for sysctl */
 unsigned int __read_mostly softlockup_panic =
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
@@ -259,11 +248,15 @@ void touch_all_softlockup_watchdogs(void)
int cpu;
 
/*
-* this is done lockless
-* do we care if a 0 races with a timestamp?
-* all it means is the softlock check starts one cycle later
+* watchdog_mutex cannpt be taken here, as this might be called
+* from (soft)interrupt context, so the access to
+* watchdog_allowed_cpumask might race with a concurrent update.
+*
+* The watchdog time stamp can race against a concurrent real
+* update as well, the only side effect might be a cycle delay for
+* the softlockup check.
 */
-   for_each_watchdog_cpu(cpu)
+   for_each_cpu(cpu, _allowed_mask)
per_cpu(watchdog_touch_ts, cpu) = 0;
wq_watchdog_touch(-1);
 }
@@ -303,9 +296,6 @@ static void watchdog_interrupt_count(void)
__this_cpu_inc(hrtimer_interrupts);
 }
 
-static int watchdog_enable_all_cpus(void);
-static void watchdog_disable_all_cpus(void);
-
 /* watchdog kicker functions */
 static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
 {
@@ -498,95 +488,6 @@ static struct smp_hotplug_thread watchdog_threads = {
.unpark = watchdog_enable,
 };
 
-/*
- * park all watchdog threads that are specified in 'watchdog_cpumask'
- *
- * This function returns an error if kthread_park() of a watchdog thread
- * fails. In this situation, the watchdog threads of some CPUs can already
- * be parked and the watchdog threads of other CPUs can still be runnable.
- * Callers are expected to handle this special condition as appropriate in
- * their context.
- *
- * This function may only be called in a context that is protected against
- * races with CPU hotplug - for example, via get_online_cpus().
- */
-static int watchdog_park_threads(void)
-{
-   int cpu, ret = 0;
-
-   for_each_watchdog_cpu(cpu) {
-   ret = kthread_park(per_cpu(softlockup_watchdog, cpu));
-   if (ret)
-   break;
-   }
-   return ret;
-}
-
-/*
- * unpark all watchdog threads that 

[tip:core/urgent] smpboot/threads, watchdog/core: Avoid runtime allocation

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  0d85923c7a81719567311ba0eae8ecb2efd4c8a0
Gitweb: http://git.kernel.org/tip/0d85923c7a81719567311ba0eae8ecb2efd4c8a0
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:09 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:06 +0200

smpboot/threads, watchdog/core: Avoid runtime allocation

smpboot_update_cpumask_threads_percpu() allocates a temporary cpumask at
runtime. This is suboptimal because the call site needs more code size for
proper error handling than a statically allocated temporary mask requires
data size.

Add static temporary cpumask. The function is globaly serialized, so no
further protection required.

Remove the half baken error handling in the watchdog code and get rid of
the export as there are no in tree modular users of that function.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.297288...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 include/linux/smpboot.h |  4 ++--
 kernel/smpboot.c| 22 +++---
 kernel/watchdog.c   | 21 +
 3 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index 12910cf..c149aa7 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -55,7 +55,7 @@ smpboot_register_percpu_thread(struct smp_hotplug_thread 
*plug_thread)
 }
 
 void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
-int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread 
*plug_thread,
-const struct cpumask *);
+void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread 
*plug_thread,
+ const struct cpumask *);
 
 #endif
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 1d71c05..ed7507b 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -344,39 +344,31 @@ EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread);
  * by the client, but only by calling this function.
  * This function can only be called on a registered smp_hotplug_thread.
  */
-int smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread 
*plug_thread,
-const struct cpumask *new)
+void smpboot_update_cpumask_percpu_thread(struct smp_hotplug_thread 
*plug_thread,
+ const struct cpumask *new)
 {
struct cpumask *old = plug_thread->cpumask;
-   cpumask_var_t tmp;
+   static struct cpumask tmp;
unsigned int cpu;
 
-   if (!alloc_cpumask_var(, GFP_KERNEL))
-   return -ENOMEM;
-
get_online_cpus();
mutex_lock(_threads_lock);
 
/* Park threads that were exclusively enabled on the old mask. */
-   cpumask_andnot(tmp, old, new);
-   for_each_cpu_and(cpu, tmp, cpu_online_mask)
+   cpumask_andnot(, old, new);
+   for_each_cpu_and(cpu, , cpu_online_mask)
smpboot_park_thread(plug_thread, cpu);
 
/* Unpark threads that are exclusively enabled on the new mask. */
-   cpumask_andnot(tmp, new, old);
-   for_each_cpu_and(cpu, tmp, cpu_online_mask)
+   cpumask_andnot(, new, old);
+   for_each_cpu_and(cpu, , cpu_online_mask)
smpboot_unpark_thread(plug_thread, cpu);
 
cpumask_copy(old, new);
 
mutex_unlock(_threads_lock);
put_online_cpus();
-
-   free_cpumask_var(tmp);
-
-   return 0;
 }
-EXPORT_SYMBOL_GPL(smpboot_update_cpumask_percpu_thread);
 
 static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = 
ATOMIC_INIT(CPU_POST_DEAD);
 
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index cedf45a..8935a3a 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -787,31 +787,20 @@ out:
return err;
 }
 
-static int watchdog_update_cpus(void)
+static void watchdog_update_cpus(void)
 {
-   if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR)) {
-   return smpboot_update_cpumask_percpu_thread(_threads,
-   _cpumask);
+   if (IS_ENABLED(CONFIG_SOFTLOCKUP_DETECTOR) && watchdog_running) {
+   smpboot_update_cpumask_percpu_thread(_threads,
+_cpumask);
__lockup_detector_cleanup();
}
-   return 0;
 }
 
 static void proc_watchdog_cpumask_update(void)
 {
/* Remove impossible cpus to keep sysctl output clean. */
cpumask_and(_cpumask, _cpumask, cpu_possible_mask);

[tip:core/urgent] watchdog/core: Create new thread handling infrastructure

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  2eb2527f847d1bd8d8fb9db1e8139db5d6eddb36
Gitweb: http://git.kernel.org/tip/2eb2527f847d1bd8d8fb9db1e8139db5d6eddb36
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:10 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:06 +0200

watchdog/core: Create new thread handling infrastructure

The lockup detector reconfiguration tears down all watchdog threads when
the watchdog is disabled and sets them up again when its enabled.

That's a pointless exercise. The watchdog threads are not consuming an
insane amount of resources, so it's enough to set them up at init time and
keep them in parked position when the watchdog is disabled and unpark them
when it is reenabled. The smpboot thread infrastructure takes care of
keeping the force parked threads in place even across cpu hotplug.

Another horrible mechanism are the open coded park/unpark loops which are
used for reconfiguration of the watchdog. The smpboot infrastructure allows
exactly the same via smpboot_update_cpumask_thread_percpu(), which is cpu
hotplug safe. Using that instead of the open coded loops allows to get rid
of the hotplug locking mess in the watchdog code.

Implement a clean infrastructure which allows to replace the open coded
nonsense.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194147.377182...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog.c | 75 +++
 1 file changed, 75 insertions(+)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 8935a3a..b355183 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -139,6 +139,9 @@ unsigned int __read_mostly softlockup_panic =
CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
 int __read_mostly soft_watchdog_enabled;
 
+struct cpumask watchdog_allowed_mask __read_mostly;
+static bool softlockup_threads_initialized __read_mostly;
+
 static u64 __read_mostly sample_period;
 
 static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts);
@@ -584,12 +587,84 @@ static void watchdog_disable_all_cpus(void)
}
 }
 
+static void softlockup_update_smpboot_threads(void)
+{
+   lockdep_assert_held(_mutex);
+
+   if (!softlockup_threads_initialized)
+   return;
+
+   smpboot_update_cpumask_percpu_thread(_threads,
+_allowed_mask);
+   __lockup_detector_cleanup();
+}
+
+/* Temporarily park all watchdog threads */
+static void softlockup_park_all_threads(void)
+{
+   cpumask_clear(_allowed_mask);
+   softlockup_update_smpboot_threads();
+}
+
+/*
+ * Park threads which are not longer enabled and unpark threads which have
+ * been newly enabled.
+ */
+static void softlockup_update_threads(void)
+{
+   cpumask_copy(_allowed_mask, _cpumask);
+   softlockup_update_smpboot_threads();
+}
+
+static void softlockup_reconfigure_threads(bool enabled)
+{
+   softlockup_park_all_threads();
+   set_sample_period();
+   if (enabled)
+   softlockup_update_threads();
+}
+
+/*
+ * Create the watchdog thread infrastructure.
+ *
+ * The threads are not unparked as watchdog_allowed_mask is empty.  When
+ * the threads are sucessfully initialized, take the proper locks and
+ * unpark the threads in the watchdog_cpumask if the watchdog is enabled.
+ */
+static __init void softlockup_init_threads(void)
+{
+   int ret;
+
+   /*
+* If sysctl is off and watchdog got disabled on the command line,
+* nothing to do here.
+*/
+   if (!IS_ENABLED(CONFIG_SYSCTL) &&
+   !(watchdog_enabled && watchdog_thresh))
+   return;
+
+   ret = smpboot_register_percpu_thread_cpumask(_threads,
+_allowed_mask);
+   if (ret) {
+   pr_err("Failed to initialize soft lockup detector threads\n");
+   return;
+   }
+
+   mutex_lock(_mutex);
+   softlockup_threads_initialized = true;
+   softlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh);
+   mutex_unlock(_mutex);
+}
+
 #else /* CONFIG_SOFTLOCKUP_DETECTOR */
 static inline int watchdog_park_threads(void) { return 0; }
 static inline void watchdog_unpark_threads(void) { }
 static inline int watchdog_enable_all_cpus(void) { return 0; }
 static inline void watchdog_disable_all_cpus(void) { }
 static inline void set_sample_period(void) { }
+static inline void softlockup_init_threads(void) { }
+static inline void 

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-14 Thread Willem de Bruijn
On Wed, Sep 13, 2017 at 10:40 PM, nixiaoming  wrote:
> If fanout_add is preempted after running po-> fanout = match
> and before running __fanout_link,
> it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink
>
> so, we need add mutex_lock(_mutex) to __unregister_prot_hook
> or add spin_lock(>bind_lock) before po-> fanout = match
>
> test on linux 4.1.42:
> ./trinity -c setsockopt -C 2 -X &
>
> BUG: failure at net/packet/af_packet.c:1414/__fanout_unlink()!
> Kernel panic - not syncing: BUG!
> CPU: 2 PID: 2271 Comm: trinity-c0 Tainted: GW  O4.1.12 #1
> Hardware name: Hisilicon PhosphorHi1382 FPGA (DT)
> Call trace:
> [] dump_backtrace+0x0/0xf8
> [] show_stack+0x20/0x28
> [] dump_stack+0xac/0xe4
> [] panic+0xf8/0x268
> [] __unregister_prot_hook+0xa0/0x144
> [] packet_set_ring+0x280/0x5b4
> [] packet_setsockopt+0x320/0x950
> [] SyS_setsockopt+0xa4/0xd4
>
> Signed-off-by: nixiaoming 
> Tested-by: wudesheng 
> ---
>  net/packet/af_packet.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 008a45c..0300146 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -365,10 +365,12 @@ static void __unregister_prot_hook(struct sock *sk, 
> bool sync)
>
> po->running = 0;
>
> +   mutex_lock(_mutex);
> if (po->fanout)
> __fanout_unlink(sk, po);
> else
> __dev_remove_pack(>prot_hook);
> +   mutex_unlock(_mutex);
>
> __sock_put(sk);

I happened to be looking at the same or a very similar race, courtesy
of syzkaller. packet_set_ring and fanout_add can race.

I believe that one bug is in fanout_add removing the socket
protocol hook and adding the fanout protocol hook without holding
po->bind_lock.

That lock ensures atomic updates to po->running and the actual
protocol hook. fanout_add tests po->running without holding the lock

   if (!po->running)
goto out;

and later unconditionally unbinds the socket protocol hook and binds
the fanout group protocol hook:

   if (refcount_read(>sk_ref) < PACKET_FANOUT_MAX) {
__dev_remove_pack(>prot_hook);
po->fanout = match;
refcount_set(>sk_ref,
refcount_read(>sk_ref) + 1);
__fanout_link(sk, po);
err = 0;
}

This can happen after packet_set_ring has already removed the
protocol hook, causing the socket to be added to the fanout list
twice.

Testing po->running again, this time while holding the bind_lock,
ensures that packet_set_ring cannot have dropped it in between:

+   spin_lock(>bind_lock);
+   if (!po->running) {
+   net_err_ratelimited("fanout add, but
unbound sock");
+   err = -EFAULT;
+   spin_unlock(>bind_lock);
+   goto out;
+   }
+   __dev_remove_pack(>prot_hook));
po->fanout = match;
refcount_set(>sk_ref,
refcount_read(>sk_ref) + 1);
__fanout_link(sk, po);
+   spin_unlock(>bind_lock);

I verified that the reproducer logs plenty of "fanout add, but unbound
sock" messages.

I intend to send this fix after cleaning it up a bit. Will take a
closer look at your patch to see whether these are indeed the
same bug report.


Re: [PATCH] signal: remove unused variable

2017-09-14 Thread Christos Gkekas
On 11/09/17 22:03:37 +0200, Arnd Bergmann wrote:
> The get_compat_sigset() cleanup missed a variable that is now unused:
> 
> kernel/signal.c: In function 'C_SYSC_rt_sigaction':
> kernel/signal.c:3443:19: error: unused variable 'mask' 
> [-Werror=unused-variable]
> 
> Fixes: 9b24ec57688a ("get_compat_sigset()")
> Signed-off-by: Arnd Bergmann 
> ---
>  kernel/signal.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 3198a7d2e5ff..36a523640894 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -3440,7 +3440,6 @@ COMPAT_SYSCALL_DEFINE4(rt_sigaction, int, sig,
>  
>   if (act) {
>   compat_uptr_t handler;
> - compat_sigset_t mask;
>   ret = get_user(handler, >sa_handler);
>   new_ka.sa.sa_handler = compat_ptr(handler);
>  #ifdef __ARCH_HAS_SA_RESTORER
> -- 
> 2.9.0
>


Thanks,

Acked-by: Christos Gkekas 



[RFC] KVM: arm/arm64: Introduce KVM_DEV_ARM_ITS_CTRL_RESET

2017-09-14 Thread Eric Auger
At the moment, the in-kernel emulated ITS is not properly reset.
On guest restart/reset some registers keep their old values and
internal structures like device, ITE, collection lists are not emptied.

This may lead to various bugs. Among them, we can have incorrect state
backup or failure when saving the ITS state at early guest boot stage.

This patch introduces a new attribute, KVM_DEV_ARM_ITS_CTRL_RESET in
the KVM_DEV_ARM_VGIC_GRP_CTRL group.

Upon this action, we can invalidate the various memory structures
pointed by GITS_BASERn and GITS_CBASER, free the ITS internal caches
and reset the relevant registers.

Signed-off-by: Eric Auger 

---

An alternative would consist in having the userspace writing
individual registers with default values: GITS_BASERn, GITS_CBASER
and GITS_CTLR. On kernel side we would reset related lists when
detecting the valid bit is set to false.
---
 Documentation/virtual/kvm/devices/arm-vgic-its.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/virtual/kvm/devices/arm-vgic-its.txt 
b/Documentation/virtual/kvm/devices/arm-vgic-its.txt
index eb06beb..ebb15c5 100644
--- a/Documentation/virtual/kvm/devices/arm-vgic-its.txt
+++ b/Documentation/virtual/kvm/devices/arm-vgic-its.txt
@@ -33,6 +33,9 @@ Groups:
   request the initialization of the ITS, no additional parameter in
   kvm_device_attr.addr.
 
+KVM_DEV_ARM_ITS_CTRL_RESET
+  reset the ITS, no additional parameter in kvm_device_attr.addr.
+
 KVM_DEV_ARM_ITS_SAVE_TABLES
   save the ITS table data into guest RAM, at the location provisioned
   by the guest in corresponding registers/table entries.
-- 
2.5.5



Re: [PATCH v3 04/20] mm: VMA sequence count

2017-09-14 Thread Laurent Dufour
On 14/09/2017 10:13, Sergey Senozhatsky wrote:
> Hi,
> 
> On (09/14/17 09:55), Laurent Dufour wrote:
> [..]
>>> so if there are two CPUs, one doing write_seqcount() and the other one
>>> doing read_seqcount() then what can happen is something like this
>>>
>>> CPU0CPU1
>>>
>>> fs_reclaim_acquire()
>>> write_seqcount_begin()
>>> fs_reclaim_acquire()read_seqcount_begin()
>>> write_seqcount_end()
>>>
>>> CPU0 can't write_seqcount_end() because of fs_reclaim_acquire() from
>>> CPU1, CPU1 can't read_seqcount_begin() because CPU0 did 
>>> write_seqcount_begin()
>>> and now waits for fs_reclaim_acquire(). makes sense?
>>
>> Yes, this makes sense.
>>
>> But in the case of this series, there is no call to
>> __read_seqcount_begin(), and the reader (the speculative page fault
>> handler), is just checking for (vm_seq & 1) and if this is true, simply
>> exit the speculative path without waiting.
>> So there is no deadlock possibility.
> 
> probably lockdep just knows that those locks interleave at some
> point.
> 
> 
> by the way, I think there is one path that can spin
> 
> find_vma_srcu()
>  read_seqbegin()
>   read_seqcount_begin()
>raw_read_seqcount_begin()
> __read_seqcount_begin()


That's right, but here this is the  sequence counter mm->mm_seq, not the
vm_seq one.

This one is held to protect walking the VMA list "locklessly"...

Cheers,
Laurent.



Re: [PATCH v3] Make initramfs honor CONFIG_DEVTMPFS_MOUNT

2017-09-14 Thread Christophe LEROY

Le 14/09/2017 à 01:51, Rob Landley a écrit :

From: Rob Landley 

Make initramfs honor CONFIG_DEVTMPFS_MOUNT, and move
/dev/console open after devtmpfs mount.

Add workaround for Debian bug that was copied by Ubuntu.


Is that a bug only for Debian ? Why ?
Why should a Debian bug be fixed by a workaround in the mainline kernel ?



Signed-off-by: Rob Landley 
---

v2 discussion: http://lkml.iu.edu/hypermail/linux/kernel/1705.2/05611.html

  drivers/base/Kconfig |   14 --
  fs/namespace.c   |   14 ++
  init/main.c  |   15 +--
  3 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index f046d21..97352d4 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -48,16 +48,10 @@ config DEVTMPFS_MOUNT
bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs"
depends on DEVTMPFS
help
- This will instruct the kernel to automatically mount the
- devtmpfs filesystem at /dev, directly after the kernel has
- mounted the root filesystem. The behavior can be overridden
- with the commandline parameter: devtmpfs.mount=0|1.
- This option does not affect initramfs based booting, here
- the devtmpfs filesystem always needs to be mounted manually
- after the rootfs is mounted.
- With this option enabled, it allows to bring up a system in
- rescue mode with init=/bin/sh, even when the /dev directory
- on the rootfs is completely empty.
+ Automatically mount devtmpfs at /dev on the root filesystem, which
+ lets the system to come up in rescue mode with [rd]init=/bin/sh.
+ Override with devtmpfs.mount=0 on the commandline. Initramfs can
+ create a /dev dir as needed, other rootfs needs the mount point.


Why modifying the initial text ?
Why talking about rescue mode only, whereas this feature mainly concerns 
the standard mode.


  
  config STANDALONE

bool "Select only drivers that don't need compile-time external 
firmware"
diff --git a/fs/namespace.c b/fs/namespace.c
index f8893dc..06057d7 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2417,7 +2417,21 @@ static int do_add_mount(struct mount *newmnt, struct 
path *path, int mnt_flags)
err = -EBUSY;
if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb &&
path->mnt->mnt_root == path->dentry)
+   {
+   if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT) &&
+   !strcmp(path->mnt->mnt_sb->s_type->name, "devtmpfs"))
+   {
+   /* Debian's kernel config enables DEVTMPFS_MOUNT, then
+  its initramfs setup script tries to mount devtmpfs
+  again, and if the second mount-over-itself fails
+  the script overmounts a tmpfs on /dev to hide the
+  existing contents, then boot fails with empty /dev. 
*/


Does it matter for the kernel code what Debian's kernel config does ?


+   printk(KERN_WARNING "Debian bug workaround for devtmpfs 
overmount.");


Is this log message worth it when this modification goes in mainline 
kernel ?


If so, pr_err() should be used instead.


+
+   err = 0;
+   }
goto unlock;
+   }
  
  	err = -EINVAL;

if (d_is_symlink(newmnt->mnt.mnt_root))
diff --git a/init/main.c b/init/main.c
index 0ee9c686..0d8e5ec 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1065,12 +1065,6 @@ static noinline void __init kernel_init_freeable(void)
  
  	do_basic_setup();
  
-	/* Open the /dev/console on the rootfs, this should never fail */

-   if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
-   pr_err("Warning: unable to open an initial console.\n");
-
-   (void) sys_dup(0);
-   (void) sys_dup(0);
/*
 * check if there is an early userspace init.  If yes, let it do all
 * the work
@@ -1082,8 +1076,17 @@ static noinline void __init kernel_init_freeable(void)
if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
ramdisk_execute_command = NULL;
prepare_namespace();
+   } else if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT)) {
+   sys_mkdir("/dev", 0755);


Why not, but couldn't we also expect the initramfs to already contains 
that mountpoint ?



+   devtmpfs_mount("/dev");
}
  
+	/* Open the /dev/console on the rootfs, this should never fail */

+   if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
+   pr_err("Warning: unable to open an initial console.\n");
+   (void) sys_dup(0);
+   (void) sys_dup(0);
+
/*
 * Ok, we have completed the initial bootup, and
 * we're essentially up and running. Get rid of the




Christophe


Re: [git:media_tree/master] media: adv7180: add missing adv7180cp, adv7180st i2c device IDs

2017-09-14 Thread Geert Uytterhoeven
On Wed, Sep 13, 2017 at 10:50 AM, Geert Uytterhoeven
 wrote:
> On Thu, Jul 20, 2017 at 12:54 PM, Mauro Carvalho Chehab
>  wrote:
>> This is an automatic generated email to let you know that the following 
>> patch were queued:
>>
>> Subject: media: adv7180: add missing adv7180cp, adv7180st i2c device IDs
>> Author:  Ulrich Hecht 
>> Date:Mon Jul 3 04:43:33 2017 -0400
>>
>> Fixes a crash on Renesas R8A7793 Gose board that uses these "compatible"
>> entries.
>>
>> Signed-off-by: Ulrich Hecht 
>> Tested-by: Geert Uytterhoeven 
>> Signed-off-by: Hans Verkuil 
>> Signed-off-by: Mauro Carvalho Chehab 
>
> Fixes: ce1ec5c07e0671cc ("[media] media: adv7180: add adv7180cp,
> adv7180st compatible strings")
>
> This fix is now upstream, as commit 281ddc3cdc10413b ("media: adv7180: add
> missing adv7180cp, adv7180st i2c device IDs").
>
> Greg: Can you please backport it to v3.14.x?

Oops, v4.13.x, of course. The \pi-line is dead...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [PATCH 2/2] mfd: fsl-imx25: clean up irq settings during removal

2017-09-14 Thread Lee Jones
On Tue, 12 Sep 2017, Martin Kaiser wrote:

> When fsl-imx25-tsadc is compiled as a module, unloading and reloading
> the module will lead to a crash.
> 
> Add a removal function which clears the irq handler and removes the irq
> domain. With this cleanup in place, it's possible to unload and reload
> the module.

More information please.

What is it specifically that causes the crash?

Why is this code not required?  What's stopping this causing a leak?

> Signed-off-by: Martin Kaiser 
> ---
>  drivers/mfd/fsl-imx25-tsadc.c | 14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c
> index 14189ef..a6423bd 100644
> --- a/drivers/mfd/fsl-imx25-tsadc.c
> +++ b/drivers/mfd/fsl-imx25-tsadc.c
> @@ -179,6 +179,19 @@ static int mx25_tsadc_probe(struct platform_device *pdev)
>   return devm_of_platform_populate(dev);
>  }
>  
> +static int __exit mx25_tsadc_remove(struct platform_device *pdev)
> +{
> + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
> + int irq = platform_get_irq(pdev, 0);
> +
> + if (irq) {
> + irq_set_chained_handler_and_data(irq, NULL, NULL);
> + irq_domain_remove(tsadc->domain);
> + }
> +
> + return 0;
> +}
> +
>  static const struct of_device_id mx25_tsadc_ids[] = {
>   { .compatible = "fsl,imx25-tsadc" },
>   { /* Sentinel */ }
> @@ -191,6 +204,7 @@ static struct platform_driver mx25_tsadc_driver = {
>   .of_match_table = of_match_ptr(mx25_tsadc_ids),
>   },
>   .probe = mx25_tsadc_probe,
> + .remove = __exit_p(mx25_tsadc_remove),
>  };
>  module_platform_driver(mx25_tsadc_driver);
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v2 4/4] tpm: use tpm_msleep() value as max delay

2017-09-14 Thread Nayna Jain



On 09/13/2017 06:17 AM, Jarkko Sakkinen wrote:

On Wed, Sep 06, 2017 at 08:56:39AM -0400, Nayna Jain wrote:

Currently, tpm_msleep() uses delay_msec as the minimum value in
usleep_range. However, that is the maximum time we want to wait.
The function is modified to use the delay_msec as the maximum
value, not the minimum value.

After this change, performance on a TPM 1.2 with an 8 byte
burstcount for 1000 extends improved from ~9sec to ~8sec.

Signed-off-by: Nayna Jain 
Acked-by: Mimi Zohar 
---
  drivers/char/tpm/tpm.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index eb2f8818eded..ff5a8b7b80b9 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -533,8 +533,8 @@ int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, 
unsigned long timeout,
  
  static inline void tpm_msleep(unsigned int delay_msec)

  {
-   usleep_range(delay_msec * 1000,
-(delay_msec * 1000) + TPM_TIMEOUT_RANGE_US);
+   usleep_range((delay_msec * 1000) - TPM_TIMEOUT_RANGE_US,
+delay_msec * 1000);
  };
  
  struct tpm_chip *tpm_chip_find_get(int chip_num);

--
2.13.3


Doesn't this need a Fixes tag?

Yeah.. will add.

   - Nayna

/Jarkko





Re: [PATCH 1/2] mfd: fsl-imx25: set irq handler and data in one go

2017-09-14 Thread Lee Jones
On Tue, 12 Sep 2017, Martin Kaiser wrote:

> Replace the two separate calls for setting the irq handler and data with
> a single irq_set_chained_handler_and_data() call.
> 
> Signed-off-by: Martin Kaiser 
> ---
>  drivers/mfd/fsl-imx25-tsadc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH V1] MAINTAINERS: Fix Dialog search term for watchdog binding file

2017-09-14 Thread Lee Jones
On Tue, 12 Sep 2017, Steve Twiss wrote:

> From: Steve Twiss 
> 
> Commit 340267640d769d3b3af9 ("MAINTAINERS: da9062/61 updates to the Dialog
> Semiconductor search terms") contained a typo for the watchdog binding:
> da92??-wdt.txt should have read da90??-wdt.txt. This new commit will fix
> the error and allows Dialog Semiconductor to follow files for PMIC
> bindings correctly.
> 
> Signed-off-by: Steve Twiss 
> Tested-by: Steve Twiss 
> 
> ---
> Hi Lee,
> 
> This fixes a typo in my previous MAINTAINERS submission.
> It probably has minimal impact, but it was incorrect.
> 
> Regards,
> Steve
> 
> This patch applies against linux-mainline and v4.13
> 
> 
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


[PATCH 8/8] [media] ttusb_dec: Delete four unwanted spaces

2017-09-14 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 13 Sep 2017 22:22:41 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: space prohibited after that open parenthesis '('

Thus fix affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c 
b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 58256d518fa6..b05f83eac95d 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -258,7 +258,7 @@ static int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts,
 static void ttusb_dec_set_model(struct ttusb_dec *dec,
enum ttusb_dec_model model);
 
-static void ttusb_dec_handle_irq( struct urb *urb)
+static void ttusb_dec_handle_irq(struct urb *urb)
 {
struct ttusb_dec *dec = urb->context;
char *buffer = dec->irq_buffer;
@@ -393,8 +393,8 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, 
const u8 command,
}
 }
 
-static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
-   unsigned int *model, unsigned int *version)
+static int ttusb_dec_get_stb_state(struct ttusb_dec *dec, unsigned int *mode,
+  unsigned int *model, unsigned int *version)
 {
u8 c[COMMAND_PACKET_SIZE];
int c_length;
@@ -1233,7 +1233,7 @@ static void ttusb_dec_init_tasklet(struct ttusb_dec *dec)
 (unsigned long)dec);
 }
 
-static int ttusb_init_rc( struct ttusb_dec *dec)
+static int ttusb_init_rc(struct ttusb_dec *dec)
 {
struct input_dev *input_dev;
u8 b[] = { 0x00, 0x01 };
-- 
2.14.1



[PATCH 7/8] [media] ttusb_dec: Add spaces for better code readability

2017-09-14 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 13 Sep 2017 22:12:07 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: spaces required around that '=' (ctx:VxV)

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 79 +
 1 file changed, 41 insertions(+), 38 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c 
b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index e9fe4c6142a5..58256d518fa6 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -209,47 +209,49 @@ static void dvb_filter_pes2ts_init(struct 
dvb_filter_pes2ts *p2ts,
   unsigned short pid,
   dvb_filter_pes2ts_cb_t *cb, void *priv)
 {
-   unsigned char *buf=p2ts->buf;
-
-   buf[0]=0x47;
-   buf[1]=(pid>>8);
-   buf[2]=pid&0xff;
-   p2ts->cc=0;
-   p2ts->cb=cb;
-   p2ts->priv=priv;
+   unsigned char *buf = p2ts->buf;
+
+   buf[0] = 0x47;
+   buf[1] = pid >> 8;
+   buf[2] = pid & 0xff;
+   p2ts->cc = 0;
+   p2ts->cb = cb;
+   p2ts->priv = priv;
 }
 
 static int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts,
 unsigned char *pes, int len, int payload_start)
 {
-   unsigned char *buf=p2ts->buf;
-   int ret=0, rest;
+   unsigned char *buf = p2ts->buf;
+   int ret = 0, rest;
 
//len=6+((pes[4]<<8)|pes[5]);
 
if (payload_start)
-   buf[1]|=0x40;
+   buf[1] |= 0x40;
else
-   buf[1]&=~0x40;
-   while (len>=184) {
-   buf[3]=0x10|((p2ts->cc++)&0x0f);
-   memcpy(buf+4, pes, 184);
-   if ((ret=p2ts->cb(p2ts->priv, buf)))
+   buf[1] &= ~0x40;
+   while (len >= 184) {
+   buf[3] = 0x10 | ((p2ts->cc++) & 0x0f);
+   memcpy(buf + 4, pes, 184);
+   ret = p2ts->cb(p2ts->priv, buf);
+   if (ret)
return ret;
-   len-=184; pes+=184;
-   buf[1]&=~0x40;
+   len -= 184;
+   pes += 184;
+   buf[1] &= ~0x40;
}
if (!len)
return 0;
-   buf[3]=0x30|((p2ts->cc++)&0x0f);
-   rest=183-len;
+   buf[3] = 0x30 | ((p2ts->cc++) & 0x0f);
+   rest = 183 - len;
if (rest) {
-   buf[5]=0x00;
-   if (rest-1)
-   memset(buf+6, 0xff, rest-1);
+   buf[5] = 0x00;
+   if (rest - 1)
+   memset(buf + 6, 0xff, rest - 1);
}
-   buf[4]=rest;
-   memcpy(buf+5+rest, pes, len);
+   buf[4] = rest;
+   memcpy(buf + 5 + rest, pes, len);
return p2ts->cb(p2ts->priv, buf);
 }
 
@@ -262,7 +264,7 @@ static void ttusb_dec_handle_irq( struct urb *urb)
char *buffer = dec->irq_buffer;
int retval;
 
-   switch(urb->status) {
+   switch (urb->status) {
case 0: /*success*/
break;
case -ECONNRESET:
@@ -275,7 +277,7 @@ static void ttusb_dec_handle_irq( struct urb *urb)
return;
default:
dprintk("%s:nonzero status received: %d\n",
-   __func__,urb->status);
+   __func__, urb->status);
goto exit;
}
 
@@ -1263,10 +1265,9 @@ static int ttusb_init_rc( struct ttusb_dec *dec)
 
dec->rc_input_dev = input_dev;
if (usb_submit_urb(dec->irq_urb, GFP_KERNEL))
-   printk("%s: usb_submit_urb failed\n",__func__);
+   printk("%s: usb_submit_urb failed\n", __func__);
/* enable irq pipe */
-   ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL);
-
+   ttusb_dec_send_command(dec, 0xb0, sizeof(b), b, NULL, NULL);
return 0;
 }
 
@@ -1295,18 +1296,20 @@ static int ttusb_dec_init_usb(struct ttusb_dec *dec)
dec->out_pipe = usb_sndisocpipe(dec->udev, OUT_PIPE);
dec->irq_pipe = usb_rcvintpipe(dec->udev, IRQ_PIPE);
 
-   if(enable_rc) {
+   if (enable_rc) {
dec->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if(!dec->irq_urb) {
+   if (!dec->irq_urb)
return -ENOMEM;
-   }
-   dec->irq_buffer = usb_alloc_coherent(dec->udev,IRQ_PACKET_SIZE,
-   GFP_KERNEL, >irq_dma_handle);
-   if(!dec->irq_buffer) {
+
+   dec->irq_buffer = usb_alloc_coherent(dec->udev,
+IRQ_PACKET_SIZE,
+GFP_KERNEL,
+>irq_dma_handle);
+

Re: [PATCH] ARC: reset: remove the misleading v1 suffix all over

2017-09-14 Thread Philipp Zabel
On Mon, 2017-09-11 at 09:33 -0700, Vineet Gupta wrote:
> On 09/11/2017 03:28 AM, Philipp Zabel wrote:
> > Hi Vineet,
> > 
> > [added Eugeniy to Cc]
> > 
> > On Thu, 2017-08-31 at 11:06 -0700, Vineet Gupta wrote:
> > > There is no plan yet to do a v2 board. And even if we were to do
> > > it
> > > only some IPs would actually change, so it be best to add suffixes
> > > at
> > > that point, not now !
> > > 
> > > Cc: Philipp Zabel 
> > > Signed-off-by: Vineet Gupta 
> > > ---
> > > P.S. Philip, if you and Eugeniy are OK, can this be please
> > > squashed
> > > with his original patch since it has not yet been merged etc.
> > 
> > This had been merged into arm-soc already, and by now is merged into
> > mainline. We could try to queue this as a fix for 4.14.
> 
> OK - do you want a respin ?
> 
> > 
> > [...]
> > > --- a/drivers/reset/Kconfig
> > > +++ b/drivers/reset/Kconfig
> > > @@ -34,11 +34,11 @@ config RESET_BERLIN
> > >   help
> > >     This enables the reset controller driver for Marvell
> > > Berlin
> > > SoCs.
> > >   
> > > -config RESET_HSDK_V1
> > > - bool "HSDK v1 Reset Driver"
> > > +config RESET_SNPS_HSDK
> > 
> > I suggest to drop the _SNPS part, we don't do it for the other
> > drivers
> > either, and so far I'm not afraid of conflicts with other reset
> > controllers that may be called HSDK.
> 
> It was not so much about namespace conflict but calling out that this
> is SNPS part !
> But I'm fine with what you suggest, since the updated menu string does
> have it.

Ok, thanks. No need for a respin, I can fix it up as I apply it.

regards
Philipp


[tip:core/urgent] watchdog/hardlockup/perf: Simplify deferred event destroy

2017-09-14 Thread tip-bot for Thomas Gleixner
Commit-ID:  a33d44843d4574ec05bec39527d8a87b7af2072c
Gitweb: http://git.kernel.org/tip/a33d44843d4574ec05bec39527d8a87b7af2072c
Author: Thomas Gleixner 
AuthorDate: Tue, 12 Sep 2017 21:37:22 +0200
Committer:  Ingo Molnar 
CommitDate: Thu, 14 Sep 2017 11:41:08 +0200

watchdog/hardlockup/perf: Simplify deferred event destroy

Now that all functionality is properly serialized against CPU hotplug,
remove the extra per cpu storage which holds the disabled events for
cleanup. The core makes sure that cleanup happens before new events are
created.

Signed-off-by: Thomas Gleixner 
Reviewed-by: Don Zickus 
Cc: Andrew Morton 
Cc: Borislav Petkov 
Cc: Chris Metcalf 
Cc: Linus Torvalds 
Cc: Nicholas Piggin 
Cc: Peter Zijlstra 
Cc: Sebastian Siewior 
Cc: Ulrich Obergfell 
Link: http://lkml.kernel.org/r/20170912194148.340708...@linutronix.de
Signed-off-by: Ingo Molnar 
---
 kernel/watchdog_hld.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/watchdog_hld.c b/kernel/watchdog_hld.c
index 509bb6b..b293115 100644
--- a/kernel/watchdog_hld.c
+++ b/kernel/watchdog_hld.c
@@ -21,7 +21,6 @@
 static DEFINE_PER_CPU(bool, hard_watchdog_warn);
 static DEFINE_PER_CPU(bool, watchdog_nmi_touch);
 static DEFINE_PER_CPU(struct perf_event *, watchdog_ev);
-static DEFINE_PER_CPU(struct perf_event *, dead_event);
 static struct cpumask dead_events_mask;
 
 static unsigned long hardlockup_allcpu_dumped;
@@ -204,8 +203,6 @@ void hardlockup_detector_perf_disable(void)
 
if (event) {
perf_event_disable(event);
-   this_cpu_write(watchdog_ev, NULL);
-   this_cpu_write(dead_event, event);
cpumask_set_cpu(smp_processor_id(), _events_mask);
watchdog_cpus--;
}
@@ -221,9 +218,9 @@ void hardlockup_detector_perf_cleanup(void)
int cpu;
 
for_each_cpu(cpu, _events_mask) {
-   struct perf_event *event = per_cpu(dead_event, cpu);
+   struct perf_event *event = per_cpu(watchdog_ev, cpu);
 
-   per_cpu(dead_event, cpu) = NULL;
+   per_cpu(watchdog_ev, cpu) = NULL;
perf_event_release_kernel(event);
}
cpumask_clear(_events_mask);


Re: [PATCH v2 RESEND 1/2] x86/UV: Introduce a helper function to check UV system at earlier stage

2017-09-14 Thread Baoquan He
Add Dave to the CC list, he may have concerns about the code change.

On 09/07/17 at 03:42pm, Baoquan He wrote:
> The BIOS on SGI UV system will report a UV system table which describes
> specific firmware capabilities available to the Linux kernel at runtime.
> This UV system table only exists on SGI UV system. And it's detected
> in efi_init() which is at very early stage.
> 
> So introduce a new helper function is_early_uv_system() to identify if
> a system is UV system. Later we will use it to check if the running
> system is UV system in mm KASLR code.
> 
> Signed-off-by: Baoquan He 
> Acked-by: Mike Travis 
> ---
>  arch/x86/include/asm/uv/uv.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
> index b5a32231abd8..93d7ad8763ba 100644
> --- a/arch/x86/include/asm/uv/uv.h
> +++ b/arch/x86/include/asm/uv/uv.h
> @@ -18,6 +18,11 @@ extern void uv_nmi_init(void);
>  extern void uv_system_init(void);
>  extern const struct cpumask *uv_flush_tlb_others(const struct cpumask 
> *cpumask,
>const struct flush_tlb_info 
> *info);
> +#include 
> +static inline int is_early_uv_system(void)
> +{
> + return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab);
> +}
>  
>  #else/* X86_UV */
>  
> @@ -30,6 +35,7 @@ static inline const struct cpumask *
>  uv_flush_tlb_others(const struct cpumask *cpumask,
>   const struct flush_tlb_info *info)
>  { return cpumask; }
> +static inline int is_early_uv_system(void)   { return 0; }
>  
>  #endif   /* X86_UV */
>  
> -- 
> 2.5.5
> 


RE: [PATCH v3] Add driver to force WMI Thunderbolt controller power status

2017-09-14 Thread Mario.Limonciello
> -Original Message-
> From: Lukas Wunner [mailto:lu...@wunner.de]
> Sent: Wednesday, September 13, 2017 12:20 PM
> To: Limonciello, Mario 
> Cc: dvh...@infradead.org; LKML ; 
> platform-driver-
> x...@vger.kernel.org; Richard Hughes ; Yehezkel Bernat
> ; Mika Westerberg 
> Subject: Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power
> status
> 
> Sorry, late to the party.
> 
> On Fri, Sep 08, 2017 at 10:23:11AM -0500, Mario Limonciello wrote:
> > +   mode = hex_to_bin(buf[0]);
> > +   if (mode == 0 || mode == 1) {
> > +   status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID,
> 0, 1,
> > +, NULL);
> > +   if (ACPI_FAILURE(status)) {
> > +   pr_err("intel-wmi-thunderbolt: failed setting %s\n",
> > +  buf);
> > +   return -ENODEV;
> > +   }
> > +   } else {
> > +   pr_err("intel-wmi-thunderbolt: unsupported mode: %d", mode);
> > +   }
> > +   return count;
> > +}
> 
> Seems odd to allow user space to fill the log by writing invalid data
> to sysfs, likewise that success is returned in the else case.
> I'd drop both pr_err() and return -EINVAL in the else case.
> 

Seems fine to me.  As Darren already queued the patch, I'll send a follow up 
patch 
to fix these two cases.

> 
> > +static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
> > +   { .guid_string = INTEL_WMI_THUNDERBOLT_GUID },
> > +   { },
> > +};
> 
> I'm not familiar with WMI, but don't you need a MODULE_DEVICE_TABLE here?
> How does user space know which module to load upon receiving the uevent?

Some macros for WMI bus devices.
https://github.com/torvalds/linux/blob/e0f25a3f2d052e36ff67a9b4db835c3e27e950d8/include/linux/wmi.h#L55
https://github.com/torvalds/linux/blob/master/include/linux/device.h#L1487
 


Re: [PATCH v7 2/8] mfd: wm97xx-core: core support for wm97xx Codec

2017-09-14 Thread Lee Jones
On Thu, 14 Sep 2017, Lee Jones wrote:

> On Wed, 13 Sep 2017, Robert Jarzmik wrote:
> 
> > The WM9705, WM9712 and WM9713 are highly integrated codecs, with an
> > audio codec, DAC and ADC, GPIO unit and a touchscreen interface.
> > 
> > Historically the support was spread across drivers/input/touchscreen and
> > sound/soc/codecs. The sharing was done through ac97 bus sharing. This
> > model will not withstand the new AC97 bus model, where codecs are
> > discovered on runtime.
> > 
> > Signed-off-by: Robert Jarzmik 
> > Acked-by: Charles Keepax 
> > Acked-by: Lee Jones 
> > ---
> > Since v3:
> >  - added a "depends on AC97_BUS_NEW" Kconfig statement
> >  - added default values for wm9705, wm9712 per Charles's comment
> > Since v4:
> >  - added Charles's ack
> > Since v5:
> >  - took into account Lee's comments
> > Since v6:
> >  - took into account Lee's comments
> > ---
> >  drivers/mfd/Kconfig|  14 ++
> >  drivers/mfd/Makefile   |   1 +
> >  drivers/mfd/wm97xx-core.c  | 366 
> > +
> >  include/linux/mfd/wm97xx.h |  25 
> >  4 files changed, 406 insertions(+)
> >  create mode 100644 drivers/mfd/wm97xx-core.c
> >  create mode 100644 include/linux/mfd/wm97xx.h
> 
> Applied, thanks.

Change of plan.  It looks like there are deps.

Unapplied.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH -mm -v4 3/5] mm, swap: VMA based swap readahead

2017-09-14 Thread Minchan Kim
On Wed, Sep 13, 2017 at 02:02:29PM -0700, Andrew Morton wrote:
> On Wed, 13 Sep 2017 10:40:19 +0900 Minchan Kim  wrote:
> 
> > Every zram users like low-end android device has used 0 page-cluster
> > to disable swap readahead because it has no seek cost and works as
> > synchronous IO operation so if we do readahead multiple pages,
> > swap falut latency would be (4K * readahead window size). IOW,
> > readahead is meaningful only if it doesn't bother faulted page's
> > latency.
> > 
> > However, this patch introduces additional knob /sys/kernel/mm/swap/
> > vma_ra_max_order as well as page-cluster. It means existing users
> > has used disabled swap readahead doesn't work until they should be
> > aware of new knob and modification of their script/code to disable
> > vma_ra_max_order as well as page-cluster.
> > 
> > I say it's a *regression* and wanted to fix it but Huang's opinion
> > is that it's not a functional regression so userspace should be fixed
> > by themselves.
> > Please look into detail of discussion in
> > http://lkml.kernel.org/r/%3c1505183833-4739-4-git-send-email-minc...@kernel.org%3E
> 
> hm, tricky problem.  I do agree that linking the physical and virtual
> readahead schemes in the proposed fashion is unfortunate.  I also agree
> that breaking existing setups (a bit) is also unfortunate.
> 
> Would it help if, when page-cluster is written to zero, we do
> 
> printk_once("physical readahead disabled, virtual readahead still
> enabled.  Disable virtual readhead via
> /sys/kernel/mm/swap/vma_ra_max_order").
> 
> Or something like that.  It's pretty lame, but it should help alert the
> zram-readahead-disabling people to the issue?

It was my last resort. If we cannot find other ways after all, yes, it would
be a minimum we should do. But it still breaks users don't/can't read/modify
alert and program.

How about this?

Can't we make vma-based readahead config option?
With that, users who no interest on readahead don't enable vma-based
readahead. In this case, page-cluster works as expected "disable readahead
completely" so it doesn't break anything.

People who want to use upcoming vma-based readahead can enable the feature
and we can say such unfortunate things in config/document description
somewhere so upcoming users will be aware of that unforunate two knobs.


Re: [PATCH 2/2] zram: remove zlib from the list of recommended algorithms

2017-09-14 Thread Minchan Kim
On Wed, Sep 13, 2017 at 12:38:56PM +0200, Adam Borowski wrote:
> On Wed, Sep 13, 2017 at 04:12:46PM +0900, Minchan Kim wrote:
> > On Tue, Sep 12, 2017 at 02:00:05PM +0900, Sergey Senozhatsky wrote:
> > > ZSTD tends to outperform deflate/inflate, thus we remove
> > > zlib from the list of recommended algorithms and recommend
> > > zstd instead.
> >  
> > I did test with my sample data and compared zstd with deflate.
> > zstd's compress ratio is lower a little bit but compression
> > speed is much faster 3 times more and decompress speed is too
> > 2 times more. With different data, it is different but overall,
> > zstd would be better for speed at the cost of a little lower compress
> > ratio(about 5%) so I believe it's worth to replace deflate.
> 
> Both zlib and zstd have the compression level adjustable, zstd in a far
> greater range (from lzo-like at lowest levels to mid-range lzma at the
> highest).  Thus, any such comparison needs to mention the used level.
> Ie, if you selected a setting where speed is same, compression ratio
> will be a lot better.

Unfortunately, it seems crypto doesn't support configurable level yet
so when I read the source properly, zstd default level is 3 while
deflate is 6.

> 
> For compressing RAM it's reasonable to keep to fastest levels, and a
> non-adjustable level reduces complexity, but if your use case wants high but
> slow compression, now is a good time to mention this.

What I expect zstd is same comp ratio with zlib but much faster speed.
And lastly, predefined dictionary for 4K comp/decomp. :)

Thanks.


Re: [patch V2 00/29] lockup_detector: Cure hotplug deadlocks and replace duct tape

2017-09-14 Thread Thomas Gleixner
On Wed, 13 Sep 2017, Don Zickus wrote:
> 
> Aside from the simple compile issue in patch 25.  I have no issues with this
> patchset.  Thanks Thomas!
> 
> Reviewed-by: Don Zickus 

Thanks for your time and feedback!

   tglx


  1   2   3   4   5   6   7   8   9   10   >