Re: [PATCH] x86/asm/entry/64: better check for canonical address

2015-03-31 Thread Ingo Molnar

* Denys Vlasenko  wrote:

> > I guess they could optimize it by adding a single "I am a modern 
> > OS executing regular userspace" flag to the descriptor [or 
> > expressing the same as a separate instruction], to avoid all that 
> > legacy crap that won't trigger on like 99.99% of systems ...
> 
> Yes, that would be a useful addition. Interrupt servicing on x86 
> takes a non-negligible hit because of IRET slowness.

But ... to react to your other patch: detecting the common easy case 
and doing a POPF+RET ourselves ought to be pretty good as well?

But only if ptregs->rip != the magic RET itself, to avoid recursion.

Even with all those extra checks it should still be much faster.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] [PATCH 0/7] fs: add blkdev name format specifier

2015-03-31 Thread Jens Axboe

On 03/31/2015 10:01 AM, Dmitry Monakhov wrote:

Currently in order to print block_device name one should  use blkdev() helper
which requires temproral buffer of size BDEVNAME_SIZE (32bytes). This is very
ineffective because result in stack usage bloating for deep IO call traces where
stack usage is close to maximum values.

It is reasonable to introduce dedicated format specifier for block_device name,
unfortunately "%pb", "%pB", "%pd" and "%pD" are already reserved for other data 
types
I've pick "%pg" ala geometry. If some one want to offer sane spacifier name
please let me know.

Since this is RFC version I've pick rough patch split policy (based on 
subsystem).
Please let me know if patchset should be split in different way.


I think this is looks good, nice improvement. I can take the lib and 
block parts, Al can pick up the fs bits.


--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: Factor out common CPU initialization code

2015-03-31 Thread Boris Ostrovsky

On 03/31/2015 11:55 AM, Ingo Molnar wrote:


* Boris Ostrovsky  wrote:


Some of x86 bare-metal and Xen CPU initialization code is common between the two
and therefore can be factored out to avoid code duplication.

As a side effect, doing so will also extend the fix provided by commit
a7fcf28d431e ("x86/asm/entry: Replace this_cpu_sp0() with current_top_of_stack()
to x86_32") to 32-bit Xen PV guests.

Signed-off-by: Boris Ostrovsky 
---
  arch/x86/include/asm/smp.h |  1 +
  arch/x86/kernel/smpboot.c  | 39 +++
  arch/x86/xen/smp.c | 14 +-
  3 files changed, 25 insertions(+), 29 deletions(-)


This does not apply to the latest x86 tree (tip:master).

Thanks,

Ingo




Yes, I was somewhat out-of-date, sorry. Let me re-test this and submit v2.

-boris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT PULL] selftest: Add futex functional tests

2015-03-31 Thread Shuah Khan
On 03/31/2015 10:24 AM, Darren Hart wrote:
> On 3/31/15, 8:32 AM, "Shuah Khan"  wrote:
> 
>> Hi Daren,
>>
>> On 03/27/2015 04:17 PM, Darren Hart wrote:
>>> Hi Shuah,
>>>
>>> This series begins the process of migrating my futextest tests into
>>> kselftest.
>>> I've started with only the functional tests, as the performance and
>>> stress may
>>> not be appropriate for kselftest as they stand.
>>>
>>> I cleaned up various complaints from checkpatch, but I ignored others
>>> that would
>>> require significant rework of the testcases, such as not using volatile
>>> and not
>>> creating new typedefs.
>>>
>>> The patches will follow, but I'm providing a pull request for your
>>> convenience
>>> as well.
>>
>> Thanks for acting on this so quickly after we talked about it at ELC.
>> Just a quick note that I am going to get to this soon once I get the
>> 4.1 content wrapped up. We can plan upon getting these into 4.2.
> 
> OK. Michael E. provided some feedback which I can either incorporate and
> respin, or I can send as a follow-on to your -next after you merge these.
> Which do you prefer?
> 

Working through my email. Yes I see Michael had comments on install.
I would have the same ones. Please re-do the patch 2/5 to use shared
logic and install framework in lib.mk. This need to be done to
facilitate test install. If you were to create a script for running
tests, please make it non-generic and unique. For example, run.sh
is a very generic name.

[PATCH 2/5] selftest/futex: Update Makefile to use lib.mk

I took a quick look at the exit code discussion. If you would
like improve what is in kselftest.h, please re-do that patch.

[PATCH 5/5] kselftest: Add exit code defines

You can wait to re-do patches. I am planning to review the
patch set later on this week. That way you can avoid re-spin
just in case, I have other comments.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/7] fs: use block_device name vsprintf helper

2015-03-31 Thread Dmitry Monakhov

Signed-off-by: Dmitry Monakhov 
---
 fs/btrfs/super.c  |4 +---
 fs/buffer.c   |   21 ++---
 fs/ext2/xattr.c   |6 ++
 fs/ext3/super.c   |5 ++---
 fs/ext3/xattr.c   |5 ++---
 fs/ext4/page-io.c |5 ++---
 fs/ext4/xattr.c   |6 ++
 fs/f2fs/debug.c   |6 ++
 fs/gfs2/ops_fstype.c  |4 +---
 fs/jbd/commit.c   |4 +---
 fs/jbd/journal.c  |   34 --
 fs/jbd/transaction.c  |6 ++
 fs/jbd2/transaction.c |6 ++
 fs/minix/itree_v1.c   |9 -
 fs/minix/itree_v2.c   |9 -
 fs/nilfs2/super.c |6 ++
 fs/reiserfs/journal.c |   24 ++--
 fs/reiserfs/prints.c  |9 +++--
 fs/reiserfs/procfs.c  |5 ++---
 fs/squashfs/super.c   |7 +++
 fs/super.c|4 +---
 fs/xfs/xfs_buf.c  |8 ++--
 22 files changed, 68 insertions(+), 125 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 05fef19..f12db53 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1376,9 +1376,7 @@ static struct dentry *btrfs_mount(struct file_system_type 
*fs_type, int flags,
if ((flags ^ s->s_flags) & MS_RDONLY)
error = -EBUSY;
} else {
-   char b[BDEVNAME_SIZE];
-
-   strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
+   snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev);
btrfs_sb(s)->bdev_holder = fs_type;
error = btrfs_fill_super(s, fs_devices, data,
 flags & MS_SILENT ? 1 : 0);
diff --git a/fs/buffer.c b/fs/buffer.c
index 20805db..6697cc8 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -130,13 +130,10 @@ __clear_page_buffers(struct page *page)
 
 static void buffer_io_error(struct buffer_head *bh, char *msg)
 {
-   char b[BDEVNAME_SIZE];
-
if (!test_bit(BH_Quiet, >b_state))
printk_ratelimited(KERN_ERR
-   "Buffer I/O error on dev %s, logical block %llu%s\n",
-   bdevname(bh->b_bdev, b),
-   (unsigned long long)bh->b_blocknr, msg);
+   "Buffer I/O error on dev %pg, logical block %llu%s\n",
+   bh->b_bdev, (unsigned long long)bh->b_blocknr, msg);
 }
 
 /*
@@ -233,15 +230,13 @@ __find_get_block_slow(struct block_device *bdev, sector_t 
block)
 * elsewhere, don't buffer_error if we had some unmapped buffers
 */
if (all_mapped) {
-   char b[BDEVNAME_SIZE];
-
printk("__find_get_block_slow() failed. "
"block=%llu, b_blocknr=%llu\n",
(unsigned long long)block,
(unsigned long long)bh->b_blocknr);
printk("b_state=0x%08lx, b_size=%zu\n",
bh->b_state, bh->b_size);
-   printk("device %s blocksize: %d\n", bdevname(bdev, b),
+   printk("device %pg blocksize: %d\n", bdev,
1 << bd_inode->i_blkbits);
}
 out_unlock:
@@ -527,10 +522,8 @@ repeat:
 
 static void do_thaw_one(struct super_block *sb, void *unused)
 {
-   char b[BDEVNAME_SIZE];
while (sb->s_bdev && !thaw_bdev(sb->s_bdev, sb))
-   printk(KERN_WARNING "Emergency Thaw on %s\n",
-  bdevname(sb->s_bdev, b));
+   printk(KERN_WARNING "Emergency Thaw on %pg\n", sb->s_bdev);
 }
 
 static void do_thaw_all(struct work_struct *work)
@@ -1057,12 +1050,10 @@ grow_buffers(struct block_device *bdev, sector_t block, 
int size, gfp_t gfp)
 * pagecache index.  (this comparison is done using sector_t types).
 */
if (unlikely(index != block >> sizebits)) {
-   char b[BDEVNAME_SIZE];
-
printk(KERN_ERR "%s: requested out-of-range block %llu for "
-   "device %s\n",
+   "device %pg\n",
__func__, (unsigned long long)block,
-   bdevname(bdev, b));
+   bdev);
return -EIO;
}
 
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 9142614..f918c97 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -77,10 +77,8 @@
printk("\n"); \
} while (0)
 # define ea_bdebug(bh, f...) do { \
-   char b[BDEVNAME_SIZE]; \
-   printk(KERN_DEBUG "block %s:%lu: ", \
-   bdevname(bh->b_bdev, b), \
-   (unsigned long) bh->b_blocknr); \
+   printk(KERN_DEBUG "block %pg:%lu: ", \
+   bh->b_bdev, (unsigned long) bh->b_blocknr); \
printk(f); \
printk("\n"); \
} while (0)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index d4dbf3c..c186918 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1429,9 +1429,8 @@ static int 

[PATCH 6/7] block/partitions: use block_device name vsprintf helper

2015-03-31 Thread Dmitry Monakhov

Signed-off-by: Dmitry Monakhov 
---
 block/partitions/amiga.c |   13 ++---
 block/partitions/sgi.c   |9 -
 block/partitions/sun.c   |9 -
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/block/partitions/amiga.c b/block/partitions/amiga.c
index 2b13533..240f4f6 100644
--- a/block/partitions/amiga.c
+++ b/block/partitions/amiga.c
@@ -34,7 +34,6 @@ int amiga_partition(struct parsed_partitions *state)
int start_sect, nr_sects, blk, part, res = 0;
int blksize = 1;/* Multiplier for disk block size */
int slot = 1;
-   char b[BDEVNAME_SIZE];
 
for (blk = 0; ; blk++, put_dev_sector(sect)) {
if (blk == RDB_ALLOCATION_LIMIT)
@@ -42,8 +41,8 @@ int amiga_partition(struct parsed_partitions *state)
data = read_part_sector(state, blk, );
if (!data) {
if (warn_no_part)
-   pr_err("Dev %s: unable to read RDB block %d\n",
-  bdevname(state->bdev, b), blk);
+   pr_err("Dev %pg: unable to read RDB block %d\n",
+  state->bdev, blk);
res = -1;
goto rdb_done;
}
@@ -64,8 +63,8 @@ int amiga_partition(struct parsed_partitions *state)
break;
}
 
-   pr_err("Dev %s: RDB in block %d has bad checksum\n",
-  bdevname(state->bdev, b), blk);
+   pr_err("Dev %pg: RDB in block %d has bad checksum\n",
+  state->bdev, blk);
}
 
/* blksize is blocks per 512 byte standard block */
@@ -85,8 +84,8 @@ int amiga_partition(struct parsed_partitions *state)
data = read_part_sector(state, blk, );
if (!data) {
if (warn_no_part)
-   pr_err("Dev %s: unable to read partition block 
%d\n",
-  bdevname(state->bdev, b), blk);
+   pr_err("Dev %pg: unable to read partition block 
%d\n",
+  state->bdev, blk);
res = -1;
goto rdb_done;
}
diff --git a/block/partitions/sgi.c b/block/partitions/sgi.c
index ea8a86d..b040277 100644
--- a/block/partitions/sgi.c
+++ b/block/partitions/sgi.c
@@ -37,7 +37,6 @@ int sgi_partition(struct parsed_partitions *state)
Sector sect;
struct sgi_disklabel *label;
struct sgi_partition *p;
-   char b[BDEVNAME_SIZE];
 
label = read_part_sector(state, 0, );
if (!label)
@@ -45,8 +44,8 @@ int sgi_partition(struct parsed_partitions *state)
p = >partitions[0];
magic = label->magic_mushroom;
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
-   /*printk("Dev %s SGI disklabel: bad magic %08x\n",
-  bdevname(bdev, b), be32_to_cpu(magic));*/
+   /*printk("Dev %pg SGI disklabel: bad magic %08x\n",
+  bdev, be32_to_cpu(magic));*/
put_dev_sector(sect);
return 0;
}
@@ -56,8 +55,8 @@ int sgi_partition(struct parsed_partitions *state)
csum += be32_to_cpu(cs);
}
if(csum) {
-   printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label 
corrupted\n",
-  bdevname(state->bdev, b));
+   printk(KERN_WARNING "Dev %pg SGI disklabel: csum bad, label 
corrupted\n",
+  state->bdev);
put_dev_sector(sect);
return 0;
}
diff --git a/block/partitions/sun.c b/block/partitions/sun.c
index b5b6fcf..25343d6 100644
--- a/block/partitions/sun.c
+++ b/block/partitions/sun.c
@@ -57,7 +57,6 @@ int sun_partition(struct parsed_partitions *state)
} * label;
struct sun_partition *p;
unsigned long spc;
-   char b[BDEVNAME_SIZE];
int use_vtoc;
int nparts;
 
@@ -67,8 +66,8 @@ int sun_partition(struct parsed_partitions *state)
 
p = label->partitions;
if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
-/* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
-  bdevname(bdev, b), be16_to_cpu(label->magic)); */
+/* printk(KERN_INFO "Dev %pg Sun disklabel: bad magic %04x\n",
+  bdev, be16_to_cpu(label->magic)); */
put_dev_sector(sect);
return 0;
}
@@ -77,8 +76,8 @@ int sun_partition(struct parsed_partitions *state)
for (csum = 0; ush >= ((__be16 *) label);)
csum ^= *ush--;
if (csum) {
-   printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
-  bdevname(state->bdev, b));
+   printk("Dev %pg Sun disklabel: Csum bad, label 

[PATCH 1/7] lib/vsprintf: add %*pg format specifier

2015-03-31 Thread Dmitry Monakhov
This allow to directly print block_device name.
Currently one should use bdevname() with temporal char buf[BDEVNAME_SIZE].
This is very ineffective because bloat stack usage for deep IO call-traces

Example:
%pg  ->sda, sda1 or loop0p1

Signed-off-by: Dmitry Monakhov 
---
 Documentation/printk-formats.txt |6 ++
 lib/vsprintf.c   |   28 
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index 5a615c1..de2f18f 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -216,6 +216,12 @@ dentry names:
equivalent of %s dentry->d_name.name we used to use, %pd prints
n last components.  %pD does the same thing for struct file.
 
+block_device names:
+
+   %pg sda, sda1 or loop0p1
+
+   For printing name of block_device pointers.
+
 struct va_format:
 
%pV
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b235c96..57f6fa9 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -29,6 +29,9 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_BLOCK
+#include 
+#endif
 
 #include   /* for PAGE_SIZE */
 #include   /* for dereference_function_descriptor() */
@@ -610,6 +613,23 @@ char *dentry_name(char *buf, char *end, const struct 
dentry *d, struct printf_sp
return buf;
 }
 
+#ifdef CONFIG_BLOCK
+static noinline_for_stack
+char *bdev_name(char *buf, char *end, struct block_device *bdev,
+   struct printf_spec spec, const char *fmt)
+{
+   struct gendisk *hd = bdev->bd_disk;
+   
+   buf = string(buf, end, hd->disk_name, spec);
+   if (bdev->bd_part->partno) {
+   if (isdigit(hd->disk_name[strlen(hd->disk_name)-1]) && buf < 
end)
+   *buf++ = 'p';
+   buf = number(buf, end, bdev->bd_part->partno, spec);
+   }
+   return buf;
+}
+#endif
+
 static noinline_for_stack
 char *symbol_string(char *buf, char *end, void *ptr,
struct printf_spec spec, const char *fmt)
@@ -1404,6 +1424,8 @@ int kptr_restrict __read_mostly;
  *   (default assumed to be phys_addr_t, passed by reference)
  * - 'd[234]' For a dentry name (optionally 2-4 last components)
  * - 'D[234]' Same as 'd' but for a struct file
+ * - 'g' For block_device name (gendisk + partition number)
+
  *
  * Note: The difference between 'S' and 'F' is that on ia64 and ppc64
  * function pointers are really function descriptors, which contain a
@@ -1552,6 +1574,11 @@ char *pointer(const char *fmt, char *buf, char *end, 
void *ptr,
return dentry_name(buf, end,
   ((const struct file *)ptr)->f_path.dentry,
   spec, fmt);
+#ifdef CONFIG_BLOCK
+   case 'g':
+   return bdev_name(buf, end, ptr, spec, fmt);
+#endif
+
}
spec.flags |= SMALL;
if (spec.field_width == -1) {
@@ -1779,6 +1806,7 @@ qualifier:
  * %pF output the name of a function pointer with its offset
  * %pf output the name of a function pointer without its offset
  * %pB output the name of a backtrace symbol with its offset
+ * %pg output the name of a block_device
  * %pR output the address range in a struct resource with decoded flags
  * %pr output the address range in a struct resource with raw flags
  * %pb output the bitmap with field width as the number of bits
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] drivers: use block_device name vsprintf helper

2015-03-31 Thread Dmitry Monakhov

Signed-off-by: Dmitry Monakhov 
---
 drivers/block/drbd/drbd_req.c   |6 ++
 drivers/block/pktcdvd.c |   14 --
 drivers/scsi/wd7000.c   |6 +-
 drivers/target/target_core_iblock.c |4 +---
 4 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 34f2f0b..1c268ba 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -536,16 +536,14 @@ static void mod_rq_state(struct drbd_request *req, struct 
bio_and_error *m,
 
 static void drbd_report_io_error(struct drbd_device *device, struct 
drbd_request *req)
 {
-char b[BDEVNAME_SIZE];
-
if (!__ratelimit(_ratelimit_state))
return;
 
-   drbd_warn(device, "local %s IO error sector %llu+%u on %s\n",
+   drbd_warn(device, "local %s IO error sector %llu+%u on %pg\n",
(req->rq_state & RQ_WRITE) ? "WRITE" : "READ",
(unsigned long long)req->i.sector,
req->i.size >> 9,
-   bdevname(device->ldev->backing_bdev, b));
+   device->ldev->backing_bdev);
 }
 
 /* Helper for HANDED_OVER_TO_NETWORK.
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 09e628d..024beca 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2443,13 +2443,11 @@ static void pkt_make_request_write(struct request_queue 
*q, struct bio *bio)
 static void pkt_make_request(struct request_queue *q, struct bio *bio)
 {
struct pktcdvd_device *pd;
-   char b[BDEVNAME_SIZE];
struct bio *split;
 
pd = q->queuedata;
if (!pd) {
-   pr_err("%s incorrect request queue\n",
-  bdevname(bio->bi_bdev, b));
+   pr_err("%pg incorrect request queue\n", bio->bi_bdev);
goto end_io;
}
 
@@ -2538,11 +2536,9 @@ static int pkt_seq_show(struct seq_file *m, void *p)
 {
struct pktcdvd_device *pd = m->private;
char *msg;
-   char bdev_buf[BDEVNAME_SIZE];
int states[PACKET_NUM_STATES];
 
-   seq_printf(m, "Writer %s mapped to %s:\n", pd->name,
-  bdevname(pd->bdev, bdev_buf));
+   seq_printf(m, "Writer %s mapped to %pg:\n", pd->name, pd->bdev);
 
seq_printf(m, "\nSettings:\n");
seq_printf(m, "\tpacket size:\t\t%dkB\n", pd->settings.size / 2);
@@ -2612,7 +2608,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t 
dev)
 {
int i;
int ret = 0;
-   char b[BDEVNAME_SIZE];
struct block_device *bdev;
 
if (pd->pkt_dev == dev) {
@@ -2624,8 +2619,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t 
dev)
if (!pd2)
continue;
if (pd2->bdev->bd_dev == dev) {
-   pkt_err(pd, "%s already setup\n",
-   bdevname(pd2->bdev, b));
+   pkt_err(pd, "%pg already setup\n", pd2->bdev);
return -EBUSY;
}
if (pd2->pkt_dev == dev) {
@@ -2658,7 +2652,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t 
dev)
}
 
proc_create_data(pd->name, 0, pkt_proc, _proc_fops, pd);
-   pkt_dbg(1, pd, "writer mapped to %s\n", bdevname(bdev, b));
+   pkt_dbg(1, pd, "writer mapped to %pg\n", bdev);
return 0;
 
 out_mem:
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 0c0f17b..eb01bf3 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1589,11 +1589,7 @@ static int wd7000_host_reset(struct scsi_cmnd *SCpnt)
 static int wd7000_biosparam(struct scsi_device *sdev,
struct block_device *bdev, sector_t capacity, int *ip)
 {
-   char b[BDEVNAME_SIZE];
-
-   dprintk("wd7000_biosparam: dev=%s, size=%d, ",
-   bdevname(bdev, b), capacity);
-   (void)b;/* unused var warning? */
+   dprintk("wd7000_biosparam: dev=%pg, size=%d, ", bdev, capacity);
 
/*
 * try default translation
diff --git a/drivers/target/target_core_iblock.c 
b/drivers/target/target_core_iblock.c
index d4a4b0f..da4d157 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -602,12 +602,10 @@ static ssize_t iblock_show_configfs_dev_params(struct 
se_device *dev, char *b)
 {
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
struct block_device *bd = ib_dev->ibd_bd;
-   char buf[BDEVNAME_SIZE];
ssize_t bl = 0;
 
if (bd)
-   bl += sprintf(b + bl, "iBlock device: %s",
-   bdevname(bd, buf));
+   bl += sprintf(b + bl, "iBlock device: %pg", bd);
if (ib_dev->ibd_flags & IBDF_HAS_UDEV_PATH)
bl += sprintf(b + bl, "  UDEV PATH: %s",
ib_dev->ibd_udev_path);
-- 
1.7.1

--
To unsubscribe from 

[PATCH 5/7] md: use block_device name vsprintf helper

2015-03-31 Thread Dmitry Monakhov

Signed-off-by: Dmitry Monakhov 
---
 drivers/md/bcache/debug.c|6 +-
 drivers/md/bcache/io.c   |8 +--
 drivers/md/bcache/super.c|   32 --
 drivers/md/dm-cache-target.c |5 +-
 drivers/md/dm-table.c|   32 -
 drivers/md/dm-thin.c |8 +--
 drivers/md/linear.c  |5 +-
 drivers/md/md.c  |  141 --
 drivers/md/multipath.c   |   29 +++-
 drivers/md/raid0.c   |   33 --
 drivers/md/raid1.c   |   37 ---
 drivers/md/raid10.c  |   64 +++
 drivers/md/raid5.c   |   37 +--
 13 files changed, 171 insertions(+), 266 deletions(-)

diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 8b1f1d5..fb61f55 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -104,7 +104,6 @@ void bch_btree_verify(struct btree *b)
 
 void bch_data_verify(struct cached_dev *dc, struct bio *bio)
 {
-   char name[BDEVNAME_SIZE];
struct bio *check;
struct bio_vec bv, *bv2;
struct bvec_iter iter;
@@ -127,9 +126,8 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
p2 + bv.bv_offset,
bv.bv_len),
 dc->disk.c,
-"verify failed at dev %s sector %llu",
-bdevname(dc->bdev, name),
-(uint64_t) bio->bi_iter.bi_sector);
+"verify failed at dev %pg sector %llu",
+dc->bdev, (uint64_t) bio->bi_iter.bi_sector);
 
kunmap_atomic(p1);
}
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index fa028fa..7e21113 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -188,18 +188,16 @@ void bch_count_io_errors(struct cache *ca, int error, 
const char *m)
}
 
if (error) {
-   char buf[BDEVNAME_SIZE];
unsigned errors = atomic_add_return(1 << IO_ERROR_SHIFT,
>io_errors);
errors >>= IO_ERROR_SHIFT;
 
if (errors < ca->set->error_limit)
-   pr_err("%s: IO error on %s, recovering",
-  bdevname(ca->bdev, buf), m);
+   pr_err("%pg: IO error on %s, recovering", ca->bdev , m);
else
bch_cache_set_error(ca->set,
-   "%s: too many IO errors %s",
-   bdevname(ca->bdev, buf), m);
+   "%pg: too many IO errors %s",
+   ca->bdev, m);
}
 }
 
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 4dd2bb7..b15b7db 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -907,7 +907,6 @@ void bch_cached_dev_run(struct cached_dev *dc)
 static void cached_dev_detach_finish(struct work_struct *w)
 {
struct cached_dev *dc = container_of(w, struct cached_dev, detach);
-   char buf[BDEVNAME_SIZE];
struct closure cl;
closure_init_stack();
 
@@ -930,7 +929,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
 
mutex_unlock(_register_lock);
 
-   pr_info("Caching disabled for %s", bdevname(dc->bdev, buf));
+   pr_info("Caching disabled for %pg", dc->bdev);
 
/* Drop ref we took in cached_dev_detach() */
closure_put(>disk.cl);
@@ -960,27 +959,24 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct 
cache_set *c)
 {
uint32_t rtime = cpu_to_le32(get_seconds());
struct uuid_entry *u;
-   char buf[BDEVNAME_SIZE];
-
-   bdevname(dc->bdev, buf);
 
if (memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))
return -ENOENT;
 
if (dc->disk.c) {
-   pr_err("Can't attach %s: already attached", buf);
+   pr_err("Can't attach %pg: already attached", dc->bdev);
return -EINVAL;
}
 
if (test_bit(CACHE_SET_STOPPING, >flags)) {
-   pr_err("Can't attach %s: shutting down", buf);
+   pr_err("Can't attach %pg: shutting down", dc->bdev);
return -EINVAL;
}
 
if (dc->sb.block_size < c->sb.block_size) {
/* Will die */
-   pr_err("Couldn't attach %s: block size less than set's block 
size",
-  buf);
+   pr_err("Couldn't attach %pg: block size less than set's block 
size",
+  dc->bdev);
return -EINVAL;
}
 
@@ -996,13 +992,13 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct 
cache_set *c)
 
if (!u) {
if (BDEV_STATE(>sb) == BDEV_STATE_DIRTY) {
-   

[PATCH 3/7] block: use block_device name vsprintf helper

2015-03-31 Thread Dmitry Monakhov

Signed-off-by: Dmitry Monakhov 
---
 block/blk-core.c |   30 --
 block/blk-settings.c |9 ++---
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 794c3e7..88a4c94 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1694,12 +1694,9 @@ static inline void blk_partition_remap(struct bio *bio)
 
 static void handle_bad_sector(struct bio *bio)
 {
-   char b[BDEVNAME_SIZE];
-
printk(KERN_INFO "attempt to access beyond end of device\n");
-   printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
-   bdevname(bio->bi_bdev, b),
-   bio->bi_rw,
+   printk(KERN_INFO "%pg: rw=%ld, want=%Lu, limit=%Lu\n",
+   bio->bi_bdev,bio->bi_rw,
(unsigned long long)bio_end_sector(bio),
(long long)(i_size_read(bio->bi_bdev->bd_inode) >> 9));
 
@@ -1776,7 +1773,6 @@ generic_make_request_checks(struct bio *bio)
struct request_queue *q;
int nr_sectors = bio_sectors(bio);
int err = -EIO;
-   char b[BDEVNAME_SIZE];
struct hd_struct *part;
 
might_sleep();
@@ -1788,16 +1784,16 @@ generic_make_request_checks(struct bio *bio)
if (unlikely(!q)) {
printk(KERN_ERR
   "generic_make_request: Trying to access "
-   "nonexistent block-device %s (%Lu)\n",
-   bdevname(bio->bi_bdev, b),
-   (long long) bio->bi_iter.bi_sector);
+  "nonexistent block-device %pg (%Lu)\n",
+  bio->bi_bdev,
+  (long long) bio->bi_iter.bi_sector);
goto end_io;
}
 
if (likely(bio_is_rw(bio) &&
   nr_sectors > queue_max_hw_sectors(q))) {
-   printk(KERN_ERR "bio too big device %s (%u > %u)\n",
-  bdevname(bio->bi_bdev, b),
+   printk(KERN_ERR "bio too big device %pg (%u > %u)\n",
+  bio->bi_bdev,
   bio_sectors(bio),
   queue_max_hw_sectors(q));
goto end_io;
@@ -1970,13 +1966,11 @@ void submit_bio(int rw, struct bio *bio)
}
 
if (unlikely(block_dump)) {
-   char b[BDEVNAME_SIZE];
-   printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u 
sectors)\n",
-   current->comm, task_pid_nr(current),
-   (rw & WRITE) ? "WRITE" : "READ",
-   (unsigned long long)bio->bi_iter.bi_sector,
-   bdevname(bio->bi_bdev, b),
-   count);
+   printk(KERN_DEBUG "%s(%d): %s block %Lu on %pg (%u 
sectors)\n",
+  current->comm, task_pid_nr(current),
+  (rw & WRITE) ? "WRITE" : "READ",
+  (unsigned long long)bio->bi_iter.bi_sector,
+  bio->bi_bdev, count);
}
}
 
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 6ed2cbe..45d52cf 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -689,13 +689,8 @@ void disk_stack_limits(struct gendisk *disk, struct 
block_device *bdev,
struct request_queue *t = disk->queue;
 
if (bdev_stack_limits(>limits, bdev, offset >> 9) < 0) {
-   char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE];
-
-   disk_name(disk, 0, top);
-   bdevname(bdev, bottom);
-
-   printk(KERN_NOTICE "%s: Warning: Device %s is misaligned\n",
-  top, bottom);
+   printk(KERN_NOTICE "%s: Warning: Device %pg is misaligned\n",
+  disk->disk_name, bdev);
}
 }
 EXPORT_SYMBOL(disk_stack_limits);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 2/2] Kbuild: avoid partial linking of drivers/built-in.o

