Re: [PATCH v3 2/3] Keep interrupts enabled even on soft disable

2017-01-05 Thread kbuild test robot
Hi Balbir,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.10-rc2 next-20170105]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Balbir-Singh/Merge-IPI-and-DEFAULT-priorities/20170106-101307
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-cell_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/head_64.o: In function `handle_irq_mask':
>> (.text+0x2ae0): undefined reference to `handle_masked_irq'

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


.config.gz
Description: application/gzip


Re: [PATCH v4 2/5] ia64: reuse append_elf_note() and final_note() functions

2017-01-05 Thread Dave Young
On 01/05/17 at 11:01pm, Hari Bathini wrote:
> Get rid of multiple definitions of append_elf_note() & final_note()
> functions. Reuse these functions compiled under CONFIG_CRASH_CORE
> Also, define Elf_Word and use it instead of generic u32 or the more
> specific Elf64_Word.
> 
> Signed-off-by: Hari Bathini 
> ---
> 
> Changes from v3:
> * Dropped hard-coded values and used DIV_ROUND_UP().
> 
> Changes from v2:
> * Added a definition for Elf_Word.
> * Used IA64 version of append_elf_note() and final_note() functions.
> 
> 
>  arch/ia64/kernel/crash.c   |   22 --
>  include/linux/crash_core.h |4 
>  include/linux/elf.h|2 ++
>  kernel/crash_core.c|   34 ++
>  kernel/kexec_core.c|   28 
>  5 files changed, 20 insertions(+), 70 deletions(-)
> 
> diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
> index 2955f35..75859a0 100644
> --- a/arch/ia64/kernel/crash.c
> +++ b/arch/ia64/kernel/crash.c
> @@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
>  static int kdump_on_init = 1;
>  static int kdump_on_fatal_mca = 1;
>  
> -static inline Elf64_Word
> -*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
> - size_t data_len)
> -{
> - struct elf_note *note = (struct elf_note *)buf;
> - note->n_namesz = strlen(name) + 1;
> - note->n_descsz = data_len;
> - note->n_type   = type;
> - buf += (sizeof(*note) + 3)/4;
> - memcpy(buf, name, note->n_namesz);
> - buf += (note->n_namesz + 3)/4;
> - memcpy(buf, data, data_len);
> - buf += (data_len + 3)/4;
> - return buf;
> -}
> -
> -static void
> -final_note(void *buf)
> -{
> - memset(buf, 0, sizeof(struct elf_note));
> -}
> -
>  extern void ia64_dump_cpu_regs(void *);
>  
>  static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
> diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
> index 18d0f94..541a197 100644
> --- a/include/linux/crash_core.h
> +++ b/include/linux/crash_core.h
> @@ -55,6 +55,10 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
>  extern size_t vmcoreinfo_size;
>  extern size_t vmcoreinfo_max_size;
>  
> +Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
> +   void *data, size_t data_len);
> +void final_note(Elf_Word *buf);
> +
>  int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
>   unsigned long long *crash_size, unsigned long long *crash_base);
>  int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
> diff --git a/include/linux/elf.h b/include/linux/elf.h
> index 20fa8d8..ba069e8 100644
> --- a/include/linux/elf.h
> +++ b/include/linux/elf.h
> @@ -29,6 +29,7 @@ extern Elf32_Dyn _DYNAMIC [];
>  #define elf_note elf32_note
>  #define elf_addr_t   Elf32_Off
>  #define Elf_Half Elf32_Half
> +#define Elf_Word Elf32_Word
>  
>  #else
>  
> @@ -39,6 +40,7 @@ extern Elf64_Dyn _DYNAMIC [];
>  #define elf_note elf64_note
>  #define elf_addr_t   Elf64_Off
>  #define Elf_Half Elf64_Half
> +#define Elf_Word Elf64_Word
>  
>  #endif
>  
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 80b441d..362dace 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -291,32 +291,26 @@ int __init parse_crashkernel_low(char *cmdline,
>   "crashkernel=", suffix_tbl[SUFFIX_LOW]);
>  }
>  
> -static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
> - void *data, size_t data_len)
> +Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
> +   void *data, size_t data_len)
>  {
> - struct elf_note note;
> -
> - note.n_namesz = strlen(name) + 1;
> - note.n_descsz = data_len;
> - note.n_type   = type;
> - memcpy(buf, , sizeof(note));
> - buf += (sizeof(note) + 3)/4;
> - memcpy(buf, name, note.n_namesz);
> - buf += (note.n_namesz + 3)/4;
> - memcpy(buf, data, note.n_descsz);
> - buf += (note.n_descsz + 3)/4;
> + struct elf_note *note = (struct elf_note *)buf;
> +
> + note->n_namesz = strlen(name) + 1;
> + note->n_descsz = data_len;
> + note->n_type   = type;
> + buf += DIV_ROUND_UP(sizeof(*note), sizeof(Elf_Word));
> + memcpy(buf, name, note->n_namesz);
> + buf += DIV_ROUND_UP(note->n_namesz, sizeof(Elf_Word));
> + memcpy(buf, data, data_len);
> + buf += DIV_ROUND_UP(data_len, sizeof(Elf_Word));
>  
>   return buf;
>  }
>  
> -static void final_note(u32 *buf)
> +void final_note(Elf_Word *buf)
>  {
> - struct elf_note note;
> -
> - note.n_namesz = 0;
> - note.n_descsz = 0;
> - note.n_type   = 0;
> - memcpy(buf, , sizeof(note));
> + memset(buf, 0, sizeof(struct elf_note));
>  }
>  
>  static void update_vmcoreinfo_note(void)
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> 

Re: [PATCH v4 1/5] crash: move crashkernel parsing and vmcore related code under CONFIG_CRASH_CORE

2017-01-05 Thread Dave Young
Hi Hari

Thanks for the update.

On 01/05/17 at 10:59pm, Hari Bathini wrote:
> Traditionally, kdump is used to save vmcore in case of a crash. Some
> architectures like powerpc can save vmcore using architecture specific
> support instead of kexec/kdump mechanism. Such architecture specific
> support also needs to reserve memory, to be used by dump capture kernel.
> crashkernel parameter can be a reused, for memory reservation, by such
> architecture specific infrastructure.
> 
> But currently, code related to vmcoreinfo and parsing of crashkernel
> parameter is built under CONFIG_KEXEC_CORE. This patch introduces
> CONFIG_CRASH_CORE and moves the above mentioned code under this config,
> allowing code reuse without dependency on CONFIG_KEXEC. There is no
> functional change with this patch.
> 
> Signed-off-by: Hari Bathini 
> ---
> 
> Changes from v3:
> * Renamed log_buf_kexec_setup()to log_buf_vmcoreinfo_setup() instead of
>   log_buf_crash_setup().
> 
> Changes from v2:
> * Used CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE at
>   appropriate places in printk and ksysfs.
> 
> 
>  arch/Kconfig   |4 
>  include/linux/crash_core.h |   65 ++
>  include/linux/kexec.h  |   57 --
>  include/linux/printk.h |4 
>  kernel/Makefile|1 
>  kernel/crash_core.c|  445 
> 
>  kernel/kexec_core.c|  404 
>  kernel/ksysfs.c|8 +
>  kernel/printk/printk.c |6 -
>  9 files changed, 531 insertions(+), 463 deletions(-)
>  create mode 100644 include/linux/crash_core.h
>  create mode 100644 kernel/crash_core.c
> 

[snip]

Acked-by: Dave Young 

Thanks
Dave


Re: [PATCH] powerpc/eeh: Enable IO path on permanent error

2017-01-05 Thread Gavin Shan
On Fri, Jan 06, 2017 at 10:46:21AM +1100, Russell Currey wrote:
>On Fri, 2017-01-06 at 10:39 +1100, Gavin Shan wrote:
>> We give up recovery on permanent error, simply shutdown the affected
>> devices and remove them. If the devices can't be put into quiet state,
>> they spew more traffic that is likely to cause another unexpected EEH
>> error. This was observed on "p8dtu2u" machine:
>> 
>>    0002:00:00.0 PCI bridge: IBM Device 03dc
>>    0002:01:00.0 Ethernet controller: Intel Corporation \
>> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>>    0002:01:00.1 Ethernet controller: Intel Corporation \
>> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>>    0002:01:00.2 Ethernet controller: Intel Corporation \
>> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>>    0002:01:00.3 Ethernet controller: Intel Corporation \
>> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>> 
>> On P8 PowerNV platform, the IO path is frozen when shutdowning the
>> devices, meaning the memory registers are inaccessible. It is why
>> the devices can't be put into quiet state before removing them.
>> This fixes the issue by enabling IO path prior to putting the devices
>> into quiet state.
>> 
>> Link: https://github.com/open-power/supermicro-openpower/issues/419
>
>FYI this link isn't publicly accessible.
>

Yeah, I knew it. The reason I put it here is more details out there
for you or me.

>> Reported-by: Pridhiviraj Paidipeddi 
>> Signed-off-by: Gavin Shan 
>> ---
>>  arch/powerpc/kernel/eeh.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
>> index 8180bfd..9de7f79 100644
>> --- a/arch/powerpc/kernel/eeh.c
>> +++ b/arch/powerpc/kernel/eeh.c
>> @@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int
>> severity)
>>   *
>>   * For pHyp, we have to enable IO for log retrieval. Otherwise,
>>   * 0xFF's is always returned from PCI config space.
>> + *
>> + * When the @severity is EEH_LOG_PERM, the PE is going to be
>> + * removed. Prior to that, the drivers for devices included in
>> + * the PE will be closed. The drivers rely on working IO path
>> + * to bring the devices to quiet state. Otherwise, PCI traffic
>> + * from those devices after they are removed is like to cause
>> + * another unexpected EEH error.
>>   */
>>  if (!(pe->type & EEH_PE_PHB)) {
>> -if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
>> +if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG) ||
>> +severity == EEH_LOG_PERM)
>>  eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
>>  
>>  /*
>



Re: [PATCH] powerpc/eeh: Enable IO path on permanent error

2017-01-05 Thread Russell Currey
On Fri, 2017-01-06 at 10:39 +1100, Gavin Shan wrote:
> We give up recovery on permanent error, simply shutdown the affected
> devices and remove them. If the devices can't be put into quiet state,
> they spew more traffic that is likely to cause another unexpected EEH
> error. This was observed on "p8dtu2u" machine:
> 
>    0002:00:00.0 PCI bridge: IBM Device 03dc
>    0002:01:00.0 Ethernet controller: Intel Corporation \
> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>    0002:01:00.1 Ethernet controller: Intel Corporation \
> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>    0002:01:00.2 Ethernet controller: Intel Corporation \
> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
>    0002:01:00.3 Ethernet controller: Intel Corporation \
> Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
> 
> On P8 PowerNV platform, the IO path is frozen when shutdowning the
> devices, meaning the memory registers are inaccessible. It is why
> the devices can't be put into quiet state before removing them.
> This fixes the issue by enabling IO path prior to putting the devices
> into quiet state.
> 
> Link: https://github.com/open-power/supermicro-openpower/issues/419

FYI this link isn't publicly accessible.

> Reported-by: Pridhiviraj Paidipeddi 
> Signed-off-by: Gavin Shan 
> ---
>  arch/powerpc/kernel/eeh.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
> index 8180bfd..9de7f79 100644
> --- a/arch/powerpc/kernel/eeh.c
> +++ b/arch/powerpc/kernel/eeh.c
> @@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int
> severity)
>    *
>    * For pHyp, we have to enable IO for log retrieval. Otherwise,
>    * 0xFF's is always returned from PCI config space.
> +  *
> +  * When the @severity is EEH_LOG_PERM, the PE is going to be
> +  * removed. Prior to that, the drivers for devices included in
> +  * the PE will be closed. The drivers rely on working IO path
> +  * to bring the devices to quiet state. Otherwise, PCI traffic
> +  * from those devices after they are removed is like to cause
> +  * another unexpected EEH error.
>    */
>   if (!(pe->type & EEH_PE_PHB)) {
> - if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
> + if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG) ||
> + severity == EEH_LOG_PERM)
>   eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
>  
>   /*



[PATCH] powerpc/eeh: Enable IO path on permanent error

2017-01-05 Thread Gavin Shan
We give up recovery on permanent error, simply shutdown the affected
devices and remove them. If the devices can't be put into quiet state,
they spew more traffic that is likely to cause another unexpected EEH
error. This was observed on "p8dtu2u" machine:

   0002:00:00.0 PCI bridge: IBM Device 03dc
   0002:01:00.0 Ethernet controller: Intel Corporation \
Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
   0002:01:00.1 Ethernet controller: Intel Corporation \
Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
   0002:01:00.2 Ethernet controller: Intel Corporation \
Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)
   0002:01:00.3 Ethernet controller: Intel Corporation \
Ethernet Controller X710/X557-AT 10GBASE-T (rev 02)

On P8 PowerNV platform, the IO path is frozen when shutdowning the
devices, meaning the memory registers are inaccessible. It is why
the devices can't be put into quiet state before removing them.
This fixes the issue by enabling IO path prior to putting the devices
into quiet state.

Link: https://github.com/open-power/supermicro-openpower/issues/419
Reported-by: Pridhiviraj Paidipeddi 
Signed-off-by: Gavin Shan 
---
 arch/powerpc/kernel/eeh.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 8180bfd..9de7f79 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -298,9 +298,17 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
 *
 * For pHyp, we have to enable IO for log retrieval. Otherwise,
 * 0xFF's is always returned from PCI config space.
+*
+* When the @severity is EEH_LOG_PERM, the PE is going to be
+* removed. Prior to that, the drivers for devices included in
+* the PE will be closed. The drivers rely on working IO path
+* to bring the devices to quiet state. Otherwise, PCI traffic
+* from those devices after they are removed is like to cause
+* another unexpected EEH error.
 */
