[PATCH v3 2/6] clk: sunxi-ng: Support multiple variable pre-dividers

2017-05-17 Thread Chen-Yu Tsai
On the A83T, the AHB1 clock has a shared pre-divider on the two
PLL-PERIPH clock parents. To support such instances of shared
pre-dividers, this patch extends the mux clock type to support
multiple variable pre-dividers.

As the pre-dividers are only used to calculate the rate, but
do not participate in the factorization process, this is fairly
straightforward.

Signed-off-by: Chen-Yu Tsai 
---
 drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 10 +-
 drivers/clk/sunxi-ng/ccu-sun6i-a31.c  | 10 +-
 drivers/clk/sunxi-ng/ccu-sun8i-a23.c  | 10 +-
 drivers/clk/sunxi-ng/ccu-sun8i-a33.c  | 10 +-
 drivers/clk/sunxi-ng/ccu-sun8i-h3.c   | 10 +-
 drivers/clk/sunxi-ng/ccu-sun8i-r.c| 10 +-
 drivers/clk/sunxi-ng/ccu-sun8i-v3s.c  | 10 +-
 drivers/clk/sunxi-ng/ccu_mux.c| 15 ---
 drivers/clk/sunxi-ng/ccu_mux.h| 13 -
 9 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c 
b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
index f54114c607df..2bb4cabf802f 100644
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
@@ -211,6 +211,9 @@ static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0);
 
 static const char * const ahb1_parents[] = { "osc32k", "osc24M",
 "axi", "pll-periph0" };