2015-03-31 Thread Russell King - ARM Linux
On Tue, Mar 31, 2015 at 05:27:22PM +0100, Dave Martin wrote:
> On Tue, Mar 31, 2015 at 11:22:29AM -0400, Nicolas Pitre wrote:
> > I'm using -ffunction-sections as well for the kernel size reduction work 
> > I'm currently doing.  The linker script has to be adapted so .text.* is 
> > specified along .text otherwise those functions end up appended at the 
> > end of the binary.
> 
> Interesting ... do you also mean using --gc-sections at link time?
> We'd need to avoid pruning needed code that has no explicit caller,
> and functions that are part of the kernel/module ABI but not used
> within vmlinux.
> 
> The GCC docs suggest that -ffunction-sections may impact performance
> and/or increase code size, but I don't know by how much.  Maybe it
> interferes with inling.

I've mentioned these options over the course of the last couple of
months.  David Woodhouse replied in February, so it's worth reading
up on that work.

David Woodhouse wrote:
| In many kernel configurations there are actually quite a lot of
| functions that are never called, and I was quite surprised the first
| time I played with this stuff.
| 
| There are a few ways of dealing with it. One is to use
| -ffunction-section -fdata-sections --gc-sections as you noted. I once
| also played with using GCC's --combine during the brief period that it
| was supported and not *entirely* broken, with similar effects:
| https://lwn.net/Articles/197097/
| 
| These days, the better answer is probably LTO. We could potentially
| still look at --gc-sections, but I suspect we're better off using LTO
| and just filing toolchain bugs until everything that --gc-sections
| *would* have dropped is also dropped from the LTO build :)
| 
| Unless --gc-sections actually speeds up the build in a significant way;
| a full LTO link of the kernel takes insane amounts of memory IIRC.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/7] fs: use gendisk->disk_name where possible

2015-03-31 Thread Dmitry Monakhov
gendisk with part==0 is obviously gendisk->disk_name.

Signed-off-by: Dmitry Monakhov 
---
 fs/block_dev.c |   12 +++-
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2e522ae..ec43814 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1013,12 +1013,9 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder);
 static void flush_disk(struct block_device *bdev, bool kill_dirty)
 {
if (__invalidate_device(bdev, kill_dirty)) {
-   char name[BDEVNAME_SIZE] = "";
-
-   if (bdev->bd_disk)
-   disk_name(bdev->bd_disk, 0, name);
printk(KERN_WARNING "VFS: busy inodes on changed media or "
-  "resized disk %s\n", name);
+  "resized disk %s\n",
+  bdev->bd_disk ? bdev->bd_disk->disk_name : "");
}
 
if (!bdev->bd_disk)
@@ -1042,12 +1039,9 @@ void check_disk_size_change(struct gendisk *disk, struct 
block_device *bdev)
disk_size = (loff_t)get_capacity(disk) << 9;
bdev_size = i_size_read(bdev->bd_inode);
if (disk_size != bdev_size) {
-   char name[BDEVNAME_SIZE];
-
-   disk_name(disk, 0, name);
printk(KERN_INFO
   "%s: detected capacity change from %lld to %lld\n",
-  name, bdev_size, disk_size);
+  disk->disk_name, bdev_size, disk_size);
i_size_write(bdev->bd_inode, disk_size);
flush_disk(bdev, false);
}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC] [PATCH 0/7] fs: add blkdev name format specifier

2015-03-31 Thread Dmitry Monakhov
Currently in order to print block_device name one should  use blkdev() helper
which requires temproral buffer of size BDEVNAME_SIZE (32bytes). This is very
ineffective because result in stack usage bloating for deep IO call traces where
stack usage is close to maximum values.

It is reasonable to introduce dedicated format specifier for block_device name,
unfortunately "%pb", "%pB", "%pd" and "%pD" are already reserved for other data 
types
I've pick "%pg" ala geometry. If some one want to offer sane spacifier name
please let me know.

Since this is RFC version I've pick rough patch split policy (based on 
subsystem).
Please let me know if patchset should be split in different way.

TOC:
## Add format helpers and simple cleanup
lib: vsprintf add pg format specifier
fs: use gendisk disk_name where possible
## migrate subsystems to format helpers
block: use block_device name vsprintf helper
fs: use block_device name vsprintf helper
md: use block_device name vsprintf helper
block/partitions use block_device name vsprintf help
drivers: use block_device name vsprintf helper

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 05/15] dt-bindings: Document the STM32 reset bindings

2015-03-31 Thread Maxime Coquelin
This adds documentation of device tree bindings for the
STM32 reset controller.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 .../devicetree/bindings/reset/st,stm32-rcc.txt | 107 +
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt

diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt 
b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
new file mode 100644
index 000..e2e2f25
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
@@ -0,0 +1,107 @@
+STMicroelectronics STM32 Peripheral Reset Controller
+
+
+The RCC IP is both a reset and a clock controller. This documentation only
+document the reset part.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "st,stm32-rcc"
+- reg: should be register base and length as documented in the
+  datasheet
+- #reset-cells: 1, see below
+
+example:
+
+rcc: reset@40023800 {
+   #reset-cells = <1>;
+   compatible = "st,stm32-rcc";
+   reg = <0x40023800 0x400>;
+};
+
+Specifying softreset control of devices
+===
+
+Device nodes should specify the reset channel required in their "resets"
+property, containing a phandle to the reset device node and an index specifying
+which channel to use.
+The index is the bit number within the RCC registers bank, starting from RCC
+base address.
+It is calculated as: index = register_offset / 4 * 32 + bit_offset.
+Where bit_offset is the bit offset within the register.
+For example, for CRC reset:
+  crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
+
+example:
+
+   timer2 {
+   resets  = < 256>;
+   };
+
+List of valid indices for STM32F429:
+ - gpioa: 128
+ - gpiob: 129
+ - gpioc: 130
+ - gpiod: 131
+ - gpioe: 132
+ - gpiof: 133
+ - gpiog: 134
+ - gpioh: 135
+ - gpioi: 136
+ - gpioj: 137
+ - gpiok: 138
+ - crc: 140
+ - dma1: 149
+ - dma2: 150
+ - dma2d: 151
+ - ethmac: 153
+ - otghs: 157
+ - dcmi: 160
+ - cryp: 164
+ - hash: 165
+ - rng: 166
+ - otgfs: 167
+ - fmc: 192
+ - tim2: 256
+ - tim3: 257
+ - tim4: 258
+ - tim5: 259
+ - tim6: 260
+ - tim7: 261
+ - tim12: 262
+ - tim13: 263
+ - tim14: 264
+ - wwdg: 267
+ - spi2: 270
+ - spi3: 271
+ - uart2: 273
+ - uart3: 274
+ - uart4: 275
+ - uart5: 276
+ - i2c1: 277
+ - i2c2: 278
+ - i2c3: 279
+ - can1: 281
+ - can2: 282
+ - pwr: 284
+ - dac: 285
+ - uart7: 286
+ - uart8: 287
+ - tim1: 288
+ - tim8: 289
+ - usart1: 292
+ - usart6: 293
+ - adc: 296
+ - sdio: 299
+ - spi1: 300
+ - spi4: 301
+ - syscfg: 302
+ - tim9: 304
+ - tim10: 305
+ - tim11: 306
+ - spi5: 308
+ - spi6: 309
+ - sai1: 310
+ - ltdc: 314
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 06/15] drivers: reset: Add STM32 reset driver

2015-03-31 Thread Maxime Coquelin
The STM32 MCUs family IPs can be reset by accessing some registers
from the RCC block.

The list of available reset lines is documented in the DT bindings.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 drivers/reset/Makefile  |   1 +
 drivers/reset/reset-stm32.c | 124 
 2 files changed, 125 insertions(+)
 create mode 100644 drivers/reset/reset-stm32.c

diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 157d421..aed12d1 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
+obj-$(CONFIG_ARCH_STM32) += reset-stm32.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_ARCH_STI) += sti/
diff --git a/drivers/reset/reset-stm32.c b/drivers/reset/reset-stm32.c
new file mode 100644
index 000..2c41858
--- /dev/null
+++ b/drivers/reset/reset-stm32.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author:  Maxime Coquelin 
+ * License terms:  GNU General Public License (GPL), version 2
+ *
+ * Heavily based on sunxi driver from Maxime Ripard.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct stm32_reset_data {
+   spinlock_t  lock;
+   void __iomem*membase;
+   struct reset_controller_dev rcdev;
+};
+
+static int stm32_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+   struct stm32_reset_data *data = container_of(rcdev,
+struct stm32_reset_data,
+rcdev);
+   int bank = id / BITS_PER_LONG;
+   int offset = id % BITS_PER_LONG;
+   unsigned long flags;
+   u32 reg;
+
+   spin_lock_irqsave(>lock, flags);
+
+   reg = readl_relaxed(data->membase + (bank * 4));
+   writel_relaxed(reg | BIT(offset), data->membase + (bank * 4));
+
+   spin_unlock_irqrestore(>lock, flags);
+
+   return 0;
+}
+
+static int stm32_reset_deassert(struct reset_controller_dev *rcdev,
+   unsigned long id)
+{
+   struct stm32_reset_data *data = container_of(rcdev,
+struct stm32_reset_data,
+rcdev);
+   int bank = id / BITS_PER_LONG;
+   int offset = id % BITS_PER_LONG;
+   unsigned long flags;
+   u32 reg;
+
+   spin_lock_irqsave(>lock, flags);
+
+   reg = readl_relaxed(data->membase + (bank * 4));
+   writel_relaxed(reg & ~BIT(offset), data->membase + (bank * 4));
+
+   spin_unlock_irqrestore(>lock, flags);
+
+   return 0;
+}
+
+static struct reset_control_ops stm32_reset_ops = {
+   .assert = stm32_reset_assert,
+   .deassert   = stm32_reset_deassert,
+};
+
+static const struct of_device_id stm32_reset_dt_ids[] = {
+{ .compatible = "st,stm32-rcc", },
+{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, sstm32_reset_dt_ids);
+
+static int stm32_reset_probe(struct platform_device *pdev)
+{
+   struct stm32_reset_data *data;
+   struct resource *res;
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   data->membase = devm_ioremap_resource(>dev, res);
+   if (IS_ERR(data->membase))
+   return PTR_ERR(data->membase);
+
+   spin_lock_init(>lock);
+
+   data->rcdev.owner = THIS_MODULE;
+   data->rcdev.nr_resets = resource_size(res) * 8;
+   data->rcdev.ops = _reset_ops;
+   data->rcdev.of_node = pdev->dev.of_node;
+
+   return reset_controller_register(>rcdev);
+}
+
+static int stm32_reset_remove(struct platform_device *pdev)
+{
+   struct stm32_reset_data *data = platform_get_drvdata(pdev);
+
+   reset_controller_unregister(>rcdev);
+
+   return 0;
+}
+
+static struct platform_driver stm32_reset_driver = {
+   .probe  = stm32_reset_probe,
+   .remove = stm32_reset_remove,
+   .driver = {
+   .name   = "stm32-rcc-reset",
+   .of_match_table = stm32_reset_dt_ids,
+   },
+};
+module_platform_driver(stm32_reset_driver);
+
+MODULE_AUTHOR("Maxime Coquelin ");
+MODULE_DESCRIPTION("STM32 MCUs Reset Controller Driver");
+MODULE_LICENSE("GPL");
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 04/15] clocksource/drivers: Add ARM System timer driver

2015-03-31 Thread Maxime Coquelin
This patch adds clocksource support for ARMv7-M's System timer,
also known as SysTick.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 drivers/clocksource/Kconfig  |  7 
 drivers/clocksource/Makefile |  1 +
 drivers/clocksource/armv7m_systick.c | 79 
 3 files changed, 87 insertions(+)
 create mode 100644 drivers/clocksource/armv7m_systick.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 1c2506f..b82e58b 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -134,6 +134,13 @@ config CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
help
 Use ARM global timer clock source as sched_clock
 
+config ARMV7M_SYSTICK
+   bool
+   select CLKSRC_OF if OF
+   select CLKSRC_MMIO
+   help
+ This options enables support for the ARMv7M system timer unit
+
 config ATMEL_PIT
select CLKSRC_OF if OF
def_bool SOC_AT91SAM9 || SOC_SAMA5
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 752d5c7..1c9a643 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_MTK_TIMER)   += mtk_timer.o
 
 obj-$(CONFIG_ARM_ARCH_TIMER)   += arm_arch_timer.o
 obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o
+obj-$(CONFIG_ARMV7M_SYSTICK)   += armv7m_systick.o
 obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
 obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST)  += dummy_timer.o
 obj-$(CONFIG_ARCH_KEYSTONE)+= timer-keystone.o
diff --git a/drivers/clocksource/armv7m_systick.c 
b/drivers/clocksource/armv7m_systick.c
new file mode 100644
index 000..addfd2c
--- /dev/null
+++ b/drivers/clocksource/armv7m_systick.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author:  Maxime Coquelin 
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SYST_CSR   0x00
+#define SYST_RVR   0x04
+#define SYST_CVR   0x08
+#define SYST_CALIB 0x0c
+
+#define SYST_CSR_ENABLE BIT(0)
+
+#define SYSTICK_LOAD_RELOAD_MASK 0x00FF
+
+static void __init system_timer_of_register(struct device_node *np)
+{
+   struct clk *clk = NULL;
+   void __iomem *base;
+   u32 rate;
+   int ret;
+
+   base = of_iomap(np, 0);
+   if (!base) {
+   pr_warn("system-timer: invalid base address\n");
+   return;
+   }
+
+   ret = of_property_read_u32(np, "clock-frequency", );
+   if (ret) {
+   clk = of_clk_get(np, 0);
+   if (IS_ERR(clk))
+   goto out_unmap;
+
+   ret = clk_prepare_enable(clk);
+   if (ret)
+   goto out_clk_put;
+
+   rate = clk_get_rate(clk);
+   if (!rate)
+   goto out_clk_disable;
+   }
+
+   writel_relaxed(SYSTICK_LOAD_RELOAD_MASK, base + SYST_RVR);
+   writel_relaxed(SYST_CSR_ENABLE, base + SYST_CSR);
+
+   ret = clocksource_mmio_init(base + SYST_CVR, "arm_system_timer", rate,
+   200, 24, clocksource_mmio_readl_down);
+   if (ret) {
+   pr_err("failed to init clocksource (%d)\n", ret);
+   if (clk)
+   goto out_clk_disable;
+   else
+   goto out_unmap;
+   }
+
+   pr_info("ARM System timer initialized as clocksource\n");
+
+   return;
+
+out_clk_disable:
+   clk_disable_unprepare(clk);
+out_clk_put:
+   clk_put(clk);
+out_unmap:
+   iounmap(base);
+   pr_warn("ARM System timer register failed (%d)\n", ret);
+}
+
+CLOCKSOURCE_OF_DECLARE(arm_systick, "arm,armv7m-systick",
+   system_timer_of_register);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 03/15] dt-bindings: Document the ARM System timer bindings

2015-03-31 Thread Maxime Coquelin
This adds documentation of device tree bindings for the
ARM System timer.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 .../devicetree/bindings/arm/armv7m_systick.txt | 26 ++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/armv7m_systick.txt

diff --git a/Documentation/devicetree/bindings/arm/armv7m_systick.txt 
b/Documentation/devicetree/bindings/arm/armv7m_systick.txt
new file mode 100644
index 000..7cf4a24
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/armv7m_systick.txt
@@ -0,0 +1,26 @@
+* ARMv7M System Timer
+
+ARMv7-M includes a system timer, known as SysTick. Current driver only
+implements the clocksource feature.
+
+Required properties:
+- compatible : Should be "arm,armv7m-systick"
+- reg: The address range of the timer
+
+Required clocking property, have to be one of:
+- clocks : The input clock of the timer
+- clock-frequency : The rate in HZ in input of the ARM SysTick
+
+Examples:
+
+systick: timer@e000e010 {
+   compatible = "arm,armv7m-systick";
+   reg = <0xe000e010 0x10>;
+   clocks = <_systick>;
+};
+
+systick: timer@e000e010 {
+   compatible = "arm,armv7m-systick";
+   reg = <0xe000e010 0x10>;
+   clock-frequency = <9000>;
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 00/15] Add support to STMicroelectronics STM32 family

2015-03-31 Thread Maxime Coquelin
This fourth round mainly addresses comments made on UART and clocksource
drivers. See below changelog for more details.

STM32 MCUs are Cortex-M CPU, used in various applications (consumer
electronics, industrial applications, hobbyists...).
Datasheets, user and programming manuals are publicly available on
STMicroelectronics website.

With this series applied, the STM32F419 Discovery can boot succesfully.

Changes since v3:
-
 - Fix and simplify error path in ARMv7-M Systick driver (Daniel)
 - Improve reset bindings documentation (Philipp)
 - Fix trailing lines anf typos in reset driver & doc (Philipp & Chanwoo)
 - Fix MODULE_LICENCE in USART driver (Paul)
 - Refactor USART baudrate calculation (Peter & Andy)
 - Fix error path in USART init (Peter & Russell)
 - Fix HW flow control in USART driver (Peter)
 - Fix serial port type number to unused one (Peter)
 - Applies Chanwoo's Tested-by on the series

Changes since v2:
-
 - Remove pinctrl driver from the series. 
 - Remove reset_controller_of_init(), and reset the timers in the bootloader
 - Add HW flow contrl property for serial driver
 - Lots of changes in the DTS file, as per Andreas recommendations
 - Some Kconfig clean-ups
 - Adapt the config to be compatible with Andreas' bootwrapper, except UART 
port.
 - Various fixes in documentation

Changes since v1:
-
 - Move bindings documentation in their own patches (Andreas)
 - Rename ARM System timer to armv7m-systick (Rob)
 - Add clock-frequency property handling in armv7m-systick (Rob)
 - Re-factor the reset controllers into a single controller (Philipp)
 - Add kerneldoc to reset_controller_of_init (Philipp)
 - Add named constants in include/dt-bindings/reset/ (Philipp)
 - Make pinctrl driver to depend on ARCH_STM32 or COMPILE_TEST (Geert)
 - Introduce CPUV7M_NUM_IRQ config flag to indicate the number of interrupts
supported by the MCU, in order to limit memory waste in vectors' table (Uwe)


Maxime Coquelin (15):
  scripts: link-vmlinux: Don't pass page offset to kallsyms if XIP
Kernel
  ARM: ARMv7-M: Enlarge vector table up to 256 entries
  dt-bindings: Document the ARM System timer bindings
  clocksource/drivers: Add ARM System timer driver
  dt-bindings: Document the STM32 reset bindings
  drivers: reset: Add STM32 reset driver
  dt-bindings: Document the STM32 timer bindings
  clockevents/drivers: Add STM32 Timer driver
  dt-bindings: Document the STM32 USART bindings
  serial: stm32-usart: Add STM32 USART Driver
  ARM: Add STM32 family machine
  ARM: dts: Add ARM System timer as clockevent in armv7m
  ARM: dts: Introduce STM32F429 MCU
  ARM: configs: Add STM32 defconfig
  MAINTAINERS: Add entry for STM32 MCUs

 Documentation/arm/stm32/overview.txt   |  32 +
 Documentation/arm/stm32/stm32f429-overview.txt |  22 +
 .../devicetree/bindings/arm/armv7m_systick.txt |  26 +
 .../devicetree/bindings/reset/st,stm32-rcc.txt | 107 +++
 .../devicetree/bindings/serial/st,stm32-usart.txt  |  32 +
 .../devicetree/bindings/timer/st,stm32-timer.txt   |  22 +
 MAINTAINERS|   8 +
 arch/arm/Kconfig   |  18 +
 arch/arm/Makefile  |   1 +
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/armv7-m.dtsi |   6 +
 arch/arm/boot/dts/stm32f429-disco.dts  |  71 ++
 arch/arm/boot/dts/stm32f429.dtsi   | 226 +++
 arch/arm/configs/stm32_defconfig   |  71 ++
 arch/arm/kernel/entry-v7m.S|  13 +-
 arch/arm/mach-stm32/Makefile   |   1 +
 arch/arm/mach-stm32/Makefile.boot  |   3 +
 arch/arm/mach-stm32/board-dt.c |  19 +
 arch/arm/mm/Kconfig|  15 +
 drivers/clocksource/Kconfig|  15 +
 drivers/clocksource/Makefile   |   2 +
 drivers/clocksource/armv7m_systick.c   |  79 +++
 drivers/clocksource/timer-stm32.c  | 184 +
 drivers/reset/Makefile |   1 +
 drivers/reset/reset-stm32.c| 124 
 drivers/tty/serial/Kconfig |  17 +
 drivers/tty/serial/Makefile|   1 +
 drivers/tty/serial/stm32-usart.c   | 743 +
 include/uapi/linux/serial_core.h   |   3 +
 scripts/link-vmlinux.sh|   2 +-
 30 files changed, 1860 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/arm/stm32/overview.txt
 create mode 100644 Documentation/arm/stm32/stm32f429-overview.txt
 create mode 100644 Documentation/devicetree/bindings/arm/armv7m_systick.txt
 create mode 100644 Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
 create mode 100644 Documentation/devicetree/bindings/serial/st,stm32-usart.txt
 create mode 100644 

[PATCH v4 01/15] scripts: link-vmlinux: Don't pass page offset to kallsyms if XIP Kernel

2015-03-31 Thread Maxime Coquelin
When Kernel is executed in place from ROM, the symbol addresses can be
lower than the page offset.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 scripts/link-vmlinux.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 86a4fe7..b055d9d 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -82,7 +82,7 @@ kallsyms()
kallsymopt="${kallsymopt} --all-symbols"
fi
 
-   if [ -n "${CONFIG_ARM}" ] && [ -n "${CONFIG_PAGE_OFFSET}" ]; then
+   if [ -n "${CONFIG_ARM}" ] && [ -z "${CONFIG_XIP_KERNEL}" ] && [ -n 
"${CONFIG_PAGE_OFFSET}" ]; then
kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET"
fi
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] soc: Mediatek: Add SCPSYS power domain driver

2015-03-31 Thread Kevin Hilman
Hi Sascha,

Sascha Hauer  writes:

> This adds a power domain driver for the Mediatek SCPSYS unit.
>
> The System Control Processor System (SCPSYS) has several power
> management related tasks in the system. The tasks include thermal
> measurement, dynamic voltage frequency scaling (DVFS), interrupt
> filter and lowlevel sleep control. The System Power Manager (SPM)
> inside the SCPSYS is for the MTCMOS power domain control.
>
> For now this driver only adds power domain support, the more
> advanced features are not yet supported. The driver implements
> the generic PM domain device tree bindings, the first user will
> most likely be the Mediatek AFE audio driver.
>
> Signed-off-by: Sascha Hauer 

Sorry for the lag, was travelling last week at ELC and not keeping up
with reviews.

This version looks pretty good to me, but had one minor
comment/question...

[...]

> +#define NUM_DOMAINS  ARRAY_SIZE(scp_domain_data)
> +
> +struct scp;
> +
> +struct scp_domain {
> + struct generic_pm_domain pmd;
> + struct scp_domain_data *data;
> + struct scp *scp;
> +};
> +
> +struct scp {
> + struct scp_domain domains[NUM_DOMAINS];
> + struct generic_pm_domain *pmd[NUM_DOMAINS];

Why is this genpd pointer needed?  It's just a pointer to the
.domains.pmd[i] anyways, and IMO makes the code a bit hard to follow.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 2/2] Kbuild: avoid partial linking of drivers/built-in.o

2015-03-31 Thread Dave Martin
On Tue, Mar 31, 2015 at 11:22:29AM -0400, Nicolas Pitre wrote:
> On Mon, 30 Mar 2015, Ard Biesheuvel wrote:
> 
> > On 30 March 2015 at 16:13, Michal Marek  wrote:

[...]

> > > What you could do is to add a Kconfig option to arch/arm/Kconfig adding
> > > -ffunction-sections to the compiler flags. Then allyesconfig would
> > > select it and work around the problem in a somewhat elegant way.
> > >
> > 
> > Excellent idea! Arnd hasn't chimed in yet, but he is the one doing
> > lots and lots of randconfig builds and other test builds, so I will
> > wait for him to confirm that this is a useful thing to have.
> 
> I'm using -ffunction-sections as well for the kernel size reduction work 
> I'm currently doing.  The linker script has to be adapted so .text.* is 
> specified along .text otherwise those functions end up appended at the 
> end of the binary.

Interesting ... do you also mean using --gc-sections at link time?
We'd need to avoid pruning needed code that has no explicit caller,
and functions that are part of the kernel/module ABI but not used
within vmlinux.

The GCC docs suggest that -ffunction-sections may impact performance
and/or increase code size, but I don't know by how much.  Maybe it
interferes with inling.

Cheers
---Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 07/15] dt-bindings: Document the STM32 timer bindings

2015-03-31 Thread Maxime Coquelin
This adds documentation of device tree bindings for the
STM32 timer.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 .../devicetree/bindings/timer/st,stm32-timer.txt   | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/st,stm32-timer.txt

diff --git a/Documentation/devicetree/bindings/timer/st,stm32-timer.txt 
b/Documentation/devicetree/bindings/timer/st,stm32-timer.txt
new file mode 100644
index 000..d3fdeb0
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/st,stm32-timer.txt
@@ -0,0 +1,22 @@
+. STMicroelectronics STM32 timer
+
+The STM32 MCUs family has several general-purpose 16 and 32 bits timers.
+
+Required properties:
+- compatible : Should be st,stm32-timer"
+- reg : Address and length of the register set
+- clocks : Reference on the timer input clock
+- interrupts : Reference to the timer interrupt
+
+Optional properties:
+- resets: Reference to a reset controller asserting the timer
+
+Example:
+
+timer5: timer@4c00 {
+   compatible = "st,stm32-timer";
+   reg = <0x4c00 0x400>;
+   interrupts = <50>;
+   resets = < 259>;
+   clocks = <_pmtr1>;
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 08/15] clockevents/drivers: Add STM32 Timer driver

2015-03-31 Thread Maxime Coquelin
STM32 MCUs feature 16 and 32 bits general purpose timers with prescalers.
The drivers detects whether the time is 16 or 32 bits, and applies a
1024 prescaler value if it is 16 bits.

Reviewed-by: Linus Walleij 
Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 drivers/clocksource/Kconfig   |   8 ++
 drivers/clocksource/Makefile  |   1 +
 drivers/clocksource/timer-stm32.c | 184 ++
 3 files changed, 193 insertions(+)
 create mode 100644 drivers/clocksource/timer-stm32.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index b82e58b..519304b 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -101,6 +101,14 @@ config CLKSRC_EFM32
  Support to use the timers of EFM32 SoCs as clock source and clock
  event device.
 
+config CLKSRC_STM32
+   bool "Clocksource for STM32 SoCs" if !ARCH_STM32
+   depends on OF && ARM && (ARCH_STM32 || COMPILE_TEST)
+   select CLKSRC_MMIO
+   default ARCH_STM32
+   help
+ Support to use the timers of STM32 SoCs as clock event device.
+
 config ARM_ARCH_TIMER