if (!(pe->type & EEH_PE_PHB)) {
-   if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
+   if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG) ||
+   severity == EEH_LOG_PERM)
eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
 
/*
-- 
2.7.4



Re: [PATCH v2 6/6] [media] Only descend into directory when CONFIG_MEDIA_SUPPORT is set

2017-01-05 Thread Arnd Bergmann
On Thursday, January 5, 2017 4:35:33 PM CET Andrew F. Davis wrote:
> On 01/05/2017 03:42 PM, Arnd Bergmann wrote:
> > On Thursday, January 5, 2017 3:01:58 PM CET Andrew F. Davis wrote:
> >> @@ -109,7 +109,8 @@ obj-$(CONFIG_SERIO) += input/serio/
> >>  obj-$(CONFIG_GAMEPORT) += input/gameport/
> >>  obj-$(CONFIG_INPUT)+= input/
> >>  obj-$(CONFIG_RTC_LIB)  += rtc/
> >> -obj-y  += i2c/ media/
> >> +obj-y  += i2c/
> >> +obj-$(CONFIG_MEDIA_SUPPORT)+= media/
> >>  obj-$(CONFIG_PPS)  += pps/
> >>  obj-y  += ptp/
> >>  obj-$(CONFIG_W1)   += w1/
> >>
> > 
> > This one seems wrong: if CONFIG_MEDIA_SUPPORT=m, but some I2C drivers
> > inside of drivers/media/ are built-in, we will fail to enter the directory,
> > see drivers/media/Makefile.
> 
> Not sure if I see this, it looks like everything in drivers/media/
> depends on CONFIG_MEDIA_SUPPORT (directly or indirectly). If
> CONFIG_MEDIA_SUPPORT is =m then all dependents should be locked out of
> being built-in.
> 
> Any bool symbol that controls compilation of source that depends on a
> tristate symbol is broken and should be fixed anyway.

I don't think it's this easy, we have a couple of cases where that doesn't
work. I have not looked at the media example in detail, but at least it
looks intentional.

Note that drivers/media is rather creative with expressing dependencies.

Arnd


Re: [PATCH v2 6/6] [media] Only descend into directory when CONFIG_MEDIA_SUPPORT is set

2017-01-05 Thread Andrew F. Davis
On 01/05/2017 03:42 PM, Arnd Bergmann wrote:
> On Thursday, January 5, 2017 3:01:58 PM CET Andrew F. Davis wrote:
>> @@ -109,7 +109,8 @@ obj-$(CONFIG_SERIO) += input/serio/
>>  obj-$(CONFIG_GAMEPORT) += input/gameport/
>>  obj-$(CONFIG_INPUT)+= input/
>>  obj-$(CONFIG_RTC_LIB)  += rtc/
>> -obj-y  += i2c/ media/
>> +obj-y  += i2c/
>> +obj-$(CONFIG_MEDIA_SUPPORT)+= media/
>>  obj-$(CONFIG_PPS)  += pps/
>>  obj-y  += ptp/
>>  obj-$(CONFIG_W1)   += w1/
>>
> 
> This one seems wrong: if CONFIG_MEDIA_SUPPORT=m, but some I2C drivers
> inside of drivers/media/ are built-in, we will fail to enter the directory,
> see drivers/media/Makefile.

Not sure if I see this, it looks like everything in drivers/media/
depends on CONFIG_MEDIA_SUPPORT (directly or indirectly). If
CONFIG_MEDIA_SUPPORT is =m then all dependents should be locked out of
being built-in.

Any bool symbol that controls compilation of source that depends on a
tristate symbol is broken and should be fixed anyway.

> 
> I checked the other five patches in the series as well, they all look
> ok to me.
> 
>   Arnd
> 


Re: [PATCH v2 6/6] [media] Only descend into directory when CONFIG_MEDIA_SUPPORT is set

2017-01-05 Thread Arnd Bergmann
On Thursday, January 5, 2017 3:01:58 PM CET Andrew F. Davis wrote:
> @@ -109,7 +109,8 @@ obj-$(CONFIG_SERIO) += input/serio/
>  obj-$(CONFIG_GAMEPORT) += input/gameport/
>  obj-$(CONFIG_INPUT)+= input/
>  obj-$(CONFIG_RTC_LIB)  += rtc/
> -obj-y  += i2c/ media/
> +obj-y  += i2c/
> +obj-$(CONFIG_MEDIA_SUPPORT)+= media/
>  obj-$(CONFIG_PPS)  += pps/
>  obj-y  += ptp/
>  obj-$(CONFIG_W1)   += w1/
> 

This one seems wrong: if CONFIG_MEDIA_SUPPORT=m, but some I2C drivers
inside of drivers/media/ are built-in, we will fail to enter the directory,
see drivers/media/Makefile.

I checked the other five patches in the series as well, they all look
ok to me.

Arnd


[PATCH v2 4/6] macintosh: Only descend into directory when CONFIG_MACINTOSH_DRIVERS is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_MACINTOSH_DRIVERS is not set make will still descend into the
macintosh directory but nothing will be built. This produces unneeded
build artifacts and messages in addition to slowing the build.
Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index f47f23cf817a..0823730bc50b 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -75,7 +75,7 @@ obj-$(CONFIG_LIBNVDIMM)   += nvdimm/
 obj-$(CONFIG_DEV_DAX)  += dax/
 obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
 obj-$(CONFIG_NUBUS)+= nubus/
-obj-y  += macintosh/
+obj-$(CONFIG_MACINTOSH_DRIVERS)+= macintosh/
 obj-$(CONFIG_IDE)  += ide/
 obj-$(CONFIG_SCSI) += scsi/
 obj-y  += nvme/
-- 
2.11.0



[PATCH v2 6/6] [media] Only descend into directory when CONFIG_MEDIA_SUPPORT is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_MEDIA_SUPPORT is not set make will still descend into the
media directory but nothing will be built. This produces unneeded build
artifacts and messages in addition to slowing the build. Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 59d6e0f5643d..9ccec4924ad1 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -109,7 +109,8 @@ obj-$(CONFIG_SERIO) += input/serio/
 obj-$(CONFIG_GAMEPORT) += input/gameport/
 obj-$(CONFIG_INPUT)+= input/
 obj-$(CONFIG_RTC_LIB)  += rtc/
-obj-y  += i2c/ media/
+obj-y  += i2c/
+obj-$(CONFIG_MEDIA_SUPPORT)+= media/
 obj-$(CONFIG_PPS)  += pps/
 obj-y  += ptp/
 obj-$(CONFIG_W1)   += w1/
-- 
2.11.0



[PATCH v2 5/6] auxdisplay: Only descend into directory when CONFIG_AUXDISPLAY is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_AUXDISPLAY is not set make will still descend into the
auxdisplay directory but nothing will be built. This produces unneeded
build artifacts and messages in addition to slowing the build.
Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 0823730bc50b..59d6e0f5643d 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -92,7 +92,7 @@ obj-y += firewire/
 obj-$(CONFIG_UIO)  += uio/
 obj-$(CONFIG_VFIO) += vfio/
 obj-y  += cdrom/
-obj-y  += auxdisplay/
+obj-$(CONFIG_AUXDISPLAY)   += auxdisplay/
 obj-$(CONFIG_PCCARD)   += pcmcia/
 obj-$(CONFIG_DIO)  += dio/
 obj-$(CONFIG_SBUS) += sbus/
-- 
2.11.0



[PATCH v2 3/6] NFC: Only descend into nfc directory when CONFIG_NFC is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_NFC is not set make will still descend into the nfc
directory but nothing will be built. This produces unneeded build
artifacts and messages in addition to slowing the build. Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index b3adeb421000..f47f23cf817a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -66,7 +66,11 @@ obj-$(CONFIG_FB_INTEL)  += video/fbdev/intelfb/
 
 obj-$(CONFIG_PARPORT)  += parport/
 obj-$(CONFIG_NVM)  += lightnvm/
-obj-y  += base/ block/ misc/ mfd/ nfc/
+obj-y  += base/
+obj-y  += block/
+obj-y  += misc/
+obj-y  += mfd/
+obj-$(CONFIG_NFC)  += nfc/
 obj-$(CONFIG_LIBNVDIMM)+= nvdimm/
 obj-$(CONFIG_DEV_DAX)  += dax/
 obj-$(CONFIG_DMA_SHARED_BUFFER) += dma-buf/
-- 
2.11.0



[PATCH v2 0/6] Remove unneeded build directory traversals

2017-01-05 Thread Andrew F. Davis
Hello all,

I was building a kernel for x86 and noticed Make still descended into
directories like drivers/gpu/drm/hisilicon, this seems kind of odd given
nothing will be built here. It looks to be due to some directories being
included in obj-y unconditionally instead of only when the relevant
CONFIG_ is set.

These patches are split by subsystem in-case, for some reason, a file in
a directory does need to be built, I believe I have checked for all
instances of this, but a quick review from some maintainers would be nice.

Thanks,
Andrew

Changes from v1:
 - Removed patches already taken by maintainers
 - Rebased on v4.10-rc1 (no changes needed)

Andrew F. Davis (6):
  pwm: Only descend into pwm directory when CONFIG_PWM is set
  amba: Only descend into amba directory when CONFIG_ARM_AMBA is set
  NFC: Only descend into nfc directory when CONFIG_NFC is set
  macintosh: Only descend into directory when CONFIG_MACINTOSH_DRIVERS
is set
  auxdisplay: Only descend into directory when CONFIG_AUXDISPLAY is set
  [media] Only descend into directory when CONFIG_MEDIA_SUPPORT is set

 drivers/Makefile | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

-- 
2.11.0



[PATCH v2 2/6] amba: Only descend into amba directory when CONFIG_ARM_AMBA is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_ARM_AMBA is not set make will still descend into the amba
directory but nothing will be built. This produces unneeded build
artifacts and messages in addition to slowing the build. Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 0d0ed1b727d1..b3adeb421000 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -28,7 +28,7 @@ obj-$(CONFIG_SFI) += sfi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)  += pnp/
-obj-y  += amba/
+obj-$(CONFIG_ARM_AMBA) += amba/
 
 obj-y  += clk/
 # Many drivers will want to use DMA so this has to be made available
-- 
2.11.0



[PATCH v2 1/6] pwm: Only descend into pwm directory when CONFIG_PWM is set

2017-01-05 Thread Andrew F. Davis
When CONFIG_PWM is not set make will still descend into the pwm
directory but nothing will be built. This produces unneeded build
artifacts and messages in addition to slowing the build. Fix this here.

Signed-off-by: Andrew F. Davis 
---
 drivers/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 060026a02f59..0d0ed1b727d1 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy/
 # GPIO must come after pinctrl as gpios may need to mux pins etc
 obj-$(CONFIG_PINCTRL)  += pinctrl/
 obj-$(CONFIG_GPIOLIB)  += gpio/
-obj-y  += pwm/
+obj-$(CONFIG_PWM)  += pwm/
 obj-$(CONFIG_PCI)  += pci/
 obj-$(CONFIG_PARISC)   += parisc/
 obj-$(CONFIG_RAPIDIO)  += rapidio/
-- 
2.11.0



Re: [PATCH] cpufreq: Remove CONFIG_CPU_FREQ_STAT_DETAILS config option

2017-01-05 Thread Krzysztof Kozlowski
On Thu, Jan 05, 2017 at 01:57:41PM +0530, Viresh Kumar wrote:
> This doesn't have any benefit apart from saving a small amount of memory
> when it is disabled. The ifdef hackery in the code makes it dirty
> unnecessarily.
> 
> Clean it up by removing the Kconfig option completely. Few defconfigs
> are also updated and CONFIG_CPU_FREQ_STAT_DETAILS is replaced with
> CONFIG_CPU_FREQ_STAT now in them, as users wanted stats to be enabled.
> 
> Signed-off-by: Viresh Kumar 
> ---
>  arch/arm/configs/exynos_defconfig |  2 +-
>  arch/arm/configs/multi_v5_defconfig   |  2 +-
>  arch/arm/configs/multi_v7_defconfig   |  2 +-
>  arch/arm/configs/mvebu_v5_defconfig   |  2 +-
>  arch/arm/configs/pxa_defconfig|  2 +-
>  arch/arm/configs/shmobile_defconfig   |  2 +-
>  arch/mips/configs/lemote2f_defconfig  |  1 -
>  arch/powerpc/configs/ppc6xx_defconfig |  1 -
>  arch/sh/configs/sh7785lcr_32bit_defconfig |  2 +-
>  drivers/cpufreq/Kconfig   |  8 
>  drivers/cpufreq/cpufreq_stats.c   | 14 --
>  11 files changed, 7 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/arm/configs/exynos_defconfig 
> b/arch/arm/configs/exynos_defconfig
> index 79c415c33f69..809f0bf3042a 100644
> --- a/arch/arm/configs/exynos_defconfig
> +++ b/arch/arm/configs/exynos_defconfig
> @@ -24,7 +24,7 @@ CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_ARM_ATAG_DTB_COMPAT=y
>  CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x4100,8M 
> console=ttySAC1,115200 init=/linuxrc mem=256M"
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
>  CONFIG_CPU_FREQ_GOV_USERSPACE=m

For Exynos:
Acked-by: Krzysztof Kozlowski 

Best regards,
Krzysztof



Re: [RFC 1/4] mm: remove unused TASK_SIZE_OF()

2017-01-05 Thread Andy Lutomirski
On Thu, Jan 5, 2017 at 1:51 AM, David Laight  wrote:
> From: Dmitry Safonov
>> Sent: 30 December 2016 15:57
>> All users of TASK_SIZE_OF(tsk) have migrated to mm->task_size or
>> TASK_SIZE_MAX since:
>> commit d696ca016d57 ("x86/fsgsbase/64: Use TASK_SIZE_MAX for
>> FSBASE/GSBASE upper limits"),
>> commit a06db751c321 ("pagemap: check permissions and capabilities at
>> open time"),
> ...
>> +#define TASK_SIZE(current->thread.task_size)
>
> I'm not sure I like he hidden 'current' argument to an
> apparent constant.

Me neither.  But this patch is merely changing the implementation.


Re: [PATCH v3 1/5] crash: move crashkernel parsing and vmcore related code under CONFIG_CRASH_CORE

2017-01-05 Thread Hari Bathini

Hi Dave,


On Thursday 05 January 2017 11:47 AM, Dave Young wrote:

Hi, Hari

On 01/02/17 at 07:43pm, Hari Bathini wrote:

Traditionally, kdump is used to save vmcore in case of a crash. Some
architectures like powerpc can save vmcore using architecture specific
support instead of kexec/kdump mechanism. Such architecture specific
support also needs to reserve memory, to be used by dump capture kernel.
crashkernel parameter can be a reused, for memory reservation, by such
architecture specific infrastructure.

But currently, code related to vmcoreinfo and parsing of crashkernel
parameter is built under CONFIG_KEXEC_CORE. This patch introduces
CONFIG_CRASH_CORE and moves the above mentioned code under this config,
allowing code reuse without dependency on CONFIG_KEXEC. There is no
functional change with this patch.

Signed-off-by: Hari Bathini 
---

Changes from v2:
* Used CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE at
   appropriate places in printk and ksysfs.


  arch/Kconfig   |4
  include/linux/crash_core.h |   65 ++
  include/linux/kexec.h  |   57 --
  include/linux/printk.h |4
  kernel/Makefile|1
  kernel/crash_core.c|  445 
  kernel/kexec_core.c|  404 
  kernel/ksysfs.c|8 +
  kernel/printk/printk.c |6 -
  9 files changed, 531 insertions(+), 463 deletions(-)
  create mode 100644 include/linux/crash_core.h
  create mode 100644 kernel/crash_core.c


[snip]


  #ifndef CONFIG_TINY_RCU
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 8b26964..d0dfebd 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -32,7 +32,7 @@
  #include 
  #include 
  #include 
-#include 
+#include 
  #include 
  #include 
  #include 
@@ -951,7 +951,7 @@ const struct file_operations kmsg_fops = {
.release = devkmsg_release,
  };
  
-#ifdef CONFIG_KEXEC_CORE

+#ifdef CONFIG_CRASH_CORE
  /*
   * This appends the listed symbols to /proc/vmcore
   *
@@ -960,7 +960,7 @@ const struct file_operations kmsg_fops = {
   * symbols are specifically used so that utilities can access and extract the
   * dmesg log from a vmcore file after a crash.
   */