+static const struct ccu_mux_var_prediv ahb1_predivs[] = {
+   { .index = 3, .shift = 6, .width = 2 },
+};
 static struct ccu_div ahb1_clk = {
.div= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
 
@@ -218,11 +221,8 @@ static struct ccu_div ahb1_clk = {
.shift  = 12,
.width  = 2,
 
-   .variable_prediv= {
-   .index  = 3,
-   .shift  = 6,
-   .width  = 2,
-   },
+   .var_predivs= ahb1_predivs,
+   .n_var_predivs  = ARRAY_SIZE(ahb1_predivs),
},
 
.common = {
diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c 
b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
index df97e25aec76..4d6078fca9ac 100644
--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
+++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
@@ -195,6 +195,9 @@ static SUNXI_CCU_DIV_TABLE(axi_clk, "axi", "cpu",
 
 static const char * const ahb1_parents[] = { "osc32k", "osc24M",
 "axi", "pll-periph" };
+static const struct ccu_mux_var_prediv ahb1_predivs[] = {
+   { .index = 3, .shift = 6, .width = 2 },
+};
 
 static struct ccu_div ahb1_clk = {
.div= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
@@ -203,11 +206,8 @@ static struct ccu_div ahb1_clk = {
.shift  = 12,
.width  = 2,
 
-   .variable_prediv= {
-   .index  = 3,
-   .shift  = 6,
-   .width  = 2,
-   },
+   .var_predivs= ahb1_predivs,
+   .n_var_predivs  = ARRAY_SIZE(ahb1_predivs),
},
 
.common = {
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c 
b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
index 5c6d37bdf247..8a753ed0426d 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-a23.c
@@ -169,6 +169,9 @@ static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0);
 
 static const char * const ahb1_parents[] = { "osc32k", "osc24M",
 "axi" , "pll-periph" };
+static const struct ccu_mux_var_prediv ahb1_predivs[] = {
+   { .index = 3, .shift = 6, .width = 2 },
+};
 static struct ccu_div ahb1_clk = {
.div= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
 
@@ -176,11 +179,8 @@ static struct ccu_div ahb1_clk = {
.shift  = 12,
.width  = 2,
 
-   .variable_prediv= {
-   .index  = 3,
-   .shift  = 6,
-   .width  = 2,
-   },
+   .var_predivs= ahb1_predivs,
+   .n_var_predivs  = ARRAY_SIZE(ahb1_predivs),
},
 
.common = {
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c 
b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
index 8d38e6510e29..10b38dc46f75 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
@@ -180,6 +180,9 @@ static SUNXI_CCU_M(axi_clk, "axi", "cpux", 0x050, 0, 2, 0);
 
 static const char * const ahb1_parents[] = { "osc32k", "osc24M",
 "axi" , "pll-periph" };
+static const struct ccu_mux_var_prediv ahb1_predivs[] = {
+   { .index = 3, .shift = 6, .width = 2 },
+};
 static struct ccu_div ahb1_clk = {
.div= _SUNXI_CCU_DIV_FLAGS(4, 2, CLK_DIVIDER_POWER_OF_TWO),
 
@@ -187,11 +190,8 @@ static struct ccu_div ahb1_clk = {
.shift  = 12

Re: [PATCH] crypto: hifn_795x: Fix a handful of minor bugs spotted by eye

2017-05-17 Thread David Miller
From: Logan Gunthorpe 
Date: Wed, 17 May 2017 21:33:22 -0600

> 
> 
> On 17/05/17 09:26 PM, Herbert Xu wrote:
>> On Thu, May 18, 2017 at 11:25:06AM +0800, Herbert Xu wrote:
>>> On Fri, Apr 28, 2017 at 11:02:40AM -0600, Logan Gunthorpe wrote:
 * Cleaned up the formatting of ablkcipher_get arguments so it complies
   with kernel style
 * The offset in ablkcipher_get sould be added to the source, not the
   destination. We rename it to soffset for clarity.
 * dst++ should be dst=sg_next(dst)
 * We call kunmap_atomic earlier so we only have to do it once.
 * If ablkcipher_get fails, we should probably ensure the request
   completes with an error.
> 
>>> Please don't mix unrelated changes in the same patch.
> 
> Seriously? The patch is tiny and those are all incredibly minor changes.

Yes, seriously.

It is the only way to make your changes easy to review and audit.

Please do as Herbert is asking.


Re: [kbuild-all] [PATCH v4 2/3] hwmon: (adt7475) temperature smoothing

2017-05-17 Thread Guenter Roeck

On 05/17/2017 08:05 PM, Ye Xiaolong wrote:

On 05/16, Guenter Roeck wrote:

0day bot applied your patchset on top of commit 6eaaea1 ("hwmon: (pmbus) Add client 
driver for IR35221"),
is it wrong or you have some prerequisite patches?


Thanks for the info, seems we need to improve the kbuild bot by pulling the
latest tree before applying new patches.



No worries. I don't mind the occasional false positive. Better a false positive 
than a missed bug.



Just curiosity, I noticed you committed the missing patch bbb4dd0fff ("hwmon:
(adt7475) replace find_nearest() with find_closest()") at May 14, did you push
it to git.kernel.org immediately or sometime after that? Since 0day makes
mirror based on repos in git.kernel.org in this case.



I don't recall, sorry. Most likely I didn't push it immediately.

Guenter



Re: [PATCH 1/9] crypto: add hmac IPAD/OPAD constant

2017-05-17 Thread Herbert Xu
On Mon, Apr 24, 2017 at 04:16:21PM +0200, Corentin Labbe wrote:
> Many HMAC users directly use directly 0x36/0x5c values.
> It's better with crypto to use a name instead of directly some crypto
> constant.
> 
> This patch simply add HMAC_IPAD_VALUE/HMAC_OPAD_VALUE defines.
> 
> Signed-off-by: Corentin Labbe 
> ---
>  crypto/hmac.c | 4 ++--
>  include/crypto/hash.h | 3 +++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/crypto/hmac.c b/crypto/hmac.c
> index 72e38c0..4a997ce 100644
> --- a/crypto/hmac.c
> +++ b/crypto/hmac.c
> @@ -74,8 +74,8 @@ static int hmac_setkey(struct crypto_shash *parent,
>   memcpy(opad, ipad, bs);
>  
>   for (i = 0; i < bs; i++) {
> - ipad[i] ^= 0x36;
> - opad[i] ^= 0x5c;
> + ipad[i] ^= HMAC_IPAD_VALUE;
> + opad[i] ^= HMAC_OPAD_VALUE;
>   }
>  
>   return crypto_shash_init(shash) ?:
> diff --git a/include/crypto/hash.h b/include/crypto/hash.h
> index b5727bc..0f51ff1 100644
> --- a/include/crypto/hash.h
> +++ b/include/crypto/hash.h
> @@ -922,4 +922,7 @@ static inline void shash_desc_zero(struct shash_desc 
> *desc)
>sizeof(*desc) + crypto_shash_descsize(desc->tfm));
>  }
>  
> +#define HMAC_IPAD_VALUE 0x36
> +#define HMAC_OPAD_VALUE 0x5c
> +
>  #endif   /* _CRYPTO_HASH_H */

I think this should go into a header file specific to hmac.  Since
I don't see an existing hmac header file you should create one for it.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH 1/7] perf header: fail on write_padded error

2017-05-17 Thread David Carrillo-Cisneros
Do not proceed if write_padded error failed.

Also, add comments to remind that return value of write_*
functions in util/header.c do not return number of bytes written.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/util/header.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 948b2c5efb65..2415d41282d8 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -72,6 +72,7 @@ bool perf_header__has_feat(const struct perf_header *header, 
int feat)
return test_bit(feat, header->adds_features);
 }
 
+/* Return: 0 if succeded, -ERR if failed. */
 static int do_write(int fd, const void *buf, size_t size)
 {
while (size) {
@@ -87,6 +88,7 @@ static int do_write(int fd, const void *buf, size_t size)
return 0;
 }
 
+/* Return: 0 if succeded, -ERR if failed. */
 int write_padded(int fd, const void *bf, size_t count, size_t count_aligned)
 {
static const char zero_buf[NAME_ALIGN];
@@ -101,6 +103,7 @@ int write_padded(int fd, const void *bf, size_t count, 
size_t count_aligned)
 #define string_size(str)   \
(PERF_ALIGN((strlen(str) + 1), NAME_ALIGN) + sizeof(u32))
 
+/* Return: 0 if succeded, -ERR if failed. */
 static int do_write_string(int fd, const char *str)
 {
u32 len, olen;
@@ -3277,7 +3280,8 @@ int perf_event__synthesize_tracing_data(struct perf_tool 
*tool, int fd,
 */
tracing_data_put(tdata);
 
-   write_padded(fd, NULL, 0, padding);
+   if (write_padded(fd, NULL, 0, padding))
+   return -1;
 
return aligned_size;
 }
-- 
2.13.0.303.g4ebf302169-goog



[PATCH 7/7] perf tools: add feature header record to pipe-mode

2017-05-17 Thread David Carrillo-Cisneros
Add header record types to pipe-mode, reusing the functions
used in file-mode and leveraging the new struct feat_fd.

Add the perf_event__synthesize_feature event call back to
process the new header records.

Before this patch:

  $ perf record -o - -e cycles -c 10 sleep 1 | perf report --stdio
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  ...

After this patch:
  $ perf record -o - -e cycles -c 10 sleep 1 | perf report --stdio
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  # hostname : lphh7
  # os release : 4.11.0-dbx-up_perf
  # perf version : 4.11.rc6.g6277c80
  # arch : x86_64
  # nrcpus online : 72
  # nrcpus avail : 72
  # cpudesc : Intel(R) Xeon(R) CPU E5-2696 v3 @ 2.30GHz
  # cpuid : GenuineIntel,6,63,2
  # total memory : 263457192 kB
  # cmdline : /root/perf record -o - -e cycles -c 10 sleep 1
  # HEADER_CPU_TOPOLOGY info available, use -I to display
  # HEADER_NUMA_TOPOLOGY info available, use -I to display
  # pmu mappings: intel_bts = 6, uncore_imc_4 = 22, uncore_sbox_1 = 47, 
uncore_cbox_5 = 33, uncore_ha_0 = 16, uncore_cbox
   Percent |  Source code & Disassembly of kcore for cycles (9 samples)
  ...

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/builtin-annotate.c |   1 +
 tools/perf/builtin-inject.c   |   1 +
 tools/perf/builtin-record.c   |   7 ++
 tools/perf/builtin-report.c   |   1 +
 tools/perf/util/event.c   |  13 +++
 tools/perf/util/event.h   |  19 
 tools/perf/util/header.c  | 224 ++
 tools/perf/util/header.h  |   9 ++
 tools/perf/util/session.c |  12 +++
 tools/perf/util/tool.h|   3 +-
 10 files changed, 248 insertions(+), 42 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index ce44edc30c71..ffe28002dc4f 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -398,6 +398,7 @@ int cmd_annotate(int argc, const char **argv)
.attr   = perf_event__process_attr,
.build_id = perf_event__process_build_id,
.tracing_data   = perf_event__process_tracing_data,
+   .feature= perf_event__process_feature,
.ordered_events = true,
.ordering_requires_timestamps = true,
},
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index ea8db38eedd1..2b8032908fb2 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -770,6 +770,7 @@ int cmd_inject(int argc, const char **argv)
.finished_round = perf_event__repipe_oe_synth,
.build_id   = perf_event__repipe_op2_synth,
.id_index   = perf_event__repipe_op2_synth,
+   .feature= perf_event__repipe_op2_synth,
},
.input_name  = "-",
.samples = LIST_HEAD_INIT(inject.samples),
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ee7d0a82ccd0..a1bcb72b4195 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -799,6 +799,13 @@ static int record__synthesize(struct record *rec, bool 
tail)
return 0;
 
if (file->is_pipe) {
+   err = perf_event__synthesize_features(
+   tool, session, rec->evlist, process_synthesized_event);
+   if (err < 0) {
+   pr_err("Couldn't synthesize features.\n");
+   return err;
+   }
+
err = perf_event__synthesize_attrs(tool, session,
   process_synthesized_event);
if (err < 0) {
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 08c90d65a252..5a6917410469 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -717,6 +717,7 @@ int cmd_report(int argc, const char **argv)
.id_index= perf_event__process_id_index,
.auxtrace_info   = perf_event__process_auxtrace_info,
.auxtrace= perf_event__process_auxtrace,
+   .feature = perf_event__process_feature,
.ordered_events  = true,
.ordering_requires_timestamps = true,
},
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 142835c0ca0a..cef1322d2993 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -56,6 +56,19 @@ static const char *perf_event__names[] = {
[PERF_RECORD_STAT_ROUND]= "STAT_ROUND",
[PERF_RECORD_EVENT_UPDATE]  = "EVENT_UPDATE",
[PERF_RECORD_TIME_CONV] = "TIME_CONV",
+   [PERF_RECORD_HEADER_HO

[PATCH 5/7] perf header: use struct feat_fd for process and read

2017-05-17 Thread David Carrillo-Cisneros
As preparation for using header records in pipe mode, replace
int fd with struct feat_fd fd in process and read functions for
all header record types.

To reduce the boiler plate, define and use the FEAT_PROCESS_STR_FUN
macro for the common case of header records that are a simple string.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/util/header.c | 405 ++-
 tools/perf/util/header.h |   1 +
 2 files changed, 156 insertions(+), 250 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index e28770d12c1c..981f5e9685e2 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -141,27 +141,67 @@ static int do_write_string(struct feat_fd *fd, const char 
*str)
return write_padded(fd, str, olen, len);
 }
 
-static char *do_read_string(int fd, struct perf_header *ph)
+static int __do_read(struct feat_fd *fd, void *addr, ssize_t size)
+{
+   if (!fd->buf) {
+   ssize_t ret = readn(fd->fd, addr, size);
+
+   if (ret != (ssize_t)size)
+   return ret < 0 ? (int)ret : -1;
+   return 0;
+   }
+
+   assert((ssize_t)fd->size > fd->offset);
+   if (size > (ssize_t)fd->size - fd->offset)
+   return -1;
+
+   memcpy(addr, fd->buf + fd->offset, size);
+   fd->offset += size;
+
+   return 0;
+}
+
+static int do_read_u32(struct feat_fd *fd, u32 *addr)
+{
+   int ret;
+
+   ret = __do_read(fd, addr, sizeof(*addr));
+   if (ret)
+   return ret;
+
+   if (fd->ph->needs_swap)
+   *addr = bswap_32(*addr);
+   return 0;
+}
+
+static int do_read_u64(struct feat_fd *fd, u64 *addr)
+{
+   int ret;
+
+   ret = __do_read(fd, addr, sizeof(*addr));
+   if (ret)
+   return ret;
+
+   if (fd->ph->needs_swap)
+   *addr = bswap_64(*addr);
+   return 0;
+}
+
+static char *do_read_string(struct feat_fd *fd)
 {
-   ssize_t sz, ret;
u32 len;
char *buf;
 
-   sz = readn(fd, &len, sizeof(len));
-   if (sz < (ssize_t)sizeof(len))
+   if (do_read_u32(fd, &len))
return NULL;
 
-   if (ph->needs_swap)
-   len = bswap_32(len);
-
buf = malloc(len);
if (!buf)
return NULL;
 
-   ret = readn(fd, buf, len);
-   if (ret == (ssize_t)len) {
+   if (!__do_read(fd, buf, len)) {
/*
-* strings are padded by zeroes
+* note that strings are padded by zeroes
 * thus the actual strlen of buf
 * may be less than len
 */
@@ -1207,8 +1247,7 @@ static void free_event_desc(struct perf_evsel *events)
free(events);
 }
 
-static struct perf_evsel *
-read_event_desc(struct perf_header *ph, int fd)
+static struct perf_evsel *read_event_desc(struct feat_fd *fd)
 {
struct perf_evsel *evsel, *events = NULL;
u64 *id;
@@ -1218,20 +1257,12 @@ read_event_desc(struct perf_header *ph, int fd)
size_t msz;
 
/* number of events */
-   ret = readn(fd, &nre, sizeof(nre));
-   if (ret != (ssize_t)sizeof(nre))
+   if (do_read_u32(fd, &nre))
goto error;
 
-   if (ph->needs_swap)
-   nre = bswap_32(nre);
-
-   ret = readn(fd, &sz, sizeof(sz));
-   if (ret != (ssize_t)sizeof(sz))
+   if (do_read_u32(fd, &sz))
goto error;
 
-   if (ph->needs_swap)
-   sz = bswap_32(sz);
-
/* buffer to hold on file attr struct */
buf = malloc(sz);
if (!buf)
@@ -1253,25 +1284,22 @@ read_event_desc(struct perf_header *ph, int fd)
 * must read entire on-file attr struct to
 * sync up with layout.
 */
-   ret = readn(fd, buf, sz);
+   ret = __do_read(fd, buf, sz);
if (ret != (ssize_t)sz)
goto error;
 
-   if (ph->needs_swap)
+   if (fd->ph->needs_swap)
perf_event__attr_swap(buf);
 
memcpy(&evsel->attr, buf, msz);
 
-   ret = readn(fd, &nr, sizeof(nr));
-   if (ret != (ssize_t)sizeof(nr))
+   if (do_read_u32(fd, &nr))
goto error;
 
-   if (ph->needs_swap) {
-   nr = bswap_32(nr);
+   if (fd->ph->needs_swap)
evsel->needs_swap = true;
-   }
 
-   evsel->name = do_read_string(fd, ph);
+   evsel->name = do_read_string(fd);
 
if (!nr)
continue;
@@ -1283,11 +1311,8 @@ read_event_desc(struct perf_header *ph, int fd)
evsel->id = id;
 
for (j = 0 ; j < nr; j++) {
-   ret = readn(fd, id, sizeof(*id));
-   if (ret != (ssize_t)sizeof(*id))
+   

[PATCH 4/7] perf header: use struct feat_fd for print

2017-05-17 Thread David Carrillo-Cisneros
As preparation for using header records in pipe mode, replace
int fd with struct feat_fd fd in print functions for all header
record types.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/util/header.c | 104 ++-
 1 file changed, 49 insertions(+), 55 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 5ca603b7a7a3..e28770d12c1c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1117,62 +1117,56 @@ static int write_stat(struct feat_fd *fd __maybe_unused,
return 0;
 }
 
-static void print_hostname(struct perf_header *ph, int fd __maybe_unused,
-  FILE *fp)
+static void print_hostname(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# hostname : %s\n", ph->env.hostname);
+   fprintf(fp, "# hostname : %s\n", fd->ph->env.hostname);
 }
 
-static void print_osrelease(struct perf_header *ph, int fd __maybe_unused,
-   FILE *fp)
+static void print_osrelease(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# os release : %s\n", ph->env.os_release);
+   fprintf(fp, "# os release : %s\n", fd->ph->env.os_release);
 }
 
-static void print_arch(struct perf_header *ph, int fd __maybe_unused, FILE *fp)
+static void print_arch(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# arch : %s\n", ph->env.arch);
+   fprintf(fp, "# arch : %s\n", fd->ph->env.arch);
 }
 
-static void print_cpudesc(struct perf_header *ph, int fd __maybe_unused,
- FILE *fp)
+static void print_cpudesc(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# cpudesc : %s\n", ph->env.cpu_desc);
+   fprintf(fp, "# cpudesc : %s\n", fd->ph->env.cpu_desc);
 }
 
-static void print_nrcpus(struct perf_header *ph, int fd __maybe_unused,
-FILE *fp)
+static void print_nrcpus(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# nrcpus online : %u\n", ph->env.nr_cpus_online);
-   fprintf(fp, "# nrcpus avail : %u\n", ph->env.nr_cpus_avail);
+   fprintf(fp, "# nrcpus online : %u\n", fd->ph->env.nr_cpus_online);
+   fprintf(fp, "# nrcpus avail : %u\n", fd->ph->env.nr_cpus_avail);
 }
 
-static void print_version(struct perf_header *ph, int fd __maybe_unused,
- FILE *fp)
+static void print_version(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# perf version : %s\n", ph->env.version);
+   fprintf(fp, "# perf version : %s\n", fd->ph->env.version);
 }
 
-static void print_cmdline(struct perf_header *ph, int fd __maybe_unused,
- FILE *fp)
+static void print_cmdline(struct feat_fd *fd, FILE *fp)
 {
int nr, i;
 
-   nr = ph->env.nr_cmdline;
+   nr = fd->ph->env.nr_cmdline;
 
fprintf(fp, "# cmdline : ");
 
for (i = 0; i < nr; i++)
-   fprintf(fp, "%s ", ph->env.cmdline_argv[i]);
+   fprintf(fp, "%s ", fd->ph->env.cmdline_argv[i]);
fputc('\n', fp);
 }
 
-static void print_cpu_topology(struct perf_header *ph, int fd __maybe_unused,
-  FILE *fp)
+static void print_cpu_topology(struct feat_fd *fd, FILE *fp)
 {
+   struct perf_header *ph = fd->ph;
+   int cpu_nr = ph->env.nr_cpus_avail;
int nr, i;
char *str;
-   int cpu_nr = ph->env.nr_cpus_avail;
 
nr = ph->env.nr_sibling_cores;
str = ph->env.sibling_cores;
@@ -1312,9 +1306,9 @@ static int __desc_attr__fprintf(FILE *fp, const char 
*name, const char *val,
return fprintf(fp, ", %s = %s", name, val);
 }
 
-static void print_event_desc(struct perf_header *ph, int fd, FILE *fp)
+static void print_event_desc(struct feat_fd *fd, FILE *fp)
 {
-   struct perf_evsel *evsel, *events = read_event_desc(ph, fd);
+   struct perf_evsel *evsel, *events = read_event_desc(fd->ph, fd->fd);
u32 j;
u64 *id;
 
@@ -1344,20 +1338,18 @@ static void print_event_desc(struct perf_header *ph, 
int fd, FILE *fp)
free_event_desc(events);
 }
 
-static void print_total_mem(struct perf_header *ph, int fd __maybe_unused,
-   FILE *fp)
+static void print_total_mem(struct feat_fd *fd, FILE *fp)
 {
-   fprintf(fp, "# total memory : %Lu kB\n", ph->env.total_mem);
+   fprintf(fp, "# total memory : %llu kB\n", fd->ph->env.total_mem);
 }
 
-static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused,
-   FILE *fp)
+static void print_numa_topology(struct feat_fd *fd, FILE *fp)
 {
int i;
struct numa_node *n;
 
-   for (i = 0; i < ph->env.nr_numa_nodes; i++) {
-   n = &ph->env.numa_nodes[i];
+   for (i = 0; i < fd->ph->env.nr_numa_nodes; i++) {
+   n = &fd->ph->env.numa_nodes[i];
 
fprintf(fp, "# node%u meminfo  : total = %"PRIu64" kB,"
" free = %"PRIu64" kB\n",
@@ -1368,56 +1360,51 @@ static void print_numa_topology(struct per

[PATCH 6/7] perf tool: make show-info in perf report a tool attribute

2017-05-17 Thread David Carrillo-Cisneros
Although defined as exclusive of perf report and perf script, the
attribute show_full_info interacts with the full_only attributes
of feature_ops, that are defined for all commands.

Make show_full_info a tool attribute so that any perf_event__process_*
callbacks that access to feature_ops can access to it.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/builtin-report.c | 5 ++---
 tools/perf/builtin-script.c | 6 +++---
 tools/perf/util/tool.h  | 1 +
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 22478ff2b706..08c90d65a252 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -54,7 +54,6 @@ struct report {
struct perf_tooltool;
struct perf_session *session;
booluse_tui, use_gtk, use_stdio;
-   boolshow_full_info;
boolshow_threads;
boolinverted_callchain;
boolmem_mode;
@@ -806,7 +805,7 @@ int cmd_report(int argc, const char **argv)
 symbol__config_symfs),
OPT_STRING('C', "cpu", &report.cpu_list, "cpu",
   "list of cpus to profile"),
-   OPT_BOOLEAN('I', "show-info", &report.show_full_info,
+   OPT_BOOLEAN('I', "show-info", &report.tool.show_full_info,
"Display extended information about perf.data file"),
OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src,
"Interleave source code with assembly code (default)"),
@@ -1005,7 +1004,7 @@ int cmd_report(int argc, const char **argv)
 
if ((report.header || report.header_only) && !quiet) {
perf_session__fprintf_info(session, stdout,
-  report.show_full_info);
+  report.tool.show_full_info);
if (report.header_only) {
ret = 0;
goto error;
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d05aec491cff..1edfa0da0a6c 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2374,7 +2374,6 @@ int process_cpu_map_event(struct perf_tool *tool 
__maybe_unused,
 
 int cmd_script(int argc, const char **argv)
 {
-   bool show_full_info = false;
bool header = false;
bool header_only = false;
bool script_started = false;
@@ -2466,7 +2465,7 @@ int cmd_script(int argc, const char **argv)
 "Set the maximum stack depth when parsing the callchain, "
 "anything beyond the specified depth will be ignored. "
 "Default: kernel.perf_event_max_stack or " 
__stringify(PERF_MAX_STACK_DEPTH)),
-   OPT_BOOLEAN('I', "show-info", &show_full_info,
+   OPT_BOOLEAN('I', "show-info", &script.tool.show_full_info,
"display extended information from perf.data file"),
OPT_BOOLEAN('\0', "show-kernel-path", &symbol_conf.show_kernel_path,
"Show the path of [kernel.kallsyms]"),
@@ -2684,7 +2683,8 @@ int cmd_script(int argc, const char **argv)
return -1;
 
if (header || header_only) {
-   perf_session__fprintf_info(session, stdout, show_full_info);
+   perf_session__fprintf_info(session, stdout,
+  script.tool.show_full_info);
if (header_only)
goto out_delete;
}
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index 829471a1c6d7..795b2be7b51f 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -68,6 +68,7 @@ struct perf_tool {
boolordered_events;
boolordering_requires_timestamps;
boolnamespace_events;
+   boolshow_full_info;
 };
 
 #endif /* __PERF_TOOL_H */
-- 
2.13.0.303.g4ebf302169-goog



[PATCH 3/7] perf header: use struct feat_fd for write

2017-05-17 Thread David Carrillo-Cisneros
As preparation for using header records in pipe mode, replace
int fd with struct feat_fd fd in write functions for all header
record types.

Record types that are not used in pipe-mode (such as auxtrace) will
never be called with fd->buf set and fail if so.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/util/build-id.c |  10 ++-
 tools/perf/util/build-id.h |   4 +-
 tools/perf/util/header.c   | 194 +
 tools/perf/util/header.h   |   7 +-
 4 files changed, 140 insertions(+), 75 deletions(-)

diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 168cc49654e7..292e90db3924 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -330,7 +330,7 @@ bool dso__build_id_is_kmod(const struct dso *dso, char *bf, 
size_t size)
else
 
 static int write_buildid(const char *name, size_t name_len, u8 *build_id,
-pid_t pid, u16 misc, int fd)
+pid_t pid, u16 misc, struct feat_fd *fd)
 {
int err;
struct build_id_event b;
@@ -345,14 +345,15 @@ static int write_buildid(const char *name, size_t 
name_len, u8 *build_id,
b.header.misc = misc;
b.header.size = sizeof(b) + len;
 
-   err = writen(fd, &b, sizeof(b));
+   err = do_write(fd, &b, sizeof(b));
if (err < 0)
return err;
 
return write_padded(fd, name, name_len + 1, len);
 }
 
-static int machine__write_buildid_table(struct machine *machine, int fd)
+static int machine__write_buildid_table(struct machine *machine,
+   struct feat_fd *fd)
 {
int err = 0;
char nm[PATH_MAX];
@@ -397,7 +398,8 @@ static int machine__write_buildid_table(struct machine 
*machine, int fd)
return err;
 }
 
-int perf_session__write_buildid_table(struct perf_session *session, int fd)
+int perf_session__write_buildid_table(struct perf_session *session,
+ struct feat_fd *fd)
 {
struct rb_node *nd;
int err = machine__write_buildid_table(&session->machines.host, fd);
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index a96081121179..84e5e8a52970 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -9,6 +9,7 @@
 
 extern struct perf_tool build_id__mark_dso_hit_ops;
 struct dso;
+struct feat_fd;
 
 int build_id__sprintf(const u8 *build_id, int len, char *bf);
 int sysfs__sprintf_build_id(const char *root_dir, char *sbuild_id);
@@ -26,7 +27,8 @@ int build_id__mark_dso_hit(struct perf_tool *tool, union 
perf_event *event,
 int dsos__hit_all(struct perf_session *session);
 
 bool perf_session__read_build_ids(struct perf_session *session, bool 
with_hits);
-int perf_session__write_buildid_table(struct perf_session *session, int fd);
+int perf_session__write_buildid_table(struct perf_session *session,
+ struct feat_fd *fd);
 int perf_session__cache_build_ids(struct perf_session *session);
 
 char *build_id_cache__origname(const char *sbuild_id);
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2415d41282d8..5ca603b7a7a3 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -57,6 +57,14 @@ struct perf_file_attr {
struct perf_file_sectionids;
 };
 
+struct feat_fd {
+   struct perf_header *ph;
+   int fd;
+   void *buf;  /* Either buf != NULL or fd >= 0 */
+   ssize_t offset;
+   size_t size;
+};
+
 void perf_header__set_feat(struct perf_header *header, int feat)
 {
set_bit(feat, header->adds_features);
@@ -73,23 +81,36 @@ bool perf_header__has_feat(const struct perf_header 
*header, int feat)
 }
 
 /* Return: 0 if succeded, -ERR if failed. */
-static int do_write(int fd, const void *buf, size_t size)
+int do_write(struct feat_fd *fd, const void *buf, size_t size)
 {
-   while (size) {
-   int ret = write(fd, buf, size);
+   void *addr;
 
-   if (ret < 0)
-   return -errno;
+   if (!fd->buf) {
+   ssize_t ret = writen(fd->fd, buf, size);
 
-   size -= ret;
-   buf += ret;
+   if (ret != (ssize_t)size)
+   return ret < 0 ? (int)ret : -1;
+   return 0;
}
+retry:
+   if (size > (fd->size - fd->offset)) {
+   addr = realloc(fd->buf, fd->size << 1);
+   if (!addr)
+   return -ENOSPC;
+   fd->buf = addr;
+   fd->size <<= 1;
+   goto retry;
+   }
+
+   memcpy(fd->buf + fd->offset, buf, size);
+   fd->offset += size;
 
return 0;
 }
 
 /* Return: 0 if succeded, -ERR if failed. */
-int write_padded(int fd, const void *bf, size_t count, size_t count_aligned)
+int write_padded(struct feat_fd *fd, const void *bf,
+size_t count, size_t count_aligned)
 {
static c

[PATCH 2/7] perf util: add const modifier to buf in "writen" function

2017-05-17 Thread David Carrillo-Cisneros
Make buf in helper function "writen" constant to simplify
the life of its callers.

This requires to hack a cast of buf prior to passing it to "ion"
which is simpler than the alternative of reworking the "ion"
function to provide a read and a write paths, the latter with
constant buf argument.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/util/util.c | 6 --
 tools/perf/util/util.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 6450c75a6f5b..31ca7661e5fb 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -260,6 +260,7 @@ static ssize_t ion(bool is_read, int fd, void *buf, size_t 
n)
size_t left = n;
 
while (left) {
+   /* buf must be treated as const if !is_read. */
ssize_t ret = is_read ? read(fd, buf, left) :
write(fd, buf, left);
 
@@ -287,9 +288,10 @@ ssize_t readn(int fd, void *buf, size_t n)
 /*
  * Write exactly 'n' bytes or return an error.
  */
-ssize_t writen(int fd, void *buf, size_t n)
+ssize_t writen(int fd, const void *buf, size_t n)
 {
-   return ion(false, fd, buf, n);
+   /* ion does not modify buf. */
+   return ion(false, fd, (void *)buf, n);
 }
 
 size_t hex_width(u64 v)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 3852b6d3270a..e0881bf67fc9 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -57,7 +57,7 @@ int copyfile_mode(const char *from, const char *to, mode_t 
mode);
 int copyfile_offset(int fromfd, loff_t from_ofs, int tofd, loff_t to_ofs, u64 
size);
 
 ssize_t readn(int fd, void *buf, size_t n);
-ssize_t writen(int fd, void *buf, size_t n);
+ssize_t writen(int fd, const void *buf, size_t n);
 
 struct perf_event_attr;
 
-- 
2.13.0.303.g4ebf302169-goog



[PATCH 0/7] perf tool: add meta-data header support for pipe-mode

2017-05-17 Thread David Carrillo-Cisneros

(This is a rebased and updated version of Stephane Eranian's version
 in https://patchwork.kernel.org/patch/1499081/)
 
Up until now, meta-data was only available when perf record
was used in "regular" mode, i.e., generating a perf.data file.
For users depending on pipe mode, neither host or event header
information were gathered. This patch addresses this limitation.

The difficulty in pipe mode is that information needs to be written
sequentially to the pipe. Meta data headers are usually generated
(and also expected) at the beginning of the file (or piped output).
To solve this problem, we introduce new synthetic record types,
one for each meta-data type. The approach is similar to what
is *ALREADY* used for BUILD_ID and TRACING_DATA.

We have modified util/header.c such that the same routines are used
to generate and read the meta-data information regardless of pipe-mode
vs. regular mode. To make this work, we added a new struct called
feat_fd which encapsulates all the information necessary to read or
write meta-data information to a file/pipe or from a file/pipe.

With this patch, it is possible to get:
  $ perf record -o - -e cycles -c 10 sleep 1 | perf report --stdio
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.000 MB - ]
  # hostname : myhost
  # os release : 4.11.0-dbx-up_perf
  # perf version : 4.11.rc6.g6277c80
  # arch : x86_64
  # nrcpus online : 72
  # nrcpus avail : 72
  # cpudesc : Intel(R) Xeon(R) CPU E5-2696 v3 @ 2.30GHz
  # cpuid : GenuineIntel,6,63,2
  # total memory : 263457192 kB
  # cmdline : /root/perf record -o - -e cycles -c 10 sleep 1
  # HEADER_CPU_TOPOLOGY info available, use -I to display
  # HEADER_NUMA_TOPOLOGY info available, use -I to display
  # pmu mappings: intel_bts = 6, uncore_imc_4 = 22, uncore_sbox_1 = 47, 
uncore_cbox_5 = 33, uncore_ha_0 = 16, uncore_cbox
  Percent |  Source code & Disassembly of kcore for cycles (9 samples)
  ...


David Carrillo-Cisneros (7):
  perf header: fail on write_padded error
  perf util: add const modifier to buf in "writen" function
  perf header: use struct feat_fd for write
  perf header: use struct feat_fd for print
  perf header: use struct feat_fd for process and read
  perf tool: make show-info in perf report a tool attribute
  perf tools: add feature header record to pipe-mode

 tools/perf/builtin-annotate.c |   1 +
 tools/perf/builtin-inject.c   |   1 +
 tools/perf/builtin-record.c   |   6 +
 tools/perf/builtin-report.c   |   6 +-
 tools/perf/builtin-script.c   |   6 +-
 tools/perf/util/build-id.c|  10 +-
 tools/perf/util/build-id.h|   4 +-
 tools/perf/util/event.c   |  13 +
 tools/perf/util/event.h   |  19 +
 tools/perf/util/header.c  | 905 +++---
 tools/perf/util/header.h  |  17 +-
 tools/perf/util/session.c |  12 +
 tools/perf/util/tool.h|   4 +-
 tools/perf/util/util.c|   6 +-
 tools/perf/util/util.h|   2 +-
 15 files changed, 594 insertions(+), 418 deletions(-)

-- 
2.13.0.303.g4ebf302169-goog



[PATCH v3 11/16] drm/sis: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/sis/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/sis/Makefile b/drivers/gpu/drm/sis/Makefile
index 441c061..7bf4c13 100644
--- a/drivers/gpu/drm/sis/Makefile
+++ b/drivers/gpu/drm/sis/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 sis-y := sis_drv.o sis_mm.o
 
 obj-$(CONFIG_DRM_SIS)   += sis.o
-- 
2.7.4



[PATCH v3 03/16] drm/vmwgfx: fix include notation and remove -Iinclude/drm flag

2017-05-17 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/vmwgfx/Makefile | 3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 ++-
 7 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index aac17a6..a365330 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
vmwgfx_fb.o vmwgfx_ioctl.o vmwgfx_resource.o vmwgfx_buffer.o \
vmwgfx_fifo.o vmwgfx_irq.o vmwgfx_ldu.o vmwgfx_ttm_glue.o \
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 77cb7c6..99a7f4a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -25,8 +25,9 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
-#include "ttm/ttm_bo_api.h"
 
 /*
  * Size of inline command buffers. Try to make sure that a page size is a
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 443d1ed..bcc6d41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_user_context {
struct ttm_base_object base;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index 265c81e..6c026d7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -30,9 +30,10 @@
  * whenever the backing MOB is evicted.
  */
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
-#include 
 #include "vmwgfx_so.h"
 
 /**
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e57a0ba..6063c96 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -30,7 +30,7 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
+#include 
 #include "vmwgfx_msg.h"
 
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 92f8b1d..68f135c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -25,10 +25,11 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_binding.h"
-#include "ttm/ttm_placement.h"
 
 struct vmw_shader {
struct vmw_resource res;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7681341..5900cff 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -25,11 +25,12 @@
  *
  **/
 
+#include 
+
 #include "vmwgfx_drv.h"
 #include "vmwgfx_resource_priv.h"
 #include "vmwgfx_so.h"
 #include "vmwgfx_binding.h"
-#include 
 #include "device_include/svga3d_surfacedefs.h"
 
 
-- 
2.7.4



[PATCH v3 01/16] drm/vc4: fix include notation and remove -Iinclude/drm flag

2017-05-17 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

While we are here, use <...> instead of "..." for include/linux/*.h
and include/sound/*.h headers too.

Signed-off-by: Masahiro Yamada 
---

Changes in v3:
  - Rebase

 drivers/gpu/drm/vc4/Makefile|  2 --
 drivers/gpu/drm/vc4/vc4_crtc.c  | 14 +++---
 drivers/gpu/drm/vc4/vc4_dpi.c   | 16 
 drivers/gpu/drm/vc4/vc4_drv.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_drv.h   |  6 ++
 drivers/gpu/drm/vc4/vc4_dsi.c   | 28 ++--
 drivers/gpu/drm/vc4/vc4_hdmi.c  | 30 +++---
 drivers/gpu/drm/vc4/vc4_hvs.c   |  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c   | 12 ++--
 drivers/gpu/drm/vc4/vc4_plane.c |  9 +
 drivers/gpu/drm/vc4/vc4_v3d.c   |  6 +++---
 11 files changed, 62 insertions(+), 65 deletions(-)

diff --git a/drivers/gpu/drm/vc4/Makefile b/drivers/gpu/drm/vc4/Makefile
index ab687fb..25bd5d3 100644
--- a/drivers/gpu/drm/vc4/Makefile
+++ b/drivers/gpu/drm/vc4/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 # Please keep these build lists sorted!
 
 # core driver code
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 1b4dbe9..0bfc4d8 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -32,13 +32,13 @@
  * ones that set the clock.
  */
 
-#include "drm_atomic.h"
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "linux/clk.h"
-#include "drm_fb_cma_helper.h"
-#include "linux/component.h"
-#include "linux/of_device.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index c6d7039..39d6808 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -22,14 +22,14 @@
  * ALT2 function.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/of_graph.h"
-#include "linux/of_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 8639749..136bb42 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -31,7 +31,7 @@
 #include 
 #include 
 #include 
-#include "drm_fb_cma_helper.h"
+#include 
 #include 
 
 #include "uapi/drm/vc4_drm.h"
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index 5ba2813..a97556f 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -6,12 +6,10 @@
  * published by the Free Software Foundation.
  */
 
-#include "drmP.h"
-#include "drm_gem_cma_helper.h"
-#include "drm_gem_cma_helper.h"
-
 #include 
+#include 
 #include 
+#include 
 
 struct vc4_dev {
struct drm_device *dev;
diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index fdb3877..0ef41df 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -29,20 +29,20 @@
  * hopefully present.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "drm_mipi_dsi.h"
-#include "drm_panel.h"
-#include "linux/clk.h"
-#include "linux/clk-provider.h"
-#include "linux/completion.h"
-#include "linux/component.h"
-#include "linux/dmaengine.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_platform.h"
-#include "linux/pm_runtime.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 3c2723f6..ed63d4e 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -42,21 +42,21 @@
  * encoder block has CEC support.
  */
 
-#include "drm_atomic_helper.h"
-#include "drm_crtc_helper.h"
-#include "drm_edid.h"
-#include "linux/clk.h"
-#include "linux/component.h"
-#include "linux/i2c.h"
-#include "linux/of_address.h"
-#include "linux/of_gpio.h"
-#include "linux/of_platform.h"
-#include "linux/pm_runtime.h"
-#include "linux/rational.h"
-#include "sound/dmaengine_pcm.h"
-#include "sound/pcm_drm_eld.h"
-#include "sound/pcm_params.h"
-#include "sound/soc.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
 
diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index fd421ba..2b62fc5 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -22,7 +22,7 @@
  * each CRTC.
  */
 
-#include 

[PATCH v3 13/16] drm/tdfx: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/tdfx/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tdfx/Makefile b/drivers/gpu/drm/tdfx/Makefile
index 0379f29..74bd4ae3 100644
--- a/drivers/gpu/drm/tdfx/Makefile
+++ b/drivers/gpu/drm/tdfx/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 tdfx-y := tdfx_drv.o
 
 obj-$(CONFIG_DRM_TDFX) += tdfx.o
-- 
2.7.4



[PATCH v3 10/16] drm/savage: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/savage/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/savage/Makefile b/drivers/gpu/drm/savage/Makefile
index d8f84ac..cfd436b 100644
--- a/drivers/gpu/drm/savage/Makefile
+++ b/drivers/gpu/drm/savage/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y = -Iinclude/drm
 savage-y := savage_drv.o savage_bci.o savage_state.o
 
 obj-$(CONFIG_DRM_SAVAGE)+= savage.o
-- 
2.7.4



[PATCH v3 00/16] gpu/drm: remove -Iinclude/drm compiler flags from Makefile

2017-05-17 Thread Masahiro Yamada

Many Makefiles needed to add -Iinclude/drm as an include path,
but the right thing to do is to include headers in the form
  #include 

This series fixes the source files, then rip off -Iinclude/drm flags.

V3: rebased on commit bb2af9bda33 (drm-misc-next)


Masahiro Yamada (16):
  drm/vc4: fix include notation and remove -Iinclude/drm flag
  drm/virtio: fix include notation and remove -Iinclude/drm flag
  drm/vmwgfx: fix include notation and remove -Iinclude/drm flag
  drm/gma500: remove unneeded -Iinclude/drm compiler flag
  drm/i810: remove unneeded -Iinclude/drm compiler flag
  drm/i2c: remove unneeded -Iinclude/drm compiler flag
  drm/mga: remove unneeded -Iinclude/drm compiler flag
  drm/omap: remove unneeded -Iinclude/drm compiler flag
  drm/r128: remove unneeded -Iinclude/drm compiler flag
  drm/savage: remove unneeded -Iinclude/drm compiler flag
  drm/sis: remove unneeded -Iinclude/drm compiler flag
  drm/stm: remove unneeded -Iinclude/drm compiler flag
  drm/tdfx: remove unneeded -Iinclude/drm compiler flag
  drm/udl: remove unneeded -Iinclude/drm compiler flag
  drm/vgem: remove unneeded -Iinclude/drm compiler flag
  drm/via: remove unneeded -Iinclude/drm compiler flag

 drivers/gpu/drm/gma500/Makefile  |  1 -
 drivers/gpu/drm/i2c/Makefile |  2 --
 drivers/gpu/drm/i810/Makefile|  1 -
 drivers/gpu/drm/mga/Makefile |  1 -
 drivers/gpu/drm/omapdrm/Makefile |  1 -
 drivers/gpu/drm/r128/Makefile|  1 -
 drivers/gpu/drm/savage/Makefile  |  1 -
 drivers/gpu/drm/sis/Makefile |  1 -
 drivers/gpu/drm/stm/Makefile |  2 --
 drivers/gpu/drm/tdfx/Makefile|  1 -
 drivers/gpu/drm/udl/Makefile |  3 ---
 drivers/gpu/drm/vc4/Makefile |  2 --
 drivers/gpu/drm/vc4/vc4_crtc.c   | 14 +++---
 drivers/gpu/drm/vc4/vc4_dpi.c| 16 
 drivers/gpu/drm/vc4/vc4_drv.c|  2 +-
 drivers/gpu/drm/vc4/vc4_drv.h|  6 ++
 drivers/gpu/drm/vc4/vc4_dsi.c| 28 ++--
 drivers/gpu/drm/vc4/vc4_hdmi.c   | 30 +++---
 drivers/gpu/drm/vc4/vc4_hvs.c|  2 +-
 drivers/gpu/drm/vc4/vc4_kms.c| 12 ++--
 drivers/gpu/drm/vc4/vc4_plane.c  |  9 +
 drivers/gpu/drm/vc4/vc4_v3d.c|  6 +++---
 drivers/gpu/drm/vgem/Makefile|  1 -
 drivers/gpu/drm/via/Makefile |  1 -
 drivers/gpu/drm/virtio/Makefile  |  2 --
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c |  4 ++--
 drivers/gpu/drm/virtio/virtgpu_drv.h |  8 
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   |  5 +++--
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-
 drivers/gpu/drm/vmwgfx/Makefile  |  3 ---
 drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c   |  3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_context.c  |  3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c  |  3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c  |  2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c   |  3 ++-
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c  |  3 ++-
 37 files changed, 88 insertions(+), 107 deletions(-)

-- 
2.7.4



[PATCH v3 15/16] drm/vgem: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/vgem/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile
index bfcdea1..cb5d413 100644
--- a/drivers/gpu/drm/vgem/Makefile
+++ b/drivers/gpu/drm/vgem/Makefile
@@ -1,4 +1,3 @@
-ccflags-y := -Iinclude/drm
 vgem-y := vgem_drv.o vgem_fence.o
 
 obj-$(CONFIG_DRM_VGEM) += vgem.o
-- 
2.7.4



[PATCH v3 14/16] drm/udl: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/udl/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/udl/Makefile b/drivers/gpu/drm/udl/Makefile
index 195bcac..36f2e82 100644
--- a/drivers/gpu/drm/udl/Makefile
+++ b/drivers/gpu/drm/udl/Makefile
@@ -1,6 +1,3 @@
-
-ccflags-y := -Iinclude/drm
-
 udl-y := udl_drv.o udl_modeset.o udl_connector.o udl_encoder.o udl_main.o 
udl_fb.o udl_transfer.o udl_gem.o udl_dmabuf.o
 
 obj-$(CONFIG_DRM_UDL) := udl.o
-- 
2.7.4



[PATCH v3 06/16] drm/i2c: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/i2c/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 43aa33b..a77acfc 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
 
-- 
2.7.4



[PATCH v3 04/16] drm/gma500: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/gma500/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/Makefile b/drivers/gpu/drm/gma500/Makefile
index 190e55f..c1c8dc1 100644
--- a/drivers/gpu/drm/gma500/Makefile
+++ b/drivers/gpu/drm/gma500/Makefile
@@ -1,7 +1,6 @@
 #
 #  KMS driver for the GMA500
 #
-ccflags-y += -I$(srctree)/include/drm
 
 gma500_gfx-y += \
  accel_2d.o \
-- 
2.7.4



[PATCH v3 09/16] drm/r128: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/r128/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/r128/Makefile b/drivers/gpu/drm/r128/Makefile
index 1cc72ae..1a6700e 100644
--- a/drivers/gpu/drm/r128/Makefile
+++ b/drivers/gpu/drm/r128/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 r128-y   := r128_drv.o r128_cce.o r128_state.o r128_irq.o
 
 r128-$(CONFIG_COMPAT)   += r128_ioc32.o
-- 
2.7.4



[PATCH v3 02/16] drm/virtio: fix include notation and remove -Iinclude/drm flag

2017-05-17 Thread Masahiro Yamada
Include  instead of relative path from include/drm, then
remove the -Iinclude/drm compiler flag.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/virtio/Makefile  |  2 --
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c |  4 ++--
 drivers/gpu/drm/virtio/virtgpu_drv.h |  8 
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   |  5 +++--
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 10 +-
 6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
index 3fb8eac..7684f61 100644
--- a/drivers/gpu/drm/virtio/Makefile
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -2,8 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
-
 virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o \
diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c 
b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index f51240a..73dc990 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -24,8 +24,8 @@
  */
 
 #include 
+#include 
 
-#include "drmP.h"
 #include "virtgpu_drv.h"
 
 static int
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 2d29b01..63d35c7 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -29,8 +29,8 @@
 #include 
 #include 
 #include 
-#include "drmP.h"
-#include "drm/drm.h"
+#include 
+#include 
 
 #include "virtgpu_drv.h"
 static struct drm_driver driver;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 1328185..3a66abb 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -36,10 +36,10 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 
 #define DRIVER_NAME "virtio_gpu"
 #define DRIVER_DESC "virtio GPU"
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 61f3a96..06cb16d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -26,9 +26,10 @@
  */
 
 #include 
-#include "virtgpu_drv.h"
 #include 
-#include "ttm/ttm_execbuf_util.h"
+#include 
+
+#include "virtgpu_drv.h"
 
 static void convert_to_hw_box(struct virtio_gpu_box *dst,
  const struct drm_virtgpu_3d_box *src)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c 
b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 4e8e27d..c1f2af4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -25,11 +25,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH v3 08/16] drm/omap: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/omapdrm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/Makefile b/drivers/gpu/drm/omapdrm/Makefile
index 48b7b75..b391be7 100644
--- a/drivers/gpu/drm/omapdrm/Makefile
+++ b/drivers/gpu/drm/omapdrm/Makefile
@@ -6,7 +6,6 @@
 obj-y += dss/
 obj-y += displays/
 
-ccflags-y := -Iinclude/drm
 omapdrm-y := omap_drv.o \
omap_irq.o \
omap_debugfs.o \
-- 
2.7.4



[PATCH v3 16/16] drm/via: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/via/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/via/Makefile b/drivers/gpu/drm/via/Makefile
index d59e258..751fa8b 100644
--- a/drivers/gpu/drm/via/Makefile
+++ b/drivers/gpu/drm/via/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 via-y:= via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o 
via_video.o via_dmablit.o
 
 obj-$(CONFIG_DRM_VIA)  +=via.o
-- 
2.7.4



[PATCH v3 12/16] drm/stm: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/stm/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/stm/Makefile b/drivers/gpu/drm/stm/Makefile
index e114d45..a09ecf4 100644
--- a/drivers/gpu/drm/stm/Makefile
+++ b/drivers/gpu/drm/stm/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 stm-drm-y := \
drv.o \
ltdc.o
-- 
2.7.4



[PATCH v3 07/16] drm/mga: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/mga/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/mga/Makefile b/drivers/gpu/drm/mga/Makefile
index 6068478..49e972c 100644
--- a/drivers/gpu/drm/mga/Makefile
+++ b/drivers/gpu/drm/mga/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 mga-y := mga_drv.o mga_dma.o mga_state.o mga_warp.o mga_irq.o
 
 mga-$(CONFIG_COMPAT) += mga_ioc32.o
-- 
2.7.4



[PATCH v3 05/16] drm/i810: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Masahiro Yamada
With the include directives under include/drm/ fixed, this flag is
no longer needed.

Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/i810/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/i810/Makefile b/drivers/gpu/drm/i810/Makefile
index 43844ec..639f859 100644
--- a/drivers/gpu/drm/i810/Makefile
+++ b/drivers/gpu/drm/i810/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-ccflags-y := -Iinclude/drm
 i810-y := i810_drv.o i810_dma.o
 
 obj-$(CONFIG_DRM_I810) += i810.o
-- 
2.7.4



Re: [PATCH v2 15/29] drm/vc4: fix include notation and remove -Iinclude/drm flag

2017-05-17 Thread Masahiro Yamada
Hi Daniel,


2017-05-17 21:40 GMT+09:00 Daniel Vetter :
> On Mon, Apr 24, 2017 at 01:50:33PM +0900, Masahiro Yamada wrote:
>> Include  instead of relative path from include/drm, then
>> remove the -Iinclude/drm compiler flag.
>>
>> While we are here, use <...> instead of "..." for include/linux/*.h
>> headers too.
>>
>> Signed-off-by: Masahiro Yamada 
>
> This one doesn't apply anymore cleanly. Can you pls rebase onto latest
> linux-next? I'm going through the remaining patches, up to this all merged
> to drm-misc-next.
>
> Thanks, Daniel

I rebased this one as you suggested
and send v3 for the rest of the series.


Please note I am also adding

12/16 : drm/stm: remove unneeded -Iinclude/drm compiler flag

because a new user of -Iinclude/drm has appeared.


Thanks!




-- 
Best Regards
Masahiro Yamada


Re: [PATCH 4/4] mtd: mchp23k256: Add support for mchp23lcv1024

2017-05-17 Thread Chris Packham
On 17/05/17 17:39, Chris Packham wrote:
> The mchp23lcv1024 is software compatible with the mchp23k256, the
> only difference (from a software point of view) is the size. There
> is no way to detect the size so we must be told via a Device Tree.


I've just noticed that another difference between the 2 chips is 16-bit 
vs 24-bit addressing. So that will also need to be handled.


> 
> Signed-off-by: Chris Packham 
> ---
>   .../bindings/mtd/microchip,mchp23k256.txt   |  2 +-
>   drivers/mtd/devices/mchp23k256.c| 21 
> +++--
>   2 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt 
> b/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt
> index 25e5ad38b0f0..7328eb92a03c 100644
> --- a/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt
> +++ b/Documentation/devicetree/bindings/mtd/microchip,mchp23k256.txt
> @@ -3,7 +3,7 @@
>   Required properties:
>   - #address-cells, #size-cells : Must be present if the device has sub-nodes
> representing partitions.
> -- compatible : Must be "microchip,mchp23k256"
> +- compatible : Must be one of "microchip,mchp23k256" or 
> "microchip,mchp23lcv1024"
>   - reg : Chip-Select number
>   - spi-max-frequency : Maximum frequency of the SPI bus the chip can operate 
> at
>   
> diff --git a/drivers/mtd/devices/mchp23k256.c 
> b/drivers/mtd/devices/mchp23k256.c
> index 02c6b9dcbd3e..d1eba587633c 100644
> --- a/drivers/mtd/devices/mchp23k256.c
> +++ b/drivers/mtd/devices/mchp23k256.c
> @@ -21,6 +21,8 @@
>   #include 
>   #include 
>   
> +enum chips { mchp23k256, mchp23lcv1024 };
> +
>   struct mchp23k256_flash {
>   struct spi_device   *spi;
>   struct mutexlock;
> @@ -128,6 +130,7 @@ static int mchp23k256_probe(struct spi_device *spi)
>   struct mchp23k256_flash *flash;
>   struct flash_platform_data *data;
>   int err;
> + enum chips chip;
>   
>   flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL);
>   if (!flash)
> @@ -143,15 +146,28 @@ static int mchp23k256_probe(struct spi_device *spi)
>   
>   data = dev_get_platdata(&spi->dev);
>   
> + if (spi->dev.of_node)
> + chip = (enum chips)of_device_get_match_data(&spi->dev);
> + else
> + chip = mchp23k256;
> +
>   mtd_set_of_node(&flash->mtd, spi->dev.of_node);
>   flash->mtd.dev.parent   = &spi->dev;
>   flash->mtd.type = MTD_RAM;
>   flash->mtd.flags= MTD_CAP_RAM;
>   flash->mtd.writesize= 1;
> - flash->mtd.size = SZ_32K;
>   flash->mtd._read= mchp23k256_read;
>   flash->mtd._write   = mchp23k256_write;
>   
> + switch (chip){
> + case mchp23lcv1024:
> + flash->mtd.size = SZ_128K;
> + break;
> + default:
> + flash->mtd.size = SZ_32K;
> + break;
> + }
> +
>   flash->mtd.erasesize = PAGE_SIZE;
>   while (flash->mtd.size & (flash->mtd.erasesize - 1))
>   flash->mtd.erasesize >>= 1;
> @@ -172,7 +188,8 @@ static int mchp23k256_remove(struct spi_device *spi)
>   }
>   
>   static const struct of_device_id mchp23k256_of_table[] = {
> - { .compatible = "microchip,mchp23k256" },
> + { .compatible = "microchip,mchp23k256", .data = (void *)mchp23k256 },
> + { .compatible = "microchip,mchp23lcv1024", .data = (void 
> *)mchp23lcv1024 },
>   {}
>   };
>   MODULE_DEVICE_TABLE(of, mchp23k256_of_table);
> 



Re: [PATCH] scsi: remove useless variable assignment

2017-05-17 Thread James Bottomley
On Wed, 2017-05-17 at 19:30 -0500, Gustavo A. R. Silva wrote:
> Remove this assignment once the value stored in variable _k_ is
> overwritten after a few lines.
> 
> Addresses-Coverity-ID: 1226927
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/scsi/qlogicfas408.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/qlogicfas408.c
> b/drivers/scsi/qlogicfas408.c
> index c3a9151..269440a 100644
> --- a/drivers/scsi/qlogicfas408.c
> +++ b/drivers/scsi/qlogicfas408.c
> @@ -329,7 +329,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd
> *cmd)
>*/
>   if ((k = ql_wai(priv)))
>   return (k << 16);
> - k = inb(qbase + 5); /* should be 0x10, bus
> service */

That doesn't look right to me.  inb() is a statement which has an
effect on the I/O device regardless of whether the returned value is
used or discarded.  In this case I think it's being used to clear
pending interrupts, so removing it will likely cause a phase error.

James




Re: [PATCH 0/3] staging: android: ion: Minor clean ups and fixes

2017-05-17 Thread Sumit Semwal
Hi Archit,

On 17 May 2017 at 13:45, Archit Taneja  wrote:
> The recent ION clean ups introduced some leftover code that can be
> removed, and a bug that comes up if the call to dma_buf_map_attachment()
> from an importer fails. Fix these.
>
> Archit Taneja (3):
>   staging: android: ion: Remove unused members from ion_buffer
>   staging: android: ion: Remove ION_FLAG_CACHED_NEEDS_SYNC
>   staging: android: ion: Avoid calling free_duped_table() twice
>
Thanks for these patches! Please feel free to add my
Reviewed-by: Sumit Semwal 

>  drivers/staging/android/ion/ion.c  | 14 +++---
>  drivers/staging/android/ion/ion.h  | 14 --
>  drivers/staging/android/uapi/ion.h |  6 --
>  3 files changed, 3 insertions(+), 31 deletions(-)
>
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
>

Best,
Sumit.


[PATCH] drm/amd: include instead of "linux/delay.h"

2017-05-17 Thread Masahiro Yamada
Use <...> notation to include headers located in include/linux.
While we are here, tweak the includes order a bit to sort them
alphabetically.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c| 4 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c  | 2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 4 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 +++--
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 8 +---
 drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c  | 5 +++--
 6 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index ff4ae3d..963a9e0 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -22,10 +22,10 @@
  */
 
 #include "pp_debug.h"
-#include "linux/delay.h"
-#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include "cgs_common.h"
 #include "power_state.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
index f5e8fda..f6b4dd9 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c
@@ -21,8 +21,8 @@
  *
  */
 
+#include 
 #include 
-#include "linux/delay.h"
 #include "hwmgr.h"
 #include "amd_acpi.h"
 #include "pp_acpi.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 8f663ab..581374d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -21,11 +21,11 @@
  *
  */
 #include "pp_debug.h"
+#include 
+#include 
 #include 
 #include 
-#include 
 #include 
-#include "linux/delay.h"
 #include "pp_acpi.h"
 #include "ppatomctrl.h"
 #include "atombios.h"
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 8394955..f4ab81b 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -20,10 +20,11 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
+
+#include 
+#include 
 #include 
 #include 
-#include 
-#include "linux/delay.h"
 
 #include "hwmgr.h"
 #include "amd_powerplay.h"
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
index 1f6744a..39c7091 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
@@ -20,11 +20,13 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-#include 
+
+#include 
+#include 
 #include 
 #include 
-#include 
-#include "linux/delay.h"
+#include 
+
 #include "cgs_common.h"
 #include "smu/smu_8_0_d.h"
 #include "smu/smu_8_0_sh_mask.h"
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
index c0d7576..2e954a4 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smumgr.c
@@ -20,15 +20,16 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  */
-#include 
+
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "pp_instance.h"
 #include "smumgr.h"
 #include "cgs_common.h"
-#include "linux/delay.h"
 
 MODULE_FIRMWARE("amdgpu/topaz_smc.bin");
 MODULE_FIRMWARE("amdgpu/topaz_k_smc.bin");
-- 
2.7.4



[PATCH] drm/stm: add COMPILE_TEST to Kconfig

2017-05-17 Thread Masahiro Yamada
Add COMPILE_TEST for the compilation test coverage.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/stm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/Kconfig b/drivers/gpu/drm/stm/Kconfig
index 2c4817f..722ad11 100644
--- a/drivers/gpu/drm/stm/Kconfig
+++ b/drivers/gpu/drm/stm/Kconfig
@@ -1,6 +1,6 @@
 config DRM_STM
tristate "DRM Support for STMicroelectronics SoC Series"
-   depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM)
+   depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM || COMPILE_TEST)
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
-- 
2.7.4



Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

2017-05-17 Thread Minchan Kim
Hi Sergey,

On Wed, May 17, 2017 at 06:14:23PM +0900, Sergey Senozhatsky wrote:
> Hello Minchan,
> 
> On (05/17/17 17:32), Minchan Kim wrote:
> [..]
> > > what we can return now is a `partially updated' data, with some new
> > > and some stale pages. this is quite unlikely to end up anywhere good.
> > > am I wrong?
> > > 
> > > why does `rd block 4' in your case causes Oops? as a worst case scenario?
> > > application does not expect page to be 'all A' at this point. pages are
> > > likely to belong to some mappings/files/etc., and there is likely a data
> > > dependency between them, dunno C++ objects that span across pages or
> > > JPEG images, etc. so returning "new data   new data   stale data" is a bit
> > > fishy.
> > 
> > I thought more about it and start to confuse. :/
> 
> sorry, I'm not sure I see what's the source of your confusion :)
> 
> my point is - we should not let READ succeed if we know that WRITE
> failed. assume JPEG image example,

I don't think we shoul do it. I will write down my thought below. :)

> 
> 
> over-write block 1 aaa->xxx OK
> over-write block 2 bbb->yyy OK
> over-write block 3 ccc->zzz error
> 
> reading that JPEG file
> 
> read block 1 xxx OK
> read block 2 yyy OK
> read block 3 ccc OK   << we should not return OK here. because
>  "xxxyyyccc" is not the correct JPEG file
>  anyway.
> 
> do you agree that telling application that read() succeeded and at
> the same returning corrupted "xxxyyyccc" instead of "xxxyyyzzz" is
> not correct?

I don't agree. I *think* block device is a just dumb device so
zram doesn't need to know about any objects from the upper layer.
What zram should consider is basically read/write success or fail of
IO unit(maybe, BIO).

So if we assume each step from above example is bio unit, I think
it's no problem returns "xxxyyyccc".

What I meant "started confused" was about atomicity, not above
thing.

I think it's okay to return ccc instead of zzz but is it okay
zram to return "000", not "ccc" and "zzz"?
My conclusion is that it's okay now after discussion from one
of my FS friends.

Let's think about it.

FS requests write "aaa" to block 4 and fails by somethings
(H/W failure, S/W failure like ENOMEM). The interface to catch
the failure is the function registered by bio_endio which is
normally handles by AS_EIO by mappint_set_error as well as
PG_error flags of the page. In this case, FS assumes the block
4 can have stale data, not 'zzz' and 'ccc' because the device
was broken in the middle of write some data to a block if
the block device doesn't support atomic write(I guess it's
more popular) so it would be safe to consider the block
has garbage now rather than old value, new value.
(I hope I explain my thought well :/)

Having said that, I think everyone likes block device supports
atomicity(ie, old or new). so I am reluctant to change the
behavior for simple refactoring.

Thanks.


Re: [PATCH RFC 0/3] Improve stability of system clock

2017-05-17 Thread Richard Cochran
On Wed, May 17, 2017 at 04:06:07PM -0700, John Stultz wrote:
> On Wed, May 17, 2017 at 10:22 AM, Miroslav Lichvar  
> wrote:
> > Is there a better way to run the timekeeping code in an userspace
> > application? I suspect it would need something like the Linux Kernel
> > Library project.
> 
> I dunno. There's probably a cleaner way to go about it, but I also
> feel like the benefit of just having the test in the kernel tree is
> that it can be managed as a unified whole, rather then the test being
> a separate thing and always playing catchup to kernel changes.

I vaguely recall a rant on the list years ago from a Linux bigwhig
saying how we don't support that kind of thing.  But maybe it is my
imagination.  In any case, IMHO running user space tests for chunks of
kernel code can be quite useful.

Thanks,
Richard





Re: [PATCH] perf/x86/intel/cqm: Make sure the head event of cache_groups always has valid RMID

2017-05-17 Thread David Carrillo-Cisneros
On Tue, May 16, 2017 at 7:38 AM, Peter Zijlstra  wrote:
> On Thu, May 04, 2017 at 10:31:43AM +0800, Zefan Li wrote:
>> It is assumed that the head of cache_groups always has valid RMID,
>> which isn't true.
>>
>> When we deallocate RMID from conflicting events currently we don't
>> move them to the tail, and one of those events can happen to be in
>> the head. Another case is we allocate RMIDs for all the events except
>> the head event in intel_cqm_sched_in_event().
>>
>> Besides there's another bug that we retry rotating without resetting
>> nr_needed and start in __intel_cqm_rmid_rotate().
>>
>> Those bugs combined together led to the following oops.
>>
>> WARNING: at arch/x86/kernel/cpu/perf_event_intel_cqm.c:186 
>> __put_rmid+0x28/0x80()
>> ...
>>  [] __put_rmid+0x28/0x80
>>  [] intel_cqm_rmid_rotate+0xba/0x440
>>  [] process_one_work+0x17b/0x470
>>  [] worker_thread+0x11b/0x400
>> ...
>> BUG: unable to handle kernel NULL pointer dereference at   (null)

I ran into this bug long time ago but never found an easy way to
reproduce. Do you have one?

>> ...
>>  [] intel_cqm_rmid_rotate+0xba/0x440
>>  [] process_one_work+0x17b/0x470
>>  [] worker_thread+0x11b/0x400
>
> I've managed to forgot most if not all of that horror show. Vikas and
> David seem to be working on a replacement, but until such a time it
> would be good if this thing would not crash the kernel.
>
> Guys, could you have a look? To me it appears to mostly have the right
> shape, but like I said, I forgot most details...

The patch LGTM. I ran into this issues before and fixed them in a
similar but messier way, then the re-write started ...

>
>>
>> Cc: sta...@vger.kernel.org
>> Signed-off-by: Zefan Li 
Acked-by: David Carrillo-Cisneros 


Re: [PATCH 1/2] wcn36xx: Pass used skb to ieee80211_tx_status()

2017-05-17 Thread Bjorn Andersson
On Wed 17 May 06:14 PDT 2017, Johannes Berg wrote:

> On Thu, 2017-05-04 at 13:13 +, Kalle Valo wrote:
> > 
> > > > This code intentionally checked if TX status was requested, and
> > > > if not then it doesn't go to the effort of building it.
> > > > 
> > > 
> > > What I'm finding puzzling is the fact that the only caller of
> > > ieee80211_led_tx() is ieee80211_tx_status() and it seems like
> > > drivers, such as ath10k, call this for each packet handled - but
> > > I'm likely missing something.
> 
> Yes, many drivers do call it for each packet, and as such, this
> deficiency was never noted.
> 
> > > > As it is with your patch, it'll go and report the TX status
> > > > without any
> > > > TX status information - which is handled in
> > > > wcn36xx_dxe_tx_ack_ind()
> > > > for those frames needing it.
> > > > 
> > > 
> > > Right, it doesn't sound desired. However, during normal operation
> > > I'm not seeing IEEE80211_TX_CTL_REQ_TX_STATUS being set and as such
> > > ieee80211_led_tx() is never called.
> > 
> > So what's the conclusion? How do we get leds working?
> 
> Well, frankly, I never thought the TX LED was a super good idea - but
> it had been supported by the original code IIRC, so never removed. Some
> people like frantic blinking I guess ;-)
> 

It seems very important to a lot of people...


But if ieee80211_free_txskb() is the counterpart of
ieee80211_tx_status() then we should be able to push the
ieee80211_led_tx() call down into ieee80211_report_used_skb() and handle
both cases.

The ieee80211_free_txskb() seems to be used in various cases where we
discard skbs, but perhaps this is not an issue in reality.

> But I think the problem also applies to the throughput trigger thing,
> so perhaps we need to stick some LED feedback calls into other places,
> like _noskb() or provide an extra way to do it?
> 

Looking around it seems that we either have a call to free_txskb() or
one of the tx_status(); where the _noskb() would need some special
handling. Are there others or would it be reasonable to add a call in
this one "special" case?

Regards,
Bjorn


Re: [PATCH 8/8] serial: exar: Add support for IOT2040 device

2017-05-17 Thread Jan Kiszka
On 2017-05-13 15:54, Andy Shevchenko wrote:
> On Sat, May 13, 2017 at 10:29 AM, Jan Kiszka  wrote:
>> This implements the setup of RS232 and the switch-over to RS485 or RS422
>> for the Siemens IOT2040. That uses an EXAR XR17V352 with external logic
>> to switch between the different modes. The external logic is controlled
>> via MPIO pins of the EXAR controller.
>>
>> Only pin 10 can be exported as GPIO on the IOT2040. It is connected to
>> an LED.
>>
>> As the XR17V352 used on the IOT2040 is not equipped with an external
>> EEPROM, it cannot present itself as IOT2040-variant via subvendor/
>> subdevice IDs. Thus, we have to check via DMI for the target platform.
>>
>> Co-developed with Sascha Weisenberger.
>>
> 
> Please, refactor that using properly formed DMI structrure and use its
> callback and driver data facilities/

Could you point to a specific example? The callback of the dmi_system_id
structure is not designed to handle device initializations like this one
- not to speak of having those two different initialization points here.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux


Re: [PATCH 2/4] crypto: drbg wait for crypto op not signal safe

2017-05-17 Thread Herbert Xu
On Thu, May 11, 2017 at 02:53:43PM +0300, Gilad Ben-Yossef wrote:
> drbg_kcapi_sym_ctr() was using wait_for_completion_interruptible() to
> wait for completion of async crypto op but if a signal occurs it
> may return before DMA ops of HW crypto provider finish, thus
> corrupting the output buffer.
> 
> Resolve this by using wait_for_completion() instead.
> 
> Reported-by: Eric Biggers 
> Signed-off-by: Gilad Ben-Yossef 
> CC: sta...@vger.kernel.org

This patch doesn't even compile.  Please test your work first.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH 0/7] perf tool: add meta-data header support for pipe-mode

2017-05-17 Thread Andi Kleen
> The difficulty in pipe mode is that information needs to be written
> sequentially to the pipe. Meta data headers are usually generated
> (and also expected) at the beginning of the file (or piped output).
> To solve this problem, we introduce new synthetic record types,
> one for each meta-data type. The approach is similar to what
> is *ALREADY* used for BUILD_ID and TRACING_DATA.

The new headers need documentation in Documentation/perf.data-file-format.txt

-Andi


Re: [PATCH 5/8] gpio: exar: Fix reading of directions and values

2017-05-17 Thread Jan Kiszka
On 2017-05-13 15:36, Andy Shevchenko wrote:
> On Sat, May 13, 2017 at 10:29 AM, Jan Kiszka  wrote:
>> First, the logic for translating a register bit to the return code of
>> exar_get_direction and exar_get_value were wrong. And second, there was
>> a flip regarding the register bank in exar_get_direction.
> 
> Again, I wish it was tested in the first place.
> 
> After addressing below:
> FWIW:
> Reviewed-by: Andy Shevchenko 
> 
>> @@ -68,7 +68,7 @@ static int exar_get(struct gpio_chip *chip, unsigned int 
>> reg)
>> value = readb(exar_gpio->regs + reg);
>> mutex_unlock(&exar_gpio->lock);
>>
>> -   return !!value;
>> +   return value;
> 
> This one is correct.
> 
>> @@ -80,7 +80,7 @@ static int exar_get_direction(struct gpio_chip *chip, 
>> unsigned int offset)
>> addr = bank ? EXAR_OFFSET_MPIOSEL_HI : EXAR_OFFSET_MPIOSEL_LO;
>> val = exar_get(chip, addr) >> (offset % 8);
>>
>> -   return !!val;
>> +   return val & 1;
> 
> It should be rather
> 
> val = exar_get(chip, addr) & BIT(offset % 8);

That won't give us 0 or 1 as return value, thus would be incorrect.

> 
>>  }
>>
>>  static int exar_get_value(struct gpio_chip *chip, unsigned int offset)
>> @@ -89,10 +89,10 @@ static int exar_get_value(struct gpio_chip *chip, 
>> unsigned int offset)
>> unsigned int addr;
>> int val;
>>
>> -   addr = bank ? EXAR_OFFSET_MPIOLVL_LO : EXAR_OFFSET_MPIOLVL_HI;
>> +   addr = bank ? EXAR_OFFSET_MPIOLVL_HI : EXAR_OFFSET_MPIOLVL_LO;
> 
> Good catch!
> 
>> val = exar_get(chip, addr) >> (offset % 8);
>>
>> -   return !!val;
>> +   return val & 1;
> 
> Ditto (see above).
> 

Same here.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux


[scsi] 66de5f1b19: BUG:unable_to_handle_kernel

2017-05-17 Thread kernel test robot

FYI, we noticed the following commit:

commit: 66de5f1b197e175840a132f7ee8927bfc3ff92b3 ("scsi: Move 
scsi_device.cmd_list manipulation code")
https://github.com/bvanassche/linux for-next

in testcase: boot

on test machine: qemu-system-x86_64 -enable-kvm -cpu kvm64,+ssse3 -smp 2 -m 8G

caused below changes (please refer to attached dmesg/kmsg for entire 
log/backtrace):


+--+++
|  | 002c9890c6 
| 66de5f1b19 |
+--+++
| boot_successes   | 6  
| 0  |
| boot_failures| 4  
| 10 |
| invoked_oom-killer:gfp_mask=0x   | 4  
||
| Mem-Info | 4  
||
| Kernel_panic-not_syncing:Out_of_memory_and_no_killable_processes | 4  
||
| BUG:unable_to_handle_kernel  | 0  
| 10 |
| Oops:#[##]   | 0  
| 10 |
| Kernel_panic-not_syncing:Fatal_exception_in_interrupt| 0  
| 10 |
+--+++



[   38.475923] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   38.475979] IP: scsi_put_command+0x31/0x5d
[   38.475981] PGD 0 
[   38.475983] P4D 0 
[   38.475984] 
[   38.475989] Oops: 0002 [#1] SMP
[   38.476013] Modules linked in:
[   38.476021] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.11.0-12455-g66de5f1 
#1
[   38.476044] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
1.9.3-20161025_171302-gandalf 04/01/2014
[   38.476048] task: 88022a2c task.stack: c9c54000
[   38.476053] RIP: 0010:scsi_put_command+0x31/0x5d
[   38.476055] RSP: :88023fc03e30 EFLAGS: 00010082
[   38.476081] RAX: 0246 RBX: 880207e70d40 RCX: 
[   38.476084] RDX: 880207e70d80 RSI:  RDI: 
[   38.476086] RBP: 88023fc03e38 R08:  R09: 81121b01
[   38.476110] R10: 88023fc03d68 R11:  R12: 880207e70c00
[   38.476113] R13: 880207e70d40 R14: 88020801 R15: 
[   38.476118] FS:  () GS:88023fc0() 
knlGS:
[   38.476142] CS:  0010 DS:  ES:  CR0: 80050033
[   38.476144] CR2: 0008 CR3: 01e11000 CR4: 06f0
[   38.476175] Call Trace:
[   38.476178]  
[   38.476214]  scsi_end_request+0x130/0x17b
[   38.476241]  scsi_io_completion+0x1ce/0x49f
[   38.476246]  scsi_finish_command+0x113/0x11c
[   38.476272]  scsi_softirq_done+0xe5/0x107
[   38.476280]  blk_done_softirq+0x7c/0x83
[   38.476310]  __do_softirq+0xff/0x267
[   38.476339]  irq_exit+0x58/0x99
[   38.476345]  smp_apic_timer_interrupt+0x3d/0x48
[   38.476372]  apic_timer_interrupt+0x89/0x90
[   38.476402] RIP: 0010:console_unlock+0x221/0x42e
[   38.476404] RSP: :c9c57d58 EFLAGS: 0246 ORIG_RAX: 
ff10
[   38.476410] RAX:  RBX: 8212d220 RCX: 
[   38.476433] RDX: 03f9 RSI: 0046 RDI: 0246
[   38.476436] RBP: c9c57da0 R08:  R09: 
[   38.476439] R10: 81aa0735 R11: 8212d227 R12: 
[   38.476442] R13: 81f561c0 R14:  R15: 0040
[   38.476444]  
[   38.476474]  vprintk_emit+0x215/0x227
[   38.476503]  ? cnic_init+0x7f/0x7f
[   38.476507]  ? set_debug_rodata+0x17/0x17
[   38.476533]  vprintk_default+0x1d/0x1f
[   38.476537]  vprintk_func+0x4a/0x4c
[   38.476564]  printk+0x43/0x4b
[   38.476570]  bnx2x_init+0x1d/0xea
[   38.476574]  ? cnic_init+0x7f/0x7f
[   38.476600]  do_one_initcall+0x90/0x137
[   38.476605]  ? set_debug_rodata+0x17/0x17
[   38.476630]  kernel_init_freeable+0x179/0x1fc
[   38.476636]  ? rest_init+0x87/0x87
[   38.476661]  kernel_init+0xe/0xfa
[   38.47]  ret_from_fork+0x2c/0x40
[   38.476669] Code: 48 89 e5 53 48 8b 47 38 48 89 fb 48 8d 78 38 e8 70 84 4a 
00 48 8b 4b 40 48 8d 53 40 48 39 ca 75 02 0f 0b 48 8b 7b 40 48 8b 4b 48 <48> 89 
4f 08 48 89 39 48 8b 73 38 48 89 53 40 48 89 53 48 48 8d 
[   38.476988] RIP: scsi_put_command+0x31/0x5d RSP: 88023fc03e30
[   38.476990] CR2: 0008
[   38.477022] ---[ end trace ab7b630f48deb907 ]---


To reproduce:

git clone https://github.com/01org/lkp-tests.git
cd lkp-tests
bin/lkp qemu -k  job-script  # job-script is attached in this 
email



Thanks,
Kernel Test Robot
#
# Automatically generated file; D

Re: [PATCH v3 2/2] powerpc/mm/hugetlb: Add support for 1G huge pages

2017-05-17 Thread Michael Ellerman
"Aneesh Kumar K.V"  writes:

> POWER9 supports hugepages of size 2M and 1G in radix MMU mode. This patch
> enables the usage of 1G page size for hugetlbfs. This also update the helper
> such we can do 1G page allocation at runtime.
>
> We still don't enable 1G page size on DD1 version. This is to avoid doing
> workaround mentioned in commit: 6d3a0379ebdc8 (powerpc/mm: Add
> radix__tlb_flush_pte_p9_dd1()
>
> Signed-off-by: Aneesh Kumar K.V 
> ---
>  arch/powerpc/include/asm/book3s/64/hugetlb.h | 10 ++
>  arch/powerpc/mm/hugetlbpage.c|  7 +--
>  arch/powerpc/platforms/Kconfig.cputype   |  1 +
>  3 files changed, 16 insertions(+), 2 deletions(-)

I think this patch is OK, but it's very confusing because it doesn't
mention that it's only talking about *generic* gigantic page support.

We have existing support for gigantic pages on powerpc, on several
platforms. This patch appears to break that, but I think doesn't in
practice?

So can you make it a bit clearer in the commit message, and the code,
that this is only about enabling the generic gigantic page support, and
is unrelated to the arch-specific gigantic page support.

cheers

> diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h 
> b/arch/powerpc/include/asm/book3s/64/hugetlb.h
> index cd366596..5c28bd6f2ae1 100644
> --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h
> +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h
> @@ -50,4 +50,14 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct 
> vm_area_struct *vma,
>   else
>   return entry;
>  }
> +
> +#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
> +static inline bool gigantic_page_supported(void)
> +{
> + if (radix_enabled())
> + return true;
> + return false;
> +}
> +#endif
> +
>  #endif
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index a4f33de4008e..80f6d2ed551a 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -763,8 +763,11 @@ static int __init add_huge_page_size(unsigned long long 
> size)
>* Hash: 16M and 16G
>*/
>   if (radix_enabled()) {
> - if (mmu_psize != MMU_PAGE_2M)
> - return -EINVAL;
> + if (mmu_psize != MMU_PAGE_2M) {
> + if (cpu_has_feature(CPU_FTR_POWER9_DD1) ||
> + (mmu_psize != MMU_PAGE_1G))
> + return -EINVAL;
> + }
>   } else {
>   if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
>   return -EINVAL;
> diff --git a/arch/powerpc/platforms/Kconfig.cputype 
> b/arch/powerpc/platforms/Kconfig.cputype
> index 684e886eaae4..b76ef6637016 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -344,6 +344,7 @@ config PPC_STD_MMU_64
>  config PPC_RADIX_MMU
>   bool "Radix MMU Support"
>   depends on PPC_BOOK3S_64
> + select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
>   default y
>   help
> Enable support for the Power ISA 3.0 Radix style MMU. Currently this
> -- 
> 2.7.4


Re: [PATCH v8 06/08] iommu/ipmmu-vmsa: Use fwspec iommu_priv on ARM64

2017-05-17 Thread Magnus Damm
Hi Robin,

On Wed, May 17, 2017 at 11:29 PM, Robin Murphy  wrote:
> Hi Magnus,
>
> On 17/05/17 11:07, Magnus Damm wrote:
>> From: Magnus Damm 
>>
>> Convert from archdata to iommu_priv via iommu_fwspec on ARM64 but
>> let 32-bit ARM keep on using archdata for now.
>>
>> Once the 32-bit ARM code and the IPMMU driver is able to move over
>> to CONFIG_IOMMU_DMA=y then coverting to fwspec via ->of_xlate() will
>> be easy.
>>
>> For now fwspec ids and num_ids are not used to allow code sharing between
>> 32-bit and 64-bit ARM code inside the driver.
>
> That's not what I meant at all - this just looks like a crazy
> unmaintainable mess that's making things that much harder to unpick in
> future.
>
> Leaving the existing code fossilised and building up half of a second
> separate driver around it wrapped in ifdefs is not only hideous, it's
> more work in the end than simply pulling things into the right shape to
> begin with. What I meant was to start with the below (compile-tested
> only), and add the of_xlate support on top. AFAICS the arm/arm64
> differences overall should only come down to a bit of special-casing in
> add_device(), and (optionally) whether you outright reject
> IOMMU_DOMAIN_DMA or not.
>
> Sorry, but I just can't agree with the two-drivers-in-one approach.

Thanks for checking the code and sorry to disappoint you by not using
->ids[] and ->num_ids right away. The two-drivers-on-one approach
comes from wanting to use the same IOMMU driver on both 32-bit and
64-bit ARM architectures but the former is lacking IOMMU_DMA support
upstream.

Obviously using ->ids[] and ->num_ids is the right forward, and in my
mind it is only a question of time and merge order. I'm more than
happy to make use of your patch but I'm wondering if it will work on
32-bit ARM and R-Car Gen2 that currently does not use ->of_xlate(). I
can see that you're using iommu_fwspec_init() so it might work right
out of the box. Thanks for your help cooking up the patch by the way.

>From my side I was hoping on doing one larger feature jump for 32-bit
ARM by moving over to IOMMU_DMA=y together with ->of_xlate()and fwspec
at the same time. Doing minor increments of the legacy code that is
still using special mapping code instead of OMMU_DMA=y in case of
32-bit ARM just feels like a lot of potential breakage and little gain
to me.

What's the plan for supporting IOMMU_DMA=y on 32-bit ARM? Anything I
can do to help? Or do you prefer minor increments on 32-bit ARM over
larger feature jumps?

Let me know what you think. My plan is to revisit this topic early next week.

Cheers,

/ magnus


Re: [PATCH] crypto: tcrypt: don't disable irqs and wait

2017-05-17 Thread Herbert Xu
On Tue, Apr 25, 2017 at 11:25:40AM +0300, Gilad Ben-Yossef wrote:
> The tcrypt AEAD cycles speed tests disables irqs during the test, which is
> broken at the very least since commit
> '1425d2d17f7309c6 ("crypto: tcrypt - Fix AEAD speed tests")'
> adds a wait for completion as part of the test and probably since
> switching to the new AEAD API.
> 
> While the result of taking a cycle count diff may not mean much on SMP
> systems if the task migrates, it's good enough for tcrypt being the quick
> & dirty dev tool it is. It's also what all the other (i.e. hash) cycle
> speed tests do.
> 
> Signed-off-by: Gilad Ben-Yossef 
> Reported-by: Ofir Drang 

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH v3 06/16] drm/i2c: remove unneeded -Iinclude/drm compiler flag

2017-05-17 Thread Archit Taneja



On 05/18/2017 09:59 AM, Masahiro Yamada wrote:

With the include directives under include/drm/ fixed, this flag is
no longer needed.


Acked-by: Archit Taneja 



Signed-off-by: Masahiro Yamada 
---

Changes in v3: None

 drivers/gpu/drm/i2c/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 43aa33b..a77acfc 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -1,5 +1,3 @@
-ccflags-y := -Iinclude/drm
-
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o




--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


Re: [PATCH v5] of/pci: Fix memory leak in of_pci_get_host_bridge_resources

2017-05-17 Thread jeffy

Hi Bjorn,

On 05/18/2017 05:08 AM, Bjorn Helgaas wrote:

On Wed, Apr 05, 2017 at 10:28:22AM +0800, Jeffy Chen wrote:

Currently we only free the allocated resource struct when error.
This would cause memory leak after pci_free_resource_list.


I think I see the problem here.  The release path is this:

   pci_release_host_bridge_dev
 pci_free_resource_list
   resource_list_free
list_for_each_entry_safe(entry, tmp, head, node)
  resource_list_destroy_entry
resource_list_del
resource_list_free_entry
  kfree(entry)

but that frees only the struct resource_entry, not the struct resource
pointed to by entry->res.  Is that right?

right, that's the leak.



And this patch solves it for of_pci_get_host_bridge_resources() by
always making entry->res point to entry->__res, which is an element in
struct resource_entry, so it's sufficient to free the resource_entry.

The memory management here is pretty tangled.  I wonder if there's
some way to simplify it so it's easier to make sure everybody does it
correctly.  For example, could we remove the entry->res pointer
completely and force everybody to use entry->__res?
i've tried something like this in 
https://patchwork.kernel.org/patch/9638003/


but it turns out there are a few codes trying to use shared 
resources(entry->res pointer point to some common resources), for example:


./arch/tile/kernel/pci.c:307: 
pci_add_resource(&resources, &ioport_resource);
./arch/tile/kernel/pci.c:308: 
pci_add_resource(&resources, &iomem_resource);


so i tried to use IORESOURCE_AUTO to handle non-common(private) resources.


and i saw drivers/pnp/manager.c tried to handle something like this too, 
by manually free resources marked as IORESOURCE_AUTO:

static void pnp_clean_resource_table(struct pnp_dev *dev)
{
struct pnp_resource *pnp_res, *tmp;

list_for_each_entry_safe(pnp_res, tmp, &dev->resources, list) {
if (pnp_res->res.flags & IORESOURCE_AUTO)
pnp_free_resource(pnp_res);
}
}





Signed-off-by: Jeffy Chen 
---

Changes in v5:
Fix some careless compile errors.

Changes in v4:
Use IORESOURCE_AUTO to mark struct resources which could be copied.

Changes in v3:
Add some comments.

Changes in v2:
Don't change the resource_list_create_entry's behavior.

  drivers/of/of_pci.c | 51 ++-
  drivers/pci/bus.c   |  7 ++-
  2 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
index 0ee42c3..49233bf 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
@@ -189,9 +189,7 @@ int of_pci_get_host_bridge_resources(struct device_node 
*dev,
unsigned char busno, unsigned char bus_max,
struct list_head *resources, resource_size_t *io_base)
  {
-   struct resource_entry *window;
-   struct resource *res;
-   struct resource *bus_range;
+   struct resource res;
struct of_pci_range range;
struct of_pci_range_parser parser;
char range_type[4];
@@ -200,24 +198,21 @@ int of_pci_get_host_bridge_resources(struct device_node 
*dev,
if (io_base)
*io_base = (resource_size_t)OF_BAD_ADDR;

-   bus_range = kzalloc(sizeof(*bus_range), GFP_KERNEL);
-   if (!bus_range)
-   return -ENOMEM;
-
pr_info("host bridge %s ranges:\n", dev->full_name);

-   err = of_pci_parse_bus_range(dev, bus_range);
+   err = of_pci_parse_bus_range(dev, &res);
if (err) {
-   bus_range->start = busno;
-   bus_range->end = bus_max;
-   bus_range->flags = IORESOURCE_BUS;
-   pr_info("  No bus range found for %s, using %pR\n",
-   dev->full_name, bus_range);
+   res.start = busno;
+   res.end = bus_max;
+   res.flags = IORESOURCE_BUS;
+   pr_info("  No bus range found for %s\n", dev->full_name);
} else {
-   if (bus_range->end > bus_range->start + bus_max)
-   bus_range->end = bus_range->start + bus_max;
+   if (res.end > res.start + bus_max)
+   res.end = res.start + bus_max;
}
-   pci_add_resource(resources, bus_range);
+
+   res.flags |= IORESOURCE_AUTO;
+   pci_add_resource(resources, &res);

/* Check for ranges property */
err = of_pci_range_parser_init(&parser, dev);
@@ -244,24 +239,16 @@ int of_pci_get_host_bridge_resources(struct device_node 
*dev,
if (range.cpu_addr == OF_BAD_ADDR || range.size == 0)
continue;

-   res = kzalloc(sizeof(struct resource), GFP_KERNEL);
-   if (!res) {
-   err = -ENOMEM;
-   goto parse_failed;
-   }
-
-   err = of_pci_range_to_resource(&range, dev, res);
-   if 

[4.9.28] vmscan: shrink_slab: ext4_es_scan+0x0/0x150 negative objects to delete nr=-2147483624

2017-05-17 Thread Marc Burkhardt

Hi everybody,

tonight my dmesg was flooded with mesages like 

vmscan: shrink_slab: ext4_es_scan+0x0/0x150 negative objects to delete 
nr=-2147483624

Is that an integer overflow happening in ext4?

It's the first time I see this message. Any help on how to debug/reprocude this
are appreciated. Please advice if you want me to investigate this.

Bestregards,
Marc Burkhardt

-- 
Marc Burkhardt


Re: [PATCH 0/7] crypto: aesni: provide generic gcm(aes)

2017-05-17 Thread Herbert Xu
On Fri, Apr 28, 2017 at 06:11:55PM +0200, Sabrina Dubroca wrote:
> The current aesni AES-GCM implementation only offers support for
> rfc4106(gcm(aes)).  This makes some things a little bit simpler
> (handling of associated data and authentication tag), but it means
> that non-IPsec users of gcm(aes) have to rely on
> gcm_base(ctr-aes-aesni,ghash-clmulni), which is much slower.
> 
> This patchset adds handling of all valid authentication tag lengths
> and of any associated data length to the assembly code, and exposes a
> generic gcm(aes) AEAD algorithm to the crypto API.
> 
> With these patches, performance of MACsec on a single core increases
> by 40% (from 4.5Gbps to around 6.3Gbps).

All patches applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH] kexec/kdump: Minor Documentation updates for arm64 and Image

2017-05-17 Thread Bharat Bhushan
This patch have minor updates in Documentation for arm64i as
relocatable kernel.
Also this patch updates documentation for using uncompressed
image "Image" which is used for ARM64.

Signed-off-by: Bharat Bhushan 
---
 Documentation/kdump/kdump.txt | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 615434d..522ce13 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -112,8 +112,8 @@ There are two possible methods of using Kdump.
 2) Or use the system kernel binary itself as dump-capture kernel and there is
no need to build a separate dump-capture kernel. This is possible
only with the architectures which support a relocatable kernel. As
-   of today, i386, x86_64, ppc64, ia64 and arm architectures support 
relocatable
-   kernel.
+   of today, i386, x86_64, ppc64, ia64, arm and arm64 architectures support
+   relocatable kernel.
 
 Building a relocatable kernel is advantageous from the point of view that
 one does not have to build a second kernel for capturing the dump. But
@@ -361,6 +361,12 @@ to load dump-capture kernel.
--dtb= \
--append="root= "
 
+If you are using a uncompressed Image, then use following command
+to load dump-capture kernel.
+
+   kexec -p  \
+   --initrd= \
+   --append="root= "
 
 Please note, that --args-linux does not need to be specified for ia64.
 It is planned to make this a no-op on that architecture, but for now
-- 
1.9.3



Re: [PATCH 3/3] EDAC: mv64x60: replace in_le32/out_le32 with ioread32/iowrite32

2017-05-17 Thread Michael Ellerman
Borislav Petkov  writes:

> Top-posting so that the PPC list can see the whole patch below.
>
> Since I don't know PPC, let me add PPC ML to CC for a confirmation this
> change is correct.
>
> Which brings me to the tangential: this driver is from 2006-ish and
> is for some "Marvell MV64x60 Memory Controller kernel module for PPC
> platforms". If you're going to touch it, then you should test on the PPC
> hardware too, so that you don't break the driver there.
>
> Unless that hardware is obsolete now and we don't care and, and ..?
>
> Maybe someone has some insights...

Not really sorry.

I don't have one of those boards, so I can't test. Maybe someone else on
the list does?

I'd err on the side of the PPC hardware being obsolete and no one really
caring. If the driver is helpful on ARM then we may as well use it
there, if we can also avoid breaking it on PPC then great.

cheers


> On Fri, May 12, 2017 at 04:20:02PM +1200, Chris Packham wrote:
>> To allow this driver to be used on non-powerpc platforms it needs to use
>> io accessors suitable for all platforms.
>> 
>> Signed-off-by: Chris Packham 
>> ---
>>  drivers/edac/mv64x60_edac.c | 84 
>> ++---
>>  1 file changed, 42 insertions(+), 42 deletions(-)
>> 
>> diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
>> index ddc5082f7577..102ec29f864b 100644
>> --- a/drivers/edac/mv64x60_edac.c
>> +++ b/drivers/edac/mv64x60_edac.c
>> @@ -32,21 +32,21 @@ static void mv64x60_pci_check(struct edac_pci_ctl_info 
>> *pci)
>>  struct mv64x60_pci_pdata *pdata = pci->pvt_info;
>>  u32 cause;
>>  
>> -cause = in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>> +cause = ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>>  if (!cause)
>>  return;
>>  
>>  printk(KERN_ERR "Error in PCI %d Interface\n", pdata->pci_hose);
>>  printk(KERN_ERR "Cause register: 0x%08x\n", cause);
>>  printk(KERN_ERR "Address Low: 0x%08x\n",
>> -   in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_LO));
>> +   ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_LO));
>>  printk(KERN_ERR "Address High: 0x%08x\n",
>> -   in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_HI));
>> +   ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_HI));
>>  printk(KERN_ERR "Attribute: 0x%08x\n",
>> -   in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ATTR));
>> +   ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_ATTR));
>>  printk(KERN_ERR "Command: 0x%08x\n",
>> -   in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CMD));
>> -out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE, ~cause);
>> +   ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_CMD));
>> +iowrite32(~cause, pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>>  
>>  if (cause & MV64X60_PCI_PE_MASK)
>>  edac_pci_handle_pe(pci, pci->ctl_name);
>> @@ -61,7 +61,7 @@ static irqreturn_t mv64x60_pci_isr(int irq, void *dev_id)
>>  struct mv64x60_pci_pdata *pdata = pci->pvt_info;
>>  u32 val;
>>  
>> -val = in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>> +val = ioread32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>>  if (!val)
>>  return IRQ_NONE;
>>  
>> @@ -93,7 +93,7 @@ static int __init mv64x60_pci_fixup(struct platform_device 
>> *pdev)
>>  if (!pci_serr)
>>  return -ENOMEM;
>>  
>> -out_le32(pci_serr, in_le32(pci_serr) & ~0x1);
>> +iowrite32(ioread32(pci_serr) & ~0x1, pci_serr);
>>  iounmap(pci_serr);
>>  
>>  return 0;
>> @@ -161,10 +161,10 @@ static int mv64x60_pci_err_probe(struct 
>> platform_device *pdev)
>>  goto err;
>>  }
>>  
>> -out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE, 0);
>> -out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_MASK, 0);
>> -out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_MASK,
>> - MV64X60_PCIx_ERR_MASK_VAL);
>> +iowrite32(0, pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
>> +iowrite32(0, pdata->pci_vbase + MV64X60_PCI_ERROR_MASK);
>> +iowrite32(MV64X60_PCIx_ERR_MASK_VAL,
>> +  pdata->pci_vbase + MV64X60_PCI_ERROR_MASK);
>>  
>>  if (edac_pci_add_device(pci, pdata->edac_idx) > 0) {
>>  edac_dbg(3, "failed edac_pci_add_device()\n");
>> @@ -233,23 +233,23 @@ static void mv64x60_sram_check(struct 
>> edac_device_ctl_info *edac_dev)
>>  struct mv64x60_sram_pdata *pdata = edac_dev->pvt_info;
>>  u32 cause;
>>  
>> -cause = in_le32(pdata->sram_vbase + MV64X60_SRAM_ERR_CAUSE);
>> +cause = ioread32(pdata->sram_vbase + MV64X60_SRAM_ERR_CAUSE);
>>  if (!cause)
>>  return;
>>  
>>  printk(KERN_ERR "Error in internal SRAM\n");
>>  printk(KERN_ERR "Cause register: 0x%08x\n", cause);
>>  printk(KERN_ERR "Address Low: 0x%08x\n",
>> -   in_le32(pdata->sram_vbase + MV64X60_SRAM_ERR_ADDR_LO));
>> +   ioread32(pdata->sram_vbase + MV64X60_SRAM_

Re: [PATCH v2 00/29] gpu/drm: remove -Iinclude/drm compiler flags from Makefile

2017-05-17 Thread Daniel Vetter
On Mon, Apr 24, 2017 at 01:50:18PM +0900, Masahiro Yamada wrote:
> Many Makefiles needed to add -Iinclude/drm as an include path,
> but the right thing to do is to include headers in the form
>   #include 
> 
> This series fixes the source files, then rip off -Iinclude/drm flags.
> 
> 
> Masahiro Yamada (29):
>   drm: make drm_panel.h self-contained
>   drm/ttm: fix include notation and remove -Iinclude/drm flag
>   drm/amd: fix include notation and remove -Iinclude/drm flag
>   drm/ast: fix include notation and remove -Iinclude/drm flag
>   drm/bochs: fix include notation and remove -Iinclude/drm flag
>   drm/bridge: fix include notation and remove -Iinclude/drm flag
>   drm/cirrus: fix include notation and remove -Iinclude/drm flag
>   drm/hisilicon: fix include notation and remove -Iinclude/drm flag
>   drm/mgag200: fix include notation and remove -Iinclude/drm flag
>   drm/msm: fix include notation and remove -Iinclude/drm flag
>   drm/nouveau: fix include notation and remove -Iinclude/drm flag
>   drm/qxl: fix include notation and remove -Iinclude/drm flag
>   drm/radeon: fix include notation and remove -Iinclude/drm flag
>   drm/tilcdc: fix include notation and remove -Iinclude/drm flag
>   drm/vc4: fix include notation and remove -Iinclude/drm flag
>   drm/virtio: fix include notation and remove -Iinclude/drm flag
>   drm/vmwgfx: fix include notation and remove -Iinclude/drm flag
>   drm/gma500: remove unneeded -Iinclude/drm compiler flag
>   drm/i810: remove unneeded -Iinclude/drm compiler flag
>   drm/i2c: remove unneeded -Iinclude/drm compiler flag
>   drm/mga: remove unneeded -Iinclude/drm compiler flag
>   drm/omap: remove unneeded -Iinclude/drm compiler flag
>   drm/r128: remove unneeded -Iinclude/drm compiler flag
>   drm/savage: remove unneeded -Iinclude/drm compiler flag
>   drm/sis: remove unneeded -Iinclude/drm compiler flag
>   drm/tdfx: remove unneeded -Iinclude/drm compiler flag
>   drm/udl: remove unneeded -Iinclude/drm compiler flag
>   drm/vgem: remove unneeded -Iinclude/drm compiler flag
>   drm/via: remove unneeded -Iinclude/drm compiler flag

Ok, I think I merged them all except the vc4 one. Can you please
rebase&resubmit that one?

Thanks, Daniel

> 
>  drivers/gpu/drm/amd/amdgpu/Makefile  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h  | 10 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  | 10 -
>  drivers/gpu/drm/amd/amdgpu/ci_dpm.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/ci_smc.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/cik.c |  2 +-
>  drivers/gpu/drm/amd/amdgpu/cik_ih.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/cz_ih.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c |  2 +-
>  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/iceland_ih.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/kv_dpm.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/kv_smc.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/psp_v3_1.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/si.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/si_dpm.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/si_ih.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/si_smc.c  |  2 +-
>  drivers/gpu/drm/amd/amdgpu/soc15.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/tonga_ih.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/vega10_ih.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/vi.c  |  2 +-
>  drivers/gpu/drm/amd/amdkfd/Makefile  |  2 +-
>  drivers/gpu/drm/amd/powerplay/Makefile   |  2 +-
>  drivers/gpu/drm/ast/Makefile |  2 --
>  drivers/gpu/drm/ast/ast_ttm.c|  3 ++-
>  drivers/gpu/drm/bochs/Makefile   |  1 -
>  drivers/gpu/drm/bochs/bochs.h|  4 ++--
>  drivers/gpu/drm/bridge/Makefile  |  2 --
>  drivers/gpu/drm/bridge/nxp-ptn3460.c | 12 +-
>  drivers/gpu/drm/bridge/parade-ps8622.c   | 10 -
>  drivers/gpu/drm/cirrus/Makefile  |  1 -
>  drivers/gpu/drm/cirrus/cirrus_ttm.c  |  3 ++-
>  drivers/gpu/drm/gma500/Makefile 

Re: [PATCH v1 2/2] hw_random: timeriomem_rng: Allow setting RNG quality from platform data

2017-05-17 Thread PrasannaKumar Muralidharan
Hi Rick,

Minor comment below.

On 18 May 2017 at 03:59, Rick Altherr  wrote:
> When a hw_random device's quality is non-zero, it will automatically be
> used to fill the kernel's entropy pool.  Since timeriomem_rng is used by
> many different devices, the quality needs to be provided by platform
> data or device tree.
>
> Signed-off-by: Rick Altherr 
> ---
>
>  drivers/char/hw_random/timeriomem-rng.c | 7 +++
>  include/linux/timeriomem-rng.h  | 3 +++
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/char/hw_random/timeriomem-rng.c 
> b/drivers/char/hw_random/timeriomem-rng.c
> index a0faa5f05deb..03ff5483d865 100644
> --- a/drivers/char/hw_random/timeriomem-rng.c
> +++ b/drivers/char/hw_random/timeriomem-rng.c
> @@ -151,8 +151,15 @@ static int timeriomem_rng_probe(struct platform_device 
> *pdev)
> dev_err(&pdev->dev, "missing period\n");
> return -EINVAL;
> }
> +
> +   if (!of_property_read_u32(pdev->dev.of_node,
> +   "quality", &i))
> +   priv->rng_ops.quality = i;
> +   else
> +   priv->rng_ops.quality = 0;
> } else {
> period = pdata->period;
> +   priv->rng_ops.quality = pdata->quality;
> }
>
> priv->period = ns_to_ktime(period * NSEC_PER_USEC);
> diff --git a/include/linux/timeriomem-rng.h b/include/linux/timeriomem-rng.h
> index 46eb27ddbfab..320f743bf06b 100644
> --- a/include/linux/timeriomem-rng.h
> +++ b/include/linux/timeriomem-rng.h
> @@ -13,4 +13,7 @@ struct timeriomem_rng_data {
>
> /* measures in usecs */
> unsigned intperiod;
> +
> +   /* bits of entropy per 1000 bits read */

Your dt-bindings patch says 'entropy per 1024 bits'. Please be consistent.

> +   unsigned intquality;
>  };
> --
> 2.13.0.303.g4ebf302169-goog
>

Regards,
PrasannaKumar


Re: [PATCH] kexec/kdump: Minor Documentation updates for arm64 and Image

2017-05-17 Thread Baoquan He
On 05/18/17 at 11:03am, Bharat Bhushan wrote:
> This patch have minor updates in Documentation for arm64i as
> relocatable kernel.
> Also this patch updates documentation for using uncompressed
> image "Image" which is used for ARM64.
> 
> Signed-off-by: Bharat Bhushan 
> ---
>  Documentation/kdump/kdump.txt | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
> index 615434d..522ce13 100644
> --- a/Documentation/kdump/kdump.txt
> +++ b/Documentation/kdump/kdump.txt
> @@ -112,8 +112,8 @@ There are two possible methods of using Kdump.
>  2) Or use the system kernel binary itself as dump-capture kernel and there is
> no need to build a separate dump-capture kernel. This is possible
> only with the architectures which support a relocatable kernel. As
> -   of today, i386, x86_64, ppc64, ia64 and arm architectures support 
> relocatable
> -   kernel.
> +   of today, i386, x86_64, ppc64, ia64, arm and arm64 architectures support
> +   relocatable kernel.
>  
>  Building a relocatable kernel is advantageous from the point of view that
>  one does not have to build a second kernel for capturing the dump. But
> @@ -361,6 +361,12 @@ to load dump-capture kernel.
> --dtb= \
> --append="root= "
>  
> +If you are using a uncompressed Image, then use following command
~ an
> +to load dump-capture kernel.
> +
> +   kexec -p  \
> +   --initrd= \
> +   --append="root= "
>  
>  Please note, that --args-linux does not need to be specified for ia64.
>  It is planned to make this a no-op on that architecture, but for now
> -- 
> 1.9.3
> 


[PATCH v1] drivers/staging/ccree: fix coding style issues

2017-05-17 Thread Dhiru Kholia
This patch fixes the "please, no space before tabs" warnings emitted by
checkpatch.pl script.

Signed-off-by: Dhiru Kholia 
---
 drivers/staging/ccree/cc_crypto_ctx.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/cc_crypto_ctx.h 
b/drivers/staging/ccree/cc_crypto_ctx.h
index 216d247..ac39d34 100644
--- a/drivers/staging/ccree/cc_crypto_ctx.h
+++ b/drivers/staging/ccree/cc_crypto_ctx.h
@@ -54,13 +54,13 @@
 #define CC_AES_KEY_SIZE_MAXCC_AES_256_BIT_KEY_SIZE
 #define CC_AES_KEY_SIZE_WORDS_MAX  (CC_AES_KEY_SIZE_MAX >> 2)
 
-#define CC_MD5_DIGEST_SIZE 16
-#define CC_SHA1_DIGEST_SIZE20
-#define CC_SHA224_DIGEST_SIZE  28
-#define CC_SHA256_DIGEST_SIZE  32
+#define CC_MD5_DIGEST_SIZE 16
+#define CC_SHA1_DIGEST_SIZE20
+#define CC_SHA224_DIGEST_SIZE  28
+#define CC_SHA256_DIGEST_SIZE  32
 #define CC_SHA256_DIGEST_SIZE_IN_WORDS 8
-#define CC_SHA384_DIGEST_SIZE  48
-#define CC_SHA512_DIGEST_SIZE  64
+#define CC_SHA384_DIGEST_SIZE  48
+#define CC_SHA512_DIGEST_SIZE  64
 
 #define CC_SHA1_BLOCK_SIZE 64
 #define CC_SHA1_BLOCK_SIZE_IN_WORDS 16
@@ -83,9 +83,9 @@
 
 #define CC_HMAC_BLOCK_SIZE_MAX CC_HASH_BLOCK_SIZE_MAX
 
-#define CC_MULTI2_SYSTEM_KEY_SIZE  32
-#define CC_MULTI2_DATA_KEY_SIZE8
-#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE   (CC_MULTI2_SYSTEM_KEY_SIZE + 
CC_MULTI2_DATA_KEY_SIZE)
+#define CC_MULTI2_SYSTEM_KEY_SIZE  32
+#define CC_MULTI2_DATA_KEY_SIZE8
+#define CC_MULTI2_SYSTEM_N_DATA_KEY_SIZE   (CC_MULTI2_SYSTEM_KEY_SIZE + 
CC_MULTI2_DATA_KEY_SIZE)
 #defineCC_MULTI2_BLOCK_SIZE8
 #defineCC_MULTI2_IV_SIZE   8
 #defineCC_MULTI2_MIN_NUM_ROUNDS8
-- 
2.7.4



Re: [net-intel-i40e] question about assignment overwrite

2017-05-17 Thread Jeff Kirsher
On Wed, 2017-05-17 at 15:48 -0500, Gustavo A. R. Silva wrote:
> While looking into Coverity ID 1408956 I ran into the following
> piece  
> of code at drivers/net/ethernet/intel/i40e/i40e_main.c:8807:
> 
> 8807    if (pf->hw.mac.type == I40E_MAC_X722) {
> 8808    pf->flags |= I40E_FLAG_RSS_AQ_CAPABLE
> 8809 | I40E_FLAG_128_QP_RSS_CAPABLE
> 8810 | I40E_FLAG_HW_ATR_EVICT_CAPABLE
> 8811 | I40E_FLAG_OUTER_UDP_CSUM_CAPABLE
> 8812 | I40E_FLAG_WB_ON_ITR_CAPABLE
> 8813 |
> I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE
> 8814 | I40E_FLAG_NO_PCI_LINK_CHECK
> 8815 | I40E_FLAG_USE_SET_LLDP_MIB
> 8816 | I40E_FLAG_GENEVE_OFFLOAD_CAPABLE
> 8817 | I40E_FLAG_PTP_L4_CAPABLE
> 8818 | I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE;
> 8819    } else if ((pf->hw.aq.api_maj_ver > 1) ||
> 8820   ((pf->hw.aq.api_maj_ver == 1) &&
> 8821    (pf->hw.aq.api_min_ver > 4))) {
> 8822    /* Supported in FW API version higher than 1.4 */
> 8823    pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
> 8824    pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
> 8825    } else {
> 8826    pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
> 8827    }
> 
> The issue here is that the assignment at line 8823 is overwritten
> by  
> the code at line 8824.
> 
> I'm suspicious that line 8824 should be remove and a patch like the  
> following can be applied:
> 
> index d5c9c9e..48ffa73 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -8821,7 +8821,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
>  (pf->hw.aq.api_min_ver > 4))) {
>  /* Supported in FW API version higher than 1.4 */
>  pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
> -   pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
>  } else {
>  pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE;
>  }
> 
> What do you think?

This issue is already fixed in my dev-queue branch on my next-queue
tree.

signature.asc
Description: This is a digitally signed message part


Re: Microchip USB Hub Driver Harmonization

2017-05-17 Thread Richard Leitner

On 05/17/2017 06:01 PM, Krzysztof Kozlowski wrote:

On Wed, May 17, 2017 at 12:58:38PM +0200, Richard Leitner wrote:

...

1. Currently usb251xb uses i2c_smbus_*, usb3503 uses regmap_* and
usb4604 uses i2c_master_* functions for the hub configuration. What
would be the preferred solution?


regmap? It is already widely used for I2C drivers. I think most (or even
all?) new I2C drivers use regmap. It hides the real bus between common
regmap API.


Ok. Thanks for that information. Then I will go for regmap.




2. What would be a good prefix for common headers/functions/macros/etc.?
I thought of "mcusbhub"... Would that be OK? Or are there any
conventions/better proposals on that?


If you are going to develop one driver for entire family, then you could
even choose just one name. Let's say the most generic.

I don't quite understand the meaning behind "harmonizing drivers".


I'm currently evaluating if it is feasible to create one common driver 
for all USB hubs. Due to the fact there are currently only 3 hub 
types implemented mainline (the Microchip homepage lists 36 USB Hub 
products [1]) it involves quite a lot data-sheet reading ;-)


As a first step (and also the final one if implementing a common driver 
is not feasible) I thought of creating a common header/source file which 
implements all "re-useable" functions/macros/etc. Would that also be an 
accepted solution?





3. Currently only usb3503 supports "platform data". Is this still needed
or may it be removed?


I think it is still used, e.g. by:
arch/arm/boot/dts/exynos5250-spring.dts


Please correct me if I'm wrong, but isn't that DT only?

The reason why I'm asking if it may be removed is because the only file 
including "linux/platform_data/usb3503.h" is the usb3503.c driver itself 
and it's also the only file using "struct usb3503_platform_data".


Thanks & kind regards,
RichardL

[1] 
https://www.microchip.com/design-centers/usb/usb-hubs-and-devices/products/overview


Re: [PATCH] kexec/kdump: Minor Documentation updates for arm64 and Image

2017-05-17 Thread Dave Young
Add Takahiro and Pratyush, they should be able to review the arm64 part.

On 05/18/17 at 11:03am, Bharat Bhushan wrote:
> This patch have minor updates in Documentation for arm64i as
> relocatable kernel.
> Also this patch updates documentation for using uncompressed
> image "Image" which is used for ARM64.
> 
> Signed-off-by: Bharat Bhushan 
> ---
>  Documentation/kdump/kdump.txt | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
> index 615434d..522ce13 100644
> --- a/Documentation/kdump/kdump.txt
> +++ b/Documentation/kdump/kdump.txt
> @@ -112,8 +112,8 @@ There are two possible methods of using Kdump.
>  2) Or use the system kernel binary itself as dump-capture kernel and there is
> no need to build a separate dump-capture kernel. This is possible
> only with the architectures which support a relocatable kernel. As
> -   of today, i386, x86_64, ppc64, ia64 and arm architectures support 
> relocatable
> -   kernel.
> +   of today, i386, x86_64, ppc64, ia64, arm and arm64 architectures support
> +   relocatable kernel.
>  
>  Building a relocatable kernel is advantageous from the point of view that
>  one does not have to build a second kernel for capturing the dump. But
> @@ -361,6 +361,12 @@ to load dump-capture kernel.
> --dtb= \
> --append="root= "
>  
> +If you are using a uncompressed Image, then use following command

s/a/an

> +to load dump-capture kernel.
> +
> +   kexec -p  \
> +   --initrd= \
> +   --append="root= "

For uncompressed Image, dtb is not necessary?

>  
>  Please note, that --args-linux does not need to be specified for ia64.
>  It is planned to make this a no-op on that architecture, but for now
> -- 
> 1.9.3
> 

Thanks
Dave


Re: [PATCH v1] staging: ccree: fix all whitespace errors

2017-05-17 Thread Dhiru Kholia
On Sun, May 14, 2017 at 08:53:02AM +0300, Gilad Ben-Yossef wrote:
> Hi Dhiru,
> 
> On Sat, May 13, 2017 at 5:52 PM, Dhiru Kholia  wrote:
> > These whitespace issues were found by the checkpatch.pl script. This
> > patch helps in making the staging tree a bit cleaner.
> >
> > Signed-off-by: Dhiru Kholia 
> > ---
> >  drivers/staging/ccree/TODO|   2 +-
> >  drivers/staging/ccree/cc_bitops.h |   6 +-
> >  drivers/staging/ccree/cc_crypto_ctx.h |   8 +--
> >  drivers/staging/ccree/cc_hal.h|   6 +-
> >  drivers/staging/ccree/cc_hw_queue_defs.h  | 116 
> > +++---
> >  drivers/staging/ccree/cc_lli_defs.h   |   6 +-
> >  drivers/staging/ccree/cc_pal_log.h|  12 ++--
> >  drivers/staging/ccree/cc_pal_log_plat.h   |   6 +-
> >  drivers/staging/ccree/cc_pal_types.h  |  42 +--
> >  drivers/staging/ccree/cc_pal_types_plat.h |   8 +--
> >  drivers/staging/ccree/cc_regs.h   |  10 +--
> >  11 files changed, 111 insertions(+), 111 deletions(-)
> 
> I'm sorry, but your patch doesn't apply after the recent patch set that
> removed some of those files.

True.

The good news is that my patch is no longer needed. The current ccree
code in linux-next seems to be free of any whitespace issues.

Thanks,
Dhiru


Re: [infiniband-hw-i40iw] question about identical code for different branches

2017-05-17 Thread Yuval Shaia
On Wed, May 17, 2017 at 05:06:54PM -0500, Gustavo A. R. Silva wrote:
> 
> Hello everybody,
> 
> While looking into Coverity ID 1362263 I ran into the following piece of
> code at drivers/infiniband/hw/i40iw/i40iw_virtchnl.c:445:
> 
> 445if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> 446if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> 447vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> 448else
> 449vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> 450return I40IW_SUCCESS;
> 451}
> 
> The issue is that lines of code 447 and 449 are identical for different
> branches.
> 
> My question here is if one of the branches should be modified, or the entire
> _if_ statement replaced?
> 
> Maybe a patch like the following could be applied:
> 
> index f4d1368..48fd327 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c
> @@ -443,10 +443,7 @@ enum i40iw_status_code i40iw_vchnl_recv_pf(struct
> i40iw_sc_dev *dev,
> if (!dev->vchnl_up)
> return I40IW_ERR_NOT_READY;
> if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> -   if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> -   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> -   else
> -   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> +   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> return I40IW_SUCCESS;
> }
> for (iw_vf_idx = 0; iw_vf_idx < I40IW_MAX_PE_ENABLED_VF_COUNT;
> iw_vf_idx++) {
> 
> What do you think?

This looks like a nice catch!

Reviewed-by: Yuval Shaia 

> 
> I'd really appreciate any comment on this.
> 
> Thank you!
> --
> Gustavo A. R. Silva
> 
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 2/2] powerpc/mm/hugetlb: Add support for 1G huge pages

2017-05-17 Thread Aneesh Kumar K.V



On Thursday 18 May 2017 10:51 AM, Michael Ellerman wrote:

"Aneesh Kumar K.V"  writes:


POWER9 supports hugepages of size 2M and 1G in radix MMU mode. This patch
enables the usage of 1G page size for hugetlbfs. This also update the helper
such we can do 1G page allocation at runtime.

We still don't enable 1G page size on DD1 version. This is to avoid doing
workaround mentioned in commit: 6d3a0379ebdc8 (powerpc/mm: Add
radix__tlb_flush_pte_p9_dd1()

Signed-off-by: Aneesh Kumar K.V 
---
  arch/powerpc/include/asm/book3s/64/hugetlb.h | 10 ++
  arch/powerpc/mm/hugetlbpage.c|  7 +--
  arch/powerpc/platforms/Kconfig.cputype   |  1 +
  3 files changed, 16 insertions(+), 2 deletions(-)


I think this patch is OK, but it's very confusing because it doesn't
mention that it's only talking about *generic* gigantic page support.



What you mean by generic gigantic page ? what is supported here is the 
gigantic page with size 1G alone ?




We have existing support for gigantic pages on powerpc, on several
platforms. This patch appears to break that, but I think doesn't in
practice?



What is broken ?



So can you make it a bit clearer in the commit message, and the code,
that this is only about enabling the generic gigantic page support, and
is unrelated to the arch-specific gigantic page support.

cheers


diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h 
b/arch/powerpc/include/asm/book3s/64/hugetlb.h
index cd366596..5c28bd6f2ae1 100644
--- a/arch/powerpc/include/asm/book3s/64/hugetlb.h
+++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h
@@ -50,4 +50,14 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct 
vm_area_struct *vma,
else
return entry;
  }
+
+#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
+static inline bool gigantic_page_supported(void)
+{
+   if (radix_enabled())
+   return true;
+   return false;
+}
+#endif
+
  #endif
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index a4f33de4008e..80f6d2ed551a 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -763,8 +763,11 @@ static int __init add_huge_page_size(unsigned long long 
size)
 * Hash: 16M and 16G
 */
if (radix_enabled()) {
-   if (mmu_psize != MMU_PAGE_2M)
-   return -EINVAL;
+   if (mmu_psize != MMU_PAGE_2M) {
+   if (cpu_has_feature(CPU_FTR_POWER9_DD1) ||
+   (mmu_psize != MMU_PAGE_1G))
+   return -EINVAL;
+   }
} else {
if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
return -EINVAL;
diff --git a/arch/powerpc/platforms/Kconfig.cputype 
b/arch/powerpc/platforms/Kconfig.cputype
index 684e886eaae4..b76ef6637016 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -344,6 +344,7 @@ config PPC_STD_MMU_64
  config PPC_RADIX_MMU
bool "Radix MMU Support"
depends on PPC_BOOK3S_64
+   select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA
default y
help
  Enable support for the Power ISA 3.0 Radix style MMU. Currently this
--
2.7.4






Re: [PATCH 1/3] ARM: davinci: da8xx: Create DSP device only when assigned memory

2017-05-17 Thread Sekhar Nori
On Wednesday 17 May 2017 03:43 AM, Suman Anna wrote:
> The DSP device on Davinci platforms does not have an MMU and requires
> specific DDR memory to boot. This memory is reserved using the rproc_mem
> kernel boot parameter and is assigned to the device on non-DT boots.
> The remoteproc core uses the DMA API and so will fall back to assigning
> random memory if this memory is not assigned to the device, but the DSP
> remote processor boot will not be successful in such cases. So, check
> that memory has been reserved and assigned to the device specifically
> before even creating the DSP device.
> 
> Signed-off-by: Suman Anna 
> ---
>  arch/arm/mach-davinci/devices-da8xx.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/arm/mach-davinci/devices-da8xx.c 
> b/arch/arm/mach-davinci/devices-da8xx.c
> index 7cf529ffbe5a..1ccf52e49886 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
> @@ -814,6 +814,8 @@ static struct platform_device da8xx_dsp = {
>   .resource   = da8xx_rproc_resources,
>  };
>  
> +static bool rproc_mem_inited __initdata;
> +
>  #if IS_ENABLED(CONFIG_DA8XX_REMOTEPROC)
>  
>  static phys_addr_t rproc_base __initdata;
> @@ -852,6 +854,8 @@ void __init da8xx_rproc_reserve_cma(void)
>   ret = dma_declare_contiguous(&da8xx_dsp.dev, rproc_size, rproc_base, 0);
>   if (ret)
>   pr_err("%s: dma_declare_contiguous failed %d\n", __func__, ret);
> + else
> + rproc_mem_inited = true;
>  }
>  
>  #else
> @@ -866,6 +870,12 @@ int __init da8xx_register_rproc(void)
>  {
>   int ret;
>  
> + if (!rproc_mem_inited) {
> + pr_warn("%s: memory not reserved for DSP, not registering DSP 
> device\n",
> + __func__);

We now have a warning and an error if dma_declare_contiguous() fails. I
like this message better. So can you replace the existing error message
with this text instead ?

Thanks,
Sekhar


RE: [PATCH] kexec/kdump: Minor Documentation updates for arm64 and Image

2017-05-17 Thread Bharat Bhushan


> -Original Message-
> From: Dave Young [mailto:dyo...@redhat.com]
> Sent: Thursday, May 18, 2017 11:29 AM
> To: Bharat Bhushan 
> Cc: b...@redhat.com; vgo...@redhat.com; cor...@lwn.net;
> ke...@lists.infradead.org; linux-...@vger.kernel.org; linux-
> ker...@vger.kernel.org; takahiro.aka...@linaro.org; pan...@redhat.com
> Subject: Re: [PATCH] kexec/kdump: Minor Documentation updates for
> arm64 and Image
> 
> Add Takahiro and Pratyush, they should be able to review the arm64 part.
> 
> On 05/18/17 at 11:03am, Bharat Bhushan wrote:
> > This patch have minor updates in Documentation for arm64i as
> > relocatable kernel.
> > Also this patch updates documentation for using uncompressed image
> > "Image" which is used for ARM64.
> >
> > Signed-off-by: Bharat Bhushan 
> > ---
> >  Documentation/kdump/kdump.txt | 10 --
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/kdump/kdump.txt
> > b/Documentation/kdump/kdump.txt index 615434d..522ce13 100644
> > --- a/Documentation/kdump/kdump.txt
> > +++ b/Documentation/kdump/kdump.txt
> > @@ -112,8 +112,8 @@ There are two possible methods of using Kdump.
> >  2) Or use the system kernel binary itself as dump-capture kernel and there
> is
> > no need to build a separate dump-capture kernel. This is possible
> > only with the architectures which support a relocatable kernel. As
> > -   of today, i386, x86_64, ppc64, ia64 and arm architectures support
> relocatable
> > -   kernel.
> > +   of today, i386, x86_64, ppc64, ia64, arm and arm64 architectures support
> > +   relocatable kernel.
> >
> >  Building a relocatable kernel is advantageous from the point of view
> > that  one does not have to build a second kernel for capturing the
> > dump. But @@ -361,6 +361,12 @@ to load dump-capture kernel.
> > --dtb= \
> > --append="root= "
> >
> > +If you are using a uncompressed Image, then use following command
> 
> s/a/an
> 
> > +to load dump-capture kernel.
> > +
> > +   kexec -p  \
> > +   --initrd= \
> > +   --append="root= "
> 
> For uncompressed Image, dtb is not necessary?

Yes dtb is not necessary, it works for me without giving dtb.

Thanks
-Bharat

> 
> >
> >  Please note, that --args-linux does not need to be specified for ia64.
> >  It is planned to make this a no-op on that architecture, but for now
> > --
> > 1.9.3
> >
> 
> Thanks
> Dave


Re: [PATCH v6 05/15] lockdep: Implement crossrelease feature

2017-05-17 Thread Byungchul Park
On Tue, May 16, 2017 at 04:18:46PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 25, 2017 at 02:40:44PM +0900, Byungchul Park wrote:
> > On Mon, Apr 24, 2017 at 12:17:47PM +0200, Peter Zijlstra wrote:
> 
> > > My complaint is mostly about naming.. and "hist_gen_id" might be a
> > > better name.
> > 
> > Ah, I also think the name, 'work_id', is not good... and frankly I am
> > not sure if 'hist_gen_id' is good, either. What about to apply 'rollback',
> > which I did for locks in irq, into works of workqueues? If you say yes,
> > I will try to do it.
> 
> If the rollback thing works, that's fine too. If it gets ugly, stick
> with something like 'hist_id'.

I really want to implement it with rollback.. But it also needs to
introduce new fields to distinguish between works which are all normal
process contexts.

I will do this with renaming instead of applying rollback.

Thank you.


Re: [RFC PATCH 6/6] drm/i915/gvt: support QEMU getting the dmabuf

2017-05-17 Thread Gerd Hoffmann
  Hi,

> > +static long intel_vgpu_dmabuf_mgr_fd_ioctl(struct file *filp,
> > +   unsigned int ioctl, unsigned long arg)
> > +{
> > +   struct intel_vgpu *vgpu = filp->private_data;
> > +   int minsz;
> > +   struct intel_vgpu_dmabuf dmabuf;
> > +   int ret;
> > +   struct fd f;
> > +   f = fdget(dmabuf.fd);
> > +   minsz = offsetofend(struct intel_vgpu_dmabuf, tiled);
> > +   if (copy_from_user(&dmabuf, (void __user *)arg, minsz))
> > +   return -EFAULT;
> > +   if (ioctl == INTEL_VGPU_QUERY_DMABUF)
> > +   ret = intel_gvt_ops->vgpu_query_dmabuf(vgpu, &dmabuf);
> > +   else if (ioctl == INTEL_VGPU_GENERATE_DMABUF)
> > +   ret = intel_gvt_ops->vgpu_generate_dmabuf(vgpu, &dmabuf);
> 
> Why do we need vendor specific ioctls here?  Aren't querying the
> current plane and getting an fd for that plane very generic concepts? 
> Is the resulting dmabuf Intel specific?

The dmabuf certainly isn't, and I think the ioctl interface can easily
be made pretty generic too.  The struct intel_vgpu_dmabuf hasn't much
intel-specific bits in there.  The only thing is the tiled bool, and I
think that can be replaced with a modifier code field (see
fourcc_mod_code() in drm/drm_fourcc.h).

Apparently the amd guys are working on vcpu support too, but using sriov
instead of mdev (saw this in the news only, have no more details).  They
can possibly support such an interface too.

cheers,
  Gerd



Re: 答复: [PATCH 1/2] PCI: dwc: kirin: add PCIe Driver for HiSilicon Kirin SoC

2017-05-17 Thread Guodong Xu
On Thu, May 18, 2017 at 9:50 AM, songxiaowei  wrote:
> Hi Arnd,
>
>
> On Fri, May 12, 2017 at 3:51 AM, Song Xiaowei  
> wrote:
>> From: songxiaowei 
>
> Looks good overall, just a few details:
>
> Please fix your ~/.gitconfig to contain the same real name ("Song Xiaowei"
> instead of "songxiaowei") that you use for sending the emails.
>
> [Xiaowei Song]  I'll fix this issue and update the patch.
>
>> +
>> +static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie) {
> ...
>> +   reg_val = kirin_apb_phy_readl(kirin_pcie, 0x400);
>> +   while (reg_val & pipe_clk_stable) {
>> +   udelay(100);
>> +   if (time == 0) {
>> +   dev_err(kirin_pcie->pci->dev, "PIPE clk is not 
>> stable\n");
>> +   return -EINVAL;
>> +   }
>> +   time--;
>> +   reg_val = kirin_apb_phy_readl(kirin_pcie, 0x400);
>> +   }
>
> If this is not called with interrupts disabled, please use a sleeping 
> function (e.g. msleep(1)) as the delay and compare against ktime_before() to 
> see how much total time has expired when waiting for a timeout, instead of 
> using a counter.
>
> [Xiaowei Song] This issue was fixed in the patch sent at 2017-5-15, and I'll 
> send it again.

Xiaowei,

Please make sure you add [PATCH v..] version information when you
making future updates. Eg.

$ git format-patch --subject-prefix="PATCH v3"

-Guodong


>
>> diff --git a/drivers/pci/dwc/pcie-kirin.h
>> b/drivers/pci/dwc/pcie-kirin.h new file mode 100644 index
>> ..ad9a3b427298
>> --- /dev/null
>> +++ b/drivers/pci/dwc/pcie-kirin.h
>> @@ -0,0 +1,79 @@
>> +/*
>> + * PCIe host controller driver for Kirin 960 SoCs
>> + *
>> + * Copyright (C) 2015 Huawei Electronics Co., Ltd.
>> + * http://www.huawei.com
>> + *
>> + * Author: Xiaowei Song 
>
> The header is only used in one .c file, so just remove it and add the 
> contents to that file.
>
> [songxiaowei] In new patch the header file was deleted,
>
>
> Thanks a lot.
>
> Best regard,
> Xiaowei.


cleanup UUID types V3

2017-05-17 Thread Christoph Hellwig
Hi all,

this series, which is a combined effort from Amir, Andy and me introduces
new uuid_t and guid_t type names that are less confusing than the existing
types, adds new helpers for them and starts switching the fs code over to
it.  Andy has additional patches on top to convert many of the users
that use char arrays for UUIDs and GUIDs to these (or rather a predecessor
for now until updated).

Changes since V3:
 - stop exposing uuid_be/uuid_t to userspace
 - remove uuid_be entirely

Changes since V2:
 - various cleanups


[PATCH 03/23] uuid: remove uuid_be defintions from the uapi header

2017-05-17 Thread Christoph Hellwig
We don't use uuid_be and the UUID_BE constants in any uapi headers, so make
them private to the kernel.

Signed-off-by: Christoph Hellwig 
---
 include/linux/uuid.h  | 15 +++
 include/uapi/linux/uuid.h | 16 
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 4dff73a89758..de3aea206562 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,6 +18,21 @@
 
 #include 
 
+typedef struct {
+   __u8 b[16];
+} uuid_be;
+
+#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
+((uuid_be) \
+{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((b) >> 8) & 0xff, (b) & 0xff,  \
+   ((c) >> 8) & 0xff, (c) & 0xff,  \
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
+
+#define NULL_UUID_BE   \
+   UUID_BE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
+   0x00, 0x00, 0x00, 0x00)
+
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 3738e5fb6a4d..0099756c4bac 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -24,10 +24,6 @@ typedef struct {
__u8 b[16];
 } uuid_le;
 
-typedef struct {
-   __u8 b[16];
-} uuid_be;
-
 #define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
 ((uuid_le) \
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
@@ -35,20 +31,8 @@ typedef struct {
(c) & 0xff, ((c) >> 8) & 0xff,  \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
-((uuid_be) \
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,  \
-   ((c) >> 8) & 0xff, (c) & 0xff,  \
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
 #define NULL_UUID_LE   \
UUID_LE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00)
 
-#define NULL_UUID_BE   \
-   UUID_BE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
-   0x00, 0x00, 0x00, 0x00)
-
-
 #endif /* _UAPI_LINUX_UUID_H_ */
-- 
2.11.0



[PATCH 01/23] xfs: use uuid_copy() helper to abstract uuid_t

2017-05-17 Thread Christoph Hellwig
From: Amir Goldstein 

uuid_t definition is about to change.

Signed-off-by: Amir Goldstein 
Signed-off-by: Christoph Hellwig 
---
 fs/xfs/xfs_inode_item.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 08cb7d1a4a3a..013cc78d7daf 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -834,9 +834,7 @@ xfs_inode_item_format_convert(
in_f->ilf_dsize = in_f32->ilf_dsize;
in_f->ilf_ino = in_f32->ilf_ino;
/* copy biggest field of ilf_u */
-   memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
-  in_f32->ilf_u.ilfu_uuid.__u_bits,
-  sizeof(uuid_t));
+   uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f32->ilf_u.ilfu_uuid);
in_f->ilf_blkno = in_f32->ilf_blkno;
in_f->ilf_len = in_f32->ilf_len;
in_f->ilf_boffset = in_f32->ilf_boffset;
@@ -851,9 +849,7 @@ xfs_inode_item_format_convert(
in_f->ilf_dsize = in_f64->ilf_dsize;
in_f->ilf_ino = in_f64->ilf_ino;
/* copy biggest field of ilf_u */
-   memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
-  in_f64->ilf_u.ilfu_uuid.__u_bits,
-  sizeof(uuid_t));
+   uuid_copy(&in_f->ilf_u.ilfu_uuid, &in_f64->ilf_u.ilfu_uuid);
in_f->ilf_blkno = in_f64->ilf_blkno;
in_f->ilf_len = in_f64->ilf_len;
in_f->ilf_boffset = in_f64->ilf_boffset;
-- 
2.11.0



[PATCH 09/23] S390/sysinfo: use uuid_is_null instead of opencoding it

2017-05-17 Thread Christoph Hellwig
.. and switch to use uuid_t instead of the old uuid_be type while we're
at it.

Signed-off-by: Christoph Hellwig 
---
 arch/s390/include/asm/sysinfo.h | 4 ++--
 arch/s390/kernel/sysinfo.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 73bff45ced55..e7f8e1b77d92 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -109,7 +109,7 @@ struct sysinfo_2_2_2 {
unsigned short cpus_shared;
char reserved_4[3];
unsigned char vsne;
-   uuid_be uuid;
+   uuid_t uuid;
char reserved_5[160];
char ext_name[256];
 };
@@ -134,7 +134,7 @@ struct sysinfo_3_2_2 {
char reserved_1[3];
unsigned char evmne;
unsigned int reserved_2;
-   uuid_be uuid;
+   uuid_t uuid;
} vm[8];
char reserved_3[1504];
char ext_names[8][256];
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index eefcb54872a5..fb869b103825 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -242,7 +242,7 @@ static void print_ext_name(struct seq_file *m, int lvl,
 
 static void print_uuid(struct seq_file *m, int i, struct sysinfo_3_2_2 *info)
 {
-   if (!memcmp(&info->vm[i].uuid, &NULL_UUID_BE, sizeof(uuid_be)))
+   if (uuid_is_null(&info->vm[i].uuid))
return;
seq_printf(m, "VM%02d UUID:%pUb\n", i, &info->vm[i].uuid);
 }
-- 
2.11.0



Re: [PATCH 1/2] mtd: nand: add generic helpers to check, match, maximize ECC settings

2017-05-17 Thread Masahiro Yamada
Hi Boris,



2017-05-15 20:54 GMT+09:00 Boris Brezillon :
> Hi Masahiro,
>
> Sorry for the late reply.
>
> On Mon, 8 May 2017 12:40:47 +0900
> Masahiro Yamada  wrote:
>
>> Hi Boris,
>>
>>
>> 2017-04-29 1:32 GMT+09:00 Boris Brezillon 
>> :
>>
>> >> + for (setting = caps->ecc_settings; setting->step; setting++) {
>> >> + /* If chip->ecc.size is already set, respect it. */
>> >> + if (chip->ecc.size && setting->step != chip->ecc.size)
>> >> + continue;
>> >> +
>> >> + /* If chip->ecc.strength is already set, respect it. */
>> >> + if (chip->ecc.strength &&
>> >> + setting->strength != chip->ecc.strength)
>> >> + continue;
>> >
>> > Hm, I don't get it. If chip->ecc.strength and chip->ecc.size are
>> > explicitly set, you should just call nand_check_ecc_caps() and skip
>> > nand_try_to_match_ecc_req(). Why would you call
>> > nand_try_to_match_ecc_req() in this case?
>>
>>
>> I want to call this function if
>> ecc.size is specified but ecc.strength is not
>> (or vice versa).
>
> That's not a valid combination. I accepted the case where
> nand-ecc-step-size is not defined in the DT just because sometime you
> only have one possible setting which is imposed by the controller. In
> this case ecc.size should be explicitly set by the driver not left to 0.
>
>>
>>
>> If both ecc.size and ecc.strength are already specified,
>> you are right, no need to call this function.
>> This function can check the sanity of the specified
>> combination of (step, strength), but this is the same
>> as what nand_check_ecc_caps() does.


I am working on the next version because I really need to
merge all of my Denali controller patches for my SoCs.


One question about this part.


   /* If chip->ecc.size is already set, respect it. */
   if (chip->ecc.size && step_size != chip->ecc.size)
   continue;

Does this make sense for nand_try_to_maximize_ecc()?

(In other words, can nand-ecc-maximize stand together with nand-ecc-step-size?)


-- 
Best Regards
Masahiro Yamada


[PATCH 07/23] uuid: hoist helpers uuid_equal() and uuid_copy() from xfs

2017-05-17 Thread Christoph Hellwig
These helper are used to compare and copy two uuid_t type objects.

Signed-off-by: Amir Goldstein 
[hch: also provide the respective guid_ versions]
Signed-off-by: Christoph Hellwig 
---
 fs/xfs/uuid.c|  6 --
 fs/xfs/uuid.h|  7 ---
 include/linux/uuid.h | 20 
 lib/test_uuid.c  |  4 ++--
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index b83f76b6d410..29ed78c8637b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -55,9 +55,3 @@ uuid_is_nil(uuid_t *uuid)
if (*cp++) return 0;/* not nil */
return 1;   /* is nil */
 }
-
-int
-uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
-{
-   return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? 0 : 1;
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 4f1441ba4fa5..86bbed071e79 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,13 +19,6 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
-static inline void
-uuid_copy(uuid_t *dst, uuid_t *src)
-{
-   memcpy(dst, src, sizeof(uuid_t));
-}
-
 #endif /* __XFS_SUPPORT_UUID_H__ */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 8bd1da4ec95d..7aff929007dd 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,26 @@ typedef struct {
  */
 #defineUUID_STRING_LEN 36
 
+static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
+{
+   return memcmp(u1, u2, sizeof(guid_t)) == 0;
+}
+
+static inline void guid_copy(guid_t *dst, const guid_t *src)
+{
+   memcpy(dst, src, sizeof(guid_t));
+}
+
+static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
+{
+   return memcmp(u1, u2, sizeof(uuid_t)) == 0;
+}
+
+static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
+{
+   memcpy(dst, src, sizeof(uuid_t));
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 9cad846fd805..4d05189e5f87 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -71,7 +71,7 @@ static void __init test_uuid_test(const struct test_uuid_data 
*data)
test_uuid_failed("conversion", false, false, data->uuid, NULL);
 
total_tests++;
-   if (uuid_le_cmp(data->le, le)) {
+   if (!guid_equal(&data->le, &le)) {
sprintf(buf, "%pUl", &le);
test_uuid_failed("cmp", false, false, data->uuid, buf);
}
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data 
*data)
test_uuid_failed("conversion", false, true, data->uuid, NULL);
 
total_tests++;
-   if (uuid_be_cmp(data->be, be)) {
+   if (uuid_equal(&data->be, &be)) {
sprintf(buf, "%pUb", &be);
test_uuid_failed("cmp", false, true, data->uuid, buf);
}
-- 
2.11.0



[PATCH 04/23] uuid: rename uuid types

2017-05-17 Thread Christoph Hellwig
Our "little endian" UUID really is a Wintel GUID, so rename it and its
helpers such (guid_t).  The big endian UUID is the only true one, so
give it the name uuid_t.  The uuid_le and uuid_be names are retained for
now, but will hopefully go away soon.  The exception to that are the _cmp
helpers that will be replaced by better primites ASAP and thus don't
get the new names.

Also remove the existing typedef in XFS that's now been superceeded by
the generic type name.

Signed-off-by: Christoph Hellwig 
[andy: also update the UUID_LE/UUID_BE macros including fallout]
Signed-off-by: Andy Shevchenko 
---
 fs/xfs/xfs_linux.h|  2 --
 include/linux/uuid.h  | 55 +++
 include/uapi/linux/uuid.h | 12 +++
 lib/test_uuid.c   | 32 +--
 lib/uuid.c| 28 
 lib/vsprintf.c|  4 ++--
 6 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 89ee5ec66837..2c33d915e550 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -39,8 +39,6 @@ typedef __s64 xfs_daddr_t;/*  type */
 typedef __u32  xfs_dev_t;
 typedef __u32  xfs_nlink_t;
 
-typedef uuid_beuuid_t;
-
 #include "xfs_types.h"
 
 #include "kmem.h"
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index de3aea206562..0410cd002282 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -20,19 +20,15 @@
 
 typedef struct {
__u8 b[16];
-} uuid_be;
+} uuid_t;
 
-#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
-((uuid_be) \
+#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)  \
+((uuid_t)  \
 {{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
((b) >> 8) & 0xff, (b) & 0xff,  \
((c) >> 8) & 0xff, (c) & 0xff,  \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
 
-#define NULL_UUID_BE   \
-   UUID_BE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
-   0x00, 0x00, 0x00, 0x00)
-
 /*
  * V1 (time-based) UUID definition [RFC 4122].
  * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
@@ -63,27 +59,40 @@ struct uuid_v1 {
  */
 #defineUUID_STRING_LEN 36
 
-static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
-{
-   return memcmp(&u1, &u2, sizeof(uuid_le));
-}
-
-static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
-{
-   return memcmp(&u1, &u2, sizeof(uuid_be));
-}
-
 void generate_random_uuid(unsigned char uuid[16]);
 
-extern void uuid_le_gen(uuid_le *u);
-extern void uuid_be_gen(uuid_be *u);
+extern void guid_gen(guid_t *u);
+extern void uuid_gen(uuid_t *u);
 
 bool __must_check uuid_is_valid(const char *uuid);
 
-extern const u8 uuid_le_index[16];
-extern const u8 uuid_be_index[16];
+extern const u8 guid_index[16];
+extern const u8 uuid_index[16];
+
+int guid_to_bin(const char *uuid, guid_t *u);
+int uuid_to_bin(const char *uuid, uuid_t *u);
 
-int uuid_le_to_bin(const char *uuid, uuid_le *u);
-int uuid_be_to_bin(const char *uuid, uuid_be *u);
+/* backwards compatibility, don't use in new code */
+typedef uuid_t uuid_be;
+#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+   UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
+#define NULL_UUID_BE   \
+   UUID_BE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
+0x00, 0x00, 0x00, 0x00)
+
+#define uuid_le_gen(u) guid_gen(u)
+#define uuid_be_gen(u) uuid_gen(u)
+#define uuid_le_to_bin(guid, u)guid_to_bin(guid, u)
+#define uuid_be_to_bin(uuid, u)uuid_to_bin(uuid, u)
+
+static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
+{
+   return memcmp(&u1, &u2, sizeof(guid_t));
+}
+
+static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
+{
+   return memcmp(&u1, &u2, sizeof(uuid_t));
+}
 
 #endif
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
index 0099756c4bac..1eeeca973315 100644
--- a/include/uapi/linux/uuid.h
+++ b/include/uapi/linux/uuid.h
@@ -22,17 +22,21 @@
 
 typedef struct {
__u8 b[16];
-} uuid_le;
+} guid_t;
 
-#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)   \
-((uuid_le) \
+#define GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)  \
+((guid_t)  \
 {{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
(b) & 0xff, ((b) >> 8) & 0xff,  \
(c) & 0xff, 

[PATCH 18/23] overlayfs: use uuid_t instead of uuid_be

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
---
 fs/overlayfs/copy_up.c   | 2 +-
 fs/overlayfs/overlayfs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 5b795873f7fa..2a67e8c13098 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -233,7 +233,7 @@ int ovl_set_attr(struct dentry *upperdentry, struct kstat 
*stat)
return err;
 }
 
-static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_be *uuid)
+static struct ovl_fh *ovl_encode_fh(struct dentry *lower, uuid_t *uuid)
 {
struct ovl_fh *fh;
int fh_type, fh_len, dwords;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index caa36cb9c46d..cb0fc450419b 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -55,7 +55,7 @@ struct ovl_fh {
u8 len; /* size of this header + size of fid */
u8 flags;   /* OVL_FH_FLAG_* */
u8 type;/* fid_type of fid */
-   uuid_be uuid;   /* uuid of filesystem */
+   uuid_t uuid;/* uuid of filesystem */
u8 fid[0];  /* file identifier */
 } __packed;
 
-- 
2.11.0



[PATCH 15/23] block: remove blk_part_pack_uuid

2017-05-17 Thread Christoph Hellwig
This helper was only used by IMA of all things, which would get spurious
errors if CONFIG_BLOCK is disabled.  Just opencode the call there.

Signed-off-by: Christoph Hellwig 
---
 include/linux/genhd.h   | 11 ---
 security/integrity/ima/ima_policy.c |  3 +--
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index acff9437e5c3..e619fae2f037 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -219,12 +219,6 @@ static inline struct gendisk *part_to_disk(struct 
hd_struct *part)
return NULL;
 }
 
-static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
-{
-   uuid_be_to_bin(uuid_str, (uuid_be *)to);
-   return 0;
-}
-
 static inline int disk_max_parts(struct gendisk *disk)
 {
if (disk->flags & GENHD_FL_EXT_DEVT)
@@ -736,11 +730,6 @@ static inline dev_t blk_lookup_devt(const char *name, int 
partno)
dev_t devt = MKDEV(0, 0);
return devt;
 }
-
-static inline int blk_part_pack_uuid(const u8 *uuid_str, u8 *to)
-{
-   return -EINVAL;
-}
 #endif /* CONFIG_BLOCK */
 
 #endif /* _LINUX_GENHD_H */
diff --git a/security/integrity/ima/ima_policy.c 
b/security/integrity/ima/ima_policy.c
index 3ab1067db624..49fbc3e8f012 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -717,8 +717,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry 
*entry)
break;
}
 
-   result = blk_part_pack_uuid(args[0].from,
-   entry->fsuuid);
+   result = uuid_to_bin(args[0].from, (uuid_t 
*)&entry->fsuuid);
if (!result)
entry->flags |= IMA_FSUUID;
break;
-- 
2.11.0



[PATCH 23/23] uuid: remove uuid_be

2017-05-17 Thread Christoph Hellwig
Everything uses uuid_t now.

Signed-off-by: Christoph Hellwig 
---
 include/linux/uuid.h | 14 --
 1 file changed, 14 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index e8a065035113..6b9a05570565 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -111,26 +111,12 @@ int guid_to_bin(const char *uuid, guid_t *u);
 int uuid_to_bin(const char *uuid, uuid_t *u);
 
 /* backwards compatibility, don't use in new code */
-typedef uuid_t uuid_be;
-#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
-   UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
-#define NULL_UUID_BE   \
-   UUID_BE(0x, 0x, 0x, 0x00, 0x00, 0x00, 0x00, \
-0x00, 0x00, 0x00, 0x00)
-
 #define uuid_le_gen(u) guid_gen(u)
-#define uuid_be_gen(u) uuid_gen(u)
 #define uuid_le_to_bin(guid, u)guid_to_bin(guid, u)
-#define uuid_be_to_bin(uuid, u)uuid_to_bin(uuid, u)
 
 static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
 {
return memcmp(&u1, &u2, sizeof(guid_t));
 }
 
-static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
-{
-   return memcmp(&u1, &u2, sizeof(uuid_t));
-}
-
 #endif
-- 
2.11.0



[PATCH 22/23] scsi_debug: switch to uuid_t

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/scsi_debug.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 17249c3650fe..35ee09644cfb 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -245,7 +245,7 @@ struct sdebug_dev_info {
unsigned int channel;
unsigned int target;
u64 lun;
-   uuid_be lu_name;
+   uuid_t lu_name;
struct sdebug_host_info *sdbg_host;
unsigned long uas_bm[1];
atomic_t num_in_q;
@@ -965,7 +965,7 @@ static const u64 naa3_comp_c = 0x3110ULL;
 static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
  int target_dev_id, int dev_id_num,
  const char *dev_id_str, int dev_id_str_len,
- const uuid_be *lu_name)
+ const uuid_t *lu_name)
 {
int num, port_a;
char b[32];
@@ -3568,7 +3568,7 @@ static void sdebug_q_cmd_wq_complete(struct work_struct 
*work)
 }
 
 static bool got_shared_uuid;
-static uuid_be shared_uuid;
+static uuid_t shared_uuid;
 
 static struct sdebug_dev_info *sdebug_device_create(
struct sdebug_host_info *sdbg_host, gfp_t flags)
@@ -3578,12 +3578,12 @@ static struct sdebug_dev_info *sdebug_device_create(
devip = kzalloc(sizeof(*devip), flags);
if (devip) {
if (sdebug_uuid_ctl == 1)
-   uuid_be_gen(&devip->lu_name);
+   uuid_gen(&devip->lu_name);
else if (sdebug_uuid_ctl == 2) {
if (got_shared_uuid)
devip->lu_name = shared_uuid;
else {
-   uuid_be_gen(&shared_uuid);
+   uuid_gen(&shared_uuid);
got_shared_uuid = true;
devip->lu_name = shared_uuid;
}
-- 
2.11.0



[PATCH 21/23] nvme: switch to uuid_t

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
---
 drivers/nvme/host/fabrics.c | 8 
 drivers/nvme/host/fabrics.h | 2 +-
 drivers/nvme/host/fc.c  | 3 +--
 drivers/nvme/target/nvmet.h | 1 +
 include/linux/nvme-fc.h | 3 +--
 include/linux/nvme.h| 2 +-
 6 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 990e6fb32a63..c190d7e36900 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -58,7 +58,7 @@ static struct nvmf_host *nvmf_host_add(const char *hostnqn)
 
kref_init(&host->ref);
memcpy(host->nqn, hostnqn, NVMF_NQN_SIZE);
-   uuid_be_gen(&host->id);
+   uuid_gen(&host->id);
 
list_add_tail(&host->list, &nvmf_hosts);
 out_unlock:
@@ -75,7 +75,7 @@ static struct nvmf_host *nvmf_host_default(void)
return NULL;
 
kref_init(&host->ref);
-   uuid_be_gen(&host->id);
+   uuid_gen(&host->id);
snprintf(host->nqn, NVMF_NQN_SIZE,
"nqn.2014-08.org.nvmexpress:NVMf:uuid:%pUb", &host->id);
 
@@ -395,7 +395,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
if (!data)
return -ENOMEM;
 
-   memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
+   uuid_copy(&data->hostid, &ctrl->opts->host->id);
data->cntlid = cpu_to_le16(0x);
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
@@ -454,7 +454,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
if (!data)
return -ENOMEM;
 
-   memcpy(&data->hostid, &ctrl->opts->host->id, sizeof(uuid_be));
+   uuid_copy(&data->hostid, &ctrl->opts->host->id);
data->cntlid = cpu_to_le16(ctrl->cntlid);
strncpy(data->subsysnqn, ctrl->opts->subsysnqn, NVMF_NQN_SIZE);
strncpy(data->hostnqn, ctrl->opts->host->nqn, NVMF_NQN_SIZE);
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index f5a9c1fb186f..29be7600689d 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -36,7 +36,7 @@ struct nvmf_host {
struct kref ref;
struct list_headlist;
charnqn[NVMF_NQN_SIZE];
-   uuid_be id;
+   uuid_t  id;
 };
 
 /**
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 70e689bf1cad..da95e85cadec 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -882,8 +882,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
/* Linux supports only Dynamic controllers */
assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0x);
-   memcpy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id,
-   min_t(size_t, FCNVME_ASSOC_HOSTID_LEN, sizeof(uuid_be)));
+   uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
strncpy(assoc_rqst->assoc_cmd.hostnqn, ctrl->ctrl.opts->host->nqn,
min(FCNVME_ASSOC_HOSTNQN_LEN, NVMF_NQN_SIZE));
strncpy(assoc_rqst->assoc_cmd.subnqn, ctrl->ctrl.opts->subsysnqn,
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 7cb77ba5993b..204f4066c971 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index e997c4a49a88..bc711a10be05 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -177,7 +177,6 @@ struct fcnvme_lsdesc_rjt {
 };
 
 
-#define FCNVME_ASSOC_HOSTID_LEN16
 #define FCNVME_ASSOC_HOSTNQN_LEN   256
 #define FCNVME_ASSOC_SUBNQN_LEN256
 
@@ -191,7 +190,7 @@ struct fcnvme_lsdesc_cr_assoc_cmd {
__be16  cntlid;
__be16  sqsize;
__be32  rsvd52;
-   u8  hostid[FCNVME_ASSOC_HOSTID_LEN];
+   uuid_t  hostid;
u8  hostnqn[FCNVME_ASSOC_HOSTNQN_LEN];
u8  subnqn[FCNVME_ASSOC_SUBNQN_LEN];
u8  rsvd632[384];
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index b625bacf37ef..d88e925f82ce 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -843,7 +843,7 @@ struct nvmf_connect_command {
 };
 
 struct nvmf_connect_data {
-   __u8hostid[16];
+   uuid_t  hostid;
__le16  cntlid;
charresv4[238];
charsubsysnqn[NVMF_NQN_FIELD_LEN];
-- 
2.11.0



[PATCH 20/23] sysctl: switch to use uuid_t

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
---
 kernel/sysctl_binary.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index ece4b177052b..1ae520eed53c 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1119,7 +1119,7 @@ static ssize_t bin_uuid(struct file *file,
/* Only supports reads */
if (oldval && oldlen) {
char buf[UUID_STRING_LEN + 1];
-   uuid_be uuid;
+   uuid_t uuid;
 
result = kernel_read(file, 0, buf, sizeof(buf) - 1);
if (result < 0)
@@ -1128,7 +1128,7 @@ static ssize_t bin_uuid(struct file *file,
buf[result] = '\0';
 
result = -EIO;
-   if (uuid_be_to_bin(buf, &uuid))
+   if (uuid_to_bin(buf, &uuid))
goto out;
 
if (oldlen > 16)
-- 
2.11.0



[PATCH 19/23] partitions/ldm: switch to use uuid_t

2017-05-17 Thread Christoph Hellwig
And the uuid helpers.

Signed-off-by: Christoph Hellwig 
---
 block/partitions/ldm.c | 10 +-
 block/partitions/ldm.h |  6 ++
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index edcea70674c9..bbf929e80b94 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -115,7 +115,7 @@ static bool ldm_parse_privhead(const u8 *data, struct 
privhead *ph)
ldm_error("PRIVHEAD disk size doesn't match real disk size");
return false;
}
-   if (uuid_be_to_bin(data + 0x0030, (uuid_be *)ph->disk_id)) {
+   if (uuid_to_bin(data + 0x0030, &ph->disk_id)) {
ldm_error("PRIVHEAD contains an invalid GUID.");
return false;
}
@@ -234,7 +234,7 @@ static bool ldm_compare_privheads (const struct privhead 
*ph1,
(ph1->logical_disk_size  == ph2->logical_disk_size) &&
(ph1->config_start   == ph2->config_start)  &&
(ph1->config_size== ph2->config_size)   &&
-   !memcmp (ph1->disk_id, ph2->disk_id, GUID_SIZE));
+   uuid_equal(&ph1->disk_id, &ph2->disk_id));
 }
 
 /**
@@ -557,7 +557,7 @@ static struct vblk * ldm_get_disk_objid (const struct ldmdb 
*ldb)
 
list_for_each (item, &ldb->v_disk) {
struct vblk *v = list_entry (item, struct vblk, list);
-   if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE))
+   if (uuid_equal(&v->vblk.disk.disk_id, &ldb->ph.disk_id))
return v;
}
 
@@ -892,7 +892,7 @@ static bool ldm_parse_dsk3 (const u8 *buffer, int buflen, 
struct vblk *vb)
disk = &vb->vblk.disk;
ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name,
sizeof (disk->alt_name));
-   if (uuid_be_to_bin(buffer + 0x19 + r_name, (uuid_be *)disk->disk_id))
+   if (uuid_to_bin(buffer + 0x19 + r_name, &disk->disk_id))
return false;
 
return true;
@@ -927,7 +927,7 @@ static bool ldm_parse_dsk4 (const u8 *buffer, int buflen, 
struct vblk *vb)
return false;
 
disk = &vb->vblk.disk;
-   memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE);
+   uuid_copy(&disk->disk_id, (uuid_t *)(buffer + 0x18 + r_name));
return true;
 }
 
diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h
index 374242c0971a..f4c6055df956 100644
--- a/block/partitions/ldm.h
+++ b/block/partitions/ldm.h
@@ -112,8 +112,6 @@ struct frag {   /* VBLK 
Fragment handling */
 
 /* In memory LDM database structures. */
 
-#define GUID_SIZE  16
-
 struct privhead {  /* Offsets and sizes are in sectors. */
u16 ver_major;
u16 ver_minor;
@@ -121,7 +119,7 @@ struct privhead {   /* Offsets and sizes 
are in sectors. */
u64 logical_disk_size;
u64 config_start;
u64 config_size;
-   u8  disk_id[GUID_SIZE];
+   uuid_t  disk_id;
 };
 
 struct tocblock {  /* We have exactly two bitmaps. */
@@ -154,7 +152,7 @@ struct vblk_dgrp {  /* VBLK Disk Group */
 };
 
 struct vblk_disk { /* VBLK Disk */
-   u8  disk_id[GUID_SIZE];
+   uuid_t  disk_id;
u8  alt_name[128];
 };
 
-- 
2.11.0



[PATCH 14/23] xfs: use the common helper uuid_is_null()

2017-05-17 Thread Christoph Hellwig
From: Amir Goldstein 

Use the common helper uuid_is_null() and remove the xfs specific
helper uuid_is_nil().

The common helper does not check for the NULL pointer value as
xfs helper did, but xfs code never calls the helper with a pointer
that can be NULL.

Conform comments and warning strings to use the term 'null uuid'
instead of 'nil uuid', because this is the terminology used by
lib/uuid.c and its users. It is also the terminology used in
userspace by libuuid and xfsprogs.

Signed-off-by: Amir Goldstein 
[hch: remove now unused uuid.[ch]]
Signed-off-by: Christoph Hellwig 
---
 fs/xfs/Makefile  |  3 +--
 fs/xfs/uuid.c| 32 
 fs/xfs/uuid.h| 23 ---
 fs/xfs/xfs_linux.h   |  1 -
 fs/xfs/xfs_log_recover.c |  6 +++---
 fs/xfs/xfs_mount.c   |  8 
 6 files changed, 8 insertions(+), 65 deletions(-)
 delete mode 100644 fs/xfs/uuid.c
 delete mode 100644 fs/xfs/uuid.h

diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 5c90f82b8f6b..a6e955bfead8 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -98,8 +98,7 @@ xfs-y += xfs_aops.o \
   xfs_sysfs.o \
   xfs_trans.o \
   xfs_xattr.o \
-  kmem.o \
-  uuid.o
+  kmem.o
 
 # low-level transaction/log code
 xfs-y  += xfs_log.o \
diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
deleted file mode 100644
index 737c186ea98b..
--- a/fs/xfs/uuid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#include 
-
-int
-uuid_is_nil(uuid_t *uuid)
-{
-   int i;
-   char*cp = (char *)uuid;
-
-   if (uuid == NULL)
-   return 0;
-   /* implied check of version number here... */
-   for (i = 0; i < sizeof *uuid; i++)
-   if (*cp++) return 0;/* not nil */
-   return 1;   /* is nil */
-}
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
deleted file mode 100644
index 5aea49bf0963..
--- a/fs/xfs/uuid.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_SUPPORT_UUID_H__
-#define __XFS_SUPPORT_UUID_H__
-
-extern int uuid_is_nil(uuid_t *uuid);
-
-#endif /* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 2c33d915e550..2d167fe643ec 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -43,7 +43,6 @@ typedef __u32 xfs_nlink_t;
 
 #include "kmem.h"
 #include "mrlock.h"
-#include "uuid.h"
 
 #include 
 #include 
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index cd0b077deb35..8cec1e5505a4 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -352,13 +352,13 @@ xlog_header_check_mount(
 {
ASSERT(head->h_magicno == cpu_to_be32(XLOG_HEADER_MAGIC_NUM));
 
-   if (uuid_is_nil(&head->h_fs_uuid)) {
+   if (uuid_is_null(&head->h_fs_uuid)) {
/*
 * IRIX doesn't write the h_fs_uuid or h_fmt fields. If
-* h_fs_uuid is nil, we assume this log was last mounted
+* h_fs_uuid is null, we assume this log was last mounted
 * by IRIX and continue.
 */
-   xfs_warn(mp, "nil uuid in log - IRIX style log");
+   xfs_warn(mp, "null uuid in log - IRIX style log");
} else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
 

[PATCH 17/23] fs: switch ->s_uuid to uuid_t

2017-05-17 Thread Christoph Hellwig
For some file systems we still memcpy into it, but in various places this
already allows us to use the proper uuid helpers.  More to come..

Signed-off-by: Christoph Hellwig 
---
 drivers/xen/tmem.c  |  6 +++---
 fs/ext4/super.c |  2 +-
 fs/f2fs/super.c |  2 +-
 fs/gfs2/ops_fstype.c|  2 +-
 fs/gfs2/sys.c   | 22 +-
 fs/ocfs2/super.c|  2 +-
 fs/overlayfs/copy_up.c  |  5 ++---
 fs/overlayfs/namei.c|  2 +-
 fs/xfs/xfs_mount.c  |  3 +--
 include/linux/cleancache.h  |  2 +-
 include/linux/fs.h  |  5 +++--
 mm/cleancache.c |  2 +-
 security/integrity/evm/evm_crypto.c |  2 +-
 security/integrity/ima/ima_policy.c |  2 +-
 14 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 4ac2ca8a7656..bf13d1ec51f3 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -233,12 +233,12 @@ static int tmem_cleancache_init_fs(size_t pagesize)
return xen_tmem_new_pool(uuid_private, 0, pagesize);
 }
 
-static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize)
+static int tmem_cleancache_init_shared_fs(uuid_t *uuid, size_t pagesize)
 {
struct tmem_pool_uuid shared_uuid;
 
-   shared_uuid.uuid_lo = *(u64 *)uuid;
-   shared_uuid.uuid_hi = *(u64 *)(&uuid[8]);
+   shared_uuid.uuid_lo = *(u64 *)&uuid->b[0];
+   shared_uuid.uuid_hi = *(u64 *)&uuid->b[8];
return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize);
 }
 
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0b177da9ea82..6e3b4186a22f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3952,7 +3952,7 @@ static int ext4_fill_super(struct super_block *sb, void 
*data, int silent)
sb->s_qcop = &ext4_qctl_operations;
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ;
 #endif
-   memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
+   memcpy(&sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
 
INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */
mutex_init(&sbi->s_orphan_lock);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 83355ec4a92c..0b89b0b7b9f7 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1937,7 +1937,7 @@ static int f2fs_fill_super(struct super_block *sb, void 
*data, int silent)
sb->s_time_gran = 1;
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
(test_opt(sbi, POSIX_ACL) ? MS_POSIXACL : 0);
-   memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+   memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 
/* init f2fs-specific super block info */
sbi->valid_super_block = valid_super_block;
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index ed67548b286c..b92135c202c2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -203,7 +203,7 @@ static void gfs2_sb_in(struct gfs2_sbd *sdp, const void 
*buf)
 
memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-   memcpy(s->s_uuid, str->sb_uuid, 16);
+   memcpy(&s->s_uuid, str->sb_uuid, 16);
 }
 
 /**
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7a515345610c..e77bc52b468f 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -71,25 +71,14 @@ static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
 }
 
-static int gfs2_uuid_valid(const u8 *uuid)
-{
-   int i;
-
-   for (i = 0; i < 16; i++) {
-   if (uuid[i])
-   return 1;
-   }
-   return 0;
-}
-
 static ssize_t uuid_show(struct gfs2_sbd *sdp, char *buf)
 {
struct super_block *s = sdp->sd_vfs;
-   const u8 *uuid = s->s_uuid;
+
buf[0] = '\0';
-   if (!gfs2_uuid_valid(uuid))
+   if (uuid_is_null(&s->s_uuid))
return 0;
-   return snprintf(buf, PAGE_SIZE, "%pUB\n", uuid);
+   return snprintf(buf, PAGE_SIZE, "%pUB\n", &s->s_uuid);
 }
 
 static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -712,14 +701,13 @@ static int gfs2_uevent(struct kset *kset, struct kobject 
*kobj,
 {
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct super_block *s = sdp->sd_vfs;
-   const u8 *uuid = s->s_uuid;
 
add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
if (!test_bit(SDF_NOJOURNALID, &sdp->sd_flags))
add_uevent_var(env, "JOURNALID=%d", sdp->sd_lockstruct.ls_jid);
-   if (gfs2_uuid_valid(uuid))
-   add_uevent_var(env, "UUID=%pUB", uuid);
+   if (!uuid_is_null(&s->s_uuid))
+   add_uevent_var(env, "UUID=%pUB", &s->s_uuid);
return 0;
 }
 

[PATCH 12/23] xfs: remove uuid_getnodeuniq and xfs_uu_t

2017-05-17 Thread Christoph Hellwig
Directly use the v1 intepretation of uuid_t instead.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/uuid.c  | 25 -
 fs/xfs/uuid.h  |  1 -
 fs/xfs/xfs_mount.c |  6 +-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index 29ed78c8637b..737c186ea98b 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -17,31 +17,6 @@
  */
 #include 
 
-/* IRIX interpretation of an uuid_t */
-typedef struct {
-   __be32  uu_timelow;
-   __be16  uu_timemid;
-   __be16  uu_timehi;
-   __be16  uu_clockseq;
-   __be16  uu_node[3];
-} xfs_uu_t;
-
-/*
- * uuid_getnodeuniq - obtain the node unique fields of a UUID.
- *
- * This is not in any way a standard or condoned UUID function;
- * it just something that's needed for user-level file handles.
- */
-void
-uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
-{
-   xfs_uu_t *uup = (xfs_uu_t *)uuid;
-
-   fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
-  be16_to_cpu(uup->uu_timemid);
-   fsid[1] = be32_to_cpu(uup->uu_timelow);
-}
-
 int
 uuid_is_nil(uuid_t *uuid)
 {
diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 86bbed071e79..5aea49bf0963 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -19,6 +19,5 @@
 #define __XFS_SUPPORT_UUID_H__
 
 extern int uuid_is_nil(uuid_t *uuid);
-extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
 
 #endif /* __XFS_SUPPORT_UUID_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2eaf81859166..742e4a61c0bc 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -793,7 +793,11 @@ xfs_mountfs(
 *  Copies the low order bits of the timestamp and the randomly
 *  set "sequence" number out of a UUID.
 */
-   uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
+   mp->m_fixedfsid[0] =
+   ((u32)sbp->sb_uuid.v1.clock_seq_hi_and_reserved << 24) |
+   ((u32)sbp->sb_uuid.v1.clock_seq_low << 16) |
+be16_to_cpu(sbp->sb_uuid.v1.time_mid);
+   mp->m_fixedfsid[1] = be32_to_cpu(sbp->sb_uuid.v1.time_low);
 
mp->m_dmevmask = 0; /* not persistent; set after each mount */
 
-- 
2.11.0



[PATCH 16/23] ima/policy: switch to use uuid_t

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
---
 security/integrity/ima/ima_policy.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/security/integrity/ima/ima_policy.c 
b/security/integrity/ima/ima_policy.c
index 49fbc3e8f012..da3e7d50e0d7 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -61,7 +61,7 @@ struct ima_rule_entry {
enum ima_hooks func;
int mask;
unsigned long fsmagic;
-   u8 fsuuid[16];
+   uuid_t fsuuid;
kuid_t uid;
kuid_t fowner;
bool (*uid_op)(kuid_t, kuid_t);/* Handlers for operators   */
@@ -244,7 +244,7 @@ static bool ima_match_rules(struct ima_rule_entry *rule, 
struct inode *inode,
&& rule->fsmagic != inode->i_sb->s_magic)
return false;
if ((rule->flags & IMA_FSUUID) &&
-   memcmp(rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
+   memcmp(&rule->fsuuid, inode->i_sb->s_uuid, sizeof(rule->fsuuid)))
return false;
if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
return false;
@@ -711,13 +711,12 @@ static int ima_parse_rule(char *rule, struct 
ima_rule_entry *entry)
case Opt_fsuuid:
ima_log_string(ab, "fsuuid", args[0].from);
 
-   if (memchr_inv(entry->fsuuid, 0x00,
-  sizeof(entry->fsuuid))) {
+   if (uuid_is_null(&entry->fsuuid)) {
result = -EINVAL;
break;
}
 
-   result = uuid_to_bin(args[0].from, (uuid_t 
*)&entry->fsuuid);
+   result = uuid_to_bin(args[0].from, &entry->fsuuid);
if (!result)
entry->flags |= IMA_FSUUID;
break;
@@ -1086,7 +1085,7 @@ int ima_policy_show(struct seq_file *m, void *v)
}
 
if (entry->flags & IMA_FSUUID) {
-   seq_printf(m, "fsuuid=%pU", entry->fsuuid);
+   seq_printf(m, "fsuuid=%pU", &entry->fsuuid);
seq_puts(m, " ");
}
 
-- 
2.11.0



[PATCH 13/23] md: namespace private helper names

2017-05-17 Thread Christoph Hellwig
From: Amir Goldstein 

The md private helper uuid_equal() collides with a generic helper
of the same name.

Rename the md private helper to md_uuid_equal() and do the same for
md_sb_equal().

Cc: Shaohua Li 
Signed-off-by: Amir Goldstein 
Signed-off-by: Christoph Hellwig 
---
 drivers/md/md.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 82f798be964f..65795cc4cb7d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -825,7 +825,7 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
return -EINVAL;
 }
 
-static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
return  sb1->set_uuid0 == sb2->set_uuid0 &&
sb1->set_uuid1 == sb2->set_uuid1 &&
@@ -833,7 +833,7 @@ static int uuid_equal(mdp_super_t *sb1, mdp_super_t *sb2)
sb1->set_uuid3 == sb2->set_uuid3;
 }
 
-static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
+static int md_sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
 {
int ret;
mdp_super_t *tmp1, *tmp2;
@@ -1025,12 +1025,12 @@ static int super_90_load(struct md_rdev *rdev, struct 
md_rdev *refdev, int minor
} else {
__u64 ev1, ev2;
mdp_super_t *refsb = page_address(refdev->sb_page);
-   if (!uuid_equal(refsb, sb)) {
+   if (!md_uuid_equal(refsb, sb)) {
pr_warn("md: %s has different UUID to %s\n",
b, bdevname(refdev->bdev,b2));
goto abort;
}
-   if (!sb_equal(refsb, sb)) {
+   if (!md_sb_equal(refsb, sb)) {
pr_warn("md: %s has same UUID but different superblock 
to %s\n",
b, bdevname(refdev->bdev, b2));
goto abort;
-- 
2.11.0



[PATCH 10/23] afs: switch to use uuid_t and uuid_gen

2017-05-17 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig 
Reviewed-by: David Howells 
---
 fs/afs/cmservice.c | 46 +++---
 fs/afs/internal.h  |  2 +-
 fs/afs/main.c  |  4 ++--
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c
index 3062cceb5c2a..d4e77d12570c 100644
--- a/fs/afs/cmservice.c
+++ b/fs/afs/cmservice.c
@@ -350,7 +350,7 @@ static int afs_deliver_cb_init_call_back_state3(struct 
afs_call *call)
 {
struct sockaddr_rxrpc srx;
struct afs_server *server;
-   struct uuid_v1 *r;
+   uuid_t *r;
unsigned loop;
__be32 *b;
int ret;
@@ -380,20 +380,20 @@ static int afs_deliver_cb_init_call_back_state3(struct 
afs_call *call)
}
 
_debug("unmarshall UUID");
-   call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+   call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
if (!call->request)
return -ENOMEM;
 
b = call->buffer;
r = call->request;
-   r->time_low = b[0];
-   r->time_mid = htons(ntohl(b[1]));
-   r->time_hi_and_version  = htons(ntohl(b[2]));
-   r->clock_seq_hi_and_reserved= ntohl(b[3]);
-   r->clock_seq_low= ntohl(b[4]);
+   r->v1.time_low  = b[0];
+   r->v1.time_mid  = htons(ntohl(b[1]));
+   r->v1.time_hi_and_version   = htons(ntohl(b[2]));
+   r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+   r->v1.clock_seq_low = ntohl(b[4]);
 
for (loop = 0; loop < 6; loop++)
-   r->node[loop] = ntohl(b[loop + 5]);
+   r->v1.node[loop] = ntohl(b[loop + 5]);
 
call->offset = 0;
call->unmarshall++;
@@ -453,7 +453,7 @@ static int afs_deliver_cb_probe(struct afs_call *call)
 static void SRXAFSCB_ProbeUuid(struct work_struct *work)
 {
struct afs_call *call = container_of(work, struct afs_call, work);
-   struct uuid_v1 *r = call->request;
+   uuid_t *r = call->request;
 
struct {
__be32  match;
@@ -476,7 +476,7 @@ static void SRXAFSCB_ProbeUuid(struct work_struct *work)
  */
 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
 {
-   struct uuid_v1 *r;
+   uuid_t *r;
unsigned loop;
__be32 *b;
int ret;
@@ -502,20 +502,20 @@ static int afs_deliver_cb_probe_uuid(struct afs_call 
*call)
}
 
_debug("unmarshall UUID");
-   call->request = kmalloc(sizeof(struct uuid_v1), GFP_KERNEL);
+   call->request = kmalloc(sizeof(uuid_t), GFP_KERNEL);
if (!call->request)
return -ENOMEM;
 
b = call->buffer;
r = call->request;
-   r->time_low = b[0];
-   r->time_mid = htons(ntohl(b[1]));
-   r->time_hi_and_version  = htons(ntohl(b[2]));
-   r->clock_seq_hi_and_reserved= ntohl(b[3]);
-   r->clock_seq_low= ntohl(b[4]);
+   r->v1.time_low  = b[0];
+   r->v1.time_mid  = htons(ntohl(b[1]));
+   r->v1.time_hi_and_version   = htons(ntohl(b[2]));
+   r->v1.clock_seq_hi_and_reserved = ntohl(b[3]);
+   r->v1.clock_seq_low = ntohl(b[4]);
 
for (loop = 0; loop < 6; loop++)
-   r->node[loop] = ntohl(b[loop + 5]);
+   r->v1.node[loop] = ntohl(b[loop + 5]);
 
call->offset = 0;
call->unmarshall++;
@@ -568,13 +568,13 @@ static void SRXAFSCB_TellMeAboutYourself(struct 
work_struct *work)
memset(&reply, 0, sizeof(reply));
reply.ia.nifs = htonl(nifs);
 
-   reply.ia.uuid[0] = afs_uuid.time_low;
-   reply.ia.uuid[1] = htonl(ntohs(afs_uuid.time_mid));
-   reply.ia.uuid[2] = htonl(ntohs(afs_uuid.time_hi_and_version));
-   reply.ia.uuid[3] = htonl((s8) afs_uuid.clock_seq_hi_and_reserved);
-   reply.ia.uuid[4] = htonl((s8) afs_uuid.clock_seq_low);
+   reply.ia.uuid[0] = afs_uuid.v1.time_low;
+   reply.ia.uuid[1] = htonl(ntohs(afs_uuid.v1.time_mid));
+   reply.ia.uuid[2] = htonl(ntohs(afs_uuid.v1.time_hi_and_version));
+   reply.ia.uuid[3] = htonl((s8) afs_uuid.v1.clock_seq_hi_and_reserved);
+   reply.ia.uuid[4] = htonl((s8) afs_uuid.v1.clock_seq_low);
for (loop = 0; loop < 6; loop++)
-   reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.node[loop]);
+   reply.ia.uuid[loop + 5] = htonl((s8) afs_uuid.v1.node[loop]);
 
if (ifs) {
for (loop = 0; loop < nifs; loo

[PATCH 11/23] uuid: remove struct uuid_v1

2017-05-17 Thread Christoph Hellwig
Unused now.

Signed-off-by: Christoph Hellwig 
---
 include/linux/uuid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 47ca06d846d4..e8a065035113 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -40,7 +40,7 @@ typedef struct {
 * - the clock sequence is a 14-bit counter to avoid duplicate
 *   times
 */
-   struct uuid_v1 {
+   struct {
__be32  time_low;
__be16  time_mid;
__be16  time_hi_and_version;
-- 
2.11.0



[PATCH 08/23] uuid: hoist uuid_is_null() helper from libnvdimm

2017-05-17 Thread Christoph Hellwig
Hoist the libnvdimm helper as an inline helper to linux/uuid.h
using an auxiliary const variable uuid_null in lib/uuid.c.

[hch: also add the guid variant.  Both do the same but I'd like
to keep casts to a minimum]

The common helper uses the new abstract type uuid_t * instead of
u8 *.

Suggested-by: Christoph Hellwig 
Cc: Andy Shevchenko 
Cc: David Howells 
Signed-off-by: Amir Goldstein 
[hch: added guid_is_null]
Signed-off-by: Christoph Hellwig 
Acked-by: Dan Williams 
---
 drivers/nvdimm/btt_devs.c |  9 +
 include/linux/uuid.h  | 13 +
 lib/uuid.c|  5 +
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
index ae00dc0d9791..4c989bb9a8a0 100644
--- a/drivers/nvdimm/btt_devs.c
+++ b/drivers/nvdimm/btt_devs.c
@@ -222,13 +222,6 @@ struct device *nd_btt_create(struct nd_region *nd_region)
return dev;
 }
 
-static bool uuid_is_null(u8 *uuid)
-{
-   static const u8 null_uuid[16];
-
-   return (memcmp(uuid, null_uuid, 16) == 0);
-}
-
 /**
  * nd_btt_arena_is_valid - check if the metadata layout is valid
  * @nd_btt:device with BTT geometry and backing device info
@@ -249,7 +242,7 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct 
btt_sb *super)
if (memcmp(super->signature, BTT_SIG, BTT_SIG_LEN) != 0)
return false;
 
-   if (!uuid_is_null(super->parent_uuid))
+   if (!guid_is_null((guid_t *)&super->parent_uuid))
if (memcmp(super->parent_uuid, parent_uuid, 16) != 0)
return false;
 
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 7aff929007dd..47ca06d846d4 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -64,6 +64,9 @@ typedef struct {
  */
 #defineUUID_STRING_LEN 36
 
+extern const guid_t guid_null;
+extern const uuid_t uuid_null;
+
 static inline bool guid_equal(const guid_t *u1, const guid_t *u2)
 {
return memcmp(u1, u2, sizeof(guid_t)) == 0;
@@ -74,6 +77,11 @@ static inline void guid_copy(guid_t *dst, const guid_t *src)
memcpy(dst, src, sizeof(guid_t));
 }
 
+static inline bool guid_is_null(guid_t *guid)
+{
+   return guid_equal(guid, &guid_null);
+}
+
 static inline bool uuid_equal(const uuid_t *u1, const uuid_t *u2)
 {
return memcmp(u1, u2, sizeof(uuid_t)) == 0;
@@ -84,6 +92,11 @@ static inline void uuid_copy(uuid_t *dst, const uuid_t *src)
memcpy(dst, src, sizeof(uuid_t));
 }
 
+static inline bool uuid_is_null(uuid_t *uuid)
+{
+   return uuid_equal(uuid, &uuid_null);
+}
+
 void generate_random_uuid(unsigned char uuid[16]);
 
 extern void guid_gen(guid_t *u);
diff --git a/lib/uuid.c b/lib/uuid.c
index 003bf6823003..25145bfb0eaa 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -21,6 +21,11 @@
 #include 
 #include 
 
+const guid_t guid_null;
+EXPORT_SYMBOL(guid_null);
+const uuid_t uuid_null;
+EXPORT_SYMBOL(uuid_null);
+
 const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
 const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
 
-- 
2.11.0



[PATCH 06/23] uuid: add the v1 layout to uuid_t

2017-05-17 Thread Christoph Hellwig
Turn the content of uuid_t into a union and add the fields for the v1
interpretation to it.

Signed-off-by: Christoph Hellwig 
Reviewed-by: David Howells 
---
 include/linux/uuid.h | 59 
 1 file changed, 32 insertions(+), 27 deletions(-)

diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 0410cd002282..8bd1da4ec95d 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -18,40 +18,45 @@
 
 #include 
 
-typedef struct {
-   __u8 b[16];
-} uuid_t;
-
-#define UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)  \
-((uuid_t)  \
-{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
-   ((b) >> 8) & 0xff, (b) & 0xff,  \
-   ((c) >> 8) & 0xff, (c) & 0xff,  \
-   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
-
-/*
- * V1 (time-based) UUID definition [RFC 4122].
- * - the timestamp is a 60-bit value, split 32/16/12, and goes in 100ns
- *   increments since midnight 15th October 1582
- *   - add AFS_UUID_TO_UNIX_TIME to convert unix time in 100ns units to UUID
- * time
- * - the clock sequence is a 14-bit counter to avoid duplicate times
- */
-struct uuid_v1 {
-   __be32  time_low;   /* low part of 
timestamp */
-   __be16  time_mid;   /* mid part of 
timestamp */
-   __be16  time_hi_and_version;/* high part of 
timestamp and version  */
+/* v1 UUID defintions: */
 #define UUID_TO_UNIX_TIME  0x01b21dd213814000ULL
 #define UUID_TIMEHI_MASK   0x0fff
 #define UUID_VERSION_TIME  0x1000  /* time-based UUID */
 #define UUID_VERSION_NAME  0x3000  /* name-based UUID */
 #define UUID_VERSION_RANDOM0x4000  /* (pseudo-)random generated UUID */
-   u8  clock_seq_hi_and_reserved;  /* clock seq hi and 
variant */
 #define UUID_CLOCKHI_MASK  0x3f
 #define UUID_VARIANT_STD   0x80
-   u8  clock_seq_low;  /* clock seq low */
-   u8  node[6];/* spatially unique 
node ID (MAC addr) */
-};
+
+typedef struct {
+   union {
+   __u8b[16];
+
+   /*
+* V1 (time-based) UUID definition [RFC 4122]:
+* - the timestamp is a 60-bit value, split 32/16/12, and goes
+*   in 100ns increments since midnight 15th October 1582
+*   - add UUID_TO_UNIX_TIME to convert unix time in 100ns
+* units to UUID time
+* - the clock sequence is a 14-bit counter to avoid duplicate
+*   times
+*/
+   struct uuid_v1 {
+   __be32  time_low;
+   __be16  time_mid;
+   __be16  time_hi_and_version;
+   u8  clock_seq_hi_and_reserved;
+   u8  clock_seq_low;
+   u8  node[6];
+   } v1;
+   };
+} uuid_t;
+
+#define UUID(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
+{.b = {
\
+   ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
+   ((_b) >> 8) & 0xff, (_b) & 0xff,\
+   ((c) >> 8) & 0xff, (c) & 0xff,  \
+   (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }}
 
 /*
  * The length of a UUID string ("----")
-- 
2.11.0



[PATCH] ocfs2: give an obvious tip for dismatch cluster names

2017-05-17 Thread Gang He
This patch is used to add an obvious error message, due to
dismatch cluster names between on-disk and in the current cluster.
We can meet this case during OCFS2 cluster migration, if we can
give the user an obvious tip for why they can not mount the file
system after migration, they can quickly fix this dismatch problem.
Second, also move printing ocfs2_fill_super() errno to the front
of ocfs2_dismount_volume() function, since ocfs2_dismount_volume()
will also print it's own message.

Signed-off-by: Gang He 
---
 fs/ocfs2/super.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ca1646f..5575918 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1208,14 +1208,15 @@ static int ocfs2_fill_super(struct super_block *sb, 
void *data, int silent)
 read_super_error:
brelse(bh);
 
+   if (status)
+   mlog_errno(status);
+
if (osb) {
atomic_set(&osb->vol_state, VOLUME_DISABLED);
wake_up(&osb->osb_mount_event);
ocfs2_dismount_volume(sb, 1);
}
 
-   if (status)
-   mlog_errno(status);
return status;
 }
 
@@ -1843,6 +1844,9 @@ static int ocfs2_mount_volume(struct super_block *sb)
status = ocfs2_dlm_init(osb);
if (status < 0) {
mlog_errno(status);
+   if (status == -EBADR)
+   mlog(ML_ERROR, "couldn't mount because cluster name on"
+   " disk does not match the running cluster name.\n");
goto leave;
}
 
-- 
1.8.5.6



[PATCH 05/23] uuid: don't export guid_index and uuid_index

2017-05-17 Thread Christoph Hellwig
These are only used in uuid.c and vsprintf.c and aren't something modules
should use directly.

Signed-off-by: Christoph Hellwig 
---
 lib/uuid.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/uuid.c b/lib/uuid.c
index f80dc63f6ca8..003bf6823003 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -22,9 +22,7 @@
 #include 
 
 const u8 guid_index[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(guid_index);
 const u8 uuid_index[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-EXPORT_SYMBOL(uuid_index);
 
 /***
  * Random UUID interface
-- 
2.11.0



[PATCH 02/23] xfs: use uuid_be to implement the uuid_t type

2017-05-17 Thread Christoph Hellwig
Use the generic Linux definition to implement our UUID type, this will
allow using more generic infrastructure in the future.

Signed-off-by: Christoph Hellwig 
---
 fs/xfs/uuid.h  | 4 
 fs/xfs/xfs_linux.h | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/uuid.h b/fs/xfs/uuid.h
index 104db0f3bed6..4f1441ba4fa5 100644
--- a/fs/xfs/uuid.h
+++ b/fs/xfs/uuid.h
@@ -18,10 +18,6 @@
 #ifndef __XFS_SUPPORT_UUID_H__
 #define __XFS_SUPPORT_UUID_H__
 
-typedef struct {
-   unsigned char   __u_bits[16];
-} uuid_t;
-
 extern int uuid_is_nil(uuid_t *uuid);
 extern int uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
 extern void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 044fb0e15390..89ee5ec66837 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -19,6 +19,7 @@
 #define __XFS_LINUX__
 
 #include 
+#include 
 
 /*
  * Kernel specific type declarations for XFS
@@ -38,6 +39,8 @@ typedef __s64 xfs_daddr_t;/*  type */
 typedef __u32  xfs_dev_t;
 typedef __u32  xfs_nlink_t;
 
+typedef uuid_beuuid_t;
+
 #include "xfs_types.h"
 
 #include "kmem.h"
-- 
2.11.0



[PATCH v2] iio: adc: sun4i-gpadc-iio: fix parent device being used in devm function

2017-05-17 Thread Quentin Schulz
For the sake of DT binding stability, this IIO driver is a child of an
MFD driver for Allwinner A10, A13 and A31 because there already exists a
DT binding for this IP. The MFD driver has a DT node but the IIO driver
does not.

The IIO device registers the temperature sensor in the thermal framework
using the DT node of the parent, the MFD device, so the thermal
framework could match the phandle to the MFD device in the DT and the
struct device used to register in the thermal framework.

devm_thermal_zone_of_sensor_register was previously used to register the
thermal sensor with the parent struct device of the IIO device,
representing the MFD device. By doing so, we registered actually the
parent in the devm routine and not the actual IIO device.

This lead to the devm unregister function not being called when the IIO
module driver is removed. It resulted in the thermal framework still
polling the get_temp function of the IIO module while the device doesn't
exist anymore, thus generated a kernel panic.

Use the non-devm function instead and do the unregister manually in the
remove function.

Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")

Signed-off-by: Quentin Schulz 
Reported-by: Corentin Labbe 
---

v2:
  - save struct device used to register in thermal framework in
  sun4i_gpadc_iio,
  - use this struct device to unregister from thermal framework instead
  of doing a condition on pdev->dev.of_node,
  - check if CONFIG_THERMAL_OF is enabled before unregistering from
  thermal,

 drivers/iio/adc/sun4i-gpadc-iio.c | 36 ++--
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c 
b/drivers/iio/adc/sun4i-gpadc-iio.c
index b23527309088..11f7d7745614 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -105,6 +105,8 @@ struct sun4i_gpadc_iio {
boolno_irq;
/* prevents concurrent reads of temperature and ADC */
struct mutexmutex;
+   struct thermal_zone_device  *tzd;
+   struct device   *sensor_device;
 };
 
 #define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \
@@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device 
*pdev,
 {
struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
const struct of_device_id *of_dev;
-   struct thermal_zone_device *tzd;
struct resource *mem;
void __iomem *base;
int ret;
@@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device 
*pdev,
if (!IS_ENABLED(CONFIG_THERMAL_OF))
return 0;
 
-   tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, info,
-  &sun4i_ts_tz_ops);
-   if (IS_ERR(tzd))
+   info->sensor_device = &pdev->dev;
+   info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0,
+   info, &sun4i_ts_tz_ops);
+   if (IS_ERR(info->tzd))
dev_err(&pdev->dev, "could not register thermal sensor: %ld\n",
-   PTR_ERR(tzd));
+   PTR_ERR(info->tzd));
 
-   return PTR_ERR_OR_ZERO(tzd);
+   return PTR_ERR_OR_ZERO(info->tzd);
 }
 
 static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
@@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device 
*pdev,
 * of_node, and the device from this driver as third argument to
 * return the temperature.
 */
-   struct thermal_zone_device *tzd;
-   tzd = devm_thermal_zone_of_sensor_register(pdev->dev.parent, 0,
-  info,
-  &sun4i_ts_tz_ops);
-   if (IS_ERR(tzd)) {
+   info->sensor_device = pdev->dev.parent;
+   info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
+   0, info,
+   &sun4i_ts_tz_ops);
+   if (IS_ERR(info->tzd)) {
dev_err(&pdev->dev,
"could not register thermal sensor: %ld\n",
-   PTR_ERR(tzd));
-   return PTR_ERR(tzd);
+   PTR_ERR(info->tzd));
+   return PTR_ERR(info->tzd);
}
} else {
indio_dev->num_channels =
@@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
 
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-   if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF))
+
+   if (!IS_ENABLED(CONFIG_THERMAL_OF))
+   return 0;
+
+   thermal_zone_of_sensor_unregister(i

[PATCH] nvme/pci: remap BAR0 to cover admin CQ doorbell for large stride

2017-05-17 Thread Xu Yu
The existing driver initially maps 8192 bytes of BAR0 which is
intended to cover doorbells of admin SQ and CQ. However, if a
large stride, e.g. 10, is used, the doorbell of admin CQ will
be out of 8192 bytes. Consequently, a page fault will be raised
when the admin CQ doorbell is accessed in nvme_configure_admin_queue().

This patch fixes this issue by remapping BAR0 before accessing
admin CQ doorbell if the initial mapping is not enough.

Signed-off-by: "Xu, Yu A" 
---
 drivers/nvme/host/pci.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 9d4640a..7c991eb 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1322,6 +1322,17 @@ static int nvme_configure_admin_queue(struct nvme_dev 
*dev)
u32 aqa;
u64 cap = lo_hi_readq(dev->bar + NVME_REG_CAP);
struct nvme_queue *nvmeq;
+   struct pci_dev *pdev = to_pci_dev(dev->dev);
+   unsigned long size;
+
+   size = 4096 + 2 * 4 * dev->db_stride;
+   if (size > 8192) {
+   iounmap(dev->bar);
+   dev->bar = ioremap(pci_resource_start(pdev, 0), size);
+   if (!dev->bar)
+   return -ENOMEM;
+   dev->dbs = dev->bar + 4096;
+   }
 
dev->subsystem = readl(dev->bar + NVME_REG_VS) >= NVME_VS(1, 1, 0) ?
NVME_CAP_NSSRC(cap) : 0;
-- 
2.10.1



[PATCH v4] x86/efi: Correct ident mapping of efi old_map when kalsr enabled

2017-05-17 Thread Baoquan He
For EFI with 'efi=old_map' kernel option specified, Kernel will panic
when kaslr is enabled.

The back trace is:

BUG: unable to handle kernel paging request at 7febd57e
IP: 0x7febd57e
PGD 1025a067
PUD 0

Oops: 0010 [#1] SMP
[ ... ]
Call Trace:
 ? efi_call+0x58/0x90
 ? printk+0x58/0x6f
 efi_enter_virtual_mode+0x3c5/0x50d
 start_kernel+0x40f/0x4b8
 ? set_init_arg+0x55/0x55
 ? early_idt_handler_array+0x120/0x120
 x86_64_start_reservations+0x24/0x26
 x86_64_start_kernel+0x14c/0x16f
 start_cpu+0x14/0x14

The root cause is the ident mapping is not built correctly in old_map case.

For nokaslr kernel, PAGE_OFFSET is 0x8800 which is PGDIR_SIZE
aligned. We can borrow the pud table from direct mapping safely. Given a
physical address X, we have pud_index(X) == pud_index(__va(X)). However,
for kaslr kernel, PAGE_OFFSET is PUD_SIZE aligned. For a given physical
address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry
from direct mapping to build ident mapping, instead need copy pud entry
one by one from direct mapping.

Fix it.

Signed-off-by: Baoquan He 
Signed-off-by: Dave Young 
Cc: Matt Fleming 
Cc: Ard Biesheuvel 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: "H. Peter Anvin" 
Cc: Thomas Garnier 
Cc: Kees Cook 
Cc: Russ Anderson 
Cc: Frank Ramsay 
Cc: Borislav Petkov 
Cc: Bhupesh Sharma 
Cc: x...@kernel.org
Cc: linux-...@vger.kernel.org
---
v3->v4:
1. Forget running scripts/checkpatch.pl to check patch, there are several
code stype issue. Correct them in this version.

v2->v3:
1. Rewrite code to copy pud entry one by one so that code can be understood
better. Usually we only have less than 1TB or several TB memory, pud entry
copy one by one won't impact efficiency.

2. Adding p4d page table handling.

v1->v2:
Change code and add description according to Thomas's suggestion as below:

1. Add checking if pud table is allocated successfully. If not just break
the for loop.

2. Add code comment to explain how the 1:1 mapping is built in 
efi_call_phys_prolog

3. Other minor change

 arch/x86/platform/efi/efi_64.c | 70 +-
 1 file changed, 62 insertions(+), 8 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index c488625..087aafc 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -71,11 +71,13 @@ static void __init early_code_mapping_set_exec(int 
executable)
 
 pgd_t * __init efi_call_phys_prolog(void)
 {
-   unsigned long vaddress;
-   pgd_t *save_pgd;
+   unsigned long vaddr, addr_pgd, addr_p4d, addr_pud;
+   pgd_t *save_pgd, *pgd_k, *pgd_efi;
+   p4d_t *p4d, *p4d_k, *p4d_efi;
+   pud_t *pud;
 
int pgd;
-   int n_pgds;
+   int n_pgds, i, j;
 
if (!efi_enabled(EFI_OLD_MEMMAP)) {
save_pgd = (pgd_t *)read_cr3();
@@ -88,10 +90,44 @@ pgd_t * __init efi_call_phys_prolog(void)
n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
 
+   /*
+* Build 1:1 ident mapping for old_map usage. It needs to be noticed
+* that PAGE_OFFSET is PGDIR_SIZE aligned with KASLR disabled, while
+* PUD_SIZE ALIGNED with KASLR enabled. So for a given physical
+* address X, the pud_index(X) != pud_index(__va(X)), we can only copy
+* pud entry of __va(X) to fill in pud entry of X to build 1:1 mapping
+* . Means here we can only reuse pmd table of direct mapping.
+*/
for (pgd = 0; pgd < n_pgds; pgd++) {
-   save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
-   vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
-   set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), 
*pgd_offset_k(vaddress));
+   addr_pgd = (unsigned long)(pgd * PGDIR_SIZE);
+   vaddr = (unsigned long)__va(pgd * PGDIR_SIZE);
+   pgd_efi = pgd_offset_k(addr_pgd);
+   save_pgd[pgd] = *pgd_efi;
+   p4d =  p4d_alloc(&init_mm, pgd_efi, addr_pgd);
+
+   if (!p4d) {
+   pr_err("Failed to allocate p4d table!\n");
+   goto out;
+   }
+   for (i = 0; i < PTRS_PER_P4D; i++) {
+   addr_p4d = addr_pgd + i * P4D_SIZE;
+   p4d_efi = p4d + p4d_index(addr_p4d);
+   pud = pud_alloc(&init_mm, p4d_efi, addr_p4d);
+   if (!pud) {
+   pr_err("Failed to allocate pud table!\n");
+   goto out;
+   }
+   for (j = 0; j < PTRS_PER_PUD; j++) {
+   addr_pud = addr_p4d + j * PUD_SIZE;
+   if (addr_pud > (max_pfn << PAGE_SHIFT))
+   break;
+   vaddr = (unsigned l

Re: [infiniband-hw-i40iw] question about identical code for different branches

2017-05-17 Thread Leon Romanovsky
On Wed, May 17, 2017 at 05:06:54PM -0500, Gustavo A. R. Silva wrote:
>
> Hello everybody,
>
> While looking into Coverity ID 1362263 I ran into the following piece of
> code at drivers/infiniband/hw/i40iw/i40iw_virtchnl.c:445:
>
> 445if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> 446if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> 447vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> 448else
> 449vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> 450return I40IW_SUCCESS;
> 451}
>
> The issue is that lines of code 447 and 449 are identical for different
> branches.
>
> My question here is if one of the branches should be modified, or the entire
> _if_ statement replaced?
>
> Maybe a patch like the following could be applied:

It looks like that you can replace I40IW_VCHNL_OP_GET_VER_V0 with
I40IW_VCHNL_OP_GET_VER and get rid of all places with
I40IW_VCHNL_OP_GET_VER_V0.

Thanks

>
> index f4d1368..48fd327 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_virtchnl.c
> @@ -443,10 +443,7 @@ enum i40iw_status_code i40iw_vchnl_recv_pf(struct
> i40iw_sc_dev *dev,
> if (!dev->vchnl_up)
> return I40IW_ERR_NOT_READY;
> if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> -   if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> -   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> -   else
> -   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> +   vchnl_pf_send_get_ver_resp(dev, vf_id, vchnl_msg);
> return I40IW_SUCCESS;
> }
> for (iw_vf_idx = 0; iw_vf_idx < I40IW_MAX_PE_ENABLED_VF_COUNT;
> iw_vf_idx++) {
>
> What do you think?
>
> I'd really appreciate any comment on this.
>
> Thank you!
> --
> Gustavo A. R. Silva
>
>
>
>


signature.asc
Description: PGP signature


[PATCH v1] mm: drop NULL return check of pte_offset_map_lock()

2017-05-17 Thread Naoya Horiguchi
pte_offset_map_lock() finds and takes ptl, and returns pte.
But some callers return without unlocking the ptl when pte == NULL,
which seems weird.

Git history said that !pte check in change_pte_range() was introduced in
commit 1ad9f620c3a2 ("mm: numa: recheck for transhuge pages under lock
during protection changes") and still remains after commit 175ad4f1e7a2
("mm: mprotect: use pmd_trans_unstable instead of taking the pmd_lock")
which partially reverts 1ad9f620c3a2. So I think that it's just dead code.

Many other caller of pte_offset_map_lock() never check NULL return, so
let's do likewise.

Signed-off-by: Naoya Horiguchi 
---
 mm/memory.c   | 2 --
 mm/mprotect.c | 2 --
 2 files changed, 4 deletions(-)

diff --git v4.11-rc6-mmotm-2017-04-13-14-50/mm/memory.c 
v4.11-rc6-mmotm-2017-04-13-14-50_patched/mm/memory.c
index 8ae6700..c17fad1d 100644
--- v4.11-rc6-mmotm-2017-04-13-14-50/mm/memory.c
+++ v4.11-rc6-mmotm-2017-04-13-14-50_patched/mm/memory.c
@@ -4040,8 +4040,6 @@ static int __follow_pte_pmd(struct mm_struct *mm, 
unsigned long address,
goto out;
 
ptep = pte_offset_map_lock(mm, pmd, address, ptlp);
-   if (!ptep)
-   goto out;
if (!pte_present(*ptep))
goto unlock;
*ptepp = ptep;
diff --git v4.11-rc6-mmotm-2017-04-13-14-50/mm/mprotect.c 
v4.11-rc6-mmotm-2017-04-13-14-50_patched/mm/mprotect.c
index 8fd010f..d60a1ee 100644
--- v4.11-rc6-mmotm-2017-04-13-14-50/mm/mprotect.c
+++ v4.11-rc6-mmotm-2017-04-13-14-50_patched/mm/mprotect.c
@@ -58,8 +58,6 @@ static unsigned long change_pte_range(struct vm_area_struct 
*vma, pmd_t *pmd,
 * reading.
 */
pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
-   if (!pte)
-   return 0;
 
/* Get target node for single threaded private VMAs */
if (prot_numa && !(vma->vm_flags & VM_SHARED) &&
-- 
2.7.0



Re: commit cfafcd117 "futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()" causes glibc nptl/tst-robustpi8 failure

2017-05-17 Thread Peter Zijlstra
On Wed, May 17, 2017 at 07:50:31PM +0200, Florian Weimer wrote:
> On 05/17/2017 07:36 PM, Markus Trippelsdorf wrote:
> > Since:
> > commit cfafcd117da0216520568c195cb2f6cd1980c4bb
> > Author: Peter Zijlstra 
> > Date:   Wed Mar 22 11:35:58 2017 +0100
> > 
> > futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()
> > 
> > glibc's nptl/tst-robustpi8 testcase fails:
> > 
> > glibc-build % ./nptl/tst-robustpi8
> > tst-robustpi8: ../nptl/pthread_mutex_lock.c:424: __pthread_mutex_lock_full: 
> > Assertion `INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || !robust' failed.
> > 
> > pthread_mutex_lock.c:
> > 415 if (INTERNAL_SYSCALL_ERROR_P (e, __err)
> > 416 && (INTERNAL_SYSCALL_ERRNO (e, __err) == ESRCH
> > 417 || INTERNAL_SYSCALL_ERRNO (e, __err) == EDEADLK))
> > 418   {
> > 419 assert (INTERNAL_SYSCALL_ERRNO (e, __err) != EDEADLK
> > 420 || (kind != PTHREAD_MUTEX_ERRORCHECK_NP
> > 421 && kind != PTHREAD_MUTEX_RECURSIVE_NP));
> > 422 /* ESRCH can happen only for non-robust PI mutexes where
> > 423the owner of the lock died.  */
> > 424 assert (INTERNAL_SYSCALL_ERRNO (e, __err) != ESRCH || 
> > !robust);
> > 
> > During bisection the commit above hangs the machine when I run the
> > testcase.
> > 
> > See: https://sourceware.org/bugzilla/show_bug.cgi?id=21487
> 
> Markus, could you confirm that it is chocking on the EAGAIN failure?  Or
> is it something else?
> 
> What is userspace supposed to do with the error code?

IIRC that -EAGAIN should not get to userspace. The kernel should retry
the lock operation. I'll go stare at it.


  1   2   3   4   5   6   7   8   9   10   >