Re: linux-4.14-rc3/arch/powerpc/perf/imc-pmu.c:599: pointless test ?

2017-10-08 Thread Michael Ellerman
David Binderman  writes:
> Hello there,
>
> linux-4.14-rc3/arch/powerpc/perf/imc-pmu.c:599]: (style) Unsigned variable 
> 'ncpu' can't be negative so it is unnecessary to test it.
>
> Source code is
>
> if (ncpu >= 0 && ncpu < nr_cpu_ids) {
>
> but
>
> unsigned int ncpu, core_id;
>
> Suggest remove test.

Thanks.

Notifying the author would be more helpful:

$ git blame -L 599,599 arch/powerpc/perf/imc-pmu.c
39a846db1d574 (Anju T Sudhakar 2017-07-19 03:06:35 +0530 599)   if (ncpu >= 0 
&& ncpu < nr_cpu_ids) {
$ git log -1 --format=%ae 39a846db1d574
a...@linux.vnet.ibm.com

cheers


Re: [PATCH tip/core/rcu 1/3] membarrier: Provide register expedited private command

2017-10-08 Thread Andrea Parri
On Fri, Oct 06, 2017 at 10:32:19AM +0200, Peter Zijlstra wrote:
> > AFAIU the scheduler rq->lock is held while preemption is disabled.
> > synchronize_sched() is used here to ensure that all pre-existing
> > preempt-off critical sections have completed.
> > 
> > So saying that we use synchronize_sched() to synchronize with rq->lock
> > would be stretching the truth a bit. It's actually only true because the
> > scheduler holding the rq->lock is surrounded by a preempt-off
> > critical section.
> 
> No, rq->lock is sufficient, note that rq->lock is a raw_spinlock_t which
> implies !preempt. Yes, we also surround the rq->lock usage with a
> slightly larger preempt_disable() section but that's not in fact
> required for this.

That's what it is, according to the current sources: we seemed to agree that
a preempt-off critical section is what we rely on here and that the start of
this critical section is not marked by that raw_spin_lock.

  Andrea


RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER

2017-10-08 Thread Gross, Mark
Acked-by: mark gross 

--mark

> -Original Message-
> From: Kees Cook [mailto:keesc...@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner 
> Cc: Kees Cook ; Arnd Bergmann ;
> Greg Kroah-Hartman ; Gross, Mark
> ; Andrew Morton ;
> Benjamin Herrenschmidt ; Chris Metcalf
> ; Geert Uytterhoeven ;
> Guenter Roeck ; Harish Patil ;
> Heiko Carstens ; James E.J. Bottomley
> ; John Stultz ; Julian
> Wiedmann ; Kalle Valo ;
> Lai Jiangshan ; Brown, Len ;
> Manish Chopra ; Martin K. Petersen
> ; Martin Schwidefsky
> ; Michael Ellerman ; Michael
> Reed ; net...@vger.kernel.org; Oleg Nesterov
> ; Paul Mackerras ; Pavel Machek
> ; Petr Mladek ; Rafael J. Wysocki
> ; Ralf Baechle ; Sebastian Reichel
> ; Stefan Richter ; Stephen Boyd
> ; Sudip Mukherjee ;
> Tejun Heo ; Ursula Braun ; Viresh
> Kumar ; Wim Van Sebroeck ;
> linux1394-de...@lists.sourceforge.net; linux-m...@linux-mips.org; linux-
> p...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; linux-
> s...@vger.kernel.org; linux-s...@vger.kernel.org; linux-
> watch...@vger.kernel.org; linux-wirel...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
> 
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the 
> internal
> version.
> 
> Cc: Arnd Bergmann 
> Cc: Greg Kroah-Hartman 
> Cc: Mark Gross 
> Cc: Thomas Gleixner 
> Signed-off-by: Kees Cook 
> ---
>  drivers/char/tlclk.c  | 12 +---  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;   /* Event that generate a interrupt */
>  static int got_event;/* if events processing have been done 
> */
> 
> -static void switchover_timeout(unsigned long data); -static struct timer_list
> switchover_timer =
> - TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
> 
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>   goto out3;
>   }
> 
> - init_timer(_timer);
> + timer_setup(_timer, switchover_timeout, 0);
> 
>   ret = misc_register(_miscdev);
>   if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
> 
>  }
> 
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> - unsigned long flags = *(unsigned long *) data;
> + unsigned long flags = tlclk_timer_data;
> 
>   if ((flags & 1)) {
>   if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>   /* TIMEOUT in ~10ms */
>   switchover_timer.expires = jiffies + msecs_to_jiffies(10);
>   tlclk_timer_data = inb(TLCLK_REG1);
> - switchover_timer.data = (unsigned long) _timer_data;
>   mod_timer(_timer, switchover_timer.expires);
>   } else {
>   got_event = 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
> 
>  #define DEFINE_TIMER(_name, _function, _expires, _data)  \
>   struct timer_list _name =   \
> - TIMER_INITIALIZER(_function, _expires, _data)
> + __TIMER_INITIALIZER(_function, _expires, _data, 0)
> 
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>   const char *name, struct lock_class_key *key);
> --
> 2.7.4



Re: [PATCH tip/core/rcu 1/3] membarrier: Provide register expedited private command

2017-10-08 Thread Andrea Parri
On Fri, Oct 6, 2017 at 12:02 AM, Andrea Parri  wrote:
> On Thu, Oct 05, 2017 at 04:02:06PM +, Mathieu Desnoyers wrote:
>> - On Oct 5, 2017, at 8:12 AM, Peter Zijlstra pet...@infradead.org wrote:
>>
>> > On Wed, Oct 04, 2017 at 02:37:53PM -0700, Paul E. McKenney wrote:
>> >> diff --git a/arch/powerpc/kernel/membarrier.c 
>> >> b/arch/powerpc/kernel/membarrier.c
>> >> new file mode 100644
>> >> index ..b0d79a5f5981
>> >> --- /dev/null
>> >> +++ b/arch/powerpc/kernel/membarrier.c
>> >> @@ -0,0 +1,45 @@
>> >
>> >> +void membarrier_arch_register_private_expedited(struct task_struct *p)
>> >> +{
>> >> +  struct task_struct *t;
>> >> +
>> >> +  if (get_nr_threads(p) == 1) {
>> >> +  set_thread_flag(TIF_MEMBARRIER_PRIVATE_EXPEDITED);
>> >> +  return;
>> >> +  }
>> >> +  /*
>> >> +   * Coherence of TIF_MEMBARRIER_PRIVATE_EXPEDITED against thread
>> >> +   * fork is protected by siglock.
>> >> +   */
>> >> +  spin_lock(>sighand->siglock);
>> >> +  for_each_thread(p, t)
>> >> +  set_ti_thread_flag(task_thread_info(t),
>> >> +  TIF_MEMBARRIER_PRIVATE_EXPEDITED);
>> >
>> > I'm not sure this works correctly vs CLONE_VM without CLONE_THREAD.
>>
>> The intent here is to hold the sighand siglock to provide mutual
>> exclusion against invocation of membarrier_fork(p, clone_flags)
>> by copy_process().
>>
>> copy_process() grabs spin_lock(>sighand->siglock) for both
>> CLONE_THREAD and not CLONE_THREAD flags.
>>
>> What am I missing here ?
>>
>> >
>> >> +  spin_unlock(>sighand->siglock);
>> >> +  /*
>> >> +   * Ensure all future scheduler executions will observe the new
>> >> +   * thread flag state for this process.
>> >> +   */
>> >> +  synchronize_sched();
>> >
>> > This relies on the flag being read inside rq->lock, right?
>>
>> Yes. The flag is read by membarrier_arch_switch_mm(), invoked
>> within switch_mm_irqs_off(), called by context_switch() before
>> finish_task_switch() releases the rq lock.
>
> I fail to graps the relation between this synchronize_sched() and rq->lock.

s/graps/grasp

  Andrea


>
> (Besides, we made no reference to rq->lock while discussing:
>
>   
> https://github.com/paulmckrcu/litmus/commit/47039df324b60ace0cf7b2403299580be730119b
>   replace membarrier_arch_sched_in with switch_mm_irqs_off )
>
> Could you elaborate?
>
>   Andrea
>
>
>>
>> Is the comment clear enough, or do you have suggestions for
>> improvements ?
>
>
>
>>
>> Thanks,
>>
>> Mathieu
>>
>> >
>> > > +}
>>
>> --
>> Mathieu Desnoyers
>> EfficiOS Inc.
>> http://www.efficios.com


Re: [PATCH tip/core/rcu 1/3] membarrier: Provide register expedited private command

2017-10-08 Thread Andrea Parri
On Thu, Oct 05, 2017 at 04:02:06PM +, Mathieu Desnoyers wrote:
> - On Oct 5, 2017, at 8:12 AM, Peter Zijlstra pet...@infradead.org wrote:
> 
> > On Wed, Oct 04, 2017 at 02:37:53PM -0700, Paul E. McKenney wrote:
> >> diff --git a/arch/powerpc/kernel/membarrier.c 
> >> b/arch/powerpc/kernel/membarrier.c
> >> new file mode 100644
> >> index ..b0d79a5f5981
> >> --- /dev/null
> >> +++ b/arch/powerpc/kernel/membarrier.c
> >> @@ -0,0 +1,45 @@
> > 
> >> +void membarrier_arch_register_private_expedited(struct task_struct *p)
> >> +{
> >> +  struct task_struct *t;
> >> +
> >> +  if (get_nr_threads(p) == 1) {
> >> +  set_thread_flag(TIF_MEMBARRIER_PRIVATE_EXPEDITED);
> >> +  return;
> >> +  }
> >> +  /*
> >> +   * Coherence of TIF_MEMBARRIER_PRIVATE_EXPEDITED against thread
> >> +   * fork is protected by siglock.
> >> +   */
> >> +  spin_lock(>sighand->siglock);
> >> +  for_each_thread(p, t)
> >> +  set_ti_thread_flag(task_thread_info(t),
> >> +  TIF_MEMBARRIER_PRIVATE_EXPEDITED);
> > 
> > I'm not sure this works correctly vs CLONE_VM without CLONE_THREAD.
> 
> The intent here is to hold the sighand siglock to provide mutual
> exclusion against invocation of membarrier_fork(p, clone_flags)
> by copy_process().
> 
> copy_process() grabs spin_lock(>sighand->siglock) for both
> CLONE_THREAD and not CLONE_THREAD flags.
> 
> What am I missing here ?
> 
> > 
> >> +  spin_unlock(>sighand->siglock);
> >> +  /*
> >> +   * Ensure all future scheduler executions will observe the new
> >> +   * thread flag state for this process.
> >> +   */
> >> +  synchronize_sched();
> > 
> > This relies on the flag being read inside rq->lock, right?
> 
> Yes. The flag is read by membarrier_arch_switch_mm(), invoked
> within switch_mm_irqs_off(), called by context_switch() before
> finish_task_switch() releases the rq lock.

I fail to graps the relation between this synchronize_sched() and rq->lock.

(Besides, we made no reference to rq->lock while discussing:

  
https://github.com/paulmckrcu/litmus/commit/47039df324b60ace0cf7b2403299580be730119b
  replace membarrier_arch_sched_in with switch_mm_irqs_off )

Could you elaborate?

  Andrea


> 
> Is the comment clear enough, or do you have suggestions for
> improvements ?



> 
> Thanks,
> 
> Mathieu
> 
> > 
> > > +}
> 
> -- 
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com


Re: [PATCH tip/core/rcu 1/3] membarrier: Provide register expedited private command

2017-10-08 Thread Avi Kivity



On 10/05/2017 07:23 AM, Nicholas Piggin wrote:

On Wed,  4 Oct 2017 14:37:53 -0700
"Paul E. McKenney"  wrote:


From: Mathieu Desnoyers 

Provide a new command allowing processes to register their intent to use
the private expedited command.

This allows PowerPC to skip the full memory barrier in switch_mm(), and
only issue the barrier when scheduling into a task belonging to a
process that has registered to use expedited private.

Processes are now required to register before using
MEMBARRIER_CMD_PRIVATE_EXPEDITED, otherwise that command returns EPERM.

Changes since v1:
- Use test_ti_thread_flag(next, ...) instead of test_thread_flag() in
   powerpc membarrier_arch_sched_in(), given that we want to specifically
   check the next thread state.
- Add missing ARCH_HAS_MEMBARRIER_HOOKS in Kconfig.
- Use task_thread_info() to pass thread_info from task to
   *_ti_thread_flag().

Changes since v2:
- Move membarrier_arch_sched_in() call to finish_task_switch().
- Check for NULL t->mm in membarrier_arch_fork().
- Use membarrier_sched_in() in generic code, which invokes the
   arch-specific membarrier_arch_sched_in(). This fixes allnoconfig
   build on PowerPC.
- Move asm/membarrier.h include under CONFIG_MEMBARRIER, fixing
   allnoconfig build on PowerPC.
- Build and runtime tested on PowerPC.

Changes since v3:
- Simply rely on copy_mm() to copy the membarrier_private_expedited mm
   field on fork.
- powerpc: test thread flag instead of reading
   membarrier_private_expedited in membarrier_arch_fork().
- powerpc: skip memory barrier in membarrier_arch_sched_in() if coming
   from kernel thread, since mmdrop() implies a full barrier.
- Set membarrier_private_expedited to 1 only after arch registration
   code, thus eliminating a race where concurrent commands could succeed
   when they should fail if issued concurrently with process
   registration.
- Use READ_ONCE() for membarrier_private_expedited field access in
   membarrier_private_expedited. Matches WRITE_ONCE() performed in
   process registration.

Changes since v4:
- Move powerpc hook from sched_in() to switch_mm(), based on feedback
   from Nicholas Piggin.

For now, the powerpc approach is okay by me. I plan to test
others (e.g., taking runqueue locks) on larger systems, but that can
be sent as an incremental patch at a later time.

The main thing I would like is for people to review the userspace API.



As a future satisfied user of the expedited private membarrier syscall, 
I am happy with the change.




Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER

2017-10-08 Thread Kalle Valo
Kees Cook  writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
> $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook 
> Acked-by: Geert Uytterhoeven  # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo 

-- 
Kalle Valo


[PATCH] mm: remove unnecessary WARN_ONCE in page_vma_mapped_walk().

2017-10-08 Thread Zi Yan
From: Zi Yan 

A non present pmd entry can appear after pmd_lock is taken in
page_vma_mapped_walk(), even if THP migration is not enabled.
The WARN_ONCE is unnecessary.

Fixes: 616b8371539a ("mm: thp: enable thp migration in generic path")
Reported-and-tested-by: Abdul Haleem 
Signed-off-by: Zi Yan 
Cc: "Kirill A. Shutemov" 
Cc: Anshuman Khandual 
Cc: Andrew Morton 
---
 mm/page_vma_mapped.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
index 6a03946469a9..eb462e7db0a9 100644
--- a/mm/page_vma_mapped.c
+++ b/mm/page_vma_mapped.c
@@ -167,8 +167,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
return not_found(pvmw);
return true;
}
-   } else
-   WARN_ONCE(1, "Non present huge pmd without pmd 
migration enabled!");
+   }
return not_found(pvmw);
} else {
/* THP pmd was split under us: handle on pte level */
-- 
2.14.1



Re: [PATCH 03/25] powerpc: track allocation status of all pkeys

2017-10-08 Thread Ram Pai
On Sat, Oct 07, 2017 at 09:02:55PM +1100, Michael Ellerman wrote:
> Ram Pai  writes:
> 
> > Total 32 keys are available on power7 and above. However
> > pkey 0,1 are reserved. So effectively we  have  30 pkeys.
> >
> > On 4K kernels, we do not  have  5  bits  in  the  PTE to
> > represent  all the keys; we only have 3bits.Two of those
> > keys are reserved; pkey 0 and pkey 1. So effectively  we
> > have 6 pkeys.
> >
> > This patch keeps track of reserved keys, allocated  keys
> > and keys that are currently free.
> >
> > Also it  adds  skeletal  functions  and macros, that the
> > architecture-independent code expects to be available.
> >
> > Signed-off-by: Ram Pai 
> > ---
> >  arch/powerpc/include/asm/book3s/64/mmu.h |9 
> >  arch/powerpc/include/asm/mmu_context.h   |1 +
> >  arch/powerpc/include/asm/pkeys.h |   72 
> > --
> >  arch/powerpc/mm/mmu_context_book3s64.c   |2 +
> >  arch/powerpc/mm/pkeys.c  |   28 
> >  5 files changed, 108 insertions(+), 4 deletions(-)
> 
> This doesn't build for me, with pseries_le_defconfig. I assume it built
> for you. So something has changed upstream maybe?
> 

Yes. :(
The following commit upstream broke my patches.
df3735c5b40fad8d0d28eb8ab065fe955b3347ee

Will fix and send you a patch.

RP



> 
> In file included from ../include/linux/pkeys.h:8:0,
>  from ../mm/mprotect.c:26:
> ../mm/mprotect.c: In function ‘do_mprotect_pkey’:
> ../arch/powerpc/include/asm/pkeys.h:27:29: error: ‘VM_PKEY_BIT0’ undeclared 
> (first use in this function)
>  #define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \
>  ^
..snip...



Linux 4.14: Reported regressions as of Sunday, 2017-10-08

2017-10-08 Thread Thorsten Leemhuis
Hi! Find below my second regression report for Linux 4.14. It lists 8
regressions I'm currently aware of. One regression was fixed since last
weeks report. One was in there that shouldn't have been there.

As always: Are you aware of any other regressions? Then please let me
know by mail (a simple bounce in my direction is enough!). For details
see http://bit.ly/lnxregtrackid And please tell me if there is anything
in the report that shouldn't be there.

Ciao, Thorsten

P.S.: Thx to Adam and Igor for pointing me at two regressions they face.
And thx to Yanko for pointing out a stupidity I did in last weeks report.

== Current regressions ==

"hangs when building e.g. perf" & "Random insta-reboots on AMD Phenom II"
Status: "Mr. Luto better revert the new lazy TLB flushing fun'n'games"
-> "Yeah, working on it.  It's not a straightforward revert."
Note: TWIMC: Workaround: wrmsr -a 0xc0010015 0x118
Reported: 2017-09-05
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1484723.html
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1501379.html
https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1501570.html
Cause: 94b1b03b519b81c494900cb112aa00ed205cc2d9

New default s2idle does not work on Dell XPS 13 9360
Status: works fine on several other owners of this laptop; maybe
specific to the variant or the particular machine the reporter owns;
looks related to the storage device used
Reported: 2017-09-11
https://bugzilla.kernel.org/show_bug.cgi?id=196907
Cause: e870c6c87cf9484090d28f2a68aa29e008960c93 (assumed)

CIFS SMB2+ combined with pythons xattr.listxattr leads to "IOError:
[Errno 61
Status: no reaction from developers yet; reporter needs to reverify and
poke list
Note: Disclaimer: A regression the regression tracker reported
Reported: 2017-09-26
https://marc.info/?l=linux-cifs=150644485708526
Cause: 8dc5b3a6cb2f (assumed)

Ath10k disconnects
Status: WIP, recently got bisected
Note: Only happens with some wifi routers; Disclaimer: A regression the
regression tracker reported
Reported: 2017-10-01
http://lists.infradead.org/pipermail/ath10k/2017-October/010189.html
Cause: c9353bf483d3724c116a9d502c0ead9cec54a61a

Oops in nouveau_fbcon_set_suspend_work during boot or resume on some
machines
Status: No reaction from developers;  ask reporter for bisection
Note: Something specific to  ThinkPad W530 and W531?
Reported: 2017-10-02
https://bugzilla.kernel.org/show_bug.cgi?id=197103
https://bugs.freedesktop.org/show_bug.cgi?id=102381

networking doesn't work in opensuse 42.2 due to apparmor: add base
infastructure for socket mediation
Status: there was a debate if this is a regression or not that faded out
Reported: 2017-10-03
https://lkml.kernel.org/r/1507003338.3174.4.ca...@hansenpartnership.com
Cause: 651e28c5537abb39076d3949fb7618536f1d242e

nftables oops with 4.14.0-rc3 on arm64 (Rock64 board)
Status: Tested fix: http://patchwork.ozlabs.org/patch/821334/
Reported: 2017-10-04
https://bugzilla.kernel.org/show_bug.cgi?id=197123
Cause: 9f08ea848117

WiFi stopped working with 4.14
Status: told reporters they better should bringt this to netdev
Note: maybe these are two different issues; one with rtl8723bs an one
where with 8265 that is related to switching BT on and off
Reported: 2017-10-05
https://bugzilla.kernel.org/show_bug.cgi?id=197137


== Fixed since last report ==

stalls, short lived or long lived lockups very shortly after boot.
Status: got reverted weeks ago and I missed it when compiling last weeks
report (sorry!)
Reported: 2017-09-19
https://marc.info/?l=linux-kernel=150583434416295
Cause: 74def747bcd0

Module removal-related regression
Status: Fixed: 6878e7de6af726de47f9f3bec649c3f49e786586
Reported: 2017-09-09
https://marc.info/?l=linux-kernel=150497889508778
Cause: 1455cf8dbfd06aa7651dcfccbadb7a093944ca65


Re: powerpc/powernv: Make opal_event_shutdown() callable from IRQ context

2017-10-08 Thread Michael Ellerman
On Fri, 2017-09-29 at 03:58:02 UTC, Michael Ellerman wrote:
> In opal_event_shutdown() we free all the IRQs hanging off the
> opal_event_irqchip. However it's not safe to do so if we're called
> from IRQ context, because free_irq() wants to synchronise versus IRQ
> context. This can lead to warnings and a stuck system.
> 
> For example from sysrq-b:
> 
>   Trying to free IRQ 17 from IRQ context!
>   [ cut here ]
>   WARNING: CPU: 0 PID: 0 at kernel/irq/manage.c:1461 __free_irq+0x398/0x8d0
>   ...
>   NIP __free_irq+0x398/0x8d0
>   LR __free_irq+0x394/0x8d0
>   Call Trace:
> __free_irq+0x394/0x8d0 (unreliable)
> free_irq+0xa4/0x140
> opal_event_shutdown+0x128/0x180
> opal_shutdown+0x1c/0xb0
> pnv_shutdown+0x20/0x40
> machine_restart+0x38/0x90
> emergency_restart+0x28/0x40
> sysrq_handle_reboot+0x24/0x40
> __handle_sysrq+0x198/0x590
> hvc_poll+0x48c/0x8c0
> hvc_handle_interrupt+0x1c/0x50
> __handle_irq_event_percpu+0xe8/0x6e0
> handle_irq_event_percpu+0x34/0xe0
> handle_irq_event+0xc4/0x210
> handle_level_irq+0x250/0x770
> generic_handle_irq+0x5c/0xa0
> opal_handle_events+0x11c/0x240
> opal_interrupt+0x38/0x50
> __handle_irq_event_percpu+0xe8/0x6e0
> handle_irq_event_percpu+0x34/0xe0
> handle_irq_event+0xc4/0x210
> handle_fasteoi_irq+0x174/0xa10
> generic_handle_irq+0x5c/0xa0
> __do_irq+0xbc/0x4e0
> call_do_irq+0x14/0x24
> do_IRQ+0x18c/0x540
> hardware_interrupt_common+0x158/0x180
> 
> We can avoid that by using disable_irq_nosync() rather than
> free_irq(). Although it doesn't fully free the IRQ, it should be
> sufficient when we're shutting down, particularly in an emergency.
> 
> Add an in_interrupt() check and use free_irq() when we're shutting
> down normally. It's probably OK to use disable_irq_nosync() in that
> case too, but for now it's safer to leave that behaviour as-is.
> 
> Fixes: 9f0fd0499d30 ("powerpc/powernv: Add a virtual irqchip for opal events")
> Signed-off-by: Michael Ellerman 
> Acked-by: Balbir Singh 

Applied to powerpc next.

https://git.kernel.org/powerpc/c/c6baa077b784c3b37391a8c11f433e

cheers


Re: selftests/powerpc: Use snprintf to construct DSCR sysfs interface paths

2017-10-08 Thread Michael Ellerman
On Thu, 2017-09-28 at 13:34:26 UTC, Seth Forshee wrote:
> Currently sprintf is used, and while paths should never exceed
> the size of the buffer it is theoretically possible since
> dirent.d_name is 256 bytes. As a result this trips
> -Wformat-overflow, and since the test is built with -Wall -Werror
> the causes the build to fail. Switch to using snprintf and skip
> any paths which are too long for the filename buffer.
> 
> Signed-off-by: Seth Forshee 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/06755a871314c7443a89c09650cdb3

cheers


Re: powerpc: Always initialize input array when calling epapr_hypercall()

2017-10-08 Thread Michael Ellerman
On Thu, 2017-09-28 at 13:33:39 UTC, Seth Forshee wrote:
> Several callers to epapr_hypercall() pass an uninitialized stack
> allocated array for the input arguments, presumably because they
> have no input arguments. However this can produce errors like
> this one
> 
>  arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: 'in' may be used 
> uninitialized in this function [-Werror=maybe-uninitialized]
>   unsigned long register r3 asm("r3") = in[0];
> ~~^~~
> 
> Fix callers to this function to always zero-initialize the input
> arguments array to prevent this.
> 
> Signed-off-by: Seth Forshee 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/186b8f1587c79c2fa04bfa392fdf08

cheers


Re: [v2, 1/6] powerpc/kprobes: Some cosmetic updates to try_to_emulate()

2017-10-08 Thread Michael Ellerman
On Fri, 2017-09-22 at 09:10:43 UTC, "Naveen N. Rao" wrote:
> 1. This is only used in kprobes.c, so make it static.
> 2. Remove the un-necessary (ret == 0) comparison in the else clause.
> 
> Reviewed-by: Masami Hiramatsu 
> Reviewed-by: Kamalesh Babulal 
> Signed-off-by: Naveen N. Rao 

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/22085337f5b9d7a7adf5c6cc4e007c

cheers


Re: powerpc: Add PPC_EMULATED_STATS to powernv_defconfig

2017-10-08 Thread Michael Ellerman
On Thu, 2017-09-21 at 05:24:49 UTC, Michael Neuling wrote:
> This is useful, especially for developers.
> 
> Signed-off-by: Michael Neuling 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e366b921c7e32c9b92b4c524696fa8

cheers


Re: powerpc/xmon: Add option to show uptime information

2017-10-08 Thread Michael Ellerman
On Mon, 2017-09-18 at 14:16:58 UTC, "Guilherme G. Piccoli" wrote:
> It might be useful to quickly get the uptime of a running
> system on xmon, without needing to grab data from memory and
> doing math on struct addresses.
> 
> For example, it'd be useful to check for how long after a crash
> a system is on xmon shell or if some test was started after the
> first test crashed (and this 2nd test crashed too into xmon).
> 
> This small patch adds the 'U' command, to accomplish this.
> 
> Suggested-by: Murilo Fossa Vicentini 
> Signed-off-by: Guilherme G. Piccoli 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/59d3391e8cf274097c42369866070c

cheers


Re: [V3] cxl: Add support for POWER9 DD2

2017-10-08 Thread Michael Ellerman
On Fri, 2017-09-08 at 13:52:11 UTC, Christophe Lombard wrote:
> The PSL initialization sequence has been updated to DD2.
> This patch adapts to the changes, retaining compatibility with DD1.
> The patch includes some changes to DD1 fix-ups as well.
> 
> Tests performed on some of the old/new hardware.
> 
> The function is_page_fault(), for POWER9, lists the Translation Checkout
> Responses where the page fault will be handled by copro_handle_mm_fault().
> This list is too restrictive and not necessary.
> 
> This patches removes this restriction and all page faults, whatever the
> reason, will be handled. In this case, the interruption is always
> acknowledged.
> 
> The following features will be added soon:
> - phb reset when switching to capi mode.
> - cxllib update to support new functions.
> 
> Signed-off-by: Christophe Lombard 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5632874311dbf432c698fcbe0cf7a4

cheers


Re: [1/1] powerpc: get_wchan(): solve possible race scenario due to parallel wakeup

2017-10-08 Thread Michael Ellerman
On Tue, 2016-04-19 at 10:18:21 UTC, Kautuk Consul wrote:
> Add a check for p->state == TASK_RUNNING so that any wake-ups on
> task_struct p in the interim lead to 0 being returned by get_wchan().
> 
> Signed-off-by: Kautuk Consul 

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/4ca360f3dbf2036d964cdf3a6c4a45

cheers