-void log_buf_kexec_setup(void)
+void log_buf_crash_setup(void)

I can not think of any better name about the CONFIG_CRASH_CORE though I
feel it is not excellent so personally I can live with it.

But for this function name log_buf_crash_setup is too general, I can not get
what it is doing from the name, how about change it to log_buf_vmcoreinfo_setup


log_buf_vmcoreinfo_setup is appropriate.  Also dropped hard-coded values
for DIV_ROUND_UP().
Posted v4 with these changes..

Thanks
Hari



[PATCH v4 5/5] powerpc/fadump: update documentation about crashkernel parameter reuse

2017-01-05 Thread Hari Bathini
As we are reusing crashkernel parameter instead of fadump_reserve_mem
parameter to specify the memory to reserve for fadump's crash kernel,
update the documentation accordingly.

Signed-off-by: Hari Bathini 
---
 Documentation/powerpc/firmware-assisted-dump.txt |   23 ++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/Documentation/powerpc/firmware-assisted-dump.txt 
b/Documentation/powerpc/firmware-assisted-dump.txt
index 3007bc9..8394bc8 100644
--- a/Documentation/powerpc/firmware-assisted-dump.txt
+++ b/Documentation/powerpc/firmware-assisted-dump.txt
@@ -55,10 +55,14 @@ as follows:
  booted with restricted memory. By default, the boot memory
  size will be the larger of 5% of system RAM or 256MB.
  Alternatively, user can also specify boot memory size
- through boot parameter 'fadump_reserve_mem=' which will
- override the default calculated size. Use this option
- if default boot memory size is not sufficient for second
- kernel to boot successfully.
+ through boot parameter 'crashkernel=' which will override
+ the default calculated size. Use this option if default
+ boot memory size is not sufficient for second kernel to
+ boot successfully. For syntax of crashkernel= parameter,
+ refer to Documentation/kdump/kdump.txt. If any offset is
+ provided in crashkernel= parameter, it will be ignored
+ as fadump reserves memory at end of RAM for boot memory
+ dump preservation in case of a crash.
 
 -- After the low memory (boot memory) area has been saved, the
firmware will reset PCI and other hardware state.  It will
@@ -158,13 +162,16 @@ How to enable firmware-assisted dump (fadump):
 
 1. Set config option CONFIG_FA_DUMP=y and build kernel.
 2. Boot into linux kernel with 'fadump=on' kernel cmdline option.
-3. Optionally, user can also set 'fadump_reserve_mem=' kernel cmdline
+3. Optionally, user can also set 'crashkernel=' kernel cmdline
to specify size of the memory to reserve for boot memory dump
preservation.
 
-NOTE: If firmware-assisted dump fails to reserve memory then it will
-   fallback to existing kdump mechanism if 'crashkernel=' option
-   is set at kernel cmdline.
+NOTE: 1. 'fadump_reserve_mem=' parameter has been deprecated. Instead
+ use 'crashkernel=' to specify size of the memory to reserve
+ for boot memory dump preservation.
+  2. If firmware-assisted dump fails to reserve memory then it
+ will fallback to existing kdump mechanism if 'crashkernel='
+ option is set at kernel cmdline.
 
 Sysfs/debugfs files:
 



[PATCH v4 4/5] powerpc/fadump: reuse crashkernel parameter for fadump memory reservation

2017-01-05 Thread Hari Bathini
fadump supports specifying memory to reserve for fadump's crash kernel
with fadump_reserve_mem kernel parameter. This parameter currently
supports passing a fixed memory size, like fadump_reserve_mem=
only. This patch aims to add support for other syntaxes like range-based
memory size :[,:,:,...]
which allows using the same parameter to boot the kernel with different
system RAM sizes.

As crashkernel parameter already supports the above mentioned syntaxes,
this patch deprecates fadump_reserve_mem parameter and reuses crashkernel
parameter instead, to specify memory for fadump's crash kernel memory
reservation as well. If any offset is provided in crashkernel parameter,
it will be ignored in case of fadump, as fadump reserves memory at end
of RAM.

Advantages using crashkernel parameter instead of fadump_reserve_mem
parameter are one less kernel parameter overall, code reuse and support
for multiple syntaxes to specify memory.

Suggested-by: Dave Young 
Signed-off-by: Hari Bathini 
---
 arch/powerpc/kernel/fadump.c |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index db0b339..de7d39a 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -210,14 +210,20 @@ static unsigned long init_fadump_mem_struct(struct 
fadump_mem_struct *fdm,
  */
 static inline unsigned long fadump_calculate_reserve_size(void)
 {
-   unsigned long size;
+   int ret;
+   unsigned long long base, size;
 
/*
-* Check if the size is specified through fadump_reserve_mem= cmdline
-* option. If yes, then use that.
+* Check if the size is specified through crashkernel= cmdline
+* option. If yes, then use that but ignore base as fadump
+* reserves memory at end of RAM.
 */
-   if (fw_dump.reserve_bootvar)
+   ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+   , );
+   if (ret == 0 && size > 0) {
+   fw_dump.reserve_bootvar = (unsigned long)size;
return fw_dump.reserve_bootvar;
+   }
 
/* divide by 20 to get 5% of value */
size = memblock_end_of_DRAM() / 20;
@@ -353,15 +359,6 @@ static int __init early_fadump_param(char *p)
 }
 early_param("fadump", early_fadump_param);
 
