fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3

2016-09-10 Thread kbuild test robot
Hi Dave,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: ab9d1e4f7b0217948a3b35a64178602ab30ff45d Merge branch 
'xfs-misc-fixes-4.6-3' into for-next
date:   6 months ago
config: openrisc-allyesconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
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
git checkout ab9d1e4f7b0217948a3b35a64178602ab30ff45d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:48:0:
   In function 'xfs_check_ondisk_structs',
   inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1862:26:
   fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared 
with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 6
>> fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3
   fs/xfs/xfs_ondisk.h:97:2: error: call to '__compiletime_assert_97' declared 
with attribute error: XFS: sizeof(xfs_dir2_sf_hdr_t) is wrong, expected 10

vim +/__compiletime_assert_96 +96 fs/xfs/xfs_ondisk.h

30cbc591 Darrick J. Wong 2016-03-09  80 
XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t, 12);
30cbc591 Darrick J. Wong 2016-03-09  81 
XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t, 16);
30cbc591 Darrick J. Wong 2016-03-09  82 
XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  83 
XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,16);
30cbc591 Darrick J. Wong 2016-03-09  84 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t, 4);
30cbc591 Darrick J. Wong 2016-03-09  85 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09 @86 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_unused_t,   6);
30cbc591 Darrick J. Wong 2016-03-09  87 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  88 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  89 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino4_t,  4);
30cbc591 Darrick J. Wong 2016-03-09  90 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino8_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  91 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_inou_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  92 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,8);
30cbc591 Darrick J. Wong 2016-03-09  93 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  94 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  95 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t, 4);
30cbc591 Darrick J. Wong 2016-03-09 @96 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,  3);
30cbc591 Darrick J. Wong 2016-03-09  97 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,10);
30cbc591 Darrick J. Wong 2016-03-09  98 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,2);
30cbc591 Darrick J. Wong 2016-03-09  99  

:: The code at line 96 was first introduced by commit
:: 30cbc591c34e680e8b5d6d675ea49effe42a0570 xfs: check sizes of XFS on-disk 
structures at compile time

:: TO: Darrick J. Wong 
:: CC: Dave Chinner 

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


.config.gz
Description: Binary data


fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3

2016-09-10 Thread kbuild test robot
Hi Dave,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: ab9d1e4f7b0217948a3b35a64178602ab30ff45d Merge branch 
'xfs-misc-fixes-4.6-3' into for-next
date:   6 months ago
config: openrisc-allyesconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
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
git checkout ab9d1e4f7b0217948a3b35a64178602ab30ff45d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:48:0:
   In function 'xfs_check_ondisk_structs',
   inlined from 'init_xfs_fs' at fs/xfs/xfs_super.c:1862:26:
   fs/xfs/xfs_ondisk.h:86:2: error: call to '__compiletime_assert_86' declared 
with attribute error: XFS: sizeof(xfs_dir2_data_unused_t) is wrong, expected 6
>> fs/xfs/xfs_ondisk.h:96:2: error: call to '__compiletime_assert_96' declared 
>> with attribute error: XFS: sizeof(xfs_dir2_sf_entry_t) is wrong, expected 3
   fs/xfs/xfs_ondisk.h:97:2: error: call to '__compiletime_assert_97' declared 
with attribute error: XFS: sizeof(xfs_dir2_sf_hdr_t) is wrong, expected 10

vim +/__compiletime_assert_96 +96 fs/xfs/xfs_ondisk.h

30cbc591 Darrick J. Wong 2016-03-09  80 
XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t, 12);
30cbc591 Darrick J. Wong 2016-03-09  81 
XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t, 16);
30cbc591 Darrick J. Wong 2016-03-09  82 
XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  83 
XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,16);
30cbc591 Darrick J. Wong 2016-03-09  84 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t, 4);
30cbc591 Darrick J. Wong 2016-03-09  85 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09 @86 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_unused_t,   6);
30cbc591 Darrick J. Wong 2016-03-09  87 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  88 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  89 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino4_t,  4);
30cbc591 Darrick J. Wong 2016-03-09  90 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_ino8_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  91 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_inou_t,  8);
30cbc591 Darrick J. Wong 2016-03-09  92 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,8);
30cbc591 Darrick J. Wong 2016-03-09  93 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  94 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,  16);
30cbc591 Darrick J. Wong 2016-03-09  95 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t, 4);
30cbc591 Darrick J. Wong 2016-03-09 @96 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,  3);
30cbc591 Darrick J. Wong 2016-03-09  97 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,10);
30cbc591 Darrick J. Wong 2016-03-09  98 
XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_off_t,2);
30cbc591 Darrick J. Wong 2016-03-09  99  

:: The code at line 96 was first introduced by commit
:: 30cbc591c34e680e8b5d6d675ea49effe42a0570 xfs: check sizes of XFS on-disk 
structures at compile time

:: TO: Darrick J. Wong 
:: CC: Dave Chinner 

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


.config.gz
Description: Binary data


Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Pan, Harry
My apology that I resent again in order to clean my junk of useless
enum, and ignore ambiguous in-reply-to (2016/9/11/8) due to subject.

new patchset is here:
https://lkml.org/lkml/2016/9/11/11
https://lkml.org/lkml/2016/9/11/12
https://lkml.org/lkml/2016/9/11/10

Thanks,
Harry


Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Pan, Harry
My apology that I resent again in order to clean my junk of useless
enum, and ignore ambiguous in-reply-to (2016/9/11/8) due to subject.

new patchset is here:
https://lkml.org/lkml/2016/9/11/11
https://lkml.org/lkml/2016/9/11/12
https://lkml.org/lkml/2016/9/11/10

Thanks,
Harry


[PATCH 2/3] x86/perf/rapl: Make quirk a function pointer

2016-09-10 Thread Harry Pan
From: Thomas Gleixner 

There are more model specific quirks required. So we need to change the
single purpose boolean quirk flag to an easy extensible mechanism.

Make the quirk a function pointer and move the existing quirk into its own
function.

While at it make the init struct initializers readable and rename the
misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
that's what it is a cpu model descriptor for the rapl features specific to
a particular model.

Signed-off-by: Thomas Gleixner 
Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 92 ++--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index f7924640..94abfdb 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -152,6 +152,12 @@ struct rapl_pmus {
struct rapl_pmu *pmus[];
 };
 
+struct intel_rapl_model_desc {
+   void(*quirk)(void);
+   int cntr_mask;
+   struct attribute**attrs;
+};
+
  /* 1/2^hw_unit Joule */
 static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
 static struct rapl_pmus *rapl_pmus;
@@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int cpu)
return 0;
 }
 
-static int rapl_check_hw_unit(bool apply_quirk)
+static void rapl_hsx_quirk(void)
+{
+   /*
+* DRAM domain on HSW server and KNL has fixed energy unit which can be
+* different than the unit from power unit MSR. See
+* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
+* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
+*/
+   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+}
+
+static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
int i;
@@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply_quirk)
for (i = 0; i < NR_RAPL_DOMAINS; i++)
rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
 
-   /*
-* DRAM domain on HSW server and KNL has fixed energy unit which can be
-* different than the unit from power unit MSR. See
-* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
-* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
-*/
-   if (apply_quirk)
-   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+   /* Apply quirk before initializing the timer rate */
+   if (model->quirk)
+   model->quirk();
 
/*
 * Calculate the timer rate:
@@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
 #define X86_RAPL_MODEL_MATCH(model, init)  \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
 
-struct intel_rapl_init_fun {
-   bool apply_quirk;
-   int cntr_mask;
-   struct attribute **attrs;
-};
-
-static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_CLN,
-   .attrs = rapl_events_cln_attr,
+static const struct intel_rapl_model_desc snb_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_CLN,
+   .attrs  = rapl_events_cln_attr,
 };
 
-static const struct intel_rapl_init_fun hsx_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc hsx_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun hsw_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_HSW,
-   .attrs = rapl_events_hsw_attr,
+static const struct intel_rapl_model_desc hsw_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_HSW,
+   .attrs  = rapl_events_hsw_attr,
 };
 
-static const struct intel_rapl_init_fun snbep_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc snbep_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun knl_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_KNL,
-   .attrs = rapl_events_knl_attr,
+static const struct intel_rapl_model_desc knl_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_KNL,
+   .attrs  = rapl_events_knl_attr,
 };
 
-static const struct intel_rapl_init_fun skl_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SKL_CLN,
-   .attrs = 

[PATCH 2/3] x86/perf/rapl: Make quirk a function pointer

2016-09-10 Thread Harry Pan
From: Thomas Gleixner 

There are more model specific quirks required. So we need to change the
single purpose boolean quirk flag to an easy extensible mechanism.

Make the quirk a function pointer and move the existing quirk into its own
function.

While at it make the init struct initializers readable and rename the
misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
that's what it is a cpu model descriptor for the rapl features specific to
a particular model.

Signed-off-by: Thomas Gleixner 
Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 92 ++--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index f7924640..94abfdb 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -152,6 +152,12 @@ struct rapl_pmus {
struct rapl_pmu *pmus[];
 };
 
+struct intel_rapl_model_desc {
+   void(*quirk)(void);
+   int cntr_mask;
+   struct attribute**attrs;
+};
+
  /* 1/2^hw_unit Joule */
 static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
 static struct rapl_pmus *rapl_pmus;
@@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int cpu)
return 0;
 }
 
-static int rapl_check_hw_unit(bool apply_quirk)
+static void rapl_hsx_quirk(void)
+{
+   /*
+* DRAM domain on HSW server and KNL has fixed energy unit which can be
+* different than the unit from power unit MSR. See
+* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
+* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
+*/
+   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+}
+
+static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
int i;
@@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply_quirk)
for (i = 0; i < NR_RAPL_DOMAINS; i++)
rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
 
-   /*
-* DRAM domain on HSW server and KNL has fixed energy unit which can be
-* different than the unit from power unit MSR. See
-* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
-* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
-*/
-   if (apply_quirk)
-   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+   /* Apply quirk before initializing the timer rate */
+   if (model->quirk)
+   model->quirk();
 
/*
 * Calculate the timer rate:
@@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
 #define X86_RAPL_MODEL_MATCH(model, init)  \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
 
-struct intel_rapl_init_fun {
-   bool apply_quirk;
-   int cntr_mask;
-   struct attribute **attrs;
-};
-
-static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_CLN,
-   .attrs = rapl_events_cln_attr,
+static const struct intel_rapl_model_desc snb_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_CLN,
+   .attrs  = rapl_events_cln_attr,
 };
 
-static const struct intel_rapl_init_fun hsx_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc hsx_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun hsw_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_HSW,
-   .attrs = rapl_events_hsw_attr,
+static const struct intel_rapl_model_desc hsw_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_HSW,
+   .attrs  = rapl_events_hsw_attr,
 };
 
-static const struct intel_rapl_init_fun snbep_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc snbep_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun knl_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_KNL,
-   .attrs = rapl_events_knl_attr,
+static const struct intel_rapl_model_desc knl_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_KNL,
+   .attrs  = rapl_events_knl_attr,
 };
 
-static const struct intel_rapl_init_fun skl_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SKL_CLN,
-   .attrs = rapl_events_skl_attr,
+static const struct intel_rapl_model_desc 

[PATCH 3/3] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 49 
 1 file changed, 49 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..2af6c18 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1<config
  * any other bit is reserved
@@ -458,6 +462,14 @@ RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, 
"2.3283064365386962890
 RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, 
"2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-psys.scale,   rapl_psys_scale, 
"2.3283064365386962890625e-10");
 
+/*
+ * Some Atom series processors (BYT/BSW) have fixed
+ * energy status unit (ESU) in smallest unit of microjoule,
+ * and its increment is in 2^ESU microjoules.
+ */
+RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_byt_cores_scale, "1.0e-6");
+RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_byt_pkg_scale, "1.0e-6");
+
 static struct attribute *rapl_events_srv_attr[] = {
EVENT_PTR(rapl_cores),
EVENT_PTR(rapl_pkg),
@@ -539,6 +551,18 @@ static struct attribute *rapl_events_knl_attr[] = {
NULL,
 };
 
+static struct attribute *rapl_events_byt_attr[] = {
+   EVENT_PTR(rapl_cores),
+   EVENT_PTR(rapl_pkg),
+
+   EVENT_PTR(rapl_cores_unit),
+   EVENT_PTR(rapl_pkg_unit),
+
+   EVENT_PTR(rapl_byt_cores_scale),
+   EVENT_PTR(rapl_byt_pkg_scale),
+   NULL,
+};
+
 static struct attribute_group rapl_pmu_events_group = {
.name = "events",
.attrs = NULL, /* patched at runtime */
@@ -634,6 +658,23 @@ static void rapl_hsx_quirk(void)
rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
 }
 
+static void rapl_byt_quirk(void)
+{
+   int i;
+
+   /*
+* Some Atom processors (BYT/BSW) have 2^ESU microjoules
+* increment, refer to Software Developers' Manual, Vol. 3C,
+* Order No. 325384, Table 35-8 of MSR_RAPL_POWER_UNIT.
+*
+* TODO: In order to fit BYT/BSW quirk model, here remind
+*   this generates timer rate in 80ms; by default
+*   ESU of BYT/BSW is 5, so it leads (1000/200)*2^4.
+*/
+   for (i = 0; i < NR_RAPL_DOMAINS; i++)
+   rapl_hw_unit[i] = 32 - rapl_hw_unit[i];
+}
+
 static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
@@ -745,6 +786,12 @@ static const struct intel_rapl_model_desc skl_rapl_init 
__initconst = {
.attrs  = rapl_events_skl_attr,
 };
 
+static const struct intel_rapl_model_desc byt_rapl_init __initconst = {
+   .quirk  = rapl_byt_quirk,
+   .cntr_mask  = RAPL_IDX_BYT,
+   .attrs  = rapl_events_byt_attr,
+};
+
 static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE,   snb_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE_X, snbep_rapl_init),
@@ -768,6 +815,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
 
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_SILVERMONT1, byt_rapl_init),
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_AIRMONT, byt_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
-- 
2.6.6



[PATCH 1/3] perf/x86/rapl: Enable Apollo Lake RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Apollo Lake (Goldmont) processors (Model 92):

RAPL of Goldmont, unlikes ESU increment of Silvermont/Airmont,
it likes the Haswell microarchitecture in 1/2^ESU joules and
supports power domains in PP0/PP1/PKG/RAM.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-12.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 2886593..f7924640 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -765,6 +765,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_MOBILE,  skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
+
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
 
-- 
2.6.6



[PATCH 3/3] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 49 
 1 file changed, 49 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..2af6c18 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1

[PATCH 1/3] perf/x86/rapl: Enable Apollo Lake RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Apollo Lake (Goldmont) processors (Model 92):

RAPL of Goldmont, unlikes ESU increment of Silvermont/Airmont,
it likes the Haswell microarchitecture in 1/2^ESU joules and
supports power domains in PP0/PP1/PKG/RAM.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-12.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 2886593..f7924640 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -765,6 +765,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_MOBILE,  skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
+
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
 
-- 
2.6.6



make[2]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o', needed by 'arch/sh/boot/dts/built-in.o'.

2016-09-10 Thread kbuild test robot
Hi Rich,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 190fe191cfbead9fe089453dd092869c9469c6d4 sh: add support for linking a 
builtin device tree blob in the kernel
date:   6 weeks ago
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
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
git checkout 190fe191cfbead9fe089453dd092869c9469c6d4
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

>> make[2]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o', needed by 
>> 'arch/sh/boot/dts/built-in.o'.
   make[2]: Target '__build' not remade because of errors.

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


.config.gz
Description: Binary data


make[2]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o', needed by 'arch/sh/boot/dts/built-in.o'.

2016-09-10 Thread kbuild test robot
Hi Rich,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 190fe191cfbead9fe089453dd092869c9469c6d4 sh: add support for linking a 
builtin device tree blob in the kernel
date:   6 weeks ago
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 5.4.0-6) 5.4.0 20160609
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
git checkout 190fe191cfbead9fe089453dd092869c9469c6d4
# save the attached .config to linux build tree
make.cross ARCH=sh 

All errors (new ones prefixed by >>):

>> make[2]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o', needed by 
>> 'arch/sh/boot/dts/built-in.o'.
   make[2]: Target '__build' not remade because of errors.

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


.config.gz
Description: Binary data


[PATCH] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 49 
 1 file changed, 49 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..2af6c18 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1<config
  * any other bit is reserved
@@ -458,6 +462,14 @@ RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, 
"2.3283064365386962890
 RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, 
"2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-psys.scale,   rapl_psys_scale, 
"2.3283064365386962890625e-10");
 
+/*
+ * Some Atom series processors (BYT/BSW) have fixed
+ * energy status unit (ESU) in smallest unit of microjoule,
+ * and its increment is in 2^ESU microjoules.
+ */
+RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_byt_cores_scale, "1.0e-6");
+RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_byt_pkg_scale, "1.0e-6");
+
 static struct attribute *rapl_events_srv_attr[] = {
EVENT_PTR(rapl_cores),
EVENT_PTR(rapl_pkg),
@@ -539,6 +551,18 @@ static struct attribute *rapl_events_knl_attr[] = {
NULL,
 };
 
+static struct attribute *rapl_events_byt_attr[] = {
+   EVENT_PTR(rapl_cores),
+   EVENT_PTR(rapl_pkg),
+
+   EVENT_PTR(rapl_cores_unit),
+   EVENT_PTR(rapl_pkg_unit),
+
+   EVENT_PTR(rapl_byt_cores_scale),
+   EVENT_PTR(rapl_byt_pkg_scale),
+   NULL,
+};
+
 static struct attribute_group rapl_pmu_events_group = {
.name = "events",
.attrs = NULL, /* patched at runtime */
@@ -634,6 +658,23 @@ static void rapl_hsx_quirk(void)
rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
 }
 
+static void rapl_byt_quirk(void)
+{
+   int i;
+
+   /*
+* Some Atom processors (BYT/BSW) have 2^ESU microjoules
+* increment, refer to Software Developers' Manual, Vol. 3C,
+* Order No. 325384, Table 35-8 of MSR_RAPL_POWER_UNIT.
+*
+* TODO: In order to fit BYT/BSW quirk model, here remind
+*   this generates timer rate in 80ms; by default
+*   ESU of BYT/BSW is 5, so it leads (1000/200)*2^4.
+*/
+   for (i = 0; i < NR_RAPL_DOMAINS; i++)
+   rapl_hw_unit[i] = 32 - rapl_hw_unit[i];
+}
+
 static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
@@ -745,6 +786,12 @@ static const struct intel_rapl_model_desc skl_rapl_init 
__initconst = {
.attrs  = rapl_events_skl_attr,
 };
 
+static const struct intel_rapl_model_desc byt_rapl_init __initconst = {
+   .quirk  = rapl_byt_quirk,
+   .cntr_mask  = RAPL_IDX_BYT,
+   .attrs  = rapl_events_byt_attr,
+};
+
 static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE,   snb_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE_X, snbep_rapl_init),
@@ -768,6 +815,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
 
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_SILVERMONT1, byt_rapl_init),
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_AIRMONT, byt_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
-- 
2.6.6



[PATCH] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 49 
 1 file changed, 49 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..2af6c18 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1

Talent Scout

2016-09-10 Thread Camilia Brunnet
Dear Concern,
I am Talent Scout For BLUE SKY FILM STUDIO, Present Blue sky Studio a Film 
Corporation Located in the United State, is Soliciting for the Right to use 
Your Photo/Face and Personality as One of the Semi -Major Role/ Character in 
our Upcoming ANIMATED Stereoscope 3D Movie-The Story of Ferdinand(Ferdinand 
2017) The Movie is Currently Filming (In Production) Please Note That There 
Will Be No Auditions, Traveling or Any Special / Professional Acting Skills, 
Since the Production of This Movie Will Be Done with our State of Art Computer 
-Generating Imagery Equipment. We Are Prepared to Pay the Total Sum of 
$620,000.00 USD. For More Information/Understanding, Please Write us on the 
E-Mail Below.
CONTACT EMAIL: blueskyfilmstu...@usa.com
All Reply to:  blueskyfilmstu...@usa.com
Note: Only the Response send to this mail will be Given a Prior Consideration.
Talent Scout
Camilia Brunnet


Talent Scout

2016-09-10 Thread Camilia Brunnet
Dear Concern,
I am Talent Scout For BLUE SKY FILM STUDIO, Present Blue sky Studio a Film 
Corporation Located in the United State, is Soliciting for the Right to use 
Your Photo/Face and Personality as One of the Semi -Major Role/ Character in 
our Upcoming ANIMATED Stereoscope 3D Movie-The Story of Ferdinand(Ferdinand 
2017) The Movie is Currently Filming (In Production) Please Note That There 
Will Be No Auditions, Traveling or Any Special / Professional Acting Skills, 
Since the Production of This Movie Will Be Done with our State of Art Computer 
-Generating Imagery Equipment. We Are Prepared to Pay the Total Sum of 
$620,000.00 USD. For More Information/Understanding, Please Write us on the 
E-Mail Below.
CONTACT EMAIL: blueskyfilmstu...@usa.com
All Reply to:  blueskyfilmstu...@usa.com
Note: Only the Response send to this mail will be Given a Prior Consideration.
Talent Scout
Camilia Brunnet


Re: [PATCH 0/5] ATM-nicstar: Fine-tuning for three function implementations

2016-09-10 Thread David Miller
From: SF Markus Elfring 
Date: Sat, 10 Sep 2016 09:15:37 +0200

