Re: [PATCH 14/18] perf tools: Make vmlinux short name more like kallsyms short name

2014-11-08 Thread Jiri Olsa
On Thu, Nov 06, 2014 at 06:04:35PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Namhyung Kim 
> 
> The previous patch changed kernel dso name from '[kernel.kallsyms]' to
> vmlinux.  However it might add confusion to old users accustomed to the
> old name.  So change the short name to '[kernel.vmlinux]' to reduce such
> confusion.
> 

SNIP

> Signed-off-by: Arnaldo Carvalho de Melo 
> ---
>  tools/perf/util/machine.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 53f90e9c65fe..52e94902afb1 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1106,6 +1106,9 @@ static int machine__process_kernel_mmap_event(struct 
> machine *machine,
>   if (__machine__create_kernel_maps(machine, kernel) < 0)
>   goto out_problem;
>  
> + if (strstr(dso->long_name, "vmlinux"))
> + dso__set_short_name(dso, "[kernel.vmlinux]", false);
> +

heya,
I've got attached segfault in perf script because of this,
if I revert it's ok..

jirka

[jolsa@krava perf]$ ./perf record -e instructions -c 1 yes > /dev/null
^C[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (~576 samples) ]
[jolsa@krava perf]$ gdb ./perf
GNU gdb (GDB) Fedora 7.7.1-21.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./perf...done.
(gdb) r script
Starting program: /home/jolsa/kernel.org/linux-perf/tools/perf/perf script
warning: section  not found in 
/usr/lib/debug/lib/modules/3.16.6-203.fc20.x86_64/vdso/vdso64.so.debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 6849.
Program received signal SIGSEGV, Segmentation fault.
__strstr_sse42 (s1=0x0, s2=0x5db702 "vmlinux") at 
../sysdeps/x86_64/multiarch/strstr.c:175
175   if (__builtin_expect (p1[0] == '\0', 0))
Missing separate debuginfos, use: debuginfo-install 
audit-libs-2.4-2.fc20.x86_64 elfutils-libelf-0.160-1.fc20.x86_64 
elfutils-libs-0.160-1.fc20.x86_64 libunwind-1.1-3.fc20.x86_64 
nss-softokn-freebl-3.17.2-1.fc20.x86_64 numactl-libs-2.0.9-2.fc20.x86_64 
perl-libs-5.18.4-290.fc20.x86_64 python-libs-2.7.5-14.fc20.x86_64 
slang-2.2.4-11.fc20.x86_64 xz-libs-5.1.2-12alpha.fc20.x86_64 
zlib-1.2.8-3.fc20.x86_64
(gdb) bt
#0  __strstr_sse42 (s1=0x0, s2=0x5db702 "vmlinux") at 
../sysdeps/x86_64/multiarch/strstr.c:175
#1  0x004a881d in machine__process_kernel_mmap_event (machine=0x8d3e80, 
event=0x77ff50d8)
at util/machine.c:1109
#2  0x004a8b4f in machine__process_mmap_event (machine=0x8d3e80, 
event=0x77ff50d8,
sample=0x7fffd280) at util/machine.c:1203
#3  0x00470e7e in perf_event__process_mmap (tool=0x7fffd650, 
event=0x77ff50d8,
sample=0x7fffd280, machine=0x8d3e80) at util/event.c:666
#4  0x004af2fa in perf_session__deliver_event (session=0x8d3dc0, 
event=0x77ff50d8,
sample=0x7fffd280, tool=0x7fffd650, file_offset=216) at 
util/session.c:845
#5  0x004afa96 in perf_session__process_event (session=0x8d3dc0, 
event=0x77ff50d8,
tool=0x7fffd650, file_offset=216) at util/session.c:1020
#6  0x004b0451 in __perf_session__process_events (session=0x8d3dc0, 
data_offset=216, data_size=16240,
file_size=16456, tool=0x7fffd650) at util/session.c:1292
#7  0x004b061e in perf_session__process_events (session=0x8d3dc0, 
tool=0x7fffd650)
at util/session.c:1337
#8  0x004453d4 in __cmd_script (script=0x7fffd650) at 
builtin-script.c:803
#9  0x00448858 in cmd_script (argc=0, argv=0x7fffe2e0, prefix=0x0) 
at builtin-script.c:1835
#10 0x0041c88c in run_builtin (p=0x856f70 , argc=1, 
argv=0x7fffe2e0) at perf.c:331
#11 0x0041caeb in handle_internal_command (argc=1, argv=0x7fffe2e0) 
at perf.c:390
#12 0x0041cc37 in run_argv (argcp=0x7fffe13c, argv=0x7fffe130) 
at perf.c:434
#13 0x0041cf8e in main (argc=1, argv=0x7fffe2e0) at perf.c:549
(gdb) q
A debugging session is active.
--
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  

Re: [PATCH v3 3/4] input: alps: For protocol V3, do not process data when last packet's bit7 is set

2014-11-08 Thread Dmitry Torokhov
Hi Pali,

On Sun, Nov 02, 2014 at 12:25:09AM +0100, Pali Rohár wrote:
> Sometimes on Dell Latitude laptops psmouse/alps driver receive invalid ALPS
> protocol V3 packets with bit7 set in last byte. More often it can be 
> reproduced
> on Dell Latitude E6440 or E7440 with closed lid and pushing cover above 
> touchpad.
> 
> If bit7 in last packet byte is set then it is not valid ALPS packet. I was 
> told
> that ALPS devices never send these packets. It is not know yet who send those
> packets, it could be Dell EC, bug in BIOS and also bug in touchpad firmware...
> 
> With this patch alps driver does not process those invalid packets and drops 
> it
> with PSMOUSE_FULL_PACKET so psmouse driver does not enter to out of sync 
> state.
> 
> This patch fix problem when psmouse driver still resetting ALPS device when
> laptop lid is closed because of receiving invalid packets in out of sync 
> state.
> 
> Signed-off-by: Pali Rohár 
> Tested-by: Pali Rohár 
> Cc: sta...@vger.kernel.org
> ---
>  drivers/input/mouse/alps.c |   10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 7c47e97..e802d28 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -1181,6 +1181,16 @@ static psmouse_ret_t alps_process_byte(struct psmouse 
> *psmouse)
>   return PSMOUSE_BAD_DATA;
>   }
>  
> + if (priv->proto_version == ALPS_PROTO_V3 && psmouse->pktcnt == 
> psmouse->pktsize) {
> + // For protocol V3, do not process data when last packet's bit7 
> is set
> + if (psmouse->packet[psmouse->pktcnt - 1] & 0x80) {
> + psmouse_dbg(psmouse, "v3 discard packet[%i] = %x\n",
> + psmouse->pktcnt - 1,
> + psmouse->packet[psmouse->pktcnt - 1]);
> + return PSMOUSE_FULL_PACKET;
> + }
> + }

I wanted to apply it, but I would like some more data. Could you please
send me the dmesg with i8042.debug wit this patch in place?

Thanks!

-- 
Dmitry
--
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/5] f2fs: write node pages if checkpoint is not doing

2014-11-08 Thread Jaegeuk Kim
It needs to write node pages if checkpoint is not doing in order to avoid
memory pressure.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/node.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 4ea2c47..6f514fb 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1314,10 +1314,12 @@ static int f2fs_write_node_page(struct page *page,
return 0;
}
 
-   if (wbc->for_reclaim)
-   goto redirty_out;
-
-   down_read(>node_write);
+   if (wbc->for_reclaim) {
+   if (!down_read_trylock(>node_write))
+   goto redirty_out;
+   } else {
+   down_read(>node_write);
+   }
set_page_writeback(page);
write_node_page(sbi, page, , nid, ni.blk_addr, _addr);
set_node_addr(sbi, , new_addr, is_fsync_dnode(page));
-- 
2.1.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 3/5] f2fs: control the memory footprint used by ino entries

2014-11-08 Thread Jaegeuk Kim
This patch adds to control the memory footprint used by ino entries.
This will conduct best effort, not strictly.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/node.c| 28 ++--
 fs/f2fs/node.h|  3 ++-
 fs/f2fs/segment.c |  3 ++-
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 44b8afe..4ea2c47 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -31,22 +31,38 @@ bool available_free_memory(struct f2fs_sb_info *sbi, int 
type)
 {
struct f2fs_nm_info *nm_i = NM_I(sbi);
struct sysinfo val;
+   unsigned long avail_ram;
unsigned long mem_size = 0;
bool res = false;
 
si_meminfo();
-   /* give 25%, 25%, 50% memory for each components respectively */
+
+   /* only uses low memory */
+   avail_ram = val.totalram - val.totalhigh;
+
+   /* give 25%, 25%, 50%, 50% memory for each components respectively */
if (type == FREE_NIDS) {
-   mem_size = (nm_i->fcnt * sizeof(struct free_nid)) >> 12;
-   res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2);
+   mem_size = (nm_i->fcnt * sizeof(struct free_nid)) >>
+   PAGE_CACHE_SHIFT;
+   res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2);
} else if (type == NAT_ENTRIES) {
-   mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >> 12;
-   res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 2);
+   mem_size = (nm_i->nat_cnt * sizeof(struct nat_entry)) >>
+   PAGE_CACHE_SHIFT;
+   res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 2);
} else if (type == DIRTY_DENTS) {
if (sbi->sb->s_bdi->dirty_exceeded)
return false;
mem_size = get_pages(sbi, F2FS_DIRTY_DENTS);
-   res = mem_size < ((val.totalram * nm_i->ram_thresh / 100) >> 1);
+   res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
+   } else if (type == INO_ENTRIES) {
+   int i;
+
+   if (sbi->sb->s_bdi->dirty_exceeded)
+   return false;
+   for (i = 0; i <= UPDATE_INO; i++)
+   mem_size += (sbi->ino_num[i] * sizeof(struct ino_entry))
+   >> PAGE_CACHE_SHIFT;
+   res = mem_size < ((avail_ram * nm_i->ram_thresh / 100) >> 1);
}
return res;
 }
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index acb71e5..d10b644 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -106,7 +106,8 @@ static inline void raw_nat_from_node_info(struct 
f2fs_nat_entry *raw_ne,
 enum mem_type {
FREE_NIDS,  /* indicates the free nid list */
NAT_ENTRIES,/* indicates the cached nat entry */
-   DIRTY_DENTS /* indicates dirty dentry pages */
+   DIRTY_DENTS,/* indicates dirty dentry pages */
+   INO_ENTRIES,/* indicates inode entries */
 };
 
 struct nat_entry_set {
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 16721b5d..e094675 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -276,7 +276,8 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi)
 {
/* check the # of cached NAT entries and prefree segments */
if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK) ||
-   excess_prefree_segs(sbi))
+   excess_prefree_segs(sbi) ||
+   available_free_memory(sbi, INO_ENTRIES))
f2fs_sync_fs(sbi->sb, true);
 }
 
-- 
2.1.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 5/5] f2fs: do not skip any writes under memory pressure

2014-11-08 Thread Jaegeuk Kim
Under memory pressure, let's avoid skipping data writes.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/segment.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 6723ccc..7f327c0 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -711,6 +711,9 @@ static inline unsigned int max_hw_blocks(struct 
f2fs_sb_info *sbi)
  */
 static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
 {
+   if (sbi->sb->s_bdi->dirty_exceeded)
+   return 0;
+
if (type == DATA)
return sbi->blocks_per_seg;
else if (type == NODE)
-- 
2.1.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 2/5] f2fs: introduce the number of inode entries

2014-11-08 Thread Jaegeuk Kim
This patch adds to monitor the number of ino entries.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/checkpoint.c | 27 +++
 fs/f2fs/debug.c  |  4 +++-
 fs/f2fs/f2fs.h   |  2 +-
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index dd6a357..bcd686e 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -318,6 +318,8 @@ retry:
e->ino = ino;
 
list_add_tail(>list, >ino_list[type]);
+   if (type != ORPHAN_INO)
+   sbi->ino_num[type]++;
}
spin_unlock(>ino_lock[type]);
 }
@@ -331,8 +333,7 @@ static void __remove_ino_entry(struct f2fs_sb_info *sbi, 
nid_t ino, int type)
if (e) {
list_del(>list);
radix_tree_delete(>ino_root[type], ino);
-   if (type == ORPHAN_INO)
-   sbi->n_orphans--;
+   sbi->ino_num[type]--;
spin_unlock(>ino_lock[type]);
kmem_cache_free(ino_entry_slab, e);
return;
@@ -373,6 +374,7 @@ void release_dirty_inode(struct f2fs_sb_info *sbi)
list_del(>list);
radix_tree_delete(>ino_root[i], e->ino);
kmem_cache_free(ino_entry_slab, e);
+   sbi->ino_num[i]--;
}
spin_unlock(>ino_lock[i]);
}
@@ -383,10 +385,10 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
int err = 0;
 
spin_lock(>ino_lock[ORPHAN_INO]);
-   if (unlikely(sbi->n_orphans >= sbi->max_orphans))
+   if (unlikely(sbi->ino_num[ORPHAN_INO] >= sbi->max_orphans))
err = -ENOSPC;
else
-   sbi->n_orphans++;
+   sbi->ino_num[ORPHAN_INO]++;
spin_unlock(>ino_lock[ORPHAN_INO]);
 
return err;
@@ -395,8 +397,8 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
 void release_orphan_inode(struct f2fs_sb_info *sbi)
 {
spin_lock(>ino_lock[ORPHAN_INO]);
-   f2fs_bug_on(sbi, sbi->n_orphans == 0);
-   sbi->n_orphans--;
+   f2fs_bug_on(sbi, sbi->ino_num[ORPHAN_INO] == 0);
+   sbi->ino_num[ORPHAN_INO]--;
spin_unlock(>ino_lock[ORPHAN_INO]);
 }
 
@@ -460,11 +462,12 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, 
block_t start_blk)
struct f2fs_orphan_block *orphan_blk = NULL;
unsigned int nentries = 0;
unsigned short index;
-   unsigned short orphan_blocks =
-   (unsigned short)GET_ORPHAN_BLOCKS(sbi->n_orphans);
+   unsigned short orphan_blocks;
struct page *page = NULL;
struct ino_entry *orphan = NULL;
 
+   orphan_blocks = GET_ORPHAN_BLOCKS(sbi->ino_num[ORPHAN_INO]);
+
for (index = 0; index < orphan_blocks; index++)
grab_meta_page(sbi, start_blk + index);
 
@@ -892,7 +895,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct 
cp_control *cpc)
else
clear_ckpt_flags(ckpt, CP_COMPACT_SUM_FLAG);
 
-   orphan_blocks = GET_ORPHAN_BLOCKS(sbi->n_orphans);
+   orphan_blocks = GET_ORPHAN_BLOCKS(sbi->ino_num[ORPHAN_INO]);
ckpt->cp_pack_start_sum = cpu_to_le32(1 + cp_payload_blks +
orphan_blocks);
 
@@ -908,7 +911,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct 
cp_control *cpc)
orphan_blocks);
}
 
-   if (sbi->n_orphans)
+   if (sbi->ino_num[ORPHAN_INO])
set_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
else
clear_ckpt_flags(ckpt, CP_ORPHAN_PRESENT_FLAG);
@@ -943,7 +946,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct 
cp_control *cpc)
f2fs_put_page(cp_page, 1);
}
 
-   if (sbi->n_orphans) {
+   if (sbi->ino_num[ORPHAN_INO]) {
write_orphan_inodes(sbi, start_blk);
start_blk += orphan_blocks;
}
@@ -1045,6 +1048,7 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi)
INIT_RADIX_TREE(>ino_root[i], GFP_ATOMIC);
spin_lock_init(>ino_lock[i]);
INIT_LIST_HEAD(>ino_list[i]);
+   sbi->ino_num[i] = 0;
}
 
/*
@@ -1053,7 +1057,6 @@ void init_ino_entry_info(struct f2fs_sb_info *sbi)
 * orphan entries with the limitation one reserved segment
 * for cp pack we can have max 1020*504 orphan entries
 */
-   sbi->n_orphans = 0;
sbi->max_orphans = (sbi->blocks_per_seg - F2FS_CP_PACKS -
NR_CURSEG_TYPE) * F2FS_ORPHANS_PER_BLOCK;
 }
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 86e6e92..74a0d78 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -119,6 +119,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
 {
struct f2fs_stat_info *si = F2FS_STAT(sbi);
unsigned npages;
+   int i;
 
if (si->base_mem)
 

[PATCH 1/5] f2fs: disable roll-forward when active_logs = 2

2014-11-08 Thread Jaegeuk Kim
The roll-forward mechanism should be activated when the number of active
logs is not 2.

Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/file.c| 2 ++
 fs/f2fs/segment.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 46311e7..54722a0 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -132,6 +132,8 @@ static inline bool need_do_checkpoint(struct inode *inode)
need_cp = true;
else if (test_opt(sbi, FASTBOOT))
need_cp = true;
+   else if (sbi->active_logs == 2)
+   need_cp = true;
 
return need_cp;
 }
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 2fb3d7f..16721b5d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1090,8 +1090,8 @@ static int __get_segment_type_4(struct page *page, enum 
page_type p_type)
else
return CURSEG_COLD_DATA;
} else {
-   if (IS_DNODE(page) && !is_cold_node(page))
-   return CURSEG_HOT_NODE;
+   if (IS_DNODE(page) && is_cold_node(page))
+   return CURSEG_WARM_NODE;
else
return CURSEG_COLD_NODE;
}
-- 
2.1.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] Move BTRFS RCU string to common library

2014-11-08 Thread Omar Sandoval
On Sat, Nov 08, 2014 at 08:13:37AM -0800, Joe Perches wrote:
> On Sat, 2014-11-08 at 00:46 -0800, Omar Sandoval wrote:
> > The RCU-friendly string API used internally by BTRFS is generic enough for
> > common use. This doesn't add any new functionality, but instead just moves 
> > the
> > code and documents the existing API.
> 
> Some more trivia, can be updated later if desired.
> 
> > diff --git a/include/linux/rcustring.h b/include/linux/rcustring.h
> > new file mode 100644
> []
> > +
> > +/**
> > + * printk_in_rcu() - printk in an RCU read-side critical section
> 
> It'd be nice to show the arguments for kernel-doc here
My impression is that referencing printk tells you everything you need to know,
but for completeness' sake, that sounds fair.

> > + */
> > +#define printk_in_rcu(fmt, ...)\
> > +   do {\
> > +   rcu_read_lock();\
> > +   printk(fmt, __VA_ARGS__);   \
> 
> This should use ##__VA_ARGS__ to allow the
> compiler to elide the comma when using
> 
>   printk_in_rcu("Hello World!");
> 
Luckily, there's probably no sane reason anyone would do a printk_in_rcu
without the varargs, but once again, it's probably good hygiene.

Anyone else have anything to add? Otherwise, I'll wrap this up in another
iteration of the patch.

Thanks!
-- 
Omar
--
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 Part2 v5 21/31] PCI/MSI: Enhance core to support hierarchy irqdomain

2014-11-08 Thread Jiang Liu
On 2014/11/9 12:26, Suravee Suthikulpanit wrote:
> Hi Gerry,
> 
> Please see my comments / questions below.
> 
> On 11/6/14 21:20, Jiang Liu wrote:
>> Enhance PCI MSI core to support hierarchy irqdomain, so the common
>> code could be shared among architectures.
>>
>> Signed-off-by: Jiang Liu 
>> ---
>> Hi Thomas,
>> These changes are a temporary solution, I'm working on another
>> patch set which will refine these interfaces, especially kill
>> arch_msi_irq_domain_{set|get}_hwirq().
>> Regards!
>> Gerry
> 
> Would the change includes the struct irqdomain_msi_data proposed by
> Thomas here (https://lkml.org/lkml/2014/11/6/210)?
Hi Suravee,
I'm working on another patch set which will refine the way to
create irqdomain for MSI. I hope will solve all issues mentioned by
Thomas. I will post that patch set as RFC within one or two days.

> 
>> [...]
>> +static int msi_domain_alloc(struct irq_domain *domain, unsigned int
>> virq,
>> +unsigned int nr_irqs, void *arg)
>> +{
>> +int i, ret;
>> +irq_hw_number_t hwirq = arch_msi_irq_domain_get_hwirq(arg);
>> +
>> +if (irq_find_mapping(domain, hwirq) > 0)
>> +return -EEXIST;
>> +
>> +ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg);
>> +if (ret < 0)
>> +return ret;
>> +
> 
> When executing irq_domain_alloc_irqs_parent(), it triggers the following
> warning message due to
> 
> WARN_ON(desc->irq_data.chip == _irq_chip)
> 
> [ cut here ]
> WARNING: CPU: 2 PID: 912 at kernel/irq/chip.c:734
> __irq_set_handler+0x138/0x13c()
> Modules linked in: mlx4_core(+) rtc_efi efivarfs
> CPU: 2 PID: 912 Comm: modprobe Not tainted 3.18.0-rc3-p2v5+ #53
> Call trace:
> [] dump_backtrace+0x0/0x16c
> [] show_stack+0x10/0x1c
> [] dump_stack+0x74/0x98
> [] warn_slowpath_common+0x84/0xac
> [] warn_slowpath_null+0x14/0x20
> [] __irq_set_handler+0x134/0x13c
> [] gic_irq_domain_map+0x4c/0xac
> [] gic_irq_domain_alloc+0x60/0x88
> [] gicv2m_domain_alloc+0x30/0xa8
> [] __irq_domain_alloc_irqs+0x144/0x30c
> [] gicv2m_setup_msi_irq+0xc0/0x118
> [] arch_setup_msi_irq+0x34/0x60
> [] arch_setup_msi_irqs+0x50/0xb0
> [] pci_enable_msix+0x310/0x39c
> [] pci_enable_msix_range+0x34/0x9c
> 
> 
> However, I think if we call irq_domain_set_hwirq_and_chip() in the
> msi_create_irq_domain() as suggested by Thomas, that should also fix
> this issue.
We didn't trigger this warning on x86 because only the outer-most
irqdomain will set irq flow handler. On ARM, the inner GIC domain
will set irq flow handler, but the irq_data->chip for outer-most
domain hasn't been set yet.

I'm still find a way out here. Maybe we need to relax the WARN_ON().

> 
>> +for (i = 0; i < nr_irqs; i++) {
>> +irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
>> +  domain->host_data,
>> +  (void *)(long)i);
>> +__irq_set_handler(virq + i, handle_edge_irq, 0, "edge");
>> +}
> 
> Is there are a way to specify other type of handler besides edge?
Yes, the new patch set will address this requirement.

> 
>> [...]
>> +static void msi_domain_activate(struct irq_domain *domain,
>> +struct irq_data *irq_data)
>> +{
>> +struct msi_msg msg;
>> +
>> +/*
>> + * irq_data->chip_data is MSI/MSI-X offset.
>> + * MSI-X message is written per-IRQ, the offset is always 0.
>> + * MSI message denotes a contiguous group of IRQs, written for
>> 0th IRQ.
>> + */
>> +if (irq_data->chip_data)
>> +return;
> 
> Actually, I am a bit confused with this comment here.  If you look at
> "/drivers/pci/msi.c: arch_setup_msi_irq()", it calls
> irq_set_chip_data(des->irq, chip) where chip is *msi_chip.
> 
> It looks like if the arch uses this API, it would conflict with what you
> have here where the irq_data->chip_data would be not NULL at the logic
> above, and would always return.
Good point, it's work on x86, but will break ARM or other platforms.
Will refine this part.
Regards!
Gerry
> 
> Thank you,
> 
> Suravee
--
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/


[GIT PULL] ARM: SoC fixes for 3.18-rc4

2014-11-08 Thread Olof Johansson
Hi Linus,

The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git 
tags/armsoc-for-rc4

for you to fetch changes up to 92c9e0c780e61f821ab8a08f0d4d4fd33ba1197c:

  ARM: dts: zynq: Enable PL clocks for Parallella (2014-11-08 16:57:44 -0800)


ARM: SoC fixes for 3.18-rc4

Another quiet week:

- A fix to silence edma probe error on non-supported platforms from Arnd
- A fix to enable the PL clock for Parallella, to make mainline usable with
  the SDK.
- A somewhat verbose fix for the PLL clock tree on VF610
- Enabling of SD/MMC on one of the VF610-based boards (for testing)
- A fix for i.MX where CONFIG_SPI used to be implicitly enabled and now needs
  to be added to the defconfig instead
- Another maintainer added for bcm2835: Lee Jones


Andreas Färber (1):
  ARM: dts: zynq: Enable PL clocks for Parallella

Arnd Bergmann (1):
  dma: edma: move device registration to platform code

Fabio Estevam (1):
  ARM: imx: Fix the removal of CONFIG_SPI option

Olof Johansson (2):
  Merge tag 'imx-fixes-3.18-2' of git://git.kernel.org/.../shawnguo/linux 
into fixes
  ARM: dts: vf610: add SD node to cosmic dts

Stefan Agner (1):
  ARM: imx: clk-vf610: define PLL's clock tree

Stephen Warren (1):
  MAINTAINERS: update bcm2835 entry

 MAINTAINERS |   3 +-
 arch/arm/boot/dts/vf610-cosmic.dts  |  19 +
 arch/arm/boot/dts/zynq-parallella.dts   |   4 +
 arch/arm/common/edma.c  |   9 +++
 arch/arm/configs/imx_v4_v5_defconfig|   1 +
 arch/arm/configs/imx_v6_v7_defconfig|   1 +
 arch/arm/mach-imx/clk-vf610.c   | 134 ++--
 drivers/dma/edma.c  |  40 +-
 include/dt-bindings/clock/vf610-clock.h |  39 --
 9 files changed, 160 insertions(+), 90 deletions(-)
--
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 v5 3/6] irqchip: gic: Support hierarchy irq domain.

2014-11-08 Thread Jiang Liu