-/* Look for fadump_reserve_mem= cmdline option */
-static int __init early_fadump_reserve_mem(char *p)
-{
-   if (p)
-   fw_dump.reserve_bootvar = memparse(p, );
-   return 0;
-}
-early_param("fadump_reserve_mem", early_fadump_reserve_mem);
-
 static void register_fw_dump(struct fadump_mem_struct *fdm)
 {
int rc;



[PATCH v4 3/5] powerpc/fadump: remove dependency with CONFIG_KEXEC

2017-01-05 Thread Hari Bathini
Now that crashkernel parameter parsing and vmcoreinfo related code is
moved under CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE, remove
dependency with CONFIG_KEXEC for CONFIG_FA_DUMP. While here, get rid
of definitions of fadump_append_elf_note() & fadump_final_note()
functions to reuse similar functions compiled under CONFIG_CRASH_CORE.

Signed-off-by: Hari Bathini 
---
 arch/powerpc/Kconfig   |   10 ++
 arch/powerpc/include/asm/fadump.h  |2 ++
 arch/powerpc/kernel/crash.c|2 --
 arch/powerpc/kernel/fadump.c   |   34 +++---
 arch/powerpc/kernel/setup-common.c |5 +
 5 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a8ee573..b9726be 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -513,21 +513,23 @@ config RELOCATABLE_TEST
  relocation code.
 
 config CRASH_DUMP
-   bool "Build a kdump crash kernel"
+   bool "Build a dump capture kernel"
depends on PPC64 || 6xx || FSL_BOOKE || (44x && !SMP)
select RELOCATABLE if (PPC64 && !COMPILE_TEST) || 44x || FSL_BOOKE
help
- Build a kernel suitable for use as a kdump capture kernel.
+ Build a kernel suitable for use as a dump capture kernel.
  The same kernel binary can be used as production kernel and dump
  capture kernel.
 
 config FA_DUMP
bool "Firmware-assisted dump"
-   depends on PPC64 && PPC_RTAS && CRASH_DUMP && KEXEC_CORE
+   depends on PPC64 && PPC_RTAS
+   select CRASH_CORE
+   select CRASH_DUMP
help
  A robust mechanism to get reliable kernel crash dump with
  assistance from firmware. This approach does not use kexec,
- instead firmware assists in booting the kdump kernel
+ instead firmware assists in booting the capture kernel
  while preserving memory contents. Firmware-assisted dump
  is meant to be a kdump replacement offering robustness and
  speed not possible without system firmware assistance.
diff --git a/arch/powerpc/include/asm/fadump.h 
b/arch/powerpc/include/asm/fadump.h
index 0031806..60b9108 100644
--- a/arch/powerpc/include/asm/fadump.h
+++ b/arch/powerpc/include/asm/fadump.h
@@ -73,6 +73,8 @@
reg_entry++;\
 })
 
+extern int crashing_cpu;
+
 /* Kernel Dump section info */
 struct fadump_section {
__be32  request_flag;
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 47b63de..cbabb5a 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -43,8 +43,6 @@
 #define IPI_TIMEOUT1
 #define REAL_MODE_TIMEOUT  1
 
-/* This keeps a track of which one is the crashing cpu. */
-int crashing_cpu = -1;
 static int time_to_dump;
 
 #define CRASH_HANDLER_MAX 3
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 8f0c7c5..db0b339 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -486,34 +486,6 @@ fadump_read_registers(struct fadump_reg_entry *reg_entry, 
struct pt_regs *regs)
return reg_entry;
 }
 
-static u32 *fadump_append_elf_note(u32 *buf, char *name, unsigned type,
-   void *data, size_t data_len)
-{
-   struct elf_note note;
-
-   note.n_namesz = strlen(name) + 1;
-   note.n_descsz = data_len;
-   note.n_type   = type;
-   memcpy(buf, , sizeof(note));
-   buf += (sizeof(note) + 3)/4;
-   memcpy(buf, name, note.n_namesz);
-   buf += (note.n_namesz + 3)/4;
-   memcpy(buf, data, note.n_descsz);
-   buf += (note.n_descsz + 3)/4;
-
-   return buf;
-}
-
-static void fadump_final_note(u32 *buf)
-{
-   struct elf_note note;
-
-   note.n_namesz = 0;
-   note.n_descsz = 0;
-   note.n_type   = 0;
-   memcpy(buf, , sizeof(note));
-}
-
 static u32 *fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs)
 {
struct elf_prstatus prstatus;
@@ -524,8 +496,8 @@ static u32 *fadump_regs_to_elf_notes(u32 *buf, struct 
pt_regs *regs)
 * prstatus.pr_pid = 
 */
elf_core_copy_kernel_regs(_reg, regs);
-   buf = fadump_append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
-   , sizeof(prstatus));
+   buf = append_elf_note(buf, CRASH_CORE_NOTE_NAME, NT_PRSTATUS,
+ , sizeof(prstatus));
return buf;
 }
 
@@ -666,7 +638,7 @@ static int __init fadump_build_cpu_notes(const struct 
fadump_mem_struct *fdm)
note_buf = fadump_regs_to_elf_notes(note_buf, );
}
}
-   fadump_final_note(note_buf);
+   final_note(note_buf);
 
if (fdh) {
pr_debug("Updating elfcore header (%llx) with cpu notes\n",
diff --git a/arch/powerpc/kernel/setup-common.c 

[PATCH v4 2/5] ia64: reuse append_elf_note() and final_note() functions

2017-01-05 Thread Hari Bathini
Get rid of multiple definitions of append_elf_note() & final_note()
functions. Reuse these functions compiled under CONFIG_CRASH_CORE
Also, define Elf_Word and use it instead of generic u32 or the more
specific Elf64_Word.

Signed-off-by: Hari Bathini 
---

Changes from v3:
* Dropped hard-coded values and used DIV_ROUND_UP().

Changes from v2:
* Added a definition for Elf_Word.
* Used IA64 version of append_elf_note() and final_note() functions.


 arch/ia64/kernel/crash.c   |   22 --
 include/linux/crash_core.h |4 
 include/linux/elf.h|2 ++
 kernel/crash_core.c|   34 ++
 kernel/kexec_core.c|   28 
 5 files changed, 20 insertions(+), 70 deletions(-)

diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 2955f35..75859a0 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
 static int kdump_on_init = 1;
 static int kdump_on_fatal_mca = 1;
 
-static inline Elf64_Word
-*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
-   size_t data_len)
-{
-   struct elf_note *note = (struct elf_note *)buf;
-   note->n_namesz = strlen(name) + 1;
-   note->n_descsz = data_len;
-   note->n_type   = type;
-   buf += (sizeof(*note) + 3)/4;
-   memcpy(buf, name, note->n_namesz);
-   buf += (note->n_namesz + 3)/4;
-   memcpy(buf, data, data_len);
-   buf += (data_len + 3)/4;
-   return buf;
-}
-
-static void
-final_note(void *buf)
-{
-   memset(buf, 0, sizeof(struct elf_note));
-}
-
 extern void ia64_dump_cpu_regs(void *);
 
 static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
index 18d0f94..541a197 100644
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -55,6 +55,10 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 extern size_t vmcoreinfo_size;
 extern size_t vmcoreinfo_max_size;
 
+Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
+ void *data, size_t data_len);
+void final_note(Elf_Word *buf);
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 20fa8d8..ba069e8 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -29,6 +29,7 @@ extern Elf32_Dyn _DYNAMIC [];
 #define elf_note   elf32_note
 #define elf_addr_t Elf32_Off
 #define Elf_Half   Elf32_Half
+#define Elf_Word   Elf32_Word
 
 #else
 
@@ -39,6 +40,7 @@ extern Elf64_Dyn _DYNAMIC [];
 #define elf_note   elf64_note
 #define elf_addr_t Elf64_Off
 #define Elf_Half   Elf64_Half
+#define Elf_Word   Elf64_Word
 
 #endif
 
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 80b441d..362dace 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -291,32 +291,26 @@ int __init parse_crashkernel_low(char *cmdline,
"crashkernel=", suffix_tbl[SUFFIX_LOW]);
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
-   void *data, size_t data_len)
+Elf_Word *append_elf_note(Elf_Word *buf, char *name, unsigned int type,
+ void *data, size_t data_len)
 {
-   struct elf_note note;
-
-   note.n_namesz = strlen(name) + 1;
-   note.n_descsz = data_len;
-   note.n_type   = type;
-   memcpy(buf, , sizeof(note));
-   buf += (sizeof(note) + 3)/4;
-   memcpy(buf, name, note.n_namesz);
-   buf += (note.n_namesz + 3)/4;
-   memcpy(buf, data, note.n_descsz);
-   buf += (note.n_descsz + 3)/4;
+   struct elf_note *note = (struct elf_note *)buf;
+
+   note->n_namesz = strlen(name) + 1;
+   note->n_descsz = data_len;
+   note->n_type   = type;
+   buf += DIV_ROUND_UP(sizeof(*note), sizeof(Elf_Word));
+   memcpy(buf, name, note->n_namesz);
+   buf += DIV_ROUND_UP(note->n_namesz, sizeof(Elf_Word));
+   memcpy(buf, data, data_len);
+   buf += DIV_ROUND_UP(data_len, sizeof(Elf_Word));
 
return buf;
 }
 
-static void final_note(u32 *buf)
+void final_note(Elf_Word *buf)
 {
-   struct elf_note note;
-
-   note.n_namesz = 0;
-   note.n_descsz = 0;
-   note.n_type   = 0;
-   memcpy(buf, , sizeof(note));
+   memset(buf, 0, sizeof(struct elf_note));
 }
 
 static void update_vmcoreinfo_note(void)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 2179a16..263d764 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -990,34 +990,6 @@ int crash_shrink_memory(unsigned long new_size)
return ret;
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, 

[PATCH v4 1/5] crash: move crashkernel parsing and vmcore related code under CONFIG_CRASH_CORE

2017-01-05 Thread Hari Bathini
Traditionally, kdump is used to save vmcore in case of a crash. Some
architectures like powerpc can save vmcore using architecture specific
support instead of kexec/kdump mechanism. Such architecture specific
support also needs to reserve memory, to be used by dump capture kernel.
crashkernel parameter can be a reused, for memory reservation, by such
architecture specific infrastructure.

But currently, code related to vmcoreinfo and parsing of crashkernel
parameter is built under CONFIG_KEXEC_CORE. This patch introduces
CONFIG_CRASH_CORE and moves the above mentioned code under this config,
allowing code reuse without dependency on CONFIG_KEXEC. There is no
functional change with this patch.

Signed-off-by: Hari Bathini 
---

Changes from v3:
* Renamed log_buf_kexec_setup()to log_buf_vmcoreinfo_setup() instead of
  log_buf_crash_setup().

Changes from v2:
* Used CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE at
  appropriate places in printk and ksysfs.


 arch/Kconfig   |4 
 include/linux/crash_core.h |   65 ++
 include/linux/kexec.h  |   57 --
 include/linux/printk.h |4 
 kernel/Makefile|1 
 kernel/crash_core.c|  445 
 kernel/kexec_core.c|  404 
 kernel/ksysfs.c|8 +
 kernel/printk/printk.c |6 -
 9 files changed, 531 insertions(+), 463 deletions(-)
 create mode 100644 include/linux/crash_core.h
 create mode 100644 kernel/crash_core.c

diff --git a/arch/Kconfig b/arch/Kconfig
index 99839c2..82e6f99 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -2,7 +2,11 @@
 # General architecture dependent options
 #
 
+config CRASH_CORE
+   bool
+
 config KEXEC_CORE