> From: Markus Elfring 
> Date: Sat, 10 Sep 2016 09:10:01 +0200
> 
> A few update suggestions were taken into account
> from static source code analysis.

Series applied.


Re: [PATCH 0/4] ATM-ZeitNet: Fine-tuning for three function implementations

2016-09-10 Thread David Miller
From: SF Markus Elfring 
Date: Sat, 10 Sep 2016 10:57:37 +0200

> A few update suggestions were taken into account
> from static source code analysis.

Series applied.


Re: [PATCH 0/5] ATM-nicstar: Fine-tuning for three function implementations

2016-09-10 Thread David Miller
From: SF Markus Elfring 
Date: Sat, 10 Sep 2016 09:15:37 +0200

> From: Markus Elfring 
> Date: Sat, 10 Sep 2016 09:10:01 +0200
> 
> A few update suggestions were taken into account
> from static source code analysis.

Series applied.


Re: [PATCH 0/4] ATM-ZeitNet: Fine-tuning for three function implementations

2016-09-10 Thread David Miller
From: SF Markus Elfring 
Date: Sat, 10 Sep 2016 10:57:37 +0200

> A few update suggestions were taken into account
> from static source code analysis.

Series applied.


Re: [PATCH] rapidio: avoid GFP_KERNEL in atomic context in riocm_send_close()

2016-09-10 Thread Andrew Morton
On Fri, 9 Sep 2016 21:22:14 -0700 Andrew Morton  
wrote:

> Why not just make `hdr' a local?  It isn't very large and the code
> becomes smaller and faster.

Actually, doing it this way saves some code size and is faster:


From: Andrew Morton 
Subject: drivers/rapidio/rio_cm.c: avoid GFP_KERNEL in atomic context

riocm_send_close() is called from rio_cm_shutdown() under
spin_lock_bh(idr_lock), but riocm_send_close() uses a GFP_KERNEL
allocation.

Fix this by making local `hdr' a local variable rather than obtaining it
via kmalloc().

Found by Linux Driver Verification project (linuxtesting.org).

Link: 
http://lkml.kernel.org/r/1473453815-15914-1-git-send-email-khoroshi...@ispras.ru
Reported-by: Alexey Khoroshilov 
Cc: Alexandre Bounine 
Signed-off-by: Andrew Morton 
---

 drivers/rapidio/rio_cm.c |   38 -
 1 file changed, 17 insertions(+), 21 deletions(-)

diff -puN 
drivers/rapidio/rio_cm.c~drivers-rapidio-rio_cmc-avoid-gfp_kernel-in-atomic-context
 drivers/rapidio/rio_cm.c
--- 
a/drivers/rapidio/rio_cm.c~drivers-rapidio-rio_cmc-avoid-gfp_kernel-in-atomic-context
+++ a/drivers/rapidio/rio_cm.c
@@ -1395,38 +1395,34 @@ static void riocm_ch_free(struct kref *r
complete(>comp_close);
 }
 
+/*
+ * Send CH_CLOSE notification to the remote RapidIO device
+ */
 static int riocm_send_close(struct rio_channel *ch)
 {
-   struct rio_ch_chan_hdr *hdr;
int ret;
-
-   /*
-* Send CH_CLOSE notification to the remote RapidIO device
-*/
-
-   hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
-   if (hdr == NULL)
-   return -ENOMEM;
-
-   hdr->bhdr.src_id = htonl(ch->loc_destid);
-   hdr->bhdr.dst_id = htonl(ch->rem_destid);
-   hdr->bhdr.src_mbox = cmbox;
-   hdr->bhdr.dst_mbox = cmbox;
-   hdr->bhdr.type = RIO_CM_CHAN;
-   hdr->ch_op = CM_CONN_CLOSE;
-   hdr->dst_ch = htons(ch->rem_channel);
-   hdr->src_ch = htons(ch->id);
+   struct rio_ch_chan_hdr hdr = {
+   .bhdr = {
+   .src_id = htonl(ch->loc_destid),
+   .dst_id = htonl(ch->rem_destid),
+   .src_mbox = cmbox,
+   .dst_mbox = cmbox,
+   .type = RIO_CM_CHAN,
+   },
+   .ch_op = CM_CONN_CLOSE,
+   .dst_ch = htons(ch->rem_channel),
+   .src_ch = htons(ch->id),
+   };
 
/* ATTN: the function call below relies on the fact that underlying
 * add_outb_message() routine copies TX data into its internal transfer
 * buffer. Needs to be reviewed if switched to direct buffer mode.
 */
-   ret = riocm_post_send(ch->cmdev, ch->rdev, hdr, sizeof(*hdr));
+   ret = riocm_post_send(ch->cmdev, ch->rdev, , sizeof(hdr));
 
if (ret == -EBUSY && !riocm_queue_req(ch->cmdev, ch->rdev,
- hdr, sizeof(*hdr)))
+ , sizeof(hdr)))
return 0;
-   kfree(hdr);
 
if (ret)
riocm_error("ch(%d) send CLOSE failed (ret=%d)", ch->id, ret);
_





Re: [PATCH] rapidio: avoid GFP_KERNEL in atomic context in riocm_send_close()

2016-09-10 Thread Andrew Morton
On Fri, 9 Sep 2016 21:22:14 -0700 Andrew Morton  
wrote:

> Why not just make `hdr' a local?  It isn't very large and the code
> becomes smaller and faster.

Actually, doing it this way saves some code size and is faster:


From: Andrew Morton 
Subject: drivers/rapidio/rio_cm.c: avoid GFP_KERNEL in atomic context

riocm_send_close() is called from rio_cm_shutdown() under
spin_lock_bh(idr_lock), but riocm_send_close() uses a GFP_KERNEL
allocation.

Fix this by making local `hdr' a local variable rather than obtaining it
via kmalloc().

Found by Linux Driver Verification project (linuxtesting.org).

Link: 
http://lkml.kernel.org/r/1473453815-15914-1-git-send-email-khoroshi...@ispras.ru
Reported-by: Alexey Khoroshilov 
Cc: Alexandre Bounine 
Signed-off-by: Andrew Morton 
---

 drivers/rapidio/rio_cm.c |   38 -
 1 file changed, 17 insertions(+), 21 deletions(-)

diff -puN 
drivers/rapidio/rio_cm.c~drivers-rapidio-rio_cmc-avoid-gfp_kernel-in-atomic-context
 drivers/rapidio/rio_cm.c
--- 
a/drivers/rapidio/rio_cm.c~drivers-rapidio-rio_cmc-avoid-gfp_kernel-in-atomic-context
+++ a/drivers/rapidio/rio_cm.c
@@ -1395,38 +1395,34 @@ static void riocm_ch_free(struct kref *r
complete(>comp_close);
 }
 
+/*
+ * Send CH_CLOSE notification to the remote RapidIO device
+ */
 static int riocm_send_close(struct rio_channel *ch)
 {
-   struct rio_ch_chan_hdr *hdr;
int ret;
-
-   /*
-* Send CH_CLOSE notification to the remote RapidIO device
-*/
-
-   hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
-   if (hdr == NULL)
-   return -ENOMEM;
-
-   hdr->bhdr.src_id = htonl(ch->loc_destid);
-   hdr->bhdr.dst_id = htonl(ch->rem_destid);
-   hdr->bhdr.src_mbox = cmbox;
-   hdr->bhdr.dst_mbox = cmbox;
-   hdr->bhdr.type = RIO_CM_CHAN;
-   hdr->ch_op = CM_CONN_CLOSE;
-   hdr->dst_ch = htons(ch->rem_channel);
-   hdr->src_ch = htons(ch->id);
+   struct rio_ch_chan_hdr hdr = {
+   .bhdr = {
+   .src_id = htonl(ch->loc_destid),
+   .dst_id = htonl(ch->rem_destid),
+   .src_mbox = cmbox,
+   .dst_mbox = cmbox,
+   .type = RIO_CM_CHAN,
+   },
+   .ch_op = CM_CONN_CLOSE,
+   .dst_ch = htons(ch->rem_channel),
+   .src_ch = htons(ch->id),
+   };
 
/* ATTN: the function call below relies on the fact that underlying
 * add_outb_message() routine copies TX data into its internal transfer
 * buffer. Needs to be reviewed if switched to direct buffer mode.
 */
-   ret = riocm_post_send(ch->cmdev, ch->rdev, hdr, sizeof(*hdr));
+   ret = riocm_post_send(ch->cmdev, ch->rdev, , sizeof(hdr));
 
if (ret == -EBUSY && !riocm_queue_req(ch->cmdev, ch->rdev,
- hdr, sizeof(*hdr)))
+ , sizeof(hdr)))
return 0;
-   kfree(hdr);
 
if (ret)
riocm_error("ch(%d) send CLOSE failed (ret=%d)", ch->id, ret);
_





Re: [PATCH] atomic64: No need for CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE

2016-09-10 Thread kbuild test robot
Hi Vineet,

[auto build test ERROR on arm64/for-next/core]
[cannot apply to linus/master linux/master v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Vineet-Gupta/atomic64-No-need-for-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE/20160909-013936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 
for-next/core
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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=ia64 

All errors (new ones prefixed by >>):

   lib/atomic64_test.c: In function 'test_atomic64':
>> lib/atomic64_test.c:217:2: error: implicit declaration of function 
>> 'atomic64_dec_if_positive' [-Werror=implicit-function-declaration]
 BUG_ON(atomic64_dec_if_positive() != (onestwos - 1));
 ^
   cc1: some warnings being treated as errors

vim +/atomic64_dec_if_positive +217 lib/atomic64_test.c

86a89380 Luca Barbieri 2010-02-24  211  INIT(v0);
9efbcd59 Luca Barbieri 2010-03-01  212  BUG_ON(!atomic64_add_unless(, 
one, v1));
86a89380 Luca Barbieri 2010-02-24  213  r += one;
86a89380 Luca Barbieri 2010-02-24  214  BUG_ON(v.counter != r);
86a89380 Luca Barbieri 2010-02-24  215  
86a89380 Luca Barbieri 2010-02-24  216  INIT(onestwos);
86a89380 Luca Barbieri 2010-02-24 @217  
BUG_ON(atomic64_dec_if_positive() != (onestwos - 1));
86a89380 Luca Barbieri 2010-02-24  218  r -= one;
86a89380 Luca Barbieri 2010-02-24  219  BUG_ON(v.counter != r);
86a89380 Luca Barbieri 2010-02-24  220  

:: The code at line 217 was first introduced by commit
:: 86a8938078a8bb518c5376de493e348c7490d506 lib: Add self-test for 
atomic64_t

:: TO: Luca Barbieri 
:: CC: H. Peter Anvin 

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


.config.gz
Description: Binary data


Re: [PATCH] atomic64: No need for CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE

2016-09-10 Thread kbuild test robot
Hi Vineet,

[auto build test ERROR on arm64/for-next/core]
[cannot apply to linus/master linux/master v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Vineet-Gupta/atomic64-No-need-for-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE/20160909-013936
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 
for-next/core
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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=ia64 

All errors (new ones prefixed by >>):

   lib/atomic64_test.c: In function 'test_atomic64':
>> lib/atomic64_test.c:217:2: error: implicit declaration of function 
>> 'atomic64_dec_if_positive' [-Werror=implicit-function-declaration]
 BUG_ON(atomic64_dec_if_positive() != (onestwos - 1));
 ^
   cc1: some warnings being treated as errors

vim +/atomic64_dec_if_positive +217 lib/atomic64_test.c

86a89380 Luca Barbieri 2010-02-24  211  INIT(v0);
9efbcd59 Luca Barbieri 2010-03-01  212  BUG_ON(!atomic64_add_unless(, 
one, v1));
86a89380 Luca Barbieri 2010-02-24  213  r += one;
86a89380 Luca Barbieri 2010-02-24  214  BUG_ON(v.counter != r);
86a89380 Luca Barbieri 2010-02-24  215  
86a89380 Luca Barbieri 2010-02-24  216  INIT(onestwos);
86a89380 Luca Barbieri 2010-02-24 @217  
BUG_ON(atomic64_dec_if_positive() != (onestwos - 1));
86a89380 Luca Barbieri 2010-02-24  218  r -= one;
86a89380 Luca Barbieri 2010-02-24  219  BUG_ON(v.counter != r);
86a89380 Luca Barbieri 2010-02-24  220  

:: The code at line 217 was first introduced by commit
:: 86a8938078a8bb518c5376de493e348c7490d506 lib: Add self-test for 
atomic64_t

:: TO: Luca Barbieri 
:: CC: H. Peter Anvin 

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


.config.gz
Description: Binary data


Re: [PATCH 0/8] net: use IS_ENABLED() instead of checking for built-in or module

2016-09-10 Thread David Miller
From: Javier Martinez Canillas 
Date: Fri,  9 Sep 2016 08:43:12 -0400

> This trivial series replace the open coding to check for a Kconfig symbol
> being built-in or module, with IS_ENABLED() macro that does exactly that.
> 
> Using the macro makes the code more readable by helping abstract away some
> of the Kconfig built-in and module enable details.

Series applied, thanks.


Re: [PATCH 0/8] net: use IS_ENABLED() instead of checking for built-in or module

2016-09-10 Thread David Miller
From: Javier Martinez Canillas 
Date: Fri,  9 Sep 2016 08:43:12 -0400

> This trivial series replace the open coding to check for a Kconfig symbol
> being built-in or module, with IS_ENABLED() macro that does exactly that.
> 
> Using the macro makes the code more readable by helping abstract away some
> of the Kconfig built-in and module enable details.

Series applied, thanks.


Re: [PATCH v2 0/3] Optimisation of fs_enet ethernet driver

2016-09-10 Thread David Miller
From: Christophe Leroy 
Date: Fri,  9 Sep 2016 14:26:18 +0200 (CEST)

> This set optimises the freescale fs_enet ethernet driver:
> 1/ Merge of RX and TX NAPI functions in order to limit the amount of
> interrupts
> 2/ Do not unmap DMA when packets len is below copybreak, otherwise there
> is no benefit in copying the skb instead of allocating a new one
> 3/ Make copybreak value configurable as the optimised value is not the
> same on all targets

Series applied, thanks.


Re: [PATCH v2 0/3] Optimisation of fs_enet ethernet driver

2016-09-10 Thread David Miller
From: Christophe Leroy 
Date: Fri,  9 Sep 2016 14:26:18 +0200 (CEST)

> This set optimises the freescale fs_enet ethernet driver:
> 1/ Merge of RX and TX NAPI functions in order to limit the amount of
> interrupts
> 2/ Do not unmap DMA when packets len is below copybreak, otherwise there
> is no benefit in copying the skb instead of allocating a new one
> 3/ Make copybreak value configurable as the optimised value is not the
> same on all targets

Series applied, thanks.


Re: perf test "object code reading" segfaulting via usercopy check

2016-09-10 Thread Jiri Olsa
On Fri, Sep 09, 2016 at 12:47:20PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Sep 09, 2016 at 05:41:25PM +0200, Jiri Olsa escreveu:
> > On Fri, Sep 09, 2016 at 12:36:26PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Hi Adrian,
> > > 
> > >   I noticed that 'perf test "object code reading"' is segfaulting
> > > here:
> > > 
> > > [root@jouet linux]# perf test -F "object code reading"
> > > 21: Test object code reading :Segmentation fault
> > > [root@jouet linux]# 
> > > 
> > > dmesg output below, trying to figure this out...
> > 
> > heya,
> > it's the new hardened user copy check.. I sent patches for that:
> > 
> >   http://marc.info/?l=linux-kernel=147332143929289=2
> >   http://marc.info/?l=linux-kernel=147332145229291=2
> 
> Cool, but that is for the kernel, without thinking too much about it, is
> there a way to change that 'perf test' entry to avoid doing what
> triggers the segfault?
> 
> My first thought was that it was reading 4K all the way to the end,
> where it should instead read just what is remaining, but I haven't
> checked this theory at all.

it's actually reading within the bounds of kernel text that triggers
that, it's the new CONFIG_HARDENED_USERCOPY feature:
  f5509cc18daa mm: Hardened usercopy

check the change log, there's list of conditions and
one of them is:
  - object must not overlap with kernel text

jirka


Re: perf test "object code reading" segfaulting via usercopy check

2016-09-10 Thread Jiri Olsa
On Fri, Sep 09, 2016 at 12:47:20PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Sep 09, 2016 at 05:41:25PM +0200, Jiri Olsa escreveu:
> > On Fri, Sep 09, 2016 at 12:36:26PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Hi Adrian,
> > > 
> > >   I noticed that 'perf test "object code reading"' is segfaulting
> > > here:
> > > 
> > > [root@jouet linux]# perf test -F "object code reading"
> > > 21: Test object code reading :Segmentation fault
> > > [root@jouet linux]# 
> > > 
> > > dmesg output below, trying to figure this out...
> > 
> > heya,
> > it's the new hardened user copy check.. I sent patches for that:
> > 
> >   http://marc.info/?l=linux-kernel=147332143929289=2
> >   http://marc.info/?l=linux-kernel=147332145229291=2
> 
> Cool, but that is for the kernel, without thinking too much about it, is
> there a way to change that 'perf test' entry to avoid doing what
> triggers the segfault?
> 
> My first thought was that it was reading 4K all the way to the end,
> where it should instead read just what is remaining, but I haven't
> checked this theory at all.

it's actually reading within the bounds of kernel text that triggers
that, it's the new CONFIG_HARDENED_USERCOPY feature:
  f5509cc18daa mm: Hardened usercopy

check the change log, there's list of conditions and
one of them is:
  - object must not overlap with kernel text

jirka


Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Pan, Harry
Hi Thomas,

Appreciate comments, I understood and learned.
I just uploaded 3 patches integrated yours, yet there was 'git am'
failure thus I did hand work, kindly double check.

Sincerely,
Harry

On Fri, 2016-09-09 at 23:21 +0200, Thomas Gleixner wrote:
> On Fri, 9 Sep 2016, Pan, Harry wrote:
> > On Fri, 2016-09-09 at 17:11 +0200, Thomas Gleixner wrote:
> > > >  struct intel_rapl_init_fun {
> > > > -   bool apply_quirk;
> > > > +   enum rapl_quirk apply_quirk;
> > > 
> > > This is silly. Make apply_quirk a function pointer and provide functions
> > > for the different quirks.
> > I read the rapl_check_hw_unit() as: read MSR_RAPL_POWER_UNIT, apply
> > quirk if need, then estimate timer rate.
> > 
> > In case to refine struct intel_rapl_init_fun adding callback, then
> > either the quirk moving outside the rapl_check_hw_unit(), or replace
> > input parameter as whole rapl_init in order to assess quirk callback, by
> > far it looks to me centralize these two quirks inside this function more
> > easily to maintain.
> 
> If you have more than 3 quirks then the function becomes completely
> unreadable while with a function pointer nobody has to touch it when adding
> a new quirk. Neither do you have to update enums.
> 
> > > Zero ininitalization has no real value other than consuming state space.
> > To enable more than one quirk I extended bool to enum, I thought the
> > __initconst space would be freed after kernel initialized, is there more
> > detail concern I missed?
> 
> I meant screen space. What's the point of zero initialization other than
> consuming code lines and providing zero information?
> 
> But instead of arguing with you in circles I took the 5 minutes to make it
> function pointer based. Patch below.
> 
> Thanks,
> 
>   tglx
> 
> 8<---
> 
> Subject: x86/perf/rapl: Make quirk a function pointer
> From: Thomas Gleixner 
> Date: Fri, 09 Sep 2016 22:46:17 +0200
> 
> There are more model specific quirks required. So we need to change the
> single purpose boolean quirk flag to an easy extensible mechanism.
> 
> Make the quirk a function pointer and move the existing quirk into its own
> function.
> 
> While at it make the init struct initializers readable and rename the
> misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
> that's what it is a cpu model descriptor for the rapl features specific to
> a particular model.
> 
> Signed-off-by: Thomas Gleixner 
> ---
>  arch/x86/events/intel/rapl.c |   92 
> +--
>  1 file changed, 46 insertions(+), 46 deletions(-)
> 
> --- a/arch/x86/events/intel/rapl.c
> +++ b/arch/x86/events/intel/rapl.c
> @@ -152,6 +152,12 @@ struct rapl_pmus {
>   struct rapl_pmu *pmus[];
>  };
>  
> +struct intel_rapl_model_desc {
> + void(*quirk)(void);;
> + int cntr_mask;
> + struct attribute**attrs;
> +};
> +
>   /* 1/2^hw_unit Joule */
>  static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
>  static struct rapl_pmus *rapl_pmus;
> @@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int
>   return 0;
>  }
>  
> -static int rapl_check_hw_unit(bool apply_quirk)
> +static void rapl_hsx_quirk(void)
> +{
> + /*
> +  * DRAM domain on HSW server and KNL has fixed energy unit which can be
> +  * different than the unit from power unit MSR. See
> +  * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
> +  * of 2. Datasheet, September 2014, Reference Number: 330784-001 "
> +  */
> + rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
> +}
> +
> +static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
>  {
>   u64 msr_rapl_power_unit_bits;
>   int i;
> @@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply
>   for (i = 0; i < NR_RAPL_DOMAINS; i++)
>   rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
>  
> - /*
> -  * DRAM domain on HSW server and KNL has fixed energy unit which can be
> -  * different than the unit from power unit MSR. See
> -  * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
> -  * of 2. Datasheet, September 2014, Reference Number: 330784-001 "
> -  */
> - if (apply_quirk)
> - rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
> + /* Apply quirk before initializing the timer rate */
> + if (model->quirk)
> + model->quirk();
>  
>   /*
>* Calculate the timer rate:
> @@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
>  #define X86_RAPL_MODEL_MATCH(model, init)\
>   { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
>  
> -struct intel_rapl_init_fun {
> - bool apply_quirk;
> - int cntr_mask;
> - struct attribute **attrs;
> -};
> -
> -static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
> - .apply_quirk = false,
> - 

Re: [PATCH 2/2] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Pan, Harry
Hi Thomas,

Appreciate comments, I understood and learned.
I just uploaded 3 patches integrated yours, yet there was 'git am'
failure thus I did hand work, kindly double check.

Sincerely,
Harry

On Fri, 2016-09-09 at 23:21 +0200, Thomas Gleixner wrote:
> On Fri, 9 Sep 2016, Pan, Harry wrote:
> > On Fri, 2016-09-09 at 17:11 +0200, Thomas Gleixner wrote:
> > > >  struct intel_rapl_init_fun {
> > > > -   bool apply_quirk;
> > > > +   enum rapl_quirk apply_quirk;
> > > 
> > > This is silly. Make apply_quirk a function pointer and provide functions
> > > for the different quirks.
> > I read the rapl_check_hw_unit() as: read MSR_RAPL_POWER_UNIT, apply
> > quirk if need, then estimate timer rate.
> > 
> > In case to refine struct intel_rapl_init_fun adding callback, then
> > either the quirk moving outside the rapl_check_hw_unit(), or replace
> > input parameter as whole rapl_init in order to assess quirk callback, by
> > far it looks to me centralize these two quirks inside this function more
> > easily to maintain.
> 
> If you have more than 3 quirks then the function becomes completely
> unreadable while with a function pointer nobody has to touch it when adding
> a new quirk. Neither do you have to update enums.
> 
> > > Zero ininitalization has no real value other than consuming state space.
> > To enable more than one quirk I extended bool to enum, I thought the
> > __initconst space would be freed after kernel initialized, is there more
> > detail concern I missed?
> 
> I meant screen space. What's the point of zero initialization other than
> consuming code lines and providing zero information?
> 
> But instead of arguing with you in circles I took the 5 minutes to make it
> function pointer based. Patch below.
> 
> Thanks,
> 
>   tglx
> 
> 8<---
> 
> Subject: x86/perf/rapl: Make quirk a function pointer
> From: Thomas Gleixner 
> Date: Fri, 09 Sep 2016 22:46:17 +0200
> 
> There are more model specific quirks required. So we need to change the
> single purpose boolean quirk flag to an easy extensible mechanism.
> 
> Make the quirk a function pointer and move the existing quirk into its own
> function.
> 
> While at it make the init struct initializers readable and rename the
> misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
> that's what it is a cpu model descriptor for the rapl features specific to
> a particular model.
> 
> Signed-off-by: Thomas Gleixner 
> ---
>  arch/x86/events/intel/rapl.c |   92 
> +--
>  1 file changed, 46 insertions(+), 46 deletions(-)
> 
> --- a/arch/x86/events/intel/rapl.c
> +++ b/arch/x86/events/intel/rapl.c
> @@ -152,6 +152,12 @@ struct rapl_pmus {
>   struct rapl_pmu *pmus[];
>  };
>  
> +struct intel_rapl_model_desc {
> + void(*quirk)(void);;
> + int cntr_mask;
> + struct attribute**attrs;
> +};
> +
>   /* 1/2^hw_unit Joule */
>  static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
>  static struct rapl_pmus *rapl_pmus;
> @@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int
>   return 0;
>  }
>  
> -static int rapl_check_hw_unit(bool apply_quirk)
> +static void rapl_hsx_quirk(void)
> +{
> + /*
> +  * DRAM domain on HSW server and KNL has fixed energy unit which can be
> +  * different than the unit from power unit MSR. See
> +  * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
> +  * of 2. Datasheet, September 2014, Reference Number: 330784-001 "
> +  */
> + rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
> +}
> +
> +static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
>  {
>   u64 msr_rapl_power_unit_bits;
>   int i;
> @@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply
>   for (i = 0; i < NR_RAPL_DOMAINS; i++)
>   rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
>  
> - /*
> -  * DRAM domain on HSW server and KNL has fixed energy unit which can be
> -  * different than the unit from power unit MSR. See
> -  * "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
> -  * of 2. Datasheet, September 2014, Reference Number: 330784-001 "
> -  */
> - if (apply_quirk)
> - rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
> + /* Apply quirk before initializing the timer rate */
> + if (model->quirk)
> + model->quirk();
>  
>   /*
>* Calculate the timer rate:
> @@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
>  #define X86_RAPL_MODEL_MATCH(model, init)\
>   { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
>  
> -struct intel_rapl_init_fun {
> - bool apply_quirk;
> - int cntr_mask;
> - struct attribute **attrs;
> -};
> -
> -static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
> - .apply_quirk = false,
> - .cntr_mask = RAPL_IDX_CLN,
> - .attrs = 

[PATCH 2/3] x86/perf/rapl: Make quirk a function pointer

2016-09-10 Thread Harry Pan
From: Thomas Gleixner 

There are more model specific quirks required. So we need to change the
single purpose boolean quirk flag to an easy extensible mechanism.

Make the quirk a function pointer and move the existing quirk into its own
function.

While at it make the init struct initializers readable and rename the
misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
that's what it is a cpu model descriptor for the rapl features specific to
a particular model.

Signed-off-by: Thomas Gleixner 
Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 92 ++--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index f7924640..94abfdb 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -152,6 +152,12 @@ struct rapl_pmus {
struct rapl_pmu *pmus[];
 };
 
+struct intel_rapl_model_desc {
+   void(*quirk)(void);
+   int cntr_mask;
+   struct attribute**attrs;
+};
+
  /* 1/2^hw_unit Joule */
 static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
 static struct rapl_pmus *rapl_pmus;
@@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int cpu)
return 0;
 }
 
-static int rapl_check_hw_unit(bool apply_quirk)
+static void rapl_hsx_quirk(void)
+{
+   /*
+* DRAM domain on HSW server and KNL has fixed energy unit which can be
+* different than the unit from power unit MSR. See
+* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
+* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
+*/
+   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+}
+
+static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
int i;
@@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply_quirk)
for (i = 0; i < NR_RAPL_DOMAINS; i++)
rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
 