bool
select CLKSRC_OF if OF
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 1c9a643..525dafe 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_ARCH_NSPIRE) += zevio-timer.o
 obj-$(CONFIG_ARCH_BCM_MOBILE)  += bcm_kona_timer.o
 obj-$(CONFIG_CADENCE_TTC_TIMER)+= cadence_ttc_timer.o
 obj-$(CONFIG_CLKSRC_EFM32) += time-efm32.o
+obj-$(CONFIG_CLKSRC_STM32) += timer-stm32.o
 obj-$(CONFIG_CLKSRC_EXYNOS_MCT)+= exynos_mct.o
 obj-$(CONFIG_CLKSRC_SAMSUNG_PWM)   += samsung_pwm_timer.o
 obj-$(CONFIG_FSL_FTM_TIMER)+= fsl_ftm_timer.o
diff --git a/drivers/clocksource/timer-stm32.c 
b/drivers/clocksource/timer-stm32.c
new file mode 100644
index 000..fad2e2e
--- /dev/null
+++ b/drivers/clocksource/timer-stm32.c
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author:  Maxime Coquelin 
+ * License terms:  GNU General Public License (GPL), version 2
+ *
+ * Inspired by time-efm32.c from Uwe Kleine-Koenig
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TIM_CR10x00
+#define TIM_DIER   0x0c
+#define TIM_SR 0x10
+#define TIM_EGR0x14
+#define TIM_PSC0x28
+#define TIM_ARR0x2c
+
+#define TIM_CR1_CENBIT(0)
+#define TIM_CR1_OPMBIT(3)
+#define TIM_CR1_ARPE   BIT(7)
+
+#define TIM_DIER_UIE   BIT(0)
+
+#define TIM_SR_UIF BIT(0)
+
+#define TIM_EGR_UG BIT(0)
+
+struct stm32_clock_event_ddata {
+   struct clock_event_device evtdev;
+   unsigned periodic_top;
+   void __iomem *base;
+};
+
+static void stm32_clock_event_set_mode(enum clock_event_mode mode,
+  struct clock_event_device *evtdev)
+{
+   struct stm32_clock_event_ddata *data =
+   container_of(evtdev, struct stm32_clock_event_ddata, evtdev);
+   void *base = data->base;
+
+   switch (mode) {
+   case CLOCK_EVT_MODE_PERIODIC:
+   writel_relaxed(data->periodic_top, base + TIM_ARR);
+   writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, base + TIM_CR1);
+   break;
+
+   case CLOCK_EVT_MODE_ONESHOT:
+   default:
+   writel_relaxed(0, base + TIM_CR1);
+   break;
+   }
+}
+
+static int stm32_clock_event_set_next_event(unsigned long evt,
+   struct clock_event_device *evtdev)
+{
+   struct stm32_clock_event_ddata *data =
+   container_of(evtdev, struct stm32_clock_event_ddata, evtdev);
+
+   writel_relaxed(evt, data->base + TIM_ARR);
+   writel_relaxed(TIM_CR1_ARPE | TIM_CR1_OPM | TIM_CR1_CEN,
+  data->base + TIM_CR1);
+
+   return 0;
+}
+
+static irqreturn_t stm32_clock_event_handler(int irq, void *dev_id)
+{
+   struct stm32_clock_event_ddata *data = dev_id;
+
+   writel_relaxed(0, data->base + TIM_SR);
+
+   data->evtdev.event_handler(>evtdev);
+
+   return IRQ_HANDLED;
+}
+
+static struct stm32_clock_event_ddata clock_event_ddata = {
+   .evtdev = {
+   .name = "stm32 clockevent",
+   .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
+   .set_mode = stm32_clock_event_set_mode,
+   .set_next_event = stm32_clock_event_set_next_event,
+   .rating = 200,
+   },
+};
+
+static void __init stm32_clockevent_init(struct device_node *np)
+{
+   struct stm32_clock_event_ddata *data = _event_ddata;
+   struct clk *clk;
+   struct reset_control *rstc;
+   unsigned long rate, max_delta;
+   int irq, ret, bits, prescaler = 1;
+
+   clk = of_clk_get(np, 0);
+   if (IS_ERR(clk)) {
+   ret = 

[PATCH v4 15/15] MAINTAINERS: Add entry for STM32 MCUs

2015-03-31 Thread Maxime Coquelin
Add a MAINTAINER entry covering all STM32 machine and drivers files.

Signed-off-by: Maxime Coquelin 
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..08c08c4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1467,6 +1467,14 @@ F:   drivers/usb/host/ehci-st.c
 F: drivers/usb/host/ohci-st.c
 F: drivers/ata/ahci_st.c
 
+ARM/STM32 ARCHITECTURE
+M: Maxime Coquelin 
+L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
+S: Maintained
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mcoquelin/stm32.git
+N: stm32
+F: drivers/clocksource/armv7m_systick.c
+
 ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
 M: Lennert Buytenhek 
 L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 13/15] ARM: dts: Introduce STM32F429 MCU

2015-03-31 Thread Maxime Coquelin
The STMicrolectornics's STM32F419 MCU has the following main features:
 - Cortex-M4 core running up to @180MHz
 - 2MB internal flash, 256KBytes internal RAM
 - FMC controller to connect SDRAM, NOR and NAND memories
 - SD/MMC/SDIO support
 - Ethernet controller
 - USB OTFG FS & HS controllers
 - I2C, SPI, CAN busses support
 - Several 16 & 32 bits general purpose timers
 - Serial Audio interface
 - LCD controller

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 arch/arm/boot/dts/Makefile|   1 +
 arch/arm/boot/dts/stm32f429-disco.dts |  71 +++
 arch/arm/boot/dts/stm32f429.dtsi  | 226 ++
 3 files changed, 298 insertions(+)
 create mode 100644 arch/arm/boot/dts/stm32f429-disco.dts
 create mode 100644 arch/arm/boot/dts/stm32f429.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index a1c776b..e5dbd03 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -509,6 +509,7 @@ dtb-$(CONFIG_ARCH_STI) += \
stih416-b2020.dtb \
stih416-b2020e.dtb \
stih418-b2199.dtb
+dtb-$(CONFIG_ARCH_STM32)+= stm32f429-disco.dtb
 dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-a1000.dtb \
sun4i-a10-ba10-tvbox.dtb \
diff --git a/arch/arm/boot/dts/stm32f429-disco.dts 
b/arch/arm/boot/dts/stm32f429-disco.dts
new file mode 100644
index 000..6b9aa59
--- /dev/null
+++ b/arch/arm/boot/dts/stm32f429-disco.dts
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2015 - Maxime Coquelin 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "stm32f429.dtsi"
+
+/ {
+   model = "STMicroelectronics STM32F429i-DISCO board";
+   compatible = "st,stm32f429i-disco", "st,stm32f429";
+
+   chosen {
+   bootargs = "console=ttyS0,115200 root=/dev/ram rdinit=/linuxrc";
+   linux,stdout-path = 
+   };
+
+   memory {
+   reg = <0x9000 0x80>;
+   };
+
+   aliases {
+   serial0 = 
+   };
+};
+
+ {
+   status = "okay";
+};
diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
new file mode 100644
index 000..39ffdb8
--- /dev/null
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2015 - Maxime Coquelin 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be 

[PATCH v4 12/15] ARM: dts: Add ARM System timer as clockevent in armv7m

2015-03-31 Thread Maxime Coquelin
Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 arch/arm/boot/dts/armv7-m.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/armv7-m.dtsi b/arch/arm/boot/dts/armv7-m.dtsi
index 5a660d0..b1ad7cf 100644
--- a/arch/arm/boot/dts/armv7-m.dtsi
+++ b/arch/arm/boot/dts/armv7-m.dtsi
@@ -8,6 +8,12 @@
reg = <0xe000e100 0xc00>;
};
 
+   systick: timer@e000e010 {
+   compatible = "arm,armv7m-systick";
+   reg = <0xe000e010 0x10>;
+   status = "disabled";
+   };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 10/15] serial: stm32-usart: Add STM32 USART Driver

2015-03-31 Thread Maxime Coquelin
This drivers adds support to the STM32 USART controller, which is a
standard serial driver.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 drivers/tty/serial/Kconfig   |  17 +
 drivers/tty/serial/Makefile  |   1 +
 drivers/tty/serial/stm32-usart.c | 743 +++
 include/uapi/linux/serial_core.h |   3 +
 4 files changed, 764 insertions(+)
 create mode 100644 drivers/tty/serial/stm32-usart.c

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index d2501f0..880cb4f 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1611,6 +1611,23 @@ config SERIAL_SPRD_CONSOLE
  with "earlycon" on the kernel command line. The console is
  enabled when early_param is processed.
 
+config SERIAL_STM32
+   tristate "STMicroelectronics STM32 serial port support"
+   select SERIAL_CORE
+   depends on ARM || COMPILE_TEST
+   help
+ This driver is for the on-chip Serial Controller on
+ STMicroelectronics STM32 MCUs.
+ USART supports Rx & Tx functionality.
+ It support all industry standard baud rates.
+
+ If unsure, say N.
+
+config SERIAL_STM32_CONSOLE
+   bool "Support for console on STM32"
+   depends on SERIAL_STM32=y
+   select SERIAL_CORE_CONSOLE
+
 endmenu
 
 config SERIAL_MCTRL_GPIO
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index 599be4b..67c5023 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -95,6 +95,7 @@ obj-$(CONFIG_SERIAL_FSL_LPUART)   += fsl_lpuart.o
 obj-$(CONFIG_SERIAL_CONEXANT_DIGICOLOR)+= digicolor-usart.o
 obj-$(CONFIG_SERIAL_MEN_Z135)  += men_z135_uart.o
 obj-$(CONFIG_SERIAL_SPRD) += sprd_serial.o
+obj-$(CONFIG_SERIAL_STM32) += stm32-usart.o
 
 # GPIOLIB helpers for modem control lines
 obj-$(CONFIG_SERIAL_MCTRL_GPIO)+= serial_mctrl_gpio.o
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
new file mode 100644
index 000..126fbac
--- /dev/null
+++ b/drivers/tty/serial/stm32-usart.c
@@ -0,0 +1,743 @@
+/*
+ * Copyright (C) Maxime Coquelin 2015
+ * Author:  Maxime Coquelin 
+ * License terms:  GNU General Public License (GPL), version 2
+ *
+ * Inspired by st-asc.c from STMicroelectronics (c)
+ */
+
+#if defined(CONFIG_SERIAL_STM32_USART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+#define SUPPORT_SYSRQ
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "stm32-usart"
+
+/* Register offsets */
+#define USART_SR   0x00
+#define USART_DR   0x04
+#define USART_BRR  0x08
+#define USART_CR1  0x0c
+#define USART_CR2  0x10
+#define USART_CR3  0x14
+#define USART_GTPR 0x18
+
+/* USART_SR */
+#define USART_SR_PEBIT(0)
+#define USART_SR_FEBIT(1)
+#define USART_SR_NFBIT(2)
+#define USART_SR_ORE   BIT(3)
+#define USART_SR_IDLE  BIT(4)
+#define USART_SR_RXNE  BIT(5)
+#define USART_SR_TCBIT(6)
+#define USART_SR_TXE   BIT(7)
+#define USART_SR_LBD   BIT(8)
+#define USART_SR_CTS   BIT(9)
+#define USART_SR_ERR_MASK  (USART_SR_LBD | USART_SR_ORE | \
+USART_SR_FE | USART_SR_PE)
+/* Dummy bits */
+#define USART_SR_DUMMY_RX  BIT(16)
+
+/* USART_DR */
+#define USART_DR_MASK  GENMASK(8, 0)
+
+/* USART_BRR */
+#define USART_BRR_DIV_F_MASK   GENMASK(3, 0)
+#define USART_BRR_DIV_M_MASK   GENMASK(15, 4)
+#define USART_BRR_DIV_M_SHIFT  4
+
+/* USART_CR1 */
+#define USART_CR1_SBK  BIT(0)
+#define USART_CR1_RWU  BIT(1)
+#define USART_CR1_RE   BIT(2)
+#define USART_CR1_TE   BIT(3)
+#define USART_CR1_IDLEIE   BIT(4)
+#define USART_CR1_RXNEIE   BIT(5)
+#define USART_CR1_TCIE BIT(6)
+#define USART_CR1_TXEIEBIT(7)
+#define USART_CR1_PEIE BIT(8)
+#define USART_CR1_PS   BIT(9)
+#define USART_CR1_PCE  BIT(10)
+#define USART_CR1_WAKE BIT(11)
+#define USART_CR1_MBIT(12)
+#define USART_CR1_UE   BIT(13)
+#define USART_CR1_OVER8BIT(15)
+#define USART_CR1_IE_MASK  GENMASK(8, 4)
+
+/* USART_CR2 */
+#define USART_CR2_ADD_MASK GENMASK(3, 0)
+#define USART_CR2_LBDL BIT(5)
+#define USART_CR2_LBDIEBIT(6)
+#define USART_CR2_LBCL BIT(8)
+#define USART_CR2_CPHA BIT(9)
+#define USART_CR2_CPOL BIT(10)
+#define USART_CR2_CLKENBIT(11)
+#define USART_CR2_STOP_2B  BIT(13)
+#define USART_CR2_STOP_MASKGENMASK(13, 12)
+#define USART_CR2_LINENBIT(14)
+
+/* USART_CR3 */
+#define USART_CR3_EIE  BIT(0)
+#define USART_CR3_IREN BIT(1)
+#define USART_CR3_IRLP BIT(2)

[PATCH v4 11/15] ARM: Add STM32 family machine

2015-03-31 Thread Maxime Coquelin
STMicrolectronics's STM32 series is a family of Cortex-M
microcontrollers. It is used in various applications, and
proposes a wide range of peripherals.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 Documentation/arm/stm32/overview.txt   | 32 ++
 Documentation/arm/stm32/stm32f429-overview.txt | 22 ++
 arch/arm/Kconfig   | 18 +++
 arch/arm/Makefile  |  1 +
 arch/arm/mach-stm32/Makefile   |  1 +
 arch/arm/mach-stm32/Makefile.boot  |  3 +++
 arch/arm/mach-stm32/board-dt.c | 19 +++
 7 files changed, 96 insertions(+)
 create mode 100644 Documentation/arm/stm32/overview.txt
 create mode 100644 Documentation/arm/stm32/stm32f429-overview.txt
 create mode 100644 arch/arm/mach-stm32/Makefile
 create mode 100644 arch/arm/mach-stm32/Makefile.boot
 create mode 100644 arch/arm/mach-stm32/board-dt.c

diff --git a/Documentation/arm/stm32/overview.txt 
b/Documentation/arm/stm32/overview.txt
new file mode 100644
index 000..09aed55
--- /dev/null
+++ b/Documentation/arm/stm32/overview.txt
@@ -0,0 +1,32 @@
+   STM32 ARM Linux Overview
+   
+
+Introduction
+
+
+  The STMicroelectronics family of Cortex-M based MCUs are supported by the
+  'STM32' platform of ARM Linux. Currently only the STM32F429 is supported.
+
+
+Configuration
+-
+
+  A generic configuration is provided for STM32 family, and can be used as the
+  default by
+   make stm32_defconfig
+
+Layout
+--
+
+  All the files for multiple machine families are located in the platform code
+  contained in arch/arm/mach-stm32
+
+  There is a generic board board-dt.c in the mach folder which support
+  Flattened Device Tree, which means, it works with any compatible board with
+  Device Trees.
+
+
+Document Author
+---
+
+  Maxime Coquelin 
diff --git a/Documentation/arm/stm32/stm32f429-overview.txt 
b/Documentation/arm/stm32/stm32f429-overview.txt
new file mode 100644
index 000..5206822
--- /dev/null
+++ b/Documentation/arm/stm32/stm32f429-overview.txt
@@ -0,0 +1,22 @@
+   STM32F429 Overview
+   ==
+
+  Introduction
+  
+   The STM32F429 is a Cortex-M4 MCU aimed at various applications.
+   It features:
+   - ARM Cortex-M4 up to 180MHz with FPU
+   - 2MB internal Flash Memory
+   - External memory support through FMC controller (PSRAM, SDRAM, NOR, 
NAND)
+   - I2C, SPI, SAI, CAN, USB OTG, Ethernet controllers
+   - LCD controller & Camera interface
+   - Cryptographic processor
+
+  Resources
+  -
+   Datasheet and reference manual are publicly available on ST website:
+   - 
http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1577/LN1806?ecmp=stm32f429-439_pron_pr-ces2014_nov2013
+
+  Document Author
+  ---
+   Maxime Coquelin 
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9f1f09a..5b1157d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -776,6 +776,24 @@ config ARCH_OMAP1
help
  Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx)
 
+config ARCH_STM32
+   bool "STMicrolectronics STM32"
+   depends on !MMU
+   select ARCH_HAS_RESET_CONTROLLER
+   select ARM_NVIC
+   select ARMV7M_SYSTICK
+   select AUTO_ZRELADDR
+   select CLKSRC_OF
+   select COMMON_CLK
+   select CPU_V7M
+   select GENERIC_CLOCKEVENTS
+   select NO_IOPORT_MAP
+   select RESET_CONTROLLER
+   select SPARSE_IRQ
+   select USE_OF
+   help
+ Support for STMicroelectronics STM32 processors.
+
 endchoice
 
 menu "Multiple platform selection"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 7f99cd6..982c104 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -196,6 +196,7 @@ machine-$(CONFIG_ARCH_SHMOBILE) += shmobile
 machine-$(CONFIG_ARCH_SIRF)+= prima2
 machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
 machine-$(CONFIG_ARCH_STI) += sti
+machine-$(CONFIG_ARCH_STM32)   += stm32
 machine-$(CONFIG_ARCH_SUNXI)   += sunxi
 machine-$(CONFIG_ARCH_TEGRA)   += tegra
 machine-$(CONFIG_ARCH_U300)+= u300
diff --git a/arch/arm/mach-stm32/Makefile b/arch/arm/mach-stm32/Makefile
new file mode 100644
index 000..bd0b7b5
--- /dev/null
+++ b/arch/arm/mach-stm32/Makefile
@@ -0,0 +1 @@
+obj-y += board-dt.o
diff --git a/arch/arm/mach-stm32/Makefile.boot 
b/arch/arm/mach-stm32/Makefile.boot
new file mode 100644
index 000..eacfc3f
--- /dev/null
+++ b/arch/arm/mach-stm32/Makefile.boot
@@ -0,0 +1,3 @@
+# Empty file waiting for deletion once Makefile.boot isn't needed any more.
+# Patch waits for application at
+# http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7889/1 .
diff --git 

[PATCH v4 14/15] ARM: configs: Add STM32 defconfig

2015-03-31 Thread Maxime Coquelin
This patch adds a new config for STM32 MCUs.
STM32F429 Discovery board boots successfully with this config applied.

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 arch/arm/configs/stm32_defconfig | 71 
 1 file changed, 71 insertions(+)
 create mode 100644 arch/arm/configs/stm32_defconfig

diff --git a/arch/arm/configs/stm32_defconfig b/arch/arm/configs/stm32_defconfig
new file mode 100644
index 000..412a9f9
--- /dev/null
+++ b/arch/arm/configs/stm32_defconfig
@@ -0,0 +1,71 @@
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_LOG_BUF_SHIFT=16
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE="./rootfs.cpio"
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+# CONFIG_UID16 is not set
+# CONFIG_BASE_FULL is not set
+# CONFIG_FUTEX is not set
+# CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_AIO is not set
+CONFIG_EMBEDDED=y
+# CONFIG_VM_EVENT_COUNTERS is not set
+# CONFIG_SLUB_DEBUG is not set
+# CONFIG_LBDAF is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_MMU is not set
+CONFIG_ARCH_STM32=y
+CONFIG_SET_MEM_PARAM=y
+CONFIG_DRAM_BASE=0x9000
+CONFIG_FLASH_MEM_BASE=0x0800
+CONFIG_FLASH_SIZE=0x0020
+CONFIG_PREEMPT=y
+# CONFIG_ATAGS is not set
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_XIP_KERNEL=y
+CONFIG_XIP_PHYS_ADDR=0x08008000
+CONFIG_BINFMT_FLAT=y
+CONFIG_BINFMT_SHARED_FLAT=y
+# CONFIG_COREDUMP is not set
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_BLK_DEV is not set
+CONFIG_EEPROM_93CX6=y
+# CONFIG_INPUT is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+# CONFIG_UNIX98_PTYS is not set
+# CONFIG_LEGACY_PTYS is not set
+CONFIG_SERIAL_NONSTANDARD=y
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_STM32=y
+CONFIG_SERIAL_STM32_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_GPIO_SYSFS=y
+# CONFIG_HWMON is not set
+CONFIG_USB=y
+CONFIG_USB_DWC2=y
+CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+# CONFIG_FILE_LOCKING is not set
+# CONFIG_DNOTIFY is not set
+# CONFIG_INOTIFY_USER is not set
+CONFIG_PRINTK_TIME=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_FTRACE is not set
+CONFIG_CRC_ITU_T=y
+CONFIG_CRC7=y
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 09/15] dt-bindings: Document the STM32 USART bindings

2015-03-31 Thread Maxime Coquelin
This adds documentation of device tree bindings for the
STM32 USART

Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 .../devicetree/bindings/serial/st,stm32-usart.txt  | 32 ++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/st,stm32-usart.txt

diff --git a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt 
b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
new file mode 100644
index 000..090a3a4
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
@@ -0,0 +1,32 @@
+* STMicroelectronics STM32 USART
+
+Required properties:
+- compatible: Can be either "st,stm32-usart" or "st,stm32-uart" depending on
+whether the device supports synchronous mode.
+- reg: The address and length of the peripheral registers space
+- interrupts: The interrupt line of the USART instance
+- clocks: The input clock of the USART instance
+
+Optional properties:
+- pinctrl: The reference on the pins configuration
+- st,hw-flow-ctrl: bool flag to enable hardware flow control.
+
+Examples:
+usart4: serial@40004c00 {
+   compatible = "st,stm32-uart";
+   reg = <0x40004c00 0x400>;
+   interrupts = <52>;
+   clocks = <_pclk1>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_usart4>;
+};
+
+usart2: serial@40004400 {
+   compatible = "st,stm32-usart", "st,stm32-uart";
+   reg = <0x40004400 0x400>;
+   interrupts = <38>;
+   clocks = <_pclk1>;
+   st,hw-flow-ctrl;
+   pinctrl-names = "default";
+   pinctrl-0 = <_usart2 _usart2_rtscts>;
+};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 02/15] ARM: ARMv7-M: Enlarge vector table up to 256 entries

2015-03-31 Thread Maxime Coquelin
>From Cortex-M reference manuals, the nvic supports up to 240 interrupts.
So the number of entries in vectors table is up to 256.

This patch adds a new config flag to specify the number of external interrupts.
Some ifdeferies are added in order to respect the natural alignment without
wasting too much space on smaller systems.

Acked-by: Uwe Kleine-König 
Acked-by: Stefan Agner 
Tested-by: Chanwoo Choi 
Signed-off-by: Maxime Coquelin 
---
 arch/arm/kernel/entry-v7m.S | 13 +
 arch/arm/mm/Kconfig | 15 +++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S
index 8944f49..b6c8bb9 100644
--- a/arch/arm/kernel/entry-v7m.S
+++ b/arch/arm/kernel/entry-v7m.S
@@ -117,9 +117,14 @@ ENTRY(__switch_to)
 ENDPROC(__switch_to)
 
.data
-   .align  8
+#if CONFIG_CPU_V7M_NUM_IRQ <= 112
+   .align  9
+#else
+   .align  10
+#endif
+
 /*
- * Vector table (64 words => 256 bytes natural alignment)
+ * Vector table (Natural alignment need to be ensured)
  */
 ENTRY(vector_table)
.long   0   @ 0 - Reset stack pointer
@@ -138,6 +143,6 @@ ENTRY(vector_table)
.long   __invalid_entry @ 13 - Reserved
.long   __pendsv_entry  @ 14 - PendSV
.long   __invalid_entry @ 15 - SysTick
-   .rept   64 - 16
-   .long   __irq_entry @ 16..64 - External Interrupts
+   .rept   CONFIG_CPU_V7M_NUM_IRQ
+   .long   __irq_entry @ External Interrupts
.endr
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 9b4f29e..aec53b4 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -604,6 +604,21 @@ config CPU_USE_DOMAINS
  This option enables or disables the use of domain switching
  via the set_fs() function.
 
+config CPU_V7M_NUM_IRQ
+   int "Number of external interrupts connected to the NVIC"
+   depends on CPU_V7M
+   default 90 if ARCH_STM32
+   default 38 if ARCH_EFM32
+   default 240
+   help
+ This option indicates the number of interrupts connected to the NVIC.
+ The value can be larger than the real number of interrupts supported
+ by the system, but must not be lower.
+ The default value is 240, corresponding to the maximum number of
+ interrupts supported by the NVIC on Cortex-M family.
+
+ If unsure, keep default value.
+
 #
 # CPU supports 36-bit I/O
 #
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 0/3] Improve eye-diagram & single-ended test for rk3288 hdmi

2015-03-31 Thread Russell King - ARM Linux
On Mon, Mar 09, 2015 at 05:42:21PM +0800, Yakir Yang wrote:
> RK3288 hdmi eye-diagram test would fail when pixel clock is 148.5MHz,
> and single-ended test would failed when display mode is 74.25MHz.

Has anyone reviewed these changes yet?  I don't see any replies, nor
are they in David's git tree.  To me, they look mostly fine - the only
issue I get is that the final patch doesn't apply cleanly to dw_hdmi.h
since they're generated against a tree which has audio support merged.
I also see no regressions on iMX6, so I think they can be merged.

Unless anyone has any objections, I'll add these to my queue for David.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] perf script segfault

2015-03-31 Thread Jiri Olsa
On Tue, Mar 31, 2015 at 01:14:20PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Mar 31, 2015 at 05:50:48PM +0200, Jiri Olsa escreveu:
> > On Tue, Mar 31, 2015 at 05:48:44PM +0200, Jiri Olsa wrote:
> > > On Tue, Mar 31, 2015 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > > 
> > > SNIP
> > > 
> > > > struct ordered_events *oe = >ordered_events;
> > > > -   struct perf_tool *tool = oe->tool;
> > > > +   struct perf_tool *tool = session->tool;
> > > > int fd = perf_data_file__fd(session->file);
> > > > u64 head, page_offset, file_offset, file_pos, size;
> > > > int err, mmap_prot, mmap_flags, map_idx = 0;
> > > > @@ -1394,6 +1407,7 @@ out:
> > > >  out_err:
> > > > ui_progress__finish();
> > > > perf_tool__warn_about_errors(tool, >evlist->stats);
> > > > +   ordered_events__warn_about_errors(>ordered_events);
> > > 
> > > how about just single warning function ?
> > > 
> > >   perf_session__warn_about_errors(struct perf_session *session)
> > > 
> > > session has now both tool and ordered_events
> > 
> > other than this it looks ok to me
> 
> Like this? If so, can I have your Acked-by? :-)

I luv it! ;-) thanks

Acked-by: Jiri Olsa 

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4] spi: Add SPI driver for Mikrotik RB4xx series boards

2015-03-31 Thread Bert Vermeulen
This driver mediates access between the connected CPLD and other devices
on the bus.

The m25p80-compatible boot flash and (some models) MMC use regular SPI,
bitbanged as required by the SoC. However the SPI-connected CPLD has
a "fast write" mode, in which two bits are transferred by SPI clock
cycle. The second bit is transmitted with the SoC's CS2 pin.

Protocol drivers using this fast write facility signal this by setting
the cs_change flag on transfers.

Signed-off-by: Bert Vermeulen 
---
 drivers/spi/Kconfig |   6 ++
 drivers/spi/Makefile|   1 +
 drivers/spi/spi-rb4xx.c | 244 
 3 files changed, 251 insertions(+)
 create mode 100644 drivers/spi/spi-rb4xx.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index ab8dfbe..aa76ce5 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -429,6 +429,12 @@ config SPI_ROCKCHIP
  The main usecase of this controller is to use spi flash as boot
  device.
 
+config SPI_RB4XX
+   tristate "Mikrotik RB4XX SPI master"
+   depends on SPI_MASTER && ATH79_MACH_RB4XX
+   help
+ SPI controller driver for the Mikrotik RB4xx series boards.
+
 config SPI_RSPI