+   select CRASH_CORE
bool
 
 config HAVE_IMA_KEXEC
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
new file mode 100644
index 000..18d0f94
--- /dev/null
+++ b/include/linux/crash_core.h
@@ -0,0 +1,65 @@
+#ifndef LINUX_CRASH_CORE_H
+#define LINUX_CRASH_CORE_H
+
+#include 
+#include 
+#include 
+
+#define CRASH_CORE_NOTE_NAME  "CORE"
+#define CRASH_CORE_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
+#define CRASH_CORE_NOTE_NAME_BYTES ALIGN(sizeof(CRASH_CORE_NOTE_NAME), 4)
+#define CRASH_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
+
+#define CRASH_CORE_NOTE_BYTES ((CRASH_CORE_NOTE_HEAD_BYTES * 2) +  \
+CRASH_CORE_NOTE_NAME_BYTES +   \
+CRASH_CORE_NOTE_DESC_BYTES)
+
+#define VMCOREINFO_BYTES  (4096)
+#define VMCOREINFO_NOTE_NAME  "VMCOREINFO"
+#define VMCOREINFO_NOTE_NAME_BYTES ALIGN(sizeof(VMCOREINFO_NOTE_NAME), 4)
+#define VMCOREINFO_NOTE_SIZE  ((CRASH_CORE_NOTE_HEAD_BYTES * 2) +  \
+VMCOREINFO_NOTE_NAME_BYTES +   \
+VMCOREINFO_BYTES)
+
+typedef u32 note_buf_t[CRASH_CORE_NOTE_BYTES/4];
+
+void crash_save_vmcoreinfo(void);
+void arch_crash_save_vmcoreinfo(void);
+__printf(1, 2)
+void vmcoreinfo_append_str(const char *fmt, ...);
+phys_addr_t paddr_vmcoreinfo_note(void);
+
+#define VMCOREINFO_OSRELEASE(value) \
+   vmcoreinfo_append_str("OSRELEASE=%s\n", value)
+#define VMCOREINFO_PAGESIZE(value) \
+   vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
+#define VMCOREINFO_SYMBOL(name) \
+   vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long))
+#define VMCOREINFO_SIZE(name) \
+   vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+ (unsigned long)sizeof(name))
+#define VMCOREINFO_STRUCT_SIZE(name) \
+   vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+ (unsigned long)sizeof(struct name))
+#define VMCOREINFO_OFFSET(name, field) \
+   vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
+ (unsigned long)offsetof(struct name, field))
+#define VMCOREINFO_LENGTH(name, value) \
+   vmcoreinfo_append_str("LENGTH(%s)=%lu\n", #name, (unsigned long)value)
+#define VMCOREINFO_NUMBER(name) \
+   vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name)
+#define VMCOREINFO_CONFIG(name) \
+   vmcoreinfo_append_str("CONFIG_%s=y\n", #name)
+
+extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
+extern size_t vmcoreinfo_size;
+extern size_t vmcoreinfo_max_size;
+
+int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
+   unsigned long long *crash_size, unsigned long long *crash_base);
+int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
+   unsigned long long *crash_size, unsigned long long *crash_base);
+int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,
+   unsigned long long *crash_size, unsigned long long *crash_base);
+
+#endif /* LINUX_CRASH_CORE_H */
diff --git a/include/linux/kexec.h 

[PATCH v4 0/5] kexec/fadump: remove dependency with CONFIG_KEXEC and reuse crashkernel parameter for fadump

2017-01-05 Thread Hari Bathini
Traditionally, kdump is used to save vmcore in case of a crash. Some
architectures like powerpc can save vmcore using architecture specific
support instead of kexec/kdump mechanism. Such architecture specific
support also needs to reserve memory, to be used by dump capture kernel.
crashkernel parameter can be a reused, for memory reservation, by such
architecture specific infrastructure.

This patchset removes dependency with CONFIG_KEXEC for crashkernel parameter
and vmcoreinfo related code as it can be reused without kexec support. Also,
crashkernel parameter is reused instead of fadump_reserve_mem to reserve
memory for fadump.

The first patch moves crashkernel parameter parsing and vmcoreinfo related
code under CONFIG_CRASH_CORE instead of CONFIG_KEXEC_CORE. The second patch
reuses the definitions of append_elf_note() & final_note() functions under
CONFIG_CRASH_CORE in IA64 arch code. The third patch removes dependency on
CONFIG_KEXEC for firmware-assisted dump (fadump) in powerpc. The next patch
reuses crashkernel parameter for reserving memory for fadump, instead of the
fadump_reserve_mem parameter. This has the advantage of using all syntaxes
crashkernel parameter supports, for fadump as well. The last patch updates
fadump kernel documentation about use of crashkernel parameter.

---

Hari Bathini (5):
  crash: move crashkernel parsing and vmcore related code under 
CONFIG_CRASH_CORE
  ia64: reuse append_elf_note() and final_note() functions
  powerpc/fadump: remove dependency with CONFIG_KEXEC
  powerpc/fadump: reuse crashkernel parameter for fadump memory reservation
  powerpc/fadump: update documentation about crashkernel parameter reuse


 Documentation/powerpc/firmware-assisted-dump.txt |   23 +
 arch/Kconfig |4 
 arch/ia64/kernel/crash.c |   22 -
 arch/powerpc/Kconfig |   10 -
 arch/powerpc/include/asm/fadump.h|2 
 arch/powerpc/kernel/crash.c  |2 
 arch/powerpc/kernel/fadump.c |   57 +--
 arch/powerpc/kernel/setup-common.c   |5 
 include/linux/crash_core.h   |   69 +++
 include/linux/elf.h  |2 
 include/linux/kexec.h|   57 ---
 include/linux/printk.h   |4 
 kernel/Makefile  |1 
 kernel/crash_core.c  |  439 ++
 kernel/kexec_core.c  |  432 --
 kernel/ksysfs.c  |8 
 kernel/printk/printk.c   |6 
 17 files changed, 572 insertions(+), 571 deletions(-)
 create mode 100644 include/linux/crash_core.h
 create mode 100644 kernel/crash_core.c



Re: [Patch V7 4/4] irqchip/qeic: remove PPCisms for QEIC

2017-01-05 Thread Marc Zyngier
On 26/12/16 08:32, Zhao Qiang wrote:
> QEIC was supported on PowerPC, and dependent on PPC,
> Now it is supported on other platforms, so remove PPCisms.
> 
> Signed-off-by: Zhao Qiang 
> ---
> Changes for v6:
>   - new added
> Changes for v7:
>   - fix warning
> 
>  drivers/irqchip/irq-qeic.c | 34 --
>  include/soc/fsl/qe/qe_ic.h | 12 ++--
>  2 files changed, 26 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-qeic.c b/drivers/irqchip/irq-qeic.c
> index 4f49d4b..957ea5b 100644
> --- a/drivers/irqchip/irq-qeic.c
> +++ b/drivers/irqchip/irq-qeic.c
> @@ -18,7 +18,10 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -88,7 +91,7 @@
>  
>  struct qe_ic {
>   /* Control registers offset */
> - volatile u32 __iomem *regs;
> + u32 __iomem *regs;
>  
>   /* The remapper for this QEIC */
>   struct irq_domain *irqhost;
> @@ -264,15 +267,15 @@ static struct qe_ic_info qe_ic_info[] = {
>   },
>  };
>  
> -static inline u32 qe_ic_read(volatile __be32  __iomem * base, unsigned int 
> reg)
> +static inline u32 qe_ic_read(__be32  __iomem * base, unsigned int reg)
>  {
> - return in_be32(base + (reg >> 2));
> + return ioread32be(base + (reg >> 2));
>  }
>  
> -static inline void qe_ic_write(volatile __be32  __iomem * base, unsigned int 
> reg,
> +static inline void qe_ic_write(__be32  __iomem * base, unsigned int reg,
>  u32 value)
>  {
> - out_be32(base + (reg >> 2), value);
> + iowrite32be(value, base + (reg >> 2));
>  }
>  
>  static inline struct qe_ic *qe_ic_from_irq(unsigned int virq)
> @@ -374,7 +377,7 @@ static const struct irq_domain_ops qe_ic_host_ops = {
>   .xlate = irq_domain_xlate_onetwocell,
>  };
>  
> -/* Return an interrupt vector or NO_IRQ if no interrupt is pending. */
> +/* Return an interrupt vector or 0 if no interrupt is pending. */
>  unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic)

Why isn't this static?

>  {
>   int irq;
> @@ -385,12 +388,12 @@ unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic)
>   irq = qe_ic_read(qe_ic->regs, QEIC_CIVEC) >> 26;
>  
>   if (irq == 0)
> - return NO_IRQ;
> + return 0;
>  
>   return irq_linear_revmap(qe_ic->irqhost, irq);
>  }
>  
> -/* Return an interrupt vector or NO_IRQ if no interrupt is pending. */
> +/* Return an interrupt vector or 0 if no interrupt is pending. */
>  unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic)

and this ? And all the functions in that file while you're at it?