-   /*
-* DRAM domain on HSW server and KNL has fixed energy unit which can be
-* different than the unit from power unit MSR. See
-* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
-* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
-*/
-   if (apply_quirk)
-   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+   /* Apply quirk before initializing the timer rate */
+   if (model->quirk)
+   model->quirk();
 
/*
 * Calculate the timer rate:
@@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
 #define X86_RAPL_MODEL_MATCH(model, init)  \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
 
-struct intel_rapl_init_fun {
-   bool apply_quirk;
-   int cntr_mask;
-   struct attribute **attrs;
-};
-
-static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_CLN,
-   .attrs = rapl_events_cln_attr,
+static const struct intel_rapl_model_desc snb_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_CLN,
+   .attrs  = rapl_events_cln_attr,
 };
 
-static const struct intel_rapl_init_fun hsx_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc hsx_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun hsw_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_HSW,
-   .attrs = rapl_events_hsw_attr,
+static const struct intel_rapl_model_desc hsw_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_HSW,
+   .attrs  = rapl_events_hsw_attr,
 };
 
-static const struct intel_rapl_init_fun snbep_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc snbep_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun knl_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_KNL,
-   .attrs = rapl_events_knl_attr,
+static const struct intel_rapl_model_desc knl_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_KNL,
+   .attrs  = rapl_events_knl_attr,
 };
 
-static const struct intel_rapl_init_fun skl_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SKL_CLN,
-   .attrs = 

[PATCH 2/3] x86/perf/rapl: Make quirk a function pointer

2016-09-10 Thread Harry Pan
From: Thomas Gleixner 

There are more model specific quirks required. So we need to change the
single purpose boolean quirk flag to an easy extensible mechanism.

Make the quirk a function pointer and move the existing quirk into its own
function.

While at it make the init struct initializers readable and rename the
misnomed intel_rapl_hw_init_fun struct to intel_rapl_model_desc because
that's what it is a cpu model descriptor for the rapl features specific to
a particular model.

Signed-off-by: Thomas Gleixner 
Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 92 ++--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index f7924640..94abfdb 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -152,6 +152,12 @@ struct rapl_pmus {
struct rapl_pmu *pmus[];
 };
 
+struct intel_rapl_model_desc {
+   void(*quirk)(void);
+   int cntr_mask;
+   struct attribute**attrs;
+};
+
  /* 1/2^hw_unit Joule */
 static int rapl_hw_unit[NR_RAPL_DOMAINS] __read_mostly;
 static struct rapl_pmus *rapl_pmus;
@@ -617,7 +623,18 @@ static int rapl_cpu_prepare(unsigned int cpu)
return 0;
 }
 
-static int rapl_check_hw_unit(bool apply_quirk)
+static void rapl_hsx_quirk(void)
+{
+   /*
+* DRAM domain on HSW server and KNL has fixed energy unit which can be
+* different than the unit from power unit MSR. See
+* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
+* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
+*/
+   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+}
+
+static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
int i;
@@ -628,14 +645,9 @@ static int rapl_check_hw_unit(bool apply_quirk)
for (i = 0; i < NR_RAPL_DOMAINS; i++)
rapl_hw_unit[i] = (msr_rapl_power_unit_bits >> 8) & 0x1FULL;
 
-   /*
-* DRAM domain on HSW server and KNL has fixed energy unit which can be
-* different than the unit from power unit MSR. See
-* "Intel Xeon Processor E5-1600 and E5-2600 v3 Product Families, V2
-* of 2. Datasheet, September 2014, Reference Number: 330784-001 "
-*/
-   if (apply_quirk)
-   rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
+   /* Apply quirk before initializing the timer rate */
+   if (model->quirk)
+   model->quirk();
 
/*
 * Calculate the timer rate:
@@ -701,46 +713,36 @@ static int __init init_rapl_pmus(void)
 #define X86_RAPL_MODEL_MATCH(model, init)  \
{ X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) }
 
-struct intel_rapl_init_fun {
-   bool apply_quirk;
-   int cntr_mask;
-   struct attribute **attrs;
-};
-
-static const struct intel_rapl_init_fun snb_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_CLN,
-   .attrs = rapl_events_cln_attr,
+static const struct intel_rapl_model_desc snb_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_CLN,
+   .attrs  = rapl_events_cln_attr,
 };
 
-static const struct intel_rapl_init_fun hsx_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc hsx_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun hsw_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_HSW,
-   .attrs = rapl_events_hsw_attr,
+static const struct intel_rapl_model_desc hsw_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_HSW,
+   .attrs  = rapl_events_hsw_attr,
 };
 
-static const struct intel_rapl_init_fun snbep_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SRV,
-   .attrs = rapl_events_srv_attr,
+static const struct intel_rapl_model_desc snbep_rapl_init __initconst = {
+   .cntr_mask  = RAPL_IDX_SRV,
+   .attrs  = rapl_events_srv_attr,
 };
 
-static const struct intel_rapl_init_fun knl_rapl_init __initconst = {
-   .apply_quirk = true,
-   .cntr_mask = RAPL_IDX_KNL,
-   .attrs = rapl_events_knl_attr,
+static const struct intel_rapl_model_desc knl_rapl_init __initconst = {
+   .quirk  = rapl_hsx_quirk,
+   .cntr_mask  = RAPL_IDX_KNL,
+   .attrs  = rapl_events_knl_attr,
 };
 
-static const struct intel_rapl_init_fun skl_rapl_init __initconst = {
-   .apply_quirk = false,
-   .cntr_mask = RAPL_IDX_SKL_CLN,
-   .attrs = rapl_events_skl_attr,
+static const struct intel_rapl_model_desc 

[PATCH 1/3] perf/x86/rapl: Enable Apollo Lake RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Apollo Lake (Goldmont) processors (Model 92):

RAPL of Goldmont, unlikes ESU increment of Silvermont/Airmont,
it likes the Haswell microarchitecture in 1/2^ESU joules and
supports power domains in PP0/PP1/PKG/RAM.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-12.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 2886593..f7924640 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -765,6 +765,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_MOBILE,  skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
+
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
 
-- 
2.6.6



[PATCH 3/3] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 55 
 1 file changed, 55 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..a434087 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1<config
  * any other bit is reserved
@@ -136,6 +140,12 @@ static struct perf_pmu_events_attr event_attr_##v = {  
\
.event_str  = str,  
\
 };
 
+enum rapl_quirk {
+   RAPL_NO_QUIRK = 0,
+   RAPL_HSX_QUIRK,
+   RAPL_BYT_QUIRK,
+};
+
 struct rapl_pmu {
raw_spinlock_t  lock;
int n_active;
@@ -458,6 +468,14 @@ RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, 
"2.3283064365386962890
 RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, 
"2.3283064365386962890625e-10");
 RAPL_EVENT_ATTR_STR(energy-psys.scale,   rapl_psys_scale, 
"2.3283064365386962890625e-10");
 
+/*
+ * Some Atom series processors (BYT/BSW) have fixed
+ * energy status unit (ESU) in smallest unit of microjoule,
+ * and its increment is in 2^ESU microjoules.
+ */
+RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_byt_cores_scale, "1.0e-6");
+RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_byt_pkg_scale, "1.0e-6");
+
 static struct attribute *rapl_events_srv_attr[] = {
EVENT_PTR(rapl_cores),
EVENT_PTR(rapl_pkg),
@@ -539,6 +557,18 @@ static struct attribute *rapl_events_knl_attr[] = {
NULL,
 };
 
+static struct attribute *rapl_events_byt_attr[] = {
+   EVENT_PTR(rapl_cores),
+   EVENT_PTR(rapl_pkg),
+
+   EVENT_PTR(rapl_cores_unit),
+   EVENT_PTR(rapl_pkg_unit),
+
+   EVENT_PTR(rapl_byt_cores_scale),
+   EVENT_PTR(rapl_byt_pkg_scale),
+   NULL,
+};
+
 static struct attribute_group rapl_pmu_events_group = {
.name = "events",
.attrs = NULL, /* patched at runtime */
@@ -634,6 +664,23 @@ static void rapl_hsx_quirk(void)
rapl_hw_unit[RAPL_IDX_RAM_NRG_STAT] = 16;
 }
 
+static void rapl_byt_quirk(void)
+{
+   int i;
+
+   /*
+* Some Atom processors (BYT/BSW) have 2^ESU microjoules
+* increment, refer to Software Developers' Manual, Vol. 3C,
+* Order No. 325384, Table 35-8 of MSR_RAPL_POWER_UNIT.
+*
+* TODO: In order to fit BYT/BSW quirk model, here remind
+*   this generates timer rate in 80ms; by default
+*   ESU of BYT/BSW is 5, so it leads (1000/200)*2^4.
+*/
+   for (i = 0; i < NR_RAPL_DOMAINS; i++)
+   rapl_hw_unit[i] = 32 - rapl_hw_unit[i];
+}
+
 static int rapl_check_hw_unit(const struct intel_rapl_model_desc *model)
 {
u64 msr_rapl_power_unit_bits;
@@ -745,6 +792,12 @@ static const struct intel_rapl_model_desc skl_rapl_init 
__initconst = {
.attrs  = rapl_events_skl_attr,
 };
 
+static const struct intel_rapl_model_desc byt_rapl_init __initconst = {
+   .quirk  = rapl_byt_quirk,
+   .cntr_mask  = RAPL_IDX_BYT,
+   .attrs  = rapl_events_byt_attr,
+};
+
 static const struct x86_cpu_id rapl_cpu_match[] __initconst = {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE,   snb_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SANDYBRIDGE_X, snbep_rapl_init),
@@ -768,6 +821,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
 
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_SILVERMONT1, byt_rapl_init),
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_AIRMONT, byt_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
-- 
2.6.6



[PATCH 1/3] perf/x86/rapl: Enable Apollo Lake RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Apollo Lake (Goldmont) processors (Model 92):

RAPL of Goldmont, unlikes ESU increment of Silvermont/Airmont,
it likes the Haswell microarchitecture in 1/2^ESU joules and
supports power domains in PP0/PP1/PKG/RAM.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-12.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 2886593..f7924640 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -765,6 +765,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst 
= {
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_MOBILE,  skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_DESKTOP, skl_rapl_init),
X86_RAPL_MODEL_MATCH(INTEL_FAM6_SKYLAKE_X,   hsx_rapl_init),
+
+   X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT, hsw_rapl_init),
{},
 };
 
-- 
2.6.6



[PATCH 3/3] perf/x86/rapl: Enable Baytrail/Braswell RAPL support

2016-09-10 Thread Harry Pan
This patch enables RAPL counters (energy consumption counters)
support for Intel Baytrail and Braswell processors (Model 55 and 76):

The Silvermont/Airmont microarchitecture actually uses fixed
energy status unit (ESU) in smallest unit of microjoule,
this patch adds quirk for these Atom processors (BYT/BSW)
to calculate energy increment in 2^ESU microjoules.

ESU and power domains refer to Intel Software Developers' Manual,
Vol. 3C, Order No. 325384, Table 35-8.

v2: simplify setting rapl_hw_unit[] to reduce runtime overhead.

Usage example:

$ perf list
$ perf stat -a -e power/energy-cores/,power/energy-pkg/ sleep 10

This patch also enables multiple quirks.

Signed-off-by: Harry Pan 
---
 arch/x86/events/intel/rapl.c | 55 
 1 file changed, 55 insertions(+)

diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c
index 94abfdb..a434087 100644
--- a/arch/x86/events/intel/rapl.c
+++ b/arch/x86/events/intel/rapl.c
@@ -110,6 +110,10 @@ static const char *const 
rapl_domain_names[NR_RAPL_DOMAINS] __initconst = {
 #define RAPL_IDX_KNL   (1

collect2: error: ld returned 1 exit status

2016-09-10 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 2527ecc9195e9c66252af24c4689e8a67cd4ccb9 gpio: Fix OF build problem on 
UM
date:   3 weeks ago
config: um-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout 2527ecc9195e9c66252af24c4689e8a67cd4ccb9
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc7d1): warning: Using 'getgrnam' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc61c): warning: Using 'getpwuid' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc935): warning: Using 'getaddrinfo' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoaddr':
   (.text+0x1d3c5): warning: Using 'gethostbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametonetaddr':
   (.text+0x1d465): warning: Using 'getnetbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoproto':
   (.text+0x1d685): warning: Using 'getprotobyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoport':
   (.text+0x1d4b7): warning: Using 'getservbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   drivers/built-in.o: In function `fwnode_get_named_gpiod':
   drivers/gpio/gpiolib.c:3215: undefined reference to 
`of_get_named_gpiod_flags'
   drivers/built-in.o: In function `gpiod_get_index':
   drivers/gpio/gpiolib.c:3140: undefined reference to 
`of_get_named_gpiod_flags'
   drivers/built-in.o: In function `zx_gpio_probe':
   drivers/gpio/gpio-zx.c:229: undefined reference to `devm_ioremap_resource'
   `.text.exit' referenced in section `.fini_array' of 
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o): 
defined in discarded section `.text.exit' of 
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
>> collect2: error: ld returned 1 exit status

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


.config.gz
Description: Binary data


collect2: error: ld returned 1 exit status

2016-09-10 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 2527ecc9195e9c66252af24c4689e8a67cd4ccb9 gpio: Fix OF build problem on 
UM
date:   3 weeks ago
config: um-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout 2527ecc9195e9c66252af24c4689e8a67cd4ccb9
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc7d1): warning: Using 'getgrnam' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc61c): warning: Using 'getpwuid' in statically linked applications 
requires at runtime the shared libraries from the glibc version used for linking
   arch/um/drivers/built-in.o: In function `vde_open_real':
   (.text+0xc935): warning: Using 'getaddrinfo' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoaddr':
   (.text+0x1d3c5): warning: Using 'gethostbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametonetaddr':
   (.text+0x1d465): warning: Using 'getnetbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoproto':
   (.text+0x1d685): warning: Using 'getprotobyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   arch/um/drivers/built-in.o: In function `pcap_nametoport':
   (.text+0x1d4b7): warning: Using 'getservbyname' in statically linked 