tristate "Renesas RSPI/QSPI controller"
depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index d8cbf65..0218f39 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -66,6 +66,7 @@ obj-$(CONFIG_SPI_PXA2XX)  += spi-pxa2xx-platform.o
 obj-$(CONFIG_SPI_PXA2XX_PCI)   += spi-pxa2xx-pci.o
 obj-$(CONFIG_SPI_QUP)  += spi-qup.o
 obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o
+obj-$(CONFIG_SPI_RB4XX)+= spi-rb4xx.o
 obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
 obj-$(CONFIG_SPI_S3C24XX)  += spi-s3c24xx-hw.o
 spi-s3c24xx-hw-y   := spi-s3c24xx.o
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
new file mode 100644
index 000..155b81c
--- /dev/null
+++ b/drivers/spi/spi-rb4xx.c
@@ -0,0 +1,244 @@
+/*
+ * SPI controller driver for the Mikrotik RB4xx boards
+ *
+ * Copyright (C) 2010 Gabor Juhos 
+ * Copyright (C) 2015 Bert Vermeulen 
+ *
+ * This file was based on the patches for Linux 2.6.27.39 published by
+ * MikroTik for their RouterBoard 4xx series devices.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SPI_CLOCK_FASTEST  0x40
+#define SPI_HZ 3334
+#define CPLD_CMD_WRITE_NAND0x08 /* bulk write mode */
+
+struct rb4xx_spi {
+   void __iomem*base;
+   struct spi_master   *master;
+};
+
+static inline u32 rb4xx_read(struct rb4xx_spi *rbspi, u32 reg)
+{
+   return __raw_readl(rbspi->base + reg);
+}
+
+static inline void rb4xx_write(struct rb4xx_spi *rbspi, u32 reg, u32 value)
+{
+   __raw_writel(value, rbspi->base + reg);
+}
+
+static inline void do_spi_clk(struct rb4xx_spi *rbspi, u32 spi_ioc, int value)
+{
+   u32 regval;
+
+   regval = spi_ioc;
+   if (value & BIT(0))
+   regval |= AR71XX_SPI_IOC_DO;
+
+   rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval);
+   rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval | AR71XX_SPI_IOC_CLK);
+}
+
+static void do_spi_byte(struct rb4xx_spi *rbspi, u32 spi_ioc, u8 byte)
+{
+   int i;
+
+   for (i = 7; i >= 0; i--)
+   do_spi_clk(rbspi, spi_ioc, byte >> i);
+}
+
+static inline void do_spi_clk_fast(struct rb4xx_spi *rbspi, u32 spi_ioc,
+  u8 value)
+{
+   u32 regval;
+
+   regval = spi_ioc;
+   if (value & BIT(1))
+   regval |= AR71XX_SPI_IOC_DO;
+   if (value & BIT(0))
+   regval |= AR71XX_SPI_IOC_CS2;
+
+   rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval);
+   rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval | AR71XX_SPI_IOC_CLK);
+}
+
+/* Two bits at a time, msb first */
+static void do_spi_byte_fast(struct rb4xx_spi *rbspi, u32 spi_ioc, u8 byte)
+{
+   do_spi_clk_fast(rbspi, spi_ioc, byte >> 6);
+   do_spi_clk_fast(rbspi, spi_ioc, byte >> 4);
+   do_spi_clk_fast(rbspi, spi_ioc, byte >> 2);
+   do_spi_clk_fast(rbspi, spi_ioc, byte >> 0);
+}
+
+static void rb4xx_set_cs(struct spi_device *spi, bool enable)
+{
+   struct rb4xx_spi *rbspi = spi_master_get_devdata(spi->master);
+
+   /*
+* Setting CS is done along with bitbanging the actual values,
+* since it's all on the same hardware register. However the
+* CPLD needs CS deselected after every command.
+*/
+   if (!enable)
+   rb4xx_write(rbspi, AR71XX_SPI_REG_IOC,
+   AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1);
+}
+
+/* Deselect 

Re: [GIT PULL] selftest: Add futex functional tests

2015-03-31 Thread Darren Hart
On 3/31/15, 8:32 AM, "Shuah Khan"  wrote:

>Hi Daren,
>
>On 03/27/2015 04:17 PM, Darren Hart wrote:
>> Hi Shuah,
>> 
>> This series begins the process of migrating my futextest tests into
>>kselftest.
>> I've started with only the functional tests, as the performance and
>>stress may
>> not be appropriate for kselftest as they stand.
>> 
>> I cleaned up various complaints from checkpatch, but I ignored others
>>that would
>> require significant rework of the testcases, such as not using volatile
>>and not
>> creating new typedefs.
>> 
>> The patches will follow, but I'm providing a pull request for your
>>convenience
>> as well.
>
>Thanks for acting on this so quickly after we talked about it at ELC.
>Just a quick note that I am going to get to this soon once I get the
>4.1 content wrapped up. We can plan upon getting these into 4.2.

OK. Michael E. provided some feedback which I can either incorporate and
respin, or I can send as a follow-on to your -next after you merge these.
Which do you prefer?

-- 
Darren Hart
Intel Open Source Technology Center



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] TESTCASE: of: OOPS when disabling node via OF_DYNAMIC

2015-03-31 Thread Pantelis Antoniou
Hi Wolfram,

> On Mar 31, 2015, at 18:12 , Wolfram Sang  wrote:
> 
> From: Wolfram Sang 
> 
> I wanted to disable a node via OF_DYNAMIC by setting its status to disabled.
> This code is the minimal testcase, the same happens in a more complex 
> scenario.
> There is something wrong with freeing resources. Is my module wrong? Or is it 
> a
> bug? Crashlog without CONFIG_I2C_CHARDEV, slightly shortened:
> 

> [5.127314] of/notify UPDATE_PROPERTY /i2c@e60b:status
> [5.132814] i2c-sh_mobile e60b.i2c: pm_clk_notify() 2
> [5.138504] bus: 'platform': remove device e60b.i2c
> [5.143762] i2c-sh_mobile e60b.i2c: pm_clk_notify() 6
> [5.149231] device: '7-0068': device_unregister
> [5.153982] bus: 'i2c': remove device 7-0068
> [5.158679] device: 'regulator.2': device_unregister
> [5.165827] i2c 7-0068: uevent
> [5.168997] i2c i2c-7: adapter [e60b.i2c] unregistered
> [5.174462] device: 'i2c-7': device_unregister
> [5.179057] bus: 'i2c': remove device i2c-7
> [5.183570] platform e60b.i2c: pm_clk_notify() 7
> [5.188595] platform e60b.i2c: Runtime PM disabled, clock forced off.
> [5.195368] platform e60b.i2c: pm_clk_notify() 3
> [5.200426] Unable to handle kernel NULL pointer dereference at virtual 
> address 0018
> [5.208474] pgd = c0004000
> [5.211164] [0018] *pgd=
> [5.214745] Internal error: Oops: 5 [#1] ARM
> [5.218995] CPU: 0 PID: 1 Comm: swapper Tainted: GW   
> 4.0.0-rc4-9-gcb55587ebc4047 #90
> [5.228148] Hardware name: Generic R8A7790 (Flattened Device Tree)
> [5.234288] task: ee84d340 ti: ee84e000 task.ti: ee84e000
> [5.239656] PC is at release_resource+0x20/0x68
> [5.244171] LR is at _raw_write_lock+0x3c/0x44
> [5.248591] pc : []lr : []psr: a113
> [5.248591] sp : ee84fcd8  ip : ee84fcb0  fp : ee84fcec
> [5.259989] r10:   r9 : c03de2c0  r8 : c03d5694
> [5.265180] r7 : ee84fdf4  r6 : 001c  r5 :   r4 : ee8efd00
> [5.271664] r3 :   r2 : 0018  r1 : 0009  r0 : c03c7cd8
> [5.278149] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment 
> kernel
> [5.285410] Control: 10c5347d  Table: 40004059  DAC: 0015
> [5.291117] Process swapper (pid: 1, stack limit = 0xee84e208)
> [5.296911] Stack: (0xee84fcd8 to 0xee85)
> [5.301243] fcc0:   
>  ee8f3e00
> [5.309375] fce0: ee84fd0c ee84fcf0 c01604fc c0024168 c03d39a0 ee8f3e00 
>  0005
> [5.317507] fd00: ee84fd24 ee84fd10 c016054c c0160494 c03d39a0 ee8f3e10 
> ee84fd3c ee84fd28
> [5.325639] fd20: c01aad54 c0160544 ee8f3e34 ee8f3e00 ee84fd64 ee84fd40 
> c01ab3f8 c01aad08
> ...
> [5.512643] Backtrace:
> [5.515097] [] (release_resource) from [] 
> (platform_device_del+0x74/0x84)
> [5.523561]  r4:ee8f3e00 r3:
> [5.527145] [] (platform_device_del) from [] 
> (platform_device_unregister+0x14/0x20)
> [5.536469]  r6:0005 r5: r4:ee8f3e00 r3:c03d39a0
> [5.542152] [] (platform_device_unregister) from [] 
> (of_platform_device_destroy+0x58/0xa8)
> [5.552080]  r4:ee8f3e10 r3:c03d39a0
> [5.555667] [] (of_platform_device_destroy) from [] 
> (of_platform_notify+0xcc/0xe8)
> [5.564905]  r4:ee8f3e00 r3:ee8f3e34
> [5.568493] [] (of_platform_notify) from [] 
> (notifier_call_chain+0x48/0x70)
> [5.577128]  r6:0005 r5: r4:
> [5.581759] [] (notifier_call_chain) from [] 
> (__blocking_notifier_call_chain+0x4c/0x64)
> [5.591429]  r8:0005 r7:ee84fdf4 r6: r5:c03d7ba4 r4:c03d7b98 
> r3:
> [5.599192] [] (__blocking_notifier_call_chain) from 
> [] (blocking_notifier_call_chain+0x20/0x28)
> [5.609637]  r8:c0340d2c r7:c0340d2c r6:ee84fe88 r5:0005 r4:ee84fdf4
> [5.616365] [] (blocking_notifier_call_chain) from [] 
> (of_reconfig_notify+0x88/0xa8)
> [5.625788] [] (of_reconfig_notify) from [] 
> (of_property_notify+0x44/0x4c)
> [5.634338]  r5:ee84fe88 r4:ee940440
> [5.637925] [] (of_property_notify) from [] 
> (__of_changeset_entry_notify+0x84/0xc4)
> [5.647263] [] (__of_changeset_entry_notify) from [] 
> (of_changeset_apply+0xa4/0xe4)
> [5.656588]  r4:ee940440
> [5.659126] [] (of_changeset_apply) from [] 
> (test_init+0x84/0xa8)
> [5.666900]  r6: r5:c03356c0 r4:eefd18b8
> [5.671533] [] (test_init) from [] 
> (do_one_initcall+0x108/0x1bc)
> [5.679220]  r4:ee940440
> 
> Signed-off-by: Wolfram Sang 
> ---
> drivers/of/Makefile   |  2 +-
> drivers/of/wsa_testcase.c | 48 +++
> 2 files changed, 49 insertions(+), 1 deletion(-)
> create mode 100644 drivers/of/wsa_testcase.c
> 
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index 7563f36c71db34..4ec30a5bab39d5 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -1,4 +1,4 @@
> -obj-y = base.o 

Re: [PATCH v3 2/2] perf tool: Fix ppid for synthesized fork events

2015-03-31 Thread Don Zickus
On Mon, Mar 30, 2015 at 02:35:58PM -0600, David Ahern wrote:
> 363b785f38 added synthesized fork events and set a thread's parent id
> to itself. Since we are already processing /proc//status the ppid
> can be determined properly. Make it so.

Acked-by: Don Zickus 

> 
> Signed-off-by: David Ahern 
> Cc: Don Zickus 
> Cc: Joe Mario 
> Cc: Jiri Olsa 
> ---
> v3
> - removed isspace and newline checks; added brackets per Arnaldo's comments
> 
> v2:
> - removed changes to function signature for perf_event__synthesize_comm as
>   noted by Jiri
> 
>  tools/perf/util/event.c | 83 
> +
>  1 file changed, 50 insertions(+), 33 deletions(-)
> 
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index 023dd3548a94..5516236df6ab 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -51,29 +51,32 @@ static struct perf_sample synth_sample = {
>  
>  /*
>   * Assumes that the first 4095 bytes of /proc/pid/stat contains
> - * the comm and tgid.
> + * the comm, tgid and ppid.
>   */
> -static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
> +static int perf_event__get_comm_ids(pid_t pid, char *comm, size_t len,
> + pid_t *tgid, pid_t *ppid)
>  {
>   char filename[PATH_MAX];
>   char bf[4096];
>   int fd;
>   size_t size = 0, n;
> - pid_t tgid = -1;
> - char *nl, *name, *tgids;
> + char *nl, *name, *tgids, *ppids;
> +
> + *tgid = -1;
> + *ppid = -1;
>  
>   snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
>  
>   fd = open(filename, O_RDONLY);
>   if (fd < 0) {
>   pr_debug("couldn't open %s\n", filename);
> - return 0;
> + return -1;
>   }
>  
>   n = read(fd, bf, sizeof(bf) - 1);
>   close(fd);
>   if (n <= 0) {
> - pr_warning("Couldn't get COMM and tgid for pid %d\n",
> + pr_warning("Couldn't get COMM, tigd and ppid for pid %d\n",
>  pid);
>   return -1;
>   }
> @@ -81,6 +84,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char 
> *comm, size_t len)
>  
>   name = strstr(bf, "Name:");
>   tgids = strstr(bf, "Tgid:");
> + ppids = strstr(bf, "PPid:");
>  
>   if (name) {
>   name += 5;  /* strlen("Name:") */
> @@ -103,32 +107,45 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char 
> *comm, size_t len)
>  
>   if (tgids) {
>   tgids += 5;  /* strlen("Tgid:") */
> - tgid = atoi(tgids);
> + *tgid = atoi(tgids);
>   } else {
>   pr_debug("Tgid: string not found for pid %d\n", pid);
>   }
>  
> - return tgid;
> + if (ppids) {
> + ppids += 5;  /* strlen("PPid:") */
> + *ppid = atoi(ppids);
> + } else {
> + pr_debug("PPid: string not found for pid %d\n", pid);
> + }
> +
> + return 0;
>  }
>  
> -static pid_t perf_event__prepare_comm(union perf_event *event, pid_t pid,
> -  struct machine *machine)
> +static int perf_event__prepare_comm(union perf_event *event, pid_t pid,
> + struct machine *machine,
> + pid_t *tgid, pid_t *ppid)
>  {
>   size_t size;
> - pid_t tgid;
> +
> + *ppid = -1;
>  
>   memset(>comm, 0, sizeof(event->comm));
>  
> - if (machine__is_host(machine))
> - tgid = perf_event__get_comm_tgid(pid, event->comm.comm,
> -  sizeof(event->comm.comm));
> - else
> - tgid = machine->pid;
> + if (machine__is_host(machine)) {
> + if (perf_event__get_comm_ids(pid, event->comm.comm,
> +  sizeof(event->comm.comm),
> +  tgid, ppid) != 0) {
> + return -1;
> + }
> + } else {
> + *tgid = machine->pid;
> + }
>  
> - if (tgid < 0)
> - goto out;
> + if (*tgid < 0)
> + return -1;
>  
> - event->comm.pid = tgid;
> + event->comm.pid = *tgid;
>   event->comm.header.type = PERF_RECORD_COMM;
>  
>   size = strlen(event->comm.comm) + 1;
> @@ -138,8 +155,8 @@ static pid_t perf_event__prepare_comm(union perf_event 
> *event, pid_t pid,
>   (sizeof(event->comm.comm) - size) +
>   machine->id_hdr_size);
>   event->comm.tid = pid;
> -out:
> - return tgid;
> +
> + return 0;
>  }
>  
>  static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
> @@ -147,27 +164,27 @@ static pid_t perf_event__synthesize_comm(struct 
> perf_tool *tool,
>perf_event__handler_t process,
>struct machine *machine)
>  {
> - pid_t tgid = perf_event__prepare_comm(event, pid, 

Re: [PATCH v2 1/2] perf tool: Refactor comm/tgid lookup

2015-03-31 Thread Don Zickus
On Mon, Mar 30, 2015 at 02:35:57PM -0600, David Ahern wrote:
> Rather than parsing /proc/pid/status file one line at a time, read
> it into a buffer in one shot and search for all strings in one pass.
> 
> tgid conversion also simplified -- removing the isspace walk. As
> noted by Arnaldo those are not needed for atoi == strtol calls.

Seeing Jiri is happy now. :-) 

Acked-by: Don Zickus 

> 
> Signed-off-by: David Ahern 
> Cc: Don Zickus 
> Cc: Joe Mario 
> Cc: Jiri Olsa 
> ---
> v2:
> - removed the isspace checks on tgid string
> 
>  tools/perf/util/event.c | 72 
> ++---
>  1 file changed, 44 insertions(+), 28 deletions(-)
> 
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index d5efa5092ce6..023dd3548a94 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -49,48 +49,64 @@ static struct perf_sample synth_sample = {
>   .period= 1,
>  };
>  
> +/*
> + * Assumes that the first 4095 bytes of /proc/pid/stat contains
> + * the comm and tgid.
> + */
>  static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
>  {
>   char filename[PATH_MAX];
> - char bf[BUFSIZ];
> - FILE *fp;
> - size_t size = 0;
> + char bf[4096];
> + int fd;
> + size_t size = 0, n;
>   pid_t tgid = -1;
> + char *nl, *name, *tgids;
>  
>   snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
>  
> - fp = fopen(filename, "r");
> - if (fp == NULL) {
> + fd = open(filename, O_RDONLY);
> + if (fd < 0) {
>   pr_debug("couldn't open %s\n", filename);
>   return 0;
>   }
>  
> - while (!comm[0] || (tgid < 0)) {
> - if (fgets(bf, sizeof(bf), fp) == NULL) {
> - pr_warning("couldn't get COMM and pgid, malformed %s\n",
> -filename);
> - break;
> - }
> + n = read(fd, bf, sizeof(bf) - 1);
> + close(fd);
> + if (n <= 0) {
> + pr_warning("Couldn't get COMM and tgid for pid %d\n",
> +pid);
> + return -1;
> + }
> + bf[n] = '\0';
>  
> - if (memcmp(bf, "Name:", 5) == 0) {
> - char *name = bf + 5;
> - while (*name && isspace(*name))
> - ++name;
> - size = strlen(name) - 1;
> - if (size >= len)
> - size = len - 1;
> - memcpy(comm, name, size);
> - comm[size] = '\0';
> -
> - } else if (memcmp(bf, "Tgid:", 5) == 0) {
> - char *tgids = bf + 5;
> - while (*tgids && isspace(*tgids))
> - ++tgids;
> - tgid = atoi(tgids);
> - }
> + name = strstr(bf, "Name:");
> + tgids = strstr(bf, "Tgid:");
> +
> + if (name) {
> + name += 5;  /* strlen("Name:") */
> +
> + while (*name && isspace(*name))
> + ++name;
> +
> + nl = strchr(name, '\n');
> + if (nl)
> + *nl = '\0';
> +
> + size = strlen(name);
> + if (size >= len)
> + size = len - 1;
> + memcpy(comm, name, size);
> + comm[size] = '\0';
> + } else {
> + pr_debug("Name: string not found for pid %d\n", pid);
>   }
>  
> - fclose(fp);
> + if (tgids) {
> + tgids += 5;  /* strlen("Tgid:") */
> + tgid = atoi(tgids);
> + } else {
> + pr_debug("Tgid: string not found for pid %d\n", pid);
> + }
>  
>   return tgid;
>  }
> -- 
> 2.2.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] arm: perf: Directly handle SMP platforms with one SPI

2015-03-31 Thread Will Deacon
Hi Daniel,

On Wed, Mar 04, 2015 at 01:25:45PM +, Daniel Thompson wrote:
> Some ARM platforms mux the PMU interrupt of every core into a single
> SPI. On such platforms if the PMU of any core except 0 raises an interrupt
> then it cannot be serviced and eventually, if you are lucky, the spurious
> irq detection might forcefully disable the interrupt.
> 
> On these SoCs it is not possible to determine which core raised the
> interrupt so workaround this issue by queuing irqwork on the other
> cores whenever the primary interrupt handler is unable to service the
> interrupt.
> 
> The u8500 platform has an alternative workaround that dynamically alters
> the affinity of the PMU interrupt. This workaround logic is no longer
> required so the original code is removed as is the hook it relied upon.
> 
> Tested on imx6q (which has fours cores/PMUs all muxed to a single SPI)
> using a simple soak, combined perf and CPU hotplug soak and using
> perf fuzzer's fast_repro.sh.

[...]

> diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
> index b1596bd59129..dfef7904b790 100644
> --- a/arch/arm/include/asm/pmu.h
> +++ b/arch/arm/include/asm/pmu.h
> @@ -87,6 +87,14 @@ struct pmu_hw_events {
>  * already have to allocate this struct per cpu.
>  */
> struct arm_pmu  *percpu_pmu;
> +
> +#ifdef CONFIG_SMP
> +   /*
> +* This is used to schedule workaround logic on platforms where all
> +* the PMUs are attached to a single SPI.
> +*/
> +   struct irq_work work;
> +#endif
>  };
> 
>  struct arm_pmu {
> @@ -117,6 +125,10 @@ struct arm_pmu {
> struct platform_device  *plat_device;
> struct pmu_hw_events__percpu *hw_events;
> struct notifier_block   hotplug_nb;
> +#ifdef CONFIG_SMP
> +   int muxed_spi_workaround_irq;
> +   atomic_tremaining_irq_work;
> +#endif
>  };
> 
>  #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
> diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> index 557e128e4df0..e3fc1a0ce969 100644
> --- a/arch/arm/kernel/perf_event.c
> +++ b/arch/arm/kernel/perf_event.c
> @@ -305,8 +305,6 @@ validate_group(struct perf_event *event)
>  static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)
>  {
> struct arm_pmu *armpmu;
> -   struct platform_device *plat_device;
> -   struct arm_pmu_platdata *plat;
> int ret;
> u64 start_clock, finish_clock;
> 
> @@ -317,14 +315,9 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void 
> *dev)
>  * dereference.
>  */
> armpmu = *(void **)dev;
> -   plat_device = armpmu->plat_device;
> -   plat = dev_get_platdata(_device->dev);
> 
> start_clock = sched_clock();
> -   if (plat && plat->handle_irq)
> -   ret = plat->handle_irq(irq, armpmu, armpmu->handle_irq);
> -   else
> -   ret = armpmu->handle_irq(irq, armpmu);
> +   ret = armpmu->handle_irq(irq, armpmu);
> finish_clock = sched_clock();
> 
> perf_sample_event_took(finish_clock - start_clock);
> diff --git a/arch/arm/kernel/perf_event_cpu.c 
> b/arch/arm/kernel/perf_event_cpu.c
> index 61b53c46edfa..d5bbd79abd4c 100644
> --- a/arch/arm/kernel/perf_event_cpu.c
> +++ b/arch/arm/kernel/perf_event_cpu.c
> @@ -59,6 +59,116 @@ int perf_num_counters(void)
>  }
>  EXPORT_SYMBOL_GPL(perf_num_counters);
> 
> +#ifdef CONFIG_SMP
> +
> +static cpumask_t down_prepare_cpu_mask;
> +static DEFINE_SPINLOCK(down_prepare_cpu_lock);
> +
> +/*
> + * Workaround logic that is distributed to all cores if the PMU has only
> + * a single IRQ and the CPU receiving that IRQ cannot handle it. Its
> + * job is to try to service the interrupt on the current CPU. It will
> + * also enable the IRQ again if all the other CPUs have already tried to
> + * service it.
> + */
> +static void cpu_pmu_do_percpu_work(struct irq_work *w)
> +{
> +   struct pmu_hw_events *hw_events =
> +   container_of(w, struct pmu_hw_events, work);
> +   struct arm_pmu *cpu_pmu = hw_events->percpu_pmu;
> +
> +   /* Ignore the return code, we can do nothing useful with it */
> +   (void) cpu_pmu->handle_irq(0, cpu_pmu);
> +
> +   if (atomic_dec_and_test(_pmu->remaining_irq_work))
> +   enable_irq(cpu_pmu->muxed_spi_workaround_irq);
> +}
> +
> +/*
> + * Workaround for systems where all PMU interrupts are targeting a
> + * single SPI.
> + *
> + * The workaround will disable the interrupt and distribute irqwork to all
> + * the other processors in the system. Hopefully one of them will clear the
> + * interrupt...
> + *
> + * The workaround is only deployed when all PMU interrupts are aimed
> + * at a single core. As a result the workaround is never re-entered
> + * making it safe for us to use static data to maintain state.
> + */
> +static void cpu_pmu_deploy_muxed_spi_workaround(struct arm_pmu *cpu_pmu)
> +{
> +   static cpumask_t 

[PATCH 3/6] Input: Implement dev_pm_ops.prepare()

2015-03-31 Thread Tomeu Vizoso
Have it return 1 in both input_dev_type and input_class (for evdev
handlers) so that input devices that are runtime-suspended won't be
suspended when the system goes to a sleep state. This can make resume
times considerably shorter because these devices don't need to be
resumed when the system is awaken.

Signed-off-by: Tomeu Vizoso 
---
 drivers/input/input.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index cc357f1..cbbd391 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1741,12 +1741,22 @@ static int input_dev_poweroff(struct device *dev)
return 0;
 }
 
+static int input_dev_prepare(struct device *dev)
+{
+   return 1;
+}
+
 static const struct dev_pm_ops input_dev_pm_ops = {
.suspend= input_dev_suspend,
.resume = input_dev_resume,
.freeze = input_dev_freeze,
.poweroff   = input_dev_poweroff,
.restore= input_dev_resume,
+   .prepare= input_dev_prepare,
+};
+
+static const struct dev_pm_ops input_class_pm_ops = {
+   .prepare= input_dev_prepare,
 };
 #endif /* CONFIG_PM */
 
@@ -1767,6 +1777,9 @@ static char *input_devnode(struct device *dev, umode_t 
*mode)
 struct class input_class = {
.name   = "input",
.devnode= input_devnode,
+#ifdef CONFIG_PM_SLEEP
+   .pm = _class_pm_ops,
+#endif
 };
 EXPORT_SYMBOL_GPL(input_class);
 
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/6] [media] v4l2-core: Implement dev_pm_ops.prepare()

2015-03-31 Thread Tomeu Vizoso
Have it return 1 so that video devices that are runtime-suspended won't
be suspended when the system goes to a sleep state. This can make resume
times considerably shorter because these devices don't need to be
resumed when the system is awaken.

Signed-off-by: Tomeu Vizoso 
---
 drivers/media/v4l2-core/v4l2-dev.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index e2b8b3e..b74e3d3 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -219,9 +219,19 @@ static void v4l2_device_release(struct device *cd)
v4l2_device_put(v4l2_dev);
 }
 
+static int video_device_prepare(struct device *dev)
+{
+   return 1;
+}
+
+static const struct dev_pm_ops video_device_pm_ops = {
+   .prepare = video_device_prepare,
+};
+
 static struct class video_class = {
.name = VIDEO_NAME,
.dev_groups = video_device_groups,
+   .pm = _device_pm_ops,
 };
 
 struct video_device *video_devdata(struct file *file)
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] perf script segfault

2015-03-31 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 31, 2015 at 01:14:20PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Mar 31, 2015 at 05:50:48PM +0200, Jiri Olsa escreveu:
> > On Tue, Mar 31, 2015 at 05:48:44PM +0200, Jiri Olsa wrote:
> > > On Tue, Mar 31, 2015 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > > 
> > > SNIP
> > > 
> > > > struct ordered_events *oe = >ordered_events;
> > > > -   struct perf_tool *tool = oe->tool;
> > > > +   struct perf_tool *tool = session->tool;
> > > > int fd = perf_data_file__fd(session->file);
> > > > u64 head, page_offset, file_offset, file_pos, size;
> > > > int err, mmap_prot, mmap_flags, map_idx = 0;
> > > > @@ -1394,6 +1407,7 @@ out:
> > > >  out_err:
> > > > ui_progress__finish();
> > > > perf_tool__warn_about_errors(tool, >evlist->stats);
> > > > +   ordered_events__warn_about_errors(>ordered_events);
> > > 
> > > how about just single warning function ?
> > > 
> > >   perf_session__warn_about_errors(struct perf_session *session)
> > > 
> > > session has now both tool and ordered_events
> > 
> > other than this it looks ok to me
> 
> Like this? If so, can I have your Acked-by? :-)

Out for lunch, put it on the tmp.perf/core branch in my repo,

bbl,
 