>  {
>   int irq;
> @@ -401,7 +404,7 @@ unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic)
>   irq = qe_ic_read(qe_ic->regs, QEIC_CHIVEC) >> 26;
>  
>   if (irq == 0)
> - return NO_IRQ;
> + return 0;
>  
>   return irq_linear_revmap(qe_ic->irqhost, irq);
>  }
> @@ -447,7 +450,7 @@ static int __init qe_ic_init(unsigned int flags)
>   qe_ic->virq_high = irq_of_parse_and_map(node, 0);
>   qe_ic->virq_low = irq_of_parse_and_map(node, 1);
>  
> - if (qe_ic->virq_low == NO_IRQ) {
> + if (qe_ic->virq_low == 0) {
>   pr_err("Failed to map QE_IC low IRQ\n");
>   ret = -ENOMEM;
>   goto err_domain_remove;
> @@ -479,7 +482,7 @@ static int __init qe_ic_init(unsigned int flags)
>   irq_set_handler_data(qe_ic->virq_low, qe_ic);
>   irq_set_chained_handler(qe_ic->virq_low, qe_ic_cascade_low_mpic);
>  
> - if (qe_ic->virq_high != NO_IRQ &&
> + if (qe_ic->virq_high != 0 &&
>   qe_ic->virq_high != qe_ic->virq_low) {
>   irq_set_handler_data(qe_ic->virq_high, qe_ic);
>   irq_set_chained_handler(qe_ic->virq_high,
> @@ -500,7 +503,8 @@ err_put_node:
>  void qe_ic_set_highest_priority(unsigned int virq, int high)
>  {
>   struct qe_ic *qe_ic = qe_ic_from_irq(virq);
> - unsigned int src = virq_to_hw(virq);
> + struct irq_data *irq_data = irq_get_irq_data(virq);
> + irq_hw_number_t src = WARN_ON(!irq_data) ? 0 : irq_data->hwirq;
>   u32 temp = 0;
>  
>   temp = qe_ic_read(qe_ic->regs, QEIC_CICR);
> @@ -518,7 +522,8 @@ void qe_ic_set_highest_priority(unsigned int virq, int 
> high)
>  int qe_ic_set_priority(unsigned int virq, unsigned int priority)
>  {
>   struct qe_ic *qe_ic = qe_ic_from_irq(virq);
> - unsigned int src = virq_to_hw(virq);
> + struct irq_data *irq_data = irq_get_irq_data(virq);
> + irq_hw_number_t src = WARN_ON(!irq_data) ? 0 : irq_data->hwirq;
>   u32 temp;
>  
>   if (priority > 8 || priority == 0)
> @@ -548,7 +553,8 @@ int qe_ic_set_priority(unsigned int virq, unsigned int 
> priority)
>  int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int 
> high)
>  {
>   struct qe_ic *qe_ic = qe_ic_from_irq(virq);
> - unsigned int src = virq_to_hw(virq);
> + struct 

Re: [Patch V7 2/4] irqchip/qeic: merge qeic init code from platforms to a common function

2017-01-05 Thread Marc Zyngier
On 26/12/16 08:32, Zhao Qiang wrote:
> The codes of qe_ic init from a variety of platforms are redundant,
> merge them to a common function and put it to irqchip/irq-qeic.c
> 
> For non-p1021_mds mpc85xx_mds boards, use "qe_ic_init(np, 0,
> qe_ic_cascade_low_mpic, qe_ic_cascade_high_mpic);" instead of
> "qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);".
> 
> qe_ic_cascade_muxed_mpic was used for boards has the same interrupt
> number for low interrupt and high interrupt, qe_ic_init has checked
> if "low interrupt == high interrupt"
> 
> Signed-off-by: Zhao Qiang 
> ---
> Changes for v2:
>   - modify subject and commit msg
>   - add check for qeic by type
> Changes for v3:
>   - na
> Changes for v4:
>   - na
> Changes for v5:
>   - na
> Changes for v6:
>   - rebase
> Changes for v7:
>   - na
> 
>  arch/powerpc/platforms/83xx/misc.c| 15 ---
>  arch/powerpc/platforms/85xx/corenet_generic.c |  9 -
>  arch/powerpc/platforms/85xx/mpc85xx_mds.c | 14 --
>  arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 16 
>  arch/powerpc/platforms/85xx/twr_p102x.c   | 14 --
>  drivers/irqchip/irq-qeic.c| 16 
>  6 files changed, 16 insertions(+), 68 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/83xx/misc.c 
> b/arch/powerpc/platforms/83xx/misc.c
> index d75c981..c09a135 100644
> --- a/arch/powerpc/platforms/83xx/misc.c
> +++ b/arch/powerpc/platforms/83xx/misc.c
> @@ -93,24 +93,9 @@ void __init mpc83xx_ipic_init_IRQ(void)
>  }
>  
>  #ifdef CONFIG_QUICC_ENGINE
> -void __init mpc83xx_qe_init_IRQ(void)
> -{
> - struct device_node *np;
> -
> - np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> - if (!np) {
> - np = of_find_node_by_type(NULL, "qeic");
> - if (!np)
> - return;
> - }
> - qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
> - of_node_put(np);
> -}
> -
>  void __init mpc83xx_ipic_and_qe_init_IRQ(void)
>  {
>   mpc83xx_ipic_init_IRQ();
> - mpc83xx_qe_init_IRQ();
>  }
>  #endif /* CONFIG_QUICC_ENGINE */
>  
> diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c 
> b/arch/powerpc/platforms/85xx/corenet_generic.c
> index 1179115..1d96c3f 100644
> --- a/arch/powerpc/platforms/85xx/corenet_generic.c
> +++ b/arch/powerpc/platforms/85xx/corenet_generic.c
> @@ -41,8 +41,6 @@ void __init corenet_gen_pic_init(void)
>   unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
>   MPIC_NO_RESET;
>  
> - struct device_node *np;
> -
>   if (ppc_md.get_irq == mpic_get_coreint_irq)
>   flags |= MPIC_ENABLE_COREINT;
>  
> @@ -50,13 +48,6 @@ void __init corenet_gen_pic_init(void)
>   BUG_ON(mpic == NULL);
>  
>   mpic_init(mpic);
> -
> - np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> - if (np) {
> - qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> - qe_ic_cascade_high_mpic);
> - of_node_put(np);
> - }
>  }
>  
>  /*
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c 
> b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> index d7e440e..06f34a9 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -283,20 +283,6 @@ static void __init mpc85xx_mds_qeic_init(void)
>   of_node_put(np);
>   return;
>   }
> -
> - np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> - if (!np) {
> - np = of_find_node_by_type(NULL, "qeic");
> - if (!np)
> - return;
> - }
> -
> - if (machine_is(p1021_mds))
> - qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> - qe_ic_cascade_high_mpic);
> - else
> - qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
> - of_node_put(np);
>  }
>  #else
>  static void __init mpc85xx_mds_qe_init(void) { }
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c 
> b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> index 1006950..000d385 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
> @@ -48,10 +48,6 @@ void __init mpc85xx_rdb_pic_init(void)
>  {
>   struct mpic *mpic;
>  
> -#ifdef CONFIG_QUICC_ENGINE
> - struct device_node *np;
> -#endif
> -
>   if (of_machine_is_compatible("fsl,MPC85XXRDB-CAMP")) {
>   mpic = mpic_alloc(NULL, 0, MPIC_NO_RESET |
>   MPIC_BIG_ENDIAN |
> @@ -66,18 +62,6 @@ void __init mpc85xx_rdb_pic_init(void)
>  
>   BUG_ON(mpic == NULL);
>   mpic_init(mpic);
> -
> -#ifdef CONFIG_QUICC_ENGINE
> - np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
> - if (np) {
> - qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
> - qe_ic_cascade_high_mpic);
> - of_node_put(np);
> -
> 

Re: [RESEND] cxl: Force psl data-cache flush during device shutdown

2017-01-05 Thread Frederic Barrat



Le 04/01/2017 à 07:18, Vaibhav Jain a écrit :

This change adds a force psl data cache flush during device shutdown
callback. This should reduce a possibility of psl holding a dirty
cache line while the CAPP is being reinitialized, which may result in
a UE [load/store] machine check error.

Signed-off-by: Vaibhav Jain 
---


Looks good to me, thanks!

Acked-by: Frederic Barrat 



Resend: Fixed the author ident.
---
 drivers/misc/cxl/pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 80a87ab..73432e7 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1610,6 +1610,9 @@ static void cxl_pci_remove_adapter(struct cxl *adapter)
cxl_sysfs_adapter_remove(adapter);
cxl_debugfs_adapter_remove(adapter);

+   /* Flush adapter datacache as its about to be removed */
+   cxl_data_cache_flush(adapter);
+
cxl_deconfigure_adapter(adapter);

device_unregister(>dev);





[PATCH v2 2/2] powerpc/perf: support new BHRB filtering modes

2017-01-05 Thread Madhavan Srinivasan
Add support for new BHRB filtering modes in power9.
Filtering modes restrict the type of branch
instructions that can enter into the BHRB.

The filtering criteria are defined using the following
terminology, Call, Return, Jump, Conditional Branch,
Unconditional Branch, Indirect Branch and Direct Branch.

PowerISA v3.0 defines 5 new BHRB filtering bits
in MMCRA[27:31] for the software to prevent various
combinations of each of the above types of Branch
instructions from being entered into the BHRB.

Patch updates the branch types based on "Progrmming Note"
information from PowerISA v3.0 "BHRB Filtering" section.

Signed-off-by: Madhavan Srinivasan 
---
Changelog v1:
1) Added mode comments in code
2) Updates to commit message

 arch/powerpc/perf/power9-pmu.c | 53 +-
 1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index 56ad09801fff..0d232916cab2 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -103,6 +103,31 @@ enum {
 #define POWER9_MMCRA_IFM2  0x8000UL
 #define POWER9_MMCRA_IFM3  0xC000UL
 
+/*
+ * BHRB Filtering mode FJ -- Filter Jump Instructions
+ */
+#define POWER9_MMCRA_FJ0x0001UL
+
+/*
+ * BHRB Filtering mode FR -- Filter Return Instructions
+ */
+#define POWER9_MMCRA_FR0x0002UL
+
+/*
+ * BHRB Filtering mode FC -- Filter Call Instructions
+ */
+#define POWER9_MMCRA_FC0x0004UL
+
+/*
+ * BHRB Filtering mode FU -- Filter Unconditional Branch Instructions
+ */
+#define POWER9_MMCRA_FU0x0008UL
+
+/*
+ * BHRB Filtering mode FD -- Filter Direct Branch Instructions
+ */
+#define POWER9_MMCRA_FD0x0010UL
+
 /* PowerISA v2.07 format attribute structure*/
 extern struct attribute_group isa207_pmu_format_group;
 
@@ -240,14 +265,30 @@ static u64 power9_bhrb_filter_map(u64 branch_sample_type)
return pmu_bhrb_filter;
 
/* Invalid branch filter options - HW does not support */
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_RETURN)
-   return -1;
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_RETURN) {
+   pmu_bhrb_filter = POWER9_MMCRA_FC | POWER9_MMCRA_FJ;
+   return pmu_bhrb_filter;
+   }
 
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_CALL)
-   return -1;
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_CALL) {
+   pmu_bhrb_filter = POWER9_MMCRA_FD | POWER9_MMCRA_FR | 
POWER9_MMCRA_FJ;
+   return pmu_bhrb_filter;
+   }
 
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_CALL)
-   return -1;
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_COND) {
+   pmu_bhrb_filter = POWER9_MMCRA_FU;
+   return pmu_bhrb_filter;
+   }
+
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_JUMP) {
+   pmu_bhrb_filter = POWER9_MMCRA_FD | POWER9_MMCRA_FC | 
POWER9_MMCRA_FR;
+   return pmu_bhrb_filter;
+   }
+
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_CALL) {
+   pmu_bhrb_filter = POWER9_MMCRA_FC;
+   return pmu_bhrb_filter;
+   }
 
if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_CALL) {
pmu_bhrb_filter |= POWER9_MMCRA_IFM1;
-- 
2.7.4



[PATCH v2 1/2] powerpc/perf: Factor out bhrb functions

2017-01-05 Thread Madhavan Srinivasan
Factor out the bhrb functions to "isa207-common.c"
to share with power9 DD1. Only code movement and no logic change

Signed-off-by: Madhavan Srinivasan 
---
Changelog v1:
1)Updates to commit messages

 arch/powerpc/perf/isa207-common.c | 41 
 arch/powerpc/perf/isa207-common.h |  9 +++
 arch/powerpc/perf/power8-pmu.c| 49 ++-
 arch/powerpc/perf/power9-pmu.c|  4 ++--
 4 files changed, 54 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/perf/isa207-common.c 
b/arch/powerpc/perf/isa207-common.c
index 50e598cf644b..ee4e3e89c04c 100644
--- a/arch/powerpc/perf/isa207-common.c
+++ b/arch/powerpc/perf/isa207-common.c
@@ -338,3 +338,44 @@ void isa207_disable_pmc(unsigned int pmc, unsigned long 
mmcr[])
if (pmc <= 3)
mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SHIFT(pmc + 1));
 }
+
+u64 isa207_bhrb_filter_map(u64 branch_sample_type)
+{
+   u64 pmu_bhrb_filter = 0;
+
+   /* BHRB and regular PMU events share the same privilege state
+* filter configuration. BHRB is always recorded along with a
+* regular PMU event. As the privilege state filter is handled
+* in the basic PMC configuration of the accompanying regular
+* PMU event, we ignore any separate BHRB specific request.
+*/
+
+   /* No branch filter requested */
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY)
+   return pmu_bhrb_filter;
+
+   /* Invalid branch filter options - HW does not support */
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_RETURN)
+   return -1;
+
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_CALL)
+   return -1;
+
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_CALL)
+   return -1;
+
+   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_CALL) {
+   pmu_bhrb_filter |= MMCRA_IFM1;
+   return pmu_bhrb_filter;
+   }
+
+   /* Every thing else is unsupported */
+   return -1;
+}
+
+void isa207_config_bhrb(u64 pmu_bhrb_filter)
+{
+   /* Enable BHRB filter in PMU */
+   mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter));
+}
+
diff --git a/arch/powerpc/perf/isa207-common.h 
b/arch/powerpc/perf/isa207-common.h
index 90495f1580c7..e5e4182731da 100644
--- a/arch/powerpc/perf/isa207-common.h
+++ b/arch/powerpc/perf/isa207-common.h
@@ -244,6 +244,12 @@
 #define MMCRA_SDAR_MODE_TLB(1ull << MMCRA_SDAR_MODE_SHIFT)
 #define MMCRA_IFM_SHIFT30
 