applications requires at runtime the shared libraries from the glibc version 
used for linking
   drivers/built-in.o: In function `fwnode_get_named_gpiod':
   drivers/gpio/gpiolib.c:3215: undefined reference to 
`of_get_named_gpiod_flags'
   drivers/built-in.o: In function `gpiod_get_index':
   drivers/gpio/gpiolib.c:3140: undefined reference to 
`of_get_named_gpiod_flags'
   drivers/built-in.o: In function `zx_gpio_probe':
   drivers/gpio/gpio-zx.c:229: undefined reference to `devm_ioremap_resource'
   `.text.exit' referenced in section `.fini_array' of 
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o): 
defined in discarded section `.text.exit' of 
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
>> collect2: error: ld returned 1 exit status

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


.config.gz
Description: Binary data


include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type

2016-09-10 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   3 weeks ago
config: x86_64-randconfig-b0-09110627 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
>> include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^~~~
>> include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^~~
   include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
int blk_mq_register_disk(struct gendisk *);
^~~
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
void blk_mq_unregister_disk(struct gendisk *);
   ^~~
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
>> include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
>> incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^~
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
>> include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
>> request'
 return rq + 1;
 ^~
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
>> drivers/nvme/host/nvme.h:217:6: error: implicit declaration of function 
>> 'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^~
>> drivers/nvme/host/nvme.h:220:10: error: implicit declaration of function 
>> 'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
 ^~~~
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
>> drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
>> type 'struct request'
  kfree(req->completion_data);
   ^~
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
>> drivers/nvme/host/nvme.h:243:35: error: implicit declaration of function 
>> 'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
  ^~~
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
>> drivers/nvme/host/core.c:75:6: error: implicit declaration of function 
>> 'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^~~
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
>> drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
>> type 'struct gendisk'
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^~
>> drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
>> 'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^~~~
   drivers/nvme/host/core.c: In function 'nvme_requeue_req':
>> drivers/nvme/host/core.c:203:7: error: implicit declaration of function 
>> 'blk_queue_stopped' [-Werror=implicit-function-declaration]
 if (!blk_queue_stopped(req->q))
  ^
   drivers/nvme/host/core.c: In function 'nvme_alloc_request':
>> drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared 
>> (first use in this function)
 req->cmd_type = REQ_TYPE_DRV_PRIV;
 ^
   drivers/nvme/host/core.c:223:18: note: each undeclared identifier is 
reported only once for each function it appears in
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/sched.h:17,
from include/linux/blkdev.h:4,
from drivers/nvme/host/core.c:15:
   drivers/nvme/host/core.c: In function 'nvme_setup_discard':
>> drivers/nvme/host/core.c:254:46: error: implicit declaration of function 
>> 'blk_rq_pos' [-Werror=implicit-function-declaration]
 range->slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
   

include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type

2016-09-10 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: aa71987472a974f4f6dc4be377720564079ef42e nvme: fabrics drivers don't 
need the nvme-pci driver
date:   3 weeks ago
config: x86_64-randconfig-b0-09110627 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
git checkout aa71987472a974f4f6dc4be377720564079ef42e
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from drivers/nvme/host/core.c:16:0:
>> include/linux/blk-mq.h:61:18: error: field 'kobj' has incomplete type
 struct kobject  kobj;
 ^~~~
>> include/linux/blk-mq.h:128:2: error: unknown type name 'softirq_done_fn'
 softirq_done_fn  *complete;
 ^~~
   include/linux/blk-mq.h:181:33: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
int blk_mq_register_disk(struct gendisk *);
^~~
   include/linux/blk-mq.h:182:36: warning: 'struct gendisk' declared inside 
parameter list will not be visible outside of this definition or declaration
void blk_mq_unregister_disk(struct gendisk *);
   ^~~
   include/linux/blk-mq.h: In function 'blk_mq_rq_from_pdu':
>> include/linux/blk-mq.h:260:22: error: invalid application of 'sizeof' to 
>> incomplete type 'struct request'
 return pdu - sizeof(struct request);
 ^~
   include/linux/blk-mq.h: In function 'blk_mq_rq_to_pdu':
>> include/linux/blk-mq.h:264:2: error: invalid use of undefined type 'struct 
>> request'
 return rq + 1;
 ^~
   In file included from drivers/nvme/host/core.c:32:0:
   drivers/nvme/host/nvme.h: In function 'nvme_map_len':
>> drivers/nvme/host/nvme.h:217:6: error: implicit declaration of function 
>> 'req_op' [-Werror=implicit-function-declaration]
 if (req_op(rq) == REQ_OP_DISCARD)
 ^~
>> drivers/nvme/host/nvme.h:220:10: error: implicit declaration of function 
>> 'blk_rq_bytes' [-Werror=implicit-function-declaration]
  return blk_rq_bytes(rq);
 ^~~~
   drivers/nvme/host/nvme.h: In function 'nvme_cleanup_cmd':
>> drivers/nvme/host/nvme.h:226:12: error: dereferencing pointer to incomplete 
>> type 'struct request'
  kfree(req->completion_data);
   ^~
   drivers/nvme/host/nvme.h: In function 'nvme_req_needs_retry':
>> drivers/nvme/host/nvme.h:243:35: error: implicit declaration of function 
>> 'blk_noretry_request' [-Werror=implicit-function-declaration]
 return !(status & NVME_SC_DNR || blk_noretry_request(req)) &&
  ^~~
   drivers/nvme/host/core.c: In function 'nvme_cancel_request':
>> drivers/nvme/host/core.c:75:6: error: implicit declaration of function 
>> 'blk_queue_dying' [-Werror=implicit-function-declaration]
 if (blk_queue_dying(req->q))
 ^~~
   drivers/nvme/host/core.c: In function 'nvme_free_ns':
>> drivers/nvme/host/core.c:157:42: error: dereferencing pointer to incomplete 
>> type 'struct gendisk'
  nvme_nvm_unregister(ns->queue, ns->disk->disk_name);
 ^~
>> drivers/nvme/host/core.c:163:2: error: implicit declaration of function 
>> 'put_disk' [-Werror=implicit-function-declaration]
 put_disk(ns->disk);
 ^~~~
   drivers/nvme/host/core.c: In function 'nvme_requeue_req':
>> drivers/nvme/host/core.c:203:7: error: implicit declaration of function 
>> 'blk_queue_stopped' [-Werror=implicit-function-declaration]
 if (!blk_queue_stopped(req->q))
  ^
   drivers/nvme/host/core.c: In function 'nvme_alloc_request':
>> drivers/nvme/host/core.c:223:18: error: 'REQ_TYPE_DRV_PRIV' undeclared 
>> (first use in this function)
 req->cmd_type = REQ_TYPE_DRV_PRIV;
 ^
   drivers/nvme/host/core.c:223:18: note: each undeclared identifier is 
reported only once for each function it appears in
   In file included from include/linux/byteorder/little_endian.h:4:0,
from arch/x86/include/uapi/asm/byteorder.h:4,
from include/asm-generic/bitops/le.h:5,
from arch/x86/include/asm/bitops.h:504,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/sched.h:17,
from include/linux/blkdev.h:4,
from drivers/nvme/host/core.c:15:
   drivers/nvme/host/core.c: In function 'nvme_setup_discard':
>> drivers/nvme/host/core.c:254:46: error: implicit declaration of function 
>> 'blk_rq_pos' [-Werror=implicit-function-declaration]
 range->slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
   

Re: [m32r] undefined reference to `printk'

2016-09-10 Thread Fengguang Wu

Sorry m32r looks orphaned and there is no maintainer to CC
such arch related error report..

I'll stop sending old errors on m32r if no one raise concerns.

On Sun, Sep 11, 2016 at 01:10:54AM +0800, kbuild test robot wrote:

Hi Peter,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   d0acc7dfd90eb97e90ccd42a567034017ec60fb8
commit: 63a3f603413ffe82ad775f2d62a5afff87fd94a0 timeconst.pl: Eliminate Perl 
warning
date:   3 years, 7 months ago
config: m32r-allnoconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
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
   git checkout 63a3f603413ffe82ad775f2d62a5afff87fd94a0
   # save the attached .config to linux build tree
   make.cross ARCH=m32r

All errors (new ones prefixed by >>):

  arch/m32r/kernel/built-in.o: In function `default_eit_handler':

(.text+0x51c): undefined reference to `printk'

  arch/m32r/kernel/built-in.o: In function `default_eit_handler':
  (.text+0x51c): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
undefined symbol `printk'

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




___
kbuild-all mailing list
kbuild-...@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild-all




Re: [m32r] undefined reference to `printk'

2016-09-10 Thread Fengguang Wu

Sorry m32r looks orphaned and there is no maintainer to CC
such arch related error report..

I'll stop sending old errors on m32r if no one raise concerns.

On Sun, Sep 11, 2016 at 01:10:54AM +0800, kbuild test robot wrote:

Hi Peter,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   d0acc7dfd90eb97e90ccd42a567034017ec60fb8
commit: 63a3f603413ffe82ad775f2d62a5afff87fd94a0 timeconst.pl: Eliminate Perl 
warning
date:   3 years, 7 months ago
config: m32r-allnoconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
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
   git checkout 63a3f603413ffe82ad775f2d62a5afff87fd94a0
   # save the attached .config to linux build tree
   make.cross ARCH=m32r

All errors (new ones prefixed by >>):

  arch/m32r/kernel/built-in.o: In function `default_eit_handler':

(.text+0x51c): undefined reference to `printk'

  arch/m32r/kernel/built-in.o: In function `default_eit_handler':
  (.text+0x51c): relocation truncated to fit: R_M32R_26_PCREL_RELA against 
undefined symbol `printk'

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




___
kbuild-all mailing list
kbuild-...@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild-all




arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit integer (-8192-8191)

2016-09-10 Thread kbuild test robot
Hi Will,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: da48d094ce5d7c7dcdad9011648a81c42fd1c2ef Kconfig: remove 
HAVE_LATENCYTOP_SUPPORT
date:   8 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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
git checkout da48d094ce5d7c7dcdad9011648a81c42fd1c2ef
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   arch/ia64/kernel/entry.S: Assembler messages:
>> arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit 
>> integer (-8192-8191)
   arch/ia64/kernel/entry.S:728: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
   arch/ia64/kernel/entry.S:859: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
--
   arch/ia64/kernel/fsys.S: Assembler messages:
>> arch/ia64/kernel/fsys.S:67: Error: Operand 3 of `add' should be a general 
>> register r0-r3
   arch/ia64/kernel/fsys.S:97: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:193: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:336: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:338: Error: Operand 3 of `add' should be a general 
register r0-r3
--
   arch/ia64/kernel/ivt.S: Assembler messages:
>> arch/ia64/kernel/ivt.S:759: Error: Operand 3 of `add' should be a general 
>> register r0-r3

vim +621 arch/ia64/kernel/entry.S

^1da177e Linus Torvalds 2005-04-16  605 PT_REGS_UNWIND_INFO(0)
^1da177e Linus Torvalds 2005-04-16  606  {  /*
^1da177e Linus Torvalds 2005-04-16  607  * Some versions of gas 
generate bad unwind info if the first instruction of a
^1da177e Linus Torvalds 2005-04-16  608  * procedure doesn't go into 
the first slot of a bundle.  This is a workaround.
^1da177e Linus Torvalds 2005-04-16  609  */
^1da177e Linus Torvalds 2005-04-16  610 nop.m 0
^1da177e Linus Torvalds 2005-04-16  611 nop.i 0
^1da177e Linus Torvalds 2005-04-16  612 /*
^1da177e Linus Torvalds 2005-04-16  613  * We need to call 
schedule_tail() to complete the scheduling process.
^1da177e Linus Torvalds 2005-04-16  614  * Called by ia64_switch_to() 
after do_fork()->copy_thread().  r8 contains the
^1da177e Linus Torvalds 2005-04-16  615  * address of the previously 
executing task.
^1da177e Linus Torvalds 2005-04-16  616  */
^1da177e Linus Torvalds 2005-04-16  617 br.call.sptk.many 
rp=ia64_invoke_schedule_tail
^1da177e Linus Torvalds 2005-04-16  618  }
^1da177e Linus Torvalds 2005-04-16  619  .ret8:
54d496c3 Al Viro2012-10-14  620  (pKStk)br.call.sptk.many 
rp=call_payload
^1da177e Linus Torvalds 2005-04-16 @621 adds 
r2=TI_FLAGS+IA64_TASK_SIZE,r13
^1da177e Linus Torvalds 2005-04-16  622 ;;
^1da177e Linus Torvalds 2005-04-16  623 ld4 r2=[r2]
^1da177e Linus Torvalds 2005-04-16  624 ;;
^1da177e Linus Torvalds 2005-04-16  625 mov r8=0
^1da177e Linus Torvalds 2005-04-16  626 and 
r2=_TIF_SYSCALL_TRACEAUDIT,r2
^1da177e Linus Torvalds 2005-04-16  627 ;;
^1da177e Linus Torvalds 2005-04-16  628 cmp.ne p6,p0=r2,r0
^1da177e Linus Torvalds 2005-04-16  629  (p6)   br.cond.spnt 
.strace_check_retval

:: The code at line 621 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

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


.config.gz
Description: Binary data


arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit integer (-8192-8191)

2016-09-10 Thread kbuild test robot
Hi Will,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: da48d094ce5d7c7dcdad9011648a81c42fd1c2ef Kconfig: remove 
HAVE_LATENCYTOP_SUPPORT
date:   8 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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
git checkout da48d094ce5d7c7dcdad9011648a81c42fd1c2ef
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   arch/ia64/kernel/entry.S: Assembler messages:
>> arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit 
>> integer (-8192-8191)
   arch/ia64/kernel/entry.S:728: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
   arch/ia64/kernel/entry.S:859: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
--
   arch/ia64/kernel/fsys.S: Assembler messages:
>> arch/ia64/kernel/fsys.S:67: Error: Operand 3 of `add' should be a general 
>> register r0-r3
   arch/ia64/kernel/fsys.S:97: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:193: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:336: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:338: Error: Operand 3 of `add' should be a general 
register r0-r3
--
   arch/ia64/kernel/ivt.S: Assembler messages:
>> arch/ia64/kernel/ivt.S:759: Error: Operand 3 of `add' should be a general 
>> register r0-r3

vim +621 arch/ia64/kernel/entry.S

^1da177e Linus Torvalds 2005-04-16  605 PT_REGS_UNWIND_INFO(0)
^1da177e Linus Torvalds 2005-04-16  606  {  /*
^1da177e Linus Torvalds 2005-04-16  607  * Some versions of gas 
generate bad unwind info if the first instruction of a
^1da177e Linus Torvalds 2005-04-16  608  * procedure doesn't go into 
the first slot of a bundle.  This is a workaround.
^1da177e Linus Torvalds 2005-04-16  609  */
^1da177e Linus Torvalds 2005-04-16  610 nop.m 0
^1da177e Linus Torvalds 2005-04-16  611 nop.i 0
^1da177e Linus Torvalds 2005-04-16  612 /*
^1da177e Linus Torvalds 2005-04-16  613  * We need to call 
schedule_tail() to complete the scheduling process.
^1da177e Linus Torvalds 2005-04-16  614  * Called by ia64_switch_to() 
after do_fork()->copy_thread().  r8 contains the
^1da177e Linus Torvalds 2005-04-16  615  * address of the previously 
executing task.
^1da177e Linus Torvalds 2005-04-16  616  */
^1da177e Linus Torvalds 2005-04-16  617 br.call.sptk.many 
rp=ia64_invoke_schedule_tail
^1da177e Linus Torvalds 2005-04-16  618  }
^1da177e Linus Torvalds 2005-04-16  619  .ret8:
54d496c3 Al Viro2012-10-14  620  (pKStk)br.call.sptk.many 
rp=call_payload
^1da177e Linus Torvalds 2005-04-16 @621 adds 
r2=TI_FLAGS+IA64_TASK_SIZE,r13
^1da177e Linus Torvalds 2005-04-16  622 ;;
^1da177e Linus Torvalds 2005-04-16  623 ld4 r2=[r2]
^1da177e Linus Torvalds 2005-04-16  624 ;;
^1da177e Linus Torvalds 2005-04-16  625 mov r8=0
^1da177e Linus Torvalds 2005-04-16  626 and 
r2=_TIF_SYSCALL_TRACEAUDIT,r2
^1da177e Linus Torvalds 2005-04-16  627 ;;
^1da177e Linus Torvalds 2005-04-16  628 cmp.ne p6,p0=r2,r0
^1da177e Linus Torvalds 2005-04-16  629  (p6)   br.cond.spnt 
.strace_check_retval

:: The code at line 621 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

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


.config.gz
Description: Binary data


Re: serial: earlycon: Extend earlycon command line option to support 64-bit addresses

2016-09-10 Thread Guenter Roeck
Hi,

On Fri, Sep 02, 2016 at 01:20:21PM +0200, Alexander Sverdlin wrote:
> earlycon implementation used "unsigned long" internally, but there are systems
> (ARM with LPAE) where sizeof(unsigned long) == 4 and uart is mapped beyond 
> 4GiB
> address range.
> 
> Switch to resource_size_t internally and replace obsoleted simple_strtoul() 
> with
> kstrtoull().
> 

This patch breaks a qemu emulation using
console=uart,mmio,0x9000,115200
as command line argument. Problem appears to be the replacement of
simple_strtoul() with kstrtoull(). It looks like simple_strtoul() parsed
the address, but kstrtoull() doesn't. Reverting the kstrtoull() back to
simple_strtoul() fixes the problem for me.

The command line in question is found in arch/openrisc/boot/dts/or1ksim.dts.
There are similar command lines in other dts files, which makes me suspect
that this construct is also used by out-of-kernel command lines. Besides, the
code looks for ',' after the address, which suggests that the above should be
a valid argument.

Is this change to kstrtoull really necessary ? If yes, can you make it work
with existing command lines ?

Thanks,
Guenter

> Signed-off-by: Alexander Sverdlin 
> ---
>  drivers/tty/serial/8250/8250_core.c |  2 +-
>  drivers/tty/serial/earlycon.c   |  7 +++
>  drivers/tty/serial/serial_core.c| 12 +---
>  include/linux/serial_core.h |  2 +-
>  4 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c 
> b/drivers/tty/serial/8250/8250_core.c
> index 13ad5c3..f64d6cd 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -639,7 +639,7 @@ static int univ8250_console_match(struct console *co, 
> char *name, int idx,
>  {
>   char match[] = "uart";  /* 8250-specific earlycon name */
>   unsigned char iotype;
> - unsigned long addr;
> + resource_size_t addr;
>   int i;
>  
>   if (strncmp(name, match, 4) != 0)
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index 067783f..3940280 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -38,7 +38,7 @@ static struct earlycon_device early_console_dev = {
>   .con = _con,
>  };
>  
> -static void __iomem * __init earlycon_map(unsigned long paddr, size_t size)
> +static void __iomem * __init earlycon_map(resource_size_t paddr, size_t size)
>  {
>   void __iomem *base;
>  #ifdef CONFIG_FIX_EARLYCON_MEM
> @@ -49,8 +49,7 @@ static void __iomem * __init earlycon_map(unsigned long 
> paddr, size_t size)
>   base = ioremap(paddr, size);
>  #endif
>   if (!base)
> - pr_err("%s: Couldn't map 0x%llx\n", __func__,
> -(unsigned long long)paddr);
> + pr_err("%s: Couldn't map %pa\n", __func__, );
>  
>   return base;
>  }
> @@ -92,7 +91,7 @@ static int __init parse_options(struct earlycon_device 
> *device, char *options)
>  {
>   struct uart_port *port = >port;
>   int length;
> - unsigned long addr;
> + resource_size_t addr;
>  
>   if (uart_parse_earlycon(options, >iotype, , ))
>   return -EINVAL;
> diff --git a/drivers/tty/serial/serial_core.c 
> b/drivers/tty/serial/serial_core.c
> index 9fc1533..89f5d6a 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1938,11 +1938,14 @@ uart_get_console(struct uart_port *ports, int nr, 
> struct console *co)
>   *  console=,0x,
>   *   is also accepted; the returned @iotype will be UPIO_MEM.
>   *
> - *   Returns 0 on success or -EINVAL on failure
> + *   Returns 0 on success, -EINVAL or -ERANGE on failure
>   */
> -int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
> +int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t 
> *addr,
>   char **options)
>  {
> + int ret;
> + unsigned long long tmp;
> +
>   if (strncmp(p, "mmio,", 5) == 0) {
>   *iotype = UPIO_MEM;
>   p += 5;
> @@ -1968,7 +1971,10 @@ int uart_parse_earlycon(char *p, unsigned char 
> *iotype, unsigned long *addr,
>   return -EINVAL;
>   }
>  
> - *addr = simple_strtoul(p, NULL, 0);
> + ret = kstrtoull(p, 0, );
> + if (ret)
> + return ret;
> + *addr = tmp;
>   p = strchr(p, ',');
>   if (p)
>   p++;
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 2f44e20..cdba6f1 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -374,7 +374,7 @@ extern int of_setup_earlycon(const struct earlycon_id 
> *match,
>  
>  struct uart_port *uart_get_console(struct uart_port *ports, int nr,
>  struct console *c);
> -int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
> +int uart_parse_earlycon(char *p, unsigned char *iotype, 

Re: serial: earlycon: Extend earlycon command line option to support 64-bit addresses

2016-09-10 Thread Guenter Roeck
Hi,

On Fri, Sep 02, 2016 at 01:20:21PM +0200, Alexander Sverdlin wrote:
> earlycon implementation used "unsigned long" internally, but there are systems
> (ARM with LPAE) where sizeof(unsigned long) == 4 and uart is mapped beyond 
> 4GiB
> address range.
> 
> Switch to resource_size_t internally and replace obsoleted simple_strtoul() 
> with
> kstrtoull().
> 

This patch breaks a qemu emulation using
console=uart,mmio,0x9000,115200
as command line argument. Problem appears to be the replacement of
simple_strtoul() with kstrtoull(). It looks like simple_strtoul() parsed
the address, but kstrtoull() doesn't. Reverting the kstrtoull() back to
simple_strtoul() fixes the problem for me.

The command line in question is found in arch/openrisc/boot/dts/or1ksim.dts.
There are similar command lines in other dts files, which makes me suspect
that this construct is also used by out-of-kernel command lines. Besides, the
code looks for ',' after the address, which suggests that the above should be
a valid argument.

Is this change to kstrtoull really necessary ? If yes, can you make it work
with existing command lines ?

Thanks,
Guenter

> Signed-off-by: Alexander Sverdlin 
> ---
>  drivers/tty/serial/8250/8250_core.c |  2 +-
>  drivers/tty/serial/earlycon.c   |  7 +++
>  drivers/tty/serial/serial_core.c| 12 +---
>  include/linux/serial_core.h |  2 +-
>  4 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_core.c 
> b/drivers/tty/serial/8250/8250_core.c
> index 13ad5c3..f64d6cd 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -639,7 +639,7 @@ static int univ8250_console_match(struct console *co, 
> char *name, int idx,
>  {
>   char match[] = "uart";  /* 8250-specific earlycon name */
>   unsigned char iotype;
> - unsigned long addr;
> + resource_size_t addr;
>   int i;
>  
>   if (strncmp(name, match, 4) != 0)
> diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
> index 067783f..3940280 100644
> --- a/drivers/tty/serial/earlycon.c
> +++ b/drivers/tty/serial/earlycon.c
> @@ -38,7 +38,7 @@ static struct earlycon_device early_console_dev = {
>   .con = _con,
>  };
>  
> -static void __iomem * __init earlycon_map(unsigned long paddr, size_t size)
> +static void __iomem * __init earlycon_map(resource_size_t paddr, size_t size)
>  {
>   void __iomem *base;
>  #ifdef CONFIG_FIX_EARLYCON_MEM
> @@ -49,8 +49,7 @@ static void __iomem * __init earlycon_map(unsigned long 
> paddr, size_t size)
>   base = ioremap(paddr, size);
>  #endif
>   if (!base)
> - pr_err("%s: Couldn't map 0x%llx\n", __func__,
> -(unsigned long long)paddr);
> + pr_err("%s: Couldn't map %pa\n", __func__, );
>  
>   return base;
>  }
> @@ -92,7 +91,7 @@ static int __init parse_options(struct earlycon_device 
> *device, char *options)
>  {
>   struct uart_port *port = >port;
>   int length;
> - unsigned long addr;
> + resource_size_t addr;
>  
>   if (uart_parse_earlycon(options, >iotype, , ))
>   return -EINVAL;
> diff --git a/drivers/tty/serial/serial_core.c 
> b/drivers/tty/serial/serial_core.c
> index 9fc1533..89f5d6a 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1938,11 +1938,14 @@ uart_get_console(struct uart_port *ports, int nr, 
> struct console *co)
>   *  console=,0x,
>   *   is also accepted; the returned @iotype will be UPIO_MEM.
>   *
> - *   Returns 0 on success or -EINVAL on failure
> + *   Returns 0 on success, -EINVAL or -ERANGE on failure
>   */
> -int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
> +int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t 
> *addr,
>   char **options)
>  {
> + int ret;
> + unsigned long long tmp;
> +
>   if (strncmp(p, "mmio,", 5) == 0) {
>   *iotype = UPIO_MEM;
>   p += 5;
> @@ -1968,7 +1971,10 @@ int uart_parse_earlycon(char *p, unsigned char 
> *iotype, unsigned long *addr,
>   return -EINVAL;
>   }
>  
> - *addr = simple_strtoul(p, NULL, 0);
> + ret = kstrtoull(p, 0, );
> + if (ret)
> + return ret;
> + *addr = tmp;
>   p = strchr(p, ',');
>   if (p)
>   p++;
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 2f44e20..cdba6f1 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -374,7 +374,7 @@ extern int of_setup_earlycon(const struct earlycon_id 
> *match,
>  
>  struct uart_port *uart_get_console(struct uart_port *ports, int nr,
>  struct console *c);
> -int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr,
> +int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t 
> *addr,
>

include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct kprobe_ctlblk'

2016-09-10 Thread kbuild test robot
Hi Christoph,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: abec1a806e0c3cf168999667d5fb6218398ef12a percpu: Make __verify_pcu_ptr 
handle per cpu pointers to arrays
date:   3 years, 1 month ago
config: mn10300-allmodconfig (attached as .config)
compiler: am33_2.0-linux-gcc (GCC) 4.9.0
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
git checkout abec1a806e0c3cf168999667d5fb6218398ef12a
# save the attached .config to linux build tree
make.cross ARCH=mn10300 

All errors (new ones prefixed by >>):

   In file included from net/dccp/probe.c:26:0:
   include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct 
>> kprobe_ctlblk'
 return (&__get_cpu_var(kprobe_ctlblk));
 ^
   In file included from arch/mn10300/include/asm/percpu.h:1:0,
from include/linux/percpu.h:10,
from include/linux/kprobes.h:38,
from net/dccp/probe.c:26:
   include/asm-generic/percpu.h:83:29: error: dereferencing pointer to 
incomplete type
#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
^
   include/linux/kprobes.h:332:11: note: in expansion of macro '__get_cpu_var'
 return (&__get_cpu_var(kprobe_ctlblk));
  ^

vim +332 include/linux/kprobes.h

ef53d9c5e Srinivasa D S  2008-07-25  316  void 
kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags);
b94cce926 Hien Nguyen2005-06-23  317  struct hlist_head * 
kretprobe_inst_table_head(struct task_struct *tsk);
^1da177e4 Linus Torvalds 2005-04-16  318  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  319  /* kprobe_running() will 
just return the current_kprobe on this CPU */
e65845235 Ananth N Mavinakayanahalli 2005-11-07  320  static inline struct 
kprobe *kprobe_running(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  321  {
b76834bc1 Christoph Lameter  2010-12-06  322return 
(__this_cpu_read(current_kprobe));
e65845235 Ananth N Mavinakayanahalli 2005-11-07  323  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  324  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  325  static inline void 
reset_current_kprobe(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  326  {
b76834bc1 Christoph Lameter  2010-12-06  327
__this_cpu_write(current_kprobe, NULL);
e65845235 Ananth N Mavinakayanahalli 2005-11-07  328  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  329  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  330  static inline struct 
kprobe_ctlblk *get_kprobe_ctlblk(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  331  {
e65845235 Ananth N Mavinakayanahalli 2005-11-07 @332return 
(&__get_cpu_var(kprobe_ctlblk));
e65845235 Ananth N Mavinakayanahalli 2005-11-07  333  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  334  
^1da177e4 Linus Torvalds 2005-04-16  335  int 
register_kprobe(struct kprobe *p);
^1da177e4 Linus Torvalds 2005-04-16  336  void 
unregister_kprobe(struct kprobe *p);
9861668f7 Masami Hiramatsu   2008-04-28  337  int 
register_kprobes(struct kprobe **kps, int num);
9861668f7 Masami Hiramatsu   2008-04-28  338  void 
unregister_kprobes(struct kprobe **kps, int num);
^1da177e4 Linus Torvalds 2005-04-16  339  int 
setjmp_pre_handler(struct kprobe *, struct pt_regs *);
^1da177e4 Linus Torvalds 2005-04-16  340  int 
longjmp_break_handler(struct kprobe *, struct pt_regs *);

:: The code at line 332 was first introduced by commit
:: e65845235c8120be63001fc1a4ac00c819194bbe [PATCH] Kprobes: Track kprobe 
on a per_cpu basis - base changes

:: TO: Ananth N Mavinakayanahalli 
:: CC: Linus Torvalds 

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


.config.gz
Description: Binary data


include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct kprobe_ctlblk'

2016-09-10 Thread kbuild test robot
Hi Christoph,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: abec1a806e0c3cf168999667d5fb6218398ef12a percpu: Make __verify_pcu_ptr 
handle per cpu pointers to arrays
date:   3 years, 1 month ago
config: mn10300-allmodconfig (attached as .config)
compiler: am33_2.0-linux-gcc (GCC) 4.9.0
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
git checkout abec1a806e0c3cf168999667d5fb6218398ef12a
# save the attached .config to linux build tree
make.cross ARCH=mn10300 

All errors (new ones prefixed by >>):

   In file included from net/dccp/probe.c:26:0:
   include/linux/kprobes.h: In function 'get_kprobe_ctlblk':
>> include/linux/kprobes.h:332:2: error: invalid use of undefined type 'struct 
>> kprobe_ctlblk'
 return (&__get_cpu_var(kprobe_ctlblk));
 ^
   In file included from arch/mn10300/include/asm/percpu.h:1:0,
from include/linux/percpu.h:10,
from include/linux/kprobes.h:38,
from net/dccp/probe.c:26:
   include/asm-generic/percpu.h:83:29: error: dereferencing pointer to 
incomplete type
#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
^
   include/linux/kprobes.h:332:11: note: in expansion of macro '__get_cpu_var'
 return (&__get_cpu_var(kprobe_ctlblk));
  ^

vim +332 include/linux/kprobes.h

ef53d9c5e Srinivasa D S  2008-07-25  316  void 
kretprobe_hash_unlock(struct task_struct *tsk, unsigned long *flags);
b94cce926 Hien Nguyen2005-06-23  317  struct hlist_head * 
kretprobe_inst_table_head(struct task_struct *tsk);
^1da177e4 Linus Torvalds 2005-04-16  318  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  319  /* kprobe_running() will 
just return the current_kprobe on this CPU */
e65845235 Ananth N Mavinakayanahalli 2005-11-07  320  static inline struct 
kprobe *kprobe_running(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  321  {
b76834bc1 Christoph Lameter  2010-12-06  322return 
(__this_cpu_read(current_kprobe));
e65845235 Ananth N Mavinakayanahalli 2005-11-07  323  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  324  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  325  static inline void 
reset_current_kprobe(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  326  {
b76834bc1 Christoph Lameter  2010-12-06  327
__this_cpu_write(current_kprobe, NULL);
e65845235 Ananth N Mavinakayanahalli 2005-11-07  328  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  329  
e65845235 Ananth N Mavinakayanahalli 2005-11-07  330  static inline struct 
kprobe_ctlblk *get_kprobe_ctlblk(void)
e65845235 Ananth N Mavinakayanahalli 2005-11-07  331  {
e65845235 Ananth N Mavinakayanahalli 2005-11-07 @332return 
(&__get_cpu_var(kprobe_ctlblk));
e65845235 Ananth N Mavinakayanahalli 2005-11-07  333  }
e65845235 Ananth N Mavinakayanahalli 2005-11-07  334  
^1da177e4 Linus Torvalds 2005-04-16  335  int 
register_kprobe(struct kprobe *p);
^1da177e4 Linus Torvalds 2005-04-16  336  void 
unregister_kprobe(struct kprobe *p);
9861668f7 Masami Hiramatsu   2008-04-28  337  int 
register_kprobes(struct kprobe **kps, int num);
9861668f7 Masami Hiramatsu   2008-04-28  338  void 
unregister_kprobes(struct kprobe **kps, int num);
^1da177e4 Linus Torvalds 2005-04-16  339  int 
setjmp_pre_handler(struct kprobe *, struct pt_regs *);
^1da177e4 Linus Torvalds 2005-04-16  340  int 
longjmp_break_handler(struct kprobe *, struct pt_regs *);

:: The code at line 332 was first introduced by commit
:: e65845235c8120be63001fc1a4ac00c819194bbe [PATCH] Kprobes: Track kprobe 
on a per_cpu basis - base changes

:: TO: Ananth N Mavinakayanahalli 
:: CC: Linus Torvalds 

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


.config.gz
Description: Binary data


RE: [PATCH v2 2/9] ext2: tell DAX the size of allocation holes

2016-09-10 Thread Matthew Wilcox
From: Theodore Ts'o [mailto:ty...@mit.edu]
> On Sat, Sep 10, 2016 at 12:31:51AM -0700, Christoph Hellwig wrote:
> > I've mentioned this before, but I'd like to repeat it.  With all the
> > work reqwuired in the file system I would prefer to drop DAX support
> > in ext2 (and if people really cry for it reinstate the trivial old xip
> > support).
> 
> Why is so much work required to support the new DAX interfaces in
> ext2?  Is that unique to ext2, or is adding DAX support just going to
> be painful for all file systems?  Hopefully it's not the latter,
> right?

It's always been my goal to make supporting DAX as easy as possible
for the filesystem.  Hence the sharing of the DIO locking, and the (it
turned out) premature reliance on helper functions.  It's more complex
than I wanted it to be right now, and I hope we get to simplify it again.



RE: [PATCH v2 2/9] ext2: tell DAX the size of allocation holes

2016-09-10 Thread Matthew Wilcox
From: Theodore Ts'o [mailto:ty...@mit.edu]
> On Sat, Sep 10, 2016 at 12:31:51AM -0700, Christoph Hellwig wrote:
> > I've mentioned this before, but I'd like to repeat it.  With all the
> > work reqwuired in the file system I would prefer to drop DAX support
> > in ext2 (and if people really cry for it reinstate the trivial old xip
> > support).
> 
> Why is so much work required to support the new DAX interfaces in
> ext2?  Is that unique to ext2, or is adding DAX support just going to
> be painful for all file systems?  Hopefully it's not the latter,
> right?

It's always been my goal to make supporting DAX as easy as possible
for the filesystem.  Hence the sharing of the DIO locking, and the (it
turned out) premature reliance on helper functions.  It's more complex
than I wanted it to be right now, and I hope we get to simplify it again.



Re: [PATCH v6 2/8] thunderbolt: Updating the register definitions

2016-09-10 Thread Andreas Noever
On Mon, Aug 1, 2016 at 2:23 PM, Amir Levy  wrote:
> Adding more Thunderbolt(TM) register definitions
> and some helper macros.

Thinking about this again I would prefer it if you would put your
definitions into a separate file under icm/ (even if there is some
duplication). The style (bitfields vs. genmask) is different between
the drivers and for a reader it is difficult to find out what is
actually supposed to be used by the two drivers (ring_desc vs
tbt_buf_desc or the ring RING_INT_EN/DISABLE macros in the header file
vs. ring_interrupt_active in nhi.c).

This would also completely separate the two drivers.

Andreas


> Signed-off-by: Amir Levy 
> ---
>  drivers/thunderbolt/nhi_regs.h | 109 
> +
>  1 file changed, 109 insertions(+)
>
> diff --git a/drivers/thunderbolt/nhi_regs.h b/drivers/thunderbolt/nhi_regs.h
> index 75cf069..b8e961f 100644
> --- a/drivers/thunderbolt/nhi_regs.h
> +++ b/drivers/thunderbolt/nhi_regs.h
> @@ -9,6 +9,11 @@
>
>  #include 
>
> +#define NHI_MMIO_BAR 0
> +
> +#define TBT_RING_MIN_NUM_BUFFERS   2
> +#define TBT_RING_MAX_FRAME_SIZE(4 * 1024)
> +
>  enum ring_flags {
> RING_FLAG_ISOCH_ENABLE = 1 << 27, /* TX only? */
> RING_FLAG_E2E_FLOW_CONTROL = 1 << 28,
> @@ -39,6 +44,33 @@ struct ring_desc {
> u32 time; /* write zero */
>  } __packed;
>
> +/**
> + * struct tbt_buf_desc - TX/RX ring buffer descriptor.
> + * This is same as struct ring_desc, but without the use of bitfields and
> + * with explicit endianity.
> + */
> +struct tbt_buf_desc {
> +   __le64 phys;
> +   __le32 attributes;
> +   __le32 time;
> +};
> +
> +#define DESC_ATTR_LEN_SHIFT0
> +#define DESC_ATTR_LEN_MASK GENMASK(11, DESC_ATTR_LEN_SHIFT)
> +#define DESC_ATTR_EOF_SHIFT12
> +#define DESC_ATTR_EOF_MASK GENMASK(15, DESC_ATTR_EOF_SHIFT)
> +#define DESC_ATTR_SOF_SHIFT16
> +#define DESC_ATTR_SOF_MASK GENMASK(19, DESC_ATTR_SOF_SHIFT)
> +#define DESC_ATTR_TX_ISOCH_DMA_EN  BIT(20) /* TX */
> +#define DESC_ATTR_RX_CRC_ERR   BIT(20) /* RX after use */
> +#define DESC_ATTR_DESC_DONEBIT(21)
> +#define DESC_ATTR_REQ_STS  BIT(22) /* TX and RX before use */
> +#define DESC_ATTR_RX_BUF_OVRN_ERR  BIT(22) /* RX after use */
> +#define DESC_ATTR_INT_EN   BIT(23)
> +#define DESC_ATTR_OFFSET_SHIFT 24
> +#define DESC_ATTR_OFFSET_MASK  GENMASK(31, DESC_ATTR_OFFSET_SHIFT)
> +
> +
>  /* NHI registers in bar 0 */
>
>  /*
> @@ -60,6 +92,30 @@ struct ring_desc {
>   */
>  #define REG_RX_RING_BASE   0x08000
>
> +#define REG_RING_STEP  16
> +#define REG_RING_PHYS_LO_OFFSET0
> +#define REG_RING_PHYS_HI_OFFSET4
> +#define REG_RING_CONS_PROD_OFFSET  8   /* cons - RO, prod - RW */
> +#define REG_RING_CONS_SHIFT0
> +#define REG_RING_CONS_MASK GENMASK(15, REG_RING_CONS_SHIFT)
> +#define REG_RING_PROD_SHIFT16
> +#define REG_RING_PROD_MASK GENMASK(31, REG_RING_PROD_SHIFT)
> +#define REG_RING_SIZE_OFFSET   12
> +#define REG_RING_SIZE_SHIFT0
> +#define REG_RING_SIZE_MASK GENMASK(15, REG_RING_SIZE_SHIFT)
> +#define REG_RING_BUF_SIZE_SHIFT16
> +#define REG_RING_BUF_SIZE_MASK GENMASK(27, REG_RING_BUF_SIZE_SHIFT)
> +
> +#define TBT_RING_CONS_PROD_REG(iobase, ringbase, ringnumber) \
> + ((iobase) + (ringbase) + \
> + ((ringnumber) * REG_RING_STEP) + \
> + REG_RING_CONS_PROD_OFFSET)
> +
> +#define TBT_REG_RING_PROD_EXTRACT(val) (((val) & REG_RING_PROD_MASK) >> \
> +  REG_RING_PROD_SHIFT)
> +
> +#define TBT_REG_RING_CONS_EXTRACT(val) (((val) & REG_RING_CONS_MASK) >> \
> +  REG_RING_CONS_SHIFT)
>  /*
>   * 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
>   * 00: enum_ring_flags
> @@ -77,6 +133,19 @@ struct ring_desc {
>   * ..: unknown
>   */
>  #define REG_RX_OPTIONS_BASE0x29800
> +#define REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT12
> +#define REG_RX_OPTS_TX_E2E_HOP_ID_MASK \
> +   GENMASK(22, REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT)
> +#define REG_RX_OPTS_MASK_OFFSET4
> +#define REG_RX_OPTS_MASK_EOF_SHIFT 0
> +#define REG_RX_OPTS_MASK_EOF_MASK  GENMASK(15, 
> REG_RX_OPTS_MASK_EOF_SHIFT)
> +#define REG_RX_OPTS_MASK_SOF_SHIFT 16
> +#define REG_RX_OPTS_MASK_SOF_MASK  GENMASK(31, 
> REG_RX_OPTS_MASK_SOF_SHIFT)
> +
> +#define REG_OPTS_STEP  32
> +#define REG_OPTS_E2E_ENBIT(28)
> +#define REG_OPTS_RAW   BIT(30)
> +#define REG_OPTS_VALID BIT(31)
>
>  /*
>   * three bitfields: tx, rx, rx overflow
> @@ -86,6 +155,7 @@ struct 

Re: [PATCH v6 2/8] thunderbolt: Updating the register definitions

2016-09-10 Thread Andreas Noever
On Mon, Aug 1, 2016 at 2:23 PM, Amir Levy  wrote:
> Adding more Thunderbolt(TM) register definitions
> and some helper macros.

Thinking about this again I would prefer it if you would put your
definitions into a separate file under icm/ (even if there is some
duplication). The style (bitfields vs. genmask) is different between
the drivers and for a reader it is difficult to find out what is
actually supposed to be used by the two drivers (ring_desc vs
tbt_buf_desc or the ring RING_INT_EN/DISABLE macros in the header file
vs. ring_interrupt_active in nhi.c).

This would also completely separate the two drivers.

Andreas


> Signed-off-by: Amir Levy 
> ---
>  drivers/thunderbolt/nhi_regs.h | 109 
> +
>  1 file changed, 109 insertions(+)
>
> diff --git a/drivers/thunderbolt/nhi_regs.h b/drivers/thunderbolt/nhi_regs.h
> index 75cf069..b8e961f 100644
> --- a/drivers/thunderbolt/nhi_regs.h
> +++ b/drivers/thunderbolt/nhi_regs.h
> @@ -9,6 +9,11 @@
>
>  #include 
>
> +#define NHI_MMIO_BAR 0
> +
> +#define TBT_RING_MIN_NUM_BUFFERS   2
> +#define TBT_RING_MAX_FRAME_SIZE(4 * 1024)
> +
>  enum ring_flags {
> RING_FLAG_ISOCH_ENABLE = 1 << 27, /* TX only? */
> RING_FLAG_E2E_FLOW_CONTROL = 1 << 28,
> @@ -39,6 +44,33 @@ struct ring_desc {
> u32 time; /* write zero */
>  } __packed;
>
> +/**
> + * struct tbt_buf_desc - TX/RX ring buffer descriptor.
> + * This is same as struct ring_desc, but without the use of bitfields and
> + * with explicit endianity.
> + */
> +struct tbt_buf_desc {
> +   __le64 phys;
> +   __le32 attributes;
> +   __le32 time;
> +};
> +
> +#define DESC_ATTR_LEN_SHIFT0
> +#define DESC_ATTR_LEN_MASK GENMASK(11, DESC_ATTR_LEN_SHIFT)
> +#define DESC_ATTR_EOF_SHIFT12
> +#define DESC_ATTR_EOF_MASK GENMASK(15, DESC_ATTR_EOF_SHIFT)
> +#define DESC_ATTR_SOF_SHIFT16
> +#define DESC_ATTR_SOF_MASK GENMASK(19, DESC_ATTR_SOF_SHIFT)
> +#define DESC_ATTR_TX_ISOCH_DMA_EN  BIT(20) /* TX */
> +#define DESC_ATTR_RX_CRC_ERR   BIT(20) /* RX after use */
> +#define DESC_ATTR_DESC_DONEBIT(21)
> +#define DESC_ATTR_REQ_STS  BIT(22) /* TX and RX before use */
> +#define DESC_ATTR_RX_BUF_OVRN_ERR  BIT(22) /* RX after use */
> +#define DESC_ATTR_INT_EN   BIT(23)
> +#define DESC_ATTR_OFFSET_SHIFT 24
> +#define DESC_ATTR_OFFSET_MASK  GENMASK(31, DESC_ATTR_OFFSET_SHIFT)
> +
> +
>  /* NHI registers in bar 0 */
>
>  /*
> @@ -60,6 +92,30 @@ struct ring_desc {
>   */
>  #define REG_RX_RING_BASE   0x08000
>
> +#define REG_RING_STEP  16
> +#define REG_RING_PHYS_LO_OFFSET0
> +#define REG_RING_PHYS_HI_OFFSET4
> +#define REG_RING_CONS_PROD_OFFSET  8   /* cons - RO, prod - RW */
> +#define REG_RING_CONS_SHIFT0
> +#define REG_RING_CONS_MASK GENMASK(15, REG_RING_CONS_SHIFT)
> +#define REG_RING_PROD_SHIFT16
> +#define REG_RING_PROD_MASK GENMASK(31, REG_RING_PROD_SHIFT)
> +#define REG_RING_SIZE_OFFSET   12
> +#define REG_RING_SIZE_SHIFT0
> +#define REG_RING_SIZE_MASK GENMASK(15, REG_RING_SIZE_SHIFT)
> +#define REG_RING_BUF_SIZE_SHIFT16
> +#define REG_RING_BUF_SIZE_MASK GENMASK(27, REG_RING_BUF_SIZE_SHIFT)
> +
> +#define TBT_RING_CONS_PROD_REG(iobase, ringbase, ringnumber) \
> + ((iobase) + (ringbase) + \
> + ((ringnumber) * REG_RING_STEP) + \
> + REG_RING_CONS_PROD_OFFSET)
> +
> +#define TBT_REG_RING_PROD_EXTRACT(val) (((val) & REG_RING_PROD_MASK) >> \
> +  REG_RING_PROD_SHIFT)
> +
> +#define TBT_REG_RING_CONS_EXTRACT(val) (((val) & REG_RING_CONS_MASK) >> \
> +  REG_RING_CONS_SHIFT)
>  /*
>   * 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
>   * 00: enum_ring_flags
> @@ -77,6 +133,19 @@ struct ring_desc {
>   * ..: unknown
>   */
>  #define REG_RX_OPTIONS_BASE0x29800
> +#define REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT12
> +#define REG_RX_OPTS_TX_E2E_HOP_ID_MASK \
> +   GENMASK(22, REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT)
> +#define REG_RX_OPTS_MASK_OFFSET4
> +#define REG_RX_OPTS_MASK_EOF_SHIFT 0
> +#define REG_RX_OPTS_MASK_EOF_MASK  GENMASK(15, 
> REG_RX_OPTS_MASK_EOF_SHIFT)
> +#define REG_RX_OPTS_MASK_SOF_SHIFT 16
> +#define REG_RX_OPTS_MASK_SOF_MASK  GENMASK(31, 
> REG_RX_OPTS_MASK_SOF_SHIFT)
> +
> +#define REG_OPTS_STEP  32
> +#define REG_OPTS_E2E_ENBIT(28)
> +#define REG_OPTS_RAW   BIT(30)
> +#define REG_OPTS_VALID BIT(31)
>
>  /*
>   * three bitfields: tx, rx, rx overflow
> @@ -86,6 +155,7 @@ struct ring_desc {
>   */
>  #define REG_RING_NOTIFY_BASE   

include/linux/unaligned/access_ok.h:7:19: error: redefinition of 'get_unaligned_le16'

2016-09-10 Thread kbuild test robot
Hi Vincent,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 3194c6870158e305dac2af52f83681e9cb67280f NFC: nfcmrvl: add firmware 
download support
date:   11 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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
git checkout 3194c6870158e305dac2af52f83681e9cb67280f
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:7:19: error: redefinition of 
>> 'get_unaligned_le16'
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:6:19: note: previous definition of 
'get_unaligned_le16' was here
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:12:19: error: redefinition of 
>> 'get_unaligned_le32'
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:11:19: note: previous definition of 
'get_unaligned_le32' was here
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:17:19: error: redefinition of 
>> 'get_unaligned_le64'
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:16:19: note: previous definition of 
'get_unaligned_le64' was here
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:22:19: error: redefinition of 
>> 'get_unaligned_be16'
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/be_byteshift.h:40:19: note: previous definition of 
'get_unaligned_be16' was here
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:27:19: error: redefinition of 
>> 'get_unaligned_be32'
static inline u32 get_unaligned_be32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
   

include/linux/unaligned/access_ok.h:7:19: error: redefinition of 'get_unaligned_le16'

2016-09-10 Thread kbuild test robot
Hi Vincent,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   98ac9a608dc79ba8a20cee77fe959a6dfccdaa63
commit: 3194c6870158e305dac2af52f83681e9cb67280f NFC: nfcmrvl: add firmware 
download support
date:   11 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
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
git checkout 3194c6870158e305dac2af52f83681e9cb67280f
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:7:19: error: redefinition of 
>> 'get_unaligned_le16'
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:6:19: note: previous definition of 
'get_unaligned_le16' was here
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:12:19: error: redefinition of 
>> 'get_unaligned_le32'
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:11:19: note: previous definition of 
'get_unaligned_le32' was here
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:17:19: error: redefinition of 
>> 'get_unaligned_le64'
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:16:19: note: previous definition of 
'get_unaligned_le64' was here
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:22:19: error: redefinition of 
>> 'get_unaligned_be16'
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/be_byteshift.h:40:19: note: previous definition of 
'get_unaligned_be16' was here
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:27:19: error: redefinition of 
>> 'get_unaligned_be32'
static inline u32 get_unaligned_be32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
   

drivers/gpu/drm/i915/i915_gem_gtt.c:2367: error: 'gtt_entry' may be used uninitialized in this function

2016-09-10 Thread kbuild test robot
Hi Dave,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   d0acc7dfd90eb97e90ccd42a567034017ec60fb8
commit: 85d1225ec066b2ef46fbd0ed1bae78ae1f3e6c91 drm/i915: Introduce & use new 
lightweight SGL iterators
date:   4 months ago
config: x86_64-randconfig-s1-09110645 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
git checkout 85d1225ec066b2ef46fbd0ed1bae78ae1f3e6c91
# save the attached .config to linux build tree
make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All errors (new ones prefixed by >>):

   cc1: warnings being treated as errors
   drivers/gpu/drm/i915/i915_gem_gtt.c: In function 'gen8_ggtt_insert_entries':
>> drivers/gpu/drm/i915/i915_gem_gtt.c:2367: error: 'gtt_entry' may be used 
>> uninitialized in this function
   drivers/gpu/drm/i915/i915_gem_gtt.c: In function 'gen6_ggtt_insert_entries':
   drivers/gpu/drm/i915/i915_gem_gtt.c:2442: error: 'gtt_entry' may be used 
uninitialized in this function

vim +/gtt_entry +2367 drivers/gpu/drm/i915/i915_gem_gtt.c

  2361   enum i915_cache_level level, u32 
unused)
  2362  {
  2363  struct drm_i915_private *dev_priv = to_i915(vm->dev);
  2364  struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
  2365  struct sgt_iter sgt_iter;
  2366  gen8_pte_t __iomem *gtt_entries;
> 2367  gen8_pte_t gtt_entry;
  2368  dma_addr_t addr;
  2369  int rpm_atomic_seq;
  2370  int i = 0;

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


.config.gz
Description: Binary data


drivers/gpu/drm/i915/i915_gem_gtt.c:2367: error: 'gtt_entry' may be used uninitialized in this function

2016-09-10 Thread kbuild test robot
Hi Dave,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   d0acc7dfd90eb97e90ccd42a567034017ec60fb8
commit: 85d1225ec066b2ef46fbd0ed1bae78ae1f3e6c91 drm/i915: Introduce & use new 
lightweight SGL iterators
date:   4 months ago
config: x86_64-randconfig-s1-09110645 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
git checkout 85d1225ec066b2ef46fbd0ed1bae78ae1f3e6c91
# save the attached .config to linux build tree
make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All errors (new ones prefixed by >>):

   cc1: warnings being treated as errors
   drivers/gpu/drm/i915/i915_gem_gtt.c: In function 'gen8_ggtt_insert_entries':
>> drivers/gpu/drm/i915/i915_gem_gtt.c:2367: error: 'gtt_entry' may be used 
>> uninitialized in this function
   drivers/gpu/drm/i915/i915_gem_gtt.c: In function 'gen6_ggtt_insert_entries':
   drivers/gpu/drm/i915/i915_gem_gtt.c:2442: error: 'gtt_entry' may be used 
uninitialized in this function

vim +/gtt_entry +2367 drivers/gpu/drm/i915/i915_gem_gtt.c

  2361   enum i915_cache_level level, u32 
unused)
  2362  {
  2363  struct drm_i915_private *dev_priv = to_i915(vm->dev);
  2364  struct i915_ggtt *ggtt = i915_vm_to_ggtt(vm);
  2365  struct sgt_iter sgt_iter;
  2366  gen8_pte_t __iomem *gtt_entries;
> 2367  gen8_pte_t gtt_entry;
  2368  dma_addr_t addr;
  2369  int rpm_atomic_seq;
  2370  int i = 0;

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


.config.gz
Description: Binary data


Re: [PATCH v2] ubifs: compress lines for immediate return

2016-09-10 Thread kbuild test robot
Hi Masahiro,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Heiko-Schocher/ubifs-compress-lines-for-immediate-return/20160905-145802
config: i386-randconfig-x0-09110426 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   fs/ubifs/budget.c: In function 'run_gc':
>> fs/ubifs/budget.c:91:9: error: expected expression before '=' token
 return = ubifs_return_leb(c, lnum);
^
   fs/ubifs/budget.c:92:1: warning: control reaches end of non-void function 
[-Wreturn-type]
}
^

vim +91 fs/ubifs/budget.c

85  up_read(>commit_sem);
86  if (lnum < 0)
87  return lnum;
88  
89  /* GC freed one LEB, return it to lprops */
90  dbg_budg("GC freed LEB %d", lnum);
  > 91  return = ubifs_return_leb(c, lnum);
92  }
93  
94  /**

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


.config.gz
Description: Binary data


Re: [PATCH v2] ubifs: compress lines for immediate return

2016-09-10 Thread kbuild test robot
Hi Masahiro,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Heiko-Schocher/ubifs-compress-lines-for-immediate-return/20160905-145802
config: i386-randconfig-x0-09110426 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   fs/ubifs/budget.c: In function 'run_gc':
>> fs/ubifs/budget.c:91:9: error: expected expression before '=' token
 return = ubifs_return_leb(c, lnum);
^
   fs/ubifs/budget.c:92:1: warning: control reaches end of non-void function 
[-Wreturn-type]
}
^

vim +91 fs/ubifs/budget.c

85  up_read(>commit_sem);
86  if (lnum < 0)
87  return lnum;
88  
89  /* GC freed one LEB, return it to lprops */
90  dbg_budg("GC freed LEB %d", lnum);
  > 91  return = ubifs_return_leb(c, lnum);
92  }
93  
94  /**

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


.config.gz
Description: Binary data


Re: [PATCH v6 1/8] thunderbolt: Macro rename

2016-09-10 Thread Andreas Noever
On Mon, Aug 1, 2016 at 2:23 PM, Amir Levy  wrote:
> This first patch updates the registers file to
> reflect that it isn't only for Cactus Ridge.
> No functional change intended.
>
> Signed-off-by: Amir Levy 
> ---
>  drivers/thunderbolt/nhi_regs.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thunderbolt/nhi_regs.h b/drivers/thunderbolt/nhi_regs.h
> index 86b996c..75cf069 100644
> --- a/drivers/thunderbolt/nhi_regs.h
> +++ b/drivers/thunderbolt/nhi_regs.h
> @@ -1,11 +1,11 @@
>  /*
> - * Thunderbolt Cactus Ridge driver - NHI registers
> + * Thunderbolt driver - NHI registers
>   *
>   * Copyright (c) 2014 Andreas Noever 
>   */
>
> -#ifndef DSL3510_REGS_H_
> -#define DSL3510_REGS_H_
> +#ifndef NHI_REGS_H_
> +#define NHI_REGS_H_
>
>  #include 
>
> --
> 2.7.4
Signed-off-by: Andreas Noever 


Re: [PATCH v6 1/8] thunderbolt: Macro rename

2016-09-10 Thread Andreas Noever
On Mon, Aug 1, 2016 at 2:23 PM, Amir Levy  wrote:
> This first patch updates the registers file to
> reflect that it isn't only for Cactus Ridge.
> No functional change intended.
>
> Signed-off-by: Amir Levy 
> ---
>  drivers/thunderbolt/nhi_regs.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thunderbolt/nhi_regs.h b/drivers/thunderbolt/nhi_regs.h
> index 86b996c..75cf069 100644
> --- a/drivers/thunderbolt/nhi_regs.h
> +++ b/drivers/thunderbolt/nhi_regs.h
> @@ -1,11 +1,11 @@
>  /*
> - * Thunderbolt Cactus Ridge driver - NHI registers
> + * Thunderbolt driver - NHI registers
>   *
>   * Copyright (c) 2014 Andreas Noever 
>   */
>
> -#ifndef DSL3510_REGS_H_
> -#define DSL3510_REGS_H_
> +#ifndef NHI_REGS_H_
> +#define NHI_REGS_H_
>
>  #include 
>
> --
> 2.7.4
Signed-off-by: Andreas Noever 


Re: [PATCH v6 0/8] thunderbolt: Introducing Thunderbolt(TM) networking

2016-09-10 Thread Andreas Noever
On Wed, Aug 31, 2016 at 1:28 PM, Greg KH  wrote:
> On Mon, Aug 01, 2016 at 03:23:45PM +0300, Amir Levy wrote:
>> This is version 6 of Thunderbolt(TM) driver for non-Apple hardware.
>>
>> Changes since v5:
>>  - Removed the padding of short packets in receive
>>  - Replaced RW semaphore with mutex
>>  - Cleanup
>>
>> These patches were pushed to GitHub where they can be reviewed more
>> comfortably with green/red highlighting:
>>   https://github.com/01org/thunderbolt-software-kernel-tree
>>
>> Daemon code:
>>   https://github.com/01org/thunderbolt-software-daemon
>>
>> For reference, here's a link to version 5:
>> [v5]: https://lkml.org/lkml/2016/7/28/85
>
> Without acks from the thunderbolt maintainer, or any network driver
> developers, I'm not going to take this series.  Please work to get that
> review.

Sorry for the late response. I was away for the last two weeks and
will be away again for the next week.

This driver is independent from mine. It uses an interface provided by
the firmware which is not present on Apple hardware and with which I
am not familiar (also it does networking, not pci with which I am also
not familiar). So I cannot comment on the driver itself. I don't mind
a second driver, if that is what you are asking.

Andreas


Re: [PATCH v6 0/8] thunderbolt: Introducing Thunderbolt(TM) networking

2016-09-10 Thread Andreas Noever
On Wed, Aug 31, 2016 at 1:28 PM, Greg KH  wrote:
> On Mon, Aug 01, 2016 at 03:23:45PM +0300, Amir Levy wrote:
>> This is version 6 of Thunderbolt(TM) driver for non-Apple hardware.
>>
>> Changes since v5:
>>  - Removed the padding of short packets in receive
>>  - Replaced RW semaphore with mutex
>>  - Cleanup
>>
>> These patches were pushed to GitHub where they can be reviewed more
>> comfortably with green/red highlighting:
>>   https://github.com/01org/thunderbolt-software-kernel-tree
>>
>> Daemon code:
>>   https://github.com/01org/thunderbolt-software-daemon
>>
>> For reference, here's a link to version 5:
>> [v5]: https://lkml.org/lkml/2016/7/28/85
>
> Without acks from the thunderbolt maintainer, or any network driver
> developers, I'm not going to take this series.  Please work to get that
> review.

Sorry for the late response. I was away for the last two weeks and
will be away again for the next week.

This driver is independent from mine. It uses an interface provided by
the firmware which is not present on Apple hardware and with which I
am not familiar (also it does networking, not pci with which I am also
not familiar). So I cannot comment on the driver itself. I don't mind
a second driver, if that is what you are asking.

Andreas


Re: [PATCH v2] net: ip, diag -- Add diag interface for raw sockets

2016-09-10 Thread David Ahern
On 9/10/16 4:05 PM, Cyrill Gorcunov wrote:
> On Sat, Sep 10, 2016 at 10:31:35AM -0600, David Ahern wrote:
>>
>> Would you mind adding the destroy capability as well? The udp version
>> should be close to what is needed for raw sockets. See udp_diag_destroy
>> and udp_abort.
> 
> Should be something like below. Didn't tested it yet so for review only.
> Will do testing at Monday.

doesn't compile:
- raw_abort needs to be in a header for ipv6, and
- inet_sk_diag_fill args have changed due to a recent commit



Re: [PATCH v2] net: ip, diag -- Add diag interface for raw sockets

2016-09-10 Thread David Ahern
On 9/10/16 4:05 PM, Cyrill Gorcunov wrote:
> On Sat, Sep 10, 2016 at 10:31:35AM -0600, David Ahern wrote:
>>
>> Would you mind adding the destroy capability as well? The udp version
>> should be close to what is needed for raw sockets. See udp_diag_destroy
>> and udp_abort.
> 
> Should be something like below. Didn't tested it yet so for review only.
> Will do testing at Monday.

doesn't compile:
- raw_abort needs to be in a header for ipv6, and
- inet_sk_diag_fill args have changed due to a recent commit



Re: [RFC/RFT][PATCH v2 3/7] PM / sleep: Make async suspend/resume of devices use device links

2016-09-10 Thread Rafael J. Wysocki
On Sat, Sep 10, 2016 at 3:31 PM, Lukas Wunner  wrote:
> On Thu, Sep 08, 2016 at 11:28:33PM +0200, Rafael J. Wysocki wrote:
>> Make the device suspend/resume part of the core system
>> suspend/resume code use device links to ensure that supplier
>> and consumer devices will be suspended and resumed in the right
>> order in case of async suspend/resume.
>>
>> The idea, roughly, is to use dpm_wait() to wait for all consumers
>> before a supplier device suspend and to wait for all suppliers
>> before a consumer device resume.
>
> For devices with a parent/child relationship, if the child does not
> utilize direct_complete, the parent is not allowed to utilize it
> either and is runtime resumed upon system sleep.
>
> Don't we need the same for supplier/consumer relationships?
>
> The code enforcing this is in __device_suspend() and looks like this:
>
> if (parent) {
> spin_lock_irq(>power.lock);
>
> dev->parent->power.direct_complete = false;
> if (dev->power.wakeup_path
> && !dev->parent->power.ignore_children)
> dev->parent->power.wakeup_path = true;
>
> spin_unlock_irq(>power.lock);
> }
>
> I guess we need to iterate over the suppliers here and execute
> the block for each of them.

You are right about the direct_complete thing, but the wakeup_path
thing is another matter.  It is about forwarding wakeup signals up the
hierarchy and I'd confine it to parents at least for the time being.

Thanks,
Rafael


Re: [RFC/RFT][PATCH v2 3/7] PM / sleep: Make async suspend/resume of devices use device links

2016-09-10 Thread Rafael J. Wysocki
On Sat, Sep 10, 2016 at 3:31 PM, Lukas Wunner  wrote:
> On Thu, Sep 08, 2016 at 11:28:33PM +0200, Rafael J. Wysocki wrote:
>> Make the device suspend/resume part of the core system
>> suspend/resume code use device links to ensure that supplier
>> and consumer devices will be suspended and resumed in the right
>> order in case of async suspend/resume.
>>
>> The idea, roughly, is to use dpm_wait() to wait for all consumers
>> before a supplier device suspend and to wait for all suppliers
>> before a consumer device resume.
>
> For devices with a parent/child relationship, if the child does not
> utilize direct_complete, the parent is not allowed to utilize it
> either and is runtime resumed upon system sleep.
>
> Don't we need the same for supplier/consumer relationships?
>
> The code enforcing this is in __device_suspend() and looks like this:
>
> if (parent) {
> spin_lock_irq(>power.lock);
>
> dev->parent->power.direct_complete = false;
> if (dev->power.wakeup_path
> && !dev->parent->power.ignore_children)
> dev->parent->power.wakeup_path = true;
>
> spin_unlock_irq(>power.lock);
> }
>
> I guess we need to iterate over the suppliers here and execute
> the block for each of them.

You are right about the direct_complete thing, but the wakeup_path
thing is another matter.  It is about forwarding wakeup signals up the
hierarchy and I'd confine it to parents at least for the time being.

Thanks,
Rafael


[PATCH v2] net: ip, diag -- Add diag interface for raw sockets

2016-09-10 Thread Cyrill Gorcunov
On Sat, Sep 10, 2016 at 10:31:35AM -0600, David Ahern wrote:
> 
> Would you mind adding the destroy capability as well? The udp version
> should be close to what is needed for raw sockets. See udp_diag_destroy
> and udp_abort.

Should be something like below. Didn't tested it yet so for review only.
Will do testing at Monday.
---
From: Cyrill Gorcunov 
Subject: [PATCH v2] net: ip, diag -- Add diag interface for raw sockets

In criu we are actively using diag interface to collect sockets
present in the system when dumping applications. And while for
unix, tcp, udp[lite], packet, netlink it works as expected,
the raw sockets do not have. Thus add it.

v2:
 - add missing sock_put calls in raw_diag_dump_one (by eric.dumazet@)
 - implement @destroy for diag requests (by dsa@)

CC: David S. Miller 
CC: Eric Dumazet 
CC: David Ahern 
CC: Alexey Kuznetsov 
CC: James Morris 
CC: Hideaki YOSHIFUJI 
CC: Patrick McHardy 
CC: Andrey Vagin 
CC: Stephen Hemminger 
Signed-off-by: Cyrill Gorcunov 
---

Take a look please, once time permit. Hopefully I didn't
miss something obvious, tested as "ss -n -A raw" for modified
iproute2 instance and c/r for trivial application which has
raw sockets opened. A patch for ss tool is at https://goo.gl/VFQ93L
for the reference, will send it out then.

 include/net/raw.h   |5 +
 include/net/rawv6.h |5 +
 net/ipv4/Kconfig|8 +
 net/ipv4/Makefile   |1 
 net/ipv4/raw.c  |   22 -
 net/ipv4/raw_diag.c |  219 
 net/ipv6/raw.c  |7 +
 7 files changed, 263 insertions(+), 4 deletions(-)

Index: linux-ml.git/include/net/raw.h
===
--- linux-ml.git.orig/include/net/raw.h
+++ linux-ml.git/include/net/raw.h
@@ -23,6 +23,11 @@
 
 extern struct proto raw_prot;
 
+extern struct raw_hashinfo raw_v4_hashinfo;
+struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
+unsigned short num, __be32 raddr,
+__be32 laddr, int dif);
+
 void raw_icmp_error(struct sk_buff *, int, u32);
 int raw_local_deliver(struct sk_buff *, int);
 
Index: linux-ml.git/include/net/rawv6.h
===
--- linux-ml.git.orig/include/net/rawv6.h
+++ linux-ml.git/include/net/rawv6.h
@@ -3,6 +3,11 @@
 
 #include 
 
+extern struct raw_hashinfo raw_v6_hashinfo;
+struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
+unsigned short num, const struct in6_addr 
*loc_addr,
+const struct in6_addr *rmt_addr, int dif);
+
 void raw6_icmp_error(struct sk_buff *, int nexthdr,
u8 type, u8 code, int inner_offset, __be32);
 bool raw6_local_deliver(struct sk_buff *, int);
Index: linux-ml.git/net/ipv4/Kconfig
===
--- linux-ml.git.orig/net/ipv4/Kconfig
+++ linux-ml.git/net/ipv4/Kconfig
@@ -430,6 +430,14 @@ config INET_UDP_DIAG
  Support for UDP socket monitoring interface used by the ss tool.
  If unsure, say Y.
 
+config INET_RAW_DIAG
+   tristate "RAW: socket monitoring interface"
+   depends on INET_DIAG && (IPV6 || IPV6=n)
+   default n
+   ---help---
+ Support for RAW socket monitoring interface used by the ss tool.
+ If unsure, say Y.
+
 config INET_DIAG_DESTROY
bool "INET: allow privileged process to administratively close sockets"
depends on INET_DIAG
Index: linux-ml.git/net/ipv4/Makefile
===
--- linux-ml.git.orig/net/ipv4/Makefile
+++ linux-ml.git/net/ipv4/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_NETFILTER)   += netfilter.o n
 obj-$(CONFIG_INET_DIAG) += inet_diag.o 
 obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
 obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o
+obj-$(CONFIG_INET_RAW_DIAG) += raw_diag.o
 obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
 obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o
Index: linux-ml.git/net/ipv4/raw.c
===
--- linux-ml.git.orig/net/ipv4/raw.c
+++ linux-ml.git/net/ipv4/raw.c
@@ -89,9 +89,10 @@ struct raw_frag_vec {
int hlen;
 };
 
-static struct raw_hashinfo raw_v4_hashinfo = {
+struct raw_hashinfo raw_v4_hashinfo = {
.lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
 };
+EXPORT_SYMBOL_GPL(raw_v4_hashinfo);
 
 int raw_hash_sk(struct sock *sk)
 {
@@ -120,7 +121,7 @@ void raw_unhash_sk(struct sock *sk)
 }
 EXPORT_SYMBOL_GPL(raw_unhash_sk);
 
-static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
+struct sock *__raw_v4_lookup(struct net 

[PATCH v2] net: ip, diag -- Add diag interface for raw sockets

2016-09-10 Thread Cyrill Gorcunov
On Sat, Sep 10, 2016 at 10:31:35AM -0600, David Ahern wrote:
> 
> Would you mind adding the destroy capability as well? The udp version
> should be close to what is needed for raw sockets. See udp_diag_destroy
> and udp_abort.

Should be something like below. Didn't tested it yet so for review only.
Will do testing at Monday.
---
From: Cyrill Gorcunov 
Subject: [PATCH v2] net: ip, diag -- Add diag interface for raw sockets

In criu we are actively using diag interface to collect sockets
present in the system when dumping applications. And while for
unix, tcp, udp[lite], packet, netlink it works as expected,
the raw sockets do not have. Thus add it.

v2:
 - add missing sock_put calls in raw_diag_dump_one (by eric.dumazet@)
 - implement @destroy for diag requests (by dsa@)

CC: David S. Miller 
CC: Eric Dumazet 
CC: David Ahern 
CC: Alexey Kuznetsov 
CC: James Morris 
CC: Hideaki YOSHIFUJI 
CC: Patrick McHardy 
CC: Andrey Vagin 
CC: Stephen Hemminger 
Signed-off-by: Cyrill Gorcunov 
---

Take a look please, once time permit. Hopefully I didn't
miss something obvious, tested as "ss -n -A raw" for modified
iproute2 instance and c/r for trivial application which has
raw sockets opened. A patch for ss tool is at https://goo.gl/VFQ93L
for the reference, will send it out then.

 include/net/raw.h   |5 +
 include/net/rawv6.h |5 +
 net/ipv4/Kconfig|8 +
 net/ipv4/Makefile   |1 
 net/ipv4/raw.c  |   22 -
 net/ipv4/raw_diag.c |  219 
 net/ipv6/raw.c  |7 +
 7 files changed, 263 insertions(+), 4 deletions(-)

Index: linux-ml.git/include/net/raw.h
===
--- linux-ml.git.orig/include/net/raw.h
+++ linux-ml.git/include/net/raw.h
@@ -23,6 +23,11 @@
 
 extern struct proto raw_prot;
 
+extern struct raw_hashinfo raw_v4_hashinfo;
+struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
+unsigned short num, __be32 raddr,
+__be32 laddr, int dif);
+
 void raw_icmp_error(struct sk_buff *, int, u32);
 int raw_local_deliver(struct sk_buff *, int);
 
Index: linux-ml.git/include/net/rawv6.h
===
--- linux-ml.git.orig/include/net/rawv6.h
+++ linux-ml.git/include/net/rawv6.h
@@ -3,6 +3,11 @@
 
 #include 
 
+extern struct raw_hashinfo raw_v6_hashinfo;
+struct sock *__raw_v6_lookup(struct net *net, struct sock *sk,
+unsigned short num, const struct in6_addr 
*loc_addr,
+const struct in6_addr *rmt_addr, int dif);
+
 void raw6_icmp_error(struct sk_buff *, int nexthdr,
u8 type, u8 code, int inner_offset, __be32);
 bool raw6_local_deliver(struct sk_buff *, int);
Index: linux-ml.git/net/ipv4/Kconfig
===
--- linux-ml.git.orig/net/ipv4/Kconfig
+++ linux-ml.git/net/ipv4/Kconfig
@@ -430,6 +430,14 @@ config INET_UDP_DIAG
  Support for UDP socket monitoring interface used by the ss tool.
  If unsure, say Y.
 
+config INET_RAW_DIAG
+   tristate "RAW: socket monitoring interface"
+   depends on INET_DIAG && (IPV6 || IPV6=n)
+   default n
+   ---help---
+ Support for RAW socket monitoring interface used by the ss tool.
+ If unsure, say Y.
+
 config INET_DIAG_DESTROY
bool "INET: allow privileged process to administratively close sockets"
depends on INET_DIAG
Index: linux-ml.git/net/ipv4/Makefile
===
--- linux-ml.git.orig/net/ipv4/Makefile
+++ linux-ml.git/net/ipv4/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_NETFILTER)   += netfilter.o n
 obj-$(CONFIG_INET_DIAG) += inet_diag.o 
 obj-$(CONFIG_INET_TCP_DIAG) += tcp_diag.o
 obj-$(CONFIG_INET_UDP_DIAG) += udp_diag.o
+obj-$(CONFIG_INET_RAW_DIAG) += raw_diag.o
 obj-$(CONFIG_NET_TCPPROBE) += tcp_probe.o
 obj-$(CONFIG_TCP_CONG_BIC) += tcp_bic.o
 obj-$(CONFIG_TCP_CONG_CDG) += tcp_cdg.o
Index: linux-ml.git/net/ipv4/raw.c
===
--- linux-ml.git.orig/net/ipv4/raw.c
+++ linux-ml.git/net/ipv4/raw.c
@@ -89,9 +89,10 @@ struct raw_frag_vec {
int hlen;
 };
 
-static struct raw_hashinfo raw_v4_hashinfo = {
+struct raw_hashinfo raw_v4_hashinfo = {
.lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
 };
+EXPORT_SYMBOL_GPL(raw_v4_hashinfo);
 
 int raw_hash_sk(struct sock *sk)
 {
@@ -120,7 +121,7 @@ void raw_unhash_sk(struct sock *sk)
 }
 EXPORT_SYMBOL_GPL(raw_unhash_sk);
 
-static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
+struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
unsigned short num, __be32 raddr, __be32 laddr, int dif)
 {
sk_for_each_from(sk) {
@@ -136,6 +137,7 @@ static struct sock *__raw_v4_lookup(stru
 found:
return sk;
 }

Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices

2016-09-10 Thread Rafael J. Wysocki
On Sat, Sep 10, 2016 at 1:39 PM, Lukas Wunner  wrote:
> On Thu, Sep 08, 2016 at 11:25:44PM +0200, Rafael J. Wysocki wrote:
>> As discussed in the recent "On-demand device probing" thread and in a
>> Kernel Summit session earlier today, there is a problem with handling
>> cases where functional dependencies between devices are involved.
>>
>> What I mean by a "functional dependency" is when the driver of device B
>> needs both device A and its driver to be present and functional to be
>> able to work.  This implies that the driver of A needs to be working
>> for B to be probed successfully and it cannot be unbound from the
>> device before the B's driver.  This also has certain consequences for
>> power management of these devices (suspend/resume and runtime PM
>> ordering).
>
> As a general observation, this series seems to conflate two
> separate issues:
>
> (a) non-hierarchical device dependencies
> (a device depends on another device which is not its parent
> with regards to (runtime) suspend/resume ordering)

You need to say what it means that one device depends on another one.
Without that you don't get anything useful.

> (b) driver-presence dependencies
> (a device depends on another device to be bound to a driver
> before it can probe / must be unbound before the other device
> can unbind)
>
> Those two issues are orthogonal.

No, they aren't.

At least for a number of devices (quite likely it would be safe to say
that for the majority of them I think) the supplier can only provide
any useful service to its consumers when it has a driver bound to it
and running and the consumers cannot operate correctly without that
service.  That's why the "unbind consumers before unbinding the
supplier" logic is in there.

And in the context of this series a "dependency" boils down to the
ordering of execution of callbacks of certain type.  Like, for
example, "can I execute ->runtime_suspend() for device A before
executing it for device B?"  If there's a link between A and B where
the former is the supplier, the answer is "no".  The reason why is the
assumption that after ->runtime_suspend() A will stop responding and
will not be able to provide the service in question to B any more.

Likewise, if the driver of A goes away, this device will not be able
to provide the service in question to B any more, so it doesn't make
sense for the driver of B to still be running then.

This is the case I wanted to cover with this series if it was not clear before.

Of course, you don't like what device_links_unbind_consumers() does
because of your "Thunderbolt on Macs" use case, but guess what, you
can add a link flag to keep the consumer around when the supplier
driver goes away.  I just don't want that to be the default behavior.

> E.g. a driver-presence dependency may exist between a child and a
> parent, or between siblings, whereas a non-hierarchical device
> dependency by definition cannot exist between child/parent.
>
> Let's say I need a driver-presence dependency between parent/child.
> The PM core already guarantees correct (runtime) suspend/resume
> ordering between child. Device links duplicate that functionality.
> Oops?

No, they don't and that should be clear.

They are for out-of-the-tree dependencies only and the parent-child
one is *in* the tree.

Thanks,
Rafael


Re: [RFC/RFT][PATCH v2 0/7] Functional dependencies between devices

2016-09-10 Thread Rafael J. Wysocki
On Sat, Sep 10, 2016 at 1:39 PM, Lukas Wunner  wrote:
> On Thu, Sep 08, 2016 at 11:25:44PM +0200, Rafael J. Wysocki wrote:
>> As discussed in the recent "On-demand device probing" thread and in a
>> Kernel Summit session earlier today, there is a problem with handling
>> cases where functional dependencies between devices are involved.
>>
>> What I mean by a "functional dependency" is when the driver of device B
>> needs both device A and its driver to be present and functional to be
>> able to work.  This implies that the driver of A needs to be working
>> for B to be probed successfully and it cannot be unbound from the
>> device before the B's driver.  This also has certain consequences for
>> power management of these devices (suspend/resume and runtime PM
>> ordering).
>
> As a general observation, this series seems to conflate two
> separate issues:
>
> (a) non-hierarchical device dependencies
> (a device depends on another device which is not its parent
> with regards to (runtime) suspend/resume ordering)

You need to say what it means that one device depends on another one.
Without that you don't get anything useful.

> (b) driver-presence dependencies
> (a device depends on another device to be bound to a driver
> before it can probe / must be unbound before the other device
> can unbind)
>
> Those two issues are orthogonal.

No, they aren't.

At least for a number of devices (quite likely it would be safe to say
that for the majority of them I think) the supplier can only provide
any useful service to its consumers when it has a driver bound to it
and running and the consumers cannot operate correctly without that
service.  That's why the "unbind consumers before unbinding the
supplier" logic is in there.

And in the context of this series a "dependency" boils down to the
ordering of execution of callbacks of certain type.  Like, for
example, "can I execute ->runtime_suspend() for device A before
executing it for device B?"  If there's a link between A and B where
the former is the supplier, the answer is "no".  The reason why is the
assumption that after ->runtime_suspend() A will stop responding and
will not be able to provide the service in question to B any more.

Likewise, if the driver of A goes away, this device will not be able
to provide the service in question to B any more, so it doesn't make
sense for the driver of B to still be running then.

This is the case I wanted to cover with this series if it was not clear before.

Of course, you don't like what device_links_unbind_consumers() does
because of your "Thunderbolt on Macs" use case, but guess what, you
can add a link flag to keep the consumer around when the supplier
driver goes away.  I just don't want that to be the default behavior.

> E.g. a driver-presence dependency may exist between a child and a
> parent, or between siblings, whereas a non-hierarchical device
> dependency by definition cannot exist between child/parent.
>
> Let's say I need a driver-presence dependency between parent/child.
> The PM core already guarantees correct (runtime) suspend/resume
> ordering between child. Device links duplicate that functionality.
> Oops?

No, they don't and that should be clear.

They are for out-of-the-tree dependencies only and the parent-child
one is *in* the tree.

Thanks,
Rafael


Re: [PATCH 0/8] ARM: dts: rockchip: Remove skeleton.dtsi usage and fix memory node DTC warnings

2016-09-10 Thread Heiko Stuebner
Hi Javier,

Am Freitag, 9. September 2016, 10:01:01 CEST schrieb Javier Martinez Canillas:
> This series removes the inclusion of the skeleton.dtsi in all the Rockchip
> dts, which allows to get rid of the DTC warnings about a mismatch between
> the memory nodes' unit names and reg properties.
> 
> Patches are pretty trivial and shouldn't cause functional changes AFAIK,
> but were only built tested and dtbs compared with scripts/dtc/dtx_diff.

applied all 8 to my dts branch (for 4.9 but might get delayed to 4.10 ... not 
sure yet)


Thanks
Heiko


Re: [PATCH 0/8] ARM: dts: rockchip: Remove skeleton.dtsi usage and fix memory node DTC warnings

2016-09-10 Thread Heiko Stuebner
Hi Javier,

Am Freitag, 9. September 2016, 10:01:01 CEST schrieb Javier Martinez Canillas:
> This series removes the inclusion of the skeleton.dtsi in all the Rockchip
> dts, which allows to get rid of the DTC warnings about a mismatch between
> the memory nodes' unit names and reg properties.
> 
> Patches are pretty trivial and shouldn't cause functional changes AFAIK,
> but were only built tested and dtbs compared with scripts/dtc/dtx_diff.

applied all 8 to my dts branch (for 4.9 but might get delayed to 4.10 ... not 
sure yet)


Thanks
Heiko


[PATCH v3] usb: dwc3: OCTEON: add support for device tree

2016-09-10 Thread Steven J. Hill
This patch adds support to parse probe data for
the dwc3-octeon driver using device tree. The
DWC3 IP core is found on OCTEON III processors.

Signed-off-by: Steven J. Hill 

Changes in v3:
- Massive simplification of glue logic. Almost all the
  work is done in the SoC platform code.
Changes in v2:
- Changed comment block to acurately describe why the DMA
  properties are being set.
- Deleted 'dwc3_octeon_remove()' function as it serves
  no purpose. Also changed driver from tristate to a
  boolen as we have no plans to make it modular.
- Changed driver dependency from CAVIUM_OCTEON_SOC to
  CPU_CAVIUM_OCTEON || COMPILE_TEST per Balbi's request.

---
 drivers/usb/dwc3/Kconfig   | 10 +++
 drivers/usb/dwc3/Makefile  |  1 +
 drivers/usb/dwc3/dwc3-octeon.c | 61 ++
 3 files changed, 72 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-octeon.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index a64ce1c..f2cb24b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -105,4 +105,14 @@ config USB_DWC3_ST
  inside (i.e. STiH407).
  Say 'Y' or 'M' if you have one such device.

+config USB_DWC3_OCTEON
+   bool "Cavium OCTEON III Platforms"
+   depends on CPU_CAVIUM_OCTEON || COMPILE_TEST
+   depends on OF
+   default USB_DWC3
+   help
+ Cavium OCTEON III SoCs with one DesignWare Core USB3 IP
+ inside (i.e. cn71xx and cn78xx).
+ Say 'Y' or 'M' if you have one such device.
+
 endif
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 22420e1..f1a7a3e 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_USB_DWC3_PCI)+= dwc3-pci.o
 obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
 obj-$(CONFIG_USB_DWC3_OF_SIMPLE)   += dwc3-of-simple.o
 obj-$(CONFIG_USB_DWC3_ST)  += dwc3-st.o
+obj-$(CONFIG_USB_DWC3_OCTEON)  += dwc3-octeon.o
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
new file mode 100644
index 000..ae84a01
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -0,0 +1,61 @@
+/**
+ * dwc3-octeon.c - Cavium OCTEON III DWC3 Specific Glue Layer
+ *
+ * Copyright (C) 2016 Cavium Networks
+ *
+ * Author: Steven J. Hill 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Inspired by dwc3-exynos.c and dwc3-st.c files.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int dwc3_octeon_probe(struct platform_device *pdev)
+{
+   struct device   *dev = >dev;
+   int ret;
+
+   /*
+* Right now device-tree probed devices do not provide
+* "dma-ranges" or "dma-coherent" properties.
+*/
+   ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+static const struct of_device_id octeon_dwc3_match[] = {
+   { .compatible = "cavium,octeon-7130-usb-uctl", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, octeon_dwc3_match);
+
+static struct platform_driver dwc3_octeon_driver = {
+   .probe  = dwc3_octeon_probe,
+   .driver = {
+   .name   = "octeon-dwc3",
+   .of_match_table = octeon_dwc3_match,
+   .pm = NULL,
+   },
+};
+module_platform_driver(dwc3_octeon_driver);
+
+MODULE_ALIAS("platform:octeon-dwc3");
+MODULE_AUTHOR("Steven J. Hill 

[PATCH v3] usb: dwc3: OCTEON: add support for device tree

2016-09-10 Thread Steven J. Hill
This patch adds support to parse probe data for
the dwc3-octeon driver using device tree. The
DWC3 IP core is found on OCTEON III processors.

Signed-off-by: Steven J. Hill 

Changes in v3:
- Massive simplification of glue logic. Almost all the
  work is done in the SoC platform code.
Changes in v2:
- Changed comment block to acurately describe why the DMA
  properties are being set.
- Deleted 'dwc3_octeon_remove()' function as it serves
  no purpose. Also changed driver from tristate to a
  boolen as we have no plans to make it modular.
- Changed driver dependency from CAVIUM_OCTEON_SOC to
  CPU_CAVIUM_OCTEON || COMPILE_TEST per Balbi's request.

---
 drivers/usb/dwc3/Kconfig   | 10 +++
 drivers/usb/dwc3/Makefile  |  1 +
 drivers/usb/dwc3/dwc3-octeon.c | 61 ++
 3 files changed, 72 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-octeon.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index a64ce1c..f2cb24b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -105,4 +105,14 @@ config USB_DWC3_ST
  inside (i.e. STiH407).
  Say 'Y' or 'M' if you have one such device.

+config USB_DWC3_OCTEON
+   bool "Cavium OCTEON III Platforms"
+   depends on CPU_CAVIUM_OCTEON || COMPILE_TEST
+   depends on OF
+   default USB_DWC3
+   help
+ Cavium OCTEON III SoCs with one DesignWare Core USB3 IP
+ inside (i.e. cn71xx and cn78xx).
+ Say 'Y' or 'M' if you have one such device.
+
 endif
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 22420e1..f1a7a3e 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_USB_DWC3_PCI)+= dwc3-pci.o
 obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
 obj-$(CONFIG_USB_DWC3_OF_SIMPLE)   += dwc3-of-simple.o
 obj-$(CONFIG_USB_DWC3_ST)  += dwc3-st.o
+obj-$(CONFIG_USB_DWC3_OCTEON)  += dwc3-octeon.o
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
new file mode 100644
index 000..ae84a01
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -0,0 +1,61 @@
+/**
+ * dwc3-octeon.c - Cavium OCTEON III DWC3 Specific Glue Layer
+ *
+ * Copyright (C) 2016 Cavium Networks
+ *
+ * Author: Steven J. Hill 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Inspired by dwc3-exynos.c and dwc3-st.c files.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int dwc3_octeon_probe(struct platform_device *pdev)
+{
+   struct device   *dev = >dev;
+   int ret;
+
+   /*
+* Right now device-tree probed devices do not provide
+* "dma-ranges" or "dma-coherent" properties.
+*/
+   ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+static const struct of_device_id octeon_dwc3_match[] = {
+   { .compatible = "cavium,octeon-7130-usb-uctl", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, octeon_dwc3_match);
+
+static struct platform_driver dwc3_octeon_driver = {
+   .probe  = dwc3_octeon_probe,
+   .driver = {
+   .name   = "octeon-dwc3",
+   .of_match_table = octeon_dwc3_match,
+   .pm = NULL,
+   },
+};
+module_platform_driver(dwc3_octeon_driver);
+
+MODULE_ALIAS("platform:octeon-dwc3");
+MODULE_AUTHOR("Steven J. Hill 

[PATCH 13/13] DRBD-receiver: Improve determination of sizes in receive_Barrier()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:06:21 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index e4da335..32ac4a9 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1747,7 +1747,7 @@ static int receive_Barrier(struct drbd_connection 
*connection, struct packet_inf
 
/* receiver context, in the writeout path of the other node.
 * avoid potential distributed deadlock */
-   epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
+   epoch = kmalloc(sizeof(*epoch), GFP_NOIO);
if (epoch)
break;
else
@@ -1760,7 +1760,7 @@ static int receive_Barrier(struct drbd_connection 
*connection, struct packet_inf
drbd_flush(connection);
 
if (atomic_read(>current_epoch->epoch_size)) {
-   epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
+   epoch = kmalloc(sizeof(*epoch), GFP_NOIO);
if (epoch)
break;
}
-- 
2.10.0



[PATCH 13/13] DRBD-receiver: Improve determination of sizes in receive_Barrier()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:06:21 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index e4da335..32ac4a9 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1747,7 +1747,7 @@ static int receive_Barrier(struct drbd_connection 
*connection, struct packet_inf
 
/* receiver context, in the writeout path of the other node.
 * avoid potential distributed deadlock */
-   epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
+   epoch = kmalloc(sizeof(*epoch), GFP_NOIO);
if (epoch)
break;
else
@@ -1760,7 +1760,7 @@ static int receive_Barrier(struct drbd_connection 
*connection, struct packet_inf
drbd_flush(connection);
 
if (atomic_read(>current_epoch->epoch_size)) {
-   epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
+   epoch = kmalloc(sizeof(*epoch), GFP_NOIO);
if (epoch)
break;
}
-- 
2.10.0



[PATCH 12/13] DRBD-receiver: Delete error messages for failed resource allocations in receive_protocol()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:04:08 +0200

Omit two messages for memory allocation failures in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index bbccdb8..e4da335 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3691,17 +3691,13 @@ static int receive_protocol(struct drbd_connection 
*connection, struct packet_in
hash_size = crypto_ahash_digestsize(peer_integrity_tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
-   if (!(int_dig_in && int_dig_vv)) {
-   drbd_err(connection, "Allocation of buffers for data 
integrity checking failed\n");
+   if (!(int_dig_in && int_dig_vv))
goto disconnect;
-   }
}
 
new_net_conf = kmalloc(sizeof(*new_net_conf), GFP_KERNEL);
-   if (!new_net_conf) {
-   drbd_err(connection, "Allocation of new net_conf failed\n");
+   if (!new_net_conf)
goto disconnect;
-   }
 
mutex_lock(>data.mutex);
mutex_lock(>resource->conf_update);
-- 
2.10.0



[PATCH 12/13] DRBD-receiver: Delete error messages for failed resource allocations in receive_protocol()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:04:08 +0200

Omit two messages for memory allocation failures in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index bbccdb8..e4da335 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3691,17 +3691,13 @@ static int receive_protocol(struct drbd_connection 
*connection, struct packet_in
hash_size = crypto_ahash_digestsize(peer_integrity_tfm);
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
-   if (!(int_dig_in && int_dig_vv)) {
-   drbd_err(connection, "Allocation of buffers for data 
integrity checking failed\n");
+   if (!(int_dig_in && int_dig_vv))
goto disconnect;
-   }
}
 
new_net_conf = kmalloc(sizeof(*new_net_conf), GFP_KERNEL);
-   if (!new_net_conf) {
-   drbd_err(connection, "Allocation of new net_conf failed\n");
+   if (!new_net_conf)
goto disconnect;
-   }
 
mutex_lock(>data.mutex);
mutex_lock(>resource->conf_update);
-- 
2.10.0



[PATCH 11/13] DRBD-receiver: Improve a size determination in receive_protocol()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:02:11 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 3e1315a..bbccdb8 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3697,7 +3697,7 @@ static int receive_protocol(struct drbd_connection 
*connection, struct packet_in
}
}
 
-   new_net_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
+   new_net_conf = kmalloc(sizeof(*new_net_conf), GFP_KERNEL);
if (!new_net_conf) {
drbd_err(connection, "Allocation of new net_conf failed\n");
goto disconnect;
-- 
2.10.0



[PATCH 11/13] DRBD-receiver: Improve a size determination in receive_protocol()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:02:11 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 3e1315a..bbccdb8 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3697,7 +3697,7 @@ static int receive_protocol(struct drbd_connection 
*connection, struct packet_in
}
}
 
-   new_net_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
+   new_net_conf = kmalloc(sizeof(*new_net_conf), GFP_KERNEL);
if (!new_net_conf) {
drbd_err(connection, "Allocation of new net_conf failed\n");
goto disconnect;
-- 
2.10.0



[PATCH 10/13] DRBD-receiver: Delete error messages for failed resource allocations in receive_SyncParam()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:00:10 +0200

Omit three messages for memory allocation failures in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 6fbd968..3e1315a 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3863,7 +3863,6 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (!new_disk_conf) {
put_ldev(device);
mutex_unlock(>resource->conf_update);
-   drbd_err(device, "Allocation of new disk_conf 
failed\n");
return -ENOMEM;
}
 
@@ -3938,7 +3937,6 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (fifo_size != device->rs_plan_s->size) {
new_plan = fifo_alloc(fifo_size);
if (!new_plan) {
-   drbd_err(device, "kmalloc of 
fifo_buffer failed");
put_ldev(device);
goto disconnect;
}
@@ -3948,10 +3946,8 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (verify_tfm || csums_tfm) {
new_net_conf = kzalloc(sizeof(*new_net_conf),
   GFP_KERNEL);
-   if (!new_net_conf) {
-   drbd_err(device, "Allocation of new net_conf 
failed\n");
+   if (!new_net_conf)
goto disconnect;
-   }
 
*new_net_conf = *old_net_conf;
 
-- 
2.10.0



[PATCH 10/13] DRBD-receiver: Delete error messages for failed resource allocations in receive_SyncParam()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 22:00:10 +0200

Omit three messages for memory allocation failures in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 6fbd968..3e1315a 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3863,7 +3863,6 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (!new_disk_conf) {
put_ldev(device);
mutex_unlock(>resource->conf_update);
-   drbd_err(device, "Allocation of new disk_conf 
failed\n");
return -ENOMEM;
}
 
@@ -3938,7 +3937,6 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (fifo_size != device->rs_plan_s->size) {
new_plan = fifo_alloc(fifo_size);
if (!new_plan) {
-   drbd_err(device, "kmalloc of 
fifo_buffer failed");
put_ldev(device);
goto disconnect;
}
@@ -3948,10 +3946,8 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
if (verify_tfm || csums_tfm) {
new_net_conf = kzalloc(sizeof(*new_net_conf),
   GFP_KERNEL);
-   if (!new_net_conf) {
-   drbd_err(device, "Allocation of new net_conf 
failed\n");
+   if (!new_net_conf)
goto disconnect;
-   }
 
*new_net_conf = *old_net_conf;
 
-- 
2.10.0



[PATCH 09/13] DRBD-receiver: Improve determination of sizes in receive_SyncParam()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:54:55 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 2fe58d1..6fbd968 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3859,7 +3859,7 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
mutex_lock(>resource->conf_update);
old_net_conf = peer_device->connection->net_conf;
if (get_ldev(device)) {
-   new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL);
+   new_disk_conf = kzalloc(sizeof(*new_disk_conf), GFP_KERNEL);
if (!new_disk_conf) {
put_ldev(device);
mutex_unlock(>resource->conf_update);
@@ -3946,7 +3946,8 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
}
 
if (verify_tfm || csums_tfm) {
-   new_net_conf = kzalloc(sizeof(struct net_conf), 
GFP_KERNEL);
+   new_net_conf = kzalloc(sizeof(*new_net_conf),
+  GFP_KERNEL);
if (!new_net_conf) {
drbd_err(device, "Allocation of new net_conf 
failed\n");
goto disconnect;
-- 
2.10.0



[PATCH 09/13] DRBD-receiver: Improve determination of sizes in receive_SyncParam()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:54:55 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 2fe58d1..6fbd968 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3859,7 +3859,7 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
mutex_lock(>resource->conf_update);
old_net_conf = peer_device->connection->net_conf;
if (get_ldev(device)) {
-   new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL);
+   new_disk_conf = kzalloc(sizeof(*new_disk_conf), GFP_KERNEL);
if (!new_disk_conf) {
put_ldev(device);
mutex_unlock(>resource->conf_update);
@@ -3946,7 +3946,8 @@ static int receive_SyncParam(struct drbd_connection 
*connection, struct packet_i
}
 
if (verify_tfm || csums_tfm) {
-   new_net_conf = kzalloc(sizeof(struct net_conf), 
GFP_KERNEL);
+   new_net_conf = kzalloc(sizeof(*new_net_conf),
+  GFP_KERNEL);
if (!new_net_conf) {
drbd_err(device, "Allocation of new net_conf 
failed\n");
goto disconnect;
-- 
2.10.0



[PATCH 07/13] DRBD-receiver: Delete an error message for a failed kzalloc() call in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:48:21 +0200

Omit an extra message for a memory allocation failure in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 64bc316..6a9c16e 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4088,7 +4088,6 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
new_disk_conf = kzalloc(sizeof(*new_disk_conf),
GFP_KERNEL);
if (!new_disk_conf) {
-   drbd_err(device, "Allocation of new disk_conf 
failed\n");
put_ldev(device);
return -ENOMEM;
}
-- 
2.10.0



[PATCH 08/13] DRBD-receiver: Move an assignment in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:50:18 +0200

Move one assignment for the local variable "ldsc" so that its setting
will only be performed after corresponding data processing succeeded
by this function.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 6a9c16e..2fe58d1 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4036,7 +4036,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
struct o_qlim *o = (connection->agreed_features & DRBD_FF_WSAME) ? 
p->qlim : NULL;
enum determine_dev_size dd = DS_UNCHANGED;
sector_t p_size, p_usize, p_csize, my_usize;
-   int ldsc = 0; /* local disk size changed */
+   int ldsc; /* local disk size changed */
enum dds_flags ddsf;
 
peer_device = conn_peer_device(connection, pi->vnr);
@@ -4141,6 +4141,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
drbd_set_my_capacity(device, p_csize ?: p_usize ?: p_size);
}
 
+   ldsc = 0;
if (get_ldev(device)) {
if (device->ldev->known_size != 
drbd_get_capacity(device->ldev->backing_bdev)) {
device->ldev->known_size = 
drbd_get_capacity(device->ldev->backing_bdev);
-- 
2.10.0



[PATCH 07/13] DRBD-receiver: Delete an error message for a failed kzalloc() call in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:48:21 +0200

Omit an extra message for a memory allocation failure in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 64bc316..6a9c16e 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4088,7 +4088,6 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
new_disk_conf = kzalloc(sizeof(*new_disk_conf),
GFP_KERNEL);
if (!new_disk_conf) {
-   drbd_err(device, "Allocation of new disk_conf 
failed\n");
put_ldev(device);
return -ENOMEM;
}
-- 
2.10.0



[PATCH 08/13] DRBD-receiver: Move an assignment in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:50:18 +0200

Move one assignment for the local variable "ldsc" so that its setting
will only be performed after corresponding data processing succeeded
by this function.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 6a9c16e..2fe58d1 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4036,7 +4036,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
struct o_qlim *o = (connection->agreed_features & DRBD_FF_WSAME) ? 
p->qlim : NULL;
enum determine_dev_size dd = DS_UNCHANGED;
sector_t p_size, p_usize, p_csize, my_usize;
-   int ldsc = 0; /* local disk size changed */
+   int ldsc; /* local disk size changed */
enum dds_flags ddsf;
 
peer_device = conn_peer_device(connection, pi->vnr);
@@ -4141,6 +4141,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
drbd_set_my_capacity(device, p_csize ?: p_usize ?: p_size);
}
 
+   ldsc = 0;
if (get_ldev(device)) {
if (device->ldev->known_size != 
drbd_get_capacity(device->ldev->backing_bdev)) {
device->ldev->known_size = 
drbd_get_capacity(device->ldev->backing_bdev);
-- 
2.10.0



[PATCH 06/13] DRBD-receiver: Improve a size determination in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:45:13 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 7666212..64bc316 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4085,7 +4085,8 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
if (my_usize != p_usize) {
struct disk_conf *old_disk_conf, *new_disk_conf;
 
-   new_disk_conf = kzalloc(sizeof(struct disk_conf), 
GFP_KERNEL);
+   new_disk_conf = kzalloc(sizeof(*new_disk_conf),
+   GFP_KERNEL);
if (!new_disk_conf) {
drbd_err(device, "Allocation of new disk_conf 
failed\n");
put_ldev(device);
-- 
2.10.0



[PATCH 06/13] DRBD-receiver: Improve a size determination in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 21:45:13 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 7666212..64bc316 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4085,7 +4085,8 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
if (my_usize != p_usize) {
struct disk_conf *old_disk_conf, *new_disk_conf;
 
-   new_disk_conf = kzalloc(sizeof(struct disk_conf), 
GFP_KERNEL);
+   new_disk_conf = kzalloc(sizeof(*new_disk_conf),
+   GFP_KERNEL);
if (!new_disk_conf) {
drbd_err(device, "Allocation of new disk_conf 
failed\n");
put_ldev(device);
-- 
2.10.0



[PATCH 05/13] DRBD-receiver: Delete an unnecessary initialisation in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 20:04:02 +0200

A local variable was assigned a null pointer despite of the detail
that it was immediately reassigned by the following statement.
Thus remove such an unnecessary initialisation.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index b5a3cf0..7666212 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4083,7 +4083,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
}
 
if (my_usize != p_usize) {
-   struct disk_conf *old_disk_conf, *new_disk_conf = NULL;
+   struct disk_conf *old_disk_conf, *new_disk_conf;
 
new_disk_conf = kzalloc(sizeof(struct disk_conf), 
GFP_KERNEL);
if (!new_disk_conf) {
-- 
2.10.0



[PATCH 05/13] DRBD-receiver: Delete an unnecessary initialisation in receive_sizes()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 20:04:02 +0200

A local variable was assigned a null pointer despite of the detail
that it was immediately reassigned by the following statement.
Thus remove such an unnecessary initialisation.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index b5a3cf0..7666212 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4083,7 +4083,7 @@ static int receive_sizes(struct drbd_connection 
*connection, struct packet_info
}
 
if (my_usize != p_usize) {
-   struct disk_conf *old_disk_conf, *new_disk_conf = NULL;
+   struct disk_conf *old_disk_conf, *new_disk_conf;
 
new_disk_conf = kzalloc(sizeof(struct disk_conf), 
GFP_KERNEL);
if (!new_disk_conf) {
-- 
2.10.0



[PATCH 04/13] DRBD-receiver: Improve a size determination in drbd_do_features()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:46:05 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 5526f6b..b5a3cf0 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -5208,7 +5208,7 @@ static int drbd_do_features(struct drbd_connection 
*connection)
 {
/* ASSERT current == connection->receiver ... */
struct p_connection_features *p;
-   const int expect = sizeof(struct p_connection_features);
+   const int expect = sizeof(*p);
struct packet_info pi;
int err;
 
-- 
2.10.0



[PATCH 04/13] DRBD-receiver: Improve a size determination in drbd_do_features()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:46:05 +0200

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 5526f6b..b5a3cf0 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -5208,7 +5208,7 @@ static int drbd_do_features(struct drbd_connection 
*connection)
 {
/* ASSERT current == connection->receiver ... */
struct p_connection_features *p;
-   const int expect = sizeof(struct p_connection_features);
+   const int expect = sizeof(*p);
struct packet_info pi;
int err;
 
-- 
2.10.0



[PATCH 03/13] DRBD-receiver: Move an assignment in receive_uuids()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:37:42 +0200

Move one assignment for the local variable "updated_uuids" so that
its setting will only be performed after corresponding memory
allocations succeeded by this function.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index dab3f74..5526f6b 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4179,7 +4179,7 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
struct drbd_device *device;
struct p_uuids *p = pi->data;
u64 *p_uuid;
-   int i, updated_uuids = 0;
+   int i, updated_uuids;
 
peer_device = conn_peer_device(connection, pi->vnr);
if (!peer_device)
@@ -4206,6 +4206,7 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
return -EIO;
}
 
+   updated_uuids = 0;
if (get_ldev(device)) {
int skip_initial_sync =
device->state.conn == C_CONNECTED &&
-- 
2.10.0



[PATCH 03/13] DRBD-receiver: Move an assignment in receive_uuids()

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:37:42 +0200

Move one assignment for the local variable "updated_uuids" so that
its setting will only be performed after corresponding memory
allocations succeeded by this function.

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index dab3f74..5526f6b 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4179,7 +4179,7 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
struct drbd_device *device;
struct p_uuids *p = pi->data;
u64 *p_uuid;
-   int i, updated_uuids = 0;
+   int i, updated_uuids;
 
peer_device = conn_peer_device(connection, pi->vnr);
if (!peer_device)
@@ -4206,6 +4206,7 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
return -EIO;
}
 
+   updated_uuids = 0;
if (get_ldev(device)) {
int skip_initial_sync =
device->state.conn == C_CONNECTED &&
-- 
2.10.0



[PATCH 02/13] DRBD-receiver: Delete an error message for a failed kmalloc_array() call

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:26:07 +0200

Omit an extra message for a memory allocation failure in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 3be9fbf..dab3f74 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4187,10 +4187,8 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
device = peer_device->device;
 
p_uuid = kmalloc_array(UI_EXTENDED_SIZE, sizeof(*p_uuid), GFP_NOIO);
-   if (!p_uuid) {
-   drbd_err(device, "kmalloc of p_uuid failed\n");
+   if (!p_uuid)
return false;
-   }
 
for (i = UI_CURRENT; i < UI_EXTENDED_SIZE; i++)
p_uuid[i] = be64_to_cpu(p->uuid[i]);
-- 
2.10.0



[PATCH 02/13] DRBD-receiver: Delete an error message for a failed kmalloc_array() call

2016-09-10 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 10 Sep 2016 19:26:07 +0200

Omit an extra message for a memory allocation failure in this function.

Link: 
http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf

Signed-off-by: Markus Elfring 
---
 drivers/block/drbd/drbd_receiver.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c 
b/drivers/block/drbd/drbd_receiver.c
index 3be9fbf..dab3f74 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4187,10 +4187,8 @@ static int receive_uuids(struct drbd_connection 
*connection, struct packet_info
device = peer_device->device;
 
p_uuid = kmalloc_array(UI_EXTENDED_SIZE, sizeof(*p_uuid), GFP_NOIO);
-   if (!p_uuid) {
-   drbd_err(device, "kmalloc of p_uuid failed\n");
+   if (!p_uuid)
return false;
-   }
 
for (i = UI_CURRENT; i < UI_EXTENDED_SIZE; i++)
p_uuid[i] = be64_to_cpu(p->uuid[i]);
-- 
2.10.0



  1   2   3   4   5   >