> - Arnaldo
> 
> From a6ee71dd2814dff89670b3764ac9fbb897366312 Mon Sep 17 00:00:00 2001
> From: Arnaldo Carvalho de Melo 
> Date: Tue, 31 Mar 2015 12:48:16 -0300
> Subject: [PATCH 1/1] perf ordered_samples: Remove references to
>  perf_{evlist,tool} and machines
> 
> As these can be obtained from the ordered_events pointer, via
> container_of, reducing the cross section of ordered_samples.
> 
> These were added to ordered_samples in:
> 
>  commit b7b61cbebd789a3dbca522e3fdb727fe5c95593f
>  Author: Arnaldo Carvalho de Melo 
>  Date:   Tue Mar 3 11:58:45 2015 -0300
> 
> perf ordered_events: Shorten function signatures
> 
> By keeping pointers to machines, evlist and tool in ordered_events.
> 
> But that was more a transitional patch while moving stuff out from
> perf_session.c to ordered_events.c and possibly not even needed by then,
> as we could use the container_of() method and instead of having the
> nr_unordered_samples stats in events_stats, we can have it in
> ordered_samples.
> 
> Based-on-a-patch-by: Jiri Olsa 
> Cc: Adrian Hunter 
> Cc: Borislav Petkov 
> Cc: David Ahern 
> Cc: Don Zickus 
> Cc: Frederic Weisbecker 
> Cc: Namhyung Kim 
> Cc: Stephane Eranian 
> Link: http://lkml.kernel.org/n/tip-4lk0t9js82g0tfc0x1onp...@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo 
> ---
>  tools/perf/util/event.h  |  1 -
>  tools/perf/util/ordered-events.c | 21 --
>  tools/perf/util/ordered-events.h | 14 +++-
>  tools/perf/util/session.c| 47 
> +---
>  tools/perf/util/session.h|  1 +
>  5 files changed, 37 insertions(+), 47 deletions(-)
> 
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index c4ffe2bd0738..09b9e8d3fcf7 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -242,7 +242,6 @@ struct events_stats {
>   u32 nr_invalid_chains;
>   u32 nr_unknown_id;
>   u32 nr_unprocessable_samples;
> - u32 nr_unordered_events;
>  };
>  
>  struct attr_event {
> diff --git a/tools/perf/util/ordered-events.c 
> b/tools/perf/util/ordered-events.c
> index 6002fa3fcf77..52be201b9b25 100644
> --- a/tools/perf/util/ordered-events.c
> +++ b/tools/perf/util/ordered-events.c
> @@ -2,7 +2,6 @@
>  #include 
>  #include 
>  #include "ordered-events.h"
> -#include "evlist.h"
>  #include "session.h"
>  #include "asm/bug.h"
>  #include "debug.h"
> @@ -167,7 +166,7 @@ int ordered_events__queue(struct ordered_events *oe, 
> union perf_event *event,
>   pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
>  oe->last_flush_type);
>  
> - oe->evlist->stats.nr_unordered_events++;
> + oe->nr_unordered_events++;
>   }
>  
>   oevent = ordered_events__new_event(oe, timestamp, event);
> @@ -187,7 +186,6 @@ static int __ordered_events__flush(struct ordered_events 
> *oe)
>  {
>   struct list_head *head = >events;
>   struct ordered_event *tmp, *iter;
> - struct perf_sample sample;
>   u64 limit = oe->next_flush;
>   u64 last_ts = oe->last ? oe->last->timestamp : 0ULL;
>   bool show_progress = limit == ULLONG_MAX;
> @@ -206,15 +204,9 @@ static int __ordered_events__flush(struct ordered_events 
> *oe)
>  
>   if (iter->timestamp > limit)
>   break;
> -
> - ret = perf_evlist__parse_sample(oe->evlist, iter->event, 
> );
> + ret = oe->deliver(oe, iter);
>   if (ret)
> - pr_err("Can't parse sample, err = %d\n", ret);
> - else {
> - ret = oe->deliver(oe, iter, );
> - if (ret)
> - return ret;
> - 

Re: [PATCH v2] ftracetest: Convert exit -1 to exit $FAIL

2015-03-31 Thread Shuah Khan
On 03/30/2015 01:50 PM, Steven Rostedt wrote:
> On Mon, 30 Mar 2015 16:21:00 +1100
> Michael Ellerman  wrote:
> 
>> POSIX says that exit takes an unsigned integer between 0 and 255, so
>> using -1 doesn't work on POSIX shells.
>>
>> There is already a well-defined failure code, $FAIL (1), so use that.
>>
>> Signed-off-by: Michael Ellerman 
> 
> Acked-by: Steven Rostedt 
> 

Applied to linux-kselftest next for 4.1

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: Tree for Mar 31 (build failures and culprits)

2015-03-31 Thread Guenter Roeck
On Wed, Apr 01, 2015 at 12:02:21AM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Changes since 20150330:
> 
> The arm64 tree gained a conflict against the arm-soc tree.
> 
> The idle tree gained a build failure so I used the version from
> next-20150327.
> 
> The tip tree gained conflicts against the pm tree.
> 
> The akpm tree gained a conflict against the mips tree.
> 
> Non-merge commits (relative to Linus' tree): 7277
>  6623 files changed, 304342 insertions(+), 138111 deletions(-)
> 
> 
> 

Build results:
total: 121 pass: 94 fail: 27
Failed builds:
alpha:allmodconfig
arm:rpc_defconfig
arm64:defconfig
cris:defconfig
cris:etrax-100lx_defconfig
cris:allnoconfig
frv:defconfig
i386:allyesconfig
i386:allmodconfig
ia64:defconfig
m32r:defconfig
m68k:defconfig
m68k:allmodconfig
m68k:sun3_defconfig
m68k:m5272c3_defconfig
m68k:m5307c3_defconfig
m68k:m5249evb_defconfig
m68k:m5407c3_defconfig
m68k:m5475evb_defconfig
mips:allmodconfig
parisc:defconfig
parisc:generic-32bit_defconfig
parisc:a500_defconfig
parisc:generic-64bit_defconfig
x86_64:allyesconfig
xtensa:defconfig
xtensa:allmodconfig

---
alpha:allmodconfig
mips:allmodconfig

samples/kdbus/kdbus-workers.c: In function ‘prime_new’:
samples/kdbus/kdbus-workers.c:930:18: error: ‘__NR_memfd_create’ undeclared
(first use in this function)
  p->fd = syscall(__NR_memfd_create, "prime-area", MFD_CLOEXEC);

Looks like the kdbus example never worked for the affected architectures.
I don't build allmodconfig for all architectures, so other architectures
may be affected as well.

---
arm64:defconfig

drivers/built-in.o: In function `tegra124_132_clock_init_post':
drivers/clk/tegra/clk-tegra124.c:1496: undefined reference to `tegra_emc_init'

Introduced by commit 32477681f48a ("Merge remote-tracking branch
'arm64/for-next/core'"). Maybe some conflict resolution problem ?
CONFIG_ARCH_TEGRA_132_SOC only builds clk-tegra124.o, but clk-tegra124.o
needs clk-emc.o for tegra_emc_init. clk-emc.c was introduced with commit
4ec9e9975d8c ("clk: tegra: Add EMC clock driver"), but it only adds
clk-emc.o to the CONFIG_ARCH_TEGRA_124_SOC build, not to
CONFIG_ARCH_TEGRA_132_SOC.

On a side note, tegra_emc_init is declared twice, once as static variable
and once as global variable, in different files.

---
cris:defconfig
cris:etrax-100lx_defconfig
cris:allnoconfig
frv:defconfig
ia64:defconfig
m32r:defconfig
m68k (all builds)
parisc (all builds)
arm:rpc_defconfig

In file included from kernel/time/hrtimer.c:57:0:
kernel/time/tick-internal.h: In function 'tick_set_periodic_handler':
kernel/time/tick-internal.h:114:5: error: dereferencing pointer to incomplete 
type
kernel/time/tick-internal.h:114:23: error: 'tick_handle_periodic' undeclared

tick_handle_periodic is declared inside CONFIG_GENERIC_CLOCKEVENTS but used
outside.

Introduced by commit 01b9fdf7e540 ("tick: Move core only declarations and
functions to core") according to bisect. There may be other problems obscuring
the bisect results, though, since the build failure pattern changes during
bisect.

---
i386:allyesconfig
i386:allmodconfig

drivers/usb/musb/musb_dsps.c: In function 'dsps_read_fifo32':
drivers/usb/musb/musb_dsps.c:624:3: error: implicit declaration of function 
'readsl'

Introduced by commit 3e457371f436 ("usb: musb: Fix fifo reads for dm816x with
musb_dsps").

---
x86_64:allyesconfig

drivers/built-in.o: In function `sl811_cs_probe':
sl811_cs.c:(.text+0x1d432f6): undefined reference to `sl811h_driver'

Introduced by commit 1dc6120ef7f0 ("usb: host/sl811-hcd: fix sparse warning"),
a botched cleanup attempt.

---
xtensa

Lots of 'dangerous relocation: l32r: literal placed after use' all over the
place, causing all xtensa builds to fail.

Introduced by commit 779c88c94c34 ("ARM: 8321/1: asm-generic: introduce
.text.fixup input section").
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] x86/asm/entry/64: simplifications

2015-03-31 Thread Denys Vlasenko
On 03/31/2015 05:47 PM, Ingo Molnar wrote:
> 
> * Denys Vlasenko  wrote:
> 
>> This patchset simplifies jump maze in entry_64.S a bit by moving
>> "retint_kernel" code block, and follows up with simplifications
>> which become obvious after the move.
> 
> So I got conflicts with latest tip:master with 3 of the 5 patches, so 
> I probably missed one of your older patches.
> 
> I pushed out the other two - mind merging all your pending patches on 
> top of latest tip:master and sending out all of them as a single 
> series, so that I can pick up all the uncontroversial bits?

Will do in ~15 minutes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] [media] media-devnode: Implement dev_pm_ops.prepare callback

2015-03-31 Thread Tomeu Vizoso
Have it return 1 so that media device nodes that are runtime-suspended
won't be suspended when the system goes to a sleep state. This can make
resume times considerably shorter because these devices don't need to be
resumed when the system is awaken.

Signed-off-by: Tomeu Vizoso 
---
 drivers/media/media-devnode.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index ebf9626..2c36d0a 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -76,8 +76,18 @@ static void media_devnode_release(struct device *cd)
mdev->release(mdev);
 }
 
+static int media_bus_prepare(struct device *dev)
+{
+   return 1;
+}
+
+static const struct dev_pm_ops media_bus_pm_ops = {
+   .prepare = media_bus_prepare,
+};
+
 static struct bus_type media_bus_type = {
.name = MEDIA_NAME,
+   .pm = _bus_pm_ops,
 };
 
 static ssize_t media_read(struct file *filp, char __user *buf,
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ftracetest: Cope properly with stack tracer not being enabled

2015-03-31 Thread Shuah Khan
On 03/30/2015 03:36 PM, Steven Rostedt wrote:
> On Mon, 30 Mar 2015 16:21:40 +1100
> Michael Ellerman  wrote:
> 
>> If the stack tracer (CONFIG_STACK_TRACER) is disabled, the
>> fgraph-filter-stack test blows chunks:
>>
>>   [8] ftrace - function graph filters with stack tracer  [FAIL]
>>   + reset_tracer
>>   + echo nop
>>   ./ftracetest: 19: 
>> /home/michael/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc:
>>  cannot create /proc/sys/kernel/stack_tracer_enabled: Directory 
>> nonexistent
>>
>> Fix it by checking if the proc file exists before echoing to it. With
>> the patch applied it fails correctly with:
>>
>>   [8] ftrace - function graph filters with stack tracer  [UNSUPPORTED]
>>
>> Signed-off-by: Michael Ellerman 
>> ---
> 
> Acked-by: Steven Rostedt 
> 

Applied to linux-kselftest next for 4.1

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: another pmem variant V2

2015-03-31 Thread Christoph Hellwig
On Tue, Mar 31, 2015 at 06:14:15PM +0300, Boaz Harrosh wrote:
> We can not accept it as is right now.

Who is we?

> We have conducted farther tests. And it messes up NUMA.

Only you if you use the memmap option in weird ways.

Sounds like I should simply remove the memmap= option so people don't
abuse it.  The main point is to parse the e820 tables, which works fine.

And those people having fake pmem, or pcie cards that they are too lazy
to submit proper drivers for can stick to their out of tree hacks?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] [media] uvcvideo: Enable runtime PM of descendant devices

2015-03-31 Thread Tomeu Vizoso
So UVC devices can remain runtime-suspended when the system goes into a
sleep state, they and all of their descendant devices need to have
runtime PM enable.

Signed-off-by: Tomeu Vizoso 
---
 drivers/media/usb/uvc/uvc_driver.c | 4 
 drivers/media/usb/uvc/uvc_status.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_driver.c 
b/drivers/media/usb/uvc/uvc_driver.c
index cf27006..e98830a1 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1792,6 +1792,8 @@ static int uvc_register_video(struct uvc_device *dev,
return ret;
}
 
+   pm_runtime_enable(>dev);
+
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE;
else
@@ -1932,6 +1934,8 @@ static int uvc_probe(struct usb_interface *intf,
if (media_device_register(>mdev) < 0)
goto error;
 
+   pm_runtime_enable(>mdev.devnode.dev);
+
dev->vdev.mdev = >mdev;
 #endif
if (v4l2_device_register(>dev, >vdev) < 0)
diff --git a/drivers/media/usb/uvc/uvc_status.c 
b/drivers/media/usb/uvc/uvc_status.c
index f552ab9..b1d3d8c 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -13,6 +13,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -46,6 +47,8 @@ static int uvc_input_init(struct uvc_device *dev)
if ((ret = input_register_device(input)) < 0)
goto error;
 
+   pm_runtime_enable(>dev);
+
dev->input = input;
return 0;
 
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler

2015-03-31 Thread Tomeu Vizoso
So ancestor devices can remain runtime-suspended when the system goes
into a sleep state, they and all of their descendant devices need to
have runtime PM enabled.

Signed-off-by: Tomeu Vizoso 
---
 drivers/input/evdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a18f41b..3d60c20 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "input-compat.h"
 
 enum evdev_clock_type {
@@ -1201,6 +1202,8 @@ static int evdev_connect(struct input_handler *handler, 
struct input_dev *dev,
if (error)
goto err_cleanup_evdev;
 
+   pm_runtime_enable(>dev);
+
return 0;
 
  err_cleanup_evdev:
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/6] MAINTAINERS: Add phy-miphy28lp.c to ARCH/STI architecture

2015-03-31 Thread Kishon Vijay Abraham I

Hi,

On Monday 30 March 2015 08:47 PM, Peter Griffin wrote:

This patch adds the phy-miphy28lp.c phy driver found on STMicroelectronics
stih407 family SoC's into the STI arch section of the maintainers file.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1de6afa..fa1bb4f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1469,6 +1469,7 @@ F:drivers/clocksource/arm_global_timer.c
  F:drivers/i2c/busses/i2c-st.c
  F:drivers/media/rc/st_rc.c
  F:drivers/mmc/host/sdhci-st.c
+F: drivers/phy/phy-miphy28lp.c


add for miphy365x.c as well?

-Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] USB / PM: Allow USB devices to remain runtime-suspended when sleeping

2015-03-31 Thread Tomeu Vizoso
Have dev_pm_ops.prepare return 1 for USB devices, interfaces, endpoints
and ports so that USB devices can remain runtime-suspended when the
system goes to a sleep state.

Also enable runtime PM for endpoints, which is another requirement for
the above to work.

Signed-off-by: Tomeu Vizoso 
---
 drivers/usb/core/endpoint.c | 17 +
 drivers/usb/core/message.c  | 16 
 drivers/usb/core/port.c |  6 ++
 drivers/usb/core/usb.c  |  2 +-
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 39a2402..7c82bb7 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -160,6 +160,19 @@ static const struct attribute_group *ep_dev_groups[] = {
NULL
 };
 
+#ifdef CONFIG_PM
+
+static int usb_ep_device_prepare(struct device *dev)
+{
+   return 1;
+}
+
+static const struct dev_pm_ops usb_ep_device_pm_ops = {
+   .prepare =  usb_ep_device_prepare,
+};
+
+#endif /* CONFIG_PM */
+
 static void ep_device_release(struct device *dev)
 {
struct ep_device *ep_dev = to_ep_device(dev);
@@ -170,6 +183,9 @@ static void ep_device_release(struct device *dev)
 struct device_type usb_ep_device_type = {
.name = "usb_endpoint",
.release = ep_device_release,
+#ifdef CONFIG_PM
+   .pm =   _ep_device_pm_ops,
+#endif
 };
 
 int usb_create_ep_devs(struct device *parent,
@@ -197,6 +213,7 @@ int usb_create_ep_devs(struct device *parent,
goto error_register;
 
device_enable_async_suspend(_dev->dev);
+   pm_runtime_enable(_dev->dev);
endpoint->ep_dev = ep_dev;
return retval;
 
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index f368d20..9041aee 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1589,10 +1589,26 @@ static int usb_if_uevent(struct device *dev, struct 
kobj_uevent_env *env)
return 0;
 }
 
+#ifdef CONFIG_PM
+
+static int usb_if_prepare(struct device *dev)
+{
+   return 1;
+}
+
+static const struct dev_pm_ops usb_if_pm_ops = {
+   .prepare =  usb_if_prepare,
+};
+
+#endif /* CONFIG_PM */
+
 struct device_type usb_if_device_type = {
.name = "usb_interface",
.release =  usb_release_interface,
.uevent =   usb_if_uevent,
+#ifdef CONFIG_PM
+   .pm =   _if_pm_ops,
+#endif
 };
 
 static struct usb_interface_assoc_descriptor *find_iad(struct usb_device *dev,
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 2106183..f49707d 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -168,12 +168,18 @@ static int usb_port_runtime_suspend(struct device *dev)
 
return retval;
 }
+
+static int usb_port_prepare(struct device *dev)
+{
+   return 1;
+}
 #endif
 
 static const struct dev_pm_ops usb_port_pm_ops = {
 #ifdef CONFIG_PM
.runtime_suspend =  usb_port_runtime_suspend,
.runtime_resume =   usb_port_runtime_resume,
+   .prepare =  usb_port_prepare,
 #endif
 };
 
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index b1fb9ae..1498faa 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -300,7 +300,7 @@ static int usb_dev_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 
 static int usb_dev_prepare(struct device *dev)
 {
-   return 0;   /* Implement eventually? */
+   return 1;   /* Implement eventually? */
 }
 
 static void usb_dev_complete(struct device *dev)
-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6] Allow UVC devices to remain runtime-suspended when sleeping

2015-03-31 Thread Tomeu Vizoso
Hi,

this series contain what I needed to do in order to have my USB webcam to not 
be resumed when the system resumes, reducing considerably the total time that 
resuming takes.

It makes use of the facility that Rafael Wysocki added in aae4518b3 ("PM / 
sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily"), 
which requires that a devices and all its descendants opt-in by having their 
dev_pm_ops.prepare callback return 1, to have runtime PM enabled, and to be 
runtime suspended when the system goes to a sleep state.

Thanks,

Tomeu

Tomeu Vizoso (6):
  [media] uvcvideo: Enable runtime PM of descendant devices
  [media] v4l2-core: Implement dev_pm_ops.prepare()
  Input: Implement dev_pm_ops.prepare()
  [media] media-devnode: Implement dev_pm_ops.prepare callback
  Input: evdev - Enable runtime PM of the evdev input handler
  USB / PM: Allow USB devices to remain runtime-suspended when sleeping

 drivers/input/evdev.c  |  3 +++
 drivers/input/input.c  | 13 +
 drivers/media/media-devnode.c  | 10 ++
 drivers/media/usb/uvc/uvc_driver.c |  4 
 drivers/media/usb/uvc/uvc_status.c |  3 +++
 drivers/media/v4l2-core/v4l2-dev.c | 10 ++
 drivers/usb/core/endpoint.c| 17 +
 drivers/usb/core/message.c | 16 
 drivers/usb/core/port.c|  6 ++
 drivers/usb/core/usb.c |  2 +-
 10 files changed, 83 insertions(+), 1 deletion(-)

-- 
2.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] perf script segfault

2015-03-31 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 31, 2015 at 05:50:48PM +0200, Jiri Olsa escreveu:
> On Tue, Mar 31, 2015 at 05:48:44PM +0200, Jiri Olsa wrote:
> > On Tue, Mar 31, 2015 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> > 
> > SNIP
> > 
> > >   struct ordered_events *oe = >ordered_events;
> > > - struct perf_tool *tool = oe->tool;
> > > + struct perf_tool *tool = session->tool;
> > >   int fd = perf_data_file__fd(session->file);
> > >   u64 head, page_offset, file_offset, file_pos, size;
> > >   int err, mmap_prot, mmap_flags, map_idx = 0;
> > > @@ -1394,6 +1407,7 @@ out:
> > >  out_err:
> > >   ui_progress__finish();
> > >   perf_tool__warn_about_errors(tool, >evlist->stats);
> > > + ordered_events__warn_about_errors(>ordered_events);
> > 
> > how about just single warning function ?
> > 
> >   perf_session__warn_about_errors(struct perf_session *session)
> > 
> > session has now both tool and ordered_events
> 
> other than this it looks ok to me

Like this? If so, can I have your Acked-by? :-)

- Arnaldo

>From a6ee71dd2814dff89670b3764ac9fbb897366312 Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo 
Date: Tue, 31 Mar 2015 12:48:16 -0300
Subject: [PATCH 1/1] perf ordered_samples: Remove references to
 perf_{evlist,tool} and machines

As these can be obtained from the ordered_events pointer, via
container_of, reducing the cross section of ordered_samples.

These were added to ordered_samples in:

 commit b7b61cbebd789a3dbca522e3fdb727fe5c95593f
 Author: Arnaldo Carvalho de Melo 
 Date:   Tue Mar 3 11:58:45 2015 -0300

perf ordered_events: Shorten function signatures

By keeping pointers to machines, evlist and tool in ordered_events.

But that was more a transitional patch while moving stuff out from
perf_session.c to ordered_events.c and possibly not even needed by then,
as we could use the container_of() method and instead of having the
nr_unordered_samples stats in events_stats, we can have it in
ordered_samples.

Based-on-a-patch-by: Jiri Olsa 
Cc: Adrian Hunter 
Cc: Borislav Petkov 
Cc: David Ahern 
Cc: Don Zickus 
Cc: Frederic Weisbecker 
Cc: Namhyung Kim 
Cc: Stephane Eranian 
Link: http://lkml.kernel.org/n/tip-4lk0t9js82g0tfc0x1onp...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/event.h  |  1 -
 tools/perf/util/ordered-events.c | 21 --
 tools/perf/util/ordered-events.h | 14 +++-
 tools/perf/util/session.c| 47 +---
 tools/perf/util/session.h|  1 +
 5 files changed, 37 insertions(+), 47 deletions(-)

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index c4ffe2bd0738..09b9e8d3fcf7 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -242,7 +242,6 @@ struct events_stats {
u32 nr_invalid_chains;
u32 nr_unknown_id;
u32 nr_unprocessable_samples;
-   u32 nr_unordered_events;
 };
 
 struct attr_event {
diff --git a/tools/perf/util/ordered-events.c b/tools/perf/util/ordered-events.c
index 6002fa3fcf77..52be201b9b25 100644
--- a/tools/perf/util/ordered-events.c
+++ b/tools/perf/util/ordered-events.c
@@ -2,7 +2,6 @@
 #include 
 #include 
 #include "ordered-events.h"
-#include "evlist.h"
 #include "session.h"
 #include "asm/bug.h"
 #include "debug.h"
@@ -167,7 +166,7 @@ int ordered_events__queue(struct ordered_events *oe, union 
perf_event *event,
pr_oe_time(oe->last_flush, "last flush, last_flush_type %d\n",
   oe->last_flush_type);
 
-   oe->evlist->stats.nr_unordered_events++;
+   oe->nr_unordered_events++;
}
 
oevent = ordered_events__new_event(oe, timestamp, event);
@@ -187,7 +186,6 @@ static int __ordered_events__flush(struct ordered_events 
*oe)
 {
struct list_head *head = >events;
struct ordered_event *tmp, *iter;
-   struct perf_sample sample;
u64 limit = oe->next_flush;
u64 last_ts = oe->last ? oe->last->timestamp : 0ULL;
bool show_progress = limit == ULLONG_MAX;
@@ -206,15 +204,9 @@ static int __ordered_events__flush(struct ordered_events 
*oe)
 
if (iter->timestamp > limit)
break;
-
-   ret = perf_evlist__parse_sample(oe->evlist, iter->event, 
);
+   ret = oe->deliver(oe, iter);
if (ret)
-   pr_err("Can't parse sample, err = %d\n", ret);
-   else {
-   ret = oe->deliver(oe, iter, );
-   if (ret)
-   return ret;
-   }
+   return ret;
 
ordered_events__delete(oe, iter);
oe->last_flush = iter->timestamp;
@@ -292,18 +284,13 @@ int ordered_events__flush(struct ordered_events *oe, enum 
oe_flush how)
return err;
 }
 
-void ordered_events__init(struct ordered_events *oe, struct machines *machines,
- struct perf_evlist *evlist, struct 

Re: [PATCH] bochs-drm: disable video before changing video mode

2015-03-31 Thread Alexander Beregalov
On 19 March 2015 at 11:26, Gerd Hoffmann  wrote:
> On Mi, 2015-03-18 at 12:37 -0400, Chris Ruffin wrote:
>> qemu and simics simulators both seem to expect that video should be disabled
>> before changing the video mode.
>
> Not required for qemu.  qemu allows updating the modesetting registers
> (xres + friends) while vbe is enabled.
>
> Turning it off, then back on after updating the registers doesn't hurt
> though.  So if this change gets things going on simics it's fine with
> me.
>
> Reviewed-by: Gerd Hoffmann 

Hi Gerd, Dave,
I can't find the patch in linux-next,
will it be included in 4.1?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH 7/7] staging: comedi: comedi_fops: extend spin-lock scope in comedi_event()

2015-03-31 Thread Hartley Sweeten
On Tuesday, March 31, 2015 2:43 AM, Ian Abbott wrote:
> On 30/03/15 17:47, Hartley Sweeten wrote:
>> On Friday, March 27, 2015 8:13 AM, Ian Abbott wrote:
>>> `comedi_event()` is called from low-level drivers to handle comedi
>>> asynchronous command event flags.  As a safety check, it checks the
>>> subdevice's "run" flags to make sure an asynchronous command is running.
>>> It can also change the run flags to mark the command as no longer
>>> running (possibly also marking it as terminated with an error).
>>> Checking the runflags and modifying them involves two uses of the
>>> subdevice's spin-lock.  It seems better to do it with a single use of
>>> the spin-lock.  This also avoids possible interactions with
>>> `do_become_nonbusy()`.
>>>
>>> Acquire the subdevice's spin-lock at the start of `comedi_event()` and
>>> release it near the end, before a possible call to `kill_fasync()` (but
>>> after it's parameter values have been determined).
>>>
>>> Add and make use of few new inline helper functions:
>>>
>>> * `__comedi_clear_subdevice_runflags()` -- clears some run flags without
>>>using the spin-lock
>>> * `__comedi_set_subdevice_runflags()` -- sets some run flags without
>>>using the spin-lock
>>> * `__comedi_get_subdevice_runflags()` -- a spin-lockless version of
>>>`comedi_get_subdevice_runflags()
>>> * `__comedi_is_subdevice_running()` -- a spin-lockless version of
>>> * `comedi_is_subdevice_running()`
>>>
>>> Signed-off-by: Ian Abbott 
>>
>> Ian,
>>
>> For completeness, the comedi_alloc_spriv() helper should probably use
>> __comedi_set_subdevice_runflags() to set the COMEDI_SRF_FREE_SPRIV
>> bit.
>
> Good point.  "drivers/staging/comedi/drivers.c" also reads the runflags 
> directly, so perhaps __comedi_clear_subdevice_runflags(), 
> __comedi_set_subdevice_runflags() and __comedi_get_subdevice_runflags() 
> should be placed in "drivers/staging/comedi/comedi_internal.h".  Or we 
> could ditch all three of those inline functions as they are just simple 
> one-liners.

comedi_internal.h works for mw. We just don't want to expose those functions
to the drivers.

Regards,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] dt: paz00: define nvec as child of i2c bus

2015-03-31 Thread Andrey Danin

Added Wolfram Sang and linux-i2c ML

On 31.03.2015 18:46, Andrey Danin wrote:

On 31.03.2015 17:09, Stephen Warren wrote:

On 03/31/2015 12:40 AM, Andrey Danin wrote:

Hi,

Thanks for the review.

On 03.02.2015 0:20, Stephen Warren wrote:

On 01/29/2015 12:20 AM, Andrey Danin wrote:

NVEC driver was reimplemented to use tegra i2c. Use common i2c
bindings
for NVEC node.



diff --git a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt


The changes to this file make more sense either as a standalone patch
1/4, or as part of the driver changes.


@@ -2,20 +2,5 @@ NVIDIA compliant embedded controller

  Required properties:
  - compatible : should be "nvidia,nvec".
-- reg : the iomem of the i2c slave controller
-- interrupts : the interrupt line of the i2c slave controller
-- clock-frequency : the frequency of the i2c bus
-- gpios : the gpio used for ec request
-- slave-addr: the i2c address of the slave controller
-- clocks : Must contain an entry for each entry in clock-names.
-  See ../clocks/clock-bindings.txt for details.
-- clock-names : Must include the following entries:
-  Tegra20/Tegra30:
-  - div-clk
-  - fast-clk
-  Tegra114:
-  - div-clk
-- resets : Must contain an entry for each entry in reset-names.
-  See ../reset/reset.txt for details.
-- reset-names : Must include the following entries:
-  - i2c
+- request-gpios : the gpio used for ec request
+- reg: the i2c address of the slave controller


This change breaks ABI.

Instead of modifying the definition of the existing compatible value, I
think you should introduce a new compatible value to describe the
external NVEC chip.


I changed compatible value to nvec-slave in v2.



diff --git a/arch/arm/boot/dts/tegra20-paz00.dts
b/arch/arm/boot/dts/tegra20-paz00.dts



-nvec@7000c500 {
-compatible = "nvidia,nvec";
-reg = <0x7000c500 0x100>;
-interrupts = ;
-#address-cells = <1>;
-#size-cells = <0>;
+i2c@7000c500 {
+status = "okay";
  clock-frequency = <8>;
-request-gpios = < TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
-slave-addr = <138>;
-clocks = <_car TEGRA20_CLK_I2C3>,
- <_car TEGRA20_CLK_PLL_P_OUT3>;
-clock-names = "div-clk", "fast-clk";
-resets = <_car 67>;
-reset-names = "i2c";
+
+nvec: nvec@45 {


This doesn't feel correct. There's nothing here to indicate that this
child device is a slave that is implemented by the host SoC rather than
something external attached to the I2C bus.

Perhaps you can get away with this, since the driver for nvidia,nvec
only calls I2C APIs suitable for internal slaves rather than external
slaves? Even so though, I think the distinction needs to be clearly
marked in the DT so that any generic code outside the NVEC driver that
parses the DT can determine the difference.

I would recommend the I2C controller having #address-cells=<2> with
cell
0 being 0==master,1==slave, cell 1 being the I2C address. The I2C
driver
would need to support #address-cells=<1> for backwards-compatibility.


Driver (nvec in this case) can decide what mode should it use according
to compatible value. Is it not enough ?


No, I don't think so.

The I2C binding model is that each child of an I2C controller represents
a device attached to the bus. which SW will communicate with using the
I2C controller as master and the device as a slave. If there's no
explicit representation of child-vs-slave in the DT, how does the I2C
core know whether a particular node is intended to be accessed as a
master or slave?


Device driver registers itself via slave API. Bus driver calls
appropriate callback function when needed.
If device driver decides to access hardware via master API, then it can
do it.

Am I missing something ?



In other words, without an explicit "communicate with this device" or
"implement this device as a slave" flag, how could DT contain:

i2c-controller {
 ...
 master@1a {
 compatible = "foo,device";
 reg = <0x1a 1>;
 };
 slave@1a {
 compatible = "foo,device-slave";
 reg = <0x1a 1>;
 };
};

where:

- "foo,device" means: instantiate a driver to communicate with a device
of this type.

- "foo,device-slave" means: instantiate a driver to act as this I2C
device.

Sure it's possible for the drivers for those two nodes to simply use the
I2C subsystem's master or slave APIs, but I suspect DT content would
confuse the I2C core into thinking that two I2C devices with the same
address had been represented in DT, and the I2C core would refuse to
instantiate one of them. The solution here is for the reg value to
encode a "master" vs. "slave" flag, so the I2C core can allow both a
master and a slave for each address.


If there is one device, then it must be one node. If there is two
devices then it looks incorrect to me to have two devices with the same
address. Does I2C allow two devices with same 

[PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states

2015-03-31 Thread Jan Stancek
Space allocated for paca is based off nr_cpu_ids,
but pnv_alloc_idle_core_states() iterates paca with
cpu_nr_cores()*threads_per_core, which is using NR_CPUS.

This causes pnv_alloc_idle_core_states() to write over memory,
which is outside of paca array and may later lead to various panics.

Fixes: 7cba160ad789 (powernv/cpuidle: Redesign idle states management)
Signed-off-by: Jan Stancek 
---
 arch/powerpc/include/asm/cputhreads.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/cputhreads.h 
b/arch/powerpc/include/asm/cputhreads.h
index 2bf8e93..4c8ad59 100644
--- a/arch/powerpc/include/asm/cputhreads.h
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -55,7 +55,7 @@ static inline cpumask_t cpu_thread_mask_to_cores(const struct 
cpumask *threads)
 
 static inline int cpu_nr_cores(void)
 {
-   return NR_CPUS >> threads_shift;
+   return nr_cpu_ids >> threads_shift;
 }
 
 static inline cpumask_t cpu_online_cores_map(void)
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] SQUASHME: pmem: Split up pmem_probe from pmem_alloc

2015-03-31 Thread Christoph Hellwig
On Tue, Mar 31, 2015 at 05:21:15PM +0300, Boaz Harrosh wrote:
> -static int pmem_probe(struct platform_device *pdev)
> +static int pmem_alloc(struct resource *res, struct device *dev,
> +   struct pmem_device **o_pmem)
>  {

please return the pmem device or an ERR_PTR() here.

Except for that it looks fine for me, and it's exactly what we'd export
for your PCIe device which would get an almost trivial pci_driver wrapper
around it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] phy: spear1310-miphy: Return proper error for spear1310_miphy_xlate

2015-03-31 Thread Kishon Vijay Abraham I

Hi,

On Wednesday 25 March 2015 02:31 PM, Axel Lin wrote:

The of_xlate callback should return ERR_PTR on error.

Signed-off-by: Axel Lin 
---
  drivers/phy/phy-spear1310-miphy.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-spear1310-miphy.c 
b/drivers/phy/phy-spear1310-miphy.c
index 9f47fae..4684b04 100644
--- a/drivers/phy/phy-spear1310-miphy.c
+++ b/drivers/phy/phy-spear1310-miphy.c
@@ -192,14 +192,14 @@ static struct phy *spear1310_miphy_xlate(struct device 
*dev,

if (args->args_count < 1) {
dev_err(dev, "DT did not pass correct no of args\n");
-   return NULL;
+   return ERR_PTR(-EINVAL);


It should actually be -ENODEV so that phy_optional_get() doesn't fail.

}

priv->mode = args->args[0];

if (priv->mode != SATA && priv->mode != PCIE) {
dev_err(dev, "DT did not pass correct phy mode\n");
-   return NULL;
+   return ERR_PTR(-EINVAL);


Same here.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: another pmem variant V2

2015-03-31 Thread Christoph Hellwig
On Tue, Mar 31, 2015 at 01:25:46PM +0300, Boaz Harrosh wrote:
> The problem I see is that if I state a memmap=nn!aa that crosses a NUMA
> boundary then the machine will not boot.
> So BTW for sure I need that "don't merge E820_PMEM ranges" patch because
> otherwise I will not be able to boot if I have pmem on both NUMA nodes
> and they happen to be contiguous.

Ok.

> Regarding the SQUASHMEs to PMEM. Originally I had them as 3-4 patches.
> But I thought since you are squashing them into a single submitted patch
> I can just send just the one patch. Tell me what you prefer and I'll
> resend (The one vs the three)

The slpit is mostly to get a good description for each change.

> And one last issue. I have some configuration "hardness" with the
> memmap=nn!aa Kernel command line API, it was better for me with the
> pmem map= module param. Will you be OK if I split pmem_probe() into
> calling pmem_alloc(addr, length), so I can keep an out-of-tree patch
> that adds the map= parameter to pmem?

Can't your out of tree patch do that as well?  In fact you might want to
rewrite it to a module that allows your to create/destroy the platform_devices
you use.  And for your PCIe case I'd really prefer a proper in-tree PCI
driver for it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 11/25] x86: Use bool function return values of true/false not 1/0

2015-03-31 Thread Paolo Bonzini


On 31/03/2015 01:46, Joe Perches wrote:
> Use the normal return values for bool functions
> 
> Signed-off-by: Joe Perches 
> ---
>  arch/x86/include/asm/archrandom.h  |  2 +-
>  arch/x86/include/asm/dma-mapping.h |  2 +-
>  arch/x86/include/asm/kvm_para.h|  2 +-
>  arch/x86/kvm/cpuid.h   |  2 +-
>  arch/x86/kvm/vmx.c | 72 
> +++---
>  5 files changed, 40 insertions(+), 40 deletions(-)

Applied arch/x86/include/asm/kvm_para.h and arch/x86/kvm/* parts, thanks.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/25] arm: Use bool function return values of true/false not 1/0

2015-03-31 Thread Marc Zyngier
On Tue, 31 Mar 2015 16:58:28 +0100
Paolo Bonzini  wrote:

> On 31/03/2015 01:45, Joe Perches wrote:
> > Use the normal return values for bool functions
> > 
> > Signed-off-by: Joe Perches 
> > ---
> >  arch/arm/include/asm/dma-mapping.h |  8 
> >  arch/arm/include/asm/kvm_emulate.h |  2 +-
> >  arch/arm/mach-omap2/powerdomain.c  | 14 +++---
> >  3 files changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/arch/arm/include/asm/dma-mapping.h 
> > b/arch/arm/include/asm/dma-mapping.h
> > index b52101d..166e1e1 100644
> > --- a/arch/arm/include/asm/dma-mapping.h
> > +++ b/arch/arm/include/asm/dma-mapping.h
> > @@ -151,18 +151,18 @@ static inline bool dma_capable(struct device *dev, 
> > dma_addr_t addr, size_t size)
> > u64 limit, mask;
> >  
> > if (!dev->dma_mask)
> > -   return 0;
> > +   return false;
> >  
> > mask = *dev->dma_mask;
> >  
> > limit = (mask + 1) & ~mask;
> > if (limit && size > limit)
> > -   return 0;
> > +   return false;
> >  
> > if ((addr | (addr + size - 1)) & ~mask)
> > -   return 0;
> > +   return false;
> >  
> > -   return 1;
> > +   return true;
> >  }
> >  
> >  static inline void dma_mark_clean(void *addr, size_t size) { }
> > diff --git a/arch/arm/include/asm/kvm_emulate.h 
> > b/arch/arm/include/asm/kvm_emulate.h
> > index a9c80a2..ad200a0 100644
> > --- a/arch/arm/include/asm/kvm_emulate.h
> > +++ b/arch/arm/include/asm/kvm_emulate.h
> > @@ -51,7 +51,7 @@ static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, 
> > unsigned long hcr)
> >  
> >  static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
> >  {
> > -   return 1;
> > +   return true;
> >  }
> >  
> >  static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
> > diff --git a/arch/arm/mach-omap2/powerdomain.c 
> > b/arch/arm/mach-omap2/powerdomain.c
> > index 78af6d8..897f9fb 100644
> > --- a/arch/arm/mach-omap2/powerdomain.c
> > +++ b/arch/arm/mach-omap2/powerdomain.c
> > @@ -950,7 +950,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
> >   */
> >  bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm)
> >  {
> > -   return (pwrdm && pwrdm->flags & PWRDM_HAS_HDWR_SAR) ? 1 : 0;
> > +   return pwrdm && (pwrdm->flags & PWRDM_HAS_HDWR_SAR);
> >  }
> >  
> >  int pwrdm_state_switch_nolock(struct powerdomain *pwrdm)
> > @@ -1185,24 +1185,24 @@ bool pwrdm_can_ever_lose_context(struct powerdomain 
> > *pwrdm)
> > if (!pwrdm) {
> > pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
> >  __func__);
> > -   return 1;
> > +   return true;
> > }
> >  
> > if (pwrdm->pwrsts & PWRSTS_OFF)
> > -   return 1;
> > +   return true;
> >  
> > if (pwrdm->pwrsts & PWRSTS_RET) {
> > if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
> > -   return 1;
> > +   return true;
> >  
> > for (i = 0; i < pwrdm->banks; i++)
> > if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
> > -   return 1;
> > +   return true;
> > }
> >  
> > for (i = 0; i < pwrdm->banks; i++)
> > if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
> > -   return 1;
> > +   return true;
> >  
> > -   return 0;
> > +   return false;
> >  }
> > 
> 
> Marc/Christoffer, please pick this up yourself.

Given that it touches a range of completely unrelated files, for the
KVM part:

Acked-by: Marc Zyngier 

M.
-- 
Jazz is not dead. It just smells funny.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next V3 00/23] ptp: get ready for 2038

2015-03-31 Thread David Miller
From: Richard Cochran 
Date: Sun, 29 Mar 2015 23:11:50 +0200

> This series converts the core driver methods of the PTP Hardware Clock
> (PHC) subsystem to use the 64 bit version of the timespec structure,
> making the core API ready for the year 2038.

Looks great, series applied, thanks Richard.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] kselftests: timers: Reduce default runtime on inconsistency-check and set-timer-lat

2015-03-31 Thread Shuah Khan
On 03/26/2015 10:20 AM, John Stultz wrote:
> On Thu, Mar 26, 2015 at 4:32 AM, Prarit Bhargava  wrote:
>> On 03/25/2015 07:44 PM, John Stultz wrote:
>>> For the default run_timers target, the timers tests takes the
>>> majority of kselftests runtime.
>>>
>>> So this patch reduces the default runtime for inconsistentcy-check
>>> and set-timer-lat, which reduced the runtime almost in half.
>>>
>>> Before:   11m48.629s
>>> After:6m47.723s
>>>
>>> Cc: Shuah Khan 
>>> Cc: Prarit Bhargava 
>>> Cc: Thomas Gleixner 
>>> Cc: Richard Cochran 
>>> Signed-off-by: John Stultz 
>>> Signed-off-by: John Stultz 

Same duplicate signature warning on this, no need to re-send.
I will fix it when I apply the patch.

-- Shuah
>>> ---
>>>  tools/testing/selftests/timers/inconsistency-check.c | 2 +-
>>>  tools/testing/selftests/timers/set-timer-lat.c   | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/timers/inconsistency-check.c 
>>> b/tools/testing/selftests/timers/inconsistency-check.c
>>> index 578e423a..caf1bc9 100644
>>> --- a/tools/testing/selftests/timers/inconsistency-check.c
>>> +++ b/tools/testing/selftests/timers/inconsistency-check.c
>>> @@ -166,7 +166,7 @@ int main(int argc, char *argv[])
>>>   int clockid, opt;
>>>   int userclock = CLOCK_REALTIME;
>>>   int maxclocks = NR_CLOCKIDS;
>>> - int runtime = 30;
>>> + int runtime = 10;
>>>   struct timespec ts;
>>>
>>
>> Oops ... left everyone off :)
>>
>> What was the reason that this was originally 30?  Or was that overkill?
> 
> So time inconsistencies (when they manifest, which ideally is never)
> can be fairly rare events. In the past we've seen them due to cpu TSC
> skew and drift, which requires enough scheduler noise to pop the
> process around between cores enough to notice, and enough system
> runtime for the TSCs to drift far enough apart.. Or we've had tiny
> accumulation bugs in update_wall_time which requires the right phase
> in the error accumulation to align with an irq. So the consistency
> test has always been a long running test (originally I'd run it
> overnight), and the 30sec interval here was added just so there was
> some "long enough" interval that wasn't too painful for me to test
> submitted patches with.  Now that more folks are using it (and they
> likely care less), we can cut it down further to avoid making test
> runs too onerous.
> 
> Now, a patch might badly break things and it would be immediately
> obvious to the test that something is wrong, so a quick check isn't
> worthless, but it just doesn't instill that much confidence from me.
> 
> I think as the kselftests grow, we'll have more "types" of test
> targets to run (quick, long, stress, etc), and we can scale the time
> in those tests accordingly. But the default should probably lean
> towards the short side.
> 

Right. I am working on adding support for quick, long etc. The goal
for quick (default) mode is to complete the test runs in 15-20 minutes
to make it easier for developers make it part of the work-flow.

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] phy: core: Add devm_of_phy_get_by_index to phy-core

2015-03-31 Thread Kishon Vijay Abraham I



On Friday 27 March 2015 04:37 AM, Dmitry Torokhov wrote:

On Wed, Mar 25, 2015 at 05:04:32PM -0700, Arun Ramamurthy wrote:



On 15-03-25 03:03 PM, Kishon Vijay Abraham I wrote:

Hi,

On Saturday 21 March 2015 02:59 AM, Arun Ramamurthy wrote:



On 15-03-20 02:26 PM, Dmitry Torokhov wrote:

Hi Arun,

On Fri, Mar 20, 2015 at 02:07:08PM -0700, Arun Ramamurthy wrote:

Adding devm_of_phy_get_by_index to get phys by supplying an index
and not a phy name when multiple phys are declared


I think a bit more explanation on why get_by_index is needed here.

Thanks Kison. Can you be more specific? I am unsure of what more I
can explain here.


We just need to mention that some generic drivers, such as ehci, may use
multiple phys, and for such drivers referencing phy(s) by name(s) does
not make sense. Instead of inventing elaborate naming schemes and
producing custom code to iterate over names, such drivers are better of
using nameless phy bindings and using this newly introduced API to
iterate through them.


+1

-Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] ahci: st: st_configure_oob must be called after IP is clocked.

2015-03-31 Thread Tejun Heo
On Tue, Mar 31, 2015 at 04:36:27PM +0100, Peter Griffin wrote:
> This patch (and also the DT documentation change) can go via your tree. Maxime
> will take the stih407 DT patch.

Hmmm... The first patch doesn't apply to libata/for-4.1?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2 0/5] ft1000 driver checkpatch.pl fixes

2015-03-31 Thread Greg Kroah-Hartman
A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Thu, Mar 26, 2015 at 08:16:14PM -0700, Janakarajan Natarajan wrote:
> I resent v2 because I didn't know if my previous patchset had been accepted or
> not.

Then it's really not a 'v2' patch series, is it :(

I suggest resending them in the proper format, if I haven't already
applied them...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/25] arm: Use bool function return values of true/false not 1/0

2015-03-31 Thread Paolo Bonzini
On 31/03/2015 01:45, Joe Perches wrote:
> Use the normal return values for bool functions
> 
> Signed-off-by: Joe Perches 
> ---
>  arch/arm/include/asm/dma-mapping.h |  8 
>  arch/arm/include/asm/kvm_emulate.h |  2 +-
>  arch/arm/mach-omap2/powerdomain.c  | 14 +++---
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/include/asm/dma-mapping.h 
> b/arch/arm/include/asm/dma-mapping.h
> index b52101d..166e1e1 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -151,18 +151,18 @@ static inline bool dma_capable(struct device *dev, 
> dma_addr_t addr, size_t size)
>   u64 limit, mask;
>  
>   if (!dev->dma_mask)
> - return 0;
> + return false;
>  
>   mask = *dev->dma_mask;
>  
>   limit = (mask + 1) & ~mask;
>   if (limit && size > limit)
> - return 0;
> + return false;
>  
>   if ((addr | (addr + size - 1)) & ~mask)
> - return 0;
> + return false;
>  
> - return 1;
> + return true;
>  }
>  
>  static inline void dma_mark_clean(void *addr, size_t size) { }
> diff --git a/arch/arm/include/asm/kvm_emulate.h 
> b/arch/arm/include/asm/kvm_emulate.h
> index a9c80a2..ad200a0 100644
> --- a/arch/arm/include/asm/kvm_emulate.h
> +++ b/arch/arm/include/asm/kvm_emulate.h
> @@ -51,7 +51,7 @@ static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, 
> unsigned long hcr)
>  
>  static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
>  {
> - return 1;
> + return true;
>  }
>  
>  static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
> diff --git a/arch/arm/mach-omap2/powerdomain.c 
> b/arch/arm/mach-omap2/powerdomain.c
> index 78af6d8..897f9fb 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -950,7 +950,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
>   */
>  bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm)
>  {
> - return (pwrdm && pwrdm->flags & PWRDM_HAS_HDWR_SAR) ? 1 : 0;
> + return pwrdm && (pwrdm->flags & PWRDM_HAS_HDWR_SAR);
>  }
>  
>  int pwrdm_state_switch_nolock(struct powerdomain *pwrdm)
> @@ -1185,24 +1185,24 @@ bool pwrdm_can_ever_lose_context(struct powerdomain 
> *pwrdm)
>   if (!pwrdm) {
>   pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
>__func__);
> - return 1;
> + return true;
>   }
>  
>   if (pwrdm->pwrsts & PWRSTS_OFF)
> - return 1;
> + return true;
>  
>   if (pwrdm->pwrsts & PWRSTS_RET) {
>   if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
> - return 1;
> + return true;
>  
>   for (i = 0; i < pwrdm->banks; i++)
>   if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
> - return 1;
> + return true;
>   }
>  
>   for (i = 0; i < pwrdm->banks; i++)
>   if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
> - return 1;
> + return true;
>  
> - return 0;
> + return false;
>  }
> 

Marc/Christoffer, please pick this up yourself.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH v4 3/3] vt: fix console lock vs. kernfs s_active lock order

2015-03-31 Thread Greg Kroah-Hartman
On Fri, Mar 27, 2015 at 08:46:57AM +0100, Daniel Vetter wrote:
> On Thu, Mar 26, 2015 at 11:05:45PM +0200, Imre Deak wrote:
> > On Thu, 2015-03-26 at 22:01 +0100, Greg Kroah-Hartman wrote:
> > > On Thu, Mar 26, 2015 at 12:59:05PM -0700, Jesse Barnes wrote:
> > > > On 12/16/2014 09:42 AM, Daniel Vetter wrote:
> > > > > On Tue, Dec 16, 2014 at 6:15 PM, Peter Hurley 
> > > > >  wrote:
> > > > >> On 12/16/2014 11:22 AM, Imre Deak wrote:
> > > > >>> On Tue, 2014-12-16 at 10:00 -0500, Peter Hurley wrote:
> > > >  Fine. Just another expedient fix piled on top of other expedient 
> > > >  fixes
> > > >  that go back past 3.9 with no end in sight.
> > > > >>>
> > > > >>> I'm also happy to look into narrowing down the scope of 
> > > > >>> console_lock in
> > > > >>> fbdev/fbcon as was suggested. But doing that as a follow-up to this
> > > > >>> change still makes sense to me since it will take more time and 
> > > > >>> have the
> > > > >>> risk of regressions that are not related to what this change fixes.
> > > > >>
> > > > >> I apologize for my tone. I'm not blaming you for the current 
> > > > >> situation,
> > > > >> nor is it your responsibility to go fix vt/fbcon/fbdev driver stack
> > > > >> inversion. I'm just trying to bring some awareness of the larger 
> > > > >> scope,
> > > > >> so that collectively we take action and resolve the underlying 
> > > > >> problems.
> > > > > 
> > > > > Yeah I guess I should tune down my NACK to a Grumpy-if-merged-by too.
> > > > > We have a lot of nonoptimal solutions at hand here :(
> > > > 
> > > > So where does that leave us with this fix?  Should we wait for someone
> > > > to come along and do all the rework?  Imre said he'd be willing to do
> > > > it, but still feels this fix makes sense
> > > > 
> > > > Or we could just abandon the fb layer altogether (my preference).  In
> > > > that case fixing this is fine, since we'll be able to ignore it for
> > > > configs that switch over to using !fbdev and kmscon.
> > > 
> > > I think I already merged the patches a while ago :)
> > 
> > Yes, but only the first two patches. This third one is not merged
> > AFAICS.
> 
> Yeah there was a big discussion in that one which eventualy resulted in my
> grumpy ack and my nack retracted. So fwiw
> 
> Reviewed-by: Daniel Vetter 

Can someone resend this patch?  It's long-gone from my patch queue.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH] x86: optimize IRET returns to kernel

2015-03-31 Thread Denys Vlasenko
On 03/31/2015 03:54 PM, Andy Lutomirski wrote:
> On Tue, Mar 31, 2015 at 5:46 AM, Denys Vlasenko  wrote:
>> This is not proposed to be merged yet.
>>
>> Andy, this patch is in spirit of your crazy ideas of repurposing
>> instructions for the roles they weren't intended for :)
>>
>> Recently I measured IRET timings and was newly "impressed"
>> how slow it is. 200+ cycles. So I started thinking...
>>
>> When we return from interrupt/exception *to kernel*,
>> most of IRET's doings are not necessary. CS and SS
>> do not need changing. And in many (most?) cases
>> saved RSP points right at the top of pt_regs,
>> or (top of pt_regs+8).
>>
>> In which case we can (ab)use POPF and RET!
>>
>> Please see the patch.
> 
> I have an old attempt at this here:
> 
> https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/commit/?h=fast-return-to-kernel=6cfe29821979c42cd812878e05577f69f99fafaf

Your version is better :/

I'd only suggests/pop %rsp/mov (%rsp),%rsp/

I suspect "pop %rsp" is not an easy insn for CPU to digest.

> If I were doing it again, I'd add a bit more care: if saved eflags
> have RF set (can kgdb do that?), then we have to use iret.

Good idea, we can even be paranoid and jump to real IRET if any
of "unusual" flags are set.

> I think that, if returning to IF=1, you need to do sti;ret to avoid an
> infinite stack usage failure in which, during an IRQ storm, each IRQ
> adds around one word of stack utilization because you haven't done the
> ret yet before the next IRQ comes in.  To make that robust, I'd adjust
> the NMI code to clear IF and back up one instruction if it interrupts
> after sti.

I kinda hoped POPF is secretly a shadowing insn too.
Experiments show it is not.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/25] arm: Use bool function return values of true/false not 1/0

2015-03-31 Thread Tony Lindgren
* Joe Perches  [150330 16:47]:
> Use the normal return values for bool functions
> 
> Signed-off-by: Joe Perches 

Acked-by: Tony Lindgren 

> ---
>  arch/arm/include/asm/dma-mapping.h |  8 
>  arch/arm/include/asm/kvm_emulate.h |  2 +-
>  arch/arm/mach-omap2/powerdomain.c  | 14 +++---
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/include/asm/dma-mapping.h 
> b/arch/arm/include/asm/dma-mapping.h
> index b52101d..166e1e1 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -151,18 +151,18 @@ static inline bool dma_capable(struct device *dev, 
> dma_addr_t addr, size_t size)
>   u64 limit, mask;
>  
>   if (!dev->dma_mask)
> - return 0;
> + return false;
>  
>   mask = *dev->dma_mask;
>  
>   limit = (mask + 1) & ~mask;
>   if (limit && size > limit)
> - return 0;
> + return false;
>  
>   if ((addr | (addr + size - 1)) & ~mask)
> - return 0;
> + return false;
>  
> - return 1;
> + return true;
>  }
>  
>  static inline void dma_mark_clean(void *addr, size_t size) { }
> diff --git a/arch/arm/include/asm/kvm_emulate.h 
> b/arch/arm/include/asm/kvm_emulate.h
> index a9c80a2..ad200a0 100644
> --- a/arch/arm/include/asm/kvm_emulate.h
> +++ b/arch/arm/include/asm/kvm_emulate.h
> @@ -51,7 +51,7 @@ static inline void vcpu_set_hcr(struct kvm_vcpu *vcpu, 
> unsigned long hcr)
>  
>  static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
>  {
> - return 1;
> + return true;
>  }
>  
>  static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
> diff --git a/arch/arm/mach-omap2/powerdomain.c 
> b/arch/arm/mach-omap2/powerdomain.c
> index 78af6d8..897f9fb 100644
> --- a/arch/arm/mach-omap2/powerdomain.c
> +++ b/arch/arm/mach-omap2/powerdomain.c
> @@ -950,7 +950,7 @@ int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
>   */
>  bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm)
>  {
> - return (pwrdm && pwrdm->flags & PWRDM_HAS_HDWR_SAR) ? 1 : 0;
> + return pwrdm && (pwrdm->flags & PWRDM_HAS_HDWR_SAR);
>  }
>  
>  int pwrdm_state_switch_nolock(struct powerdomain *pwrdm)
> @@ -1185,24 +1185,24 @@ bool pwrdm_can_ever_lose_context(struct powerdomain 
> *pwrdm)
>   if (!pwrdm) {
>   pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
>__func__);
> - return 1;
> + return true;
>   }
>  
>   if (pwrdm->pwrsts & PWRSTS_OFF)
> - return 1;
> + return true;
>  
>   if (pwrdm->pwrsts & PWRSTS_RET) {
>   if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
> - return 1;
> + return true;
>  
>   for (i = 0; i < pwrdm->banks; i++)
>   if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
> - return 1;
> + return true;
>   }
>  
>   for (i = 0; i < pwrdm->banks; i++)
>   if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
> - return 1;
> + return true;
>  
> - return 0;
> + return false;
>  }
> -- 
> 2.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: lustre: replace kzalloc with copy_from_user with memdup_user

2015-03-31 Thread gre...@linuxfoundation.org
On Tue, Mar 31, 2015 at 05:15:23PM +0200, Julia Lawall wrote:
> On Tue, 31 Mar 2015, Dhere, Chaitanya (C.) wrote:
> 
> > This patch replaces kzalloc and copy_from_user with memdup_user call
> > This change was detected with coccinelle tool
> >
> > Signed-off-by: Chaitanya Dhere 
> > ---
> >  drivers/staging/lustre/lustre/llite/file.c |   11 +++
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> > b/drivers/staging/lustre/lustre/llite/file.c
> > index 85e74d1..85b5567 100644
> > --- a/drivers/staging/lustre/lustre/llite/file.c
> > +++ b/drivers/staging/lustre/lustre/llite/file.c
> > @@ -2368,14 +2368,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, 
> > unsigned long arg)
> > struct hsm_state_set*hss;
> > int  rc;
> >
> > -   hss = kzalloc(sizeof(*hss), GFP_NOFS);
> > -   if (!hss)
> > -   return -ENOMEM;
> > -
> > -   if (copy_from_user(hss, (char *)arg, sizeof(*hss))) {
> > -   OBD_FREE_PTR(hss);
> > -   return -EFAULT;
> > -   }
> > +   hss = memdup_user((char *)arg, sizeof(*hss));
> 
> memdup_user will use the flag GFP_KERNEL, ie (__GFP_WAIT | __GFP_IO |
> __GFP_FS), rather than the flag GFP_NOFS, ie (__GFP_WAIT | __GFP_IO), that
> is specified.  I don't know if this is a problem here.

Yes, this is a filesystem, so this can't be changed, as we can't have
the allocation go out and ask for more filesystem accesses in the middle
of trying to do a filesystem access :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/9] perf sched replay: Alloc the memory of pid_to_task dynamically to adapt to the unexpected change of pid_max

2015-03-31 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 31, 2015 at 08:32:37AM -0600, David Ahern escreveu:
> On 3/31/15 7:46 AM, Yunlong Song wrote:
> >-BUG_ON(pid >= MAX_PID);
> >+if (sched->pid_to_task == NULL) {
> >+if (sysctl__read_int("kernel/pid_max", _max) < 0)
> >+pid_max = MAX_PID;
> >+BUG_ON((sched->pid_to_task = calloc(pid_max, sizeof(struct 
> >task_desc *))) == NULL);
> >+}
> >+BUG_ON(pid >= (unsigned long)pid_max);
 
> so why the previous patch bumping the MAX_PID count if you move to dynamic
> here? And shouldn't MAX_PID get dropped here as well?
 
> So attached is what i put together last week; just have not had time to send
> it out.

Yunlong, can you please check/Ack this?

- Arnaldo

> >From 159dc732e0ad66d9151e93761bc9c685872e9fa4 Mon Sep 17 00:00:00 2001
> From: David Ahern 
> Date: Tue, 24 Mar 2015 16:57:10 -0400
> Subject: [PATCH 3/5] perf sched: Remove max pid assumption from perf-sched
> 
> 'perf sched replay' currently fails on sparc64:
> $ perf sched replay
> run measurement overhead: 2475 nsecs
> sleep measurement overhead: 56165 nsecs
> the run test took 999705 nsecs
> the sleep test took 1059270 nsecs
> perf: builtin-sched.c:384: register_pid: Assertion `!(pid >= 65536)' 
> failed.
> Aborted
> 
> The max pid limitation is removed by converting pid_to_task from a
> pid based array to an intlist (rblist) with the pid as the index
> and task_desc stored in the priv element.
> 
> In the process pid is converted from a long int to int.
> 
> Signed-off-by: David Ahern 
> ---
>  tools/perf/builtin-sched.c | 30 --
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index cc52c993a1fa..858d85396d81 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -33,13 +33,12 @@
>  #define MAX_CPUS 4096
>  #define COMM_LEN 20
>  #define SYM_LEN  129
> -#define MAX_PID  65536
>  
>  struct sched_atom;
>  
>  struct task_desc {
>   unsigned long   nr;
> - unsigned long   pid;
> + int pid;
>   charcomm[COMM_LEN];
>  
>   unsigned long   nr_events;
> @@ -129,7 +128,7 @@ struct perf_sched {
>   struct perf_tool tool;
>   const char   *sort_order;
>   unsigned longnr_tasks;
> - struct task_desc *pid_to_task[MAX_PID];
> + struct intlist   *pid_to_task;
>   struct task_desc **tasks;
>   const struct trace_sched_handler *tp_handler;
>   pthread_mutex_t  start_work_mutex;
> @@ -377,14 +376,18 @@ static void add_sched_event_sleep(struct perf_sched 
> *sched, struct task_desc *ta
>  }
>  
>  static struct task_desc *register_pid(struct perf_sched *sched,
> -   unsigned long pid, const char *comm)
> +   int pid, const char *comm)
>  {
> - struct task_desc *task;
>  
> - BUG_ON(pid >= MAX_PID);
> + struct int_node *node = intlist__findnew(sched->pid_to_task, pid);
> + struct task_desc *task;
>  
> - task = sched->pid_to_task[pid];
> + if (node == NULL) {
> + pr_err("Failed to allocate entry for task\n");
> + return NULL;
> + }
>  
> + task = (struct task_desc *) node->priv;
>   if (task)
>   return task;
>  
> @@ -392,20 +395,21 @@ static struct task_desc *register_pid(struct perf_sched 
> *sched,
>   task->pid = pid;
>   task->nr = sched->nr_tasks;
>   strcpy(task->comm, comm);
> +
>   /*
>* every task starts in sleeping state - this gets ignored
>* if there's no wakeup pointing to this sleep state:
>*/
>   add_sched_event_sleep(sched, task, 0, 0);
>  
> - sched->pid_to_task[pid] = task;
> + node->priv = task;
>   sched->nr_tasks++;
>   sched->tasks = realloc(sched->tasks, sched->nr_tasks * sizeof(struct 
> task_task *));
>   BUG_ON(!sched->tasks);
>   sched->tasks[task->nr] = task;
>  
>   if (verbose)
> - printf("registered task #%ld, PID %ld (%s)\n", sched->nr_tasks, 
> pid, comm);
> + printf("registered task #%ld, PID %d (%s)\n", sched->nr_tasks, 
> pid, comm);
>  
>   return task;
>  }
> @@ -418,7 +422,7 @@ static void print_task_traces(struct perf_sched *sched)
>  
>   for (i = 0; i < sched->nr_tasks; i++) {
>   task = sched->tasks[i];
> - printf("task %6ld (%20s:%10ld), nr_events: %ld\n",
> + printf("task %6ld (%20s:%10d), nr_events: %ld\n",
>   task->nr, task->comm, task->pid, task->nr_events);
>   }
>  }
> @@ -2981,6 +2985,12 @@ int cmd_sched(int argc, const char **argv, const char 
> *prefix __maybe_unused)
>   };
>   unsigned int i;
>  
> + sched.pid_to_task = intlist__new(NULL);
> + if (sched.pid_to_task == NULL) {
> +  

Re: [PATCH v2 1/6] phy: miphy365x: Use the generic phy type constants in dt-bindings/phy/phy.h

2015-03-31 Thread Maxime Coquelin

Hi Kishon,

On 03/31/2015 05:30 PM, Kishon Vijay Abraham I wrote:

Maxime,

On Tuesday 31 March 2015 01:10 PM, Lee Jones wrote:

On Tue, 31 Mar 2015, Kishon Vijay Abraham I wrote:


Hi Patrice, Maxime,

On Monday 30 March 2015 08:47 PM, Peter Griffin wrote:
Now there are generic phy type constants declared in phy.h, migrate 
over to
using them rather than defining our own. This change has been done 
as one

atomic commit to be bisectable.

Note: The values of the defines are the same, so there is no ABI 
breakage

with this patch.

Signed-off-by: Peter Griffin 
Acked-by: Rob Herring 
Acked-by: Lee Jones 


Are you okay for this patch to go via PHY tree? It modifies 
arch/arm/boot/dts

/stih416.dtsi.


These files need to be changed simultaneously in order to prevent
breakage during bisection and the like.  I think the best bet moving
forward is to pull this into its own branch, tag it and send Maxime a
pull-request to the immutable branch.  It's the best way to minimise
merge conflicts during the v4.1 merge window.


okay. I still need an Ack from Maxime.


You have my Ack.

I haven't sent a pull request for STi DT files for v4.1 now, and it is 
too late to send one.
So creating an immutable tag is not even needed in my opinion, you can 
just take the DT patch.


Thanks,
Maxime



Thanks
Kishon


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] perf tool: Refactor comm/tgid lookup

2015-03-31 Thread Arnaldo Carvalho de Melo
Em Tue, Mar 31, 2015 at 04:35:46PM +0200, Jiri Olsa escreveu:
> On Mon, Mar 30, 2015 at 02:35:57PM -0600, David Ahern wrote:
> > Rather than parsing /proc/pid/status file one line at a time, read
> > it into a buffer in one shot and search for all strings in one pass.
> > 
> > tgid conversion also simplified -- removing the isspace walk. As
> > noted by Arnaldo those are not needed for atoi == strtol calls.
> > 
> > Signed-off-by: David Ahern 
> > Cc: Don Zickus 
> > Cc: Joe Mario 
> > Cc: Jiri Olsa 
> 
> Acked-by: Jiri Olsa 

Thanks, applied both, with Jiri's acks.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] x86: Factor out common CPU initialization code

2015-03-31 Thread Ingo Molnar

* Boris Ostrovsky  wrote:

> Some of x86 bare-metal and Xen CPU initialization code is common between the 
> two
> and therefore can be factored out to avoid code duplication.
> 
> As a side effect, doing so will also extend the fix provided by commit
> a7fcf28d431e ("x86/asm/entry: Replace this_cpu_sp0() with 
> current_top_of_stack()
> to x86_32") to 32-bit Xen PV guests.
> 
> Signed-off-by: Boris Ostrovsky 
> ---
>  arch/x86/include/asm/smp.h |  1 +
>  arch/x86/kernel/smpboot.c  | 39 +++
>  arch/x86/xen/smp.c | 14 +-
>  3 files changed, 25 insertions(+), 29 deletions(-)

This does not apply to the latest x86 tree (tip:master).

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_WAKE_ALARM

2015-03-31 Thread Shuah Khan
Hi John,

I am seeing checkpatch warnings on this patch. See below.

On 03/26/2015 05:31 AM, Prarit Bhargava wrote:
> 
> 
> On 03/25/2015 07:44 PM, John Stultz wrote:
>> The set-timer-lat test fails when testing CLOCK_BOOTTIME_ALARM
>> or CLOCK_REALTIME_ALARM when the user isn't running as root or
>> with CAP_WAKE_ALARM.
>>
>> So this patch improves the error checking so we report the
>> issue more clearly and continue rather then reporting a failure.
>>
>> Cc: Shuah Khan 
>> Cc: Prarit Bhargava 
>> Cc: Thomas Gleixner 
>> Cc: Richard Cochran 
>> Signed-off-by: John Stultz 
>> Signed-off-by: John Stultz 

WARNING: Duplicate signature
#115:
Signed-off-by: John Stultz 

>> ---
>>  tools/testing/selftests/timers/set-timer-lat.c | 7 +++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/tools/testing/selftests/timers/set-timer-lat.c 
>> b/tools/testing/selftests/timers/set-timer-lat.c
>> index 3ea2eff..dbc9537c 100644
>> --- a/tools/testing/selftests/timers/set-timer-lat.c
>> +++ b/tools/testing/selftests/timers/set-timer-lat.c
>> @@ -139,6 +139,13 @@ int do_timer(int clock_id, int flags)
>>  
>>  err = timer_create(clock_id, , );
>>  if (err) {
>> +if ((clock_id == CLOCK_REALTIME_ALARM)
>> +|| (clock_id == CLOCK_BOOTTIME_ALARM)) {
> 
> I dunno of there is actually a CodingStyle rule for this, but I've always seen
> this written with the operator on the first line:

Yes it would be good to fix this one as well when you re-do the patch.


> 
>   if ((clock_id == CLOCK_REALTIME_ALARM) ||
> (clock_id == CLOCK_BOOTTIME_ALARM)) {
> 
>> +printf("%-22s %s missing CAP_WAKE_ALARM?: 
>> [UNSUPPORTED]\n",
>> +clockstring(clock_id),
>> +flags ? "ABSTIME":"RELTIME");
> 

WARNING: line over 80 characters
#130: FILE: tools/testing/selftests/timers/set-timer-lat.c:144:
+   printf("%-22s %s missing CAP_WAKE_ALARM?: 
[UNSUPPORTED]\n",

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] x86/asm/entry/64: simplifications

2015-03-31 Thread Ingo Molnar

* Denys Vlasenko  wrote:

> This patchset simplifies jump maze in entry_64.S a bit by moving
> "retint_kernel" code block, and follows up with simplifications
> which become obvious after the move.

So I got conflicts with latest tip:master with 3 of the 5 patches, so 
I probably missed one of your older patches.

I pushed out the other two - mind merging all your pending patches on 
top of latest tip:master and sending out all of them as a single 
series, so that I can pick up all the uncontroversial bits?

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv4 20/24] mm, thp: remove compound_lock

2015-03-31 Thread Aneesh Kumar K.V




  static void put_compound_page(struct page *page)
>  {
>   struct page *page_head;
> - unsigned long flags;
>
>   if (likely(!PageTail(page))) {
>   if (put_page_testzero(page)) {
> @@ -108,58 +101,33 @@ static void put_compound_page(struct page *page)
>   /* __split_huge_page_refcount can run under us */
>   page_head = compound_head(page);
>
> - if (!compound_lock_needed(page_head)) {
> - /*
> -  * If "page" is a THP tail, we must read the tail page flags
> -  * after the head page flags. The split_huge_page side enforces
> -  * write memory barriers between clearing PageTail and before
> -  * the head page can be freed and reallocated.
> -  */
> - smp_rmb();
> - if (likely(PageTail(page))) {
> - /* __split_huge_page_refcount cannot race here. */
> - VM_BUG_ON_PAGE(!PageHead(page_head), page_head);
> - VM_BUG_ON_PAGE(page_mapcount(page) != 0, page);
> - if (put_page_testzero(page_head)) {
> - /*
> -  * If this is the tail of a slab compound page,
> -  * the tail pin must not be the last reference
> -  * held on the page, because the PG_slab cannot
> -  * be cleared before all tail pins (which skips
> -  * the _mapcount tail refcounting) have been
> -  * released. For hugetlbfs the tail pin may be
> -  * the last reference on the page instead,
> -  * because PageHeadHuge will not go away until
> -  * the compound page enters the buddy
> -  * allocator.
> -  */
> - VM_BUG_ON_PAGE(PageSlab(page_head), page_head);
> - __put_compound_page(page_head);
> - }
> - } else if (put_page_testzero(page))
> - __put_single_page(page);
> - return;
> - }
> -
> - flags = compound_lock_irqsave(page_head);
> - /* here __split_huge_page_refcount won't run anymore */
> - if (likely(page != page_head && PageTail(page))) {
> - bool free;
> -
> - free = put_page_testzero(page_head);
> - compound_unlock_irqrestore(page_head, flags);
> - if (free) {
> - if (PageHead(page_head))
> - __put_compound_page(page_head);
> - else
> - __put_single_page(page_head);
> + /*
> +  * If "page" is a THP tail, we must read the tail page flags after the
> +  * head page flags. The split_huge_page side enforces write memory
> +  * barriers between clearing PageTail and before the head page can be
> +  * freed and reallocated.
> +  */
> + smp_rmb();
> + if (likely(PageTail(page))) {
> + /* __split_huge_page_refcount cannot race here. */
> + VM_BUG_ON_PAGE(!PageHead(page_head), page_head);
> + if (put_page_testzero(page_head)) {
> + /*
> +  * If this is the tail of a slab compound page, the
> +  * tail pin must not be the last reference held on the
> +  * page, because the PG_slab cannot be cleared before
> +  * all tail pins (which skips the _mapcount tail
> +  * refcounting) have been released. For hugetlbfs the
> +  * tail pin may be the last reference on the page
> +  * instead, because PageHeadHuge will not go away until
> +  * the compound page enters the buddy allocator.
> +  */
> + VM_BUG_ON_PAGE(PageSlab(page_head), page_head);
> + __put_compound_page(page_head);
>   }


The comment may need an update ? For THP also a tail pin may be the last
reference on the page right ?


> - } else {
> - compound_unlock_irqrestore(page_head, flags);
> - VM_BUG_ON_PAGE(PageTail(page), page);
> - if (put_page_testzero(page))
> - __put_single_page(page);
> - }
> + } else if (put_page_testzero(page))
> + __put_single_page(page);
> + return;
>  }
>
>  void put_page(struct page *page)
> @@ -178,42 +146,29 @@ EXPORT_SYMBOL(put_page);
>  void __get_page_tail(struct page *page)
>  {
>   struct page *page_head = compound_head(page);

.


> + smp_rmb();
> + if (likely(PageTail(page))) {
> + /*
> +  * This is a hugetlbfs page or a slab page.
> +  * __split_huge_page_refcount cannot race here.

Re: [BUG] perf script segfault

2015-03-31 Thread Jiri Olsa
On Tue, Mar 31, 2015 at 05:48:44PM +0200, Jiri Olsa wrote:
> On Tue, Mar 31, 2015 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:
> 
> SNIP
> 
> > struct ordered_events *oe = >ordered_events;
> > -   struct perf_tool *tool = oe->tool;
> > +   struct perf_tool *tool = session->tool;
> > int fd = perf_data_file__fd(session->file);
> > u64 head, page_offset, file_offset, file_pos, size;
> > int err, mmap_prot, mmap_flags, map_idx = 0;
> > @@ -1394,6 +1407,7 @@ out:
> >  out_err:
> > ui_progress__finish();
> > perf_tool__warn_about_errors(tool, >evlist->stats);
> > +   ordered_events__warn_about_errors(>ordered_events);
> 
> how about just single warning function ?
> 
>   perf_session__warn_about_errors(struct perf_session *session)
> 
> session has now both tool and ordered_events

other than this it looks ok to me

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 01/11] clocksource: arm_arch_timer: Rename arch_timer_probed to reflect behaviour

2015-03-31 Thread Ingo Molnar

* Laurent Pinchart  wrote:

> Hi Ingo,
> 
> On Tuesday 31 March 2015 09:14:52 Ingo Molnar wrote:
> > * Daniel Lezcano  wrote:
> > > From: Laurent Pinchart 
> > > 
> > > The arch_timer_probed function returns whether the given time doesn't
> > > need to be probed. This can be the case when the timer has been probed
> > > already, but also when it has no corresponding enabled node in DT.
> > > 
> > > Rename the function to arch_timer_need_probe and invert its return value
> > > to better reflect the function's purpose and behaviour.
> > > 
> > > Acked-by: Sudeep Holla 
> > > Signed-off-by: Laurent Pinchart
> > > 
> > > Signed-off-by: Daniel Lezcano 
> > > ---
> > > 
> > >  drivers/clocksource/arm_arch_timer.c | 13 +++--
> > >  1 file changed, 7 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/clocksource/arm_arch_timer.c
> > > b/drivers/clocksource/arm_arch_timer.c index a3025e7..50bb7f2 100644
> > > --- a/drivers/clocksource/arm_arch_timer.c
> > > +++ b/drivers/clocksource/arm_arch_timer.c
> > > @@ -661,17 +661,17 @@ static const struct of_device_id
> > > arch_timer_mem_of_match[] __initconst = {> 
> > >  };
> > >  
> > >  static bool __init
> > > 
> > > -arch_timer_probed(int type, const struct of_device_id *matches)
> > > +arch_timer_need_probe(int type, const struct of_device_id *matches)
> > 
> > If we do a rename we might as well use valid English spelling such as
> > 'arch_timer_needs_probing()'?
> 
> Of course. Should I resend the patch or can you fix that while applying it ?

No need to resend, I've done the rename in the patch.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] perf script segfault

2015-03-31 Thread Jiri Olsa
On Tue, Mar 31, 2015 at 11:57:39AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

>   struct ordered_events *oe = >ordered_events;
> - struct perf_tool *tool = oe->tool;
> + struct perf_tool *tool = session->tool;
>   int fd = perf_data_file__fd(session->file);
>   u64 head, page_offset, file_offset, file_pos, size;
>   int err, mmap_prot, mmap_flags, map_idx = 0;
> @@ -1394,6 +1407,7 @@ out:
>  out_err:
>   ui_progress__finish();
>   perf_tool__warn_about_errors(tool, >evlist->stats);
> + ordered_events__warn_about_errors(>ordered_events);

how about just single warning function ?

  perf_session__warn_about_errors(struct perf_session *session)

session has now both tool and ordered_events

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] phy: driver for Conexant Digicolor internal USB PHY

2015-03-31 Thread Kishon Vijay Abraham I

Hi,

On Tuesday 31 March 2015 09:11 PM, Baruch Siach wrote:

Hi Kishon,

On Tue, Mar 31, 2015 at 08:56:54PM +0530, Kishon Vijay Abraham I wrote:

On Tuesday 31 March 2015 05:04 PM, Baruch Siach wrote:

On Sat, Mar 28, 2015 at 04:33:02PM +0100, Marek Vasut wrote:

On Friday, March 27, 2015 at 05:36:29 AM, Baruch Siach wrote:

Add a driver for the USB PHY on the Conexant CX92755 SoC, from the
Digicolor series of SoCs. The PHY is connected to the on-chip chipidea
usb2 host.

The hardware is somewhat similar to the phy-mxs-usb.c usb_phy, but it is
different enough to merit its own driver. Also, this driver uses the
generic phy infrastructure.


the register set looks very similar to MXS one indeed. How is it different
please ?


Almost of the bits that are defined in the MXS USBPHY_CTRL register are not
defined in the Digicolor one. Some have different meaning, and some are
reserved. OTOH, the Digicolor USBPHY_CTRL register uses all bits in the 1-13
range. Also, the Digicolor phy does not have anatop registers.


I think we should try adding support for this in the same driver.


The only code that can actually be shared between the driver is the two lines
usb_phy .on_connect callback routine. The init sequence that takes most of the
digicolor driver is totally different. Using a single driver for both PHYs
does not make much sense, IMHO.

Besides, phy-mxs-usb.c uses the deprecated usb_phy framework. So we first need
to port this driver to the generic phy framework.


Doesn't your driver also use the usb_phy framework?

-Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] dt: paz00: define nvec as child of i2c bus

2015-03-31 Thread Andrey Danin

On 31.03.2015 17:09, Stephen Warren wrote:

On 03/31/2015 12:40 AM, Andrey Danin wrote:

Hi,

Thanks for the review.

On 03.02.2015 0:20, Stephen Warren wrote:

On 01/29/2015 12:20 AM, Andrey Danin wrote:

NVEC driver was reimplemented to use tegra i2c. Use common i2c bindings
for NVEC node.



diff --git a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt


The changes to this file make more sense either as a standalone patch
1/4, or as part of the driver changes.


@@ -2,20 +2,5 @@ NVIDIA compliant embedded controller

  Required properties:
  - compatible : should be "nvidia,nvec".
-- reg : the iomem of the i2c slave controller
-- interrupts : the interrupt line of the i2c slave controller
-- clock-frequency : the frequency of the i2c bus
-- gpios : the gpio used for ec request
-- slave-addr: the i2c address of the slave controller
-- clocks : Must contain an entry for each entry in clock-names.
-  See ../clocks/clock-bindings.txt for details.
-- clock-names : Must include the following entries:
-  Tegra20/Tegra30:
-  - div-clk
-  - fast-clk
-  Tegra114:
-  - div-clk
-- resets : Must contain an entry for each entry in reset-names.
-  See ../reset/reset.txt for details.
-- reset-names : Must include the following entries:
-  - i2c
+- request-gpios : the gpio used for ec request
+- reg: the i2c address of the slave controller


This change breaks ABI.

Instead of modifying the definition of the existing compatible value, I
think you should introduce a new compatible value to describe the
external NVEC chip.


I changed compatible value to nvec-slave in v2.



diff --git a/arch/arm/boot/dts/tegra20-paz00.dts
b/arch/arm/boot/dts/tegra20-paz00.dts



-nvec@7000c500 {
-compatible = "nvidia,nvec";
-reg = <0x7000c500 0x100>;
-interrupts = ;
-#address-cells = <1>;
-#size-cells = <0>;
+i2c@7000c500 {
+status = "okay";
  clock-frequency = <8>;
-request-gpios = < TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
-slave-addr = <138>;
-clocks = <_car TEGRA20_CLK_I2C3>,
- <_car TEGRA20_CLK_PLL_P_OUT3>;
-clock-names = "div-clk", "fast-clk";
-resets = <_car 67>;
-reset-names = "i2c";
+
+nvec: nvec@45 {


This doesn't feel correct. There's nothing here to indicate that this
child device is a slave that is implemented by the host SoC rather than
something external attached to the I2C bus.

Perhaps you can get away with this, since the driver for nvidia,nvec
only calls I2C APIs suitable for internal slaves rather than external
slaves? Even so though, I think the distinction needs to be clearly
marked in the DT so that any generic code outside the NVEC driver that
parses the DT can determine the difference.

I would recommend the I2C controller having #address-cells=<2> with cell
0 being 0==master,1==slave, cell 1 being the I2C address. The I2C driver
would need to support #address-cells=<1> for backwards-compatibility.


Driver (nvec in this case) can decide what mode should it use according
to compatible value. Is it not enough ?


No, I don't think so.

The I2C binding model is that each child of an I2C controller represents
a device attached to the bus. which SW will communicate with using the
I2C controller as master and the device as a slave. If there's no
explicit representation of child-vs-slave in the DT, how does the I2C
core know whether a particular node is intended to be accessed as a
master or slave?


Device driver registers itself via slave API. Bus driver calls 
appropriate callback function when needed.
If device driver decides to access hardware via master API, then it can 
do it.


Am I missing something ?



In other words, without an explicit "communicate with this device" or
"implement this device as a slave" flag, how could DT contain:

i2c-controller {
 ...
 master@1a {
 compatible = "foo,device";
 reg = <0x1a 1>;
 };
 slave@1a {
 compatible = "foo,device-slave";
 reg = <0x1a 1>;
 };
};

where:

- "foo,device" means: instantiate a driver to communicate with a device
of this type.

- "foo,device-slave" means: instantiate a driver to act as this I2C device.

Sure it's possible for the drivers for those two nodes to simply use the
I2C subsystem's master or slave APIs, but I suspect DT content would
confuse the I2C core into thinking that two I2C devices with the same
address had been represented in DT, and the I2C core would refuse to
instantiate one of them. The solution here is for the reg value to
encode a "master" vs. "slave" flag, so the I2C core can allow both a
master and a slave for each address.


If there is one device, then it must be one node. If there is two 
devices then it looks incorrect to me to have two devices with the same 
address. Does I2C allow two devices with same address ?


I can imagine this:
- we have hardware with I2C device. This 

Re: [PATCH v3 6/7] dmaengine: omap-dma: Remove mapping between virtual channels and requests

2015-03-31 Thread Peter Ujfalusi
On 03/27/2015 10:22 PM, Russell King - ARM Linux wrote:
> On Fri, Mar 27, 2015 at 02:26:52PM +0200, Peter Ujfalusi wrote:
>> Do not direct map the virtual channels to sDMA request number. When the
>> sDMA is behind of a crossbar this direct mapping can cause situations when
>> certain channel can not be requested since the crossbar request number
>> will no longer match with the sDMA request line.
>> The direct mapping for virtual channels with HW request lines will make it
>> harder to implement MEM_TO_MEM mode for the driver.
> 
> There's no point having 127 virtual DMA channels then... is there?
> We might as well reduce the number down to a more reasonable set
> rather than wasting memory.

I was also come to the same conclusion. My plan was to change the virtual DMA
channels to the same as the sDMA's logical channels.

>> @@ -1049,7 +1050,6 @@ static int omap_dma_chan_init(struct omap_dmadev *od, 
>> int dma_sig)
>>  return -ENOMEM;
>>  
>>  c->reg_map = od->reg_map;
>> -c->dma_sig = dma_sig;
> 
> That's the only user of dma_sig in this function.  Why not remove it from
> the function prototype and its caller?
> 


-- 
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Linux-nvdimm] [PATCH 4/6] SQUSHME: pmem: Micro cleaning

2015-03-31 Thread Boaz Harrosh
On 03/31/2015 06:30 PM, Dan Williams wrote:
> On Tue, Mar 31, 2015 at 8:24 AM, Boaz Harrosh  wrote:
>> On 03/31/2015 06:17 PM, Dan Williams wrote:
>>> On Tue, Mar 31, 2015 at 6:27 AM, Boaz Harrosh  wrote:

 Some error checks had unlikely some did not. Put unlikely
 on all error handling paths.
 (I like unlikely for error paths specially for readability)
>>>
>>> "unlikely()" is not a readability hint, it's specifically for branches
>>> that profiling shows adding it makes a difference.  Just delete them
>>> all until profiling show they make a difference.  They certainly don't
>>> make a difference in the slow paths.
>>>
>>
>> Why?
> 
> Because the compiler and cpu already does a decent job, and if you get
> the frequency wrong it can hurt performance [1].
> 
> It's pre-mature optimization to sprinkle them around, especially in slow 
> paths.
> 
> [1]: https://lwn.net/Articles/420019/
> 

Sigh! It looks like a holy war. Again all that was said at above thread was 
about
statistical prediction yes-or-no. And I agree with all the use cases.

But not here. This is not an optimization this is the *error path*.
What I'm saying is:
"No compiler nor CPU, even if 99% of the time this branch is taken
 I still consider it cold. Because it is the error case and
 I do not care for it"

And no I did not get it wrong. All these places are "error paths" that I do not
care for.

If any of these places are dependent on some input or code variable then yes
let the smarts do it. But never in the "error path".

That said. the patch is up for grabs. I like it ...

Thanks
Boaz

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] nohz,blk-mq: do not create blk-mq workqueues on nohz dedicated CPUs

2015-03-31 Thread Jens Axboe

On 03/31/2015 09:33 AM, Frederic Weisbecker wrote:

On Tue, Mar 31, 2015 at 09:07:11AM -0600, Jens Axboe wrote:

On 03/31/2015 08:27 AM, Rik van Riel wrote:

CPUs with nohz_full do not want disruption from timer interrupts,
or other random system things.  This includes block mq work.

There is another issue with block mq vs. realtime tasks that run
100% of the time, which is not uncommon on systems that have CPUs
dedicated to real time use with isolcpus= and nohz_full=

Specifically, on systems like that, a block work item may never
get to run, which could lead to filesystems getting stuck forever.

We can avoid both issues by not scheduling blk-mq workqueues on
cpus in nohz_full mode.

Question for Jens: should we try to spread out the load for
currently offline and nohz CPUs across the remaining CPUs in
the system, to get the full benefit of blk-mq in these situations?

If so, do you have any preference on how I should implement that?

Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Jens Axboe 
Signed-off-by: Rik van Riel 
---
  block/blk-mq.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4f4bea21052e..1004d6817fa4 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -21,6 +21,7 @@
  #include 
  #include 
  #include 
+#include 

  #include 

@@ -1760,6 +1761,10 @@ static void blk_mq_init_cpu_queues(struct request_queue 
*q,
if (!cpu_online(i))
continue;

+   /* Do not schedule work on nohz full dedicated CPUs. */
+   if (tick_nohz_full_cpu(i))
+   continue;


Is this CPU ever going to queue IO? If yes, then it needs to be mapped. If
userspace never runs on it and submits IO, then we'll never run completions
on it nor schedule the associated workqueue. So I really don't see how it
doesn't already work, as-is.


Well, it's fairly possible that full dynticks CPUs do IO of any sort. Is it 
possible
to affine these asynchronous works to specific CPU? The usual scheme of full 
dynticks
is to have CPU 0 handling any kind of housekeeping and other CPUs doing latency 
or performance
sensitive works that don't want to be disturbed.


That'd be easy enough to do, that's how blk-mq handles offline CPUs as 
well. The attached patch is completely untested, but will handle offline 
or nohz CPUs in the same fashion - they will punt to hardware queue 0, 
which is mapped to CPU0 (and others, depending on the queue vs CPU ratio).


--
Jens Axboe

diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 5f13f4d0bcce..9cb20d14c6b9 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -51,7 +51,10 @@ int blk_mq_update_queue_map(unsigned int *map, unsigned int nr_queues)
 
 	queue = 0;
 	for_each_possible_cpu(i) {
-		if (!cpu_online(i)) {
+		/*
+		 * Offline or full nohz CPUs get mapped to CPU0
+		 */
+		if (blk_mq_cpu_offline(i)) {
 			map[i] = 0;
 			continue;
 		}
diff --git a/block/blk-mq.c b/block/blk-mq.c
index b7b8933ec241..ec0de2871950 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -366,7 +366,7 @@ static void blk_mq_ipi_complete_request(struct request *rq)
 	if (!test_bit(QUEUE_FLAG_SAME_FORCE, >q->queue_flags))
 		shared = cpus_share_cache(cpu, ctx->cpu);
 
-	if (cpu != ctx->cpu && !shared && cpu_online(ctx->cpu)) {
+	if (cpu != ctx->cpu && !shared && !blk_mq_cpu_offline(ctx->cpu)) {
 		rq->csd.func = __blk_mq_complete_request_remote;
 		rq->csd.info = rq;
 		rq->csd.flags = 0;
@@ -1022,7 +1022,7 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,
 	struct blk_mq_ctx *ctx = rq->mq_ctx, *current_ctx;
 
 	current_ctx = blk_mq_get_ctx(q);
-	if (!cpu_online(ctx->cpu))
+	if (blk_mq_cpu_offline(ctx->cpu))
 		rq->mq_ctx = ctx = current_ctx;
 
 	hctx = q->mq_ops->map_queue(q, ctx->cpu);
@@ -1051,7 +1051,7 @@ static void blk_mq_insert_requests(struct request_queue *q,
 
 	current_ctx = blk_mq_get_ctx(q);
 
-	if (!cpu_online(ctx->cpu))
+	if (blk_mq_cpu_offline(ctx->cpu))
 		ctx = current_ctx;
 	hctx = q->mq_ops->map_queue(q, ctx->cpu);
 
@@ -1757,7 +1757,7 @@ static void blk_mq_init_cpu_queues(struct request_queue *q,
 		__ctx->queue = q;
 
 		/* If the cpu isn't online, the cpu is mapped to first hctx */
-		if (!cpu_online(i))
+		if (blk_mq_cpu_offline(i))
 			continue;
 
 		hctx = q->mq_ops->map_queue(q, i);
@@ -1789,7 +1789,7 @@ static void blk_mq_map_swqueue(struct request_queue *q)
 	 */
 	queue_for_each_ctx(q, ctx, i) {
 		/* If the cpu isn't online, the cpu is mapped to first hctx */
-		if (!cpu_online(i))
+		if (blk_mq_cpu_offline(i))
 			continue;
 
 		hctx = q->mq_ops->map_queue(q, i);
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 6a48c4c0d8a2..443dc8e0ea24 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -1,6 +1,8 @@
 #ifndef INT_BLK_MQ_H
 #define INT_BLK_MQ_H
 
+#include 
+
 struct blk_mq_tag_set;
 
 struct blk_mq_ctx {
@@ -123,4 +125,13 @@ static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx)
 	return 

Re: [PATCH 2/2] phy: driver for Conexant Digicolor internal USB PHY

2015-03-31 Thread Baruch Siach
Hi Kishon,

On Tue, Mar 31, 2015 at 08:56:54PM +0530, Kishon Vijay Abraham I wrote:
> On Tuesday 31 March 2015 05:04 PM, Baruch Siach wrote:
> >On Sat, Mar 28, 2015 at 04:33:02PM +0100, Marek Vasut wrote:
> >>On Friday, March 27, 2015 at 05:36:29 AM, Baruch Siach wrote:
> >>>Add a driver for the USB PHY on the Conexant CX92755 SoC, from the
> >>>Digicolor series of SoCs. The PHY is connected to the on-chip chipidea
> >>>usb2 host.
> >>>
> >>>The hardware is somewhat similar to the phy-mxs-usb.c usb_phy, but it is
> >>>different enough to merit its own driver. Also, this driver uses the
> >>>generic phy infrastructure.
> >>
> >>the register set looks very similar to MXS one indeed. How is it different
> >>please ?
> >
> >Almost of the bits that are defined in the MXS USBPHY_CTRL register are not
> >defined in the Digicolor one. Some have different meaning, and some are
> >reserved. OTOH, the Digicolor USBPHY_CTRL register uses all bits in the 1-13
> >range. Also, the Digicolor phy does not have anatop registers.
> 
> I think we should try adding support for this in the same driver.

The only code that can actually be shared between the driver is the two lines 
usb_phy .on_connect callback routine. The init sequence that takes most of the 
digicolor driver is totally different. Using a single driver for both PHYs 
does not make much sense, IMHO.

Besides, phy-mxs-usb.c uses the deprecated usb_phy framework. So we first need 
to port this driver to the generic phy framework.

baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] ahci: st: st_configure_oob must be called after IP is clocked.

2015-03-31 Thread Peter Griffin
Hi Tejun,

On Tue, 31 Mar 2015, Tejun Heo wrote:

> On Tue, Mar 31, 2015 at 08:35:09AM +0100, Peter Griffin wrote:
> > Currently the ahci_st driver will hang the system on probe, as the
> > st_configure_oob function does some register writes before the IP
> > is clocked. This patch moves the function call to after
> > ahci_platform_enable_resources (which enables the IP clock), and
> > resolves the hang.
> > 
> > Addtionally st_ahci_configure_oob should be called in the st_ahci_resume
> > function, so we also rectify that ensuring it is also called after
> > the IP clock has been enabled.
> > 
> > Signed-off-by: Peter Griffin 
> > Acked-by: Lee Jones 
> > Acked-by: Maxime Coquelin 
> 
> How should this patch be routed?  Should I pick this up and apply to
> libata/for-4.1 or should it go together with the other patches?  If
> the latter, please feel free to add my acked-by.

This patch (and also the DT documentation change) can go via your tree. Maxime
will take the stih407 DT patch.

regards,

Peter.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Revert "drm/i915: Performed deferred clflush inside set-cache-level"

2015-03-31 Thread Chris Wilson
On Tue, Mar 31, 2015 at 08:40:12PM +0530, Sudip Mukherjee wrote:
> This reverts commit <0f71979ab7fbd0c71c41c2798de3d33937915434>.
> 
> my display was getting garbled for a moment very frequently. it looked
> like when the screen was getting refreshed then something was going
> wrong.
> git bisect gave this as the first bad commit, and after reverting it
> now display is not having that problem.

Hmm, I fear you would be just papering over a bug. Could you please file
a bug on bugs.freedesktop.org so that we can root cause this?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: dts: mt8173: support arm64 cpuidle-dt

2015-03-31 Thread Lorenzo Pieralisi
On Tue, Mar 31, 2015 at 04:24:37AM +0100, Howard Chen wrote:
> add an idle-states node to describe the mt8173 cpu idle
> add a reference to the idle-states node in each CPU node

You are also changing the PSCI version in this patch, but
I think it is acceptable to have multiple changes at once
to avoid churning out dts changes.

Commit log should be rewritten, lack of punctuation,
missing capitalization, etc; in short, please rewrite it.

> Signed-off-by: Howard Chen 
> ---
>  arch/arm64/boot/dts/mediatek/mt8173.dtsi | 30 ++
>  1 file changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
> b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 8554ec3..96dff1e 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -48,6 +48,8 @@
>   device_type = "cpu";
>   compatible = "arm,cortex-a53";
>   reg = <0x000>;
> + enable-method = "psci";
> + cpu-idle-states = <_SLEEP_0_0 _SLEEP_0>;

You are free to use the labels you want, but you tell me why
CPU_SLEEP_0_0 is used where eg CPU_SLEEP_0 would be sufficient
and clearer (comment valid for all cpu nodes). Copy'n'paste ?

>   };
>  
>   cpu1: cpu@1 {
> @@ -55,6 +57,7 @@
>   compatible = "arm,cortex-a53";
>   reg = <0x001>;
>   enable-method = "psci";
> + cpu-idle-states = <_SLEEP_0_0 _SLEEP_0>;
>   };
>  
>   cpu2: cpu@100 {
> @@ -62,6 +65,7 @@
>   compatible = "arm,cortex-a57";
>   reg = <0x100>;
>   enable-method = "psci";
> + cpu-idle-states = <_SLEEP_0_0 _SLEEP_0>;
>   };
>  
>   cpu3: cpu@101 {
> @@ -69,15 +73,33 @@
>   compatible = "arm,cortex-a57";
>   reg = <0x101>;
>   enable-method = "psci";
> + cpu-idle-states = <_SLEEP_0_0 _SLEEP_0>;
>   };
> +
> + idle-states {
> + entry-method = "arm,psci-0.2";

"arm,psci"

> +
> + CPU_SLEEP_0_0: cpu-sleep-0-0 {
> + compatible = "arm,idle-state";
> + arm,psci-suspend-param = <0x001>;
> + entry-latency-us = <600>;
> + exit-latency-us = <600>;
> + min-residency-us = <1200>;
> + };
> +
> + CLUSTER_SLEEP_0: cluster-sleep-0 {
> + compatible = "arm,idle-state";
> + arm,psci-suspend-param = <0x101>;
> + entry-latency-us = <800>;
> + exit-latency-us = <1000>;
> + min-residency-us = <2000>;
> + wakeup-latency-us = <1000>;
> + };

You tested these latency values right ?

>   };
>  
>   psci {
> - compatible = "arm,psci";
> + compatible = "arm,psci-0.2";

See my comment in the commit log, this change is independent of idle
states changes.

Thanks,
Lorenzo

>   method = "smc";
> - cpu_suspend   = <0x8401>;
> - cpu_off   = <0x8402>;
> - cpu_on= <0x8403>;
>   };
>  
>   uart_clk: dummy26m {
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] ahci: st: st_configure_oob must be called after IP is clocked.

2015-03-31 Thread Maxime Coquelin

Hello Tejun,

On 03/31/2015 05:29 PM, Tejun Heo wrote:

On Tue, Mar 31, 2015 at 08:35:09AM +0100, Peter Griffin wrote:

Currently the ahci_st driver will hang the system on probe, as the
st_configure_oob function does some register writes before the IP
is clocked. This patch moves the function call to after
ahci_platform_enable_resources (which enables the IP clock), and
resolves the hang.

Addtionally st_ahci_configure_oob should be called in the st_ahci_resume
function, so we also rectify that ensuring it is also called after
the IP clock has been enabled.

Signed-off-by: Peter Griffin 
Acked-by: Lee Jones 
Acked-by: Maxime Coquelin 

How should this patch be routed?  Should I pick this up and apply to
libata/for-4.1 or should it go together with the other patches?  If
the latter, please feel free to add my acked-by.


I think you can pick patches 1 & 3.
I will apply patch 2 to STi DT branch.

Thanks,
Maxime


Thanks.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 10/10] KVM: arm64: add trace points for guest_debug debug

2015-03-31 Thread Alex Bennée
This includes trace points for:
  kvm_arch_setup_guest_debug
  kvm_arch_clear_guest_debug
  kvm_handle_guest_debug

I've also added some generic register setting trace events so I can
watch the register values being built up over time. The local
dump_dbg_regs() function dumps all the HW BKPT and WPT registers.

I've also added a #define trace_dreg to shorten some lines.

Signed-off-by: Alex Bennée 

diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
index 638c111..7c96288 100644
--- a/arch/arm64/kvm/debug.c
+++ b/arch/arm64/kvm/debug.c
@@ -25,12 +25,37 @@
 #include 
 #include 
 
+#include "trace.h"
+
+#define trace_dreg(name, value) trace_kvm_arch_setup_debug_reg32(name, value)
+
 /* These are the bits of MDSCR_EL1 we may mess with */
 #define MDSCR_EL1_DEBUG_BITS   (DBG_MDSCR_SS | \
DBG_MDSCR_KDE | \
DBG_MDSCR_MDE)
 
 /**
+ * dump_dbg_regs - simple debug helper
+ *
+ * This provides a simple helper to dump the HW debug registers
+ */
+static void dump_dbg_regs(struct kvm_vcpu *vcpu, int nb, int nw)
+{
+   int i;
+
+   for (i = 0; i < nb; i++) {
+   trace_printk("bkpt%d: 0x%08x:0x%llx\n", i,
+   (u32) vcpu_sys_reg(vcpu, DBGBCR0_EL1 + i),
+   vcpu_sys_reg(vcpu, DBGBVR0_EL1 + i));
+   }
+   for (i = 0; i < nb; i++) {
+   trace_printk("wtpt%d: 0x%08x:0x%llx\n", i,
+   (u32) vcpu_sys_reg(vcpu, DBGWCR0_EL1 + i),
+   vcpu_sys_reg(vcpu, DBGWVR0_EL1 + i));
+   }
+}
+
+/**
  * kvm_arch_setup_debug - set-up debug related stuff
  *
  * @vcpu:  the vcpu pointer
@@ -52,9 +77,13 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
 {
bool trap_debug = false;
 
+   trace_kvm_arch_setup_debug(vcpu->guest_debug);
+
vcpu->arch.mdcr_el2 |= (MDCR_EL2_TPM | MDCR_EL2_TPMCR);
vcpu->arch.mdcr_el2 |= (MDCR_EL2_TDRA | MDCR_EL2_TDOSA);
 
+   trace_kvm_arch_setup_debug_reg32("MDCR_EL2", vcpu->arch.mdcr_el2);
+
/*
 * If we are not treating debug registers are dirty we need
 * to trap if the guest starts accessing them.
@@ -66,6 +95,8 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
if (vcpu->guest_debug) {
vcpu->arch.mdcr_el2 |= MDCR_EL2_TDE;
 
+   trace_dreg("MDCR_EL2", vcpu->arch.mdcr_el2);
+
/* Save pstate/mdscr */
vcpu_debug_saved_reg(vcpu, pstate_ss_bit) =
*vcpu_cpsr(vcpu) & DBG_SPSR_SS;
@@ -73,6 +104,11 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
vcpu_debug_saved_reg(vcpu, mdscr_el1) =
vcpu_sys_reg(vcpu, MDSCR_EL1);
 
+   trace_dreg("Save: PSTATE.SS",
+   vcpu_debug_saved_reg(vcpu, pstate_ss_bit));
+   trace_dreg("Save: MDSCR",
+   vcpu_debug_saved_reg(vcpu, mdscr_el1));
+
/*
 * Single Step (ARM ARM D2.12.3 The software step state
 * machine)
@@ -88,6 +124,8 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
*vcpu_cpsr(vcpu) &= ~DBG_SPSR_SS;
vcpu_sys_reg(vcpu, MDSCR_EL1) &= ~DBG_MDSCR_SS;
}
+   trace_dreg("SPSR_EL2", *vcpu_cpsr(vcpu));
+   trace_dreg("MDSCR_EL1", vcpu_sys_reg(vcpu, MDSCR_EL1));
 
/*
 * HW Break/Watch points
@@ -136,6 +174,9 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
   >dbg_wvr,
   sizeof(__u64)*nw);
 
+   if (trace_kvm_arch_setup_debug_reg32_enabled())
+   dump_dbg_regs(vcpu, nb, nw);
+
/* Make sure hyp.S copies them in/out */
vcpu->arch.debug_flags |= KVM_ARM64_DEBUG_DIRTY;
/* Also track guest changes */
@@ -147,15 +188,24 @@ void kvm_arch_setup_debug(struct kvm_vcpu *vcpu)
vcpu->arch.mdcr_el2 &= ~MDCR_EL2_TDE;
}
 
+   trace_kvm_arch_setup_debug_reg32("MDCR_EL2", vcpu->arch.mdcr_el2);
+   trace_kvm_arch_setup_debug_reg32("MDSCR_EL1",
+   vcpu_sys_reg(vcpu, MDSCR_EL1));
+
+
/* Trap debug register access? */
if (trap_debug)
vcpu->arch.mdcr_el2 |= MDCR_EL2_TDA;
else
vcpu->arch.mdcr_el2 &= ~MDCR_EL2_TDA;
+
+   trace_kvm_arch_setup_debug_reg32("MDCR_EL2", vcpu->arch.mdcr_el2);
 }
 
 void kvm_arch_clear_debug(struct kvm_vcpu *vcpu)
 {
+   trace_kvm_arch_clear_debug(vcpu->guest_debug);
+
if (vcpu->guest_debug) {
/* Restore pstate/mdscr bits we may have messed with */
*vcpu_cpsr(vcpu) &= ~DBG_SPSR_SS;
@@ -164,6 +214,8 @@ void kvm_arch_clear_debug(struct kvm_vcpu *vcpu)
vcpu_sys_reg(vcpu, MDSCR_EL1) =

Re: [PATCH RFC] nohz,blk-mq: do not create blk-mq workqueues on nohz dedicated CPUs

2015-03-31 Thread Frederic Weisbecker
On Tue, Mar 31, 2015 at 09:07:11AM -0600, Jens Axboe wrote:
> On 03/31/2015 08:27 AM, Rik van Riel wrote:
> >CPUs with nohz_full do not want disruption from timer interrupts,
> >or other random system things.  This includes block mq work.
> >
> >There is another issue with block mq vs. realtime tasks that run
> >100% of the time, which is not uncommon on systems that have CPUs
> >dedicated to real time use with isolcpus= and nohz_full=
> >
> >Specifically, on systems like that, a block work item may never
> >get to run, which could lead to filesystems getting stuck forever.
> >
> >We can avoid both issues by not scheduling blk-mq workqueues on
> >cpus in nohz_full mode.
> >
> >Question for Jens: should we try to spread out the load for
> >currently offline and nohz CPUs across the remaining CPUs in
> >the system, to get the full benefit of blk-mq in these situations?
> >
> >If so, do you have any preference on how I should implement that?
> >
> >Cc: Frederic Weisbecker 
> >Cc: Ingo Molnar 
> >Cc: Jens Axboe 
> >Signed-off-by: Rik van Riel 
> >---
> >  block/blk-mq.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> >diff --git a/block/blk-mq.c b/block/blk-mq.c
> >index 4f4bea21052e..1004d6817fa4 100644
> >--- a/block/blk-mq.c
> >+++ b/block/blk-mq.c
> >@@ -21,6 +21,7 @@
> >  #include 
> >  #include 
> >  #include 
> >+#include 
> >
> >  #include 
> >
> >@@ -1760,6 +1761,10 @@ static void blk_mq_init_cpu_queues(struct 
> >request_queue *q,
> > if (!cpu_online(i))
> > continue;
> >
> >+/* Do not schedule work on nohz full dedicated CPUs. */
> >+if (tick_nohz_full_cpu(i))
> >+continue;
> 
> Is this CPU ever going to queue IO? If yes, then it needs to be mapped. If
> userspace never runs on it and submits IO, then we'll never run completions
> on it nor schedule the associated workqueue. So I really don't see how it
> doesn't already work, as-is.

Well, it's fairly possible that full dynticks CPUs do IO of any sort. Is it 
possible
to affine these asynchronous works to specific CPU? The usual scheme of full 
dynticks
is to have CPU 0 handling any kind of housekeeping and other CPUs doing latency 
or performance
sensitive works that don't want to be disturbed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/6] phy: miphy365x: Use the generic phy type constants in dt-bindings/phy/phy.h

2015-03-31 Thread Kishon Vijay Abraham I

Maxime,

On Tuesday 31 March 2015 01:10 PM, Lee Jones wrote:

On Tue, 31 Mar 2015, Kishon Vijay Abraham I wrote:


Hi Patrice, Maxime,

On Monday 30 March 2015 08:47 PM, Peter Griffin wrote:

Now there are generic phy type constants declared in phy.h, migrate over to
using them rather than defining our own. This change has been done as one
atomic commit to be bisectable.

Note: The values of the defines are the same, so there is no ABI breakage
with this patch.

Signed-off-by: Peter Griffin 
Acked-by: Rob Herring 
Acked-by: Lee Jones 


Are you okay for this patch to go via PHY tree? It modifies arch/arm/boot/dts
/stih416.dtsi.


These files need to be changed simultaneously in order to prevent
breakage during bisection and the like.  I think the best bet moving
forward is to pull this into its own branch, tag it and send Maxime a
pull-request to the immutable branch.  It's the best way to minimise
merge conflicts during the v4.1 merge window.


okay. I still need an Ack from Maxime.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Linux-nvdimm] [PATCH 4/6] SQUSHME: pmem: Micro cleaning

2015-03-31 Thread Dan Williams
On Tue, Mar 31, 2015 at 8:24 AM, Boaz Harrosh  wrote:
> On 03/31/2015 06:17 PM, Dan Williams wrote:
>> On Tue, Mar 31, 2015 at 6:27 AM, Boaz Harrosh  wrote:
>>>
>>> Some error checks had unlikely some did not. Put unlikely
>>> on all error handling paths.
>>> (I like unlikely for error paths specially for readability)
>>
>> "unlikely()" is not a readability hint, it's specifically for branches
>> that profiling shows adding it makes a difference.  Just delete them
>> all until profiling show they make a difference.  They certainly don't
>> make a difference in the slow paths.
>>
>
> Why?

Because the compiler and cpu already does a decent job, and if you get
the frequency wrong it can hurt performance [1].

It's pre-mature optimization to sprinkle them around, especially in slow paths.

[1]: https://lwn.net/Articles/420019/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 02/25] arm64: Use bool function return values of true/false not 1/0

2015-03-31 Thread Will Deacon
On Tue, Mar 31, 2015 at 12:46:00AM +0100, Joe Perches wrote:
> Use the normal return values for bool functions
> 
> Signed-off-by: Joe Perches 
> ---
>  arch/arm64/include/asm/dma-mapping.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/dma-mapping.h 
> b/arch/arm64/include/asm/dma-mapping.h
> index 6932bb5..9437e3d 100644
> --- a/arch/arm64/include/asm/dma-mapping.h
> +++ b/arch/arm64/include/asm/dma-mapping.h
> @@ -97,7 +97,7 @@ static inline int dma_set_mask(struct device *dev, u64 mask)
>  static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t 
> size)
>  {
>   if (!dev->dma_mask)
> - return 0;
> + return false;
>  
>   return addr + size - 1 <= *dev->dma_mask;
>  }
> -- 
> 2.1.2

Looks simple enough, I'll pick it up for 4.1.

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/3] ahci: st: st_configure_oob must be called after IP is clocked.

2015-03-31 Thread Tejun Heo
On Tue, Mar 31, 2015 at 08:35:09AM +0100, Peter Griffin wrote:
> Currently the ahci_st driver will hang the system on probe, as the
> st_configure_oob function does some register writes before the IP
> is clocked. This patch moves the function call to after
> ahci_platform_enable_resources (which enables the IP clock), and
> resolves the hang.
> 
> Addtionally st_ahci_configure_oob should be called in the st_ahci_resume
> function, so we also rectify that ensuring it is also called after
> the IP clock has been enabled.
> 
> Signed-off-by: Peter Griffin 
> Acked-by: Lee Jones 
> Acked-by: Maxime Coquelin 

How should this patch be routed?  Should I pick this up and apply to
libata/for-4.1 or should it go together with the other patches?  If
the latter, please feel free to add my acked-by.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] workqueue: fix a bug when numa mapping is changed

2015-03-31 Thread Tejun Heo
Hello, Kamezawa.

On Tue, Mar 31, 2015 at 03:09:05PM +0900, Kamezawa Hiroyuki wrote:
> But this may be considered as API change for most hot-add users.

Hmm... Why would it be?  What can that possibly break?

> So, for now, I vote for detemining ids at online but record it is a good way.

If we know the information during boot, let's please do it at boot
time by all means.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    2   3   4   5   6   7   8   9   10   11   >