+/* MMCRA IFM bits */
+#define MMCRA_IFM1 0x4000UL
+#define MMCRA_IFM2 0x8000UL
+#define MMCRA_IFM3 0xC000UL
+
+
 /* MMCR1 Threshold Compare bit constant for power9 */
 #define p9_MMCRA_THR_CMP_SHIFT 45
 
@@ -261,4 +267,7 @@ int isa207_compute_mmcr(u64 event[], int n_ev,
struct perf_event *pevents[]);
 void isa207_disable_pmc(unsigned int pmc, unsigned long mmcr[]);
 
+u64 isa207_bhrb_filter_map(u64 branch_sample_type);
+void isa207_config_bhrb(u64 pmu_bhrb_filter);
+
 #endif
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index d07186382f3a..91120bec4173 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -25,11 +25,6 @@ enum {
 
 #undef EVENT
 
-/* MMCRA IFM bits - POWER8 */
-#definePOWER8_MMCRA_IFM1   0x4000UL
-#definePOWER8_MMCRA_IFM2   0x8000UL
-#definePOWER8_MMCRA_IFM3   0xC000UL
-
 /* PowerISA v2.07 format attribute structure*/
 extern struct attribute_group isa207_pmu_format_group;
 
@@ -195,46 +190,6 @@ static int power8_generic_events[] = {
[PERF_COUNT_HW_CACHE_MISSES] =  PM_LD_MISS_L1,
 };
 
-static u64 power8_bhrb_filter_map(u64 branch_sample_type)
-{
-   u64 pmu_bhrb_filter = 0;
-
-   /* BHRB and regular PMU events share the same privilege state
-* filter configuration. BHRB is always recorded along with a
-* regular PMU event. As the privilege state filter is handled
-* in the basic PMC configuration of the accompanying regular
-* PMU event, we ignore any separate BHRB specific request.
-*/
-
-   /* No branch filter requested */
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY)
-   return pmu_bhrb_filter;
-
-   /* Invalid branch filter options - HW does not support */
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_RETURN)
-   return -1;
-
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_IND_CALL)
-   return -1;
-
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_CALL)
-   return -1;
-
-   if (branch_sample_type & PERF_SAMPLE_BRANCH_ANY_CALL) {
-   pmu_bhrb_filter |= POWER8_MMCRA_IFM1;
-   return pmu_bhrb_filter;
-   }
-
-   

[PATCH 2/2] powerpc/perf: fix PM_BR_CMPL event code for power9

2017-01-05 Thread Madhavan Srinivasan
Use 0x10012 event code for PM_BR_CMPL event in
power9-event-list instead of 0x40060.

Fixes:34922527a2bcb ('powerpc/perf: Add power9 event list macros for generic 
and cache events')
Signed-off-by: Madhavan Srinivasan 
---
 arch/powerpc/perf/power9-events-list.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/power9-events-list.h 
b/arch/powerpc/perf/power9-events-list.h
index c529d9e3e245..b58b1339d79f 100644
--- a/arch/powerpc/perf/power9-events-list.h
+++ b/arch/powerpc/perf/power9-events-list.h
@@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e)
 EVENT(PM_ICT_NOSLOT_CYC,   0x100f8)
 EVENT(PM_CMPLU_STALL,  0x1e054)
 EVENT(PM_INST_CMPL,0x2)
-EVENT(PM_BR_CMPL,  0x40060)
+EVENT(PM_BR_CMPL,  0x10012)
 EVENT(PM_BR_MPRED_CMPL,0x400f6)
 
 /* All L1 D cache load references counted at finish, gated by reject */
-- 
2.7.4



[PATCH 1/2] powerpc/perf: Cleanup of PM_BR_CMPL vs. PM_BRU_CMPL in power9 event list