On 2014/10/29 18:00, Yingjoe Chen wrote:
> Add support to use gic as a parent for stacked irq domain.
> 
> Signed-off-by: Yingjoe Chen 
> ---
>  drivers/irqchip/Kconfig   |  1 +
>  drivers/irqchip/irq-gic.c | 90 
> +--
>  2 files changed, 65 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> index b21f12f..7f34138 100644
> --- a/drivers/irqchip/Kconfig
> +++ b/drivers/irqchip/Kconfig
> @@ -5,6 +5,7 @@ config IRQCHIP
>  config ARM_GIC
>   bool
>   select IRQ_DOMAIN
> + select IRQ_DOMAIN_HIERARCHY
>   select MULTI_IRQ_HANDLER
>  
>  config GIC_NON_BANKED
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 38493ff..6f39bef 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -786,19 +786,17 @@ void __init gic_init_physaddr(struct device_node *node)
>  static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>   irq_hw_number_t hw)
>  {
> + irq_domain_set_hwirq_and_chip(d, irq, hw, _chip, d->host_data);
>   if (hw < 32) {
>   irq_set_percpu_devid(irq);
> - irq_set_chip_and_handler(irq, _chip,
> -  handle_percpu_devid_irq);
> + irq_set_handler(irq, handle_percpu_devid_irq);
Hi Joe,
This may trigger a warning when dealing with hierarchy
irqdomain as below. It's because the child domain hasn't set
irq_data->chip yet when parent domain's gic_irq_domain_map() gets
called. We may need to relax the WARNING_ON() in  __irq_set_handler().
WARN_ON(desc->irq_data.chip == _irq_chip)

[ cut here ]
WARNING: CPU: 2 PID: 912 at kernel/irq/chip.c:734
__irq_set_handler+0x138/0x13c()
Modules linked in: mlx4_core(+) rtc_efi efivarfs
CPU: 2 PID: 912 Comm: modprobe Not tainted 3.18.0-rc3-p2v5+ #53
Call trace:
[] dump_backtrace+0x0/0x16c
[] show_stack+0x10/0x1c
[] dump_stack+0x74/0x98
[] warn_slowpath_common+0x84/0xac
[] warn_slowpath_null+0x14/0x20
[] __irq_set_handler+0x134/0x13c
[] gic_irq_domain_map+0x4c/0xac
[] gic_irq_domain_alloc+0x60/0x88
[] gicv2m_domain_alloc+0x30/0xa8
[] __irq_domain_alloc_irqs+0x144/0x30c
[] gicv2m_setup_msi_irq+0xc0/0x118
[] arch_setup_msi_irq+0x34/0x60
[] arch_setup_msi_irqs+0x50/0xb0
[] pci_enable_msix+0x310/0x39c
[] pci_enable_msix_range+0x34/0x9c
>   set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN);
>   } else {
> - irq_set_chip_and_handler(irq, _chip,
> -  handle_fasteoi_irq);
> + irq_set_handler(irq, handle_fasteoi_irq);
>   set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
>  
>   gic_routable_irq_domain_ops->map(d, irq, hw);
>   }
> - irq_set_chip_data(irq, d->host_data);
>   return 0;
>  }
>  
> @@ -814,8 +812,6 @@ static int gic_irq_domain_xlate(struct irq_domain *d,
>  {
>   unsigned long ret = 0;
>  
> - if (d->of_node != controller)
> - return -EINVAL;
>   if (intsize < 3)
>   return -EINVAL;
>  
> @@ -858,6 +854,42 @@ static struct notifier_block gic_cpu_notifier = {
>  };
>  #endif
>  
> +static int gic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs, void *arg)
> +{
> + int i, ret;
> + irq_hw_number_t hwirq;
> + unsigned int type = IRQ_TYPE_NONE;
> + struct of_phandle_args *irq_data = arg;
> +
> + ret = gic_irq_domain_xlate(domain, irq_data->np, irq_data->args,
> +irq_data->args_count, , );
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < nr_irqs; i++)
> + gic_irq_domain_map(domain, virq+i, hwirq+i);
> +
> + return 0;
> +}
> +
> +static void gic_irq_domain_free(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs)
> +{
> + int i;
> +
> + for (i = 0; i < nr_irqs; i++) {
> + irq_set_handler(virq + i, NULL);
> + irq_domain_set_hwirq_and_chip(domain, virq + i, 0, NULL, NULL);
> + }
> +}
> +
> +static const struct irq_domain_ops gic_irq_domain_hierarchy_ops = {
> + .xlate = gic_irq_domain_xlate,
> + .alloc = gic_irq_domain_alloc,
> + .free = gic_irq_domain_free,
> +};
> +
>  static const struct irq_domain_ops gic_irq_domain_ops = {
>   .map = gic_irq_domain_map,
>   .unmap = gic_irq_domain_unmap,
> @@ -948,18 +980,6 @@ void __init gic_init_bases(unsigned int gic_nr, int 
> irq_start,
>   gic_cpu_map[i] = 0xff;
>  
>   /*
> -  * For primary GICs, skip over SGIs.
> -  * For secondary GICs, skip over PPIs, too.
> -  */
> - if (gic_nr == 0 && (irq_start & 31) > 0) {
> - hwirq_base = 16;
> - if (irq_start != -1)
> - irq_start = (irq_start & ~31) + 16;
> - } else {
> - hwirq_base = 32;
> - }
> 

Re: [PATCH v8 4/8] ARM: dts: Enable Broadcom Cygnus SoC

2014-11-08 Thread Olof Johansson
On Sat, Nov 8, 2014 at 10:13 PM, Scott Branden  wrote:
> On 14-11-08 04:22 PM, Olof Johansson wrote:
>>
>> Hi,
>>
>> A bunch of small comments below, should be quick to fix.
>>
>> On Tue, Oct 28, 2014 at 12:53 PM, Scott Branden 
>> wrote:
>>>
>>> DT files to enable cygnus consisting on reference designs
>>> and cygnus core configuration.
>>>
>>> Reviewed-by: Ray Jui 
>>> Reviewed-by: Arun Parameswaran 
>>> Tested-by: Jonathan Richardson 
>>> Reviewed-by: JD (Jiandong) Zheng 
>>> Signed-off-by: Scott Branden 
>>> ---
>>>   arch/arm/boot/dts/Makefile  |4 ++
>>>   arch/arm/boot/dts/bcm-cygnus-clock.dtsi |   73 ++
>>>   arch/arm/boot/dts/bcm-cygnus.dtsi   |  100
>>> +++
>>>   arch/arm/boot/dts/bcm911360_entphn.dts  |   32 ++
>>>   arch/arm/boot/dts/bcm911360k.dts|   32 ++
>>>   arch/arm/boot/dts/bcm958300k.dts|   32 ++
>>>   6 files changed, 273 insertions(+)
>>>   create mode 100644 arch/arm/boot/dts/bcm-cygnus-clock.dtsi
>>>   create mode 100644 arch/arm/boot/dts/bcm-cygnus.dtsi
>>>   create mode 100644 arch/arm/boot/dts/bcm911360_entphn.dts
>>>   create mode 100644 arch/arm/boot/dts/bcm911360k.dts
>>>   create mode 100644 arch/arm/boot/dts/bcm958300k.dts
>>>
>>> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
>>> index 38c89ca..4b3a590 100644
>>> --- a/arch/arm/boot/dts/Makefile
>>> +++ b/arch/arm/boot/dts/Makefile
>>> @@ -54,6 +54,10 @@ dtb-$(CONFIG_ARCH_AT91)  += at91-sama5d4ek.dtb
>>>   dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
>>>   dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
>>>   dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
>>> +dtb-$(CONFIG_ARCH_BCM_CYGNUS) += \
>>> +   bcm911360_entphn.dtb \
>>> +   bcm911360k.dtb \
>>> +   bcm958300k.dtb
>>>   dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
>>>   dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
>>>   dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \
>>
>>
>> Please add new entries in alphabetical/alphanumerical order. Also,
>> first entry is commonly added on the first line
>>
>>
>>> diff --git a/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
>>> b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
>>> new file mode 100644
>>> index 000..d06172b
>>> --- /dev/null
>>> +++ b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
>>> @@ -0,0 +1,73 @@
>>> +/*
>>> + * Copyright 2014 Broadcom Corporation.  All rights reserved.
>>> + *
>>> + * Unless you and Broadcom execute a separate written software license
>>> + * agreement governing use of this software, this software is licensed
>>> to you
>>> + * under the terms of the GNU General Public License as
>>> + * published by the Free Software Foundation version 2.
>>> + *
>>> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
>>> + * kind, whether express or implied; without even the implied warranty
>>> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> + * GNU General Public License for more details.
>>
>>
>> We ask for new DT contents to be added with dual BSD/GPL license, to
>> allow for reuse of the DT data structures in other projects as well.
>> There's currently a lot of activity going on relicensing the current
>> files so I recommend sorting it out before they are added if you can.
>
>
> This may take more time than you think.  I am going to have to go through
> legal to get such a license created. Also, why would you need dual license?
> If it is BSD that should serve both purposes?

I haven't followed the discussion close enough to know if there's been
discussion about single-license BSD vs dual BSD/GPL.

At the very least, please start the process of getting it changed.

Also, I see now that this isn't even a clean GPL v2, given "Unless you
and Broadcom..." language. I see the bnx2x driver had that in the
past, but none of the Kona contributions did. I strongly suggest
sticking to the normal copyrights here and not making things more
complicated than they have to.


-Olof
--
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/


[GIT PULL] irqchip: Core changes for v3.19

2014-11-08 Thread Jason Cooper
Thomas,

This is a little smaller than I usual send, but I'm trying to keep on
top of it with everything else I have going on.  These changes have been
in -next for at least 4 builds of -next.

Please pull.

thx,

Jason.


The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:

  Linux 3.18-rc1 (2014-10-19 18:08:38 -0700)

are available in the git repository at:

  git://git.infradead.org/users/jcooper/linux.git tags/irqchip-core-3.19

for you to fetch changes up to 1dacf194b1468546a5715db58cbb65d50b598482:

  irqchip: irq-armada-370-xp: Use proper return value for ->set_affinity() 
(2014-11-09 03:56:37 +)


irqchip core changes for v3.19

 - hip04
- Convert a straggler to handle_domain_irq()

 - dw-apb-ictl
- Select GENERIC_IRQ_CHIP

 - armada-370-xp
- Use proper return value for ->set_affinity()


Jisheng Zhang (1):
  irqchip: dw-apb-ictl: Select GENERIC_IRQ_CHIP

Marc Zyngier (1):
  irqchip: hip04: Convert to handle_domain_irq

Thomas Petazzoni (1):
  irqchip: irq-armada-370-xp: Use proper return value for ->set_affinity()

 drivers/irqchip/Kconfig | 1 +
 drivers/irqchip/irq-armada-370-xp.c | 2 +-
 drivers/irqchip/irq-hip04.c | 3 +--
 3 files changed, 3 insertions(+), 3 deletions(-)
--
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 v8 4/8] ARM: dts: Enable Broadcom Cygnus SoC

2014-11-08 Thread Scott Branden

On 14-11-08 04:22 PM, Olof Johansson wrote:

Hi,

A bunch of small comments below, should be quick to fix.

On Tue, Oct 28, 2014 at 12:53 PM, Scott Branden  wrote:

DT files to enable cygnus consisting on reference designs
and cygnus core configuration.

Reviewed-by: Ray Jui 
Reviewed-by: Arun Parameswaran 
Tested-by: Jonathan Richardson 
Reviewed-by: JD (Jiandong) Zheng 
Signed-off-by: Scott Branden 
---
  arch/arm/boot/dts/Makefile  |4 ++
  arch/arm/boot/dts/bcm-cygnus-clock.dtsi |   73 ++
  arch/arm/boot/dts/bcm-cygnus.dtsi   |  100 +++
  arch/arm/boot/dts/bcm911360_entphn.dts  |   32 ++
  arch/arm/boot/dts/bcm911360k.dts|   32 ++
  arch/arm/boot/dts/bcm958300k.dts|   32 ++
  6 files changed, 273 insertions(+)
  create mode 100644 arch/arm/boot/dts/bcm-cygnus-clock.dtsi
  create mode 100644 arch/arm/boot/dts/bcm-cygnus.dtsi
  create mode 100644 arch/arm/boot/dts/bcm911360_entphn.dts
  create mode 100644 arch/arm/boot/dts/bcm911360k.dts
  create mode 100644 arch/arm/boot/dts/bcm958300k.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 38c89ca..4b3a590 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -54,6 +54,10 @@ dtb-$(CONFIG_ARCH_AT91)  += at91-sama5d4ek.dtb
  dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
  dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
  dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
+dtb-$(CONFIG_ARCH_BCM_CYGNUS) += \
+   bcm911360_entphn.dtb \
+   bcm911360k.dtb \
+   bcm958300k.dtb
  dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
  dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
  dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \


Please add new entries in alphabetical/alphanumerical order. Also,
first entry is commonly added on the first line



diff --git a/arch/arm/boot/dts/bcm-cygnus-clock.dtsi 
b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
new file mode 100644
index 000..d06172b
--- /dev/null
+++ b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 Broadcom Corporation.  All rights reserved.
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed to you
+ * under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.


We ask for new DT contents to be added with dual BSD/GPL license, to
allow for reuse of the DT data structures in other projects as well.
There's currently a lot of activity going on relicensing the current
files so I recommend sorting it out before they are added if you can.


This may take more time than you think.  I am going to have to go 
through legal to get such a license created.  Also, why would you need 
dual license?  If it is BSD that should serve both purposes?



+ */
+
+clocks {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+
+   osc: oscillator {
+   compatible = "fixed-clock";
+   #clock-cells = <1>;
+   clock-frequency = <2500>;
+   };
+
+   apb_clk: apb_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <10>;
+   };
+
+   periph_clk: periph_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <5>;
+   };
+
+   sdio_clk: lcpll_ch2 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2>;
+   };
+
+   axi81_clk: axi81_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <1>;
+   };
+
+   keypad_clk: keypad_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <31806>;
+   };
+
+   adc_clk: adc_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <1562500>;
+   };
+
+   pwm_clk: pwm_clk {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <100>;
+   };
+
+   lcd_clk: mipipll_ch1 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <1>;
+   };
+};
diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi 
b/arch/arm/boot/dts/bcm-cygnus.dtsi
new file mode 100644
index 000..9c650ab
--- /dev/null
+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
@@ -0,0 

Re: [PATCH v5 0/6] ARM: mediatek: Add support for interrupt polarity

2014-11-08 Thread Jason Cooper
Thomas, Marc,

Could I get Acks for the core changes and gic changes when you have
a moment?

thx,

Jason.

On Wed, Oct 29, 2014 at 06:00:18PM +0800, Yingjoe Chen wrote:
> This series is 5th version of interrupt polarity support for MediaTek SoCs.
> This is based on Jiang's hierarchy irqdomain p2v3 [1], which is based on 
> v3.18-rc2, and my mediatek SoC basic support [2].
> 
> Besides changing base, this version addressed comments from Thomas and Marc
> and also fix a bug on mt6589 reported by Matthias.
> 
> In Jiang's version of irq_create_of_mapping, if irqdomain is hierarchy, it
> will not perform irq_find_mapping check and set_type. The outermost
> irqdomain need to take care of that. Because we will have several different
> outermost irqdomain in different ARM SoCs, this cause code duplication. I
> moved them back to irq_create_of_mapping.
> 
> Simplified block diagram for interrupt on my system:
> 
> +---+  +---+
>  ---| SYSIRQ|--|ARM GIC|
>  ---|   |--|   |
>  ---|   |--|   |
>  ---|   |--|   |
>  ---|   |--|   |
> +---+  +---+
> 
> In device tree, interrupt-parent for other devices is sysirq, child of gic.
> This describe HW better and allow device to specify polarity as it is sent
> by the device.
> 
> When using hierarchy irq domain, gic will use irq_domain_add_linear to
> create irqdomain and all interrupt numbers must come from device tree. My
> /proc/interrupts looks like this now:
> 
> # cat /proc/interrupts
>CPU0
>  16: 149578  MT_SYSIRQ 113  mtk_timer
>  20:   1082  MT_SYSIRQ  54  serial
> 
> Changes in v5:
>  - Fix bug on mt6589 reported by Matthias
>  - Fix bug for irq_find_mapping in irq_create_of_mapping
>  - Merge Marc's change to proper handle non-DT case in gic_init_bases
> 
> Changes in v4:
>  - Discussed in [3]
>  - Remove arm,hierarchy-irq-domain. When GIC is probed by DT, it will
> support hierarchy irqdomain.
> 
> Changes in v3:
>  - Discussed in [4]
>  - First implementation using hierarchy irqdomain
> 
> [1] 
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/297624.html
> [2] 
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/296093.html
> [3] 
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/296911.html
> [4] 
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/293766.html
> 
> 
> Yingjoe Chen (6):
>   irqdomain: do irq_find_mapping and set_type for hierarchy irqdomain
>   genirq: Add more helper functions to support stacked irq_chip
>   irqchip: gic: Support hierarchy irq domain.
>   ARM: mediatek: Add sysirq interrupt polarity support
>   ARM: mediatek: Add sysirq in mt6589/mt8135/mt8127 dtsi
>   dt-bindings: add bindings for mediatek sysirq
> 
>  .../bindings/arm/mediatek/mediatek,sysirq.txt  |  26 
>  arch/arm/boot/dts/mt6589.dtsi  |  14 +-
>  arch/arm/boot/dts/mt8127.dtsi  |  14 +-
>  arch/arm/boot/dts/mt8135.dtsi  |  14 +-
>  drivers/irqchip/Kconfig|   1 +
>  drivers/irqchip/Makefile   |   1 +
>  drivers/irqchip/irq-gic.c  |  90 +++
>  drivers/irqchip/irq-mtk-sysirq.c   | 168 
> +
>  include/linux/irq.h|   6 +
>  kernel/irq/chip.c  |  28 
>  kernel/irq/irqdomain.c |  27 ++--
>  11 files changed, 348 insertions(+), 41 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/arm/mediatek/mediatek,sysirq.txt
>  create mode 100644 drivers/irqchip/irq-mtk-sysirq.c
> 
--
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] scripts/ksize: Add kernel build size report

2014-11-08 Thread Darren Hart


On 11/8/14 19:26, Josh Triplett wrote:
> On Sat, Nov 08, 2014 at 03:18:18PM -0800, Darren Hart wrote:
>> ksize generates hierarchical build size reports from vmlinux, *.o, and
>> built-in.o files.
>>
>> ksize is useful in preparing minimal configurations and comparing
>> similar configurations across kernel versions.
>>
>> Signed-off-by: Darren Hart 
>> Cc: Josh Triplett 
> 
> One comment below; with that addressed:
> Reviewed-by: Josh Triplett 
> 
>> +def main(argv):
>> +try:
>> +opts, args = getopt.getopt(argv[1:], "dh", ["help"])
>> +except getopt.GetoptError, err:
>> +print '%s' % str(err)
>> +usage()
>> +return 2
>> +
>> +driver_detail = False
>> +for o, a in opts:
>> +if o == '-d':
>> +driver_detail = True
>> +elif o in ('-h', '--help'):
>> +usage()
>> +return 0
>> +else:
>> +assert False, "unhandled option"
>> +
>> +cols = term_width()
>> +
>> +# Determine kernel version
>> +p = Popen("strings vmlinux | grep 'Linux version' | cut -d ' ' -f 3",
>> +  shell=True, stdout=PIPE, stderr=PIPE)
>> +version = p.communicate()[0].strip()
> 
> This seems like a very fragile, Perl-y way to obtain the kernel version.
> 
> I'd suggest either not including the version (just as bloat-o-meter
> doesn't), or parsing it out using objdump -h -t and file offsetting
> (looking for the offset and size of linux_banner).  Personally I'd go
> with the former.

I agree it's a hack, but it isn't a performance sensitive area and I
couldn't see spending the time to calculate offsets and such to save a
couple seconds for something like this. There are more advanced
approaches to extracting bits of information from vmlinux, such as
scripts/extract-ikconfig. I suppose something along those lines could be
created.

As to fragile, I have not tested every version, but this technique has
been used at least as far back as 2.6.24 [1], which seem fairly stable
to me.

Personally, I think it's nice to have. But, if nobody chimes in asking
to keep it, or with a better way to retrieve it, I can resend with it
removed.

Thanks Josh :-)

1.
http://plastilinux.blogspot.com/2009/11/how-to-know-version-of-kernel-without.html
(A slightly faster hack)

-- 
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 v2 0/5] irqchip: atmel-aic: add RTT irq fixup

2014-11-08 Thread Jason Cooper
On Mon, Nov 03, 2014 at 09:30:59AM +0100, Boris Brezillon wrote:
> Hello,
> 
> This patch series add a new fixup function for the RTT (Real Time Timer)
> block and make use of it on SoCs integrating at least one RTT to prevent
> spurious interrupts on the first interrupt line.
> 
> This fixup function was previously implemented in
> arch/arm/mach-at91/sysirq_mask.c, but is now moved to the AIC driver so
> that we can remove SoC specific hooks in arch/arm/mach-at91/ when booting
> a DT kernel.
> 
> This series also reworks the naming convention of the SoC specific fixup
> functions and add an entry for the at91rm9200.
> 
> Best Regards,
> 
> Boris
> 
> Changes since v1:
> - rebased on linux-3.18-rc2
> 
> Boris BREZILLON (5):
>   irqchip: atmel-aic: add irq fixup for RTT block
>   irqchip: atmel-aic: add irq fixups for at91sam926x SoCs
>   irqchip: atmel-aic: add specific irq fixup function for sam9g45 and
> sam9rl
>   irqchip: atmel-aic: rename at91sam9_aic_irq_fixup for naming
> consistency
>   irqchip: atmel-aic: add missing entry for rm9200 irq fixups
> 
>  drivers/irqchip/irq-atmel-aic-common.c | 26 ++
>  drivers/irqchip/irq-atmel-aic-common.h |  2 ++
>  drivers/irqchip/irq-atmel-aic.c| 26 +-
>  3 files changed, 49 insertions(+), 5 deletions(-)

Whole series applied to irqchip/atmel

thx,

Jason.
--
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: Early test: hangs in mm/compact.c w. Linus's 12d7aacab56e9ef185c

2014-11-08 Thread Hillf Danton
> > Can you please try the following patch?
> > --- a/mm/compaction.c
> > +++ b/mm/compaction.c
> > @@ -1325,13 +1325,6 @@ unsigned long try_to_compact_pages(struct zonelist
> > -   compaction_defer_reset(zone, order, false);
> 
> NACK :(
> 
> I just got again into a state that some task was spinning out of control, and
> blocking the rest of the desktop.
> 
Would you please try the diff(against 3.18-rc3) if no other progress?

--- a/mm/compaction.c   Sun Nov  9 12:02:59 2014
+++ b/mm/compaction.c   Sun Nov  9 12:07:30 2014
@@ -1070,12 +1070,12 @@ static int compact_finished(struct zone 
if (cc->order == -1)
return COMPACT_CONTINUE;
 
-   /* Compaction run is not finished if the watermark is not met */
+   /* Compaction run is skipped if the watermark is not met */
watermark = low_wmark_pages(zone);
watermark += (1 << cc->order);
 
if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0))
-   return COMPACT_CONTINUE;
+   return COMPACT_SKIPPED;
 
/* Direct compactor: Is a suitable page free? */
for (order = cc->order; order < MAX_ORDER; order++) {
--

> You will see me trying a few things, apparently the first OOM managed to
> unblock something, but a few seconds later the system "stepped" on some other
> blocking task.
> 
> See attached log, it may only give you some hint; the problem could well be in
> some other part of the kernel.
> 
> In the meanwhile, I'm pulling linus/master ...
> 
> SysRq : Show backtrace of all active CPUs
> sending NMI to all CPUs:
> NMI backtrace for cpu 1
> CPU: 1 PID: 13544 Comm: python Not tainted 3.18.0-rc3+ #46
> Hardware name: AcerTravelMate 5720/Columbia   
> , BIOS V1.34   04/15/2008
> task: 88000c78ee40 ti: 88000e5f8000 task.ti: 88000e5f8000
> RIP: 0010:[]  [] delay_tsc+0x28/0xa2
> RSP: :8800bf303b28  EFLAGS: 0002
> RAX: 6bd322e8 RBX: 2710 RCX: 0007
> RDX: 021d RSI: 8151623e RDI: 8152fea5
> RBP: 8800bf303b48 R08: 0400 R09: 
> R10: 0046 R11: 0046 R12: 00185ac0
> R13: 0001 R14: 0001 R15: 81668f90
> FS:  7f1570ed1700() GS:8800bf30() knlGS:
> CS:  0010 DS:  ES:  CR0: 8005003b
> CR2: 7f7cd966b000 CR3: 740c9000 CR4: 07e0
> Stack:
>  2710 0003 006c 0001
>  8800bf303b58 811df814 8800bf303b68 811df83d
>  8800bf303b88 81025de1 80010002 816692b0
> Call Trace:
>  
> 
>  [] __delay+0xa/0xc
>  [] __const_udelay+0x27/0x29
>  [] arch_trigger_all_cpu_backtrace+0xa8/0xd2
>  [] sysrq_handle_showallcpus+0xe/0x10
>  [] __handle_sysrq+0x94/0x126
>  [] sysrq_filter+0xee/0x287
>  [] input_to_handler+0x5e/0xcb
>  [] input_pass_values.part.3+0x76/0x134
>  [] input_handle_event+0x457/0x46d
>  [] input_event+0x55/0x6f
>  [] input_sync+0xf/0x11
>  [] atkbd_interrupt+0x4d5/0x595
>  [] serio_interrupt+0x43/0x7d
>  [] i8042_interrupt+0x292/0x2a8
>  [] ? tick_sched_do_timer+0x33/0x33
>  [] handle_irq_event_percpu+0x44/0x19f
>  [] handle_irq_event+0x3c/0x5c
>  [] ? apic_eoi+0x18/0x1a
>  [] handle_edge_irq+0x95/0xae
>  [] handle_irq+0x158/0x16d
>  [] ? get_parent_ip+0xe/0x3e
>  [] do_IRQ+0x58/0xda
>  [] common_interrupt+0x6a/0x6a
>  
> 
>  [] ? rcu_read_unlock_sched_notrace+0x17/0x17
>  [] ? compact_zone+0x2a8/0x4b2
>  [] compact_zone_order+0x4c/0x5f
>  [] try_to_compact_pages+0xc4/0x1d6
>  [] __alloc_pages_direct_compact+0x61/0x1bf
>  [] __alloc_pages_nodemask+0x409/0x799
>  [] ? anon_vma_prepare+0xf5/0x12c
>  [] do_huge_pmd_anonymous_page+0x13c/0x255
>  [] ? mmap_region+0x171/0x458
>  [] handle_mm_fault+0x112/0x808
>  [] __do_page_fault+0x27a/0x358
>  [] ? do_mmap_pgoff+0x2b8/0x306
>  [] ? vm_mmap_pgoff+0x82/0xaa
>  [] ? SyS_mmap_pgoff+0x183/0x1cf
>  [] do_page_fault+0xc/0xe
>  [] page_fault+0x22/0x30
> Code: ff 5d c3 55 48 89 e5 41 56 41 55 41 54 41 89 fc bf 01 00 00 00 53 e8 f7 
> 6f e7 ff e8 9a 9c 00 00 41 89 c5 0f 1f 00 0f ae e8 0f 31 <89> c3 0f
> 1f 00 0f ae e8 0f 31 48 c1 e2 20 89 c0 48 09 c2 41 89
> NMI backtrace for cpu 0
> CPU: 0 PID: 13788 Comm: net_applet Not tainted 3.18.0-rc3+ #46
> Hardware name: AcerTravelMate 5720/Columbia   
> , BIOS V1.34   04/15/2008
> task: 8800067a3720 ti: 88000e20c000 task.ti: 88000e20c000
> RIP: 0010:[]  [] compact_zone+0x3c4/0x4b2
> RSP: :88000e20fa18  EFLAGS: 0202
> RAX:  RBX: 8168be40 RCX: 0008
> RDX: 0380 RSI: 0009 RDI: 8168be40
> RBP: 88000e20fa78 R08:  R09: fef5
> R10: 0038 R11: 8168be40 R12: 000bf800
> R13: 000bf600 R14: 

Systemd Blues. A lyrical song that says Fuck SystemD, no harm Ment Mr. Poettering

2014-11-08 Thread Brad Townshend
Systemd Blues. A lyrical song accompanied by some drum and a heavy thick bass 
line
that's been laid down like tar during a southern snow storm,
that says Fuck SystemD, no harm Ment Mr. Poettering (who is an important man)

http://youtu.be/y0aTqsl-vfU

Please discuss.
Best Regards.

Fuck Systemd.
--
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 V4 00/14] genirq endian fixes; bcm7120/brcmstb IRQ updates

2014-11-08 Thread Jason Cooper
On Fri, Nov 07, 2014 at 07:27:45AM -0500, Jason Cooper wrote:
> Thomas,
> 
> On Thu, Nov 06, 2014 at 10:44:15PM -0800, Kevin Cernekee wrote:
> > V3->V4:
> > 
> >  - Fix buildbot bisectability warning on patch 02/14 (missing include)
> 
> Dammit.  :(  Even if I had created a topic branch for this series, I
> still would have put the genirq changes in /core, then based a brcm
> branch off of that.
> 
> I'm inclined to think I should just drop v3 and apply v4, as a revert
> commit wouldn't solve the bisectability issue.

Ok, no complaints, so it's done.

thx,

Jason.
--
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 Part2 v5 21/31] PCI/MSI: Enhance core to support hierarchy irqdomain

2014-11-08 Thread Suravee Suthikulpanit

Hi Gerry,

Please see my comments / questions below.

On 11/6/14 21:20, Jiang Liu wrote:

Enhance PCI MSI core to support hierarchy irqdomain, so the common
code could be shared among architectures.

Signed-off-by: Jiang Liu 
---
Hi Thomas,
These changes are a temporary solution, I'm working on another
patch set which will refine these interfaces, especially kill
arch_msi_irq_domain_{set|get}_hwirq().
Regards!
Gerry


Would the change includes the struct irqdomain_msi_data proposed by 
Thomas here (https://lkml.org/lkml/2014/11/6/210)?



[...]
+static int msi_domain_alloc(struct irq_domain *domain, unsigned int virq,
+   unsigned int nr_irqs, void *arg)
+{
+   int i, ret;
+   irq_hw_number_t hwirq = arch_msi_irq_domain_get_hwirq(arg);
+
+   if (irq_find_mapping(domain, hwirq) > 0)
+   return -EEXIST;
+
+   ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, arg);
+   if (ret < 0)
+   return ret;
+


When executing irq_domain_alloc_irqs_parent(), it triggers the following 
warning message due to


WARN_ON(desc->irq_data.chip == _irq_chip)

[ cut here ]
WARNING: CPU: 2 PID: 912 at kernel/irq/chip.c:734 
__irq_set_handler+0x138/0x13c()

Modules linked in: mlx4_core(+) rtc_efi efivarfs
CPU: 2 PID: 912 Comm: modprobe Not tainted 3.18.0-rc3-p2v5+ #53
Call trace:
[] dump_backtrace+0x0/0x16c
[] show_stack+0x10/0x1c
[] dump_stack+0x74/0x98
[] warn_slowpath_common+0x84/0xac
[] warn_slowpath_null+0x14/0x20
[] __irq_set_handler+0x134/0x13c
[] gic_irq_domain_map+0x4c/0xac
[] gic_irq_domain_alloc+0x60/0x88
[] gicv2m_domain_alloc+0x30/0xa8
[] __irq_domain_alloc_irqs+0x144/0x30c
[] gicv2m_setup_msi_irq+0xc0/0x118
[] arch_setup_msi_irq+0x34/0x60
[] arch_setup_msi_irqs+0x50/0xb0
[] pci_enable_msix+0x310/0x39c
[] pci_enable_msix_range+0x34/0x9c


However, I think if we call irq_domain_set_hwirq_and_chip() in the 
msi_create_irq_domain() as suggested by Thomas, that should also fix 
this issue.



+   for (i = 0; i < nr_irqs; i++) {
+   irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
+ domain->host_data,
+ (void *)(long)i);
+   __irq_set_handler(virq + i, handle_edge_irq, 0, "edge");
+   }


Is there are a way to specify other type of handler besides edge?


[...]
+static void msi_domain_activate(struct irq_domain *domain,
+   struct irq_data *irq_data)
+{
+   struct msi_msg msg;
+
+   /*
+* irq_data->chip_data is MSI/MSI-X offset.
+* MSI-X message is written per-IRQ, the offset is always 0.
+* MSI message denotes a contiguous group of IRQs, written for 0th IRQ.
+*/
+   if (irq_data->chip_data)
+   return;


Actually, I am a bit confused with this comment here.  If you look at 
"/drivers/pci/msi.c: arch_setup_msi_irq()", it calls 
irq_set_chip_data(des->irq, chip) where chip is *msi_chip.


It looks like if the arch uses this API, it would conflict with what you 
have here where the irq_data->chip_data would be not NULL at the logic 
above, and would always return.


Thank you,

Suravee
--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Josh Triplett
On Sat, Nov 08, 2014 at 12:49:29PM -0800, Joe Perches wrote:
> On Sat, 2014-11-08 at 11:01 -0800, Josh Triplett wrote:
> > On Sat, Nov 08, 2014 at 08:37:27PM +0200, Oded Gabbay wrote:
> > >  CREDITS |  7 +++
> > >  MAINTAINERS | 10 ++
> > >  2 files changed, 17 insertions(+)
> > 
> > Given the wide variety of folks who patch CREDITS and MAINTAINERS, might
> > I suggest adding CREDITS and MAINTAINERS themselves to the MAINTAINERS
> > file (perhaps in the same entry as get_maintainer.pl), so that
> > get_maintainer.pl does not fall back to git history for them?
> 
> Thanks but:
> 
> There is no MAINTAINERS/CREDITS maintainer.
> 
> I'm not volunteering.

Oh, I thought from all your work on file patterns and other such
improvements that you were the de-facto MAINTAINERS maintainer.

> Maybe you?

No thank you.

> But maybe something like this would help:
> 
> It has to have both an M: and an S: entry
> with maintained or supported to stop get_maintainers
> from doing a git history lookup.
> 
> ---
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0662378..584fd69 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5881,6 +5881,12 @@ F: drivers/mailbox/
>  F:   include/linux/mailbox_client.h
>  F:   include/linux/mailbox_controller.h
>  
> +MAINTAINERS/CREDITS
> +M:   linux-kernel@vger.kernel.org
> +S:   Maintained
> +F:   MAINTAINERS
> +F:   CREDITS

Sending something only to LKML seems likely to go un-noticed.  I think
we need a better solution than this.

- Josh Triplett
--
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] drivers: staging: lustre: Kconfig: Let LUSTRE_LLITE_LLOOP depend on all !"*_64K*" page

2014-11-08 Thread Chen Gang
It does not support 64K page, so let it disabled for 64K page under all
architectures. The related error (with allmodconfig under tile):

CC [M]  drivers/staging/lustre/lustre/llite/lloop.o
  In file included from 
drivers/staging/lustre/lustre/llite/../include/../../include/linux/libcfs/libcfs.h:160:0,
   from 
drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:52,
   from drivers/staging/lustre/lustre/llite/lloop.c:106:
  drivers/staging/lustre/lustre/llite/lloop.c: In function 'loop_set_fd':
  
drivers/staging/lustre/lustre/llite/../include/../../include/linux/libcfs/libcfs_private.h:411:54:
 error: duplicate case value
   #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } 
while (0)
^
  drivers/staging/lustre/lustre/llite/lloop.c:525:2: note: in expansion of 
macro 'CLASSERT'
CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8)));
^
  
drivers/staging/lustre/lustre/llite/../include/../../include/linux/libcfs/libcfs_private.h:411:41:
 error: previously used here
   #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } 
while (0)
   ^
  drivers/staging/lustre/lustre/llite/lloop.c:525:2: note: in expansion of 
macro 'CLASSERT'
CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8)));
^

Use "find ./ | grep Kconfig | xargs grep --color 64K" to find all 64K
page macros.


Signed-off-by: Chen Gang 
---
 drivers/staging/lustre/lustre/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/Kconfig 
b/drivers/staging/lustre/lustre/Kconfig
index 4f65ba1..6725467 100644
--- a/drivers/staging/lustre/lustre/Kconfig
+++ b/drivers/staging/lustre/lustre/Kconfig
@@ -57,5 +57,5 @@ config LUSTRE_TRANSLATE_ERRNOS
 config LUSTRE_LLITE_LLOOP
tristate "Lustre virtual block device"
depends on LUSTRE_FS && BLOCK
-   depends on !PPC_64K_PAGES && !ARM64_64K_PAGES
+   depends on !PPC_64K_PAGES && !ARM64_64K_PAGES && !MICROBLAZE_64K_PAGES 
&& !PAGE_SIZE_64KB && !IA64_PAGE_SIZE_64KB && !PARISC_PAGE_SIZE_64KB
default m
-- 
1.9.3
--
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/2] arm: dts: zynq: Move crystal freq. to board level

2014-11-08 Thread Peter Crosthwaite
The fact that all supported boards use the same 33MHz crystal is a
co-incidence. The Zynq PS support a range of crystal freqs so the
hardcoded setting should be removed from the dtsi. Re-implement it
on the board level.

This prepares support for Zynq boards with different crystal
frequencies (e.g. the Digilent ZYBO).

Signed-off-by: Peter Crosthwaite 

---
Im guessing long term this should be converted to a fixed clock. But
I think this at least steps in that direction.
---
 arch/arm/boot/dts/zynq-7000.dtsi  | 1 -
 arch/arm/boot/dts/zynq-parallella.dts | 4 
 arch/arm/boot/dts/zynq-zc702.dts  | 4 
 arch/arm/boot/dts/zynq-zc706.dts  | 4 
 arch/arm/boot/dts/zynq-zed.dts| 4 
 5 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index ce2ef5b..ee3e5d6 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -243,7 +243,6 @@
clkc: clkc@100 {
#clock-cells = <1>;
compatible = "xlnx,ps7-clkc";
-   ps-clk-frequency = <>;
fclk-enable = <0>;
clock-output-names = "armpll", "ddrpll", 
"iopll", "cpu_6or4x",
"cpu_3or2x", "cpu_2x", 
"cpu_1x", "ddr2x", "ddr3x",
diff --git a/arch/arm/boot/dts/zynq-parallella.dts 
b/arch/arm/boot/dts/zynq-parallella.dts
index e1f51ca..cd84d45 100644
--- a/arch/arm/boot/dts/zynq-parallella.dts
+++ b/arch/arm/boot/dts/zynq-parallella.dts
@@ -83,3 +83,7 @@
  {
status = "okay";
 };
+
+ {
+   ps-clk-frequency = <>;
+};
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 94e2cda..24dcece 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -135,3 +135,7 @@
  {
status = "okay";
 };
+
+ {
+   ps-clk-frequency = <>;
+};
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
index a8bbdfb..7b88399 100644
--- a/arch/arm/boot/dts/zynq-zc706.dts
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -114,3 +114,7 @@
  {
status = "okay";
 };
+
+ {
+   ps-clk-frequency = <>;
+};
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
index 697779a..4662da2 100644
--- a/arch/arm/boot/dts/zynq-zed.dts
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -46,3 +46,7 @@
  {
status = "okay";
 };
+
+ {
+   ps-clk-frequency = <>;
+};
-- 
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 2/2] arm: dts: zynq: Add Digilent ZYBO board

2014-11-08 Thread Peter Crosthwaite
Add a DTS describing the Digilent ZYBO board. Similar to ZED but with
a 50MHz crystal instead of 33MHz.

Signed-off-by: Peter Crosthwaite 
---
 arch/arm/boot/dts/Makefile  |  3 ++-
 arch/arm/boot/dts/zynq-zybo.dts | 52 +
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/zynq-zybo.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index d872062..e5e77f3 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -500,7 +500,8 @@ dtb-$(CONFIG_ARCH_ZYNQ) += \
zynq-parallella.dtb \
zynq-zc702.dtb \
zynq-zc706.dtb \
-   zynq-zed.dtb
+   zynq-zed.dtb \
+   zynq-zybo.dtb
 dtb-$(CONFIG_MACH_ARMADA_370) += \
armada-370-db.dtb \
armada-370-mirabox.dtb \
diff --git a/arch/arm/boot/dts/zynq-zybo.dts b/arch/arm/boot/dts/zynq-zybo.dts
new file mode 100644
index 000..b02d9d3
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-zybo.dts
@@ -0,0 +1,52 @@
+/*
+ *  Copyright (C) 2011 - 2014 Xilinx
+ *  Copyright (C) 2012 National Instruments Corp.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+/dts-v1/;
+/include/ "zynq-7000.dtsi"
+
+/ {
+   model = "Zynq ZYBO Development Board";
+   compatible = "xlnx,zynq-zybo", "xlnx,zynq-7000";
+
+   memory {
+   device_type = "memory";
+   reg = <0x0 0x2000>;
+   };
+
+   chosen {
+   bootargs = "console=ttyPS0,115200 earlyprintk";
+   };
+
+};
+
+ {
+   status = "okay";
+   phy-mode = "rgmii-id";
+   phy-handle = <_phy>;
+
+   ethernet_phy: ethernet-phy@0 {
+   reg = <0>;
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   ps-clk-frequency = <5000>;
+};
-- 
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] scripts/ksize: Add kernel build size report

2014-11-08 Thread Josh Triplett
On Sat, Nov 08, 2014 at 03:18:18PM -0800, Darren Hart wrote:
> ksize generates hierarchical build size reports from vmlinux, *.o, and
> built-in.o files.
> 
> ksize is useful in preparing minimal configurations and comparing
> similar configurations across kernel versions.
> 
> Signed-off-by: Darren Hart 
> Cc: Josh Triplett 

One comment below; with that addressed:
Reviewed-by: Josh Triplett 

> +def main(argv):
> +try:
> +opts, args = getopt.getopt(argv[1:], "dh", ["help"])
> +except getopt.GetoptError, err:
> +print '%s' % str(err)
> +usage()
> +return 2
> +
> +driver_detail = False
> +for o, a in opts:
> +if o == '-d':
> +driver_detail = True
> +elif o in ('-h', '--help'):
> +usage()
> +return 0
> +else:
> +assert False, "unhandled option"
> +
> +cols = term_width()
> +
> +# Determine kernel version
> +p = Popen("strings vmlinux | grep 'Linux version' | cut -d ' ' -f 3",
> +  shell=True, stdout=PIPE, stderr=PIPE)
> +version = p.communicate()[0].strip()

This seems like a very fragile, Perl-y way to obtain the kernel version.

I'd suggest either not including the version (just as bloat-o-meter
doesn't), or parsing it out using objdump -h -t and file offsetting
(looking for the offset and size of linux_banner).  Personally I'd go
with the former.

- Josh Triplett
--
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 01/11] crypto: Documentation - crypto API high level spec

2014-11-08 Thread Jason Cooper
Stephan,

On Mon, Nov 03, 2014 at 03:18:29PM +0100, Stephan Mueller wrote:
> Am Montag, 3. November 2014, 08:34:39 schrieb Jonathan Corbet:
> > These are all useful.  But I wonder if it would be worth the effort to turn
> > this inti a proper docbook document that automatically has everything
> > together in one place?
> 
> How do you suggest that is done? The API comments in the header file follow 
> the Doxygen style. Note, Jason Cooper raised the concern that an API 
> documentation separate from the code will surely deviate from the code 
> relatively fast (although I do not really fear that as the kernel crypto API 
> seems to be quite stable over the last years).

Agreed.  My primary concern was adding it in such a way which
facilitates maintenance and keeping it in sync with the code.  But as
you say, the crypto API doesn't change much.

thx,

Jason.
--
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/


Hello

2014-11-08 Thread Thaung Lin Yan

Your partnership is needed for a profitable business transaction involving huge 
amounts of fund please contact me for more details.

---
Uw partnerschap is nodig voor een winstgevende business transactie waarbij 
enorme hoeveelheden fonds kunt u contact met mij op voor meer details.


Ihre Partnerschaft ist für ein profitables Geschäft Transaktion mit riesigen 
Mengen von Fonds kontaktieren Sie mich bitte für weitere Einzelheiten benötig
--
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] dccp: Convert DCCP_WARN to net_warn_ratelimited

2014-11-08 Thread David Miller
From: Joe Perches 
Date: Thu, 06 Nov 2014 12:53:41 -0800

> Remove the dependency on the "warning" sysctl (net_msg_warn)
> which is only used by the LIMIT_NETDEBUG macro.
> 
> Convert the LIMIT_NETDEBUG use in DCCP_WARN to the more
> common net_warn_ratelimited mechanism.
> 
> This still ratelimits based on the net_ratelimit()
> function, but removes the check for the sysctl.
> 
> Signed-off-by: Joe Perches 

Applied, thanks Joe.

> What about the LIMIT_NETDEBUG stuff now?
> 
> Maybe all of them might as well be net_dbg_ratelimited
> even if it changes some of the logging levels.

I think a straight conversion to net_dbg_ratelimited would
be fine.
--
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/7] Security: Provide unioned file support

2014-11-08 Thread Casey Schaufler
On 11/7/2014 10:54 AM, Daniel J Walsh wrote:
> On 11/07/2014 10:21 AM, David Howells wrote:
>> Casey Schaufler  wrote:
>>
> What does this mean?
 It has been decided that for the purposes of docker, all files within the
 docker root fs will have the same label.  We'd have to provide policy
 namespacing otherwise (I think).
>>> That's just insane. "It has been decided" by who? Obviously not people
>>> who care about security policies. Maybe it's good enough for your
>>> particular use case, but labeling of files has to be up to the security
>>> module. That's what the modules are for.
>> It has been decided by the docker people that I've dealt with.  I was
>> expecting there to be different labels throughout a docker image, but
>> apparently not...
> We want the equivalent of the mount option
> context="system_u:object_r:svirt_sandbox_file_t:s0:c1,c2"

Which just means that the policy used in the container is going
to have to grant access to everything running in that container
to that context. That's fine if you want to emasculate your module
within the container. But it requires that you do so, and that is
wrong.

> Which would label all of the content in the OVERLAYFS with this label. 
> If we have to have a readonly label for the lower
> level and a RW Label for the context mount then that is fine with us. 
> The lower level can actually just reveal the label of the INODE.
> We can take care of labeling it with a single label.
>
> If the context="LABEL" (Or its equivalent is not passed), it should get
> some kind of label based on the parent directory I would guess
> or transition rules. 
>
> With docker we want to treat all contents of a container with a single
> label and then separate containers based on MCS(Svirt) separation.

That seems like a limited and rather pointless use case to me.

> What about LSMs that have multiple labels on a file?
 Setting policy is something I'll have to leave to the docker people and the
 administrators of systems that use docker.
>>> What does that mean? If the underlying mechanism can't do the job,
>>> how the dickens is the administrator supposed to make it happen?
>> I'm trying to make the kernel able to support a policy on this at all - not
>> actually write the policy itself.  The policy may well vary depending on the
>> installation anyway.
>>
 But all I'm proposing is a way to give the LSM access to both the file in
 the overlay and the file in the lower fs that is leeching through into the
 overlay.
>>> But your mechanisms are simultaneously incomplete and over specified.
>> Well then, specify better ones!  I'm fairly certain it is incomplete and I'm
>> *trying* to get input on how it may be improved.  I should've marked the
>> patches [RFC] but it didn't occur to me until just after I'd sent them (of
>> course).

I'd love to do so, but I'm frying too many kittens right now
to put the effort required into making this right. I do have
faith that this can be worked out. Sorry that I missed the implicit
[RFC]. It helps to know that feedback is still open.

>>
>> Anyway, there are a number of things one has to take account of:
>>
>>  (1) There may be multiple 'views' or instances of a file in a union - and
>>  each may be labelled differently.
>>
>>  (2) The lower file may have xattrs attached to it that represent the 
>> security
>>  policy.
>>
>>  (3) The union file may have xattrs attached to it that represent the 
>> security
>>  policy.
>>
>>  (4) When copying the lower file up, the xattrs representing the security
>>  attributes of the lower file must not be written as they may incorrectly
>>  overwrite the security attributes of the union file.
>>
>>  (5) There needs to be a way to set the security attributes on the union 
>> file.
>>
>>  (6) When setting the attributes on the union file, the LSM might need to 
>> take
>>  account of the attributes of the lower file in their derivation.
>>
>>  (7) There may be no inode in the union layer on which to hang the attributes
>>  for the upper file.
>>
>>  (8) struct file::f_security should be used to contain the union layer
>>  labellage on open files that point to a lower layer.
>>
>>  (9) Ideally, file->f_path would point to the union layer and file->f_inode 
>> to
>>  the lower layer when there is no upper file.  However, this is not the
>>  case at the moment.  The file struct *only* points to the lower file or
>>  the upper file and never both.
>>
>> (10) Overlayfs has an extra complication in that there are potentially three
>>  files involved in any union.  The lower file that is the source, the
>>  upper file that where the copy-up goes and the virtual union file in the
>>  overlay fs that redirects to one or the other.
>>
>>  I've taken the approach that we assume that the upper file (if it 
>> exists)
>>  has the same labellage as the union file.
>>
>>> Your proposal is a cop out. It may work in a 

[PATCH 4/5] serial: jsm: Replace magic value with the proper define

2014-11-08 Thread Konrad Zapalowicz
The changed function flushes the tx UART and the '4' corresponds to the
UART_FCR_CLEAR_XMIT value. This commit replaces the magic number with
this define.

Signed-off-by: Konrad Zapalowicz 
---
 drivers/tty/serial/jsm/jsm_neo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 5de6dffb..7291c21 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -644,7 +644,7 @@ static void neo_flush_uart_write(struct jsm_channel *ch)
 
/* Check to see if the UART feels it completely flushed the 
FIFO. */
tmp = readb(>ch_neo_uart->isr_fcr);
-   if (tmp & 4) {
+   if (tmp & UART_FCR_CLEAR_XMIT) {
jsm_dbg(IOCTL, >ch_bd->pci_dev,
"Still flushing TX UART... i: %d\n", i);
udelay(10);
-- 
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 1/5] serial: jsm: Remove unnecessary parameter from clear_break()

2014-11-08 Thread Konrad Zapalowicz
The 'force' parameter to the {cls,neo}_send_break() function has been
removed because it has not been used. The client to this API (the tty
code) always called this function with only one value.

Signed-off-by: Konrad Zapalowicz 
---
 drivers/tty/serial/jsm/jsm.h | 2 +-
 drivers/tty/serial/jsm/jsm_cls.c | 2 +-
 drivers/tty/serial/jsm/jsm_neo.c | 2 +-
 drivers/tty/serial/jsm/jsm_tty.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm.h b/drivers/tty/serial/jsm/jsm.h
index 72ed5c1..39b325b 100644
--- a/drivers/tty/serial/jsm/jsm.h
+++ b/drivers/tty/serial/jsm/jsm.h
@@ -120,7 +120,7 @@ struct board_ops {
void (*disable_receiver) (struct jsm_channel *ch);
void (*enable_receiver) (struct jsm_channel *ch);
void (*send_break) (struct jsm_channel *ch);
-   void (*clear_break) (struct jsm_channel *ch, int);
+   void (*clear_break) (struct jsm_channel *ch);
void (*send_start_character) (struct jsm_channel *ch);
void (*send_stop_character) (struct jsm_channel *ch);
void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index 4cb9275..3df9112 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -311,7 +311,7 @@ static void cls_set_no_input_flow_control(struct 
jsm_channel *ch)
  * No locks are assumed to be held when calling this function.
  * channel lock is held and released in this function.
  */
-static void cls_clear_break(struct jsm_channel *ch, int force)
+static void cls_clear_break(struct jsm_channel *ch)
 {
unsigned long lock_flags;
 
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index dc2cd90..b9faee7 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -689,7 +689,7 @@ static void neo_flush_uart_read(struct jsm_channel *ch)
 /*
  * No locks are assumed to be held when calling this function.
  */
-static void neo_clear_break(struct jsm_channel *ch, int force)
+static void neo_clear_break(struct jsm_channel *ch)
 {
unsigned long lock_flags;
 
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index c60e454..524e86a 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -188,7 +188,7 @@ static void jsm_tty_break(struct uart_port *port, int 
break_state)
if (break_state == -1)
channel->ch_bd->bd_ops->send_break(channel);
else
-   channel->ch_bd->bd_ops->clear_break(channel, 0);
+   channel->ch_bd->bd_ops->clear_break(channel);
 
spin_unlock_irqrestore(>lock, lock_flags);
 }
-- 
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 2/5] serial: jsm: Remove unnecessary if statement

2014-11-08 Thread Konrad Zapalowicz
The flow of {neo,cls}_param() shows that at this stage the baud rate
has a non-zero value. This fact makes the if clausule obsolete and
acknowledges it's removal.

Signed-off-by: Konrad Zapalowicz 
---
 drivers/tty/serial/jsm/jsm_cls.c | 3 ---
 drivers/tty/serial/jsm/jsm_neo.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index 3df9112..bfb0681 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -767,9 +767,6 @@ static void cls_param(struct jsm_channel *ch)
ier = readb(>ch_cls_uart->ier);
uart_lcr = readb(>ch_cls_uart->lcr);
 
-   if (baud == 0)
-   baud = 9600;
-
quot = ch->ch_bd->bd_dividend / baud;
 
if (quot != 0) {
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index b9faee7..4b8196d 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -1037,9 +1037,6 @@ static void neo_param(struct jsm_channel *ch)
ier = readb(>ch_neo_uart->ier);
uart_lcr = readb(>ch_neo_uart->lcr);
 
-   if (baud == 0)
-   baud = 9600;
-
quot = ch->ch_bd->bd_dividend / baud;
 
if (quot != 0) {
-- 
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 0/5] serial: jsm: Provide better code quality

2014-11-08 Thread Konrad Zapalowicz
This series of patches fixes a few minor issues in the jsm driver.
The patches do not only address the coding style issues however none
of them changes the logic.

These patches are against the current tty-next.

Konrad Zapalowicz (5):
  serial: jsm: Remove unnecessary parameter from clear_break()
  serial: jsm: Remove unnecessary if statement
  serial: jsm: Fix the alignment of the switch satement
  serial: jsm: Replace magic value with the proper define
  serial: jsm: Fix unnecessary space before function ptr arguments

 drivers/tty/serial/jsm/jsm.h | 30 +++---
 drivers/tty/serial/jsm/jsm_cls.c |  5 +
 drivers/tty/serial/jsm/jsm_neo.c | 31 ++-
 drivers/tty/serial/jsm/jsm_tty.c |  2 +-
 4 files changed, 31 insertions(+), 37 deletions(-)

-- 
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 5/5] serial: jsm: Fix unnecessary space before function ptr arguments

2014-11-08 Thread Konrad Zapalowicz
This commit deals with the checkpatch warning "Unnecessary space before
function pointer arguments".

Signed-off-by: Konrad Zapalowicz 
---
 drivers/tty/serial/jsm/jsm.h | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm.h b/drivers/tty/serial/jsm/jsm.h
index 39b325b..0b79b87 100644
--- a/drivers/tty/serial/jsm/jsm.h
+++ b/drivers/tty/serial/jsm/jsm.h
@@ -111,21 +111,21 @@ struct jsm_channel;
  /
 struct board_ops {
irq_handler_t intr;
-   void (*uart_init) (struct jsm_channel *ch);
-   void (*uart_off) (struct jsm_channel *ch);
-   void (*param) (struct jsm_channel *ch);
-   void (*assert_modem_signals) (struct jsm_channel *ch);
-   void (*flush_uart_write) (struct jsm_channel *ch);
-   void (*flush_uart_read) (struct jsm_channel *ch);
-   void (*disable_receiver) (struct jsm_channel *ch);
-   void (*enable_receiver) (struct jsm_channel *ch);
-   void (*send_break) (struct jsm_channel *ch);
-   void (*clear_break) (struct jsm_channel *ch);
-   void (*send_start_character) (struct jsm_channel *ch);
-   void (*send_stop_character) (struct jsm_channel *ch);
-   void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
-   u32 (*get_uart_bytes_left) (struct jsm_channel *ch);
-   void (*send_immediate_char) (struct jsm_channel *ch, unsigned char);
+   void (*uart_init)(struct jsm_channel *ch);
+   void (*uart_off)(struct jsm_channel *ch);
+   void (*param)(struct jsm_channel *ch);
+   void (*assert_modem_signals)(struct jsm_channel *ch);
+   void (*flush_uart_write)(struct jsm_channel *ch);
+   void (*flush_uart_read)(struct jsm_channel *ch);
+   void (*disable_receiver)(struct jsm_channel *ch);
+   void (*enable_receiver)(struct jsm_channel *ch);
+   void (*send_break)(struct jsm_channel *ch);
+   void (*clear_break)(struct jsm_channel *ch);
+   void (*send_start_character)(struct jsm_channel *ch);
+   void (*send_stop_character)(struct jsm_channel *ch);
+   void (*copy_data_from_queue_to_uart)(struct jsm_channel *ch);
+   u32 (*get_uart_bytes_left)(struct jsm_channel *ch);
+   void (*send_immediate_char)(struct jsm_channel *ch, unsigned char);
 };
 
 
-- 
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 3/5] serial: jsm: Fix the alignment of the switch satement

2014-11-08 Thread Konrad Zapalowicz
This commit fixes the alignment of the 'case's i the switch statement.

Signed-off-by: Konrad Zapalowicz 
---
 drivers/tty/serial/jsm/jsm_neo.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 4b8196d..5de6dffb 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -1019,19 +1019,19 @@ static void neo_param(struct jsm_channel *ch)
lcr |= UART_LCR_STOP;
 
switch (ch->ch_c_cflag & CSIZE) {
-   case CS5:
-   lcr |= UART_LCR_WLEN5;
-   break;
-   case CS6:
-   lcr |= UART_LCR_WLEN6;
-   break;
-   case CS7:
-   lcr |= UART_LCR_WLEN7;
-   break;
-   case CS8:
-   default:
-   lcr |= UART_LCR_WLEN8;
+   case CS5:
+   lcr |= UART_LCR_WLEN5;
+   break;
+   case CS6:
+   lcr |= UART_LCR_WLEN6;
+   break;
+   case CS7:
+   lcr |= UART_LCR_WLEN7;
break;
+   case CS8:
+   default:
+   lcr |= UART_LCR_WLEN8;
+   break;
}
 
ier = readb(>ch_neo_uart->ier);
-- 
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/


libkcapi: First release of kernel crypto API userspace library

2014-11-08 Thread Stephan Mueller
Hi,

The Linux kernel exports a Netlink interface of type AF_ALG to allow user
space to utilize the kernel crypto API.

libkcapi uses this Netlink interface and exports easy to use APIs so that
a developer does not need to consider the low-level Netlink interface 
handling. Its first release is available at [1].

The library does not implement any cipher algorithms. All consumer requests
are sent to the kernel for processing. Results from the kernel crypto API
are returned to the consumer via the library API.

The kernel interface and therefore this library can be used by unprivileged
processes. As the library is small, it may even be included directly into a 
consuming application instead of using it as a shared library.

The library together with the kernel allows the use of symmetric ciphers as 
well as message digests and keyed message digests. Patches are prepared for 
submission to LKML to allow AEAD ciphers and RNGs to be used from userspace.

[1] http://www.chronox.de/libkcapi.html

-- 
Ciao
Stephan
--
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/


[GIT PULL] Btrfs

2014-11-08 Thread Chris Mason
Hi Linus,

Please pull my for-linus branch:

git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus

It's a one liner for an error cleanup path that leads to crashes.

Chris Mason (1) commits (+1/-1):
Btrfs: fix kfree on list_head in btrfs_lookup_csums_range error cleanup

Total: (1) commits (+1/-1)

 fs/btrfs/file-item.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--
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: zynq: Enable PL clocks for Parallella

2014-11-08 Thread Olof Johansson
On Fri, Nov 07, 2014 at 07:44:16AM +0100, Michal Simek wrote:
> On 11/06/2014 06:22 PM, Andreas Färber wrote:
> > The Parallella board comes with a U-Boot bootloader that loads one of
> > two predefined FPGA bitstreams before booting the kernel. Both define an
> > AXI interface to the on-board Epiphany processor.
> > 
> > Enable clocks FCLK0..FCLK3 for the Programmable Logic by default.
> > 
> > Otherwise accessing, e.g., the ESYSRESET register freezes the board,
> > as seen with the Epiphany SDK tools e-reset and e-hw-rev, using /dev/mem.
> > 
> > Cc:  # 3.17.x
> > Signed-off-by: Andreas Färber 
> > ---
> >  Michal/Olof, please consider this trivial patch as a fix for 3.18.
> 
> Acked-by: Michal Simek 
> 
> Olof, Arnd: Can you please pick this directly?

Done, applied to fixes.


-Olof
--
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] at91: cleanup for 3.19 #1

2014-11-08 Thread Olof Johansson
On Mon, Nov 03, 2014 at 06:54:47PM +0100, Nicolas Ferre wrote:
> Arnd, Olof, Kevin,
> 
> The pull-request that was sent late for 3.18. It was removing the old
> !MMU at91x40 and 2 board files plus the whole code in at91sam9g45 & at91sam9rl
> files for implementing this deprecated method. For these particular ones, the
> EK were the only one to use this code.
> We can use these boards with DT right now.
> 
> More code removal like that is shedulle for 3.19, so this is just a first set.
> 
> Thanks, best regards,
> 
> The following changes since commit cac7f2429872d3733dc3f9915857b1691da2eb2f:
> 
>   Linux 3.18-rc2 (2014-10-26 16:48:41 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git 
> tags/at91-cleanup
> 
> for you to fetch changes up to bcf8c7e7703bb2bbde66bec26a81fed4be9cd1d4:
> 
>   ARM: at91: remove at91sam9rl legacy board support (2014-11-03 18:48:02 
> +0100)
> 
> 
> First batch of cleanup/SoC for 3.19:
> - removal of old at91x40 !MMU ARM7TDMI support which was kind of rusty
> - removal of board-sam9m10g45ek.c and board-sam9rlek.c from mach-at91
>   and the code related to these board C files + defconfigs. Use DT for them
>   now!

Merged, thanks!


-Olof
--
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] at91: dt for 3.19 #1

2014-11-08 Thread Olof Johansson
On Mon, Nov 03, 2014 at 06:43:17PM +0100, Nicolas Ferre wrote:
> Arnd, Olof, Kevin,
> 
> Very little DT update for AT91. More will come but I want to send this first
> batch soon so it doesn't get in the way of larger modifications.
> 
> Thanks, best regards,
> 
> The following changes since commit cac7f2429872d3733dc3f9915857b1691da2eb2f:
> 
>   Linux 3.18-rc2 (2014-10-26 16:48:41 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git 
> tags/at91-dt
> 
> for you to fetch changes up to 2667c6adfcf686e8c5a5b56e8c7c65af001df2cb:
> 
>   ARM: at91/dt: at91sam9263: Add CAN device nodes (2014-11-03 11:34:33 +0100)
> 
> 
> First DT batch for 3.19:
> - CAN device nodes for at91sam9263 and at91sam9x5
> - at91sam9x5 DMA definitions for usart

Merged, thanks.


-Olof
--
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] ACPI/osl: speedup grace period in acpi_os_map_cleanup

2014-11-08 Thread Paul E. McKenney
On Sun, Nov 09, 2014 at 03:24:34AM +0400, Alexander Monakov wrote:
> On Sun, Nov 9, 2014 at 1:13 AM, Paul E. McKenney
>  wrote:
> >
> > Did anyone try replacing the synchronize_rcu() with
> > synchronize_rcu_expedited()?  That should provide substantial speedups
> > over synchronize_rcu().
> 
> I've just briefly tested it on my laptop, and it also helps to avoid the 
> issue.

OK, good.

In the past, synchronize_rcu_expedited() has been a bit unfriendly to
battery-powered platforms and to real-time and HPC workloads, but
recent changes for the most part fix this.

Thanx, Paul

--
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 v8 4/8] ARM: dts: Enable Broadcom Cygnus SoC

2014-11-08 Thread Olof Johansson
Hi,

A bunch of small comments below, should be quick to fix.

On Tue, Oct 28, 2014 at 12:53 PM, Scott Branden  wrote:
> DT files to enable cygnus consisting on reference designs
> and cygnus core configuration.
>
> Reviewed-by: Ray Jui 
> Reviewed-by: Arun Parameswaran 
> Tested-by: Jonathan Richardson 
> Reviewed-by: JD (Jiandong) Zheng 
> Signed-off-by: Scott Branden 
> ---
>  arch/arm/boot/dts/Makefile  |4 ++
>  arch/arm/boot/dts/bcm-cygnus-clock.dtsi |   73 ++
>  arch/arm/boot/dts/bcm-cygnus.dtsi   |  100 
> +++
>  arch/arm/boot/dts/bcm911360_entphn.dts  |   32 ++
>  arch/arm/boot/dts/bcm911360k.dts|   32 ++
>  arch/arm/boot/dts/bcm958300k.dts|   32 ++
>  6 files changed, 273 insertions(+)
>  create mode 100644 arch/arm/boot/dts/bcm-cygnus-clock.dtsi
>  create mode 100644 arch/arm/boot/dts/bcm-cygnus.dtsi
>  create mode 100644 arch/arm/boot/dts/bcm911360_entphn.dts
>  create mode 100644 arch/arm/boot/dts/bcm911360k.dts
>  create mode 100644 arch/arm/boot/dts/bcm958300k.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 38c89ca..4b3a590 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -54,6 +54,10 @@ dtb-$(CONFIG_ARCH_AT91)  += at91-sama5d4ek.dtb
>  dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb
>  dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb
>  dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
> +dtb-$(CONFIG_ARCH_BCM_CYGNUS) += \
> +   bcm911360_entphn.dtb \
> +   bcm911360k.dtb \
> +   bcm958300k.dtb
>  dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb
>  dtb-$(CONFIG_ARCH_BCM_63XX) += bcm963138dvt.dtb
>  dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \

Please add new entries in alphabetical/alphanumerical order. Also,
first entry is commonly added on the first line


> diff --git a/arch/arm/boot/dts/bcm-cygnus-clock.dtsi 
> b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
> new file mode 100644
> index 000..d06172b
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm-cygnus-clock.dtsi
> @@ -0,0 +1,73 @@
> +/*
> + * Copyright 2014 Broadcom Corporation.  All rights reserved.
> + *
> + * Unless you and Broadcom execute a separate written software license
> + * agreement governing use of this software, this software is licensed to you
> + * under the terms of the GNU General Public License as
> + * published by the Free Software Foundation version 2.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.

We ask for new DT contents to be added with dual BSD/GPL license, to
allow for reuse of the DT data structures in other projects as well.
There's currently a lot of activity going on relicensing the current
files so I recommend sorting it out before they are added if you can.

> + */
> +
> +clocks {
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   ranges;
> +
> +   osc: oscillator {
> +   compatible = "fixed-clock";
> +   #clock-cells = <1>;
> +   clock-frequency = <2500>;
> +   };
> +
> +   apb_clk: apb_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <10>;
> +   };
> +
> +   periph_clk: periph_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <5>;
> +   };
> +
> +   sdio_clk: lcpll_ch2 {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <2>;
> +   };
> +
> +   axi81_clk: axi81_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <1>;
> +   };
> +
> +   keypad_clk: keypad_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <31806>;
> +   };
> +
> +   adc_clk: adc_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <1562500>;
> +   };
> +
> +   pwm_clk: pwm_clk {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <100>;
> +   };
> +
> +   lcd_clk: mipipll_ch1 {
> +   compatible = "fixed-clock";
> +   #clock-cells = <0>;
> +   clock-frequency = <1>;
> +   };
> +};
> diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi 
> b/arch/arm/boot/dts/bcm-cygnus.dtsi
> new file mode 100644
> index 000..9c650ab
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
> @@ -0,0 +1,100 @@
> +/*
> + * 

Re: [RFC PATCH 0/5] kdbus: add support for lsm

2014-11-08 Thread Karol Lewandowski
On Fri, Nov 07, 2014 at 10:01:20AM -0800, Greg KH wrote:
> On Fri, Oct 31, 2014 at 05:36:32PM +0100, Karol Lewandowski wrote:
> > This is set of EXPERIMENTAL patches adding lsm support to kdbus.
> > (Rebased on top of v3.17.)
> > 
> > >From least to most invasive:
> > 
> >  - (1) kdbus: extend structures with security pointer for lsm
> > 
> >Trivial.  Applicable as-is.
> > 
> >  - (2) security: export security_file_receive for modules
> >(3) kdbus: check if lsm permits installing received fds
> > 
> >fd_install doesn't seem to consult LSM, these patches
> >ensure that receiving process has the right to sent fds. 
> > 
> >Compile-tested only.
> > 
> >  - (4) security: introduce lsm hooks for kdbus
> >(5) kdbus: make use of new lsm hooks
> > 
> >Set of proof-of-concept hooks discussed previously with Paul Moore.
> > 
> >kdbus integration patch (5) for review, but unlikely for integration
> >at this stage.
> > 
> >Likewise, compile-tested only.
> > 
> > 
> > Karol Lewandowski (5):
> >   kdbus: extend structures with security pointer for lsm
> >   security: export security_file_receive for modules
> >   kdbus: check if lsm permits installing received fds
> >   security: introduce lsm hooks for kdbus
> >   kdbus: make use of new lsm hooks
> 
> These looks reasonable to me, thanks for sending them.  They will need
> to be refreshed again after this next round of changes, but it shouldn't
> be that hard to do so.

Sure thing.

For completness - there are accompanying Smack and SELinux patches that
could go together with above patches, ie.

  https://github.com/lmctl/linux/commit/103c26fd27d1ec8c32d85dd3d85681f936ac66fb

  
http://git.infradead.org/users/pcmoore/selinux/commitdiff/eef4844f91fef6092b6bfac941ebe7f18375be9d

I've got some free time on my hands now, so I'll try to revisit these too.

Cheers,
Karol Lewandowski
--
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 RESEND] PM / sleep: Fix racing timers

2014-11-08 Thread Sören Brinkmann
Hi Rafael,

On Thu, 2014-11-06 at 01:33AM +0100, Rafael J. Wysocki wrote:
> On Thursday, October 02, 2014 09:01:15 AM Sören Brinkmann wrote:
> > Hi Rafael,
> 
> Hi,
> 
> Sorry for the huge delay.
> 
> > On Tue, 2014-09-23 at 01:01AM +0200, Rafael J. Wysocki wrote:
> > > On Monday, September 22, 2014 10:07:03 AM Soren Brinkmann wrote:
> > > > On platforms that do not power off during suspend, successfully entering
> > > > suspend races with timers.
> > > > 
> > > > The race happening in a couple of location is:
> > > > 
> > > >   1. disable IRQs   (e.g. arch_suspend_disable_irqs())
> > > >  ...
> > > >   2. syscore_suspend()
> > > >   -> timekeeping_suspend()
> > > >-> clockevents_notify(SUSPEND)
> > > > -> tick_suspend()   (timers are turned off here)
> > > >  ...
> > > >   3. wfi(wait for wake-IRQ here)
> > > > 
> > > > Between steps 1 and 2 the timers can still generate interrupts that are
> > > > not handled and stay pending until step 3. That pending IRQ causes an
> > > > immediate - spurious - wake.
> > > > 
> > > > The solution is to move the clockevents suspend/resume notification
> > > > out of the syscore_suspend step and explictly call them at the 
> > > > appropriate
> > > > time in the suspend/hibernation paths. I.e. timers are suspend _before_
> > > > IRQs get disabled. And accordingly in the resume path.
> > > > 
> > > > Signed-off-by: Soren Brinkmann 
> > > > ---
> > > > Hi,
> > > > 
> > > > there was not a lot of discussion on the last submission. Just one 
> > > > comment from
> > > > Rafael (https://lkml.org/lkml/2014/8/26/780), which - as I outlined in 
> > > > my
> > > > response, does not apply, IMHO, since the platform does not re-enable
> > > > interrupts.
> > > 
> > > Well, you just don't agree with it.
> > > 
> > > The problem with your approach is that timer interrupts aren't actually as
> > > special as you think and any other IRQF_NO_SUSPEND interrupts would have 
> > > caused
> > > similar issues to appear under specific conditions.
> > > 
> > > The solution I would suggest and that actually covers all IRQF_NO_SUSPEND
> > > interrupts would be to use a wait_event() loop like the one in 
> > > freeze_enter()
> > > (on top of the current linux-next or the pm-genirq branch of 
> > > linux-pm.git),
> > > but wait for pm_abort_suspend to become true, to implement system suspend.
> > 
> > sorry, it took me a while since I needed to get some dependencies ported
> > to the pm-genirq base. Once I had that, it reproduced my original issue.
> > So far so good. I then looked into finding a solution following your
> > guidance. I'm not sure I really found what you had in mind, but below is
> > what I came up with, which seems to do it.
> > Please let me know how far off I am.
> > 
> > Thanks,
> > Sören
> > 
> > ---8<--8<8<8<---
> > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> > index c2744b30d5d9..a4f9914571f1 100644
> > --- a/drivers/base/power/wakeup.c
> > +++ b/drivers/base/power/wakeup.c
> > @@ -25,7 +25,7 @@
> >  bool events_check_enabled __read_mostly;
> >  
> >  /* If set and the system is suspending, terminate the suspend. */
> > -static bool pm_abort_suspend __read_mostly;
> > +bool pm_abort_suspend __read_mostly;
> >  
> >  /*
> >   * Combined counters of registered wakeup events and wakeup events in 
> > progress.
> > diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> > index 6dadb25cb0d8..e6a6de8f76d0 100644
> > --- a/kernel/power/suspend.c
> > +++ b/kernel/power/suspend.c
> > @@ -33,6 +33,7 @@
> >  
> >  static const char *pm_labels[] = { "mem", "standby", "freeze", };
> >  const char *pm_states[PM_SUSPEND_MAX];
> > +extern bool pm_abort_suspend;
> >  
> >  static const struct platform_suspend_ops *suspend_ops;
> >  static const struct platform_freeze_ops *freeze_ops;
> > @@ -294,25 +295,27 @@ static int suspend_enter(suspend_state_t state, bool 
> > *wakeup)
> > if (error || suspend_test(TEST_CPUS))
> > goto Enable_cpus;
> >  
> > -   arch_suspend_disable_irqs();
> > -   BUG_ON(!irqs_disabled());
> > -
> > -   error = syscore_suspend();
> > -   if (!error) {
> > -   *wakeup = pm_wakeup_pending();
> > -   if (!(suspend_test(TEST_CORE) || *wakeup)) {
> > -   trace_suspend_resume(TPS("machine_suspend"),
> > -   state, true);
> > -   error = suspend_ops->enter(state);
> > -   trace_suspend_resume(TPS("machine_suspend"),
> > -   state, false);
> > -   events_check_enabled = false;
> > +   while (!pm_abort_suspend) {
> 
> That won't work in general, because pm_abort_suspend may not be set on some
> platforms on wakeup.  It is only set if a wakeup interrupt triggers which
> may not be the case on ACPI systems if the BIOS has woken up the system.
> 
> But that could 

Re: [PATCH] ACPI/osl: speedup grace period in acpi_os_map_cleanup

2014-11-08 Thread Alexander Monakov
On Sun, Nov 9, 2014 at 1:13 AM, Paul E. McKenney
 wrote:
>
> Did anyone try replacing the synchronize_rcu() with
> synchronize_rcu_expedited()?  That should provide substantial speedups
> over synchronize_rcu().

I've just briefly tested it on my laptop, and it also helps to avoid the issue.

Alexander
--
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/


[GIT PULL] Devicetree bug fix for v3.18

2014-11-08 Thread Grant Likely
[resending; forgot to cc the mailing lists]

Hi Linus.

Please pull the following branch for a device tree bug fix.

Thanks,
g.

The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux devicetree/merge

for you to fetch changes up to a87fa1d81a9fb5e9adca9820e16008c40ad09f33:

  of: Fix overflow bug in string property parsing functions
(2014-11-04 10:19:48 +)


Devicetree bugfix for v3.18

One buffer overflow bug that shouldn't be left around.


Grant Likely (1):
  of: Fix overflow bug in string property parsing functions

 drivers/of/base.c   | 88 -
 drivers/of/selftest.c   | 66 --
 drivers/of/testcase-data/tests-phandle.dtsi |  2 +
 include/linux/of.h  | 84 ++-
 4 files changed, 154 insertions(+), 86 deletions(-)
--
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] scripts/ksize: Add kernel build size report

2014-11-08 Thread Darren Hart
ksize generates hierarchical build size reports from vmlinux, *.o, and
built-in.o files.

ksize is useful in preparing minimal configurations and comparing
similar configurations across kernel versions.

Signed-off-by: Darren Hart 
Cc: Josh Triplett 
---
 scripts/ksize | 345 ++
 1 file changed, 345 insertions(+)
 create mode 100755 scripts/ksize

diff --git a/scripts/ksize b/scripts/ksize
new file mode 100755
index 000..103da2a
--- /dev/null
+++ b/scripts/ksize
@@ -0,0 +1,345 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2011-2014 Intel Corporation.
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# Author: Darren Hart 
+#
+
+"""
+Display details of the kernel build size.
+
+The generated report is comprised of many sub-reports, starting with vmlinux,
+and descending into each component built-in.o.
+
+The first line of each report block is the table header, including the report
+title and the column labels. Next is the report totals for the top level file
+(vmlinux or built-in.o). This is followed by itemized sizes for any component
+*.o object files and all built-in.o files from one directory down (the
+built-in.o components are labeled with their parent directory to avoid
+displaying "built-in.o" on nearly every line). The final lines display the sum
+of all the itemized components and delta between the total and the sum.
+
+An example report from an x86_64 allnoconfig build follows in part:
+
+Linux (3.18.0-rc3+) total |   text   data
bss
+
+vmlinux   2201904 | 864548 121612
1215744
+
+arch/x86   282709 | 171021  65448  
46240
+kernel 249960 | 234355   7201   
8404
+mm 190369 | 154171  14154  
22044
+fs 163867 | 160820   1351   
1696
+drivers 44429 |  41353   2052   
1024
+lib 37143 |  37053 85  
5
+init21535 |   5189  16285 
61
+security 3674 |   3658  8  
8
+net   122 |122  0  0
+
+sum993808 | 807742 106584  
79482
+delta 1208096 |  56806  15028
1136262
+
+...
+
+drivers total |   text   data
bss
+
+drivers/built-in.o  44429 |  41353   2052   
1024
+
+drivers/base32427 |  31267   1060
100
+drivers/char 9980 |   8412656
912
+drivers/rtc  1155 |   1155  0  0
+drivers/clocksource   674 |406256 
12
+drivers/video  62 | 46 16  0
+
+sum 44298 |  41286   1988   
1024
+delta 131 | 67 64  0
+
+The report may optionally display an additional level of drivers/* reports:
+
+drivers/basetotal |   text   data
bss
+

+drivers/base/built-in.o 32427 |  31267   1060
100
+

+drivers/base/*.o32253 |  31121   1032
100
+

+sum 32253 |  31121   1032
100
+delta 174 |146 28  0
+
+...
+"""
+
+import sys

e100: Laptop battery drain and WoL settings from EEPROM

2014-11-08 Thread Ondrej Zary
Hello,
there is long-standing problem with battery drain after turning off at least
some Toshiba laptops, see
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/110784

I have the same problem with Toshiba Portege R100. When I shut it down in
Linux, the battery is drained to zero in a couple of days. I noticed that the
LAN port is still active, even when AC disconnected.

The WoL is enabled by default by e100 driver:

# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Link partner advertised link modes:  10baseT/Half
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0x0007 (7)
   drv probe link
Link detected: yes

By this code:
/* Wol magic packet can be enabled from eeprom */
if ((nic->mac >= mac_82558_D101_A4) &&
   (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
nic->flags |= wol_magic;
device_set_wakeup_enable(>dev, true);
}

because the WoL bit is set in EEPROM ID word:

# ethtool -e eth0
Offset  Values
--  --
0x: xx xx xx xx xx xx 03 1b 00 00 01 02 01 47 00 00
0x0010: 00 00 00 00 a2 49 01 00 79 11 7f 00 00 00 00 00
^^ bit 5 here
0x0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0040: 00 00 00 00 00 00 3d 10 00 00 00 00 00 00 00 00
0x0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0060: e4 00 3f 40 09 41 00 00 00 00 00 00 00 00 00 00
0x0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 fe

Looks like this laptop is probably WoL-capable even on battery.

Measured the current from AC adapter:
around 20mA with WoL inactive (shut down from Windows or by power button in 
GRUB)
around 40mA with WoL active (shut down from Linux)

So to work-around this problem, users must disable WoL manually on each boot.

Maybe the driver should ignore the EEPROM WoL bit on Toshiba susbsystem IDs?
Or completely, like Windows driver does?

Ethernet controller details:
02:08.0 Ethernet controller [0200]: Intel Corporation 82801DB PRO/100 VE (MOB) 
Ethernet Controller [8086:103d] (rev 83)
Subsystem: Toshiba America Info Systems Device [1179:0001]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- 
SERR- http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/3] KSM: Add auto flag new VMA as VM_MERGEABLE

2014-11-08 Thread Timofey Titovets
Implement two functions:
ksm_vm_flags_mod() - if existing flags supported by ksm - then mark like 
VM_MERGEABLE
ksm_vma_add_new() - If vma marked as VM_MERGEABLE add it to ksm page queue

Signed-off-by: Timofey Titovets 
---
 include/linux/ksm.h | 31 +++
 mm/mmap.c   | 17 +
 2 files changed, 48 insertions(+)

diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 3be6bb1..c3fff64 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -76,6 +76,29 @@ struct page *ksm_might_need_to_copy(struct page *page,
 int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
 
+/*
+ * Allow to mark new vma as VM_MERGEABLE
+ */
+#ifndef VM_SAO
+#define VM_SAO 0
+#endif
+static inline void ksm_vm_flags_mod(unsigned long *vm_flags)
+{
+   if (*vm_flags & (VM_MERGEABLE | VM_SHARED  | VM_MAYSHARE   |
+VM_PFNMAP| VM_IO  | VM_DONTEXPAND |
+VM_HUGETLB | VM_NONLINEAR | VM_MIXEDMAP   | VM_SAO) )
+   return;
+   *vm_flags |= VM_MERGEABLE;
+}
+
+static inline void ksm_vma_add_new(struct vm_area_struct *vma)
+{
+   struct mm_struct *mm = vma->vm_mm;
+   if (!test_bit(MMF_VM_MERGEABLE, >flags)) {
+   __ksm_enter(mm);
+   }
+}
+
 #else  /* !CONFIG_KSM */
 
 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
@@ -92,6 +115,14 @@ static inline int PageKsm(struct page *page)
return 0;
 }
 
+static inline void ksm_vm_flags_mod(unsigned long *vm_flags_p)
+{
+}
+
+void ksm_vma_add_new(struct vm_area_struct *vma)
+{
+}
+
 #ifdef CONFIG_MMU
 static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
unsigned long end, int advice, unsigned long *vm_flags)
diff --git a/mm/mmap.c b/mm/mmap.c
index 7f85520..ce0073e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -911,10 +912,14 @@ again:remove_next = 1 + (end > 
next->vm_end);
vma_gap_update(next);
else
mm->highest_vm_end = end;
+   } else {
+   if (next && !insert)
+   ksm_vma_add_new(next);
}
if (insert && file)
uprobe_mmap(insert);
 
+   ksm_vma_add_new(vma);
validate_mm(mm);
 
return 0;
@@ -1307,6 +1312,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned 
long addr,
vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags) |
mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
 
+   /* If ksm is enabled, we add VM_MERGABLE to new VMAs. */
+   ksm_vm_flags_mod(_flags);
+
if (flags & MAP_LOCKED)
if (!can_do_mlock())
return -EPERM;
@@ -1648,6 +1656,7 @@ munmap_back:
allow_write_access(file);
}
file = vma->vm_file;
+   ksm_vma_add_new(vma);
 out:
perf_event_mmap(vma);
 
@@ -2484,6 +2493,8 @@ static int __split_vma(struct mm_struct *mm, struct 
vm_area_struct *vma,
else
err = vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
 
+   ksm_vma_add_new(vma);
+
/* Success. */
if (!err)
return 0;
@@ -2659,6 +2670,9 @@ static unsigned long do_brk(unsigned long addr, unsigned 
long len)
if (error)
return error;
 
+   /* If ksm is enabled, we add VM_MERGABLE to new VMAs. */
+   ksm_vm_flags_mod();
+
/*
 * mm->mmap_sem is required to protect against another thread
 * changing the mappings in case we sleep.
@@ -2708,6 +2722,7 @@ static unsigned long do_brk(unsigned long addr, unsigned 
long len)
vma->vm_flags = flags;
vma->vm_page_prot = vm_get_page_prot(flags);
vma_link(mm, vma, prev, rb_link, rb_parent);
+   ksm_vma_add_new(vma);
 out:
perf_event_mmap(vma);
mm->total_vm += len >> PAGE_SHIFT;
@@ -2887,6 +2902,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct 
**vmap,
new_vma->vm_ops->open(new_vma);
vma_link(mm, new_vma, prev, rb_link, rb_parent);
*need_rmap_locks = false;
+   ksm_vma_add_new(new_vma);
}
}
return new_vma;
@@ -3004,6 +3020,7 @@ static struct vm_area_struct *__install_special_mapping(
mm->total_vm += len >> PAGE_SHIFT;
 
perf_event_mmap(vma);
+   ksm_vma_add_new(vma);
 
return vma;
 
-- 
2.1.3

--
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 3/3] KSM: Add config to control mark_new_vma

2014-11-08 Thread Timofey Titovets
Allowing to control mark_new_vma default value
Allowing work ksm on early allocated vmas

Signed-off-by: Timofey Titovets 
---
 mm/Kconfig | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/mm/Kconfig b/mm/Kconfig
index 1d1ae6b..90f40a6 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -340,6 +340,13 @@ config KSM
  until a program has madvised that an area is MADV_MERGEABLE, and
  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
 
+config KSM_MARK_NEW_VMA
+   int "Marking new vma pages as VM_MERGEABLE"
+   depends on KSM
+   default 0
+   range 0 1
+   help
+
 config DEFAULT_MMAP_MIN_ADDR
 int "Low address space to protect from user allocation"
depends on MMU
-- 
2.1.3

--
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 0/3] KSM: Mark new vma for deduplication

2014-11-08 Thread Timofey Titovets
Good time of day List,
this tiny series of patches implement feature for auto deduping all anonymous 
memory.
mark_new_vma - new ksm sysfs interface
Every time then new vma created and mark_new_vma set to 1, then will be vma 
marked as VM_MERGEABLE and added to ksm queue.
This can produce small overheads
(I have not catch any problems or slowdown)

This is useful for:
Android (CM) devs which implement ksm support with patching system.
Users of tiny pc.
Servers what not use KVM but use something very releated, like containers.

For tests:
I have tested it and it working very good. For testing apply it and enable ksm:
echo 1 | sudo tee /sys/kernel/mm/ksm/run
This show how much memory saved:
echo $[$(cat /sys/kernel/mm/ksm/pages_shared)*$(getconf PAGE_SIZE)/1024 ]KB

On my system i save ~1% of memory 26 Mb/2100 Mb (deduped)/(used)

Timofey Titovets (3):
  KSM: Add auto flag new VMA as VM_MERGEABLE
  KSM: Add to sysfs - mark_new_vma
  KSM: Add config to control mark_new_vma

 include/linux/ksm.h | 39 +++
 mm/Kconfig  |  7 +++
 mm/ksm.c| 39 ++-
 mm/mmap.c   | 17 +
 4 files changed, 101 insertions(+), 1 deletion(-)

--
2.1.3

--
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 2/3] KSM: Add to sysfs - mark_new_vma

2014-11-08 Thread Timofey Titovets
It allow for user to  control process of marking new vma as VM_MERGEABLE
Create new sysfs interface /sys/kernel/mm/ksm/mark_new_vma
1 - enabled - mark new allocated vma as VM_MERGEABLE and add it to ksm queue
0 - disable it

Signed-off-by: Timofey Titovets 
---
 include/linux/ksm.h | 10 +-
 mm/ksm.c| 39 ++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index c3fff64..deb60fc 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -76,6 +76,12 @@ struct page *ksm_might_need_to_copy(struct page *page,
 int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
 void ksm_migrate_page(struct page *newpage, struct page *oldpage);
 
+
+/* Mark new vma as mergeable */
+#define ALLOW  1
+#define DENY   0
+extern unsigned mark_new_vma __read_mostly;
+
 /*
  * Allow to mark new vma as VM_MERGEABLE
  */
@@ -84,6 +90,8 @@ void ksm_migrate_page(struct page *newpage, struct page 
*oldpage);
 #endif
 static inline void ksm_vm_flags_mod(unsigned long *vm_flags)
 {
+   if (!mark_new_vma)
+   return;
if (*vm_flags & (VM_MERGEABLE | VM_SHARED  | VM_MAYSHARE   |
 VM_PFNMAP| VM_IO  | VM_DONTEXPAND |
 VM_HUGETLB | VM_NONLINEAR | VM_MIXEDMAP   | VM_SAO) )
@@ -94,7 +102,7 @@ static inline void ksm_vm_flags_mod(unsigned long *vm_flags)
 static inline void ksm_vma_add_new(struct vm_area_struct *vma)
 {
struct mm_struct *mm = vma->vm_mm;
-   if (!test_bit(MMF_VM_MERGEABLE, >flags)) {
+   if (mark_new_vma && !test_bit(MMF_VM_MERGEABLE, >flags)) {
__ksm_enter(mm);
}
 }
diff --git a/mm/ksm.c b/mm/ksm.c
index 6b2e337..7bfb616 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -223,6 +223,12 @@ static unsigned int ksm_thread_pages_to_scan = 100;
 /* Milliseconds ksmd should sleep between batches */
 static unsigned int ksm_thread_sleep_millisecs = 20;
 
+/* Mark new vma as mergeable */
+#ifndef CONFIG_KSM_MARK_NEW_VMA
+#define CONFIG_KSM_MARK_NEW_VMA DENY
+#endif
+unsigned mark_new_vma = CONFIG_KSM_MARK_NEW_VMA;
+
 #ifdef CONFIG_NUMA
 /* Zeroed when merging across nodes is not allowed */
 static unsigned int ksm_merge_across_nodes = 1;
@@ -2127,6 +2133,34 @@ static ssize_t pages_to_scan_store(struct kobject *kobj,
 }
 KSM_ATTR(pages_to_scan);
 
+static ssize_t mark_new_vma_show(struct kobject *kobj, struct kobj_attribute 
*attr,
+   char *buf)
+{
+   return sprintf(buf, "%u\n", mark_new_vma);
+}
+static ssize_t mark_new_vma_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+   int err;
+   unsigned long flags;
+
+   err = kstrtoul(buf, 10, );
+   if (err || flags > UINT_MAX || flags > ALLOW)
+   return -EINVAL;
+
+   /*
+* ALLOW = 1 - sets allow for mark new vma as
+* VM_MERGEABLE and adding it to ksm
+* DENY = 0 - disable it
+*/
+   if (mark_new_vma != flags) {
+   mark_new_vma = flags;
+   }
+   return count;
+}
+KSM_ATTR(mark_new_vma);
+
 static ssize_t run_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
 {
@@ -2287,6 +2321,7 @@ static struct attribute *ksm_attrs[] = {
_unshared_attr.attr,
_volatile_attr.attr,
_scans_attr.attr,
+   _new_vma_attr.attr,
 #ifdef CONFIG_NUMA
_across_nodes_attr.attr,
 #endif
@@ -2323,7 +2358,9 @@ static int __init ksm_init(void)
goto out_free;
}
 #else
-   ksm_run = KSM_RUN_MERGE;/* no way for user to start it */
+   /* no way for user to start it */
+   mark_new_vma = ALLOW;
+   ksm_run = KSM_RUN_MERGE;
 
 #endif /* CONFIG_SYSFS */
 
-- 
2.1.3

--
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: Early test: hangs in mm/compact.c w. Linus's 12d7aacab56e9ef185c

2014-11-08 Thread Vlastimil Babka
On 11/08/2014 02:11 PM, P. Christeas wrote:
> On Thursday 06 November 2014, Vlastimil Babka wrote:
>>> On Wednesday 05 November 2014, Vlastimil Babka wrote:
 Can you please try the following patch?
 -  compaction_defer_reset(zone, order, false);
>> Oh and did I ask in this thread for /proc/zoneinfo yet? :)
> 
> Using that same kernel[1], got again into a race, gathered a few more data.
> 
> This time, I had 1x "urpmq" process [2] hung at 100% CPU , when "kwin" got 
> apparently blocked (100% CPU, too) trying to resize a GUI window. I suppose 
> the resizing operation would mean heavy memory alloc/free.
> 
> The rest of the system was responsive, I could easily get a console, login, 
> gather the files.. Then, I have *killed* -9 the "urpmq" process, which solved 
> the race and my system is still alive! "kwin" is still running, returned to 
> regular CPU load.
> 
> Attached is traces from SysRq+l (pressed a few times, wanted to "snapshot" 
> the 
> stack) and /proc/zoneinfo + /proc/vmstat
> 
> Bisection is not yet meaningful, IMHO, because I cannot be sure that "good" 
> points are really free from this issue. I'd estimate that each test would 
> take 
> +3days, unless I really find a deterministic way to reproduce the issue .

Hi,

I think I finally found the cause by staring into the code... CCing
people from all 4 separate threads I know about this issue.
The problem with finding the cause was that the first report I got from
Markus was about isolate_freepages_block() overhead, and later Norbert
reported that reverting a patch for isolate_freepages* helped. But the
problem seems to be that although the loop in isolate_migratepages exits
because the scanners almost meet (they are within same pageblock), they
don't truly meet, therefore compact_finished() decides to continue, but
isolate_migratepages() exits immediately... boom! But indeed e14c720efdd7
made this situation possible, as free scaner pfn can now point to a
middle of pageblock.

So I hope the attached patch will fix the soft-lockup issues in
compact_zone. Please apply on 3.18-rc3 or later without any other reverts,
and test. It probably won't help Markus and his isolate_freepages_block()
overhead though...

Thanks,
Vlastimil

--8<--
>From fbf8eb0bcd2897090312e23da6a31bad9cc6b337 Mon Sep 17 00:00:00 2001
From: Vlastimil Babka 
Date: Sat, 8 Nov 2014 22:20:43 +0100
Subject: [PATCH] mm, compaction: prevent endless loop in migrate scanner

---
 mm/compaction.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index ec74cf0..1b7a1be 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1029,8 +1029,12 @@ static isolate_migrate_t isolate_migratepages(struct 
zone *zone,
}
 
acct_isolated(zone, cc);
-   /* Record where migration scanner will be restarted */
-   cc->migrate_pfn = low_pfn;
+   /* 
+* Record where migration scanner will be restarted. If we end up in
+* the same pageblock as the free scanner, make the scanners fully
+* meet so that compact_finished() terminates compaction.
+*/
+   cc->migrate_pfn = (end_pfn <= cc->free_pfn) ? low_pfn : cc->free_pfn;
 
return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE;
 }
-- 
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] ACPI/osl: speedup grace period in acpi_os_map_cleanup

2014-11-08 Thread Paul E. McKenney
On Sat, Nov 08, 2014 at 12:47:17PM +0400, Konstantin Khlebnikov wrote:
> ACPI maintains cache of ioremap regions to speed up operations and
> access to them from irq context where ioremap() calls aren't allowed.
> This code abuses synchronize_rcu() on unmap path for synchronization
> with fast-path in acpi_os_read/write_memory which uses this cache.
> 
> Since v3.10 CPUs are allowed to enter idle state even if they have RCU
> callbacks queued, see commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66
> ("rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks").
> That change caused problems with nvidia proprietary driver which calls
> acpi_os_map/unmap_generic_address several times during initialization.
> Each unmap calls synchronize_rcu and adds significant delay. Totally
> initialization is slowed for a couple of seconds and that is enough to
> trigger timeout in hardware, gpu decides to "fell off the bus". Widely
> spread workaround is reducing "rcu_idle_gp_delay" from 4 to 1 jiffy.

Did anyone try replacing the synchronize_rcu() with
synchronize_rcu_expedited()?  That should provide substantial speedups
over synchronize_rcu().

Thanx, Paul

> This patch replaces synchronize_rcu with per-acpi_ioremap atomic counter
> of side users and wait-queue which signals when counter falls to zero.
> List of struct acpi_ioremap is still protected by RCU but they're freed
> asynchronously using kfree_rcu.
> 
> Signed-off-by: Konstantin Khlebnikov 
> Reported-and-tested-by: Alexander Monakov 
> Tested-by: Tom Boshoven 
> Link: 
> https://devtalk.nvidia.com/default/topic/567297/linux/linux-3-10-driver-crash/
> ---
>  drivers/acpi/osl.c |   71 
> ++--
>  1 file changed, 36 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 9964f70..52a 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -94,10 +94,13 @@ struct acpi_ioremap {
>   acpi_physical_address phys;
>   acpi_size size;
>   unsigned long refcount;
> + atomic_t active;
> + struct rcu_head rcu_head;
>  };
> 
>  static LIST_HEAD(acpi_ioremaps);
>  static DEFINE_MUTEX(acpi_ioremap_lock);
> +static DECLARE_WAIT_QUEUE_HEAD(acpi_ioremap_wq);
> 
>  static void __init acpi_osi_setup_late(void);
> 
> @@ -293,17 +296,31 @@ acpi_map_lookup(acpi_physical_address phys, acpi_size 
> size)
>   return NULL;
>  }
> 
> -/* Must be called with 'acpi_ioremap_lock' or RCU read lock held. */
> -static void __iomem *
> -acpi_map_vaddr_lookup(acpi_physical_address phys, unsigned int size)
> +static void __iomem *acpi_get_ioremap(acpi_physical_address phys,
> + acpi_size size, struct acpi_ioremap **pmap)
>  {
>   struct acpi_ioremap *map;
> 
> + rcu_read_lock();
>   map = acpi_map_lookup(phys, size);
> - if (map)
> + if (map && atomic_inc_not_zero(>active)) {
> + rcu_read_unlock();
> + *pmap = map;
>   return map->virt + (phys - map->phys);
> + }
> + rcu_read_unlock();
> 
> - return NULL;
> + *pmap = NULL;
> + return acpi_os_ioremap(phys, size);
> +}
> +
> +static void acpi_put_ioremap(void __iomem *virt, struct acpi_ioremap *map)
> +{
> + if (map) {
> + if (atomic_dec_and_test(>active))
> + wake_up_all(_ioremap_wq);
> + } else
> + iounmap(virt);
>  }
> 
>  void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int 
> size)
> @@ -411,6 +428,7 @@ acpi_os_map_iomem(acpi_physical_address phys, acpi_size 
> size)
>   map->phys = pg_off;
>   map->size = pg_sz;
>   map->refcount = 1;
> + atomic_set(>active, 1);
> 
>   list_add_tail_rcu(>list, _ioremaps);
> 
> @@ -436,9 +454,10 @@ static void acpi_os_drop_map_ref(struct acpi_ioremap 
> *map)
>  static void acpi_os_map_cleanup(struct acpi_ioremap *map)
>  {
>   if (!map->refcount) {
> - synchronize_rcu();
> + atomic_dec(>active);
> + wait_event(acpi_ioremap_wq, !atomic_read(>active));
>   acpi_unmap(map->phys, map->virt);
> - kfree(map);
> + kfree_rcu(map, rcu_head);
>   }
>  }
> 
> @@ -947,20 +966,14 @@ static inline u64 read64(const volatile void __iomem 
> *addr)
>  acpi_status
>  acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
>  {
> + struct acpi_ioremap *map;
>   void __iomem *virt_addr;
>   unsigned int size = width / 8;
> - bool unmap = false;
>   u64 dummy;
> 
> - rcu_read_lock();
> - virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
> - if (!virt_addr) {
> - rcu_read_unlock();
> - virt_addr = acpi_os_ioremap(phys_addr, size);
> - if (!virt_addr)
> - return AE_BAD_ADDRESS;
> - unmap = true;
> - }
> + virt_addr = acpi_get_ioremap(phys_addr, size, 

Re: [PATCH net-next v2 2/3] r8152: clear theflagofSCHEDULE_TASKLETin tasklet

2014-11-08 Thread Francois Romieu
Hayes Wang  :
>  Francois Romieu [mailto:rom...@fr.zoreil.com] 
> > Sent: Monday, November 03, 2014 6:53 AM
> [...]
> > test_and_clear_bit (dense) or clear_bit would be more idiomatic.
> 
> Excuse me. Any suggestion?
> Should I use clear_bit directly, or something else?
> Or, do I have to remove this patch?

The performance explanation leaves me a bit unconvinced. Without any
figure one could simply go for the always locked clear_bit because of:
1. the "I'm racy" message that the open-coded test + set sends
2. the extra work needed to avoid 1 (comment, explain, ...).

The extra time could thus be used to see what happens when napi is
shoehorned in this tasklet machinery. I'd naively expect it to be
relevant for efficiency.

I won't mind if your agenda is completely different. :o)

-- 
Ueimor
--
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/8] x86, microcode, intel: guard against misaligned microcode data

2014-11-08 Thread Henrique de Moraes Holschuh
On Sat, 08 Nov 2014, Borislav Petkov wrote:
> On Fri, Nov 07, 2014 at 08:54:25PM -0200, Henrique de Moraes Holschuh wrote:
> > Well, it might well be lost in the noise given how slow a microcode update
> > is.
> > 
> > What I mean is that the early microcode driver "won't waste cpu time moving
> > data that is already aligned".
> 
> Yes, don't say "faster" but explain that we can save us the shuffling
> of microcode data back and forth in the early loader if the microcode
> update is 16-byte aligned in the initrd.

Will change.

> > That WARN_ONCE() should only trigger if a bug shows its ugly face.  If it is
> > triggering in any other case, this patch is broken.
> > 
> > mc_intel->bits in the late driver really shouldn't depend at all on any
> > alignment from initramfs or whatever: that path is supposed to run on
> > microcode that came from the firmware loader, or the deprecated microcode
> 
> Right, the early path is apply_microcode_early() - I misread that part,
> sorry.
> 
> > device, or which was memcpy'd from the initramfs to a kmalloc()'d area by
> > save_microcode() in the early driver.  All of these will always be 16-byte
> > aligned AFAIK.
> 
> Why will it always be 16-byte aligned? And if it is going to be always
> 16-byte aligned, why do we need the WARN_ONCE() at all?

...

> > So, the early driver gets alignment code as it will usually have to deal
> > with unaligned microcode data, and the late driver (which should never see
> > unaligned microcode data) gets a WARN_ONCE to alert us if something broke in
> > the kernel code.
> > 
> > Should I change the WARN_ONCE message to:
> > 
> > WARN_ONCE(... "kernel bug: microcode data incorrectly aligned") ?
> 
> No, you should either give a possible scenario where an unaligned
> pointer can really happen or, alternatively, if you can prove that the
> condition will never happen, drop the WARN_ONCE completely.

If I know of a non-kernel-bug scenario where it could happen, I'd have added
code that fixes the alignment like I did in the early driver...

AFAIK, that WARN_ON is only going to trigger if kmalloc changes and starts
returning less strictly aligned data, or if something is corrupting memory.

I will remove the WARN_ONCE, and place a comment in its place:

/*
 * the memory area holding the microcode update data must be 16-byte
 * aligned.  This is supposed to be guaranteed by kmalloc().
 */

> Oh, and even if the WARN_ONCE triggers, what can we do about it? If we
> can't do anything about it, then we have a problem. If we can, then we
> better do it and change the WARN_ONCE to an if-check which, if positive,
> executes code that fixes the situation.

All we could do is abort the update.  The real reason behind the
misalignment would have to be tracked in order to know what should be done
about it.

> IOW, what I'm trying to say is, can we make the kmalloc'ed memory
> 16-byte aligned and if so, then copy the microcode data there and be
> happy. And I think we can... :-)

Sure, we can.  But AFAIK kmalloc() is supposed to already give us a 16-byte
aligned data area.

> > Neither do I.  But this has zero footprint on the resulting kernel, and
> > might save someone 10 years from now from trying to debug initramfs data
> > corruption.
> 
> ... and someone might waste a lot of time 10 years from now trying
> to fathom why the hell that thing was added, only to realize that
> someone was being unreasonably overzealous. No, we don't add code for
> hypothetical cases which are absolutely improbable.

I will drop it.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
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] i2c-davinci: Handle signals gracefully

2014-11-08 Thread Wolfram Sang
On Sun, Jun 01, 2014 at 10:11:34PM +0200, Wolfram Sang wrote:
> 
> > Feel free to adap my patch or comments and commit. Or wait a few weeks for
> > when I have a sponsor to split and update the patch.
> 
> OK, I'll hope you can make it for 3.17. Thanks!

I now picked the part removing the interruptible-call. The part with
the new exit-path would need to be resend and retested in case anyone
is still caring.



signature.asc
Description: Digital signature


Re: PATCH: Fix coding style warning.

2014-11-08 Thread Dan Carpenter
On Sat, Nov 08, 2014 at 06:39:06PM +0200, sharon wrote:
> Fix coding style warning.
> (First submission, sorry in advance for any dumb stuff I'm missing.
> Let me know and I'll fix it.)
> 

Everyone's first patch is rejected.
1) You need to work against linux-next.
2) Fix the subject:
   [PATCH] binder: lines too long
It has to be in that format.  `git am` will remove the [PATCH] part of
the subject.
3) Make the patch description as specific as possible.

regards,
dan carpenter
--
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] Fix entering suspend-to-IDLE if no freeze_oops is set

2014-11-08 Thread Rafael J. Wysocki
On Saturday, November 08, 2014 07:17:13 PM Dmitry Eremin-Solenikov wrote:
> If no freeze_ops is set, trying to enter suspend-to-IDLE will cause a
> nice oops in platform_suspend_prepare_late(). Add respective checks to
> platform_suspend_prepare_late() and platform_resume_early() functions.
> 
> Fixes: a8d46b9e (ACPI / sleep: Rework the handling of ACPI GPE wakeup ...)
> Signed-off-by: Dmitry Eremin-Solenikov 

Applied, thanks!

> ---
>  kernel/power/suspend.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index 4ca9a33..c347e3c 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -146,7 +146,7 @@ static int platform_suspend_prepare(suspend_state_t state)
>  
>  static int platform_suspend_prepare_late(suspend_state_t state)
>  {
> - return state == PM_SUSPEND_FREEZE && freeze_ops->prepare ?
> + return state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->prepare ?
>   freeze_ops->prepare() : 0;
>  }
>  
> @@ -164,7 +164,7 @@ static void platform_resume_noirq(suspend_state_t state)
>  
>  static void platform_resume_early(suspend_state_t state)
>  {
> - if (state == PM_SUSPEND_FREEZE && freeze_ops->restore)
> + if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->restore)
>   freeze_ops->restore();
>  }
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, 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/


Hello

2014-11-08 Thread Thaung Lin Yan

Your partnership is needed for a profitable business transaction involving huge 
amounts of fund please contact me for more details.

---
Uw partnerschap is nodig voor een winstgevende business transactie waarbij 
enorme hoeveelheden fonds kunt u contact met mij op voor meer details.


Ihre Partnerschaft ist für ein profitables Geschäft Transaktion mit riesigen 
Mengen von Fonds kontaktieren Sie mich bitte für weitere Einzelheiten benötig
--
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 5/5] cpufreq, add BUG() messages in critical paths to aid debugging failures

2014-11-08 Thread Rafael J. Wysocki
On Saturday, November 08, 2014 08:33:35 AM Prarit Bhargava wrote:
> 
> On 11/07/2014 09:00 PM, Rafael J. Wysocki wrote:
> > On Wednesday, November 05, 2014 09:53:59 AM Prarit Bhargava wrote:
> >> Add some additional debug to capture failures in the locking scheme for
> >> cpufreq.  Instead of just a NULL pointer, these warnings will capture 
> >> failure
> >> points if the locking scheme for cpufreq is broken.
> >>
> >> Cc: "Rafael J. Wysocki" 
> >> Cc: Viresh Kumar 
> >> Cc: linux...@vger.kernel.org
> >> Signed-off-by: Prarit Bhargava 
> >> ---
> >>  drivers/cpufreq/cpufreq_governor.c |   32 +++-
> >>  1 file changed, 27 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/cpufreq/cpufreq_governor.c 
> >> b/drivers/cpufreq/cpufreq_governor.c
> >> index b1ee597..f158882 100644
> >> --- a/drivers/cpufreq/cpufreq_governor.c
> >> +++ b/drivers/cpufreq/cpufreq_governor.c
> >> @@ -161,9 +161,18 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu)
> >>  EXPORT_SYMBOL_GPL(dbs_check_cpu);
> >>  
> >>  static inline void __gov_queue_work(int cpu, struct dbs_data *dbs_data,
> >> -  unsigned int delay)
> >> +  unsigned int delay,
> >> +  struct cpufreq_policy *policy)
> >>  {
> >> -  struct cpu_dbs_common_info *cdbs = dbs_data->cdata->get_cpu_cdbs(cpu);
> >> +  struct cpu_dbs_common_info *cdbs;
> >> +
> >> +  if (!dbs_data->cdata) {
> >> +  pr_emerg("common_dbs_data is NULL for %s but initialized = %d",
> >> +   policy->governor->name,
> >> +   atomic_read(>governor->initialized));
> >> +  BUG();
> > 
> > Is it necessary to crash the kernel here?
> 
> Yes.  dbs_data->cdata is referenced right below.
> 
> > 
> >> +  }
> >> +  cdbs = dbs_data->cdata->get_cpu_cdbs(cpu);
> 
> and we'll NULL pointer panic right here without any of the debug info above :(

Can we possibly avoid the panic?

Adding BUG() instead of a NULL pointer deref is not much improvement.

> 
> >>  
> >>mod_delayed_work_on(cpu, system_wq, >work, delay);
> >>  }
> >> @@ -185,10 +194,11 @@ void gov_queue_work(struct dbs_data *dbs_data, 
> >> struct cpufreq_policy *policy,
> >> * those works are canceled during CPU_DOWN_PREPARE so they
> >> * can't possibly run on any other CPU.
> >> */
> >> -  __gov_queue_work(raw_smp_processor_id(), dbs_data, delay);
> >> +  __gov_queue_work(raw_smp_processor_id(), dbs_data, delay,
> >> +   policy);
> >>} else {
> >>for_each_cpu(i, policy->cpus)
> >> -  __gov_queue_work(i, dbs_data, delay);
> >> +  __gov_queue_work(i, dbs_data, delay, policy);
> >>}
> >>  
> >>  out_unlock:
> >> @@ -258,7 +268,13 @@ int cpufreq_governor_dbs(struct cpufreq_policy 
> >> *policy,
> >>else
> >>dbs_data = cdata->gdbs_data;
> >>  
> >> -  WARN_ON(!dbs_data && (event != CPUFREQ_GOV_POLICY_INIT));
> >> +  if (!dbs_data && (event != CPUFREQ_GOV_POLICY_INIT)) {
> >> +  pr_emerg("governor_data is NULL but governor %s is initialized 
> >> = %d [governor_enabled = %d event = %u]\n",
> >> +   policy->governor->name,
> >> +   atomic_read(>governor->initialized),
> >> +   policy->governor_enabled, event);
> >> +  BUG();
> > 
> > And here?
> > 
> 
> Ditto -- dbs_data is dereferenced in the call path and will NULL pointer 
> panic.
> 
> P.
> 
> >> +  }
> >>  
> >>switch (event) {
> >>case CPUFREQ_GOV_POLICY_INIT:
> >> @@ -329,6 +345,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy 
> >> *policy,
> >>case CPUFREQ_GOV_POLICY_EXIT:
> >>mutex_lock(_data->usage_count_mutex);
> >>if (atomic_dec_and_test(_data->usage_count)) {
> >> +  if (atomic_read(>governor->initialized) > 1) {
> >> +  pr_emerg("Removing governor %s but initialized 
> >> = %d, dbs_data->usage_count = 0\n",
> >> +   policy->governor->name,
> >> + atomic_read(>governor->initialized));
> >> +  BUG();
> >> +  }
> >>sysfs_remove_group(get_governor_parent_kobj(policy),
> >>get_sysfs_attr(dbs_data));
> >>  
> >>
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
I speak only for myself.
Rafael J. Wysocki, 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] rtl8188eu: Remove unnecessary braces for simple return in xmit_linux.c

2014-11-08 Thread Joe Perches
On Sat, 2014-11-08 at 22:14 +0100, Krzysztof Konopko wrote:
> scripts/checkpatch.pl reports a coding style problem in xmit_linux.c
[]
> diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
> b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
[]
> @@ -67,9 +67,8 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, 
> uint rlen)
>  int rtw_endofpktfile(struct pkt_file *pfile)
>  {
>  
> - if (pfile->pkt_len == 0) {
> + if (pfile->pkt_len == 0)
>   return true;
> - }
>  
> 
>   return false;

This should probably be

bool rtw_endofpktfile(const struct pkt_file *pfile_
{
return !pfile->pkt_len;
}

or just removed altogether and tested directly
in the one place it's used.


--
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] rtl8188eu: Remove unnecessary braces for simple return in xmit_linux.c

2014-11-08 Thread Krzysztof Konopko
scripts/checkpatch.pl reports a coding style problem in xmit_linux.c

  WARNING:BRACES: braces {} are not necessary for single statement blocks
  #61852: FILE: rtl8188eu/os_dep/xmit_linux.c:70:

This patch removes unnecessary braces.

Signed-off-by: Krzysztof Konopko 
---
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index d5e41a5..9e0e338 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -67,9 +67,8 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint 
rlen)
 int rtw_endofpktfile(struct pkt_file *pfile)
 {
 
-   if (pfile->pkt_len == 0) {
+   if (pfile->pkt_len == 0)
return true;
-   }
 
 
return false;
-- 
2.1.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 v1 0/3] Transition pxa25x clock to common clocks

2014-11-08 Thread Robert Jarzmik
Dmitry Eremin-Solenikov  writes:

> 2014-11-08 20:26 GMT+03:00 Robert Jarzmik :
>> Dmitry Eremin-Solenikov  writes:
>>
>>> Hello,
>>> Tested in qemu (pxa25x target).
>>>
>>> 2) sa1100-rtc could not find a clock and thus failed to be probed.
>>> 4) Got an issue with IrDA driver - it gets -ENODEV for UARTCLK clock
>>
>> Hi Dmitry,
>>
>> Would you mind retesting with the patch in [1] applied to see if points 2 
>> and 4
>> are fixed ? Alternatively you can refetch from the github tree, I included 
>> that
>> incremental patch there too.
>>
>> If it works correctly for you, could I have your Tested-by ? If not, tell me 
>> and
>> I'll try to figure out what's wrong.
>
> Tested in qemu, everything works fine. I will test on the real hardware
> tomorow.
Aha, the test.
Would you at that time do a "cat /sys/kernel/debug/clk/clk_summary" and send it
to me please ?

>
> BTW: It looks like pxa27x also shows the same behaviour wrt. sa1100-rtc and
> pxa2xx-ir (after reverting a revert).
Ah yes, you're very right about that.

Same as before, github updated and patch included in this mail.

Cheers.

-- 
Robert

>From c36803b312621c1a69d2d6aed000ae7ee11da588 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik 
Date: Sat, 8 Nov 2014 21:46:51 +0100
Subject: [PATCH] clk: pxa: add missing clocks for Irda and sa1100-rtc

Add 2 clocks which were erronously forgotten by the clock framework
port, namely :
 - sa1100-rtc
 - irda for pxa2xx-ir:UARTCLK

Signed-off-by: Robert Jarzmik 
---
 drivers/clk/pxa/clk-pxa27x.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c
index 2b8343a..611879b 100644
--- a/drivers/clk/pxa/clk-pxa27x.c
+++ b/drivers/clk/pxa/clk-pxa27x.c
@@ -353,6 +353,33 @@ static u8 clk_pxa27x_memory_get_parent(struct clk_hw *hw)
 PARENTS(clk_pxa27x_memory) = { "osc_13mhz", "system_bus", "run" };
 MUX_RO_RATE_RO_OPS(clk_pxa27x_memory, "memory");
 
+#define DUMMY_CLK(_con_id, _dev_id, _parent) \
+	{ .con_id = _con_id, .dev_id = _dev_id, .parent = _parent }
+struct dummy_clk {
+	const char *con_id;
+	const char *dev_id;
+	const char *parent;
+};
+static struct dummy_clk dummy_clks[] __initdata = {
+	DUMMY_CLK(NULL, "sa1100-rtc", "osc_32_768khz"),
+	DUMMY_CLK("UARTCLK", "pxa2xx-ir", "STUART"),
+};
+
+static void __init pxa27x_dummy_clocks_init(void)
+{
+	struct clk *clk;
+	struct dummy_clk *d;
+	const char *name;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(dummy_clks); i++) {
+		d = _clks[i];
+		name = d->dev_id ? d->dev_id : d->con_id;
+		clk = clk_register_fixed_factor(NULL, name, d->parent, 0, 1, 1);
+		clk_register_clkdev(clk, d->con_id, d->dev_id);
+	}
+}
+
 static void __init pxa27x_base_clocks_init(void)
 {
 	pxa27x_register_plls();
@@ -365,6 +392,7 @@ static void __init pxa27x_base_clocks_init(void)
 int __init pxa27x_clocks_init(void)
 {
 	pxa27x_base_clocks_init();
+	pxa27x_dummy_clocks_init();
 	return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks));
 }
 
-- 
2.1.0



Re: [PATCH v3 2/4] input: alps: Allow 2 invalid packets without resetting device

2014-11-08 Thread Dmitry Torokhov
On Sun, Nov 02, 2014 at 12:25:08AM +0100, Pali Rohár wrote:
> On some Dell Latitude laptops ALPS device or Dell EC send one invalid byte in
> 6 bytes ALPS packet. In this case psmouse driver enter out of sync state. It
> looks like that all other bytes in packets are valid and also device working
> properly. So there is no need to do full device reset, just need to wait
> for byte which match condition for first byte (start of packet). Because ALPS
> packets are bigger (6 or 8 bytes) default limit is small.
> 
> This patch increase number of invalid bytes to size of 2 ALPS packets which
> psmouse driver can drop before do full reset.
> 
> Resetting ALPS devices take some time and when doing reset on some Dell 
> laptops
> touchpad, trackstick and also keyboard do not respond. So it is better to do 
> it
> only if really necessary.
> 
> Signed-off-by: Pali Rohár 
> Tested-by: Pali Rohár 
> Cc: sta...@vger.kernel.org

Applied, thank you.

> ---
>  drivers/input/mouse/alps.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index a772745..7c47e97 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -2391,6 +2391,9 @@ int alps_init(struct psmouse *psmouse)
>   /* We are having trouble resyncing ALPS touchpads so disable it for now 
> */
>   psmouse->resync_time = 0;
>  
> + /* Allow 2 invalid packets without resetting device */
> + psmouse->resetafter = psmouse->pktsize * 2;
> +
>   return 0;
>  
>  init_fail:
> -- 
> 1.7.9.5
> 

-- 
Dmitry
--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Joe Perches
On Sat, 2014-11-08 at 20:59 +0200, Oded Gabbay wrote:
> I also noticed I forgot to modify drivers/gpu/drm/radeon/amdkfd/* to
> drivers/gpu/drm/amd/amdkfd/*

That should probably just be drivers/gpu/drm/adm/amdkfd/

The trailing star means if there are subdirectories, do not
match them, just match the files at that directory level.

A trailing slash matches all files and subdirectories.


--
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 1/4] input: alps: Do not try to parse data as 3 bytes packet when driver is out of sync

2014-11-08 Thread Dmitry Torokhov
On Sun, Nov 02, 2014 at 12:25:07AM +0100, Pali Rohár wrote:
> 5th and 6th byte of ALPS trackstick V3 protocol match condition for first byte
> of PS/2 3 bytes packet. When driver enters out of sync state and ALPS 
> trackstick
> is sending data then driver match 5th, 6th and next 1st bytes as PS/2.
> 
> It basically means if user is using trackstick when driver is in out of sync
> state driver will never resync. Processing these bytes as 3 bytes PS/2 data
> cause total mess (random cursor movements, random clicks) and make trackstick
> unusable until psmouse driver decide to do full device reset.
> 
> Lot of users reported problems with ALPS devices on Dell Latitude E6440, E6540
> and E7440 laptops. ALPS device or Dell EC for unknown reason send some invalid
> ALPS PS/2 bytes which cause driver out of sync. It looks like that i8042 and
> psmouse/alps driver always receive group of 6 bytes packets so there are no
> missing bytes and no bytes were inserted between valid once.
> 
> This patch does not fix root of problem with ALPS devices found in Dell 
> Latitude
> laptops but it does not allow to process some (invalid) subsequence of 6 bytes
> ALPS packets as 3 bytes PS/2 when driver is out of sync.
> 
> So with this patch trackstick input device does not report bogus data when
> also driver is out of sync, so trackstick should be usable on those machines.
> 
> Unknown is also information which ALPS devices send 3 bytes packets and why
> ALPS driver needs to handle also bare PS/2 packets. According to git (and plus
> historic tree from bitkeeper) code for processing 3 bytes bare PS/2 packets
> is there since first version of alps.c existence (since 2.6.9-rc2).

I believe it was to handle external devices plugged into PS/2 ports on
Dell laptops (maybe?). Dell laptops do not use active multiplexing
controller so everything comes mixed into single data stream.

> 
> We do not want to break some older ALPS devices. And disabling processing bare
> PS/2 packets when driver is out of sync should not break it.
> 
> Signed-off-by: Pali Rohár 
> Tested-by: Pali Rohár 
> Cc: sta...@vger.kernel.org

Applied, thank you.

> ---
>  drivers/input/mouse/alps.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 2b0ae8c..a772745 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -1156,7 +1156,9 @@ static psmouse_ret_t alps_process_byte(struct psmouse 
> *psmouse)
>  {
>   struct alps_data *priv = psmouse->private;
>  
> - if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
> + /* FIXME: Could we receive bare PS/2 packets from DualPoint devices?? */
> + if (!psmouse->out_of_sync_cnt &&
> + (psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
>   if (psmouse->pktcnt == 3) {
>   alps_report_bare_ps2_packet(psmouse, psmouse->packet,
>   true);
> -- 
> 1.7.9.5
> 

-- 
Dmitry
--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Joe Perches
On Sat, 2014-11-08 at 11:01 -0800, Josh Triplett wrote:
> On Sat, Nov 08, 2014 at 08:37:27PM +0200, Oded Gabbay wrote:
> >  CREDITS |  7 +++
> >  MAINTAINERS | 10 ++
> >  2 files changed, 17 insertions(+)
> 
> Given the wide variety of folks who patch CREDITS and MAINTAINERS, might
> I suggest adding CREDITS and MAINTAINERS themselves to the MAINTAINERS
> file (perhaps in the same entry as get_maintainer.pl), so that
> get_maintainer.pl does not fall back to git history for them?

Thanks but:

There is no MAINTAINERS/CREDITS maintainer.

I'm not volunteering.  Maybe you?

But maybe something like this would help:

It has to have both an M: and an S: entry
with maintained or supported to stop get_maintainers
from doing a git history lookup.

---

diff --git a/MAINTAINERS b/MAINTAINERS
index 0662378..584fd69 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5881,6 +5881,12 @@ F:   drivers/mailbox/
 F: include/linux/mailbox_client.h
 F: include/linux/mailbox_controller.h
 
+MAINTAINERS/CREDITS
+M: linux-kernel@vger.kernel.org
+S: Maintained
+F: MAINTAINERS
+F: CREDITS
+
 MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
 M: Michael Kerrisk 
 W: http://www.kernel.org/doc/man-pages




--
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 1/3] trace: Replace seq_printf by simpler equivalents

2014-11-08 Thread Rasmus Villemoes
Using seq_printf to print a simple string or a single character is a
lot more expensive than it needs to be, since seq_puts and seq_putc
exist.

These patches do

  seq_printf(m, s) -> seq_puts(m, s)
  seq_printf(m, "%s", s) -> seq_puts(m, s)
  seq_printf(m, "%c", c) -> seq_putc(m, c)

Subsequent patches will simplify further.

Signed-off-by: Rasmus Villemoes 
---
 kernel/trace/ftrace.c| 30 
 kernel/trace/trace.c | 44 ++--
 kernel/trace/trace_branch.c  | 26 ++---
 kernel/trace/trace_events.c  |  4 ++--
 kernel/trace/trace_events_trigger.c  |  2 +-
 kernel/trace/trace_functions.c   |  2 +-
 kernel/trace/trace_functions_graph.c | 28 +++
 kernel/trace/trace_kprobe.c  |  4 ++--
 kernel/trace/trace_uprobe.c  |  2 +-
 9 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 5916a8e..7890718 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -556,13 +556,13 @@ static int function_stat_cmp(void *p1, void *p2)
 static int function_stat_headers(struct seq_file *m)
 {
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-   seq_printf(m, "  Function   "
-  "HitTimeAvg s^2\n"
- "     "
-  "------ ---\n");
+   seq_puts(m, "  Function   "
+"HitTimeAvg s^2\n"
+   "     "
+"------ ---\n");
 #else
-   seq_printf(m, "  Function   Hit\n"
- "     ---\n");
+   seq_puts(m, "  Function   Hit\n"
+   "     ---\n");
 #endif
return 0;
 }
@@ -589,7 +589,7 @@ static int function_stat_show(struct seq_file *m, void *v)
seq_printf(m, "  %-30.30s  %10lu", str, rec->counter);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-   seq_printf(m, "");
+   seq_puts(m, "");
avg = rec->time;
do_div(avg, rec->counter);
 
@@ -2941,9 +2941,9 @@ static int t_show(struct seq_file *m, void *v)
 
if (iter->flags & FTRACE_ITER_PRINTALL) {
if (iter->flags & FTRACE_ITER_NOTRACE)
-   seq_printf(m, " no functions disabled \n");
+   seq_puts(m, " no functions disabled \n");
else
-   seq_printf(m, " all functions enabled \n");
+   seq_puts(m, " all functions enabled \n");
return 0;
}
 
@@ -2965,11 +2965,11 @@ static int t_show(struct seq_file *m, void *v)
seq_printf(m, "\ttramp: %pS",
   (void *)ops->trampoline);
else
-   seq_printf(m, "\ttramp: ERROR!");
+   seq_puts(m, "\ttramp: ERROR!");
}
}   
 
-   seq_printf(m, "\n");
+   seq_puts(m, "\n");
 
return 0;
 }
@@ -4149,9 +4149,9 @@ static int g_show(struct seq_file *m, void *v)
struct ftrace_graph_data *fgd = m->private;
 
if (fgd->table == ftrace_graph_funcs)
-   seq_printf(m, " all functions enabled \n");
+   seq_puts(m, " all functions enabled \n");
else
-   seq_printf(m, " no functions disabled \n");
+   seq_puts(m, " no functions disabled \n");
return 0;
}
 
@@ -4989,12 +4989,12 @@ static int fpid_show(struct seq_file *m, void *v)
const struct ftrace_pid *fpid = list_entry(v, struct ftrace_pid, list);
 
if (v == (void *)1) {
-   seq_printf(m, "no pid\n");
+   seq_puts(m, "no pid\n");
return 0;
}
 
if (fpid->pid == ftrace_swapper_pid)
-   seq_printf(m, "swapper tasks\n");
+   seq_puts(m, "swapper tasks\n");
else
seq_printf(m, "%u\n", pid_vnr(fpid->pid));
 
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8a52839..77bb64f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2859,44 +2859,44 @@ static void test_ftrace_alive(struct seq_file *m)
 {
if (!ftrace_is_dead())
return;
-   seq_printf(m, "# WARNING: FUNCTION TRACING IS CORRUPTED\n");
-   seq_printf(m, "#  MAY BE MISSING FUNCTION EVENTS\n");
+   seq_puts(m, "# WARNING: FUNCTION TRACING IS CORRUPTED\n");
+   seq_puts(m, "#  MAY BE MISSING 

[PATCH v2 3/3] trace: Replace single-character seq_puts with seq_putc

2014-11-08 Thread Rasmus Villemoes
Printing a single character to a seqfile might as well be done with
seq_putc instead of seq_puts; this avoids a strlen() call and a memory
access. It also shaves another few bytes off the generated code.

Signed-off-by: Rasmus Villemoes 
---
 kernel/trace/ftrace.c|  2 +-
 kernel/trace/trace_events_trigger.c  |  4 ++--
 kernel/trace/trace_functions_graph.c |  4 ++--
 kernel/trace/trace_kprobe.c  | 10 +-
 kernel/trace/trace_printk.c  |  2 +-
 kernel/trace/trace_uprobe.c  |  4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7890718..9ffd006 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2969,7 +2969,7 @@ static int t_show(struct seq_file *m, void *v)
}
}   
 
-   seq_puts(m, "\n");
+   seq_putc(m, '\n');
 
return 0;
 }
diff --git a/kernel/trace/trace_events_trigger.c 
b/kernel/trace/trace_events_trigger.c
index 3d89ffc..8712df9 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -383,7 +383,7 @@ event_trigger_print(const char *name, struct seq_file *m,
if (filter_str)
seq_printf(m, " if %s\n", filter_str);
else
-   seq_puts(m, "\n");
+   seq_putc(m, '\n');
 
return 0;
 }
@@ -1105,7 +1105,7 @@ event_enable_trigger_print(struct seq_file *m, struct 
event_trigger_ops *ops,
if (data->filter_str)
seq_printf(m, " if %s\n", data->filter_str);
else
-   seq_puts(m, "\n");
+   seq_putc(m, '\n');
 
return 0;
 }
diff --git a/kernel/trace/trace_functions_graph.c 
b/kernel/trace/trace_functions_graph.c
index 29ba611..a82d1d3 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1407,7 +1407,7 @@ static void __print_graph_headers_flags(struct seq_file 
*s, u32 flags)
print_lat_header(s, flags);
 
/* 1st line */
-   seq_puts(s, "#");
+   seq_putc(s, '#');
if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
seq_puts(s, " TIME   ");
if (flags & TRACE_GRAPH_PRINT_CPU)
@@ -1421,7 +1421,7 @@ static void __print_graph_headers_flags(struct seq_file 
*s, u32 flags)
seq_puts(s, "   FUNCTION CALLS\n");
 
/* 2nd line */
-   seq_puts(s, "#");
+   seq_putc(s, '#');
if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
seq_puts(s, "  | ");
if (flags & TRACE_GRAPH_PRINT_CPU)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index ce2ea71..ef7e7f1 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -840,7 +840,7 @@ static int probes_seq_show(struct seq_file *m, void *v)
 
for (i = 0; i < tk->tp.nr_args; i++)
seq_printf(m, " %s=%s", tk->tp.args[i].name, 
tk->tp.args[i].comm);
-   seq_puts(m, "\n");
+   seq_putc(m, '\n');
 
return 0;
 }
@@ -1030,7 +1030,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
goto partial;
 
-   if (!trace_seq_puts(s, ")"))
+   if (!trace_seq_putc(s, ')'))
goto partial;
 
data = (u8 *)[1];
@@ -1039,7 +1039,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
 data + tp->args[i].offset, field))
goto partial;
 
-   if (!trace_seq_puts(s, "\n"))
+   if (!trace_seq_putc(s, '\n'))
goto partial;
 
return TRACE_TYPE_HANDLED;
@@ -1072,7 +1072,7 @@ print_kretprobe_event(struct trace_iterator *iter, int 
flags,
if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
goto partial;
 
-   if (!trace_seq_puts(s, ")"))
+   if (!trace_seq_putc(s, ')'))
goto partial;
 
data = (u8 *)[1];
@@ -1081,7 +1081,7 @@ print_kretprobe_event(struct trace_iterator *iter, int 
flags,
 data + tp->args[i].offset, field))
goto partial;
 
-   if (!trace_seq_puts(s, "\n"))
+   if (!trace_seq_putc(s, '\n'))
goto partial;
 
return TRACE_TYPE_HANDLED;
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 2900817..c4e70b6 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -305,7 +305,7 @@ static int t_show(struct seq_file *m, void *v)
seq_puts(m, "\\t");
break;
case '\\':
-   seq_puts(m, "\\");
+   seq_putc(m, '\\');
break;
case '"':
seq_puts(m, "\\\"");
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c

[PATCH v2 2/3] trace: Merge consecutive seq_puts calls

2014-11-08 Thread Rasmus Villemoes
Consecutive seq_puts calls with literal strings can be merged to a
single call. This reduces the size of the generated code, and can also
lead to slight .rodata reduction (because of fewer nul and padding
bytes). It should also shave a off a few clock cycles.

Signed-off-by: Rasmus Villemoes 
---
 kernel/trace/trace.c| 64 ++---
 kernel/trace/trace_branch.c | 14 +-
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 77bb64f..32fb5a4 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2508,14 +2508,14 @@ get_total_entries(struct trace_buffer *buf,
 
 static void print_lat_help_header(struct seq_file *m)
 {
-   seq_puts(m, "#  _--=> CPU#\n");
-   seq_puts(m, "# / _-=> irqs-off\n");
-   seq_puts(m, "#| / _=> need-resched\n");
-   seq_puts(m, "#|| / _---=> hardirq/softirq \n");
-   seq_puts(m, "#||| / _--=> preempt-depth   \n");
-   seq_puts(m, "# / delay \n");
-   seq_puts(m, "#  cmd pid   | time  |   caller  \n");
-   seq_puts(m, "# \\   /  |  \\|   /   \n");
+   seq_puts(m, "#  _--=> CPU#\n"
+   "# / _-=> irqs-off\n"
+   "#| / _=> need-resched\n"
+   "#|| / _---=> hardirq/softirq \n"
+   "#||| / _--=> preempt-depth   \n"
+   "# / delay\n"
+   "#  cmd pid   | time  |   caller  \n"
+   "# \\   /  |  \\|   / \n");
 }
 
 static void print_event_info(struct trace_buffer *buf, struct seq_file *m)
@@ -2532,20 +2532,20 @@ static void print_event_info(struct trace_buffer *buf, 
struct seq_file *m)
 static void print_func_help_header(struct trace_buffer *buf, struct seq_file 
*m)
 {
print_event_info(buf, m);
-   seq_puts(m, "#   TASK-PID   CPU#  TIMESTAMP  FUNCTION\n");
-   seq_puts(m, "#  | |   |  | |\n");
+   seq_puts(m, "#   TASK-PID   CPU#  TIMESTAMP  FUNCTION\n"
+   "#  | |   |  | |\n");
 }
 
 static void print_func_help_header_irq(struct trace_buffer *buf, struct 
seq_file *m)
 {
print_event_info(buf, m);
-   seq_puts(m, "#  _-=> irqs-off\n");
-   seq_puts(m, "# / _=> need-resched\n");
-   seq_puts(m, "#| / _---=> 
hardirq/softirq\n");
-   seq_puts(m, "#|| / _--=> preempt-depth\n");
-   seq_puts(m, "#||| / delay\n");
-   seq_puts(m, "#   TASK-PID   CPU#  TIMESTAMP  
FUNCTION\n");
-   seq_puts(m, "#  | |   |      | |\n");
+   seq_puts(m, "#  _-=> irqs-off\n"
+   "# / _=> need-resched\n"
+   "#| / _---=> hardirq/softirq\n"
+   "#|| / _--=> preempt-depth\n"
+   "#||| / delay\n"
+   "#   TASK-PID   CPU#  TIMESTAMP  FUNCTION\n"
+   "#  | |   |      | |\n");
 }
 
 void
@@ -2859,34 +2859,34 @@ static void test_ftrace_alive(struct seq_file *m)
 {
if (!ftrace_is_dead())
return;
-   seq_puts(m, "# WARNING: FUNCTION TRACING IS CORRUPTED\n");
-   seq_puts(m, "#  MAY BE MISSING FUNCTION EVENTS\n");
+   seq_puts(m, "# WARNING: FUNCTION TRACING IS CORRUPTED\n"
+   "#  MAY BE MISSING FUNCTION EVENTS\n");
 }
 
 #ifdef CONFIG_TRACER_MAX_TRACE
 static void show_snapshot_main_help(struct seq_file *m)
 {
-   seq_puts(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n");
-   seq_puts(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not 
already allocated.\n");
-   seq_puts(m, "#  Takes a snapshot of the main 
buffer.\n");
-   seq_puts(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not 
allocate or free)\n");
-   seq_puts(m, "#  (Doesn't have to be '2' works with 
any number that\n");
-   seq_puts(m, "#   is not a '0' or '1')\n");
+   seq_puts(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n"
+   "# echo 1 > snapshot : Allocates snapshot buffer, if not 
already allocated.\n"
+   "#  Takes a 

[PATCH v2 0/3] trace: Use simpler seq_file functions

2014-11-08 Thread Rasmus Villemoes
Using printf to print a simple string or puts to print a single
character is more expensive than it needs to be. Also, consecutive
puts calls can be replaced by a single call. These patches do this to
kernel/trace/, saving ~256 bytes of .text.

v2: Keep the original splitting of strings across lines.

Rasmus Villemoes (3):
  trace: Replace seq_printf by simpler equivalents
  trace: Merge consecutive seq_puts calls
  trace: Replace single-character seq_puts with seq_putc

 kernel/trace/ftrace.c| 30 +++---
 kernel/trace/trace.c | 78 ++--
 kernel/trace/trace_branch.c  | 32 +++
 kernel/trace/trace_events.c  |  4 +-
 kernel/trace/trace_events_trigger.c  |  6 +--
 kernel/trace/trace_functions.c   |  2 +-
 kernel/trace/trace_functions_graph.c | 28 ++---
 kernel/trace/trace_kprobe.c  | 12 +++---
 kernel/trace/trace_printk.c  |  2 +-
 kernel/trace/trace_uprobe.c  |  4 +-
 10 files changed, 99 insertions(+), 99 deletions(-)

-- 
2.0.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] Input: twl4030-pwrbutton: ensure a wakeup event is recorded.

2014-11-08 Thread Dmitry Torokhov
On Sat, Nov 08, 2014 at 10:40:15AM +1100, NeilBrown wrote:
> 
> 
> This button is treated as a wakeup source, so we need to initialise it
> correctly.
> 
> Without the device_init_wakeup() call, dev->power.wakeup will
> be NULL, and pm_wakeup_event() will do nothing.
> 
> Signed-off-by: NeilBrown 

Applied, thank you.

> 
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c 
> b/drivers/input/misc/twl4030-pwrbutton.c
> index fb3b63b2f85c..8400a1a34d87 100644
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ b/drivers/input/misc/twl4030-pwrbutton.c
> @@ -85,6 +85,7 @@ static int twl4030_pwrbutton_probe(struct platform_device 
> *pdev)
>   }
>  
>   platform_set_drvdata(pdev, pwr);
> + device_init_wakeup(>dev, true);
>  
>   return 0;
>  }



-- 
Dmitry
--
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] hda_intel: Add DeviceIDs for Sunrise Point-LP

2014-11-08 Thread Takashi Iwai
At Fri, 07 Nov 2014 18:02:47 -0500,
Devin Ryles wrote:
> 
> >From e02662c35ea1352ce711701a46f85e3547f842e1 Mon Sep 17 00:00:00 2001
> From: Devin Ryles 
> Date: Thu, 6 Nov 2014 12:35:25 -0500
> Subject: [PATCH 3/3] hda_intel: Add DeviceIDs for Sunrise Point-LP
> 
> This patch adds DeviceIDs for Sunrise Point-LP
> 
> Signed-off-by: Devin Ryles 

Thanks, applied.


Takashi

> ---
>  sound/pci/hda/hda_intel.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index 9ab1e63..16660f3 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -219,6 +219,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
>"{Intel, LPT_LP},"
>"{Intel, WPT_LP},"
>"{Intel, SPT},"
> +  "{Intel, SPT_LP},"
>"{Intel, HPT},"
>"{Intel, PBG},"
>"{Intel, SCH},"
> @@ -2004,6 +2005,9 @@ static const struct pci_device_id azx_ids[] = {
>   /* Sunrise Point */
>   { PCI_DEVICE(0x8086, 0xa170),
> .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
> + /* Sunrise Point-LP */
> + { PCI_DEVICE(0x8086, 0x9d70),
> +   .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
>   /* Haswell */
>   { PCI_DEVICE(0x8086, 0x0a0c),
> .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL },
> -- 
> 1.9.3
> 
> 
> 
--
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] checkkconfigsymbols.py: improve detection of defects

2014-11-08 Thread Valentin Rothberg
This patch improves the detection of defects by updating the
regular expression to find Kconfig identifiers in the source
code, and fixes some cases of false positives. The following
changes are made:
- improve regex to find Kconfig identifiers in the source
- exclude .log files from analysis
- improve filtering of false positives (e.g, CONFIG_XXX)
- change output format from (feature:\tlist) to (feature\tlist)

Signed-off-by: Valentin Rothberg 
---
Changelog:
This patch bases on version 6 (https://lkml.org/lkml/2014/9/27/93)
of a patch which has been picked up by Greg in his misc-char tree
in the char-misc-next branch. Version 6 replaces the old shell
script with a new implementation in python.
---
 scripts/checkkconfigsymbols.py | 57 --
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index f944089..e9cc689 100644
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -1,36 +1,31 @@
 #!/usr/bin/env python
 
-"""Find Kconfig identifieres that are referenced but not defined."""
+"""Find Kconfig identifiers that are referenced but not defined."""
 
-# Copyright (C) 2014 Valentin Rothberg 
-# Copyright (C) 2014 Stefan Hengelein 
+# (c) 2014 Valentin Rothberg 
+# (c) 2014 Stefan Hengelein 
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope 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.
+# Licensed under the terms of the GNU GPL License version 2
 
 
 import os
 import re
 from subprocess import Popen, PIPE, STDOUT
 
-# REGEX EXPRESSIONS
+
+# regex expressions
 OPERATORS = r"&|\(|\)|\||\!"
-FEATURE = r"\w*[A-Z]{1}\w*"
-CONFIG_DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*"
+FEATURE = r"(?:\w*[A-Z0-9]\w*){2,}"
+DEF = r"^\s*(?:menu){,1}config\s+(" + FEATURE + r")\s*"
 EXPR = r"(?:" + OPERATORS + r"|\s|" + FEATURE + r")+"
 STMT = r"^\s*(?:if|select|depends\s+on)\s+" + EXPR
+SOURCE_FEATURE = r"(?:\W|\b)+[D]{,1}CONFIG_(" + FEATURE + r")"
 
-# REGEX OBJECTS
+# regex objects
 REGEX_FILE_KCONFIG = re.compile(r".*Kconfig[\.\w+\-]*$")
 REGEX_FEATURE = re.compile(r"(" + FEATURE + r")")
-REGEX_SOURCE_FEATURE = re.compile(r"(?:D|\W|\b)+CONFIG_(" + FEATURE + r")")
-REGEX_KCONFIG_DEF = re.compile(CONFIG_DEF)
+REGEX_SOURCE_FEATURE = re.compile(SOURCE_FEATURE)
+REGEX_KCONFIG_DEF = re.compile(DEF)
 REGEX_KCONFIG_EXPR = re.compile(EXPR)
 REGEX_KCONFIG_STMT = re.compile(STMT)
 REGEX_KCONFIG_HELP = re.compile(r"^\s+(help|---help---)\s*$")
@@ -42,7 +37,7 @@ def main():
 source_files = []
 kconfig_files = []
 defined_features = set()
-referenced_features = dict()
+referenced_features = dict()  # {feature: [files]}
 
 # use 'git ls-files' to get the worklist
 pop = Popen("git ls-files", stdout=PIPE, stderr=STDOUT, shell=True)
@@ -52,12 +47,12 @@ def main():
 
 for gitfile in stdout.rsplit("\n"):
 if ".git" in gitfile or "ChangeLog" in gitfile or \
-os.path.isdir(gitfile):
+".log" in gitfile or os.path.isdir(gitfile):
 continue
 if REGEX_FILE_KCONFIG.match(gitfile):
 kconfig_files.append(gitfile)
 else:
-# All non-Kconfig files are checked for consistency
+# all non-Kconfig files are checked for consistency
 source_files.append(gitfile)
 
 for sfile in source_files:
@@ -68,15 +63,17 @@ def main():
 
 print "Undefined symbol used\tFile list"
 for feature in sorted(referenced_features):
+# filter some false positives
+if feature == "FOO" or feature == "BAR" or \
+feature == "FOO_BAR" or feature == "XXX":
+continue
 if feature not in defined_features:
 if feature.endswith("_MODULE"):
-# Avoid false positives for kernel modules
+# avoid false positives for kernel modules
 if feature[:-len("_MODULE")] in defined_features:
 continue
-if "FOO" in feature or "BAR" in feature:
-continue
 files = referenced_features.get(feature)
-print "%s:\t%s" % (feature, ", ".join(files))
+print "%s\t%s" % (feature, ", ".join(files))
 
 
 def parse_source_file(sfile, referenced_features):
@@ -92,9 +89,9 @@ def parse_source_file(sfile, referenced_features):
 for feature in features:
 if not REGEX_FILTER_FEATURES.search(feature):
 continue
-paths = referenced_features.get(feature, set())
-paths.add(sfile)
-referenced_features[feature] = paths
+

Re: [PATCH] staging: skein: fixed sparse warnings related to static declarations

2014-11-08 Thread Jason Cooper
On Sat, Nov 08, 2014 at 04:49:18PM +0100, Niklas Svensson wrote:
> drivers/staging/skein/skein_generic.c:30:5: warning: symbol 'skein256_update' 
> was not declared. Should it be static?
> drivers/staging/skein/skein_generic.c:65:5: warning: symbol 'skein512_update' 
> was not declared. Should it be static?
> drivers/staging/skein/skein_generic.c:100:5: warning: symbol 
> 'skein1024_update' was not declared. Should it be static?
> 
> Signed-off-by: Niklas Svensson 
> ---
>  drivers/staging/skein/skein_generic.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

What tree/tag is this patch against?  There've been quite a few changes
to the api this time around.

thx,

Jason.
--
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 v1 0/3] Transition pxa25x clock to common clocks

2014-11-08 Thread Dmitry Eremin-Solenikov
2014-11-08 20:26 GMT+03:00 Robert Jarzmik :
> Dmitry Eremin-Solenikov  writes:
>
>> Hello,
>> Tested in qemu (pxa25x target).
>>
>> 2) sa1100-rtc could not find a clock and thus failed to be probed.
>> 4) Got an issue with IrDA driver - it gets -ENODEV for UARTCLK clock
>
> Hi Dmitry,
>
> Would you mind retesting with the patch in [1] applied to see if points 2 and 
> 4
> are fixed ? Alternatively you can refetch from the github tree, I included 
> that
> incremental patch there too.
>
> If it works correctly for you, could I have your Tested-by ? If not, tell me 
> and
> I'll try to figure out what's wrong.

Tested in qemu, everything works fine. I will test on the real hardware tomorow.

BTW: It looks like pxa27x also shows the same behaviour wrt. sa1100-rtc and
pxa2xx-ir (after reverting a revert).

-- 
With best wishes
Dmitry
--
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] tty: serial: msm_serial: Use DT aliases

2014-11-08 Thread Arnd Bergmann
On Friday 07 November 2014 13:35:45 Frank Rowand wrote:
> On 11/7/2014 1:47 AM, Arnd Bergmann wrote:
> > On Thursday 06 November 2014 22:42:47 Frank Rowand wrote:
> >> This same change is also needed in:
> >>
> >>   qcom-ipq8064.dtsi
> >>   qcom-msm8960.dtsi
> >>   qcom-apq8084.dtsi
> >>   qcom-apq8064.dtsi
> >>   qcom-msm8660.dtsi
> >>
> >> but I did not want to just blindly apply those changes without testing.
> >>
> > 
> > Is there only one uart on each of these?
> > 
> > If not, it would be better to put the aliases in the board specific file,
> > pointing to whichever ports are in use, in the order that makes sense
> > for that board.
> 
> Good point, thanks for bringing it up.
> 
> Your comment made me verify that the board dts files can override the
> aliases from the included .dtsi.  So not a problem to have a default
> set of aliases in the .dtsi files.

I would think it's better to keep them in the per-board file out of
principle though.

Arnd
--
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/3] firmware loader: Introduce new API - request_firmware_abort()

2014-11-08 Thread Greg Kroah-Hartman
On Mon, Nov 03, 2014 at 11:07:08AM +0800, Kweh Hock Leong wrote:
> From: "Kweh, Hock Leong" 
> 
> Besides aborting through user helper interface, a new API
> request_firmware_abort() allows kernel driver module to abort the
> request_firmware() / request_firmware_nowait() when they are no
> longer needed. It is useful for cancelling an outstanding firmware
> load if initiated from inside a module where that module is in the
> process of being unloaded, since the unload function may not have
> a handle to the struct firmware_buf.
> 
> Note for people who use request_firmware_nowait():
> You are required to do your own synchronization after you call
> request_firmware_abort() in order to continue unloading the
> module. The example synchronization code shows below:
> 
> while (THIS_MODULE && module_refcount(THIS_MODULE))
>   msleep(20);

As others have pointed out, this isn't ok, and is totally racy and
should never end up in a driver.  Never mess with THIS_MODULE from
within the same module, otherwise it's racy and broken code.

So can you please rework this to not require this?

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 v2 2/3] firmware loader: fix hung task warning dump

2014-11-08 Thread Greg Kroah-Hartman
On Mon, Nov 03, 2014 at 11:07:09AM +0800, Kweh Hock Leong wrote:
> From: "Kweh, Hock Leong" 
> 
> When using request_firmware_nowait() with FW_ACTION_NOHOTPLUG param to
> expose user helper interface, if the user do not react immediately, after
> 120 seconds there will be a hung task warning message dumped as below:
> 
> [ 3000.784235] INFO: task kworker/0:0:8259 blocked for more than 120 seconds.
> [ 3000.791281]   Tainted: GE 3.16.0-rc1-yocto-standard #41
> [ 3000.798082] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables 
> this message.
> [ 3000.806072] kworker/0:0 D cd0075c8 0  8259  2 0x
> [ 3000.812765] Workqueue: events request_firmware_work_func
> [ 3000.818253]  cd375e18 0046 000e cd0075c8 00f0 cd40ea00 
> cd375fec 1b883e89
> [ 3000.826374]  026b cd40ea00 8000 0001 cd0075c8  
> cd375de4 c119917f
> [ 3000.834492]  cd563360 cd375df4 c119a0ab cd563360  cd375e24 
> c119a1d6 
> [ 3000.842616] Call Trace:
> [ 3000.845252]  [] ? kernfs_next_descendant_post+0x3f/0x50
> [ 3000.851543]  [] ? kernfs_activate+0x6b/0xc0
> [ 3000.856790]  [] ? kernfs_add_one+0xd6/0x130
> [ 3000.862047]  [] schedule+0x22/0x60
> [ 3000.866548]  [] schedule_timeout+0x175/0x1d0
> [ 3000.871887]  [] ? __kernfs_create_file+0x71/0xa0
> [ 3000.877574]  [] ? sysfs_add_file_mode_ns+0xaa/0x180
> [ 3000.883533]  [] wait_for_completion+0x6f/0xb0
> [ 3000.888961]  [] ? wake_up_process+0x40/0x40
> [ 3000.894219]  [] _request_firmware+0x750/0x9f0
> [ 3000.899666]  [] ? n_tty_receive_buf2+0x1f/0x30
> [ 3000.905200]  [] request_firmware_work_func+0x22/0x50
> [ 3000.911235]  [] process_one_work+0x122/0x380
> [ 3000.916571]  [] worker_thread+0xf9/0x470
> [ 3000.921555]  [] ? create_and_start_worker+0x50/0x50
> [ 3000.927497]  [] ? create_and_start_worker+0x50/0x50
> [ 3000.933448]  [] kthread+0x9f/0xc0
> [ 3000.937850]  [] ret_from_kernel_thread+0x20/0x30
> [ 3000.943548]  [] ? kthread_worker_fn+0x100/0x100
> 
> This patch change the wait_for_completion() function call to
> wait_for_completion_interruptible() function call for solving the issue.
> 
> Cc: Matt Fleming 
> Signed-off-by: Kweh, Hock Leong 

Acked-by: Greg Kroah-Hartman 
--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Josh Triplett
On Sat, Nov 08, 2014 at 08:37:27PM +0200, Oded Gabbay wrote:
>  CREDITS |  7 +++
>  MAINTAINERS | 10 ++
>  2 files changed, 17 insertions(+)

Given the wide variety of folks who patch CREDITS and MAINTAINERS, might
I suggest adding CREDITS and MAINTAINERS themselves to the MAINTAINERS
file (perhaps in the same entry as get_maintainer.pl), so that
get_maintainer.pl does not fall back to git history for them?

- Josh Triplett
--
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/


[GIT PULL] Driver core fixes for 3.18-rc4

2014-11-08 Thread Greg KH
The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/ 
tags/driver-core-3.18-rc4

for you to fetch changes up to cd3d9ea142c9fd47351e79fe30c7ae2c86302cda:

  tiny: rename ENABLE_DEV_COREDUMP to ALLOW_DEV_COREDUMP (2014-11-07 11:07:35 
-0800)


Driver core fixes for 3.18-rc4

Here are 3 tiny fixes for 3.18-rc4.  One fixes up a long-stading race
condition in the driver core for removing directories in
/sys/devices/virtual/ and the other 2 fix up the wording of a new
Kconfig option that was added in 3.18-rc1.

Signed-off-by: Greg Kroah-Hartman 


Aristeu Rozanski (1):
  tiny: reverse logic for DISABLE_DEV_COREDUMP

Johannes Berg (1):
  tiny: rename ENABLE_DEV_COREDUMP to ALLOW_DEV_COREDUMP

Yijing Wang (1):
  sysfs: driver core: Fix glue dir race condition by gdp_mutex

 drivers/base/Kconfig | 19 +++
 drivers/base/core.c  |  4 +++-
 2 files changed, 14 insertions(+), 9 deletions(-)
--
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/


[GIT PULL] TTY/Serial fixes for 3.18-rc3

2014-11-08 Thread Greg KH
The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/ 
tags/tty-3.18-rc4

for you to fetch changes up to c4dc304677e8d566572c4738d95c48be150c6606:

  tty: Fix pty master poll() after slave closes v2 (2014-11-06 12:23:36 -0800)


TTY/Serial fixes for 3.18-rc4

Here are some tiny serial/tty fixes for 3.18-rc4 that resolve some
reported issues.

Signed-off-by: Greg Kroah-Hartman 


Francesco Ruggeri (1):
  tty: Fix pty master poll() after slave closes v2

Imre Deak (1):
  tty/vt: don't set font mappings on vc not supporting this

Jingchang Lu (1):
  serial: of-serial: fix uninitialized kmalloc variable

Matthias Brugger (1):
  tty: serial: 8250_mtk: Fix quot calculation

Peter Hurley (3):
  serial: Fix divide-by-zero fault in uart_get_divisor()
  tty: Fix high cpu load if tty is unreleaseable
  tty: Prevent "read/write wait queue active!" log flooding

 drivers/tty/n_tty.c|  9 +++--
 drivers/tty/serial/8250/8250_mtk.c |  2 +-
 drivers/tty/serial/of_serial.c |  2 +-
 drivers/tty/serial/serial_core.c   |  2 +-
 drivers/tty/tty_io.c   | 15 ---
 drivers/tty/vt/consolemap.c|  7 +++
 6 files changed, 29 insertions(+), 8 deletions(-)
--
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/


[GIT PULL] Staging driver fixes for 3.18-rc4

2014-11-08 Thread Greg KH
The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-3.18-rc4

for you to fetch changes up to bce20b2396626301c65e08306364bce9a7505ae5:

  Merge tag 'iio-fixes-for-3.18b' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2014-11-05 11:30:45 -0800)


Staging driver fixes for 3.18-rc4

Here are some staging/iio fixes for 3.18-rc4.

Nothing major, just a few bugfixes of things that have been reported.

Signed-off-by: Greg Kroah-Hartman 


Dan Murphy (1):
  iio: tsl4531: Fix compiler error when CONFIG_PM_OPS is not defined

Daniel Baluta (1):
  io: accel: kxcjk-1013: Fix iio_event_spec direction

Fabio Estevam (1):
  iio: adc: mxs-lradc: Disable the clock on probe failure

George McCollister (1):
  iio: as3935: allocate correct iio_device size

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-3.18b' of git://git.kernel.org/.../jic23/iio 
into staging-linus

Lars-Peter Clausen (5):
  staging:iio:ad5933: Fix NULL pointer deref when enabling buffer
  staging:iio:ad5933: Drop "raw" from channel names
  staging:iio:ade7758: Fix NULL pointer deref when enabling buffer
  staging:iio:ade7758: Fix check if channels are enabled in prenable
  staging:iio:ade7758: Remove "raw" from channel name

Robin van der Gracht (1):
  iio: st_sensors: Fix buffer copy

 drivers/iio/accel/kxcjk-1013.c   |  2 +-
 drivers/iio/light/tsl4531.c  |  7 ++--
 drivers/iio/proximity/as3935.c   |  2 +-
 drivers/staging/iio/meter/ade7758.h  |  1 -
 drivers/staging/iio/meter/ade7758_core.c | 57 ++--
 drivers/staging/iio/meter/ade7758_ring.c |  5 ++-
 6 files changed, 20 insertions(+), 54 deletions(-)
--
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/


[GIT PULL] USB driver fixes for 3.18-rc4

2014-11-08 Thread Greg KH
The following changes since commit 0df1f2487d2f0d04703f142813d53615d62a1da4:

  Linux 3.18-rc3 (2014-11-02 15:01:51 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ 
tags/usb-3.18-rc4

for you to fetch changes up to 1910195423e7bea4c01c42bfe3f81792a6e969bb:

  USB: Update default usb-storage delay_use value in kernel-parameters.txt 
(2014-11-07 08:54:53 -0800)


USB fixes for 3.18-rc4

Here are some USB fixes for 3.18-rc4.

Just a bunch of little fixes resolving reported issues and new device ids for
existing drivers.  Full details are in the shortlog.

Signed-off-by: Greg Kroah-Hartman 


Adel Gadllah (2):
  USB: quirks: enable device-qualifier quirk for another Elan touchscreen
  USB: quirks: enable device-qualifier quirk for yet another Elan 
touchscreen

Alan Stern (1):
  usb-storage: handle a skipped data phase

Dan Carpenter (1):
  USB: HWA: fix a warning message

Greg Kroah-Hartman (3):
  Revert "storage: Replace magic number with define in 
usb_stor_euscsi_init()"
  Merge tag 'usb-serial-3.18-rc4' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus
  Merge tag 'fixes-for-v3.18-rc4' of git://git.kernel.org/.../balbi/usb 
into usb-linus

Hans de Goede (5):
  usb: Do not allow usb_alloc_streams on unconfigured devices
  uas: Add US_FL_NO_ATA_1X quirk for 1 more Seagate model
  xhci: Disable streams on Asmedia 1042 xhci controllers
  uas: Add NO_ATA_1X for VIA VL711 devices
  uas: Add US_FL_NO_ATA_1X quirk for 2 more Seagate models

Jim Paris (1):
  cdc-acm: ensure that termios get set when the port is activated

Johan Hovold (5):
  USB: kobil_sct: fix non-atomic allocation in write path
  USB: opticon: fix non-atomic allocation in write path
  USB: cdc-acm: add device id for GW Instek AFG-2225
  USB: cdc-acm: only raise DTR on transitions from B0
  USB: cdc-acm: add quirk for control-line state requests

Luis Henriques (1):
  usb: storage: fix build warnings !CONFIG_PM

Marek Szyprowski (1):
  usb: dwc2: gadget: fix enumeration issues

Mark Einon (1):
  MAINTAINERS: Remove duplicate entry for usbip driver

Mark Knibbs (2):
  USB: storage: Fix timeout in usb_stor_euscsi_init() and 
usb_stor_huawei_e220_init()
  USB: Update default usb-storage delay_use value in kernel-parameters.txt

Oliver Neukum (1):
  xhci: no switching back on non-ULT Haswell

Oussama Ghorbel (1):
  phy: omap-usb2: Enable runtime PM of omap-usb2 phy properly

Peter Chen (1):
  usb: core: notify disconnection when core detects disconnect

Sylwester Nawrocki (1):
  usb: Remove references to non-existent PLAT_S5P symbol

Tony Zheng (1):
  usb: core: need to call usb_phy_notify_connect after device setup

 Documentation/kernel-parameters.txt |  2 +-
 MAINTAINERS |  5 -
 drivers/phy/phy-omap-usb2.c |  6 --
 drivers/usb/class/cdc-acm.c | 25 +
 drivers/usb/class/cdc-acm.h |  2 ++
 drivers/usb/core/hcd.c  |  2 ++
 drivers/usb/core/hub.c  | 10 +-
 drivers/usb/core/quirks.c   |  6 ++
 drivers/usb/dwc2/gadget.c   |  2 +-
 drivers/usb/host/Kconfig|  4 ++--
 drivers/usb/host/hwa-hc.c   |  2 +-
 drivers/usb/host/xhci-pci.c | 18 --
 drivers/usb/serial/kobil_sct.c  |  5 +++--
 drivers/usb/serial/opticon.c|  2 +-
 drivers/usb/storage/initializers.c  |  4 ++--
 drivers/usb/storage/realtek_cr.c|  2 ++
 drivers/usb/storage/transport.c | 26 ++
 drivers/usb/storage/unusual_uas.h   | 28 
 18 files changed, 111 insertions(+), 40 deletions(-)
--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Oded Gabbay


On 11/08/2014 08:46 PM, Joe Perches wrote:
> On Sat, 2014-11-08 at 20:37 +0200, Oded Gabbay wrote:
> []
>> diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> @@ -610,6 +610,16 @@ F:  drivers/crypto/geode*
>>  F:  drivers/video/fbdev/geode/
>>  F:  arch/x86/include/asm/geode.h
>>  
>> +AMD KFD (radeon extension)
>> +M:  Oded Gabbay 
>> +L:  dri-de...@lists.freedesktop.org
>> +T:  git git://people.freedesktop.org/~gabbayo/linux.git
>> +S:  Supported
>> +F:  drivers/gpu/drm/radeon/amdkfd/*
>> +F:  drivers/gpu/drm/radeon/radeon_kfd.c
>> +F:  drivers/gpu/drm/radeon/radeon_kfd.h
>> +F:  include/linux/uapi/linux/kfd_ioctl.h
> 
> include/uapi/linux/kfd_ioctl.h
> 
>> +
>>  AMD IOMMU (AMD-VI)
>>  M:  Joerg Roedel 
>>  L:  io...@lists.linux-foundation.org
> 
> Please keep MAINTAINERS in alphabetical order too.
> Move this new AMD KFD section after AMD IOMMU.
> 

Thanks for the comments. Will be fixed in next version.
I also noticed I forgot to modify drivers/gpu/drm/radeon/amdkfd/* to
drivers/gpu/drm/amd/amdkfd/*

Oded
--
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 v5 24/24] amdkfd: Implement the Get Version IOCTL

2014-11-08 Thread Oded Gabbay
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 3130265..64c73ba 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -123,7 +123,16 @@ static int kfd_open(struct inode *inode, struct file 
*filep)
 static long kfd_ioctl_get_version(struct file *filep, struct kfd_process *p,
void __user *arg)
 {
-   return -ENODEV;
+   struct kfd_ioctl_get_version_args args;
+   int err = 0;
+
+   args.major_version = KFD_IOCTL_MAJOR_VERSION;
+   args.minor_version = KFD_IOCTL_MINOR_VERSION;
+
+   if (copy_to_user(arg, , sizeof(args)))
+   err = -EFAULT;
+
+   return err;
 }
 
 static int set_queue_properties_from_user(struct queue_properties 
*q_properties,
-- 
2.1.0

--
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 v5 22/24] amdkfd: Implement the Get Clock Counters IOCTL

2014-11-08 Thread Oded Gabbay
From: Evgeny Pinchuk 

Signed-off-by: Evgeny Pinchuk 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 1020faf..473f8e1 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -401,7 +401,34 @@ out:
 static long kfd_ioctl_get_clock_counters(struct file *filep,
struct kfd_process *p, void __user *arg)
 {
-   return -ENODEV;
+   struct kfd_ioctl_get_clock_counters_args args;
+   struct kfd_dev *dev;
+   struct timespec time;
+
+   if (copy_from_user(, arg, sizeof(args)))
+   return -EFAULT;
+
+   dev = kfd_device_by_id(args.gpu_id);
+   if (dev == NULL)
+   return -EINVAL;
+
+   /* Reading GPU clock counter from KGD */
+   args.gpu_clock_counter = kfd2kgd->get_gpu_clock_counter(dev->kgd);
+
+   /* No access to rdtsc. Using raw monotonic time */
+   getrawmonotonic();
+   args.cpu_clock_counter = (uint64_t)timespec_to_ns();
+
+   get_monotonic_boottime();
+   args.system_clock_counter = (uint64_t)timespec_to_ns();
+
+   /* Since the counter is in nano-seconds we use 1GHz frequency */
+   args.system_clock_freq = 10;
+
+   if (copy_to_user(arg, , sizeof(args)))
+   return -EFAULT;
+
+   return 0;
 }
 
 
-- 
2.1.0

--
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 v5 23/24] amdkfd: Implement the Get Process Aperture IOCTL

2014-11-08 Thread Oded Gabbay
From: Alexey Skidanov 

v3: Fixed debug messages

Signed-off-by: Alexey Skidanov 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 56 +++-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h|  6 
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 473f8e1..3130265 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -435,7 +435,61 @@ static long kfd_ioctl_get_clock_counters(struct file 
*filep,
 static int kfd_ioctl_get_process_apertures(struct file *filp,
struct kfd_process *p, void __user *arg)
 {
-   return -ENODEV;
+   struct kfd_ioctl_get_process_apertures_args args;
+   struct kfd_process_device_apertures *pAperture;
+   struct kfd_process_device *pdd;
+
+   dev_dbg(kfd_device, "get apertures for PASID %d", p->pasid);
+
+   if (copy_from_user(, arg, sizeof(args)))
+   return -EFAULT;
+
+   args.num_of_nodes = 0;
+
+   mutex_lock(>mutex);
+
+   /*if the process-device list isn't empty*/
+   if (kfd_has_process_device_data(p)) {
+   /* Run over all pdd of the process */
+   pdd = kfd_get_first_process_device_data(p);
+   do {
+   pAperture = _apertures[args.num_of_nodes];
+   pAperture->gpu_id = pdd->dev->id;
+   pAperture->lds_base = pdd->lds_base;
+   pAperture->lds_limit = pdd->lds_limit;
+   pAperture->gpuvm_base = pdd->gpuvm_base;
+   pAperture->gpuvm_limit = pdd->gpuvm_limit;
+   pAperture->scratch_base = pdd->scratch_base;
+   pAperture->scratch_limit = pdd->scratch_limit;
+
+   dev_dbg(kfd_device,
+   "node id %u\n", args.num_of_nodes);
+   dev_dbg(kfd_device,
+   "gpu id %u\n", pdd->dev->id);
+   dev_dbg(kfd_device,
+   "lds_base %llX\n", pdd->lds_base);
+   dev_dbg(kfd_device,
+   "lds_limit %llX\n", pdd->lds_limit);
+   dev_dbg(kfd_device,
+   "gpuvm_base %llX\n", pdd->gpuvm_base);
+   dev_dbg(kfd_device,
+   "gpuvm_limit %llX\n", pdd->gpuvm_limit);
+   dev_dbg(kfd_device,
+   "scratch_base %llX\n", pdd->scratch_base);
+   dev_dbg(kfd_device,
+   "scratch_limit %llX\n", pdd->scratch_limit);
+
+   args.num_of_nodes++;
+   } while ((pdd = kfd_get_next_process_device_data(p, pdd)) != 
NULL &&
+   (args.num_of_nodes < NUM_OF_SUPPORTED_GPUS));
+   }
+
+   mutex_unlock(>mutex);
+
+   if (copy_to_user(arg, , sizeof(args)))
+   return -EFAULT;
+
+   return 0;
 }
 
 static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 2bc34aa1..41e608d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -473,6 +473,12 @@ struct kfd_process_device 
*kfd_get_process_device_data(struct kfd_dev *dev,
struct kfd_process *p,
int create_pdd);
 
+/* Process device data iterator */
+struct kfd_process_device *kfd_get_first_process_device_data(struct 
kfd_process *p);
+struct kfd_process_device *kfd_get_next_process_device_data(struct kfd_process 
*p,
+   struct kfd_process_device *pdd);
+bool kfd_has_process_device_data(struct kfd_process *p);
+
 /* PASIDs */
 int kfd_pasid_init(void);
 void kfd_pasid_exit(void);
-- 
2.1.0

--
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 v5 21/24] amdkfd: Implement the Set Memory Policy IOCTL

2014-11-08 Thread Oded Gabbay
From: Andrew Lewycky 

Signed-off-by: Andrew Lewycky 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 52 +++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index d342035..1020faf 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include "kfd_priv.h"
+#include "kfd_device_queue_manager.h"
 
 static long kfd_ioctl(struct file *, unsigned int, unsigned long);
 static int kfd_open(struct inode *, struct file *);
@@ -345,7 +346,56 @@ static int kfd_ioctl_update_queue(struct file *filp, 
struct kfd_process *p,
 static long kfd_ioctl_set_memory_policy(struct file *filep,
struct kfd_process *p, void __user *arg)
 {
-   return -ENODEV;
+   struct kfd_ioctl_set_memory_policy_args args;
+   struct kfd_dev *dev;
+   int err = 0;
+   struct kfd_process_device *pdd;
+   enum cache_policy default_policy, alternate_policy;
+
+   if (copy_from_user(, arg, sizeof(args)))
+   return -EFAULT;
+
+   if (args.default_policy != KFD_IOC_CACHE_POLICY_COHERENT
+   && args.default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) {
+   return -EINVAL;
+   }
+
+   if (args.alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT
+   && args.alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) {
+   return -EINVAL;
+   }
+
+   dev = kfd_device_by_id(args.gpu_id);
+   if (dev == NULL)
+   return -EINVAL;
+
+   mutex_lock(>mutex);
+
+   pdd = kfd_bind_process_to_device(dev, p);
+   if (IS_ERR(pdd) < 0) {
+   err = PTR_ERR(pdd);
+   goto out;
+   }
+
+   default_policy = (args.default_policy == KFD_IOC_CACHE_POLICY_COHERENT)
+? cache_policy_coherent : cache_policy_noncoherent;
+
+   alternate_policy =
+   (args.alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT)
+  ? cache_policy_coherent : cache_policy_noncoherent;
+
+   if (!dev->dqm->set_cache_memory_policy(dev->dqm,
+   >qpd,
+   default_policy,
+   alternate_policy,
+   (void __user *)args.alternate_aperture_base,
+   args.alternate_aperture_size))
+   err = -EINVAL;
+
+out:
+   mutex_unlock(>mutex);
+
+   return err;
 }
 
 static long kfd_ioctl_get_clock_counters(struct file *filep,
-- 
2.1.0

--
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 v5 06/24] Update MAINTAINERS and CREDITS files with amdkfd info

2014-11-08 Thread Joe Perches
On Sat, 2014-11-08 at 20:37 +0200, Oded Gabbay wrote:
[]
> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -610,6 +610,16 @@ F:   drivers/crypto/geode*
>  F:   drivers/video/fbdev/geode/
>  F:   arch/x86/include/asm/geode.h
>  
> +AMD KFD (radeon extension)
> +M:   Oded Gabbay 
> +L:   dri-de...@lists.freedesktop.org
> +T:   git git://people.freedesktop.org/~gabbayo/linux.git
> +S:   Supported
> +F:   drivers/gpu/drm/radeon/amdkfd/*
> +F:   drivers/gpu/drm/radeon/radeon_kfd.c
> +F:   drivers/gpu/drm/radeon/radeon_kfd.h
> +F:   include/linux/uapi/linux/kfd_ioctl.h

include/uapi/linux/kfd_ioctl.h

> +
>  AMD IOMMU (AMD-VI)
>  M:   Joerg Roedel 
>  L:   io...@lists.linux-foundation.org

Please keep MAINTAINERS in alphabetical order too.
Move this new AMD KFD section after AMD IOMMU.

--
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 v5 20/24] amdkfd: Implement the create/destroy/update queue IOCTLs

2014-11-08 Thread Oded Gabbay
v3: Removed the use of internal typedefs, fixed debug prints, added checks
for parameters and moved to using doorbell address from user

v4: Extracted some of the code in the create queue ioctl to a different
function that may be also called from other ioctls in the future.
Also fixed the check of the ring size argument.

v5:

Add support for AQL queues creation to enable working with open-source HSA
runtime

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 205 ++-
 1 file changed, 202 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 58441cd..d342035 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -125,22 +125,221 @@ static long kfd_ioctl_get_version(struct file *filep, 
struct kfd_process *p,
return -ENODEV;
 }
 
+static int set_queue_properties_from_user(struct queue_properties 
*q_properties,
+   struct kfd_ioctl_create_queue_args *args)
+{
+   if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) {
+   pr_err("kfd: queue percentage must be between 0 to 
KFD_MAX_QUEUE_PERCENTAGE\n");
+   return -EINVAL;
+   }
+
+   if (args->queue_priority > KFD_MAX_QUEUE_PRIORITY) {
+   pr_err("kfd: queue priority must be between 0 to 
KFD_MAX_QUEUE_PRIORITY\n");
+   return -EINVAL;
+   }
+
+   if ((args->ring_base_address) &&
+   (!access_ok(VERIFY_WRITE, args->ring_base_address, 
sizeof(uint64_t {
+   pr_err("kfd: can't access ring base address\n");
+   return -EFAULT;
+   }
+
+   if (!is_power_of_2(args->ring_size) && (args->ring_size != 0)) {
+   pr_err("kfd: ring size must be a power of 2 or 0\n");
+   return -EINVAL;
+   }
+
+   if (!access_ok(VERIFY_WRITE, args->read_pointer_address, 
sizeof(uint32_t))) {
+   pr_err("kfd: can't access read pointer\n");
+   return -EFAULT;
+   }
+
+   if (!access_ok(VERIFY_WRITE, args->write_pointer_address, 
sizeof(uint32_t))) {
+   pr_err("kfd: can't access write pointer\n");
+   return -EFAULT;
+   }
+
+   q_properties->is_interop = false;
+   q_properties->queue_percent = args->queue_percentage;
+   q_properties->priority = args->queue_priority;
+   q_properties->queue_address = args->ring_base_address;
+   q_properties->queue_size = args->ring_size;
+   q_properties->read_ptr = (uint32_t *) args->read_pointer_address;
+   q_properties->write_ptr = (uint32_t *) args->write_pointer_address;
+   if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE ||
+   args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL)
+   q_properties->type = KFD_QUEUE_TYPE_COMPUTE;
+   else
+   return -ENOTSUPP;
+
+   if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL)
+   q_properties->format = KFD_QUEUE_FORMAT_AQL;
+   else
+   q_properties->format = KFD_QUEUE_FORMAT_PM4;
+
+   pr_debug("Queue Percentage (%d, %d)\n",
+   q_properties->queue_percent, args->queue_percentage);
+
+   pr_debug("Queue Priority (%d, %d)\n",
+   q_properties->priority, args->queue_priority);
+
+   pr_debug("Queue Address (0x%llX, 0x%llX)\n",
+   q_properties->queue_address, args->ring_base_address);
+
+   pr_debug("Queue Size (0x%llX, %u)\n",
+   q_properties->queue_size, args->ring_size);
+
+   pr_debug("Queue r/w Pointers (0x%llX, 0x%llX)\n",
+   (uint64_t) q_properties->read_ptr,
+   (uint64_t) q_properties->write_ptr);
+
+   pr_debug("Queue Format (%d)\n", q_properties->format);
+
+   return 0;
+}
+
 static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
void __user *arg)
 {
-   return -ENODEV;
+   struct kfd_ioctl_create_queue_args args;
+   struct kfd_dev *dev;
+   int err = 0;
+   unsigned int queue_id;
+   struct kfd_process_device *pdd;
+   struct queue_properties q_properties;
+
+   memset(_properties, 0, sizeof(struct queue_properties));
+
+   if (copy_from_user(, arg, sizeof(args)))
+   return -EFAULT;
+
+   pr_debug("kfd: creating queue ioctl\n");
+
+   err = set_queue_properties_from_user(_properties, );
+   if (err)
+   return err;
+
+   dev = kfd_device_by_id(args.gpu_id);
+   if (dev == NULL)
+   return -EINVAL;
+
+   mutex_lock(>mutex);
+
+   pdd = kfd_bind_process_to_device(dev, p);
+   if (IS_ERR(pdd) < 0) {
+   err = PTR_ERR(pdd);
+   goto err_bind_process;
+   }
+
+   pr_debug("kfd: creating 

[PATCH v5 18/24] amdkfd: Add device queue manager module

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

The queue scheduler divides into two sections, one section is process bounded
and the other section is device bounded.
The device bounded section is handled by this module.
The DQM module handles queue setup, update and tear-down from the device side.
It also supports suspend/resume operation.

v3: Changed device_init, added the use of the new gart allocation functions an
Added documentation.

v4:

Fixed a race in DQM queue scheduler where dqm->lock must be held when accessing
dqm->queue_count and dqm->processes_count. This fixes runlist IB allocation
failures when DQM is under load.

Fixed race in DQM queue destruction where queues being destroyed must be
removed from qpd->queues_list prior to preemption, or concurrent queue
creation activity may reschedule them while their MQD is destroyed.

Fixed EOP queue size setting in CP_HPD_EOP_CONTROL, because the size is
specified as (log2(size_dwords)-1). The previous calculation assumed the
size was specified in bytes, which caused interference between EOP queues
when multiple MEC pipelines were active.

v5:

Move amdkfd from drm/radeon/ to drm/amd/
Change format of mqd structure to match latest KV firmware
Add support for AQL queues creation to enable working with open-source HSA
runtime
Remove unused unmap_queue function
Various fixes (Style, typos)

Signed-off-by: Ben Goz 
Signed-off-by: Jay Cornwall 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile|2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_device.c|   29 +-
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c  | 1059 
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h  |   49 +-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h  |   21 +
 5 files changed, 1156 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 104f279..307a309 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -8,6 +8,6 @@ amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o 
kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
kfd_process.o kfd_queue.o kfd_mqd_manager.o \
kfd_kernel_queue.o kfd_packet_manager.o \
-   kfd_process_queue_manager.o
+   kfd_process_queue_manager.o kfd_device_queue_manager.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 4b1cced..bdf3e94 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include "kfd_priv.h"
+#include "kfd_device_queue_manager.h"
 
 #define MQD_SIZE_ALIGNED 768
 
@@ -199,12 +200,34 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
amd_iommu_set_invalidate_ctx_cb(kfd->pdev,
iommu_pasid_shutdown_callback);
 
+   kfd->dqm = device_queue_manager_init(kfd);
+   if (!kfd->dqm) {
+   dev_err(kfd_device,
+   "Error initializing queue manager for device (%x:%x)\n",
+   kfd->pdev->vendor, kfd->pdev->device);
+   goto device_queue_manager_error;
+   }
+
+   if (kfd->dqm->start(kfd->dqm) != 0) {
+   dev_err(kfd_device,
+   "Error starting queuen manager for device (%x:%x)\n",
+   kfd->pdev->vendor, kfd->pdev->device);
+   goto dqm_start_error;
+   }
+
kfd->init_complete = true;
dev_info(kfd_device, "added device (%x:%x)\n", kfd->pdev->vendor,
 kfd->pdev->device);
 
+   pr_debug("kfd: Starting kfd with the following scheduling policy %d\n",
+   sched_policy);
+
goto out;
 
+dqm_start_error:
+   device_queue_manager_uninit(kfd->dqm);
+device_queue_manager_error:
+   amd_iommu_free_device(kfd->pdev);
 device_iommu_pasid_error:
kfd_topology_remove_device(kfd);
 kfd_topology_add_device_error:
@@ -219,6 +242,7 @@ out:
 void kgd2kfd_device_exit(struct kfd_dev *kfd)
 {
if (kfd->init_complete) {
+   device_queue_manager_uninit(kfd->dqm);
amd_iommu_free_device(kfd->pdev);
kfd_topology_remove_device(kfd);
}
@@ -230,8 +254,10 @@ void kgd2kfd_suspend(struct kfd_dev *kfd)
 {
BUG_ON(kfd == NULL);
 
-   if (kfd->init_complete)
+   if (kfd->init_complete) {
+   kfd->dqm->stop(kfd->dqm);
amd_iommu_free_device(kfd->pdev);
+   }
 }
 
 int kgd2kfd_resume(struct kfd_dev *kfd)
@@ -249,6 +275,7 @@ int kgd2kfd_resume(struct kfd_dev *kfd)
return -ENXIO;
amd_iommu_set_invalidate_ctx_cb(kfd->pdev,
iommu_pasid_shutdown_callback);
+

[PATCH v5 19/24] amdkfd: Add interrupt handling module

2014-11-08 Thread Oded Gabbay
From: Andrew Lewycky 

This patch adds the interrupt handling module, in kfd_interrupt.c, and its
related members in different data structures to the amdkfd driver.

The amdkfd interrupt module maintains an internal interrupt ring per amdkfd
device. The internal interrupt ring contains interrupts that needs further
handling. The extra handling is deferred to a later time through a workqueue.

There's no acknowledgment for the interrupts we use. The hardware simply queues
a new interrupt each time without waiting.

The fixed-size internal queue means that it's possible for us to lose
interrupts because we have no back-pressure to the hardware.

v3:

Move amdkfd from drm/radeon/ to drm/amd/
Change device init
Made sure spin lock is taken only if init is complete
Moved bool field to the end of the structure

Signed-off-by: Andrew Lewycky 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile|   3 +-
 drivers/gpu/drm/amd/amdkfd/kfd_device.c|  23 +++-
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 176 +
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h  |  21 +++-
 4 files changed, 218 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 307a309..be6246d 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -8,6 +8,7 @@ amdkfd-y:= kfd_module.o kfd_device.o kfd_chardev.o 
kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
kfd_process.o kfd_queue.o kfd_mqd_manager.o \
kfd_kernel_queue.o kfd_packet_manager.o \
-   kfd_process_queue_manager.o kfd_device_queue_manager.o
+   kfd_process_queue_manager.o kfd_device_queue_manager.o \
+   kfd_interrupt.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index bdf3e94..9beb6f7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -31,6 +31,7 @@
 
 static const struct kfd_device_info kaveri_device_info = {
.max_pasid_bits = 16,
+   .ih_ring_entry_size = 4 * sizeof(uint32_t),
.mqd_size_aligned = MQD_SIZE_ALIGNED
 };
 
@@ -191,6 +192,13 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
goto kfd_topology_add_device_error;
}
 
+   if (kfd_interrupt_init(kfd)) {
+   dev_err(kfd_device,
+   "Error initializing interrupts for device (%x:%x)\n",
+   kfd->pdev->vendor, kfd->pdev->device);
+   goto kfd_interrupt_error;
+   }
+
if (!device_iommu_pasid_init(kfd)) {
dev_err(kfd_device,
"Error initializing iommuv2 for device (%x:%x)\n",
@@ -229,6 +237,8 @@ dqm_start_error:
 device_queue_manager_error:
amd_iommu_free_device(kfd->pdev);
 device_iommu_pasid_error:
+   kfd_interrupt_exit(kfd);
+kfd_interrupt_error:
kfd_topology_remove_device(kfd);
 kfd_topology_add_device_error:
kfd2kgd->fini_sa_manager(kfd->kgd);
@@ -244,6 +254,7 @@ void kgd2kfd_device_exit(struct kfd_dev *kfd)
if (kfd->init_complete) {
device_queue_manager_uninit(kfd->dqm);
amd_iommu_free_device(kfd->pdev);
+   kfd_interrupt_exit(kfd);
kfd_topology_remove_device(kfd);
}
 
@@ -281,6 +292,16 @@ int kgd2kfd_resume(struct kfd_dev *kfd)
return 0;
 }
 
-void kgd2kfd_interrupt(struct kfd_dev *dev, const void *ih_ring_entry)
+/* This is called directly from KGD at ISR. */
+void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
 {
+   if (kfd->init_complete) {
+   spin_lock(>interrupt_lock);
+
+   if (kfd->interrupts_active
+   && enqueue_ih_ring_entry(kfd, ih_ring_entry))
+   schedule_work(>interrupt_work);
+
+   spin_unlock(>interrupt_lock);
+   }
 }
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
new file mode 100644
index 000..5b99909
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * 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.
+ 

[PATCH v5 17/24] amdkfd: Add process queue manager module

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

The queue scheduler divides into two sections, one section is process bounded
and the other section is device bounded.
The process bounded section is handled by this module. The PQM handles usermode
queue setup, updates and tear-down.

v3:

Used kernel parameter to limit queues per process instead of define
Added use of doorbell address from user

v4:

Modified pqm_create_queue so that only when creating usermode queues the
driver should return the queue properties to the userspace.

Added an info message print when no more queues can be opened because of the
queue per process limitation

v5:

Move amdkfd from drm/radeon/ to drm/amd/
Various fixes

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile|   3 +-
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h  |  26 ++
 drivers/gpu/drm/amd/amdkfd/kfd_process.c   |  20 ++
 .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 342 +
 4 files changed, 390 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 1164a3a..104f279 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -7,6 +7,7 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/
 amdkfd-y   := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
kfd_process.o kfd_queue.o kfd_mqd_manager.o \
-   kfd_kernel_queue.o kfd_packet_manager.o
+   kfd_kernel_queue.o kfd_packet_manager.o \
+   kfd_process_queue_manager.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 219c85a..72b2e27 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -387,6 +387,9 @@ struct kfd_process_device {
struct kfd_dev *dev;
 
 
+   /* per-process-per device QCM data structure */
+   struct qcm_process_device qpd;
+
/*Apertures*/
uint64_t lds_base;
uint64_t lds_limit;
@@ -432,6 +435,8 @@ struct kfd_process {
 */
struct list_head per_device_data;
 
+   struct process_queue_manager pqm;
+
/* The process's queues. */
size_t queue_array_size;
 
@@ -501,12 +506,33 @@ inline uint32_t upper_32(uint64_t x);
 
 int init_queue(struct queue **q, struct queue_properties properties);
 void uninit_queue(struct queue *q);
+void print_queue_properties(struct queue_properties *q);
 void print_queue(struct queue *q);
 
 struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
enum kfd_queue_type type);
 void kernel_queue_uninit(struct kernel_queue *kq);
 
+/* Process Queue Manager */
+struct process_queue_node {
+   struct queue *q;
+   struct kernel_queue *kq;
+   struct list_head process_queue_list;
+};
+
+int pqm_init(struct process_queue_manager *pqm, struct kfd_process *p);
+void pqm_uninit(struct process_queue_manager *pqm);
+int pqm_create_queue(struct process_queue_manager *pqm,
+   struct kfd_dev *dev,
+   struct file *f,
+   struct queue_properties *properties,
+   unsigned int flags,
+   enum kfd_queue_type type,
+   unsigned int *qid);
+int pqm_destroy_queue(struct process_queue_manager *pqm, unsigned int qid);
+int pqm_update_queue(struct process_queue_manager *pqm, unsigned int qid,
+   struct queue_properties *p);
+
 /* Packet Manager */
 
 #define KFD_HIQ_TIMEOUT (500)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 5084794..a17e2dd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -222,6 +222,13 @@ static void kfd_process_notifier_release(struct 
mmu_notifier *mn,
mutex_unlock(_processes_mutex);
synchronize_srcu(_processes_srcu);
 
+   mutex_lock(>mutex);
+
+   /* In case our notifier is called before IOMMU notifier */
+   pqm_uninit(>pqm);
+
+   mutex_unlock(>mutex);
+
/*
 * Because we drop mm_count inside kfd_process_destroy_delayed
 * and because the mmu_notifier_unregister function also drop
@@ -274,8 +281,16 @@ static struct kfd_process *create_process(const struct 
task_struct *thread)
 
INIT_LIST_HEAD(>per_device_data);
 
+   err = pqm_init(>pqm, process);
+   if (err != 0)
+   goto err_process_pqm_init;
+
return process;
 
+err_process_pqm_init:
+   hash_del_rcu(>kfd_processes);
+   synchronize_rcu();
+   mmu_notifier_unregister_no_release(>mmu_notifier, process->mm);
 err_mmu_notifier:
   

[PATCH v5 16/24] amdkfd: Add packet manager module

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

The packet manager module builds PM4 packets for the sole use of the CP
scheduler. Those packets are used by the HIQ to submit runlists to the CP.

v3:

Removed include of cik_mqds.h
Changed lower_32/upper_32 calls to use linux macros
Used new gart allocation functions
Added documentation

v5:

Move amdkfd from drm/radeon/ to drm/amd/
Change format of mqd structure to match latest KV firmware
Add support for AQL queues creation to enable working with open-source HSA
runtime
Always chain runlist if you have more than 1 process or if you have
over-subscription over the number of queues.
Various fixes (typos, style)

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile |   2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 565 
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h   |  75 
 3 files changed, 641 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 047b834..1164a3a 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -7,6 +7,6 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/
 amdkfd-y   := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
kfd_process.o kfd_queue.o kfd_mqd_manager.o \
-   kfd_kernel_queue.o
+   kfd_kernel_queue.o kfd_packet_manager.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
new file mode 100644
index 000..5ce9233
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
@@ -0,0 +1,565 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ */
+
+#include 
+#include 
+#include "kfd_device_queue_manager.h"
+#include "kfd_kernel_queue.h"
+#include "kfd_priv.h"
+#include "kfd_pm4_headers.h"
+#include "kfd_pm4_opcodes.h"
+
+static inline void inc_wptr(unsigned int *wptr, unsigned int increment_bytes,
+   unsigned int buffer_size_bytes)
+{
+   unsigned int temp = *wptr + increment_bytes / sizeof(uint32_t);
+
+   BUG_ON((temp * sizeof(uint32_t)) > buffer_size_bytes);
+   *wptr = temp;
+}
+
+static unsigned int build_pm4_header(unsigned int opcode, size_t packet_size)
+{
+   union PM4_MES_TYPE_3_HEADER header;
+
+   header.u32all = 0;
+   header.opcode = opcode;
+   header.count = packet_size/sizeof(uint32_t) - 2;
+   header.type = PM4_TYPE_3;
+
+   return header.u32all;
+}
+
+static void pm_calc_rlib_size(struct packet_manager *pm,
+   unsigned int *rlib_size,
+   bool *over_subscription)
+{
+   unsigned int process_count, queue_count;
+
+   BUG_ON(!pm || !rlib_size || !over_subscription);
+
+   process_count = pm->dqm->processes_count;
+   queue_count = pm->dqm->queue_count;
+
+   /* check if there is over subscription*/
+   *over_subscription = false;
+   if ((process_count > 1) ||
+   queue_count > PIPE_PER_ME_CP_SCHEDULING * QUEUES_PER_PIPE) {
+   *over_subscription = true;
+   pr_debug("kfd: over subscribed runlist\n");
+   }
+
+   /* calculate run list ib allocation size */
+   *rlib_size = process_count * sizeof(struct pm4_map_process) +
+queue_count * sizeof(struct pm4_map_queues);
+
+   /*
+* Increase the allocation size in case we need a chained run list
+* when over subscription
+*/
+   if (*over_subscription)
+   *rlib_size += sizeof(struct pm4_runlist);
+
+   pr_debug("kfd: runlist ib size %d\n", *rlib_size);
+}
+

[PATCH v5 15/24] amdkfd: Add module parameter of scheduling policy

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

This patch adds a new parameter to the amdkfd driver. This parameter enables
the user to select the scheduling policy of the CP. The choices are:

* CP Scheduling with support for over-subscription
* CP Scheduling without support for over-subscription
* Without CP Scheduling

Note that the third option (Without CP scheduling) is only for debug purposes
and bringup of new H/W. As such, it is _not_ guaranteed to work at all times on
all H/W versions.

v3: Fixed description of parameter, changed the permissions to read_only, added
a verification of the value and added documentation

v5: Set default sched_policy to HWS as it is now supported by firmware

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/kfd_module.c | 18 +++---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h   | 30 ++
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index 56a71d8..0858dce 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -29,10 +29,10 @@
 #define KFD_DRIVER_AUTHOR  "AMD Inc. and others"
 
 #define KFD_DRIVER_DESC"Standalone HSA driver for AMD's GPUs"
-#define KFD_DRIVER_DATE"20140804"
+#define KFD_DRIVER_DATE"20140807"
 #define KFD_DRIVER_MAJOR   0
-#define KFD_DRIVER_MINOR   6
-#define KFD_DRIVER_PATCHLEVEL  4
+#define KFD_DRIVER_MINOR   8
+#define KFD_DRIVER_PATCHLEVEL  0
 
 const struct kfd2kgd_calls *kfd2kgd;
 static const struct kgd2kfd_calls kgd2kfd = {
@@ -45,6 +45,11 @@ static const struct kgd2kfd_calls kgd2kfd = {
.resume = kgd2kfd_resume,
 };
 
+int sched_policy = KFD_SCHED_POLICY_HWS;
+module_param(sched_policy, int, 0444);
+MODULE_PARM_DESC(sched_policy,
+   "Kernel cmdline parameter that defines the amdkfd scheduling policy");
+
 int max_num_of_processes = KFD_MAX_NUM_OF_PROCESSES_DEFAULT;
 module_param(max_num_of_processes, int, 0444);
 MODULE_PARM_DESC(max_num_of_processes,
@@ -88,6 +93,13 @@ static int __init kfd_module_init(void)
kfd2kgd = NULL;
 
/* Verify module parameters */
+   if ((sched_policy < KFD_SCHED_POLICY_HWS) ||
+   (sched_policy > KFD_SCHED_POLICY_NO_HWS)) {
+   pr_err("kfd: sched_policy has invalid value\n");
+   return -1;
+   }
+
+   /* Verify module parameters */
if ((max_num_of_processes < 0) ||
(max_num_of_processes > KFD_MAX_NUM_OF_PROCESSES)) {
pr_err("kfd: max_num_of_processes must be between 0 to 
KFD_MAX_NUM_OF_PROCESSES\n");
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index bba3c2a..32bca8a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -69,6 +69,36 @@ extern int max_num_of_queues_per_process;
 
 #define KFD_KERNEL_QUEUE_SIZE 2048
 
+/* Kernel module parameter to specify the scheduling policy */
+extern int sched_policy;
+
+/**
+ * enum kfd_sched_policy
+ *
+ * @KFD_SCHED_POLICY_HWS: H/W scheduling policy known as command processor (cp)
+ * scheduling. In this scheduling mode we're using the firmware code to
+ * schedule the user mode queues and kernel queues such as HIQ and DIQ.
+ * the HIQ queue is used as a special queue that dispatches the configuration
+ * to the cp and the user mode queues list that are currently running.
+ * the DIQ queue is a debugging queue that dispatches debugging commands to the
+ * firmware.
+ * in this scheduling mode user mode queues over subscription feature is
+ * enabled.
+ *
+ * @KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION: The same as above but the over
+ * subscription feature disabled.
+ *
+ * @KFD_SCHED_POLICY_NO_HWS: no H/W scheduling policy is a mode which directly
+ * set the command processor registers and sets the queues "manually". This
+ * mode is used *ONLY* for debugging proposes.
+ *
+ */
+enum kfd_sched_policy {
+   KFD_SCHED_POLICY_HWS = 0,
+   KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
+   KFD_SCHED_POLICY_NO_HWS
+};
+
 enum cache_policy {
cache_policy_coherent,
cache_policy_noncoherent
-- 
2.1.0

--
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 v5 14/24] amdkfd: Add kernel queue module

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

The kernel queue module enables the amdkfd to establish kernel queues, not
exposed to user space.

The kernel queues are used for HIQ (HSA Interface Queue) and DIQ (Debug
Interface Queue) operations

v3: Removed use of internal typedefs and added use of the new gart allocation
functions

v4: Fixed a miscalculation in kernel queue wrapping

v5:

Move amdkfd from drm/radeon/ to drm/amd/
Change format of mqd structure to match latest KV firmware
Add support for AQL queues creation to enable working with open-source HSA
runtime
Add define for kernel queue size
Various fixes

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile|   3 +-
 .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.h  | 101 +
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c  | 347 ++
 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h  |  69 
 drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers.h   | 405 +
 drivers/gpu/drm/amd/amdkfd/kfd_pm4_opcodes.h   | 107 ++
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h  |  36 +-
 7 files changed, 1066 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_pm4_headers.h
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_pm4_opcodes.h

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 301e847..047b834 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -6,6 +6,7 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/
 
 amdkfd-y   := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
-   kfd_process.o kfd_queue.o kfd_mqd_manager.o
+   kfd_process.o kfd_queue.o kfd_mqd_manager.o \
+   kfd_kernel_queue.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
new file mode 100644
index 000..e495b38
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ */
+
+#ifndef KFD_DEVICE_QUEUE_MANAGER_H_
+#define KFD_DEVICE_QUEUE_MANAGER_H_
+
+#include 
+#include 
+#include "kfd_priv.h"
+#include "kfd_mqd_manager.h"
+
+#define QUEUE_PREEMPT_DEFAULT_TIMEOUT_MS   (500)
+#define QUEUES_PER_PIPE(8)
+#define PIPE_PER_ME_CP_SCHEDULING  (3)
+#define CIK_VMID_NUM   (8)
+#define KFD_VMID_START_OFFSET  (8)
+#define VMID_PER_DEVICECIK_VMID_NUM
+#define KFD_DQM_FIRST_PIPE (0)
+
+struct device_process_node {
+   struct qcm_process_device *qpd;
+   struct list_head list;
+};
+
+struct device_queue_manager {
+   int (*create_queue)(struct device_queue_manager *dqm,
+   struct queue *q,
+   struct qcm_process_device *qpd,
+   int *allocate_vmid);
+   int (*destroy_queue)(struct device_queue_manager *dqm,
+   struct qcm_process_device *qpd,
+   struct queue *q);
+   int (*update_queue)(struct device_queue_manager *dqm,
+   struct queue *q);
+   struct mqd_manager * (*get_mqd_manager)(
+   struct device_queue_manager *dqm,
+   enum KFD_MQD_TYPE type);
+
+   int (*register_process)(struct 

[PATCH v5 13/24] amdkfd: Add mqd_manager module

2014-11-08 Thread Oded Gabbay
From: Ben Goz 

The mqd_manager module handles MQD data structures.
MQD stands for Memory Queue Descriptor, which is used by the H/W to
keep the usermode queue state in memory.

v3:

Removed new typedefs
Removed pragma pack 4
Remove cik_mqds.h file
Changed lower_32/upper_32 calls to use linux macros
Used new gart allocation functions
Added documentation

v4:

Added missing initialization of the addr field in init_mqd()

Setting the hqd persistent.preload_req bit ON so that when queues switches
on/off, their context will kept and read from the mqd when the cp reassign
them, and thus the dispatched workload context kept consistent without any
interrupts.

v5:

Move amdkfd from drm/radeon/ to drm/amd/
Change format of mqd structure to match latest KV firmware
Add support for AQL queues creation to enable working with open-source HSA
runtime.
Various fixes

Signed-off-by: Ben Goz 
Signed-off-by: Oded Gabbay 
---
 drivers/gpu/drm/amd/amdkfd/Makefile  |   2 +-
 drivers/gpu/drm/amd/amdkfd/cik_regs.h| 221 +
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c | 346 +++
 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h |  91 +++
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h|  22 ++
 5 files changed, 681 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/amdkfd/cik_regs.h
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
 create mode 100644 drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h

diff --git a/drivers/gpu/drm/amd/amdkfd/Makefile 
b/drivers/gpu/drm/amd/amdkfd/Makefile
index 42df022..301e847 100644
--- a/drivers/gpu/drm/amd/amdkfd/Makefile
+++ b/drivers/gpu/drm/amd/amdkfd/Makefile
@@ -6,6 +6,6 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/
 
 amdkfd-y   := kfd_module.o kfd_device.o kfd_chardev.o kfd_topology.o \
kfd_pasid.o kfd_doorbell.o kfd_flat_memory.o \
-   kfd_process.o kfd_queue.o
+   kfd_process.o kfd_queue.o kfd_mqd_manager.o
 
 obj-$(CONFIG_HSA_AMD)  += amdkfd.o
diff --git a/drivers/gpu/drm/amd/amdkfd/cik_regs.h 
b/drivers/gpu/drm/amd/amdkfd/cik_regs.h
new file mode 100644
index 000..607fc5c
--- /dev/null
+++ b/drivers/gpu/drm/amd/amdkfd/cik_regs.h
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ *
+ * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+#ifndef CIK_REGS_H
+#define CIK_REGS_H
+
+#define IH_VMID_0_LUT  0x3D40u
+
+#define BIF_DOORBELL_CNTL  0x530Cu
+
+#defineSRBM_GFX_CNTL   0xE44
+#definePIPEID(x)   ((x) << 0)
+#defineMEID(x) ((x) << 2)
+#defineVMID(x) ((x) << 4)
+#defineQUEUEID(x)  ((x) << 8)
+
+#defineSQ_CONFIG   0x8C00
+
+#defineSH_MEM_BASES0x8C28
+/* if PTR32, these are the bases for scratch and lds */
+#definePRIVATE_BASE(x) ((x) << 0) /* 
scratch */
+#defineSHARED_BASE(x)  ((x) << 16) /* 
LDS */
+#defineSH_MEM_APE1_BASE0x8C2C
+/* if PTR32, this is the base location of GPUVM */
+#defineSH_MEM_APE1_LIMIT   0x8C30
+/* if PTR32, this is the upper limit of GPUVM */
+#defineSH_MEM_CONFIG   0x8C34
+#definePTR32   (1 << 0)
+#define PRIVATE_ATC(1 << 1)
+#defineALIGNMENT_MODE(x)   ((x) << 2)
+#defineSH_MEM_ALIGNMENT_MODE_DWORD 0
+#defineSH_MEM_ALIGNMENT_MODE_DWORD_STRICT  1

  1   2   3   4   5   >