2017-01-05 Thread Madhavan Srinivasan
Fixes:34922527a2bcb ('powerpc/perf: Add power9 event list macros for generic 
and cache events')
Signed-off-by: Madhavan Srinivasan 
---
 arch/powerpc/perf/power9-events-list.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/power9-events-list.h 
b/arch/powerpc/perf/power9-events-list.h
index 6447dc1c3d89..c529d9e3e245 100644
--- a/arch/powerpc/perf/power9-events-list.h
+++ b/arch/powerpc/perf/power9-events-list.h
@@ -16,7 +16,7 @@ EVENT(PM_CYC, 0x0001e)
 EVENT(PM_ICT_NOSLOT_CYC,   0x100f8)
 EVENT(PM_CMPLU_STALL,  0x1e054)
 EVENT(PM_INST_CMPL,0x2)
-EVENT(PM_BRU_CMPL, 0x40060)
+EVENT(PM_BR_CMPL,  0x40060)
 EVENT(PM_BR_MPRED_CMPL,0x400f6)
 
 /* All L1 D cache load references counted at finish, gated by reject */
-- 
2.7.4



[PATCH 0/2] Cleanup and fix PM_BR_CMPL event code in power9

2017-01-05 Thread Madhavan Srinivasan
Madhavan Srinivasan (2):
  powerpc/perf: Cleanup of PM_BR_CMPL vs. PM_BRU_CMPL in power9 event list
  powerpc/perf: fix PM_BR_CMPL event code for power9

 arch/powerpc/perf/power9-events-list.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4



Re: [PATCH 9/9] powerpc: A new cache shape aux vectors

2017-01-05 Thread Tulio Magno Quites Machado Filho
Benjamin Herrenschmidt  writes:

> On Wed, 2017-01-04 at 11:04 -0200, Tulio Magno Quites Machado Filho
>
>> > +#define AT_L1I_CACHESIZE  40
>> > +#define AT_L1I_CACHESHAPE 41
>> > +#define AT_L1D_CACHESIZE  42
>> > +#define AT_L1D_CACHESHAPE 43
>> > +#define AT_L2_CACHESIZE   44
>> > +#define AT_L2_CACHESHAPE  45
>> > +#define AT_L3_CACHESIZE   46
>> > +#define AT_L3_CACHESHAPE  47
>> 
>> These names will clash with the other ones defined by alpha and sh:
>> 
>> /* Shapes of the caches.  Bits 0-3 contains associativity; bits 4-7
>> contains
>>    log2 of line size; mask those to get cache size.  */
>> #define AT_L1I_CACHESHAPE34
>> #define AT_L1D_CACHESHAPE35
>> #define AT_L2_CACHESHAPE 36
>> #define AT_L3_CACHESHAPE 37
>
> Is this a problem though ? In the kernel at least these are defined in
> arch specific headers so there is no clash.

It could become a problem if an architecture tries to use both of these
types.

glibc doesn't distinct between them:
https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/elf.h#l1113

> Otherwise, I can change them to *_CACHEGEOMETRY, is that ok ?

Looks good to me.

-- 
Tulio Magno



Re: [PATCH] powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()

2017-01-05 Thread Madhavan Srinivasan



On Monday 26 December 2016 09:45 AM, Anshuman Khandual wrote:

On 12/24/2016 11:35 AM, Madhavan Srinivasan wrote:

Cleanup to use is_kernel_addr macro.

Signed-off-by: Madhavan Srinivasan 
---
  arch/powerpc/perf/core-book3s.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 2cdf2647cdb0..d9c74fd1b37b 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -243,7 +243,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
 */
if (ppmu->flags & PPMU_NO_SIPR) {
unsigned long siar = mfspr(SPRN_SIAR);
-   if (siar >= PAGE_OFFSET)
+   if (is_kernel_addr(siar))
return PERF_RECORD_MISC_KERNEL;
return PERF_RECORD_MISC_USER;
}

While you are at this, why not also clean up these in the xmon code
as well.

Yes. Have handled this in a separate patch.

Maddy

arch/powerpc/xmon/xmon.c:   if (sp < PAGE_OFFSET) {
arch/powerpc/xmon/xmon.c:   if (lr < PAGE_OFFSET
arch/powerpc/xmon/xmon.c:   } else if (lr >= PAGE_OFFSET
arch/powerpc/xmon/xmon.c:   if (addr < PAGE_OFFSET)




[PATCH] powerpc/xmon: Cleanup to use is_kernel_addr macro

2017-01-05 Thread Madhavan Srinivasan
Signed-off-by: Madhavan Srinivasan 
---
 arch/powerpc/xmon/xmon.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 9c0e17cf6886..a44b049b9cf6 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1403,7 +1403,7 @@ static void xmon_show_stack(unsigned long sp, unsigned 
long lr,
struct pt_regs regs;
 
while (max_to_print--) {
-   if (sp < PAGE_OFFSET) {
+   if (!is_kernel_addr(sp)) {
if (sp != 0)
printf("SP (%lx) is in userspace\n", sp);
break;
@@ -1431,12 +1431,12 @@ static void xmon_show_stack(unsigned long sp, unsigned 
long lr,
mread(newsp + LRSAVE_OFFSET, ,
  sizeof(unsigned long));
if (lr == ip) {
-   if (lr < PAGE_OFFSET
+   if (!is_kernel_addr(lr)
|| (fnstart <= lr && lr < fnend))
printip = 0;
} else if (lr == nextip) {
printip = 0;
-   } else if (lr >= PAGE_OFFSET
+   } else if (is_kernel_addr(lr)
   && !(fnstart <= lr && lr < fnend)) {
printf("[link register   ] ");
xmon_print_symbol(lr, " ", "\n");
@@ -1496,7 +1496,7 @@ static void print_bug_trap(struct pt_regs *regs)
if (regs->msr & MSR_PR)
return; /* not in kernel */
addr = regs->nip;   /* address of trap instruction */
-   if (addr < PAGE_OFFSET)
+   if (!is_kernel_addr(addr))
return;
bug = find_bug(regs->nip);
if (bug == NULL)
-- 
2.7.4



Re: ext4 filesystem corruption with 4.10-rc2 on ppc64le

2017-01-05 Thread Anton Blanchard
Hi Ted,

> Anton or Chandan, could you do me a favor and verify whether or not
> 64k block sizes are working for you on ppcle on ext4 by running
> xfstests?  Light duty testing works for me but when I stress ext4 with
> pagesize==blocksize on ppcle64 via xfstests, it blows up.  I suspect
> (but am not sure) it's due to (non-upstream) device driver issues, and
> a verification that you can run xfstests on your ppcle64 systems using
> standard upstream device drivers would be very helpful, since I don't
> have easy console access on the machines I have access to at
> $WORK.  :-(

I fired off an xfstests run, and it looks good. There are 3 failures,
but they seem to be setup issues on my part. I also double checked
those same three failed on 4.8.

Chandan has been running the test suite regularly, and plans to do a
run against mainline too.

Anton


Re: [PATCH] cpufreq: Remove CONFIG_CPU_FREQ_STAT_DETAILS config option

2017-01-05 Thread Chanwoo Choi
Hi Viresh,

On 2017년 01월 05일 17:27, Viresh Kumar wrote:
> This doesn't have any benefit apart from saving a small amount of memory
> when it is disabled. The ifdef hackery in the code makes it dirty
> unnecessarily.
> 
> Clean it up by removing the Kconfig option completely. Few defconfigs
> are also updated and CONFIG_CPU_FREQ_STAT_DETAILS is replaced with
> CONFIG_CPU_FREQ_STAT now in them, as users wanted stats to be enabled.
> 
> Signed-off-by: Viresh Kumar 
> ---
>  arch/arm/configs/exynos_defconfig |  2 +-
>  arch/arm/configs/multi_v5_defconfig   |  2 +-
>  arch/arm/configs/multi_v7_defconfig   |  2 +-
>  arch/arm/configs/mvebu_v5_defconfig   |  2 +-
>  arch/arm/configs/pxa_defconfig|  2 +-
>  arch/arm/configs/shmobile_defconfig   |  2 +-
>  arch/mips/configs/lemote2f_defconfig  |  1 -
>  arch/powerpc/configs/ppc6xx_defconfig |  1 -
>  arch/sh/configs/sh7785lcr_32bit_defconfig |  2 +-
>  drivers/cpufreq/Kconfig   |  8 
>  drivers/cpufreq/cpufreq_stats.c   | 14 --
>  11 files changed, 7 insertions(+), 31 deletions(-)


I agree. Looks good to me.
Reviewed-by: Chanwoo Choi 

[snip]

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics
<>

Re: [PATCH] cpufreq: Remove CONFIG_CPU_FREQ_STAT_DETAILS config option

2017-01-05 Thread Gregory CLEMENT
Hi Viresh,
 
 On jeu., janv. 05 2017, Viresh Kumar  wrote:

> This doesn't have any benefit apart from saving a small amount of memory
> when it is disabled. The ifdef hackery in the code makes it dirty
> unnecessarily.
>
> Clean it up by removing the Kconfig option completely. Few defconfigs
> are also updated and CONFIG_CPU_FREQ_STAT_DETAILS is replaced with
> CONFIG_CPU_FREQ_STAT now in them, as users wanted stats to be enabled.
>
> Signed-off-by: Viresh Kumar 
> ---
>  arch/arm/configs/exynos_defconfig |  2 +-
>  arch/arm/configs/multi_v5_defconfig   |  2 +-
>  arch/arm/configs/multi_v7_defconfig   |  2 +-

>  arch/arm/configs/mvebu_v5_defconfig   |  2 +-
For this file:

Acked-by: Gregory CLEMENT 

Gregory


>  arch/arm/configs/pxa_defconfig|  2 +-
>  arch/arm/configs/shmobile_defconfig   |  2 +-
>  arch/mips/configs/lemote2f_defconfig  |  1 -
>  arch/powerpc/configs/ppc6xx_defconfig |  1 -
>  arch/sh/configs/sh7785lcr_32bit_defconfig |  2 +-
>  drivers/cpufreq/Kconfig   |  8 
>  drivers/cpufreq/cpufreq_stats.c   | 14 --
>  11 files changed, 7 insertions(+), 31 deletions(-)
>
> diff --git a/arch/arm/configs/exynos_defconfig 
> b/arch/arm/configs/exynos_defconfig
> index 79c415c33f69..809f0bf3042a 100644
> --- a/arch/arm/configs/exynos_defconfig
> +++ b/arch/arm/configs/exynos_defconfig
> @@ -24,7 +24,7 @@ CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_ARM_ATAG_DTB_COMPAT=y
>  CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x4100,8M 
> console=ttySAC1,115200 init=/linuxrc mem=256M"
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
>  CONFIG_CPU_FREQ_GOV_USERSPACE=m
> diff --git a/arch/arm/configs/multi_v5_defconfig 
> b/arch/arm/configs/multi_v5_defconfig
> index 361686a362f1..69a4bd13eea5 100644
> --- a/arch/arm/configs/multi_v5_defconfig
> +++ b/arch/arm/configs/multi_v5_defconfig
> @@ -58,7 +58,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
>  CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_ARM_ATAG_DTB_COMPAT=y
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_IDLE=y
>  CONFIG_ARM_KIRKWOOD_CPUIDLE=y
> diff --git a/arch/arm/configs/multi_v7_defconfig 
> b/arch/arm/configs/multi_v7_defconfig
> index b01a43851294..2dcac90eba01 100644
> --- a/arch/arm/configs/multi_v7_defconfig
> +++ b/arch/arm/configs/multi_v7_defconfig
> @@ -132,7 +132,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
>  CONFIG_KEXEC=y
>  CONFIG_EFI=y
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
>  CONFIG_CPU_FREQ_GOV_USERSPACE=m
> diff --git a/arch/arm/configs/mvebu_v5_defconfig 
> b/arch/arm/configs/mvebu_v5_defconfig
> index f7f6039419aa..4b598da0d086 100644
> --- a/arch/arm/configs/mvebu_v5_defconfig
> +++ b/arch/arm/configs/mvebu_v5_defconfig
> @@ -44,7 +44,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
>  CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_ARM_ATAG_DTB_COMPAT=y
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_IDLE=y
>  CONFIG_ARM_KIRKWOOD_CPUIDLE=y
> diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
> index e4314b1227a3..271dc7e78e43 100644
> --- a/arch/arm/configs/pxa_defconfig
> +++ b/arch/arm/configs/pxa_defconfig
> @@ -97,7 +97,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
>  CONFIG_CMDLINE="root=/dev/ram0 ro"
>  CONFIG_KEXEC=y
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
>  CONFIG_CPU_FREQ_GOV_USERSPACE=m
> diff --git a/arch/arm/configs/shmobile_defconfig 
> b/arch/arm/configs/shmobile_defconfig
> index 1b0f8ae36fb3..adeaecd831a4 100644
> --- a/arch/arm/configs/shmobile_defconfig
> +++ b/arch/arm/configs/shmobile_defconfig
> @@ -38,7 +38,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
>  CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_KEXEC=y
>  CONFIG_CPU_FREQ=y
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
> +CONFIG_CPU_FREQ_STAT=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=y
>  CONFIG_CPU_FREQ_GOV_USERSPACE=y
>  CONFIG_CPU_FREQ_GOV_ONDEMAND=y
> diff --git a/arch/mips/configs/lemote2f_defconfig 
> b/arch/mips/configs/lemote2f_defconfig
> index 5da76e0e120f..bed745596d86 100644
> --- a/arch/mips/configs/lemote2f_defconfig
> +++ b/arch/mips/configs/lemote2f_defconfig
> @@ -40,7 +40,6 @@ CONFIG_PM_STD_PARTITION="/dev/hda3"
>  CONFIG_CPU_FREQ=y
>  CONFIG_CPU_FREQ_DEBUG=y
>  CONFIG_CPU_FREQ_STAT=m
> -CONFIG_CPU_FREQ_STAT_DETAILS=y
>  CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
>  CONFIG_CPU_FREQ_GOV_POWERSAVE=m
>  CONFIG_CPU_FREQ_GOV_USERSPACE=m
> diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
> b/arch/powerpc/configs/ppc6xx_defconfig
> index 

RE: [RFC 1/4] mm: remove unused TASK_SIZE_OF()

2017-01-05 Thread David Laight
From: Dmitry Safonov
> Sent: 30 December 2016 15:57
> All users of TASK_SIZE_OF(tsk) have migrated to mm->task_size or
> TASK_SIZE_MAX since:
> commit d696ca016d57 ("x86/fsgsbase/64: Use TASK_SIZE_MAX for
> FSBASE/GSBASE upper limits"),
> commit a06db751c321 ("pagemap: check permissions and capabilities at
> open time"),
...
> +#define TASK_SIZE(current->thread.task_size)

I'm not sure I like he hidden 'current' argument to an
apparent constant.

David



Re: [PATCH v3 13/15] livepatch: change to a per-task consistency model

2017-01-05 Thread Miroslav Benes

> @@ -740,6 +809,14 @@ int klp_register_patch(struct klp_patch *patch)
>   return -ENODEV;
>  
>   /*
> +  * Architectures without reliable stack traces have to set
> +  * patch->immediate because there's currently no way to patch kthreads
> +  * with the consistency model.
> +  */
> + if (!klp_have_reliable_stack() && !patch->immediate)
> + return -ENOSYS;
> +

I think an error message (pr_err) would be appropriate here. 

$ insmod patch_1.ko
insmod: ERROR: could not insert module patch_1.ko: Function not implemented

is not helpful much :)

Miroslav


[PATCH] cpufreq: Remove CONFIG_CPU_FREQ_STAT_DETAILS config option

2017-01-05 Thread Viresh Kumar
This doesn't have any benefit apart from saving a small amount of memory
when it is disabled. The ifdef hackery in the code makes it dirty
unnecessarily.

Clean it up by removing the Kconfig option completely. Few defconfigs
are also updated and CONFIG_CPU_FREQ_STAT_DETAILS is replaced with
CONFIG_CPU_FREQ_STAT now in them, as users wanted stats to be enabled.

Signed-off-by: Viresh Kumar 
---
 arch/arm/configs/exynos_defconfig |  2 +-
 arch/arm/configs/multi_v5_defconfig   |  2 +-
 arch/arm/configs/multi_v7_defconfig   |  2 +-
 arch/arm/configs/mvebu_v5_defconfig   |  2 +-
 arch/arm/configs/pxa_defconfig|  2 +-
 arch/arm/configs/shmobile_defconfig   |  2 +-
 arch/mips/configs/lemote2f_defconfig  |  1 -
 arch/powerpc/configs/ppc6xx_defconfig |  1 -
 arch/sh/configs/sh7785lcr_32bit_defconfig |  2 +-
 drivers/cpufreq/Kconfig   |  8 
 drivers/cpufreq/cpufreq_stats.c   | 14 --
 11 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/arch/arm/configs/exynos_defconfig 
b/arch/arm/configs/exynos_defconfig
index 79c415c33f69..809f0bf3042a 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -24,7 +24,7 @@ CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x4100,8M 
console=ttySAC1,115200 init=/linuxrc mem=256M"
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_USERSPACE=m
diff --git a/arch/arm/configs/multi_v5_defconfig 
b/arch/arm/configs/multi_v5_defconfig
index 361686a362f1..69a4bd13eea5 100644
--- a/arch/arm/configs/multi_v5_defconfig
+++ b/arch/arm/configs/multi_v5_defconfig
@@ -58,7 +58,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_IDLE=y
 CONFIG_ARM_KIRKWOOD_CPUIDLE=y
diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index b01a43851294..2dcac90eba01 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -132,7 +132,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_KEXEC=y
 CONFIG_EFI=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_USERSPACE=m
diff --git a/arch/arm/configs/mvebu_v5_defconfig 
b/arch/arm/configs/mvebu_v5_defconfig
index f7f6039419aa..4b598da0d086 100644
--- a/arch/arm/configs/mvebu_v5_defconfig
+++ b/arch/arm/configs/mvebu_v5_defconfig
@@ -44,7 +44,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_IDLE=y
 CONFIG_ARM_KIRKWOOD_CPUIDLE=y
diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
index e4314b1227a3..271dc7e78e43 100644
--- a/arch/arm/configs/pxa_defconfig
+++ b/arch/arm/configs/pxa_defconfig
@@ -97,7 +97,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="root=/dev/ram0 ro"
 CONFIG_KEXEC=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_USERSPACE=m
diff --git a/arch/arm/configs/shmobile_defconfig 
b/arch/arm/configs/shmobile_defconfig
index 1b0f8ae36fb3..adeaecd831a4 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -38,7 +38,7 @@ CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_KEXEC=y
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_STAT=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_ONDEMAND=y
diff --git a/arch/mips/configs/lemote2f_defconfig 
b/arch/mips/configs/lemote2f_defconfig
index 5da76e0e120f..bed745596d86 100644
--- a/arch/mips/configs/lemote2f_defconfig
+++ b/arch/mips/configs/lemote2f_defconfig
@@ -40,7 +40,6 @@ CONFIG_PM_STD_PARTITION="/dev/hda3"
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_DEBUG=y
 CONFIG_CPU_FREQ_STAT=m
-CONFIG_CPU_FREQ_STAT_DETAILS=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
 CONFIG_CPU_FREQ_GOV_USERSPACE=m
diff --git a/arch/powerpc/configs/ppc6xx_defconfig 
b/arch/powerpc/configs/ppc6xx_defconfig
index 3ce91a3df27f..1d2d69dd6409 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -62,7 +62,6 @@ CONFIG_MPC8610_HPCD=y
 CONFIG_GEF_SBC610=y
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_STAT=m
-CONFIG_CPU_FREQ_STAT_DETAILS=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig