[PATCH 3.16.y-ckt 143/216] mac80211: free management frame keys when removing station

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Johannes Berg 

commit 28a9bc68124c319b2b3dc861e80828a8865fd1ba upstream.

When writing the code to allow per-station GTKs, I neglected to
take into account the management frame keys (index 4 and 5) when
freeing the station and only added code to free the first four
data frame keys.

Fix this by iterating the array of keys over the right length.

Fixes: e31b82136d1a ("cfg80211/mac80211: allow per-station GTKs")
Signed-off-by: Johannes Berg 
Signed-off-by: Luis Henriques 
---
 net/mac80211/key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 16d97f044a20..947daa9d3346 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -653,7 +653,7 @@ void ieee80211_free_sta_keys(struct ieee80211_local *local,
int i;
 
mutex_lock(>key_mtx);
-   for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+   for (i = 0; i < ARRAY_SIZE(sta->gtk); i++) {
key = key_mtx_dereference(local, sta->gtk[i]);
if (!key)
continue;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 144/216] ceph: do_sync is never initialized

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Dan Carpenter 

commit 021b77bee210843bed1ea91b5cad58235ff9c8e5 upstream.

Probably this code was syncing a lot more often then intended because
the do_sync variable wasn't set to zero.

Fixes: c62988ec0910 ('ceph: avoid meaningless calling ceph_caps_revoking if 
sync_mode == WB_SYNC_ALL.')
Signed-off-by: Dan Carpenter 
Signed-off-by: Ilya Dryomov 
Signed-off-by: Luis Henriques 
---
 fs/ceph/addr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 90b3954d48ed..9bfd1af53b08 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -673,7 +673,7 @@ static int ceph_writepages_start(struct address_space 
*mapping,
int rc = 0;
unsigned wsize = 1 << inode->i_blkbits;
struct ceph_osd_request *req = NULL;
-   int do_sync;
+   int do_sync = 0;
u64 truncate_size, snap_size;
u32 truncate_seq;
 
-- 
2.1.4

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


Re: [PATCH v2 1/3] dmaengine: Add support for APM X-Gene SoC DMA engine driver

2015-01-12 Thread Arnd Bergmann
On Monday 12 January 2015 14:40:09 Rameshwar Sahu wrote:
> > +
> > +   dma_set_mask_and_coherent(>dev,
> > + (sizeof(dma_addr_t) == sizeof(u64)) ?
> > + DMA_BIT_MASK(64) : DMA_BIT_MASK(32));
> > +
> 

I commented on this on v1 already: always set the device specific mask here,
it's independent of the CPU architecture, but do check the return value.

Also add the correct dma-ranges property in the parent, or else this will
fail in the future once we add proper checks to dma_set_mask.

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/


[PATCH 3.16.y-ckt 146/216] ocfs2: fix journal commit deadlock

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Junxiao Bi 

commit 136f49b9171074872f2a14ad0ab10486d1ba13ca upstream.

For buffer write, page lock will be got in write_begin and released in
write_end, in ocfs2_write_end_nolock(), before it unlock the page in
ocfs2_free_write_ctxt(), it calls ocfs2_run_deallocs(), this will ask
for the read lock of journal->j_trans_barrier.  Holding page lock and
ask for journal->j_trans_barrier breaks the locking order.

This will cause a deadlock with journal commit threads, ocfs2cmt will
get write lock of journal->j_trans_barrier first, then it wakes up
kjournald2 to do the commit work, at last it waits until done.  To
commit journal, kjournald2 needs flushing data first, it needs get the
cache page lock.

Since some ocfs2 cluster locks are holding by write process, this
deadlock may hung the whole cluster.

unlock pages before ocfs2_run_deallocs() can fix the locking order, also
put unlock before ocfs2_commit_trans() to make page lock is unlocked
before j_trans_barrier to preserve unlocking order.

Signed-off-by: Junxiao Bi 
Reviewed-by: Wengang Wang 
Reviewed-by: Mark Fasheh 
Cc: Joel Becker 
Signed-off-by: Andrew Morton 
Signed-off-by: Linus Torvalds 
Signed-off-by: Luis Henriques 
---
 fs/ocfs2/aops.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 4a231a166cf8..c04183b008da 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -894,7 +894,7 @@ void ocfs2_unlock_and_free_pages(struct page **pages, int 
num_pages)
}
 }
 
-static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
+static void ocfs2_unlock_pages(struct ocfs2_write_ctxt *wc)
 {
int i;
 
@@ -915,7 +915,11 @@ static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt 
*wc)
page_cache_release(wc->w_target_page);
}
ocfs2_unlock_and_free_pages(wc->w_pages, wc->w_num_pages);
+}
 
+static void ocfs2_free_write_ctxt(struct ocfs2_write_ctxt *wc)
+{
+   ocfs2_unlock_pages(wc);
brelse(wc->w_di_bh);
kfree(wc);
 }
@@ -2041,11 +2045,19 @@ out_write_size:
ocfs2_update_inode_fsync_trans(handle, inode, 1);
ocfs2_journal_dirty(handle, wc->w_di_bh);
 
+   /* unlock pages before dealloc since it needs acquiring j_trans_barrier
+* lock, or it will cause a deadlock since journal commit threads holds
+* this lock and will ask for the page lock when flushing the data.
+* put it here to preserve the unlock order.
+*/
+   ocfs2_unlock_pages(wc);
+
ocfs2_commit_trans(osb, handle);
 
ocfs2_run_deallocs(osb, >w_dealloc);
 
-   ocfs2_free_write_ctxt(wc);
+   brelse(wc->w_di_bh);
+   kfree(wc);
 
return copied;
 }
-- 
2.1.4

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


[PATCH 3.16.y-ckt 148/216] mmc: block: add newline to sysfs display of force_ro

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Baruch Siach 

commit 0031a98a85e9fca282624bfc887f9531b2768396 upstream.

Make force_ro consistent with other sysfs entries.

Fixes: 371a689f64b0d ('mmc: MMC boot partitions support')
Cc: Andrei Warkentin 
Signed-off-by: Baruch Siach 
Signed-off-by: Ulf Hansson 
Signed-off-by: Luis Henriques 
---
 drivers/mmc/card/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782bffebc..b082b25ea9c4 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -260,7 +260,7 @@ static ssize_t force_ro_show(struct device *dev, struct 
device_attribute *attr,
int ret;
struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev));
 
-   ret = snprintf(buf, PAGE_SIZE, "%d",
+   ret = snprintf(buf, PAGE_SIZE, "%d\n",
   get_disk_ro(dev_to_disk(dev)) ^
   md->read_only);
mmc_blk_put(md);
-- 
2.1.4

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


[PATCH 3.16.y-ckt 152/216] dm thin: fix a race in thin_dtr

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Mikulas Patocka 

commit 17181fb7a0c3a279196c0eeb2caba65a1519614b upstream.

As long as struct thin_c is in the list, anyone can grab a reference of
it.  Consequently, we must wait for the reference count to drop to zero
*after* we remove the structure from the list, not before.

Signed-off-by: Mikulas Patocka 
Signed-off-by: Mike Snitzer 
Signed-off-by: Luis Henriques 
---
 drivers/md/dm-thin.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index df898e0db419..6f75083a81cc 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -3183,14 +3183,14 @@ static void thin_dtr(struct dm_target *ti)
struct thin_c *tc = ti->private;
unsigned long flags;
 
-   thin_put(tc);
-   wait_for_completion(>can_destroy);
-
spin_lock_irqsave(>pool->lock, flags);
list_del_rcu(>list);
spin_unlock_irqrestore(>pool->lock, flags);
synchronize_rcu();
 
+   thin_put(tc);
+   wait_for_completion(>can_destroy);
+
mutex_lock(_thin_pool_table.mutex);
 
__pool_dec(tc->pool);
-- 
2.1.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 v3] Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors

2015-01-12 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Monday, January 12, 2015 8:50 AM
> To: KY Srinivasan; de...@linuxdriverproject.org
> Cc: Haiyang Zhang; Greg Kroah-Hartman; linux-kernel@vger.kernel.org;
> Dexuan Cui
> Subject: [PATCH v3] Drivers: hv: vmbus: prevent cpu offlining on newer
> hypervisors
> 
> When an SMP Hyper-V guest is running on top of 2012R2 Server and
> secondary
> cpus are sent offline (with echo 0 >
> /sys/devices/system/cpu/cpu$cpu/online)
> the system freeze is observed. This happens due to the fact that on newer
> hypervisors (Win8, WS2012R2, ...) vmbus channel handlers are distributed
> across all cpus (see init_vp_index() function in drivers/hv/channel_mgmt.c)
> and on cpu offlining nobody reassigns them to CPU0. Prevent cpu offlining
> when vmbus is loaded until the issue is fixed host-side.
> 
> This patch also disables hibernation but it is OK as it is also broken (MCE
> error is hit on resume). Suspend still works.
> 
> Tested with WS2008R2 and WS2012R2.
> 
> Signed-off-by: Vitaly Kuznetsov 
Thank you.
Signed-off-by: K. Y. Srinivasan 
> ---
> Changes since v2:
> - repair the build when vmbus is builded as a module [Greg KH] by saving
>   current cpu_disable pointer to previous_cpu_disable and restoring it on
>   unload;
> - return -ENOSYS (same as native_cpu_disable when
> !CONFIG_HOTPLUG_CPU) instead
>   of -1 in hyperv_cpu_disable().
> 
> Changes since v1:
> - introduce hv_cpu_hotplug_quirk() function to not spread #ifdefs [Greg
> KH];
> - add pr_notice() message "hv_vmbus: CPU offlining is not supported by
>   hypervisor".
> ---
>  drivers/hv/vmbus_drv.c | 36 
>  1 file changed, 36 insertions(+)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 4d6b269..233da0b 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -32,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -671,6 +672,39 @@ static void vmbus_isr(void)
>   tasklet_schedule(_dpc);
>  }
> 
> +#ifdef CONFIG_HOTPLUG_CPU
> +static int hyperv_cpu_disable(void)
> +{
> + return -ENOSYS;
> +}
> +
> +static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
> +{
> + static void *previous_cpu_disable;
> +
> + /*
> +  * Offlining a CPU when running on newer hypervisors (WS2012R2,
> Win8,
> +  * ...) is not supported at this moment as channel interrupts are
> +  * distributed across all of them.
> +  */
> +
> + if ((vmbus_proto_version == VERSION_WS2008) ||
> + (vmbus_proto_version == VERSION_WIN7))
> + return;
> +
> + if (vmbus_loaded) {
> + previous_cpu_disable = smp_ops.cpu_disable;
> + smp_ops.cpu_disable = hyperv_cpu_disable;
> + pr_notice("CPU offlining is not supported by hypervisor\n");
> + } else if (previous_cpu_disable)
> + smp_ops.cpu_disable = previous_cpu_disable;
> +}
> +#else
> +static void hv_cpu_hotplug_quirk(bool vmbus_loaded)
> +{
> +}
> +#endif
> +
>  /*
>   * vmbus_bus_init -Main vmbus driver initialization routine.
>   *
> @@ -711,6 +745,7 @@ static int vmbus_bus_init(int irq)
>   if (ret)
>   goto err_alloc;
> 
> + hv_cpu_hotplug_quirk(true);
>   vmbus_request_offers();
> 
>   return 0;
> @@ -964,6 +999,7 @@ static void __exit vmbus_exit(void)
>   bus_unregister(_bus);
>   hv_cleanup();
>   acpi_bus_unregister_driver(_acpi_driver);
> + hv_cpu_hotplug_quirk(false);
>  }
> 
> 
> --
> 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 3.16.y-ckt 139/216] x86/tls: Validate TLS entries to protect espfix

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Andy Lutomirski 

commit 41bdc78544b8a93a9c6814b8bbbfef966272abbe upstream.

Installing a 16-bit RW data segment into the GDT defeats espfix.
AFAICT this will not affect glibc, Wine, or dosemu at all.

Signed-off-by: Andy Lutomirski 
Acked-by: H. Peter Anvin 
Cc: Konrad Rzeszutek Wilk 
Cc: Linus Torvalds 
Cc: secur...@kernel.org 
Cc: Willy Tarreau 
Signed-off-by: Ingo Molnar 
Signed-off-by: Luis Henriques 
---
 arch/x86/kernel/tls.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index f7fec09e3e3a..e7650bd71109 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -27,6 +27,21 @@ static int get_free_idx(void)
return -ESRCH;
 }
 
+static bool tls_desc_okay(const struct user_desc *info)
+{
+   if (LDT_empty(info))
+   return true;
+
+   /*
+* espfix is required for 16-bit data segments, but espfix
+* only works for LDT segments.
+*/
+   if (!info->seg_32bit)
+   return false;
+
+   return true;
+}
+
 static void set_tls_desc(struct task_struct *p, int idx,
 const struct user_desc *info, int n)
 {
@@ -66,6 +81,9 @@ int do_set_thread_area(struct task_struct *p, int idx,
if (copy_from_user(, u_info, sizeof(info)))
return -EFAULT;
 
+   if (!tls_desc_okay())
+   return -EINVAL;
+
if (idx == -1)
idx = info.entry_number;
 
@@ -192,6 +210,7 @@ int regset_tls_set(struct task_struct *target, const struct 
user_regset *regset,
 {
struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES];
const struct user_desc *info;
+   int i;
 
if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) ||
(pos % sizeof(struct user_desc)) != 0 ||
@@ -205,6 +224,10 @@ int regset_tls_set(struct task_struct *target, const 
struct user_regset *regset,
else
info = infobuf;
 
+   for (i = 0; i < count / sizeof(struct user_desc); i++)
+   if (!tls_desc_okay(info + i))
+   return -EINVAL;
+
set_tls_desc(target,
 GDT_ENTRY_TLS_MIN + (pos / sizeof(struct user_desc)),
 info, count / sizeof(struct user_desc));
-- 
2.1.4

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


[PATCH] memcg: add BUILD_BUG_ON() for string tables

2015-01-12 Thread Greg Thelen
Use BUILD_BUG_ON() to compile assert that memcg string tables are in
sync with corresponding enums.  There aren't currently any issues with
these tables.  This is just defensive.

Signed-off-by: Greg Thelen 
---
 mm/memcontrol.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ef91e856c7e4..8d1ca6c55480 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3699,6 +3699,10 @@ static int memcg_stat_show(struct seq_file *m, void *v)
struct mem_cgroup *mi;
unsigned int i;
 
+   BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_stat_names) !=
+MEM_CGROUP_STAT_NSTATS);
+   BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_events_names) !=
+MEM_CGROUP_EVENTS_NSTATS);
BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
 
for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) {
-- 
2.2.0.rc0.207.ga3a616c

--
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 06/10] time: Cap clocksource reads to the clocksource max_cycles value

2015-01-12 Thread John Stultz
On Sun, Jan 11, 2015 at 4:41 AM, Richard Cochran
 wrote:
> On Fri, Jan 09, 2015 at 04:34:24PM -0800, John Stultz wrote:
>> When calculating the current delta since the last tick, we
>> currently have no hard protections to prevent a multiplciation
>> overflow from ocurring.
>
> This is just papering over the problem. The "hard protection" should
> be having a tick scheduled before the range of the clock source is
> exhausted.

So I disagree this is papering over the problem.

You say the tick should be scheduled before the clocksource wraps -
but we have logic to do that.

However there are many ways that can still go wrong.  Virtualization
can delay interrupts for long periods of time, the timer/irq code
isn't the simplest and there can be bugs, or timer hardware itself can
have issues. The difficulty is that when something has gone wrong, the
only thing we have to measure the problem may become corrupted.  And
worse, once the timekeeping code is having problems,  that can result
in bugs that manifest in all sorts of strange ways that are very
difficult to debug (you can't trust your log timestamps, etc).

So I think having some extra measures of protection is useful here.

I'll admit that its always difficult to manage, since we have to layer
our checks, we have circular dependencies (timer code needs
timekeeping to be correct, timekeeping code needs timer code to be
correct), and hardware problems are rampant - so we get trouble like
the clocksource watchdog which uses more trustworthy clocksources to
watch less trustworthy ones, but then hardware starts adding bugs to
the trustworthy ones which cause false positives, etc.   And these
checks make the code add complexity to the code that we'd be happier
without, but we can't throw out supporting the majority of hardware
that have some quirk and imperfection, so I'm not sure what the
alternative should be.

thanks
-john
--
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.16.y-ckt 150/216] mmc: sdhci-pci-o2micro: Fix Dell E5440 issue

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Peter Guo 

commit 6380ea099cdd46d7377b6fbec0291cf2aa387bad upstream.

Fix Dell E5440 when reboot Linux, can't find o2micro sd host chip issue.

Fixes: 01acf6917aed (mmc: sdhci-pci: add support of O2Micro/BayHubTech SD hosts)
Signed-off-by: Peter Guo 
Signed-off-by: Ulf Hansson 
Signed-off-by: Luis Henriques 
---
 drivers/mmc/host/sdhci-pci-o2micro.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-o2micro.c 
b/drivers/mmc/host/sdhci-pci-o2micro.c
index 5670e381b0cf..e2ec108dba0e 100644
--- a/drivers/mmc/host/sdhci-pci-o2micro.c
+++ b/drivers/mmc/host/sdhci-pci-o2micro.c
@@ -127,8 +127,6 @@ void sdhci_pci_o2_fujin2_pci_init(struct sdhci_pci_chip 
*chip)
return;
scratch_32 &= ~((1 << 21) | (1 << 30));
 
-   /* Set RTD3 function disabled */
-   scratch_32 |= ((1 << 29) | (1 << 28));
pci_write_config_dword(chip->pdev, O2_SD_FUNC_REG3, scratch_32);
 
/* Set L1 Entrance Timer */
-- 
2.1.4

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


[PATCH 3.16.y-ckt 151/216] dm space map metadata: fix sm_bootstrap_get_nr_blocks()

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Dan Carpenter 

commit c1c6156fe4d4577444b769d7edd5dd503e57bbc9 upstream.

This function isn't right and it causes a static checker warning:

drivers/md/dm-thin.c:3016 maybe_resize_data_dev()
error: potentially using uninitialized 'sb_data_size'.

It should set "*count" and return zero on success the same as the
sm_metadata_get_nr_blocks() function does earlier.

Fixes: 3241b1d3e0aa ('dm: add persistent data library')
Signed-off-by: Dan Carpenter 
Acked-by: Joe Thornber 
Signed-off-by: Mike Snitzer 
Signed-off-by: Luis Henriques 
---
 drivers/md/persistent-data/dm-space-map-metadata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c 
b/drivers/md/persistent-data/dm-space-map-metadata.c
index 786b689bdfc7..f4e22bcc7fb8 100644
--- a/drivers/md/persistent-data/dm-space-map-metadata.c
+++ b/drivers/md/persistent-data/dm-space-map-metadata.c
@@ -564,7 +564,9 @@ static int sm_bootstrap_get_nr_blocks(struct dm_space_map 
*sm, dm_block_t *count
 {
struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
 
-   return smm->ll.nr_blocks;
+   *count = smm->ll.nr_blocks;
+
+   return 0;
 }
 
 static int sm_bootstrap_get_nr_free(struct dm_space_map *sm, dm_block_t *count)
-- 
2.1.4

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


[PATCH 3.16.y-ckt 126/216] pstore-ram: Allow optional mapping with pgprot_noncached

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Tony Lindgren 

commit 027bc8b08242c59e19356b4b2c189f2d849ab660 upstream.

On some ARMs the memory can be mapped pgprot_noncached() and still
be working for atomic operations. As pointed out by Colin Cross
, in some cases you do want to use
pgprot_noncached() if the SoC supports it to see a debug printk
just before a write hanging the system.

On ARMs, the atomic operations on strongly ordered memory are
implementation defined. So let's provide an optional kernel parameter
for configuring pgprot_noncached(), and use pgprot_writecombine() by
default.

Cc: Arnd Bergmann 
Cc: Rob Herring 
Cc: Randy Dunlap 
Cc: Anton Vorontsov 
Cc: Colin Cross 
Cc: Olof Johansson 
Cc: Russell King 
Acked-by: Kees Cook 
Signed-off-by: Tony Lindgren 
Signed-off-by: Tony Luck 
Signed-off-by: Luis Henriques 
---
 Documentation/ramoops.txt  | 13 +++--
 fs/pstore/ram.c| 13 +++--
 fs/pstore/ram_core.c   | 31 ++-
 include/linux/pstore_ram.h |  4 +++-
 4 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt
index 69b3cac4749d..5d8675615e59 100644
--- a/Documentation/ramoops.txt
+++ b/Documentation/ramoops.txt
@@ -14,11 +14,19 @@ survive after a restart.
 
 1. Ramoops concepts
 
-Ramoops uses a predefined memory area to store the dump. The start and size of
-the memory area are set using two variables:
+Ramoops uses a predefined memory area to store the dump. The start and size
+and type of the memory area are set using three variables:
   * "mem_address" for the start
   * "mem_size" for the size. The memory size will be rounded down to a
   power of two.
+  * "mem_type" to specifiy if the memory type (default is pgprot_writecombine).
+
+Typically the default value of mem_type=0 should be used as that sets the 
pstore
+mapping to pgprot_writecombine. Setting mem_type=1 attempts to use
+pgprot_noncached, which only works on some platforms. This is because pstore
+depends on atomic operations. At least on ARM, pgprot_noncached causes the
+memory to be mapped strongly ordered, and atomic operations on strongly ordered
+memory are implementation defined, and won't work on many ARMs such as omaps.
 
 The memory area is divided into "record_size" chunks (also rounded down to
 power of two) and each oops/panic writes a "record_size" chunk of
@@ -55,6 +63,7 @@ Setting the ramoops parameters can be done in 2 different 
manners:
 static struct ramoops_platform_data ramoops_data = {
 .mem_size   = <...>,
 .mem_address= <...>,
+.mem_type   = <...>,
 .record_size= <...>,
 .dump_oops  = <...>,
 .ecc= <...>,
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 3b5744306ed8..5fa34243b1ae 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -61,6 +61,11 @@ module_param(mem_size, ulong, 0400);
 MODULE_PARM_DESC(mem_size,
"size of reserved RAM used to store oops/panic logs");
 
+static unsigned int mem_type;
+module_param(mem_type, uint, 0600);
+MODULE_PARM_DESC(mem_type,
+   "set to 1 to try to use unbuffered memory (default 0)");
+
 static int dump_oops = 1;
 module_param(dump_oops, int, 0600);
 MODULE_PARM_DESC(dump_oops,
@@ -79,6 +84,7 @@ struct ramoops_context {
struct persistent_ram_zone *fprz;
phys_addr_t phys_addr;
unsigned long size;
+   unsigned int memtype;
size_t record_size;
size_t console_size;
size_t ftrace_size;
@@ -358,7 +364,8 @@ static int ramoops_init_przs(struct device *dev, struct 
ramoops_context *cxt,
size_t sz = cxt->record_size;
 
cxt->przs[i] = persistent_ram_new(*paddr, sz, 0,
- >ecc_info);
+ >ecc_info,
+ cxt->memtype);
if (IS_ERR(cxt->przs[i])) {
err = PTR_ERR(cxt->przs[i]);
dev_err(dev, "failed to request mem region 
(0x%zx@0x%llx): %d\n",
@@ -388,7 +395,7 @@ static int ramoops_init_prz(struct device *dev, struct 
ramoops_context *cxt,
return -ENOMEM;
}
 
-   *prz = persistent_ram_new(*paddr, sz, sig, >ecc_info);
+   *prz = persistent_ram_new(*paddr, sz, sig, >ecc_info, 
cxt->memtype);
if (IS_ERR(*prz)) {
int err = PTR_ERR(*prz);
 
@@ -435,6 +442,7 @@ static int ramoops_probe(struct platform_device *pdev)
 
cxt->size = pdata->mem_size;
cxt->phys_addr = pdata->mem_address;
+   cxt->memtype = pdata->mem_type;
cxt->record_size = pdata->record_size;
cxt->console_size = pdata->console_size;
cxt->ftrace_size = pdata->ftrace_size;
@@ -564,6 +572,7 @@ static 

[PATCH 3.16.y-ckt 153/216] ARM: mvebu: fix ordering in Armada 370 .dtsi

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= 

commit ab1e85372168892387dd1ac171158fc8c3119be4 upstream.

Commit a095b1c78a35 ("ARM: mvebu: sort DT nodes by address")
missed placing the system-controller in the correct order.

Fixes: a095b1c78a35 ("ARM: mvebu: sort DT nodes by address")
Signed-off-by: Uwe Kleine-König 
Acked-by: Andrew Lunn 
Link: https://lkml.kernel.org/r/20141114204333.gs27...@pengutronix.de
Signed-off-by: Jason Cooper 
Signed-off-by: Luis Henriques 
---
 arch/arm/boot/dts/armada-370.dtsi | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/armada-370.dtsi 
b/arch/arm/boot/dts/armada-370.dtsi
index 21b588b6f6bd..77d22d82faf5 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -106,11 +106,6 @@
reg = <0x11100 0x20>;
};
 
-   system-controller@18200 {
-   compatible = 
"marvell,armada-370-xp-system-controller";
-   reg = <0x18200 0x100>;
-   };
-
pinctrl {
compatible = "marvell,mv88f6710-pinctrl";
reg = <0x18000 0x38>;
@@ -186,6 +181,11 @@
interrupts = <91>;
};
 
+   system-controller@18200 {
+   compatible = 
"marvell,armada-370-xp-system-controller";
+   reg = <0x18200 0x100>;
+   };
+
gateclk: clock-gating-control@18220 {
compatible = "marvell,armada-370-gating-clock";
reg = <0x18220 0x4>;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 154/216] eCryptfs: Force RO mount when encrypted view is enabled

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Tyler Hicks 

commit 332b122d39c9cbff8b799007a825d94b2e7c12f2 upstream.

The ecryptfs_encrypted_view mount option greatly changes the
functionality of an eCryptfs mount. Instead of encrypting and decrypting
lower files, it provides a unified view of the encrypted files in the
lower filesystem. The presence of the ecryptfs_encrypted_view mount
option is intended to force a read-only mount and modifying files is not
supported when the feature is in use. See the following commit for more
information:

  e77a56d [PATCH] eCryptfs: Encrypted passthrough

This patch forces the mount to be read-only when the
ecryptfs_encrypted_view mount option is specified by setting the
MS_RDONLY flag on the superblock. Additionally, this patch removes some
broken logic in ecryptfs_open() that attempted to prevent modifications
of files when the encrypted view feature was in use. The check in
ecryptfs_open() was not sufficient to prevent file modifications using
system calls that do not operate on a file descriptor.

Signed-off-by: Tyler Hicks 
Reported-by: Priya Bansal 
Signed-off-by: Luis Henriques 
---
 fs/ecryptfs/file.c | 12 
 fs/ecryptfs/main.c | 16 +---
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index db0fad3269c0..a06ad2f7ed80 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -190,23 +190,11 @@ static int ecryptfs_open(struct inode *inode, struct file 
*file)
 {
int rc = 0;
struct ecryptfs_crypt_stat *crypt_stat = NULL;
-   struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
struct dentry *ecryptfs_dentry = file->f_path.dentry;
/* Private value of ecryptfs_dentry allocated in
 * ecryptfs_lookup() */
struct ecryptfs_file_info *file_info;
 
-   mount_crypt_stat = _superblock_to_private(
-   ecryptfs_dentry->d_sb)->mount_crypt_stat;
-   if ((mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
-   && ((file->f_flags & O_WRONLY) || (file->f_flags & O_RDWR)
-   || (file->f_flags & O_CREAT) || (file->f_flags & O_TRUNC)
-   || (file->f_flags & O_APPEND))) {
-   printk(KERN_WARNING "Mount has encrypted view enabled; "
-  "files may only be read\n");
-   rc = -EPERM;
-   goto out;
-   }
/* Released in ecryptfs_release or end of function if failure */
file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
ecryptfs_set_file_private(file, file_info);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 1b119d3bf924..34eb8433d93f 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -493,6 +493,7 @@ static struct dentry *ecryptfs_mount(struct 
file_system_type *fs_type, int flags
 {
struct super_block *s;
struct ecryptfs_sb_info *sbi;
+   struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
struct ecryptfs_dentry_info *root_info;
const char *err = "Getting sb failed";
struct inode *inode;
@@ -511,6 +512,7 @@ static struct dentry *ecryptfs_mount(struct 
file_system_type *fs_type, int flags
err = "Error parsing options";
goto out;
}
+   mount_crypt_stat = >mount_crypt_stat;
 
s = sget(fs_type, NULL, set_anon_super, flags, NULL);
if (IS_ERR(s)) {
@@ -557,11 +559,19 @@ static struct dentry *ecryptfs_mount(struct 
file_system_type *fs_type, int flags
 
/**
 * Set the POSIX ACL flag based on whether they're enabled in the lower
-* mount. Force a read-only eCryptfs mount if the lower mount is ro.
-* Allow a ro eCryptfs mount even when the lower mount is rw.
+* mount.
 */
s->s_flags = flags & ~MS_POSIXACL;
-   s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL);
+   s->s_flags |= path.dentry->d_sb->s_flags & MS_POSIXACL;
+
+   /**
+* Force a read-only eCryptfs mount when:
+*   1) The lower mount is ro
+*   2) The ecryptfs_encrypted_view mount option is specified
+*/
+   if (path.dentry->d_sb->s_flags & MS_RDONLY ||
+   mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)
+   s->s_flags |= MS_RDONLY;
 
s->s_maxbytes = path.dentry->d_sb->s_maxbytes;
s->s_blocksize = path.dentry->d_sb->s_blocksize;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 155/216] eCryptfs: Remove buggy and unnecessary write in file name decode routine

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Michael Halcrow 

commit 942080643bce061c3dd9d5718d3b745dcb39a8bc upstream.

Dmitry Chernenkov used KASAN to discover that eCryptfs writes past the
end of the allocated buffer during encrypted filename decoding. This
fix corrects the issue by getting rid of the unnecessary 0 write when
the current bit offset is 2.

Signed-off-by: Michael Halcrow 
Reported-by: Dmitry Chernenkov 
Suggested-by: Kees Cook 
Signed-off-by: Tyler Hicks 
Signed-off-by: Luis Henriques 
---
 fs/ecryptfs/crypto.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 2f6735dbf1a9..31b148f3e772 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1917,7 +1917,6 @@ ecryptfs_decode_from_filename(unsigned char *dst, size_t 
*dst_size,
break;
case 2:
dst[dst_byte_offset++] |= (src_byte);
-   dst[dst_byte_offset] = 0;
current_bit_offset = 0;
break;
}
-- 
2.1.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: [GIT PULL] USB fixes for v3.19-rc5

2015-01-12 Thread Greg KH
On Mon, Jan 12, 2015 at 12:07:20PM -0600, Felipe Balbi wrote:
> Hi Greg,
> 
> Looks like this will be my last pull request for v3.19. Please consider 
> merging
> on top of your usb-linus branch.
> 
> Note that there will be a conflict when merging on that branch, the solution 
> is
> to use the version from my tree as that's more correct. Here's how the related
> code should look like:
> 
> devm_usb_ge_phy_by_phandle():
> 
> [ ... ]
> 
> 195 phy = __of_usb_find_phy(node);
> 196 if (IS_ERR(phy)) {
> 197 devres_free(ptr);
> 198 goto err1;
> 199 }
> 200 
> 201 if (!try_module_get(phy->dev->driver->owner)) {
> 202 phy = ERR_PTR(-ENODEV);
> 203 devres_free(ptr);
> 204 goto err1;
> 205 }
> 
> [ ... ]
> 
> cheers
> 
> The following changes since commit 6785a1034461c2d2c205215f63a50a740896e55b:
> 
>   usb: gadget: udc: atmel: fix possible IN hang issue (2014-12-22 10:41:15 
> -0600)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
> tags/fixes-for-v3.19-rc5

Pulled and pushed out.

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/


[PATCH 3.16.y-ckt 157/216] clk: samsung: Fix double add of syscore ops after driver rebind

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Krzysztof Kozlowski 

commit c31844ffdbd4e73a16c66e9d7df8ec290ab4b159 upstream.

During driver unbind the syscore ops were not unregistered which lead to
double add on syscore list:

$ echo "381.audss-clock-controller" > 
/sys/bus/platform/drivers/exynos-audss-clk/unbind
$ echo "381.audss-clock-controller" > 
/sys/bus/platform/drivers/exynos-audss-clk/bind
[ 1463.044061] [ cut here ]
[ 1463.047255] WARNING: CPU: 0 PID: 1 at lib/list_debug.c:36 
__list_add+0x8c/0xc0()
[ 1463.054613] list_add double add: new=c06e52c0, prev=c06e52c0, next=c06d5f84.
[ 1463.061625] Modules linked in:
[ 1463.064623] CPU: 0 PID: 1 Comm: bash Tainted: GW  
3.18.0-rc5-next-20141121-5-ga8fab06eab42-dirty #1022
[ 1463.075338] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[ 1463.083046] [] (show_stack) from [] 
(dump_stack+0x70/0xbc)
[ 1463.090236] [] (dump_stack) from [] 
(warn_slowpath_common+0x74/0xb0)
[ 1463.098295] [] (warn_slowpath_common) from [] 
(warn_slowpath_fmt+0x30/0x40)
[ 1463.106962] [] (warn_slowpath_fmt) from [] 
(__list_add+0x8c/0xc0)
[ 1463.114760] [] (__list_add) from [] 
(register_syscore_ops+0x30/0x3c)
[ 1463.122819] [] (register_syscore_ops) from [] 
(exynos_audss_clk_probe+0x36c/0x460)
[ 1463.132091] [] (exynos_audss_clk_probe) from [] 
(platform_drv_probe+0x48/0xa4)
[ 1463.141013] [] (platform_drv_probe) from [] 
(driver_probe_device+0x13c/0x37c)
[ 1463.149852] [] (driver_probe_device) from [] 
(bind_store+0x90/0xe0)
[ 1463.157822] [] (bind_store) from [] 
(drv_attr_store+0x20/0x2c)
[ 1463.165363] [] (drv_attr_store) from [] 
(sysfs_kf_write+0x4c/0x50)
[ 1463.173252] [] (sysfs_kf_write) from [] 
(kernfs_fop_write+0xbc/0x198)
[ 1463.181395] [] (kernfs_fop_write) from [] 
(vfs_write+0xa0/0x1a8)
[ 1463.189104] [] (vfs_write) from [] (SyS_write+0x40/0x8c)
[ 1463.196122] [] (SyS_write) from [] 
(ret_fast_syscall+0x0/0x48)
[ 1463.203655] ---[ end trace 08f6710c9bc8d8f3 ]---
[ 1463.208244] exynos-audss-clk 381.audss-clock-controller: setup completed

Signed-off-by: Krzysztof Kozlowski 
Fixes: 1241ef94ccc3 ("clk: samsung: register audio subsystem clocks using 
common clock framework")
Signed-off-by: Sylwester Nawrocki 
Signed-off-by: Luis Henriques 
---
 drivers/clk/samsung/clk-exynos-audss.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos-audss.c 
b/drivers/clk/samsung/clk-exynos-audss.c
index 13eae14c2cc2..b50469faf70c 100644
--- a/drivers/clk/samsung/clk-exynos-audss.c
+++ b/drivers/clk/samsung/clk-exynos-audss.c
@@ -210,6 +210,10 @@ static int exynos_audss_clk_remove(struct platform_device 
*pdev)
 {
int i;
 
+#ifdef CONFIG_PM_SLEEP
+   unregister_syscore_ops(_audss_clk_syscore_ops);
+#endif
+
of_clk_del_provider(pdev->dev.of_node);
 
for (i = 0; i < clk_data.clk_num; i++) {
-- 
2.1.4

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


[PATCH 3.16.y-ckt 142/216] isofs: Fix infinite looping over CE entries

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit f54e18f1b831c92f6512d2eedb224cd63d607d3d upstream.

Rock Ridge extensions define so called Continuation Entries (CE) which
define where is further space with Rock Ridge data. Corrupted isofs
image can contain arbitrarily long chain of these, including a one
containing loop and thus causing kernel to end in an infinite loop when
traversing these entries.

Limit the traversal to 32 entries which should be more than enough space
to store all the Rock Ridge data.

Reported-by: P J P 
Signed-off-by: Jan Kara 
Signed-off-by: Luis Henriques 
---
 fs/isofs/rock.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index f488bbae541a..bb63254ed848 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -30,6 +30,7 @@ struct rock_state {
int cont_size;
int cont_extent;
int cont_offset;
+   int cont_loops;
struct inode *inode;
 };
 
@@ -73,6 +74,9 @@ static void init_rock_state(struct rock_state *rs, struct 
inode *inode)
rs->inode = inode;
 }
 
+/* Maximum number of Rock Ridge continuation entries */
+#define RR_MAX_CE_ENTRIES 32
+
 /*
  * Returns 0 if the caller should continue scanning, 1 if the scan must end
  * and -ve on error.
@@ -105,6 +109,8 @@ static int rock_continue(struct rock_state *rs)
goto out;
}
ret = -EIO;
+   if (++rs->cont_loops >= RR_MAX_CE_ENTRIES)
+   goto out;
bh = sb_bread(rs->inode->i_sb, rs->cont_extent);
if (bh) {
memcpy(rs->buffer, bh->b_data + rs->cont_offset,
-- 
2.1.4

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


[PATCH 3.16.y-ckt 159/216] Revert "[SCSI] mpt3sas: Remove phys on topology change"

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sreekanth Reddy 

commit 2311ce4d9c91ed63a46e18f0378f3e406e7e888e upstream.

This reverts commit 963ba22b90a955363644cd397b20226928eab976
("mpt3sas: Remove phys on topology change")

Reverting the previous mpt3sas drives patch changes,
since we will observe below issue

Issue:
Drives connected Enclosure/Expander will unregister with
SCSI Transport Layer, if any one remove and add expander
cable with in DMD (Device Missing Delay) time period or
even any one power-off and power-on the Enclosure with in
the DMD period.

Signed-off-by: Sreekanth Reddy 
Reviewed-by: Tomas Henzl 
Signed-off-by: Christoph Hellwig 
Signed-off-by: Luis Henriques 
---
 drivers/scsi/mpt3sas/mpt3sas_transport.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c 
b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index 65170cb1a00f..55aa597eb229 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -1003,12 +1003,9 @@ mpt3sas_transport_update_links(struct MPT3SAS_ADAPTER 
*ioc,
_phy->remote_identify);
_transport_add_phy_to_an_existing_port(ioc, sas_node,
mpt3sas_phy, mpt3sas_phy->remote_identify.sas_address);
-   } else {
+   } else
memset(_phy->remote_identify, 0 , sizeof(struct
sas_identify));
-   _transport_del_phy_from_an_existing_port(ioc, sas_node,
-   mpt3sas_phy);
-   }
 
if (mpt3sas_phy->phy)
mpt3sas_phy->phy->negotiated_linkrate =
-- 
2.1.4

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


[PATCH 3.16.y-ckt 164/216] drm/i915: vlv: fix IRQ masking when uninstalling interrupts

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Imre Deak 

commit c352d1ba1e1e2c8a96af660944a58e86b12ac4af upstream.

irq_mask should include all IRQ bits that we want to mask, but atm we
set it incorrectly to the inverse of this. If the mask is used
subsequently to enable/disable some IRQ bits, we may unintentionally
unmask unrelated IRQs. I can't see any way that this can lead to a real
problem in the current -nightly code, since the first place the mask
will be used next (after a suspend/resume cycle) is in
valleyview_irq_postinstall(), but the mask is reset there to its proper
value.

This causes a problem in the upstream kernel though, where - due to another
issue - the mask is used in the above way to disable only the display IRQs.
This other issue is fixed by:

commit 950eabaf5a87257040e0c207be09487954113f54
Author: Imre Deak 
Date:   Mon Sep 8 15:21:09 2014 +0300

drm/i915: vlv: fix display IRQ enable/disable

Interestingly, even with the above two bugs, we shouldn't in theory have
any real problems (arguably a famous last sentence:). That's because
even if we unmask something unintentionally via the VLV_IMR/VLV_IER
register the master IRQ masking bit in VLV_MASTER_IER is still set and
should prevent all i915 interrupts. According to my testing on an ASUS
T100 with DSI output this isn't the case at least with the
MIPIA_INTERRUPT. Leaving this one unmasked in IMR/IER, while having
VLV_MASTER_IER set to 0 may lead to a lockup during system suspend as
shown in the bugzilla ticket below. This fix should get rid of the
problem reported there in upstream and older kernels.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85920
Signed-off-by: Imre Deak 
Reviewed-by: Ville Syrjälä 
Signed-off-by: Jani Nikula 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 drivers/gpu/drm/i915/i915_irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index c05c84f3f091..b54f8563ebbb 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -3591,7 +3591,7 @@ static void valleyview_irq_uninstall(struct drm_device 
*dev)
valleyview_display_irqs_uninstall(dev_priv);
spin_unlock_irqrestore(_priv->irq_lock, irqflags);
 
-   dev_priv->irq_mask = 0;
+   dev_priv->irq_mask = ~0;
 
I915_WRITE(VLV_IIR, 0x);
I915_WRITE(VLV_IMR, 0x);
-- 
2.1.4

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


[PATCH 3.16.y-ckt 161/216] Btrfs: fix fs corruption on transaction abort if device supports discard

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Filipe Manana 

commit 678886bdc6378c1cbd5072da2c5a3035000214e3 upstream.

When we abort a transaction we iterate over all the ranges marked as dirty
in fs_info->freed_extents[0] and fs_info->freed_extents[1], clear them
from those trees, add them back (unpin) to the free space caches and, if
the fs was mounted with "-o discard", perform a discard on those regions.
Also, after adding the regions to the free space caches, a fitrim ioctl call
can see those ranges in a block group's free space cache and perform a discard
on the ranges, so the same issue can happen without "-o discard" as well.

This causes corruption, affecting one or multiple btree nodes (in the worst
case leaving the fs unmountable) because some of those ranges (the ones in
the fs_info->pinned_extents tree) correspond to btree nodes/leafs that are
referred by the last committed super block - breaking the rule that anything
that was committed by a transaction is untouched until the next transaction
commits successfully.

I ran into this while running in a loop (for several hours) the fstest that
I recently submitted:

  [PATCH] fstests: add btrfs test to stress chunk allocation/removal and fstrim

The corruption always happened when a transaction aborted and then fsck 
complained
like this:

   _check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent
   *** fsck.btrfs output ***
   Check tree block failed, want=94945280, have=0
   Check tree block failed, want=94945280, have=0
   Check tree block failed, want=94945280, have=0
   Check tree block failed, want=94945280, have=0
   Check tree block failed, want=94945280, have=0
   read block failed check_tree_block
   Couldn't open file system

In this case 94945280 corresponded to the root of a tree.
Using frace what I observed was the following sequence of steps happened:

   1) transaction N started, fs_info->pinned_extents pointed to
  fs_info->freed_extents[0];

   2) node/eb 94945280 is created;

   3) eb is persisted to disk;

   4) transaction N commit starts, fs_info->pinned_extents now points to
  fs_info->freed_extents[1], and transaction N completes;

   5) transaction N + 1 starts;

   6) eb is COWed, and btrfs_free_tree_block() called for this eb;

   7) eb range (94945280 to 94945280 + 16Kb) is added to
  fs_info->pinned_extents (fs_info->freed_extents[1]);

   8) Something goes wrong in transaction N + 1, like hitting ENOSPC
  for example, and the transaction is aborted, turning the fs into
  readonly mode. The stack trace I got for example:

  [112065.253935]  [] dump_stack+0x4d/0x66
  [112065.254271]  [] warn_slowpath_common+0x7f/0x98
  [112065.254567]  [] ? 
__btrfs_abort_transaction+0x50/0x10b [btrfs]
  [112065.261674]  [] warn_slowpath_fmt+0x48/0x50
  [112065.261922]  [] ? btrfs_free_path+0x26/0x29 [btrfs]
  [112065.262211]  [] 
__btrfs_abort_transaction+0x50/0x10b [btrfs]
  [112065.262545]  [] btrfs_remove_chunk+0x537/0x58b 
[btrfs]
  [112065.262771]  [] btrfs_delete_unused_bgs+0x1de/0x21b 
[btrfs]
  [112065.263105]  [] cleaner_kthread+0x100/0x12f [btrfs]
  (...)
  [112065.264493] ---[ end trace dd7903a975a31a08 ]---
  [112065.264673] BTRFS: error (device sdc) in btrfs_remove_chunk:2625: 
errno=-28 No space left
  [112065.264997] BTRFS info (device sdc): forced readonly

   9) The clear kthread sees that the BTRFS_FS_STATE_ERROR bit is set in
  fs_info->fs_state and calls btrfs_cleanup_transaction(), which in
  turn calls btrfs_destroy_pinned_extent();

   10) Then btrfs_destroy_pinned_extent() iterates over all the ranges
   marked as dirty in fs_info->freed_extents[], and for each one
   it calls discard, if the fs was mounted with "-o discard", and
   adds the range to the free space cache of the respective block
   group;

   11) btrfs_trim_block_group(), invoked from the fitrim ioctl code path,
   sees the free space entries and performs a discard;

   12) After an umount and mount (or fsck), our eb's location on disk was full
   of zeroes, and it should have been untouched, because it was marked as
   dirty in the fs_info->pinned_extents tree, and therefore used by the
   trees that the last committed superblock points to.

Fix this by not performing a discard and not adding the ranges to the free space
caches - it's useless from this point since the fs is now in readonly mode and
we won't write free space caches to disk anymore (otherwise we would leak space)
nor any new superblock. By not adding the ranges to the free space caches, it
prevents other code paths from allocating that space and write to it as well,
therefore being safer and simpler.

This isn't a new problem, as it's been present since 2011 (git commit
acce952b0263825da32cf10489413dec78053347).

Signed-off-by: Filipe Manana 
Signed-off-by: Chris Mason 
Signed-off-by: Luis 

[PATCH 3.16.y-ckt 138/216] tracing/sched: Check preempt_count() for current when reading task->state

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: "Steven Rostedt (Red Hat)" 

commit aee4e5f3d3abb7a2239dd02f6d8fb173413fd02f upstream.

When recording the state of a task for the sched_switch tracepoint a check of
task_preempt_count() is performed to see if PREEMPT_ACTIVE is set. This is
because, technically, a task being preempted is really in the TASK_RUNNING
state, and that is what should be recorded when tracing a sched_switch,
even if the task put itself into another state (it hasn't scheduled out
in that state yet).

But with the change to use per_cpu preempt counts, the
task_thread_info(p)->preempt_count is no longer used, and instead
task_preempt_count(p) is used.

The problem is that this does not use the current preempt count but a stale
one from a previous sched_switch. The task_preempt_count(p) uses
saved_preempt_count and not preempt_count(). But for tracing sched_switch,
if p is current, we really want preempt_count().

I hit this bug when I was tracing sleep and the call from do_nanosleep()
scheduled out in the "RUNNING" state.

   sleep-4290  [000] 537272.259992: sched_switch: sleep:4290 
[120] R ==> swapper/0:0 [120]
   sleep-4290  [000] 537272.260015: kernel_stack: 
=> __schedule (8150864a)
=> schedule (815089f8)
=> do_nanosleep (8150b76c)
=> hrtimer_nanosleep (8108d66b)
=> SyS_nanosleep (8108d750)
=> return_to_handler (8150e8e5)
=> tracesys_phase2 (8150c844)

After a bit of hair pulling, I found that the state was really
TASK_INTERRUPTIBLE, but the saved_preempt_count had an old PREEMPT_ACTIVE
set and caused the sched_switch tracepoint to show it as RUNNING.

Link: http://lkml.kernel.org/r/20141210174428.3cb75...@gandalf.local.home

Acked-by: Ingo Molnar 
Cc: Peter Zijlstra 
Fixes: 01028747559a "sched: Create more preempt_count accessors"
Signed-off-by: Steven Rostedt 
Signed-off-by: Luis Henriques 
---
 include/trace/events/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 0a68d5ae584e..a7d67bc14906 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct 
task_struct *p)
/*
 * For all intents and purposes a preempted task is a running task.
 */
-   if (task_preempt_count(p) & PREEMPT_ACTIVE)
+   if (preempt_count() & PREEMPT_ACTIVE)
state = TASK_RUNNING | TASK_STATE_MAX;
 #endif
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 141/216] ARC: [nsimosci] move peripherals to match model to FPGA

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Vineet Gupta 

commit e8ef060b37c2d3cc5fd0c0edbe4e42ec1cb9768b upstream.

This allows the sdplite/Zebu images to run on OSCI simulation platform

Signed-off-by: Vineet Gupta 
Signed-off-by: Luis Henriques 
---
 arch/arc/boot/dts/nsimosci.dts | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts
index 398064cef746..4c169d825415 100644
--- a/arch/arc/boot/dts/nsimosci.dts
+++ b/arch/arc/boot/dts/nsimosci.dts
@@ -20,7 +20,7 @@
/* this is for console on PGU */
/* bootargs = "console=tty0 consoleblank=0"; */
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xc000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
};
 
aliases {
@@ -46,9 +46,9 @@
#interrupt-cells = <1>;
};
 
-   uart0: serial@c000 {
+   uart0: serial@f000 {
compatible = "ns8250";
-   reg = <0xc000 0x2000>;
+   reg = <0xf000 0x2000>;
interrupts = <11>;
clock-frequency = <3686400>;
baud = <115200>;
@@ -57,21 +57,21 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@c900 {
+   pgu0: pgu@f900 {
compatible = "snps,arcpgufb";
-   reg = <0xc900 0x400>;
+   reg = <0xf900 0x400>;
};
 
-   ps2: ps2@c9001000 {
+   ps2: ps2@f9001000 {
compatible = "snps,arc_ps2";
-   reg = <0xc9000400 0x14>;
+   reg = <0xf9000400 0x14>;
interrupts = <13>;
interrupt-names = "arc_ps2_irq";
};
 
-   eth0: ethernet@c0003000 {
+   eth0: ethernet@f0003000 {
compatible = "snps,oscilan";
-   reg = <0xc0003000 0x44>;
+   reg = <0xf0003000 0x44>;
interrupts = <7>, <8>;
interrupt-names = "rx", "tx";
};
-- 
2.1.4

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


[PATCH 3.16.y-ckt 160/216] ASoC: pcm512x: Trigger auto-increment of register addresses on i2c

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Peter Rosin 

commit 681a19560378213a193c424881b2180a783b81ae upstream.

When the codec is connected using i2c, it will only auto-increment
register addresses if msb (0x80) of the register address byte is set.

[Fixes cache sync if multiple adjacent registers are updated -- broonie]

Signed-off-by: Peter Rosin 
Signed-off-by: Mark Brown 
Signed-off-by: Luis Henriques 
---
 sound/soc/codecs/pcm512x-i2c.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/pcm512x-i2c.c b/sound/soc/codecs/pcm512x-i2c.c
index 4d62230bd378..d0547fa275fc 100644
--- a/sound/soc/codecs/pcm512x-i2c.c
+++ b/sound/soc/codecs/pcm512x-i2c.c
@@ -24,8 +24,13 @@ static int pcm512x_i2c_probe(struct i2c_client *i2c,
 const struct i2c_device_id *id)
 {
struct regmap *regmap;
+   struct regmap_config config = pcm512x_regmap;
 
-   regmap = devm_regmap_init_i2c(i2c, _regmap);
+   /* msb needs to be set to enable auto-increment of addresses */
+   config.read_flag_mask = 0x80;
+   config.write_flag_mask = 0x80;
+
+   regmap = devm_regmap_init_i2c(i2c, );
if (IS_ERR(regmap))
return PTR_ERR(regmap);
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 156/216] tcm_loop: Fix wrong I_T nexus association

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Hannes Reinecke 

commit 506787a2c7daed45f0a213674ca706cbc83a9089 upstream.

tcm_loop has the I_T nexus associated with the HBA. This causes
commands to become misdirected if the HBA has more than one
target portal group; any command is then being sent to the
first target portal group instead of the correct one.

The nexus needs to be associated with the target portal group
instead.

Signed-off-by: Hannes Reinecke 
Signed-off-by: Nicholas Bellinger 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 drivers/target/loopback/tcm_loop.c | 66 +-
 drivers/target/loopback/tcm_loop.h |  7 +---
 2 files changed, 24 insertions(+), 49 deletions(-)

diff --git a/drivers/target/loopback/tcm_loop.c 
b/drivers/target/loopback/tcm_loop.c
index 8c64b8776a96..6177ed38121e 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -197,7 +197,7 @@ static void tcm_loop_submission_work(struct work_struct 
*work)
set_host_byte(sc, DID_TRANSPORT_DISRUPTED);
goto out_done;
}
-   tl_nexus = tl_hba->tl_nexus;
+   tl_nexus = tl_tpg->tl_nexus;
if (!tl_nexus) {
scmd_printk(KERN_ERR, sc, "TCM_Loop I_T Nexus"
" does not exist\n");
@@ -277,16 +277,26 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, 
struct scsi_cmnd *sc)
  * to struct scsi_device
  */
 static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg,
- struct tcm_loop_nexus *tl_nexus,
  int lun, int task, enum tcm_tmreq_table tmr)
 {
struct se_cmd *se_cmd = NULL;
struct se_session *se_sess;
struct se_portal_group *se_tpg;
+   struct tcm_loop_nexus *tl_nexus;
struct tcm_loop_cmd *tl_cmd = NULL;
struct tcm_loop_tmr *tl_tmr = NULL;
int ret = TMR_FUNCTION_FAILED, rc;
 
+   /*
+* Locate the tl_nexus and se_sess pointers
+*/
+   tl_nexus = tl_tpg->tl_nexus;
+   if (!tl_nexus) {
+   pr_err("Unable to perform device reset without"
+   " active I_T Nexus\n");
+   return ret;
+   }
+
tl_cmd = kmem_cache_zalloc(tcm_loop_cmd_cache, GFP_KERNEL);
if (!tl_cmd) {
pr_err("Unable to allocate memory for tl_cmd\n");
@@ -302,7 +312,7 @@ static int tcm_loop_issue_tmr(struct tcm_loop_tpg *tl_tpg,
 
se_cmd = _cmd->tl_se_cmd;
se_tpg = _tpg->tl_se_tpg;
-   se_sess = tl_nexus->se_sess;
+   se_sess = tl_tpg->tl_nexus->se_sess;
/*
 * Initialize struct se_cmd descriptor from target_core_mod 
infrastructure
 */
@@ -347,7 +357,6 @@ release:
 static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 {
struct tcm_loop_hba *tl_hba;
-   struct tcm_loop_nexus *tl_nexus;
struct tcm_loop_tpg *tl_tpg;
int ret = FAILED;
 
@@ -355,21 +364,8 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 * Locate the tcm_loop_hba_t pointer
 */
tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
-   /*
-* Locate the tl_nexus and se_sess pointers
-*/
-   tl_nexus = tl_hba->tl_nexus;
-   if (!tl_nexus) {
-   pr_err("Unable to perform device reset without"
-   " active I_T Nexus\n");
-   return FAILED;
-   }
-
-   /*
-* Locate the tl_tpg pointer from TargetID in sc->device->id
-*/
tl_tpg = _hba->tl_hba_tpgs[sc->device->id];
-   ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun,
+   ret = tcm_loop_issue_tmr(tl_tpg, sc->device->lun,
 sc->tag, TMR_ABORT_TASK);
return (ret == TMR_FUNCTION_COMPLETE) ? SUCCESS : FAILED;
 }
@@ -381,7 +377,6 @@ static int tcm_loop_abort_task(struct scsi_cmnd *sc)
 static int tcm_loop_device_reset(struct scsi_cmnd *sc)
 {
struct tcm_loop_hba *tl_hba;
-   struct tcm_loop_nexus *tl_nexus;
struct tcm_loop_tpg *tl_tpg;
int ret = FAILED;
 
@@ -389,20 +384,9 @@ static int tcm_loop_device_reset(struct scsi_cmnd *sc)
 * Locate the tcm_loop_hba_t pointer
 */
tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
-   /*
-* Locate the tl_nexus and se_sess pointers
-*/
-   tl_nexus = tl_hba->tl_nexus;
-   if (!tl_nexus) {
-   pr_err("Unable to perform device reset without"
-   " active I_T Nexus\n");
-   return FAILED;
-   }
-   /*
-* Locate the tl_tpg pointer from TargetID in sc->device->id
-*/
tl_tpg = _hba->tl_hba_tpgs[sc->device->id];
-   ret = tcm_loop_issue_tmr(tl_tpg, tl_nexus, sc->device->lun,
+
+   ret = 

[PATCH 3.16.y-ckt 170/216] iser-target: Fix implicit termination of connections

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit b02efbfc9a051b41e71fe8f94ddf967260e024a6 upstream.

In situations such as bond failover, The new session establishment
implicitly invokes the termination of the old connection.

So, we don't want to wait for the old connection wait_conn to completely
terminate before we accept the new connection and post a login response.

The solution is to deffer the comp_wait completion and the conn_put to
a work so wait_conn will effectively be non-blocking (flush errors are
assumed to come very fast).

We allocate isert_release_wq with WQ_UNBOUND and WQ_UNBOUND_MAX_ACTIVE
to spread the concurrency of release works.

Reported-by: Slava Shwartsman 
Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 42 ++---
 drivers/infiniband/ulp/isert/ib_isert.h |  1 +
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index 6705d0266862..8244ff44010c 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -41,6 +41,7 @@ static DEFINE_MUTEX(device_list_mutex);
 static LIST_HEAD(device_list);
 static struct workqueue_struct *isert_rx_wq;
 static struct workqueue_struct *isert_comp_wq;
+static struct workqueue_struct *isert_release_wq;
 
 static void
 isert_unmap_cmd(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn);
@@ -3338,6 +3339,24 @@ isert_free_np(struct iscsi_np *np)
kfree(isert_np);
 }
 
+static void isert_release_work(struct work_struct *work)
+{
+   struct isert_conn *isert_conn = container_of(work,
+struct isert_conn,
+release_work);
+
+   pr_info("Starting release conn %p\n", isert_conn);
+
+   wait_for_completion(_conn->conn_wait);
+
+   mutex_lock(_conn->conn_mutex);
+   isert_conn->state = ISER_CONN_DOWN;
+   mutex_unlock(_conn->conn_mutex);
+
+   pr_info("Destroying conn %p\n", isert_conn);
+   isert_put_conn(isert_conn);
+}
+
 static void isert_wait_conn(struct iscsi_conn *conn)
 {
struct isert_conn *isert_conn = conn->context;
@@ -3357,14 +3376,9 @@ static void isert_wait_conn(struct iscsi_conn *conn)
mutex_unlock(_conn->conn_mutex);
 
wait_for_completion(_conn->conn_wait_comp_err);
-   wait_for_completion(_conn->conn_wait);
-
-   mutex_lock(_conn->conn_mutex);
-   isert_conn->state = ISER_CONN_DOWN;
-   mutex_unlock(_conn->conn_mutex);
 
-   pr_info("Destroying conn %p\n", isert_conn);
-   isert_put_conn(isert_conn);
+   INIT_WORK(_conn->release_work, isert_release_work);
+   queue_work(isert_release_wq, _conn->release_work);
 }
 
 static void isert_free_conn(struct iscsi_conn *conn)
@@ -3412,10 +3426,21 @@ static int __init isert_init(void)
goto destroy_rx_wq;
}
 
+   isert_release_wq = alloc_workqueue("isert_release_wq", WQ_UNBOUND,
+   WQ_UNBOUND_MAX_ACTIVE);
+   if (!isert_release_wq) {
+   pr_err("Unable to allocate isert_release_wq\n");
+   ret = -ENOMEM;
+   goto destroy_comp_wq;
+   }
+
iscsit_register_transport(_target_transport);
-   pr_debug("iSER_TARGET[0] - Loaded iser_target_transport\n");
+   pr_info("iSER_TARGET[0] - Loaded iser_target_transport\n");
+
return 0;
 
+destroy_comp_wq:
+   destroy_workqueue(isert_comp_wq);
 destroy_rx_wq:
destroy_workqueue(isert_rx_wq);
return ret;
@@ -3424,6 +3449,7 @@ destroy_rx_wq:
 static void __exit isert_exit(void)
 {
flush_scheduled_work();
+   destroy_workqueue(isert_release_wq);
destroy_workqueue(isert_comp_wq);
destroy_workqueue(isert_rx_wq);
iscsit_unregister_transport(_target_transport);
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h 
b/drivers/infiniband/ulp/isert/ib_isert.h
index 5cad43d3de44..9372d4d4d14a 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -149,6 +149,7 @@ struct isert_conn {
int conn_fr_pool_size;
/* lock to protect fastreg pool */
spinlock_t  conn_lock;
+   struct work_struct  release_work;
 #define ISERT_COMP_BATCH_COUNT 8
int conn_comp_batch;
struct llist_head   conn_comp_llist;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 172/216] iser-target: Fix NULL dereference in SW mode DIF

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 302cc7c3ca14d21ccdffdebdb61c4fe028f2d5ad upstream.

Fallback to software mode DIF if HCA does not support
PI (without crashing obviously). It is still possible to
run with backend protection and an unprotected frontend,
so looking at the command prot_op is not enough. Check
device PI capability on a per-IO basis (isert_prot_cmd
inline static) to determine if we need to handle protection
information.

Trace:
BUG: unable to handle kernel NULL pointer dereference at 0010
IP: [] isert_reg_sig_mr+0x351/0x3b0 [ib_isert]
Call Trace:
 [] ? swiotlb_map_sg_attrs+0x7a/0x130
 [] isert_reg_rdma+0x2fd/0x370 [ib_isert]
 [] ? idle_balance+0x6c/0x2c0
 [] isert_put_datain+0x68/0x210 [ib_isert]
 [] lio_queue_data_in+0x2b/0x30 [iscsi_target_mod]
 [] target_complete_ok_work+0x21b/0x310 [target_core_mod]
 [] process_one_work+0x182/0x3b0
 [] worker_thread+0x120/0x3c0
 [] ? maybe_create_worker+0x190/0x190
 [] kthread+0xce/0xf0
 [] ? kthread_freezable_should_stop+0x70/0x70
 [] ret_from_fork+0x7c/0xb0
 [] ? kthread_freezable_should_stop+0x70/0x70

Reported-by: Slava Shwartsman 
Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index 703c957683b1..8a25ebee717a 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -61,6 +61,14 @@ static int
 isert_rdma_accept(struct isert_conn *isert_conn);
 struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
 
+static inline bool
+isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd)
+{
+   return (conn->conn_device->pi_capable &&
+   cmd->prot_op != TARGET_PROT_NORMAL);
+}
+
+
 static void
 isert_qp_event_callback(struct ib_event *e, void *context)
 {
@@ -2930,8 +2938,7 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd 
*cmd,
if (ret)
return ret;
 
-   if (wr->data.dma_nents != 1 ||
-   se_cmd->prot_op != TARGET_PROT_NORMAL) {
+   if (wr->data.dma_nents != 1 || isert_prot_cmd(isert_conn, se_cmd)) {
spin_lock_irqsave(_conn->conn_lock, flags);
fr_desc = list_first_entry(_conn->conn_fr_pool,
   struct fast_reg_descriptor, list);
@@ -2945,7 +2952,7 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd 
*cmd,
if (ret)
goto unmap_cmd;
 
-   if (se_cmd->prot_op != TARGET_PROT_NORMAL) {
+   if (isert_prot_cmd(isert_conn, se_cmd)) {
ret = isert_handle_prot_cmd(isert_conn, isert_cmd, wr);
if (ret)
goto unmap_cmd;
@@ -2970,7 +2977,7 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd 
*cmd,
send_wr->opcode = IB_WR_RDMA_WRITE;
send_wr->wr.rdma.remote_addr = isert_cmd->read_va;
send_wr->wr.rdma.rkey = isert_cmd->read_stag;
-   send_wr->send_flags = se_cmd->prot_op == TARGET_PROT_NORMAL ?
+   send_wr->send_flags = !isert_prot_cmd(isert_conn, se_cmd) ?
  0 : IB_SEND_SIGNALED;
} else {
send_wr->opcode = IB_WR_RDMA_READ;
@@ -3012,7 +3019,7 @@ isert_put_datain(struct iscsi_conn *conn, struct 
iscsi_cmd *cmd)
return rc;
}
 
-   if (se_cmd->prot_op == TARGET_PROT_NORMAL) {
+   if (!isert_prot_cmd(isert_conn, se_cmd)) {
/*
 * Build isert_conn->tx_desc for iSCSI response PDU and attach
 */
@@ -3035,7 +3042,7 @@ isert_put_datain(struct iscsi_conn *conn, struct 
iscsi_cmd *cmd)
atomic_sub(wr->send_wr_num, _conn->post_send_buf_count);
}
 
-   if (se_cmd->prot_op == TARGET_PROT_NORMAL)
+   if (!isert_prot_cmd(isert_conn, se_cmd))
pr_debug("Cmd: %p posted RDMA_WRITE + Response for iSER Data "
 "READ\n", isert_cmd);
else
-- 
2.1.4

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


[PATCH 3.16.y-ckt 171/216] iser-target: Allocate PI contexts dynamically

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 570db170f37715b7df23c95868169f3d9affa48c upstream.

This patch converts to allocate PI contexts dynamically in order
avoid a potentially bogus np->tpg_np and associated NULL pointer
dereference in isert_connect_request() during iser-target endpoint
shutdown with multiple network portals.

Also, there is really no need to allocate these at connection
establishment since it is not guaranteed that all the IOs on
that connection will be to a PI formatted device.

We can do it in a lazy fashion so the initial burst will have a
transient slow down, but very fast all IOs will allocate a PI
context.

Squashed:

iser-target: Centralize PI context handling code

Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 267 ++--
 drivers/infiniband/ulp/isert/ib_isert.h |   7 +
 2 files changed, 158 insertions(+), 116 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index 8244ff44010c..703c957683b1 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -96,8 +96,7 @@ isert_query_device(struct ib_device *ib_dev, struct 
ib_device_attr *devattr)
 }
 
 static int
-isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id,
-   u8 protection)
+isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id)
 {
struct isert_device *device = isert_conn->conn_device;
struct ib_qp_init_attr attr;
@@ -132,7 +131,7 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct 
rdma_cm_id *cma_id,
attr.cap.max_recv_sge = 1;
attr.sq_sig_type = IB_SIGNAL_REQ_WR;
attr.qp_type = IB_QPT_RC;
-   if (protection)
+   if (device->pi_capable)
attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN;
 
pr_debug("isert_conn_setup_qp cma_id->device: %p\n",
@@ -442,8 +441,68 @@ isert_conn_free_fastreg_pool(struct isert_conn *isert_conn)
 }
 
 static int
+isert_create_pi_ctx(struct fast_reg_descriptor *desc,
+   struct ib_device *device,
+   struct ib_pd *pd)
+{
+   struct ib_mr_init_attr mr_init_attr;
+   struct pi_context *pi_ctx;
+   int ret;
+
+   pi_ctx = kzalloc(sizeof(*desc->pi_ctx), GFP_KERNEL);
+   if (!pi_ctx) {
+   pr_err("Failed to allocate pi context\n");
+   return -ENOMEM;
+   }
+
+   pi_ctx->prot_frpl = ib_alloc_fast_reg_page_list(device,
+   ISCSI_ISER_SG_TABLESIZE);
+   if (IS_ERR(pi_ctx->prot_frpl)) {
+   pr_err("Failed to allocate prot frpl err=%ld\n",
+ PTR_ERR(pi_ctx->prot_frpl));
+   ret = PTR_ERR(pi_ctx->prot_frpl);
+   goto err_pi_ctx;
+   }
+
+   pi_ctx->prot_mr = ib_alloc_fast_reg_mr(pd, ISCSI_ISER_SG_TABLESIZE);
+   if (IS_ERR(pi_ctx->prot_mr)) {
+   pr_err("Failed to allocate prot frmr err=%ld\n",
+ PTR_ERR(pi_ctx->prot_mr));
+   ret = PTR_ERR(pi_ctx->prot_mr);
+   goto err_prot_frpl;
+   }
+   desc->ind |= ISERT_PROT_KEY_VALID;
+
+   memset(_init_attr, 0, sizeof(mr_init_attr));
+   mr_init_attr.max_reg_descriptors = 2;
+   mr_init_attr.flags |= IB_MR_SIGNATURE_EN;
+   pi_ctx->sig_mr = ib_create_mr(pd, _init_attr);
+   if (IS_ERR(pi_ctx->sig_mr)) {
+   pr_err("Failed to allocate signature enabled mr err=%ld\n",
+ PTR_ERR(pi_ctx->sig_mr));
+   ret = PTR_ERR(pi_ctx->sig_mr);
+   goto err_prot_mr;
+   }
+
+   desc->pi_ctx = pi_ctx;
+   desc->ind |= ISERT_SIG_KEY_VALID;
+   desc->ind &= ~ISERT_PROTECTED;
+
+   return 0;
+
+err_prot_mr:
+   ib_dereg_mr(desc->pi_ctx->prot_mr);
+err_prot_frpl:
+   ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl);
+err_pi_ctx:
+   kfree(desc->pi_ctx);
+
+   return ret;
+}
+
+static int
 isert_create_fr_desc(struct ib_device *ib_device, struct ib_pd *pd,
-struct fast_reg_descriptor *fr_desc, u8 protection)
+struct fast_reg_descriptor *fr_desc)
 {
int ret;
 
@@ -462,62 +521,12 @@ isert_create_fr_desc(struct ib_device *ib_device, struct 
ib_pd *pd,
ret = PTR_ERR(fr_desc->data_mr);
goto err_data_frpl;
}
-   pr_debug("Create fr_desc %p page_list %p\n",
-fr_desc, fr_desc->data_frpl->page_list);
fr_desc->ind |= ISERT_DATA_KEY_VALID;
 
-   if (protection) {
-   struct ib_mr_init_attr mr_init_attr = {0};
-   struct pi_context *pi_ctx;
-
-   fr_desc->pi_ctx = kzalloc(sizeof(*fr_desc->pi_ctx), GFP_KERNEL);
-

[PATCH 3.16.y-ckt 173/216] iscsi,iser-target: Expose supported protection ops according to t10_pi

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 23a548ee656c8ba6da8cb2412070edcd62e2ac5d upstream.

iSER will report supported protection operations based on
the tpg attribute t10_pi settings and HCA PI offload capabilities.
If the HCA does not support PI offload or tpg attribute t10_pi is
not set, we fall to SW PI mode.

In order to do that, we move iscsit_get_sup_prot_ops after connection
tpg assignment.

Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c   | 14 +++---
 drivers/infiniband/ulp/isert/ib_isert.h   |  1 +
 drivers/target/iscsi/iscsi_target_login.c |  7 ---
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index 8a25ebee717a..3a36b8bbca33 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -64,7 +64,7 @@ struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
 static inline bool
 isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd)
 {
-   return (conn->conn_device->pi_capable &&
+   return (conn->pi_support &&
cmd->prot_op != TARGET_PROT_NORMAL);
 }
 
@@ -2322,8 +2322,16 @@ isert_get_sup_prot_ops(struct iscsi_conn *conn)
struct isert_conn *isert_conn = (struct isert_conn *)conn->context;
struct isert_device *device = isert_conn->conn_device;
 
-   if (device->pi_capable)
-   return TARGET_PROT_ALL;
+   if (conn->tpg->tpg_attrib.t10_pi) {
+   if (device->pi_capable) {
+   pr_info("conn %p PI offload enabled\n", isert_conn);
+   isert_conn->pi_support = true;
+   return TARGET_PROT_ALL;
+   }
+   }
+
+   pr_info("conn %p PI offload disabled\n", isert_conn);
+   isert_conn->pi_support = false;
 
return TARGET_PROT_NORMAL;
 }
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h 
b/drivers/infiniband/ulp/isert/ib_isert.h
index 2e7868c5ad14..141905f446dd 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -128,6 +128,7 @@ struct isert_conn {
atomic_tpost_send_buf_count;
u32 responder_resources;
u32 initiator_depth;
+   boolpi_support;
u32 max_sge;
char*login_buf;
char*login_req_buf;
diff --git a/drivers/target/iscsi/iscsi_target_login.c 
b/drivers/target/iscsi/iscsi_target_login.c
index e8d022d25146..dabc7e770b00 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -281,7 +281,6 @@ static int iscsi_login_zero_tsih_s1(
 {
struct iscsi_session *sess = NULL;
struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf;
-   enum target_prot_op sup_pro_ops;
int ret;
 
sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL);
@@ -343,9 +342,8 @@ static int iscsi_login_zero_tsih_s1(
kfree(sess);
return -ENOMEM;
}
-   sup_pro_ops = conn->conn_transport->iscsit_get_sup_prot_ops(conn);
 
-   sess->se_sess = transport_init_session(sup_pro_ops);
+   sess->se_sess = transport_init_session(TARGET_PROT_NORMAL);
if (IS_ERR(sess->se_sess)) {
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES);
@@ -1371,6 +1369,9 @@ static int __iscsi_target_login_thread(struct iscsi_np 
*np)
}
login->zero_tsih = zero_tsih;
 
+   conn->sess->se_sess->sup_prot_ops =
+   conn->conn_transport->iscsit_get_sup_prot_ops(conn);
+
tpg = conn->tpg;
if (!tpg) {
pr_err("Unable to locate struct iscsi_conn->tpg\n");
-- 
2.1.4

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


[PATCH 3.16.y-ckt 162/216] perf/x86/intel/uncore: Make sure only uncore events are collected

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jiri Olsa 

commit af91568e762d04931dcbdd6bef4655433d8b9418 upstream.

The uncore_collect_events functions assumes that event group
might contain only uncore events which is wrong, because it
might contain any type of events.

This bug leads to uncore framework touching 'not' uncore events,
which could end up all sorts of bugs.

One was triggered by Vince's perf fuzzer, when the uncore code
touched breakpoint event private event space as if it was uncore
event and caused BUG:

   BUG: unable to handle kernel paging request at 82822068
   IP: [] uncore_assign_events+0x188/0x250
   ...

The code in uncore_assign_events() function was looking for
event->hw.idx data while the event was initialized as a
breakpoint with different members in event->hw union.

This patch forces uncore_collect_events() to collect only uncore
events.

Reported-by: Vince Weaver 
Signed-off-by: Jiri Olsa 
Cc: Arnaldo Carvalho de Melo 
Cc: Frederic Weisbecker 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Yan, Zheng 
Link: 
http://lkml.kernel.org/r/1418243031-20367-2-git-send-email-jo...@kernel.org
Signed-off-by: Ingo Molnar 
Signed-off-by: Luis Henriques 
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index ae6552a0701f..a4c37cb40519 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3249,6 +3249,17 @@ static struct intel_uncore_box *uncore_alloc_box(struct 
intel_uncore_type *type,
return box;
 }
 
+/*
+ * Using uncore_pmu_event_init pmu event_init callback
+ * as a detection point for uncore events.
+ */
+static int uncore_pmu_event_init(struct perf_event *event);
+
+static bool is_uncore_event(struct perf_event *event)
+{
+   return event->pmu->event_init == uncore_pmu_event_init;
+}
+
 static int
 uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, 
bool dogrp)
 {
@@ -3263,13 +3274,18 @@ uncore_collect_events(struct intel_uncore_box *box, 
struct perf_event *leader, b
return -EINVAL;
 
n = box->n_events;
-   box->event_list[n] = leader;
-   n++;
+
+   if (is_uncore_event(leader)) {
+   box->event_list[n] = leader;
+   n++;
+   }
+
if (!dogrp)
return n;
 
list_for_each_entry(event, >sibling_list, group_entry) {
-   if (event->state <= PERF_EVENT_STATE_OFF)
+   if (!is_uncore_event(event) ||
+   event->state <= PERF_EVENT_STATE_OFF)
continue;
 
if (n >= max_count)
-- 
2.1.4

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


[PATCH 3.16.y-ckt 169/216] iser-target: Handle ADDR_CHANGE event for listener cm_id

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit ca6c1d82d12d8013fb75ce015900d62b9754623c upstream.

The np listener cm_id will also get ADDR_CHANGE event
upcall (in case it is bound to a specific IP). Handle
it correctly by creating a new cm_id and implicitly
destroy the old one.

Since this is the second event a listener np cm_id may
encounter, we move the np cm_id event handling to a
routine.

Squashed:

iser-target: Move cma_id setup to a function

Reported-by: Slava Shwartsman 
Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 107 +++-
 drivers/infiniband/ulp/isert/ib_isert.h |   1 +
 2 files changed, 77 insertions(+), 31 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index 22d877f96f47..6705d0266862 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -58,6 +58,7 @@ static int
 isert_rdma_post_recvl(struct isert_conn *isert_conn);
 static int
 isert_rdma_accept(struct isert_conn *isert_conn);
+struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
 
 static void
 isert_qp_event_callback(struct ib_event *e, void *context)
@@ -573,8 +574,8 @@ err:
 static int
 isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 {
-   struct iscsi_np *np = cma_id->context;
-   struct isert_np *isert_np = np->np_context;
+   struct isert_np *isert_np = cma_id->context;
+   struct iscsi_np *np = isert_np->np;
struct isert_conn *isert_conn;
struct isert_device *device;
struct ib_device *ib_dev = cma_id->device;
@@ -849,17 +850,41 @@ isert_conn_terminate(struct isert_conn *isert_conn)
 }
 
 static int
-isert_disconnected_handler(struct rdma_cm_id *cma_id)
+isert_np_cma_handler(struct isert_np *isert_np,
+enum rdma_cm_event_type event)
 {
-   struct iscsi_np *np = cma_id->context;
-   struct isert_np *isert_np = np->np_context;
-   struct isert_conn *isert_conn;
+   pr_debug("isert np %p, handling event %d\n", isert_np, event);
 
-   if (isert_np->np_cm_id == cma_id) {
+   switch (event) {
+   case RDMA_CM_EVENT_DEVICE_REMOVAL:
isert_np->np_cm_id = NULL;
-   return -1;
+   break;
+   case RDMA_CM_EVENT_ADDR_CHANGE:
+   isert_np->np_cm_id = isert_setup_id(isert_np);
+   if (IS_ERR(isert_np->np_cm_id)) {
+   pr_err("isert np %p setup id failed: %ld\n",
+isert_np, PTR_ERR(isert_np->np_cm_id));
+   isert_np->np_cm_id = NULL;
+   }
+   break;
+   default:
+   pr_err("isert np %p Unexpected event %d\n",
+ isert_np, event);
}
 
+   return -1;
+}
+
+static int
+isert_disconnected_handler(struct rdma_cm_id *cma_id,
+  enum rdma_cm_event_type event)
+{
+   struct isert_np *isert_np = cma_id->context;
+   struct isert_conn *isert_conn;
+
+   if (isert_np->np_cm_id == cma_id)
+   return isert_np_cma_handler(cma_id->context, event);
+
isert_conn = cma_id->qp->qp_context;
 
mutex_lock(_conn->conn_mutex);
@@ -902,7 +927,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
case RDMA_CM_EVENT_DISCONNECTED:   /* FALLTHRU */
case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
-   ret = isert_disconnected_handler(cma_id);
+   ret = isert_disconnected_handler(cma_id, event->event);
break;
case RDMA_CM_EVENT_REJECTED:   /* FALLTHRU */
case RDMA_CM_EVENT_UNREACHABLE:/* FALLTHRU */
@@ -3076,13 +3101,51 @@ isert_response_queue(struct iscsi_conn *conn, struct 
iscsi_cmd *cmd, int state)
return ret;
 }
 
+struct rdma_cm_id *
+isert_setup_id(struct isert_np *isert_np)
+{
+   struct iscsi_np *np = isert_np->np;
+   struct rdma_cm_id *id;
+   struct sockaddr *sa;
+   int ret;
+
+   sa = (struct sockaddr *)>np_sockaddr;
+   pr_debug("ksockaddr: %p, sa: %p\n", >np_sockaddr, sa);
+
+   id = rdma_create_id(isert_cma_handler, isert_np,
+   RDMA_PS_TCP, IB_QPT_RC);
+   if (IS_ERR(id)) {
+   pr_err("rdma_create_id() failed: %ld\n", PTR_ERR(id));
+   ret = PTR_ERR(id);
+   goto out;
+   }
+   pr_debug("id %p context %p\n", id, id->context);
+
+   ret = rdma_bind_addr(id, sa);
+   if (ret) {
+   pr_err("rdma_bind_addr() failed: %d\n", ret);
+   goto out_id;
+   }
+
+   ret = rdma_listen(id, ISERT_RDMA_LISTEN_BACKLOG);
+   if (ret) {
+

[PATCH 3.16.y-ckt 163/216] perf: Fix events installation during moving group

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jiri Olsa 

commit 9fc81d87420d0d3fd62d5e5529972c0ad9eab9cc upstream.

We allow PMU driver to change the cpu on which the event
should be installed to. This happened in patch:

  e2d37cd213dc ("perf: Allow the PMU driver to choose the CPU on which to 
install events")

This patch also forces all the group members to follow
the currently opened events cpu if the group happened
to be moved.

This and the change of event->cpu in perf_install_in_context()
function introduced in:

  0cda4c023132 ("perf: Introduce perf_pmu_migrate_context()")

forces group members to change their event->cpu,
if the currently-opened-event's PMU changed the cpu
and there is a group move.

Above behaviour causes problem for breakpoint events,
which uses event->cpu to touch cpu specific data for
breakpoints accounting. By changing event->cpu, some
breakpoints slots were wrongly accounted for given
cpu.

Vinces's perf fuzzer hit this issue and caused following
WARN on my setup:

   WARNING: CPU: 0 PID: 20214 at arch/x86/kernel/hw_breakpoint.c:119 
arch_install_hw_breakpoint+0x142/0x150()
   Can't find any breakpoint slot
   [...]

This patch changes the group moving code to keep the event's
original cpu.

Reported-by: Vince Weaver 
Signed-off-by: Jiri Olsa 
Cc: Arnaldo Carvalho de Melo 
Cc: Frederic Weisbecker 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Vince Weaver 
Cc: Yan, Zheng 
Link: 
http://lkml.kernel.org/r/1418243031-20367-3-git-send-email-jo...@kernel.org
Signed-off-by: Ingo Molnar 
Signed-off-by: Luis Henriques 
---
 kernel/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6bc75223aaa7..cfaeffaefc75 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7329,11 +7329,11 @@ SYSCALL_DEFINE5(perf_event_open,
 
if (move_group) {
synchronize_rcu();
-   perf_install_in_context(ctx, group_leader, event->cpu);
+   perf_install_in_context(ctx, group_leader, group_leader->cpu);
get_ctx(ctx);
list_for_each_entry(sibling, _leader->sibling_list,
group_entry) {
-   perf_install_in_context(ctx, sibling, event->cpu);
+   perf_install_in_context(ctx, sibling, sibling->cpu);
get_ctx(ctx);
}
}
-- 
2.1.4

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


[PATCH 3.16.y-ckt 158/216] Revert "[SCSI] mpt2sas: Remove phys on topology change."

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sreekanth Reddy 

commit 81a89c2d891b78695aa7e4cc0d5a7427785ae078 upstream.

This reverts commit 3520f9c779bed098ca76dd3fb6377264301d57ed
("mpt2sas: Remove phys on topology change")

Reverting the previous mpt2sas drives patch changes,
since we will observe below issue

Issue:
Drives connected Enclosure/Expander will unregister with
SCSI Transport Layer, if any one remove and add expander
cable with in DMD (Device Missing Delay) time period or
even any one power-off and power-on the Enclosure with in
the DMD period.

Signed-off-by: Sreekanth Reddy 
Reviewed-by: Tomas Henzl 
Signed-off-by: Christoph Hellwig 
Signed-off-by: Luis Henriques 
---
 drivers/scsi/mpt2sas/mpt2sas_transport.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c 
b/drivers/scsi/mpt2sas/mpt2sas_transport.c
index 410f4a3e..72f9c55d0e00 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_transport.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c
@@ -1006,12 +1006,9 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER 
*ioc,
_phy->remote_identify);
_transport_add_phy_to_an_existing_port(ioc, sas_node,
mpt2sas_phy, mpt2sas_phy->remote_identify.sas_address);
-   } else {
+   } else
memset(_phy->remote_identify, 0 , sizeof(struct
sas_identify));
-   _transport_del_phy_from_an_existing_port(ioc, sas_node,
-   mpt2sas_phy);
-   }
 
if (mpt2sas_phy->phy)
mpt2sas_phy->phy->negotiated_linkrate =
-- 
2.1.4

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


[PATCH 3.16.y-ckt 167/216] iser-target: Parallelize CM connection establishment

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 2371e5da8cfe91443339b5dec6254fdd6dfc upstream.

There is no point in accepting a new CM request only
when we are completely done with the last iscsi login.
Instead we accept immediately, this will also cause the
CM connection to reach connected state and the initiator
is allowed to send the first login. We mark that we got
the initial login and let iscsi layer pick it up when it
gets there.

This reduces the parallel login sequence by a factor of
more then 4 (and more for multi-login) and also prevents
the initiator (who does all logins in parallel) from
giving up on login timeout expiration.

In order to support multiple login requests sequence (CHAP)
we call isert_rx_login_req from isert_rx_completion insead
of letting isert_get_login_rx call it.

Squashed:

iser-target: Use kref_get_unless_zero in connected_handler
iser-target: Acquire conn_mutex when changing connection state
iser-target: Reject connect request in failure path

Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 84 +++--
 drivers/infiniband/ulp/isert/ib_isert.h |  2 +
 2 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index dfb811a05b04..e8e8ae256bac 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -54,6 +54,10 @@ isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd 
*cmd,
   struct isert_rdma_wr *wr);
 static int
 isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd);
+static int
+isert_rdma_post_recvl(struct isert_conn *isert_conn);
+static int
+isert_rdma_accept(struct isert_conn *isert_conn);
 
 static void
 isert_qp_event_callback(struct ib_event *e, void *context)
@@ -590,6 +594,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
isert_conn->state = ISER_CONN_INIT;
INIT_LIST_HEAD(_conn->conn_accept_node);
init_completion(_conn->conn_login_comp);
+   init_completion(_conn->login_req_comp);
init_completion(_conn->conn_wait);
init_completion(_conn->conn_wait_comp_err);
kref_init(_conn->conn_kref);
@@ -679,6 +684,14 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
if (ret)
goto out_conn_dev;
 
+   ret = isert_rdma_post_recvl(isert_conn);
+   if (ret)
+   goto out_conn_dev;
+
+   ret = isert_rdma_accept(isert_conn);
+   if (ret)
+   goto out_conn_dev;
+
mutex_lock(_np->np_accept_mutex);
list_add_tail(_conn->conn_accept_node, _np->np_accept_list);
mutex_unlock(_np->np_accept_mutex);
@@ -703,6 +716,7 @@ out_login_buf:
kfree(isert_conn->login_buf);
 out:
kfree(isert_conn);
+   rdma_reject(cma_id, NULL, 0);
return ret;
 }
 
@@ -756,8 +770,15 @@ isert_connected_handler(struct rdma_cm_id *cma_id)
 
pr_info("conn %p\n", isert_conn);
 
-   isert_conn->state = ISER_CONN_UP;
-   kref_get(_conn->conn_kref);
+   if (!kref_get_unless_zero(_conn->conn_kref)) {
+   pr_warn("conn %p connect_release is running\n", isert_conn);
+   return;
+   }
+
+   mutex_lock(_conn->conn_mutex);
+   if (isert_conn->state != ISER_CONN_FULL_FEATURE)
+   isert_conn->state = ISER_CONN_UP;
+   mutex_unlock(_conn->conn_mutex);
 }
 
 static void
@@ -1116,7 +1137,9 @@ isert_put_login_tx(struct iscsi_conn *conn, struct 
iscsi_login *login,
return ret;
 
/* Now we are in FULL_FEATURE phase */
+   mutex_lock(_conn->conn_mutex);
isert_conn->state = ISER_CONN_FULL_FEATURE;
+   mutex_unlock(_conn->conn_mutex);
goto post_send;
}
 
@@ -1133,18 +1156,17 @@ post_send:
 }
 
 static void
-isert_rx_login_req(struct iser_rx_desc *rx_desc, int rx_buflen,
-  struct isert_conn *isert_conn)
+isert_rx_login_req(struct isert_conn *isert_conn)
 {
+   struct iser_rx_desc *rx_desc = (void *)isert_conn->login_req_buf;
+   int rx_buflen = isert_conn->login_req_len;
struct iscsi_conn *conn = isert_conn->conn;
struct iscsi_login *login = conn->conn_login;
int size;
 
-   if (!login) {
-   pr_err("conn->conn_login is NULL\n");
-   dump_stack();
-   return;
-   }
+   pr_info("conn %p\n", isert_conn);
+
+   WARN_ON_ONCE(!login);
 
if (login->first_request) {
struct iscsi_login_req *login_req =
@@ -1507,11 +1529,20 @@ isert_rx_completion(struct iser_rx_desc *desc, struct 
isert_conn *isert_conn,

[PATCH 3.16.y-ckt 176/216] scsi: blacklist RSOC for Microsoft iSCSI target devices

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: "Martin K. Petersen" 

commit 198a956a11b15b564ac06d1411881e215b587408 upstream.

The Microsoft iSCSI target does not support REPORT SUPPORTED OPERATION
CODES. Blacklist these devices so we don't attempt to send the command.

Signed-off-by: Martin K. Petersen 
Tested-by: Mike Christie 
Reported-by: j...@deti74.ru
Signed-off-by: Christoph Hellwig 
Signed-off-by: Luis Henriques 
---
 drivers/scsi/scsi_devinfo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index c1d04d4d3c6c..262ab837a704 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -211,6 +211,7 @@ static struct {
{"Medion", "Flash XL  MMC/SD", "2.6D", BLIST_FORCELUN},
{"MegaRAID", "LD", NULL, BLIST_FORCELUN},
{"MICROP", "4110", NULL, BLIST_NOTQ},
+   {"MSFT", "Virtual HD", NULL, BLIST_NO_RSOC},
{"MYLEX", "DACARMRB", "*", BLIST_REPORTLUN2},
{"nCipher", "Fastness Crypto", NULL, BLIST_FORCELUN},
{"NAKAMICH", "MJ-4.8S", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
-- 
2.1.4

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


[PATCH 3.16.y-ckt 181/216] ALSA: hda/realtek - Add new Dell desktop for ALC3234 headset mode

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Kailang Yang 

commit 8b72415d8aa8bb1904c61926bd0701447ce44bee upstream.

New Dell desktop needs to support headset mode for ALC3234.

Signed-off-by: Kailang Yang 
Signed-off-by: Takashi Iwai 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fafabf28cba3..2cc27a08905b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4787,6 +4787,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1028, 0x063f, "Dell", 
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x064a, "Dell", 
ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x064b, "Dell", 
ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
+   SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", 
ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0668, "Dell", 
ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0669, "Dell", 
ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0684, "Dell", 
ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
-- 
2.1.4

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


[PATCH 3.16.y-ckt 178/216] iscsi-target: Fail connection on short sendmsg writes

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Nicholas Bellinger 

commit 6bf6ca7515c1df06f5c03737537f5e0eb191e29e upstream.

This patch changes iscsit_do_tx_data() to fail on short writes
when kernel_sendmsg() returns a value different than requested
transfer length, returning -EPIPE and thus causing a connection
reset to occur.

This avoids a potential bug in the original code where a short
write would result in kernel_sendmsg() being called again with
the original iovec base + length.

In practice this has not been an issue because iscsit_do_tx_data()
is only used for transferring 48 byte headers + 4 byte digests,
along with seldom used control payloads from NOPIN + TEXT_RSP +
REJECT with less than 32k of data.

So following Al's audit of iovec consumers, go ahead and fail
the connection on short writes for now, and remove the bogus
logic ahead of his proper upstream fix.

Reported-by: Al Viro 
Cc: David S. Miller 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/target/iscsi/iscsi_target_util.c | 26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_util.c 
b/drivers/target/iscsi/iscsi_target_util.c
index fd90b28f1d94..2e96ae6cf3c1 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1356,15 +1356,15 @@ static int iscsit_do_tx_data(
struct iscsi_conn *conn,
struct iscsi_data_count *count)
 {
-   int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len;
+   int ret, iov_len;
struct kvec *iov_p;
struct msghdr msg;
 
if (!conn || !conn->sock || !conn->conn_ops)
return -1;
 
-   if (data <= 0) {
-   pr_err("Data length is: %d\n", data);
+   if (count->data_length <= 0) {
+   pr_err("Data length is: %d\n", count->data_length);
return -1;
}
 
@@ -1373,20 +1373,16 @@ static int iscsit_do_tx_data(
iov_p = count->iov;
iov_len = count->iov_count;
 
-   while (total_tx < data) {
-   tx_loop = kernel_sendmsg(conn->sock, , iov_p, iov_len,
-   (data - total_tx));
-   if (tx_loop <= 0) {
-   pr_debug("tx_loop: %d total_tx %d\n",
-   tx_loop, total_tx);
-   return tx_loop;
-   }
-   total_tx += tx_loop;
-   pr_debug("tx_loop: %d, total_tx: %d, data: %d\n",
-   tx_loop, total_tx, data);
+   ret = kernel_sendmsg(conn->sock, , iov_p, iov_len,
+count->data_length);
+   if (ret != count->data_length) {
+   pr_err("Unexpected ret: %d send data %d\n",
+  ret, count->data_length);
+   return -EPIPE;
}
+   pr_debug("ret: %d, sent data: %d\n", ret, count->data_length);
 
-   return total_tx;
+   return ret;
 }
 
 int rx_data(
-- 
2.1.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] drm/i915: fix inconsistent brightness after resume

2015-01-12 Thread Jeremiah Mahler
Jani,

On Mon, Jan 12, 2015 at 12:31:09PM +0200, Jani Nikula wrote:
> On Sat, 10 Jan 2015, Jeremiah Mahler  wrote:
[...]
> 
> I think part of the problem is that the userspace sets brightness to
> minimum before suspend, but apparently does not restore it after
> resume. The dmesg would confirm this. But I guess it doesn't matter,
> since we're pretty much stuck with having to do this anyway.
> 

I did notice it doing this.  There were several calls to *_update_status
as it was entering suspend which set it to the minimum.

I am not familiar with the intricate details of this system but it seems
like there must be a way to fix this.  If the backlight can be powered
off and back on with the correct level it seems like it should be
possible when a suspend/resume is involved.

[...]
> > -   if (panel->backlight.level == 0) {
> > +   if (panel->backlight.level == panel->backlight.min) {
> 
> Perhaps <= instead of == would be safest?
> 
We could do that too in case that corner case ever arises.

[...]

I will fix it up in v2.

-- 
- Jeremiah Mahler
--
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.16.y-ckt 174/216] genirq: Prevent proc race against freeing of irq descriptors

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Thomas Gleixner 

commit c291ee622165cb2c8d4e7af63fffd499354a23be upstream.

Since the rework of the sparse interrupt code to actually free the
unused interrupt descriptors there exists a race between the /proc
interfaces to the irq subsystem and the code which frees the interrupt
descriptor.

CPU0CPU1
show_interrupts()
  desc = irq_to_desc(X);
free_desc(desc)
  remove_from_radix_tree();
  kfree(desc);
  raw_spinlock_irq(>lock);

/proc/interrupts is the only interface which can actively corrupt
kernel memory via the lock access. /proc/stat can only read from freed
memory. Extremly hard to trigger, but possible.

The interfaces in /proc/irq/N/ are not affected by this because the
removal of the proc file is serialized in procfs against concurrent
readers/writers. The removal happens before the descriptor is freed.

For architectures which have CONFIG_SPARSE_IRQ=n this is a non issue
as the descriptor is never freed. It's merely cleared out with the irq
descriptor lock held. So any concurrent proc access will either see
the old correct value or the cleared out ones.

Protect the lookup and access to the irq descriptor in
show_interrupts() with the sparse_irq_lock.

Provide kstat_irqs_usr() which is protecting the lookup and access
with sparse_irq_lock and switch /proc/stat to use it.

Document the existing kstat_irqs interfaces so it's clear that the
caller needs to take care about protection. The users of these
interfaces are either not affected due to SPARSE_IRQ=n or already
protected against removal.

Fixes: 1f5a5b87f78f "genirq: Implement a sane sparse_irq allocator"
Signed-off-by: Thomas Gleixner 
Signed-off-by: Luis Henriques 
---
 fs/proc/stat.c  |  2 +-
 include/linux/kernel_stat.h |  1 +
 kernel/irq/internals.h  |  4 
 kernel/irq/irqdesc.c| 52 +
 kernel/irq/proc.c   | 22 ++-
 5 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index bf2d03f8fd3e..510413eb25b8 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -159,7 +159,7 @@ static int show_stat(struct seq_file *p, void *v)
 
/* sum again ? it could be updated? */
for_each_irq_nr(j)
-   seq_put_decimal_ull(p, ' ', kstat_irqs(j));
+   seq_put_decimal_ull(p, ' ', kstat_irqs_usr(j));
 
seq_printf(p,
"\nctxt %llu\n"
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index ecbc52f9ff77..a6a8c409bbc3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -68,6 +68,7 @@ static inline unsigned int kstat_softirqs_cpu(unsigned int 
irq, int cpu)
  * Number of interrupts per specific IRQ source, since bootup
  */
 extern unsigned int kstat_irqs(unsigned int irq);
+extern unsigned int kstat_irqs_usr(unsigned int irq);
 
 /*
  * Number of interrupts per cpu, since bootup
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 099ea2e0eb88..08122140576f 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -78,8 +78,12 @@ extern void unmask_threaded_irq(struct irq_desc *desc);
 
 #ifdef CONFIG_SPARSE_IRQ
 static inline void irq_mark_irq(unsigned int irq) { }
+extern void irq_lock_sparse(void);
+extern void irq_unlock_sparse(void);
 #else
 extern void irq_mark_irq(unsigned int irq);
+static inline void irq_lock_sparse(void) { }
+static inline void irq_unlock_sparse(void) { }
 #endif
 
 extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 1487a123db5c..3922869d927a 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -131,6 +131,16 @@ static void free_masks(struct irq_desc *desc)
 static inline void free_masks(struct irq_desc *desc) { }
 #endif
 
+void irq_lock_sparse(void)
+{
+   mutex_lock(_irq_lock);
+}
+
+void irq_unlock_sparse(void)
+{
+   mutex_unlock(_irq_lock);
+}
+
 static struct irq_desc *alloc_desc(int irq, int node, struct module *owner)
 {
struct irq_desc *desc;
@@ -167,6 +177,12 @@ static void free_desc(unsigned int irq)
 
unregister_irq_proc(irq, desc);
 
+   /*
+* sparse_irq_lock protects also show_interrupts() and
+* kstat_irq_usr(). Once we deleted the descriptor from the
+* sparse tree we can free it. Access in proc will fail to
+* lookup the descriptor.
+*/
mutex_lock(_irq_lock);
delete_irq_desc(irq);
mutex_unlock(_irq_lock);
@@ -532,6 +548,15 @@ void kstat_incr_irq_this_cpu(unsigned int irq)
kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
 }
 
+/**
+ * kstat_irqs_cpu - Get the statistics for an interrupt on a cpu
+ * @irq:   The interrupt number
+ * 

[PATCH 3.16.y-ckt 177/216] storvsc: ring buffer failures may result in I/O freeze

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Long Li 

commit e86fb5e8ab95f10ec5f2e9430119d5d35020c951 upstream.

When ring buffer returns an error indicating retry, storvsc may not
return a proper error code to SCSI when bounce buffer is not used.
This has introduced I/O freeze on RAID running atop storvsc devices.
This patch fixes it by always returning a proper error code.

Signed-off-by: Long Li 
Reviewed-by: K. Y. Srinivasan 
Signed-off-by: Christoph Hellwig 
Signed-off-by: Luis Henriques 
---
 drivers/scsi/storvsc_drv.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index ed0f899e8aa5..86b05151fdab 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1690,13 +1690,12 @@ static int storvsc_queuecommand(struct Scsi_Host *host, 
struct scsi_cmnd *scmnd)
if (ret == -EAGAIN) {
/* no more space */
 
-   if (cmd_request->bounce_sgl_count) {
+   if (cmd_request->bounce_sgl_count)
destroy_bounce_buffer(cmd_request->bounce_sgl,
cmd_request->bounce_sgl_count);
 
-   ret = SCSI_MLQUEUE_DEVICE_BUSY;
-   goto queue_error;
-   }
+   ret = SCSI_MLQUEUE_DEVICE_BUSY;
+   goto queue_error;
}
 
return 0;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 168/216] iser-target: Fix connected_handler + teardown flow race

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 19e2090fb246ca21b3e569ead51a6a7a1748eadd upstream.

Take isert_conn pointer from cm_id->qp->qp_context. This
will allow us to know that the cm_id context is always
the network portal. This will make the cm_id event check
(connection or network portal) more reliable.

In order to avoid a NULL dereference in cma_id->qp->qp_context
we destroy the qp after we destroy the cm_id (and make the
dereference safe). session stablishment/teardown sequences
can happen in parallel, we should take into account that
connected_handler might race with connection teardown flow.

Also, protect isert_conn->conn_device->active_qps decrement
within the error patch during QP creation failure and the
normal teardown path in isert_connect_release().

Squashed:

iser-target: Decrement completion context active_qps in error flow

Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 31 +++
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index e8e8ae256bac..22d877f96f47 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -141,12 +141,18 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct 
rdma_cm_id *cma_id,
ret = rdma_create_qp(cma_id, isert_conn->conn_pd, );
if (ret) {
pr_err("rdma_create_qp failed for cma_id %d\n", ret);
-   return ret;
+   goto err;
}
isert_conn->conn_qp = cma_id->qp;
pr_debug("rdma_create_qp() returned success 
>.\n");
 
return 0;
+err:
+   mutex_lock(_list_mutex);
+   device->cq_active_qps[min_index]--;
+   mutex_unlock(_list_mutex);
+
+   return ret;
 }
 
 static void
@@ -602,7 +608,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
spin_lock_init(_conn->conn_lock);
INIT_LIST_HEAD(_conn->conn_fr_pool);
 
-   cma_id->context = isert_conn;
isert_conn->conn_cm_id = cma_id;
isert_conn->responder_resources = event->param.conn.responder_resources;
isert_conn->initiator_depth = event->param.conn.initiator_depth;
@@ -732,18 +737,20 @@ isert_connect_release(struct isert_conn *isert_conn)
if (device && device->use_fastreg)
isert_conn_free_fastreg_pool(isert_conn);
 
+   isert_free_rx_descriptors(isert_conn);
+   rdma_destroy_id(isert_conn->conn_cm_id);
+
if (isert_conn->conn_qp) {
cq_index = ((struct isert_cq_desc *)
isert_conn->conn_qp->recv_cq->cq_context)->cq_index;
pr_debug("isert_connect_release: cq_index: %d\n", cq_index);
+   mutex_lock(_list_mutex);
isert_conn->conn_device->cq_active_qps[cq_index]--;
+   mutex_unlock(_list_mutex);
 
-   rdma_destroy_qp(isert_conn->conn_cm_id);
+   ib_destroy_qp(isert_conn->conn_qp);
}
 
-   isert_free_rx_descriptors(isert_conn);
-   rdma_destroy_id(isert_conn->conn_cm_id);
-
ib_dereg_mr(isert_conn->conn_mr);
ib_dealloc_pd(isert_conn->conn_pd);
 
@@ -766,7 +773,7 @@ isert_connect_release(struct isert_conn *isert_conn)
 static void
 isert_connected_handler(struct rdma_cm_id *cma_id)
 {
-   struct isert_conn *isert_conn = cma_id->context;
+   struct isert_conn *isert_conn = cma_id->qp->qp_context;
 
pr_info("conn %p\n", isert_conn);
 
@@ -844,16 +851,16 @@ isert_conn_terminate(struct isert_conn *isert_conn)
 static int
 isert_disconnected_handler(struct rdma_cm_id *cma_id)
 {
+   struct iscsi_np *np = cma_id->context;
+   struct isert_np *isert_np = np->np_context;
struct isert_conn *isert_conn;
 
-   if (!cma_id->qp) {
-   struct isert_np *isert_np = cma_id->context;
-
+   if (isert_np->np_cm_id == cma_id) {
isert_np->np_cm_id = NULL;
return -1;
}
 
-   isert_conn = (struct isert_conn *)cma_id->context;
+   isert_conn = cma_id->qp->qp_context;
 
mutex_lock(_conn->conn_mutex);
isert_conn_terminate(isert_conn);
@@ -868,7 +875,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id)
 static void
 isert_connect_error(struct rdma_cm_id *cma_id)
 {
-   struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context;
+   struct isert_conn *isert_conn = cma_id->qp->qp_context;
 
isert_put_conn(isert_conn);
 }
-- 
2.1.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

[PATCH 3.16.y-ckt 166/216] iser-target: Fix flush + disconnect completion handling

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 128e9cc84566a84146baea2335b3824288eed817 upstream.

ISER_CONN_UP state is not sufficient to know if
we should wait for completion of flush errors and
disconnected_handler event.

Instead, split it to 2 states:
- ISER_CONN_UP: Got to CM connected phase, This state
indicates that we need to wait for a CM disconnect
event before going to teardown.

- ISER_CONN_FULL_FEATURE: Got to full feature phase
after we posted login response, This state indicates
that we posted recv buffers and we need to wait for
flush completions before going to teardown.

Also avoid deffering disconnected handler to a work,
and handle it within disconnected handler.
More work here is needed to handle DEVICE_REMOVAL event
correctly (cleanup all resources).

Squashed:

iser-target: Don't deffer disconnected handler to a work

Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c | 52 +++--
 drivers/infiniband/ulp/isert/ib_isert.h |  2 +-
 2 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index bf0c8b987ab8..dfb811a05b04 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -754,6 +754,9 @@ isert_connected_handler(struct rdma_cm_id *cma_id)
 {
struct isert_conn *isert_conn = cma_id->context;
 
+   pr_info("conn %p\n", isert_conn);
+
+   isert_conn->state = ISER_CONN_UP;
kref_get(_conn->conn_kref);
 }
 
@@ -780,8 +783,9 @@ isert_put_conn(struct isert_conn *isert_conn)
  * @isert_conn: isert connection struct
  *
  * Notes:
- * In case the connection state is UP, move state
+ * In case the connection state is FULL_FEATURE, move state
  * to TEMINATING and start teardown sequence (rdma_disconnect).
+ * In case the connection state is UP, complete flush as well.
  *
  * This routine must be called with conn_mutex held. Thus it is
  * safe to call multiple times.
@@ -791,32 +795,31 @@ isert_conn_terminate(struct isert_conn *isert_conn)
 {
int err;
 
-   if (isert_conn->state == ISER_CONN_UP) {
-   isert_conn->state = ISER_CONN_TERMINATING;
+   switch (isert_conn->state) {
+   case ISER_CONN_TERMINATING:
+   break;
+   case ISER_CONN_UP:
+   /*
+* No flush completions will occur as we didn't
+* get to ISER_CONN_FULL_FEATURE yet, complete
+* to allow teardown progress.
+*/
+   complete(_conn->conn_wait_comp_err);
+   case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
pr_info("Terminating conn %p state %d\n",
   isert_conn, isert_conn->state);
+   isert_conn->state = ISER_CONN_TERMINATING;
err = rdma_disconnect(isert_conn->conn_cm_id);
if (err)
pr_warn("Failed rdma_disconnect isert_conn %p\n",
   isert_conn);
+   break;
+   default:
+   pr_warn("conn %p teminating in state %d\n",
+  isert_conn, isert_conn->state);
}
 }
 
-static void
-isert_disconnect_work(struct work_struct *work)
-{
-   struct isert_conn *isert_conn = container_of(work,
-   struct isert_conn, conn_logout_work);
-
-   pr_debug("isert_disconnect_work(): 
>>\n");
-   mutex_lock(_conn->conn_mutex);
-   isert_conn_terminate(isert_conn);
-   mutex_unlock(_conn->conn_mutex);
-
-   pr_info("conn %p completing conn_wait\n", isert_conn);
-   complete(_conn->conn_wait);
-}
-
 static int
 isert_disconnected_handler(struct rdma_cm_id *cma_id)
 {
@@ -831,8 +834,12 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id)
 
isert_conn = (struct isert_conn *)cma_id->context;
 
-   INIT_WORK(_conn->conn_logout_work, isert_disconnect_work);
-   schedule_work(_conn->conn_logout_work);
+   mutex_lock(_conn->conn_mutex);
+   isert_conn_terminate(isert_conn);
+   mutex_unlock(_conn->conn_mutex);
+
+   pr_info("conn %p completing conn_wait\n", isert_conn);
+   complete(_conn->conn_wait);
 
return 0;
 }
@@ -1007,7 +1014,7 @@ isert_init_send_wr(struct isert_conn *isert_conn, struct 
isert_cmd *isert_cmd,
 * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls.
 */
mutex_lock(_conn->conn_mutex);
-   if (coalesce && isert_conn->state == ISER_CONN_UP &&
+   if (coalesce && isert_conn->state == ISER_CONN_FULL_FEATURE &&
++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) {
tx_desc->llnode_active = true;
llist_add(_desc->comp_llnode, 

Re: [PATCH v5] can: Convert to runtime_pm

2015-01-12 Thread Sören Brinkmann
On Mon, 2015-01-12 at 08:34PM +0530, Kedareswara rao Appana wrote:
> Instead of enabling/disabling clocks at several locations in the driver,
> Use the runtime_pm framework. This consolidates the actions for runtime PM
> In the appropriate callbacks and makes the driver more readable and 
> mantainable.
> 
> Signed-off-by: Soren Brinkmann 
> Signed-off-by: Kedareswara rao Appana 
> ---
> Changes for v5:
>  - Updated with the review comments.
>Updated the remove fuction to use runtime_pm.
> Chnages for v4:
>  - Updated with the review comments.
> Changes for v3:
>   - Converted the driver to use runtime_pm.
> Changes for v2:
>   - Removed the struct platform_device* from suspend/resume
> as suggest by Lothar.
> 
>  drivers/net/can/xilinx_can.c |  157 -
>  1 files changed, 107 insertions(+), 50 deletions(-)
[..]
> +static int __maybe_unused xcan_runtime_resume(struct device *dev)
>  {
> - struct platform_device *pdev = dev_get_drvdata(dev);
> - struct net_device *ndev = platform_get_drvdata(pdev);
> + struct net_device *ndev = dev_get_drvdata(dev);
>   struct xcan_priv *priv = netdev_priv(ndev);
>   int ret;
> + u32 isr, status;
>  
>   ret = clk_enable(priv->bus_clk);
>   if (ret) {
> @@ -1014,15 +1030,28 @@ static int __maybe_unused xcan_resume(struct device 
> *dev)
>   ret = clk_enable(priv->can_clk);
>   if (ret) {
>   dev_err(dev, "Cannot enable clock.\n");
> - clk_disable_unprepare(priv->bus_clk);
> + clk_disable(priv->bus_clk);
[...]
> @@ -1173,12 +1219,23 @@ static int xcan_remove(struct platform_device *pdev)
>  {
>   struct net_device *ndev = platform_get_drvdata(pdev);
>   struct xcan_priv *priv = netdev_priv(ndev);
> + int ret;
> +
> + ret = pm_runtime_get_sync(>dev);
> + if (ret < 0) {
> + netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
> + __func__, ret);
> + return ret;
> + }
>  
>   if (set_reset_mode(ndev) < 0)
>   netdev_err(ndev, "mode resetting failed!\n");
>  
>   unregister_candev(ndev);
> + pm_runtime_disable(>dev);
>   netif_napi_del(>napi);
> + clk_disable_unprepare(priv->bus_clk);
> + clk_disable_unprepare(priv->can_clk);

Shouldn't pretty much all these occurrences of clk_disable/enable
disappear? This should all be handled by the runtime_pm framework now.

Sören
--
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] platform-drivers-x86 for 3.19

2015-01-12 Thread Andrew Lutomirski
On Mon, Jan 12, 2015 at 10:38 AM, Darren Hart  wrote:
> On Mon, Jan 12, 2015 at 12:58:02AM +0200, Kirill A. Shutemov wrote:
>> On Thu, Dec 18, 2014 at 09:51:27AM -0800, Darren Hart wrote:
>> > thinkpad-acpi using software mute simplifies the driver and the user 
>> > experience
>> > significantly.
>>
>> Except when it doesn't.
>>
>> I'm probably in minority, but I don't use fancy userspace to mess with my
>> mixer and the mute button worked just fine for me before the change.
>> Wasted half an hour to find out what happened is not a pure win from user
>> experience point of view.
>>
>> Is it really necessary to have software_mute_requested == true by default?
>> Can fancy userspace ask for desired behaviour instead and change kernel to
>> not send hotkeys change notification until software_mute is enabled?
>>
>> --
>>  Kirill A. Shutemov
>>
>
> Thanks for the report Kirill,
>
> Andy, we're at RC4, so if we need to fix (or revert) this fix, we only have a
> couple weeks to do so.
>
> Kirill, to define the scope of the problem, if you specify
> software_mute_requested as false on the kernel command line, does your system
> function as expected?

If I understood Kirill's email correctly, the only issue is that he
liked the old behavior.  Kirill, is that correct?

--Andy

>
> Thanks,
>
> --
> 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/


[PATCH 7/7] ARM: at91: remove useless at91rm9200_set_type()

2015-01-12 Thread Alexandre Belloni
Since all rm9200 board files have been removed, there is no user of
at91rm9200_set_type() left. Remove it

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/generic.h |  1 -
 arch/arm/mach-at91/setup.c   | 11 ---
 2 files changed, 12 deletions(-)

diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index c10c2ddaae6d..54f3837a0a4d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -21,7 +21,6 @@ extern void __init at91_init_sram(int bank, unsigned long 
base,
  unsigned int length);
 
  /* Processors */
-extern void __init at91rm9200_set_type(int type);
 extern void __init at91_dt_initialize(void);
 
  /* Timer */
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index acb8d7724609..e3c21b458bb8 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -31,17 +31,6 @@ struct at91_init_soc __initdata at91_boot_soc;
 struct at91_socinfo at91_soc_initdata;
 EXPORT_SYMBOL(at91_soc_initdata);
 
-void __init at91rm9200_set_type(int type)
-{
-   if (type == ARCH_REVISON_9200_PQFP)
-   at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
-   else
-   at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
-
-   pr_info("filled in soc subtype: %s\n",
-   at91_get_soc_subtype(_soc_initdata));
-}
-
 void __iomem *at91_ramc_base[2];
 EXPORT_SYMBOL_GPL(at91_ramc_base);
 
-- 
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 3/7] ARM: at91: remove useless config MACH_AT91SAM9_DT

2015-01-12 Thread Alexandre Belloni
Now that at91sam9 SoCs are only supported through DT, remove
CONFIG_MACH_AT91SAM9_DT and use CONFIG_SOC_AT91SAM9 instead.

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/Kconfig  | 5 -
 arch/arm/mach-at91/Makefile | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 34725b296e4d..cec0fb5d621a 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -174,11 +174,6 @@ config SOC_AT91SAM9N12
 # --
 endif # SOC_SAM_V4_V5
 
-config MACH_AT91SAM9_DT
-   def_bool SOC_AT91SAM9
-
-# --
-
 comment "AT91 Feature Selections"
 
 config AT91_SLOW_CLOCK
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 55fc93f5638b..9165a4aa7f0d 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
 
 # AT91SAM board with device-tree
 obj-$(CONFIG_SOC_AT91RM9200) += board-dt-rm9200.o
-obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o
+obj-$(CONFIG_SOC_AT91SAM9) += board-dt-sam9.o
 
 # SAMA5 board with device-tree
 obj-$(CONFIG_SOC_SAMA5)+= board-dt-sama5.o
-- 
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 4/7] ARM: at91: remove useless at91_sysirq_mask_rtx

2015-01-12 Thread Alexandre Belloni
The irq fixup from at91_sysirq_mask_rtc and at91_sysirq_mask_rtt is now handled
by aic_common_rtc_irq_fixup and aic_common_rtt_irq_fixup. Remove those useless
functions.
Also remove the now unused mach/at91_rtt.h header.

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/Makefile|  2 +-
 arch/arm/mach-at91/at91sam9260.c   |  2 -
 arch/arm/mach-at91/at91sam9261.c   |  2 -
 arch/arm/mach-at91/at91sam9263.c   |  3 --
 arch/arm/mach-at91/at91sam9g45.c   |  3 --
 arch/arm/mach-at91/at91sam9n12.c   |  6 ---
 arch/arm/mach-at91/at91sam9rl.c|  3 --
 arch/arm/mach-at91/at91sam9x5.c| 10 
 arch/arm/mach-at91/generic.h   |  4 --
 arch/arm/mach-at91/include/mach/at91_rtt.h | 35 --
 arch/arm/mach-at91/sama5d3.c   |  6 ---
 arch/arm/mach-at91/sysirq_mask.c   | 75 --
 12 files changed, 1 insertion(+), 150 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/at91_rtt.h
 delete mode 100644 arch/arm/mach-at91/sysirq_mask.c

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 9165a4aa7f0d..8ef7d9a2e855 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y  := setup.o sysirq_mask.o
+obj-y  := setup.o
 
 obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
 
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 78137c24d90b..34e2abe82ae4 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -51,8 +51,6 @@ static void __init at91sam9260_map_io(void)
 static void __init at91sam9260_initialize(void)
 {
arm_pm_idle = at91sam9_idle;
-
-   at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT);
 }
 
 AT91_SOC_START(at91sam9260)
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index d29953ecb0c4..47878b849975 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -32,8 +32,6 @@ static void __init at91sam9261_map_io(void)
 static void __init at91sam9261_initialize(void)
 {
arm_pm_idle = at91sam9_idle;
-
-   at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT);
 }
 
 AT91_SOC_START(at91sam9261)
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index e7ad14864083..aabcb66145d0 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -29,9 +29,6 @@ static void __init at91sam9263_map_io(void)
 static void __init at91sam9263_initialize(void)
 {
arm_pm_idle = at91sam9_idle;
-
-   at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0);
-   at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1);
 }
 
 AT91_SOC_START(at91sam9263)
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index b6117bea9a6f..b044dbcc0dcc 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -29,9 +29,6 @@ static void __init at91sam9g45_map_io(void)
 static void __init at91sam9g45_initialize(void)
 {
arm_pm_idle = at91sam9_idle;
-
-   at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC);
-   at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT);
 }
 
 AT91_SOC_START(at91sam9g45)
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index dee569b1987e..0135f868ea4f 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -21,12 +21,6 @@ static void __init at91sam9n12_map_io(void)
at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE);
 }
 
-static void __init at91sam9n12_initialize(void)
-{
-   at91_sysirq_mask_rtc(AT91SAM9N12_BASE_RTC);
-}
-
 AT91_SOC_START(at91sam9n12)
.map_io = at91sam9n12_map_io,
-   .init = at91sam9n12_initialize,
 AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index f25b9aec9c50..7d303c132032 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -42,9 +42,6 @@ static void __init at91sam9rl_map_io(void)
 static void __init at91sam9rl_initialize(void)
 {
arm_pm_idle = at91sam9_idle;
-
-   at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC);
-   at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT);
 }
 
 AT91_SOC_START(at91sam9rl)
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index f0d5a69a7237..aa17520ccb0a 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -21,16 +21,6 @@ static void __init at91sam9x5_map_io(void)
at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
 }
 
-static void __init at91sam9x5_initialize(void)
-{
-   at91_sysirq_mask_rtc(AT91SAM9X5_BASE_RTC);
-}
-
-/* 
- *  Interrupt initialization
- *  */
-
 

Re: [PATCH 3/5] PCI: st: Provide support for the sti PCIe controller

2015-01-12 Thread Bjorn Helgaas
On Wed, Dec 17, 2014 at 11:34:44AM +0100, Gabriel FERNANDEZ wrote:
> sti pcie is built around a Synopsis Designware PCIe IP.
> 
> Signed-off-by: Fabrice Gasnier 
> Signed-off-by: Gabriel Fernandez 
> ---
>  drivers/pci/host/Kconfig  |   5 +
>  drivers/pci/host/Makefile |   1 +
>  drivers/pci/host/pci-st.c | 713 
> ++

Hi Gabriel,

Can you add a MAINTAINERS update so I know who should ack changes to this
driver?

>  3 files changed, 719 insertions(+)
>  create mode 100644 drivers/pci/host/pci-st.c
> 
> diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
> index c4b6568..999d2b9 100644
> --- a/drivers/pci/host/Kconfig
> +++ b/drivers/pci/host/Kconfig
> @@ -102,4 +102,9 @@ config PCI_LAYERSCAPE
>   help
> Say Y here if you want PCIe controller support on Layerscape SoCs.
>  
> +config PCI_ST
> + bool "ST STiH41x PCIe controller"
> + depends on ARCH_STI
> + select PCIE_DW

Please add help text here.

> +static int st_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
> +  unsigned int devfn, int where, int size,
> +  u32 *val)
> +{
> + u32 data;
> + u32 bdf;
> + struct st_pcie *pcie = to_st_pcie(pp);
> + int is_root_bus = pci_is_root_bus(bus);
> + int retry_count = 0;
> + int ret;
> + void __iomem *addr;
> +
> + /*
> +  * Prerequisite
> +  * PCI express devices will respond to all config type 0 cycles, since
> +  * they are point to point links. Thus to avoid probing for multiple
> +  * devices on the root, dw-pcie already check for us if it is on the
> +  * root bus / other slots. Also, dw-pcie checks for the link being up
> +  * as we will hang if we issue a config request and the link is down.
> +  * A switch will reject requests for slots it knows do not exist.
> +  */
> + bdf = bdf_num(bus->number, devfn, is_root_bus);
> + addr = pcie->config_area + config_addr(where,
> + bus->parent->number == pp->root_bus_nr);
> +retry:
> + /* Set the config packet devfn */
> + writel_relaxed(bdf, pp->dbi_base + FUNC0_BDF_NUM);
> + readl_relaxed(pp->dbi_base + FUNC0_BDF_NUM);
> +
> + ret = dw_pcie_cfg_read(addr, where, size, );
> +
> + /*
> +  * This is intended to help with when we are probing the bus. The
> +  * problem is that the wrapper logic doesn't have any way to
> +  * interrogate if the configuration request failed or not.
> +  * On the ARM we actually get a real bus error.
> +  *
> +  * Unfortunately this means it is impossible to tell the difference
> +  * between when a device doesn't exist (the switch will return a UR
> +  * completion) or the device does exist but isn't yet ready to accept
> +  * configuration requests (the device will return a CRS completion)

We do have CRS support in the Linux PCI core, so I guess this comment means
that the ST host bridge doesn't handle CRS correctly?

> +  *
> +  * The result of this is that we will miss devices when probing.
> +  *
> +  * So if we are trying to read the dev/vendor id on devfn 0 and we
> +  * appear to get zero back, then we retry the request.  We know that
> +  * zero can never be a valid device/vendor id. The specification says
> +  * we must retry for up to a second before we decide the device is
> +  * dead. If we are still dead then we assume there is nothing there and
> +  * return ~0
> +  *
> +  * The downside of this is that we incur a delay of 1s for every pci
> +  * express link that doesn't have a device connected.

That sounds pretty bad and I assume is a consequence of CRS handling being
broken in hardware.

> +  */
> + if (((where & ~3) == 0) && devfn == 0 && (data == 0 || data == ~0)) {
> + if (retry_count++ < 1000) {
> + mdelay(1);
> + goto retry;
> + } else {
> + *val = ~0;
> + return PCIBIOS_DEVICE_NOT_FOUND;
> + }
> + }
> +
> + *val = data;
> + return ret;
> +}

> +MODULE_LICENSE("GPLv2");

See license_is_gpl_compatible().  This string needs to be "GPL v2", not
"GPLv2" to avoid tainting the kernel.

Bjorn
--
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.16.y-ckt 182/216] dm thin: fix inability to discard blocks when in out-of-data-space mode

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Joe Thornber 

commit 45ec9bd0fd7abf8705e7cf12205ff69fe9d51181 upstream.

When the pool was in PM_OUT_OF_SPACE mode its process_prepared_discard
function pointer was incorrectly being set to
process_prepared_discard_passdown rather than process_prepared_discard.

This incorrect function pointer meant the discard was being passed down,
but not effecting the mapping.  As such any discard that was issued, in
an attempt to reclaim blocks, would not successfully free data space.

Reported-by: Eric Sandeen 
Signed-off-by: Joe Thornber 
Signed-off-by: Mike Snitzer 
Signed-off-by: Luis Henriques 
---
 drivers/md/dm-thin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 6f75083a81cc..c13efb1020d9 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -1759,7 +1759,7 @@ static void set_pool_mode(struct pool *pool, enum 
pool_mode new_mode)
pool->process_bio = process_bio_read_only;
pool->process_discard = process_discard;
pool->process_prepared_mapping = process_prepared_mapping;
-   pool->process_prepared_discard = 
process_prepared_discard_passdown;
+   pool->process_prepared_discard = process_prepared_discard;
 
if (!pool->pf.error_if_no_space && no_space_timeout)
queue_delayed_work(pool->wq, >no_space_timeout, 
no_space_timeout);
-- 
2.1.4

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


[PATCH 2/7] ARM: at91: remove useless config MACH_AT91RM9200_DT

2015-01-12 Thread Alexandre Belloni
Now that rm9200 is only supported through DT, remove CONFIG_MACH_AT91RM9200_DT
and use CONFIG_SOC_AT91RM9200 instead.

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/Kconfig  | 3 ---
 arch/arm/mach-at91/Makefile | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 2395c68b3e32..34725b296e4d 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -174,9 +174,6 @@ config SOC_AT91SAM9N12
 # --
 endif # SOC_SAM_V4_V5
 
-config MACH_AT91RM9200_DT
-   def_bool SOC_AT91RM9200
-
 config MACH_AT91SAM9_DT
def_bool SOC_AT91SAM9
 
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 7b6424d40764..55fc93f5638b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
 obj-$(CONFIG_SOC_SAMA5D4)  += sama5d4.o
 
 # AT91SAM board with device-tree
-obj-$(CONFIG_MACH_AT91RM9200_DT) += board-dt-rm9200.o
+obj-$(CONFIG_SOC_AT91RM9200) += board-dt-rm9200.o
 obj-$(CONFIG_MACH_AT91SAM9_DT) += board-dt-sam9.o
 
 # SAMA5 board with device-tree
-- 
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 0/7] AT91 cleanup for 3.20 #1

2015-01-12 Thread Alexandre Belloni
Hi,

This patch set cleans a lot of remaining header, config options and functions
that are not used anymore since the switch to DT only.

Patch 5 is moving mach/debug-macro.S to include/debug/at91.S to prepare the
upcoming switch to multiplatform.


Alexandre Belloni (7):
  ARM: at91: remove unused mach/memory.h
  ARM: at91: remove useless config MACH_AT91RM9200_DT
  ARM: at91: remove useless config MACH_AT91SAM9_DT
  ARM: at91: remove useless at91_sysirq_mask_rtx
  ARM: at91: move debug-macro.S into the common space
  ARM: at91: remove useless at91rm9200_dt_initialize()
  ARM: at91: remove useless at91rm9200_set_type()

 MAINTAINERS|  1 +
 arch/arm/Kconfig.debug |  9 ++-
 .../mach/debug-macro.S => include/debug/at91.S}| 19 +++---
 arch/arm/mach-at91/Kconfig |  8 ---
 arch/arm/mach-at91/Makefile|  6 +-
 arch/arm/mach-at91/at91sam9260.c   |  2 -
 arch/arm/mach-at91/at91sam9261.c   |  2 -
 arch/arm/mach-at91/at91sam9263.c   |  3 -
 arch/arm/mach-at91/at91sam9g45.c   |  3 -
 arch/arm/mach-at91/at91sam9n12.c   |  6 --
 arch/arm/mach-at91/at91sam9rl.c|  3 -
 arch/arm/mach-at91/at91sam9x5.c| 10 ---
 arch/arm/mach-at91/board-dt-rm9200.c   |  2 +-
 arch/arm/mach-at91/generic.h   |  6 --
 arch/arm/mach-at91/include/mach/at91_rtt.h | 35 --
 arch/arm/mach-at91/include/mach/memory.h   | 26 
 arch/arm/mach-at91/sama5d3.c   |  6 --
 arch/arm/mach-at91/setup.c | 18 --
 arch/arm/mach-at91/sysirq_mask.c   | 75 --
 19 files changed, 23 insertions(+), 217 deletions(-)
 rename arch/arm/{mach-at91/include/mach/debug-macro.S => include/debug/at91.S} 
(68%)
 delete mode 100644 arch/arm/mach-at91/include/mach/at91_rtt.h
 delete mode 100644 arch/arm/mach-at91/include/mach/memory.h
 delete mode 100644 arch/arm/mach-at91/sysirq_mask.c

-- 
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 5/7] ARM: at91: move debug-macro.S into the common space

2015-01-12 Thread Alexandre Belloni
Move debug-macro.S from include/mach/ to include/debug where all other common
debug macros are.

Signed-off-by: Alexandre Belloni 
---
 MAINTAINERS   |  1 +
 arch/arm/Kconfig.debug|  9 +++--
 .../mach/debug-macro.S => include/debug/at91.S}   | 19 +++
 3 files changed, 19 insertions(+), 10 deletions(-)
 rename arch/arm/{mach-at91/include/mach/debug-macro.S => include/debug/at91.S} 
(68%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3589d67437f8..8c25979a3c43 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -877,6 +877,7 @@ F:  arch/arm/boot/dts/at91*.dts
 F: arch/arm/boot/dts/at91*.dtsi
 F: arch/arm/boot/dts/sama*.dts
 F: arch/arm/boot/dts/sama*.dtsi
+F: arch/arm/include/debug/at91.S
 
 ARM/ATMEL AT91 Clock Support
 M: Boris Brezillon 
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 5ddd4906f7a7..e34d24949c6a 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -115,15 +115,18 @@ choice
0x80024000  | 0xf0024000 | UART9
 
config AT91_DEBUG_LL_DBGU0
-   bool "Kernel low-level debugging on rm9200, 9260/9g20, 
9261/9g10 and 9rl"
+   bool "Kernel low-level debugging on rm9200, 9260/9g20, 
9261/9g10, 9rl, 9x5, 9n12"
+   select DEBUG_AT91_UART
depends on HAVE_AT91_DBGU0
 
config AT91_DEBUG_LL_DBGU1
-   bool "Kernel low-level debugging on 9263 and 9g45"
+   bool "Kernel low-level debugging on 9263, 9g45 and sama5d3"
+   select DEBUG_AT91_UART
depends on HAVE_AT91_DBGU1
 
config AT91_DEBUG_LL_DBGU2
bool "Kernel low-level debugging on sama5d4"
+   select DEBUG_AT91_UART
depends on HAVE_AT91_DBGU2
 
config DEBUG_BCM2835
@@ -1165,6 +1168,8 @@ config DEBUG_LL_INCLUDE
string
default "debug/sa1100.S" if DEBUG_SA1100
default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
+   default "debug/at91.S" if AT91_DEBUG_LL_DBGU0 || AT91_DEBUG_LL_DBGU1 || 
\
+   AT91_DEBUG_LL_DBGU2
default "debug/asm9260.S" if DEBUG_ASM9260_UART
default "debug/clps711x.S" if DEBUG_CLPS711X_UART1 || 
DEBUG_CLPS711X_UART2
default "debug/meson.S" if DEBUG_MESON_UARTAO
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S 
b/arch/arm/include/debug/at91.S
similarity index 68%
rename from arch/arm/mach-at91/include/mach/debug-macro.S
rename to arch/arm/include/debug/at91.S
index 2103a90f2261..80a6501b4d50 100644
--- a/arch/arm/mach-at91/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/at91.S
@@ -1,6 +1,4 @@
 /*
- * arch/arm/mach-at91/include/mach/debug-macro.S
- *
  *  Copyright (C) 2003-2005 SAN People
  *
  * Debugging macro include header
@@ -11,18 +9,23 @@
  *
 */
 
-#include 
-#include 
-
 #if defined(CONFIG_AT91_DEBUG_LL_DBGU0)
-#define AT91_DBGU AT91_BASE_DBGU0
+#define AT91_DBGU 0xf200 /* AT91_BASE_DBGU0 */
 #elif defined(CONFIG_AT91_DEBUG_LL_DBGU1)
-#define AT91_DBGU AT91_BASE_DBGU1
+#define AT91_DBGU 0xee00 /* AT91_BASE_DBGU1 */
 #else
 /* On sama5d4, use USART3 as low level serial console */
-#define AT91_DBGU SAMA5D4_BASE_USART3
+#define AT91_DBGU 0xfc00c000 /* SAMA5D4_BASE_USART3 */
 #endif
 
+/* Keep in sync with mach-at91/include/mach/hardware.h */
+#define AT91_IO_P2V(x) ((x) - 0x0100)
+
+#define AT91_DBGU_SR   (0x14)  /* Status Register */
+#define AT91_DBGU_THR  (0x1c)  /* Transmitter Holding Register */
+#define AT91_DBGU_TXRDY(1 << 1)/* Transmitter Ready */
+#define AT91_DBGU_TXEMPTY  (1 << 9)/* Transmitter Empty */
+
.macro  addruart, rp, rv, tmp
ldr \rp, =AT91_DBGU @ System peripherals 
(phys address)
ldr \rv, =AT91_IO_P2V(AT91_DBGU)@ System peripherals 
(virt address)
-- 
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 6/7] ARM: at91: remove useless at91rm9200_dt_initialize()

2015-01-12 Thread Alexandre Belloni
at91rm9200_dt_initialize() is doing the same as at91_dit_initialize(), use that
one instead.

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/board-dt-rm9200.c | 2 +-
 arch/arm/mach-at91/generic.h | 1 -
 arch/arm/mach-at91/setup.c   | 7 ---
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/mach-at91/board-dt-rm9200.c 
b/arch/arm/mach-at91/board-dt-rm9200.c
index 76dfe8f9af50..a15ab6f8de00 100644
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ b/arch/arm/mach-at91/board-dt-rm9200.c
@@ -38,6 +38,6 @@ static const char *at91rm9200_dt_board_compat[] __initdata = {
 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
.init_time  = at91rm9200_dt_timer_init,
.map_io = at91_map_io,
-   .init_early = at91rm9200_dt_initialize,
+   .init_early = at91_dt_initialize,
.dt_compat  = at91rm9200_dt_board_compat,
 MACHINE_END
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index e0368aa06390..c10c2ddaae6d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -22,7 +22,6 @@ extern void __init at91_init_sram(int bank, unsigned long 
base,
 
  /* Processors */
 extern void __init at91rm9200_set_type(int type);
-extern void __init at91rm9200_dt_initialize(void);
 extern void __init at91_dt_initialize(void);
 
  /* Timer */
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index ce25e85720fb..acb8d7724609 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -429,13 +429,6 @@ static void at91_dt_ramc(void)
at91_pm_set_standby(standby);
 }
 
-void __init at91rm9200_dt_initialize(void)
-{
-   at91_dt_ramc();
-
-   at91_boot_soc.init();
-}
-
 void __init at91_dt_initialize(void)
 {
at91_dt_ramc();
-- 
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 1/7] ARM: at91: remove unused mach/memory.h

2015-01-12 Thread Alexandre Belloni
CONFIG_NEED_MACH_MEMORY_H is not set by any at91 platform, remove mach/memory.h

Signed-off-by: Alexandre Belloni 
---
 arch/arm/mach-at91/include/mach/memory.h | 26 --
 1 file changed, 26 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/memory.h

diff --git a/arch/arm/mach-at91/include/mach/memory.h 
b/arch/arm/mach-at91/include/mach/memory.h
deleted file mode 100644
index 401c207f2f39..
--- a/arch/arm/mach-at91/include/mach/memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/memory.h
- *
- *  Copyright (C) 2004 SAN People
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __ASM_ARCH_MEMORY_H
-#define __ASM_ARCH_MEMORY_H
-
-#include 
-
-#endif
-- 
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 3.16.y-ckt 179/216] drm/i915: Invalidate media caches on gen7

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Chris Wilson 

commit 148b83d0815a3778c8949e6a97cb798cbaa0efb3 upstream.

In the gen7 pipe control there is an extra bit to flush the media
caches, so let's set it during cache invalidation flushes.

v2: Rename to MEDIA_STATE_CLEAR to be more inline with spec.

Cc: Simon Farnsworth 
Cc: Ville Syrjälä 
Cc: Daniel Vetter 
Signed-off-by: Chris Wilson 
Reviewed-by: Daniel Vetter 
Signed-off-by: Jani Nikula 
Signed-off-by: Luis Henriques 
---
 drivers/gpu/drm/i915/i915_reg.h | 1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 6b9626567cfa..4fcff20cab98 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -352,6 +352,7 @@
 #define   PIPE_CONTROL_STORE_DATA_INDEX(1<<21)
 #define   PIPE_CONTROL_CS_STALL(1<<20)
 #define   PIPE_CONTROL_TLB_INVALIDATE  (1<<18)
+#define   PIPE_CONTROL_MEDIA_STATE_CLEAR   (1<<16)
 #define   PIPE_CONTROL_QW_WRITE(1<<14)
 #define   PIPE_CONTROL_POST_SYNC_OP_MASK(3<<14)
 #define   PIPE_CONTROL_DEPTH_STALL (1<<13)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 7add7eead21d..e831be6bcbae 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -352,6 +352,7 @@ gen7_render_ring_flush(struct intel_engine_cs *ring,
flags |= PIPE_CONTROL_VF_CACHE_INVALIDATE;
flags |= PIPE_CONTROL_CONST_CACHE_INVALIDATE;
flags |= PIPE_CONTROL_STATE_CACHE_INVALIDATE;
+   flags |= PIPE_CONTROL_MEDIA_STATE_CLEAR;
/*
 * TLB invalidate requires a post-sync write.
 */
-- 
2.1.4

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


[PATCH 3.16.y-ckt 183/216] dm thin: fix missing out-of-data-space to write mode transition if blocks are released

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Joe Thornber 

commit 2c43fd26e46734430122b8d2ad3024bb532df3ef upstream.

Discard bios and thin device deletion have the potential to release data
blocks.  If the thin-pool is in out-of-data-space mode, and blocks were
released, transition the thin-pool back to full write mode.

The correct time to do this is just after the thin-pool metadata commit.
It cannot be done before the commit because the space maps will not
allow immediate reuse of the data blocks in case there's a rollback
following power failure.

Signed-off-by: Joe Thornber 
Signed-off-by: Mike Snitzer 
Signed-off-by: Luis Henriques 
---
 drivers/md/dm-thin.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index c13efb1020d9..408ffba7ec63 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -936,6 +936,24 @@ static void schedule_zero(struct thin_c *tc, dm_block_t 
virt_block,
}
 }
 
+static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
+
+static void check_for_space(struct pool *pool)
+{
+   int r;
+   dm_block_t nr_free;
+
+   if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE)
+   return;
+
+   r = dm_pool_get_free_block_count(pool->pmd, _free);
+   if (r)
+   return;
+
+   if (nr_free)
+   set_pool_mode(pool, PM_WRITE);
+}
+
 /*
  * A non-zero return indicates read_only or fail_io mode.
  * Many callers don't care about the return value.
@@ -950,6 +968,8 @@ static int commit(struct pool *pool)
r = dm_pool_commit_metadata(pool->pmd);
if (r)
metadata_operation_failed(pool, "dm_pool_commit_metadata", r);
+   else
+   check_for_space(pool);
 
return r;
 }
@@ -968,8 +988,6 @@ static void check_low_water_mark(struct pool *pool, 
dm_block_t free_blocks)
}
 }
 
-static void set_pool_mode(struct pool *pool, enum pool_mode new_mode);
-
 static int alloc_data_block(struct thin_c *tc, dm_block_t *result)
 {
int r;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 186/216] i2c: mv64xxx: rework offload support to fix several problems

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Thomas Petazzoni 

commit 00d8689b85a7bb37cc57ba4c40bd46325f51ced4 upstream.

Originally, the I2C controller supported by the i2c-mv64xxx driver
requires a lot of software support: an interrupt is generated at each
step of an I2C transaction (after the start bit, after sending the
address, etc.) and the driver is in charge of re-programming the I2C
controller to do the next step of the I2C transaction. This explains
the fairly complex state machine that the driver has.

On Marvell Armada XP and later processors (Armada 375, 38x, etc.), the
I2C controller was extended with a part called the "I2C Bridge", which
allows to offload the I2C transaction completely to the
hardware. Initial support for this mechanism was added in commit
930ab3d403a ("i2c: mv64xxx: Add I2C Transaction Generator support").

However, the implementation done in this commit has two related
issues, which this commit fixes by completely changing how the offload
implementation is done:

 * SMBus read transfers, where there is one write to select the
   register immediately followed in the same transaction by one read,
   were making the processor hang. This was easier visible on the
   Marvell Armada XP WRT1900AC platform using a driver for an I2C LED
   controller, or on other Armada XP platforms by using a simple
   'i2cget' command to read an I2C EEPROM.

 * The implementation was based on the fact that the offload engine
   was re-programmed to transfer each message of an I2C xfer: this
   meant that each message sent with the offload engine was starting
   with a normal I2C start sequence. However, the I2C subsystem
   assumes that all messages belonging to the same xfer will use the
   so-called "repeated start" so that the entire I2C xfer is seen as
   one transfer by the I2C devices and cannot be interrupt by other
   I2C masters on the same bus.

In fact, the "I2C Bridge" allows to offload three types of xfer:

 - xfer of one write message
 - xfer of one read message
 - xfer of one write message followed by one read message

For all other situations, we have to fallback to not using the "I2C
Bridge" in order to get proper I2C semantics.

Therefore, this commit reworks the offload implementation to put it
not at the message level, but at the xfer level: in the
mv64xxx_i2c_xfer() function, we decide if the transaction can be
offloaded (in which case it is handled by the
mv64xxx_i2c_offload_xfer() function), or otherwise it is handled by
the slow path (implemented in the existing mv64xxx_i2c_execute_msg()).

This allows to simplify the state machine, which no longer needs to
have any state related to the offload implementation: the offload
implementation is now completely separated from the slow path (with
the exception of the interrupt handler, of course).

In summary:

 - mv64xxx_i2c_can_offload() will analyze an I2C xfer and decided of
   the "I2C Bridge" can be used to offload it or not.

 - mv64xxx_i2c_offload_xfer() will actually program the "I2C Bridge"
   to offload one xfer (of either one or two messages), and block
   using mv64xxx_i2c_wait_for_completion() until the xfer completes.

 - The interrupt handler mv64xxx_i2c_intr() is modified to push the
   offload related code to a separate function,
   mv64xxx_i2c_intr_offload(). It will take care of reading the
   received data if needed.

This commit was tested on:

 - Armada XP OpenBlocks AX3-4 (EEPROM on I2C and RTC on I2C)
 - Armada XP WRT1900AC (LED controller on I2C)
 - Armada XP GP (EEPROM on I2C)

Fixes: 930ab3d403ae ("i2c: mv64xxx: Add I2C Transaction Generator support")
Signed-off-by: Thomas Petazzoni 
[wsa: fixed checkpatch warnings]
Signed-off-by: Wolfram Sang 
Signed-off-by: Luis Henriques 
---
 drivers/i2c/busses/i2c-mv64xxx.c | 306 ---
 1 file changed, 186 insertions(+), 120 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index d9ecab9652b7..1de570e61305 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -75,12 +75,10 @@
 #defineMV64XXX_I2C_BRIDGE_CONTROL_TX_SIZE_SHIFT13
 #defineMV64XXX_I2C_BRIDGE_CONTROL_RX_SIZE_SHIFT16
 #defineMV64XXX_I2C_BRIDGE_CONTROL_ENABLE   BIT(19)
+#defineMV64XXX_I2C_BRIDGE_CONTROL_REPEATED_START   BIT(20)
 
 /* Bridge Status values */
 #defineMV64XXX_I2C_BRIDGE_STATUS_ERROR BIT(0)
-#defineMV64XXX_I2C_STATUS_OFFLOAD_ERROR0xf001
-#defineMV64XXX_I2C_STATUS_OFFLOAD_OK   0xf000
-
 
 /* Driver states */
 enum {
@@ -99,14 +97,12 @@ enum {
MV64XXX_I2C_ACTION_INVALID,
MV64XXX_I2C_ACTION_CONTINUE,
MV64XXX_I2C_ACTION_SEND_RESTART,
-   MV64XXX_I2C_ACTION_OFFLOAD_RESTART,
MV64XXX_I2C_ACTION_SEND_ADDR_1,

[PATCH 3.16.y-ckt 184/216] dm: fix missed error code if .end_io isn't implemented by target_type

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: zhendong chen 

commit 5164bece1673cdf04782f8ed3fba70743700f5da upstream.

In bio-based DM's clone_endio(), when target_type doesn't implement
.end_io (e.g. linear) r will be always be initialized 0.  So if a
WRITE SAME bio fails WRITE SAME will not be disabled as intended.

Fix this by initializing r to error, rather than 0, in clone_endio().

Signed-off-by: Alex Chen 
Signed-off-by: Mike Snitzer 
Fixes: 7eee4ae2db ("dm: disable WRITE SAME if it fails")
Signed-off-by: Luis Henriques 
---
 drivers/md/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 32b958dbc499..00a6cff2fffd 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -776,7 +776,7 @@ static void disable_write_same(struct mapped_device *md)
 
 static void clone_endio(struct bio *bio, int error)
 {
-   int r = 0;
+   int r = error;
struct dm_target_io *tio = container_of(bio, struct dm_target_io, 
clone);
struct dm_io *io = tio->io;
struct mapped_device *md = tio->io->md;
-- 
2.1.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: [GIT PULL] platform-drivers-x86 for 3.19

2015-01-12 Thread Darren Hart
On Mon, Jan 12, 2015 at 12:58:02AM +0200, Kirill A. Shutemov wrote:
> On Thu, Dec 18, 2014 at 09:51:27AM -0800, Darren Hart wrote:
> > thinkpad-acpi using software mute simplifies the driver and the user 
> > experience
> > significantly.
> 
> Except when it doesn't.
> 
> I'm probably in minority, but I don't use fancy userspace to mess with my
> mixer and the mute button worked just fine for me before the change.
> Wasted half an hour to find out what happened is not a pure win from user
> experience point of view.
> 
> Is it really necessary to have software_mute_requested == true by default?
> Can fancy userspace ask for desired behaviour instead and change kernel to
> not send hotkeys change notification until software_mute is enabled?
> 
> -- 
>  Kirill A. Shutemov
> 

Thanks for the report Kirill,

Andy, we're at RC4, so if we need to fix (or revert) this fix, we only have a
couple weeks to do so.

Kirill, to define the scope of the problem, if you specify
software_mute_requested as false on the kernel command line, does your system
function as expected?

Thanks,

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


[PATCH 3.16.y-ckt 196/216] audit: restore AUDIT_LOGINUID unset ABI

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Richard Guy Briggs 

commit 041d7b98ffe59c59fdd639931dea7d74f9aa9a59 upstream.

A regression was caused by commit 780a7654cee8:
 audit: Make testing for a valid loginuid explicit.
(which in turn attempted to fix a regression caused by e1760bd)

When audit_krule_to_data() fills in the rules to get a listing, there was a
missing clause to convert back from AUDIT_LOGINUID_SET to AUDIT_LOGINUID.

This broke userspace by not returning the same information that was sent and
expected.

The rule:
auditctl -a exit,never -F auid=-1
gives:
auditctl -l
LIST_RULES: exit,never f24=0 syscall=all
when it should give:
LIST_RULES: exit,never auid=-1 (0x) syscall=all

Tag it so that it is reported the same way it was set.  Create a new
private flags audit_krule field (pflags) to store it that won't interact with
the public one from the API.

Signed-off-by: Richard Guy Briggs 
Signed-off-by: Paul Moore 
Signed-off-by: Luis Henriques 
---
 include/linux/audit.h |  4 
 kernel/auditfilter.c  | 10 ++
 2 files changed, 14 insertions(+)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22cfddb75566..1e4676e7bf63 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -47,6 +47,7 @@ struct sk_buff;
 
 struct audit_krule {
int vers_ops;
+   u32 pflags;
u32 flags;
u32 listnr;
u32 action;
@@ -64,6 +65,9 @@ struct audit_krule {
u64 prio;
 };
 
+/* Flag to indicate legacy AUDIT_LOGINUID unset usage */
+#define AUDIT_LOGINUID_LEGACY  0x1
+
 struct audit_field {
u32 type;
u32 val;
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index b2e63ba5f815..58200abb8d63 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -431,6 +431,7 @@ static struct audit_entry *audit_data_to_entry(struct 
audit_rule_data *data,
if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) 
{
f->type = AUDIT_LOGINUID_SET;
f->val = 0;
+   entry->rule.pflags |= AUDIT_LOGINUID_LEGACY;
}
 
err = audit_field_valid(entry, f);
@@ -606,6 +607,13 @@ static struct audit_rule_data *audit_krule_to_data(struct 
audit_krule *krule)
data->buflen += data->values[i] =
audit_pack_string(, krule->filterkey);
break;
+   case AUDIT_LOGINUID_SET:
+   if (krule->pflags & AUDIT_LOGINUID_LEGACY && !f->val) {
+   data->fields[i] = AUDIT_LOGINUID;
+   data->values[i] = AUDIT_UID_UNSET;
+   break;
+   }
+   /* fallthrough if set */
default:
data->values[i] = f->val;
}
@@ -622,6 +630,7 @@ static int audit_compare_rule(struct audit_krule *a, struct 
audit_krule *b)
int i;
 
if (a->flags != b->flags ||
+   a->pflags != b->pflags ||
a->listnr != b->listnr ||
a->action != b->action ||
a->field_count != b->field_count)
@@ -740,6 +749,7 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old)
new = >rule;
new->vers_ops = old->vers_ops;
new->flags = old->flags;
+   new->pflags = old->pflags;
new->listnr = old->listnr;
new->action = old->action;
for (i = 0; i < AUDIT_BITMASK_SIZE; i++)
-- 
2.1.4

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


[PATCH 3.16.y-ckt 187/216] x86/tls: Don't validate lm in set_thread_area() after all

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Andy Lutomirski 

commit 3fb2f4237bb452eb4e98f6a5dbd5a445b4fed9d0 upstream.

It turns out that there's a lurking ABI issue.  GCC, when
compiling this in a 32-bit program:

struct user_desc desc = {
.entry_number= idx,
.base_addr   = base,
.limit   = 0xf,
.seg_32bit   = 1,
.contents= 0, /* Data, grow-up */
.read_exec_only  = 0,
.limit_in_pages  = 1,
.seg_not_present = 0,
.useable = 0,
};

will leave .lm uninitialized.  This means that anything in the
kernel that reads user_desc.lm for 32-bit tasks is unreliable.

Revert the .lm check in set_thread_area().  The value never did
anything in the first place.

Fixes: 0e58af4e1d21 ("x86/tls: Disallow unusual TLS segments")
Signed-off-by: Andy Lutomirski 
Acked-by: Thomas Gleixner 
Cc: Linus Torvalds 
Link: 
http://lkml.kernel.org/r/d7875b60e28c512f6a6fc0baf5714d58e7eaadbb.1418856405.git.l...@amacapital.net
Signed-off-by: Ingo Molnar 
Signed-off-by: Luis Henriques 
---
 arch/x86/include/uapi/asm/ldt.h | 7 +++
 arch/x86/kernel/tls.c   | 6 --
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/uapi/asm/ldt.h b/arch/x86/include/uapi/asm/ldt.h
index 46727eb37bfe..6e1aaf73852a 100644
--- a/arch/x86/include/uapi/asm/ldt.h
+++ b/arch/x86/include/uapi/asm/ldt.h
@@ -28,6 +28,13 @@ struct user_desc {
unsigned int  seg_not_present:1;
unsigned int  useable:1;
 #ifdef __x86_64__
+   /*
+* Because this bit is not present in 32-bit user code, user
+* programs can pass uninitialized values here.  Therefore, in
+* any context in which a user_desc comes from a 32-bit program,
+* the kernel must act as though lm == 0, regardless of the
+* actual value.
+*/
unsigned int  lm:1;
 #endif
 };
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 3e551eee87b9..4e942f31b1a7 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -55,12 +55,6 @@ static bool tls_desc_okay(const struct user_desc *info)
if (info->seg_not_present)
return false;
 
-#ifdef CONFIG_X86_64
-   /* The L bit makes no sense for data. */
-   if (info->lm)
-   return false;
-#endif
-
return true;
 }
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 175/216] powerpc/powernv: Switch off MMU before entering nap/sleep/rvwinkle mode

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Paul Mackerras 

commit 8117ac6a6c2fa0f847ff6a21a1f32c8d2c8501d0 upstream.

Currently, when going idle, we set the flag indicating that we are in
nap mode (paca->kvm_hstate.hwthread_state) and then execute the nap
(or sleep or rvwinkle) instruction, all with the MMU on.  This is bad
for two reasons: (a) the architecture specifies that those instructions
must be executed with the MMU off, and in fact with only the SF, HV, ME
and possibly RI bits set, and (b) this introduces a race, because as
soon as we set the flag, another thread can switch the MMU to a guest
context.  If the race is lost, this thread will typically start looping
on relocation-on ISIs at 0xc...4400.

This fixes it by setting the MSR as required by the architecture before
setting the flag or executing the nap/sleep/rvwinkle instruction.

[ shre...@linux.vnet.ibm.com: Edited to handle LE ]
Signed-off-by: Paul Mackerras 
Signed-off-by: Shreyas B. Prabhu 
Cc: Benjamin Herrenschmidt 
Cc: Michael Ellerman 
Cc: linuxppc-...@lists.ozlabs.org
Signed-off-by: Michael Ellerman 
Signed-off-by: Luis Henriques 
---
 arch/powerpc/include/asm/reg.h|  2 ++
 arch/powerpc/kernel/idle_power7.S | 18 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index bffd89d27301..e73cdadab785 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -118,8 +118,10 @@
 #define __MSR  (MSR_ME | MSR_RI | MSR_IR | MSR_DR | MSR_ISF |MSR_HV)
 #ifdef __BIG_ENDIAN__
 #define MSR_   __MSR
+#define MSR_IDLE   (MSR_ME | MSR_SF | MSR_HV)
 #else
 #define MSR_   (__MSR | MSR_LE)
+#define MSR_IDLE   (MSR_ME | MSR_SF | MSR_HV | MSR_LE)
 #endif
 #define MSR_KERNEL (MSR_ | MSR_64BIT)
 #define MSR_USER32 (MSR_ | MSR_PR | MSR_EE)
diff --git a/arch/powerpc/kernel/idle_power7.S 
b/arch/powerpc/kernel/idle_power7.S
index 5cf3d367190d..a29f5b0f9d3e 100644
--- a/arch/powerpc/kernel/idle_power7.S
+++ b/arch/powerpc/kernel/idle_power7.S
@@ -101,7 +101,23 @@ _GLOBAL(power7_powersave_common)
std r9,_MSR(r1)
std r1,PACAR1(r13)
 
-_GLOBAL(power7_enter_nap_mode)
+   /*
+* Go to real mode to do the nap, as required by the architecture.
+* Also, we need to be in real mode before setting hwthread_state,
+* because as soon as we do that, another thread can switch
+* the MMU context to the guest.
+*/
+   LOAD_REG_IMMEDIATE(r5, MSR_IDLE)
+   li  r6, MSR_RI
+   andcr6, r9, r6
+   LOAD_REG_ADDR(r7, power7_enter_nap_mode)
+   mtmsrd  r6, 1   /* clear RI before setting SRR0/1 */
+   mtspr   SPRN_SRR0, r7
+   mtspr   SPRN_SRR1, r5
+   rfid
+
+   .globl  power7_enter_nap_mode
+power7_enter_nap_mode:
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
/* Tell KVM we're napping */
li  r4,KVM_HWTHREAD_IN_NAP
-- 
2.1.4

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


[PATCH 3.16.y-ckt 190/216] audit: don't attempt to lookup PIDs when changing PID filtering audit rules

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Paul Moore 

commit 3640dcfa4fd00cd91d88bb86250bdb496f7070c0 upstream.

Commit f1dc4867 ("audit: anchor all pid references in the initial pid
namespace") introduced a find_vpid() call when adding/removing audit
rules with PID/PPID filters; unfortunately this is problematic as
find_vpid() only works if there is a task with the associated PID
alive on the system.  The following commands demonstrate a simple
reproducer.

# auditctl -D
# auditctl -l
# autrace /bin/true
# auditctl -l

This patch resolves the problem by simply using the PID provided by
the user without any additional validation, e.g. no calls to check to
see if the task/PID exists.

Cc: Richard Guy Briggs 
Signed-off-by: Paul Moore 
Acked-by: Eric Paris 
Reviewed-by: Richard Guy Briggs 
Signed-off-by: Luis Henriques 
---
 kernel/auditfilter.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 8e9bc9c3dbb7..b2e63ba5f815 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -433,19 +433,6 @@ static struct audit_entry *audit_data_to_entry(struct 
audit_rule_data *data,
f->val = 0;
}
 
-   if ((f->type == AUDIT_PID) || (f->type == AUDIT_PPID)) {
-   struct pid *pid;
-   rcu_read_lock();
-   pid = find_vpid(f->val);
-   if (!pid) {
-   rcu_read_unlock();
-   err = -ESRCH;
-   goto exit_free;
-   }
-   f->val = pid_nr(pid);
-   rcu_read_unlock();
-   }
-
err = audit_field_valid(entry, f);
if (err)
goto exit_free;
-- 
2.1.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 1/2] ARM: entry-common: fix forgotten set of thread_info->syscall

2015-01-12 Thread Will Deacon
On Sun, Jan 11, 2015 at 02:32:30PM +, Roman Pen wrote:
> thread_info->syscall is used only for ptrace, but syscall number
> is also used by syscall_get_nr and returned to userspace by the
> following proc file access:
> 
>  $ cat /proc/self/syscall
>  0 0x3 0xbe928bd8 0x1000 0x0 0xac9e0 0x3 0xbe928bb4 0xb6f5dfbc
>  ^
> The first number is the syscall number, currently it is zero.
> Patch fixes this:
> 
>  $ cat /proc/self/syscall
>  3 0x3 0xbefc7bd8 0x1000 0x0 0xac9e0 0x3 0xbefc7bb4 0xb6e82fbc
>  ^
> Right, read syscall

Yes, it seems that despite requiring CONFIG_HAVE_ARCH_TRACEHOOK,
the /proc code requires syscall_get_nr to work regardless of
TIF_SYSCALL_TRACE.

> Signed-off-by: Roman Pen 
> Cc: Russell King 
> Cc: Marc Zyngier 
> Cc: Catalin Marinas 
> Cc: Christoffer Dall 
> Cc: Stefano Stabellini 
> Cc: Sekhar Nori 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: sta...@vger.kernel.org
> ---
>  arch/arm/kernel/asm-offsets.c  | 1 +
>  arch/arm/kernel/entry-common.S | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
> index 2d2d608..6911bad 100644
> --- a/arch/arm/kernel/asm-offsets.c
> +++ b/arch/arm/kernel/asm-offsets.c
> @@ -70,6 +70,7 @@ int main(void)
>DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
>DEFINE(TI_CPU_DOMAIN,  offsetof(struct thread_info, 
> cpu_domain));
>DEFINE(TI_CPU_SAVE,offsetof(struct thread_info, 
> cpu_context));
> +  DEFINE(TI_SYSCALL, offsetof(struct thread_info, syscall));
>DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp));
>DEFINE(TI_TP_VALUE,offsetof(struct thread_info, tp_value));
>DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate));
> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> index f8ccc21..89452ff 100644
> --- a/arch/arm/kernel/entry-common.S
> +++ b/arch/arm/kernel/entry-common.S
> @@ -189,6 +189,7 @@ ENTRY(vector_swi)
>  #endif
>  
>  local_restart:
> + str scno, [tsk, #TI_SYSCALL]@ set syscall number
>   ldr r10, [tsk, #TI_FLAGS]   @ check for syscall tracing
>   stmdb   sp!, {r4, r5}   @ push fifth and sixth args

Do we definitely want to update scno on syscall restarting?

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


[PATCH 3.16.y-ckt 188/216] ALSA: usb-audio: extend KEF X300A FU 10 tweak to Arcam rPAC

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jiri Jaburek 

commit d70a1b9893f820fdbcdffac408c909c50f2e6b43 upstream.

The Arcam rPAC seems to have the same problem - whenever anything
(alsamixer, udevd, 3.9+ kernel from 60af3d037eb8c, ..) attempts to
access mixer / control interface of the card, the firmware "locks up"
the entire device, resulting in
  SNDRV_PCM_IOCTL_HW_PARAMS failed (-5): Input/output error
from alsa-lib.

Other operating systems can somehow read the mixer (there seems to be
playback volume/mute), but any manipulation is ignored by the device
(which has hardware volume controls).

Signed-off-by: Jiri Jaburek 
Signed-off-by: Takashi Iwai 
Signed-off-by: Luis Henriques 
---
 sound/usb/mixer_maps.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index d1d72ff50347..621bc9ebb55e 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -328,8 +328,11 @@ static struct usbmix_name_map gamecom780_map[] = {
{}
 };
 
-static const struct usbmix_name_map kef_x300a_map[] = {
-   { 10, NULL }, /* firmware locks up (?) when we try to access this FU */
+/* some (all?) SCMS USB3318 devices are affected by a firmware lock up
+ * when anything attempts to access FU 10 (control)
+ */
+static const struct usbmix_name_map scms_usb3318_map[] = {
+   { 10, NULL },
{ 0 }
 };
 
@@ -425,8 +428,14 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
.map = ebox44_map,
},
{
+   /* KEF X300A */
.id = USB_ID(0x27ac, 0x1000),
-   .map = kef_x300a_map,
+   .map = scms_usb3318_map,
+   },
+   {
+   /* Arcam rPAC */
+   .id = USB_ID(0x25c4, 0x0003),
+   .map = scms_usb3318_map,
},
{ 0 } /* terminator */
 };
-- 
2.1.4

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


[PATCH 3.16.y-ckt 165/216] iscsi,iser-target: Initiate termination only once

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sagi Grimberg 

commit 954f23722b5753305be490330cf2680b7a25f4a3 upstream.

Since commit 0fc4ea701fcf ("Target/iser: Don't put isert_conn inside
disconnected handler") we put the conn kref in isert_wait_conn, so we
need .wait_conn to be invoked also in the error path.

Introduce call to isert_conn_terminate (called under lock)
which transitions the connection state to TERMINATING and calls
rdma_disconnect. If the state is already teminating, just bail
out back (temination started).

Also, make sure to destroy the connection when getting a connect
error event if didn't get to connected (state UP). Same for the
handling of REJECTED and UNREACHABLE cma events.

Squashed:

iscsi-target: Add call to wait_conn in establishment error flow

Reported-by: Slava Shwartsman 
Signed-off-by: Sagi Grimberg 
Signed-off-by: Nicholas Bellinger 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 drivers/infiniband/ulp/isert/ib_isert.c   | 84 +++
 drivers/infiniband/ulp/isert/ib_isert.h   |  1 -
 drivers/target/iscsi/iscsi_target_login.c |  3 ++
 3 files changed, 54 insertions(+), 34 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c 
b/drivers/infiniband/ulp/isert/ib_isert.c
index c83b77e4546f..bf0c8b987ab8 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -775,6 +775,33 @@ isert_put_conn(struct isert_conn *isert_conn)
kref_put(_conn->conn_kref, isert_release_conn_kref);
 }
 
+/**
+ * isert_conn_terminate() - Initiate connection termination
+ * @isert_conn: isert connection struct
+ *
+ * Notes:
+ * In case the connection state is UP, move state
+ * to TEMINATING and start teardown sequence (rdma_disconnect).
+ *
+ * This routine must be called with conn_mutex held. Thus it is
+ * safe to call multiple times.
+ */
+static void
+isert_conn_terminate(struct isert_conn *isert_conn)
+{
+   int err;
+
+   if (isert_conn->state == ISER_CONN_UP) {
+   isert_conn->state = ISER_CONN_TERMINATING;
+   pr_info("Terminating conn %p state %d\n",
+  isert_conn, isert_conn->state);
+   err = rdma_disconnect(isert_conn->conn_cm_id);
+   if (err)
+   pr_warn("Failed rdma_disconnect isert_conn %p\n",
+  isert_conn);
+   }
+}
+
 static void
 isert_disconnect_work(struct work_struct *work)
 {
@@ -783,33 +810,15 @@ isert_disconnect_work(struct work_struct *work)
 
pr_debug("isert_disconnect_work(): 
>>\n");
mutex_lock(_conn->conn_mutex);
-   if (isert_conn->state == ISER_CONN_UP)
-   isert_conn->state = ISER_CONN_TERMINATING;
-
-   if (isert_conn->post_recv_buf_count == 0 &&
-   atomic_read(_conn->post_send_buf_count) == 0) {
-   mutex_unlock(_conn->conn_mutex);
-   goto wake_up;
-   }
-   if (!isert_conn->conn_cm_id) {
-   mutex_unlock(_conn->conn_mutex);
-   isert_put_conn(isert_conn);
-   return;
-   }
-
-   if (isert_conn->disconnect) {
-   /* Send DREQ/DREP towards our initiator */
-   rdma_disconnect(isert_conn->conn_cm_id);
-   }
-
+   isert_conn_terminate(isert_conn);
mutex_unlock(_conn->conn_mutex);
 
-wake_up:
+   pr_info("conn %p completing conn_wait\n", isert_conn);
complete(_conn->conn_wait);
 }
 
 static int
-isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
+isert_disconnected_handler(struct rdma_cm_id *cma_id)
 {
struct isert_conn *isert_conn;
 
@@ -822,18 +831,24 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, 
bool disconnect)
 
isert_conn = (struct isert_conn *)cma_id->context;
 
-   isert_conn->disconnect = disconnect;
INIT_WORK(_conn->conn_logout_work, isert_disconnect_work);
schedule_work(_conn->conn_logout_work);
 
return 0;
 }
 
+static void
+isert_connect_error(struct rdma_cm_id *cma_id)
+{
+   struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context;
+
+   isert_put_conn(isert_conn);
+}
+
 static int
 isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 {
int ret = 0;
-   bool disconnect = false;
 
pr_debug("isert_cma_handler: event %d status %d conn %p id %p\n",
 event->event, event->status, cma_id->context, cma_id);
@@ -851,11 +866,14 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct 
rdma_cm_event *event)
case RDMA_CM_EVENT_ADDR_CHANGE:/* FALLTHRU */
case RDMA_CM_EVENT_DISCONNECTED:   /* FALLTHRU */
case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
-   disconnect = true;
case RDMA_CM_EVENT_TIMEWAIT_EXIT:  /* FALLTHRU */
-   

[PATCH 3.16.y-ckt 185/216] i2c: mv64xxx: use BIT() macro for register value definitions

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Thomas Petazzoni 

commit 12598695c26ff8fccea92bd36ee3617a6da9b0d0 upstream.

Signed-off-by: Thomas Petazzoni 
Signed-off-by: Wolfram Sang 
Signed-off-by: Luis Henriques 
---
 drivers/i2c/busses/i2c-mv64xxx.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index e21e206d94e7..d9ecab9652b7 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -30,12 +30,12 @@
 #define MV64XXX_I2C_BAUD_DIV_N(val)(val & 0x7)
 #define MV64XXX_I2C_BAUD_DIV_M(val)((val & 0xf) << 3)
 
-#defineMV64XXX_I2C_REG_CONTROL_ACK 0x0004
-#defineMV64XXX_I2C_REG_CONTROL_IFLG0x0008
-#defineMV64XXX_I2C_REG_CONTROL_STOP0x0010
-#defineMV64XXX_I2C_REG_CONTROL_START   0x0020
-#defineMV64XXX_I2C_REG_CONTROL_TWSIEN  0x0040
-#defineMV64XXX_I2C_REG_CONTROL_INTEN   0x0080
+#defineMV64XXX_I2C_REG_CONTROL_ACK BIT(2)
+#defineMV64XXX_I2C_REG_CONTROL_IFLGBIT(3)
+#defineMV64XXX_I2C_REG_CONTROL_STOPBIT(4)
+#defineMV64XXX_I2C_REG_CONTROL_START   BIT(5)
+#defineMV64XXX_I2C_REG_CONTROL_TWSIEN  BIT(6)
+#defineMV64XXX_I2C_REG_CONTROL_INTEN   BIT(7)
 
 /* Ctlr status values */
 #defineMV64XXX_I2C_STATUS_BUS_ERR  0x00
@@ -68,16 +68,16 @@
 #defineMV64XXX_I2C_REG_BRIDGE_TIMING   0xe0
 
 /* Bridge Control values */
-#defineMV64XXX_I2C_BRIDGE_CONTROL_WR   0x0001
-#defineMV64XXX_I2C_BRIDGE_CONTROL_RD   0x0002
+#defineMV64XXX_I2C_BRIDGE_CONTROL_WR   BIT(0)
+#defineMV64XXX_I2C_BRIDGE_CONTROL_RD   BIT(1)
 #defineMV64XXX_I2C_BRIDGE_CONTROL_ADDR_SHIFT   2
-#defineMV64XXX_I2C_BRIDGE_CONTROL_ADDR_EXT 0x1000
+#defineMV64XXX_I2C_BRIDGE_CONTROL_ADDR_EXT BIT(12)
 #defineMV64XXX_I2C_BRIDGE_CONTROL_TX_SIZE_SHIFT13
 #defineMV64XXX_I2C_BRIDGE_CONTROL_RX_SIZE_SHIFT16
-#defineMV64XXX_I2C_BRIDGE_CONTROL_ENABLE   0x0008
+#defineMV64XXX_I2C_BRIDGE_CONTROL_ENABLE   BIT(19)
 
 /* Bridge Status values */
-#defineMV64XXX_I2C_BRIDGE_STATUS_ERROR 0x0001
+#defineMV64XXX_I2C_BRIDGE_STATUS_ERROR BIT(0)
 #defineMV64XXX_I2C_STATUS_OFFLOAD_ERROR0xf001
 #defineMV64XXX_I2C_STATUS_OFFLOAD_OK   0xf000
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 180/216] drm/i915: Force the CS stall for invalidate flushes

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Chris Wilson 

commit add284a3a2481e759d6bec35f6444c32c8ddc383 upstream.

In order to act as a full command barrier by itself, we need to tell the
pipecontrol to actually stall the command streamer while the flush runs.
We require the full command barrier before operations like
MI_SET_CONTEXT, which currently rely on a prior invalidate flush.

References: https://bugs.freedesktop.org/show_bug.cgi?id=83677
Cc: Simon Farnsworth 
Cc: Daniel Vetter 
Cc: Ville Syrjälä 
Signed-off-by: Chris Wilson 
Signed-off-by: Jani Nikula 
Signed-off-by: Luis Henriques 
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index e831be6bcbae..db8e92f27289 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -359,6 +359,8 @@ gen7_render_ring_flush(struct intel_engine_cs *ring,
flags |= PIPE_CONTROL_QW_WRITE;
flags |= PIPE_CONTROL_GLOBAL_GTT_IVB;
 
+   flags |= PIPE_CONTROL_STALL_AT_SCOREBOARD;
+
/* Workaround: we must issue a pipe_control with CS-stall bit
 * set before a pipe_control command that has the state cache
 * invalidate bit set. */
-- 
2.1.4

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


[PATCH 3.16.y-ckt 191/216] audit: use supplied gfp_mask from audit_buffer in kauditd_send_multicast_skb

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Richard Guy Briggs 

commit 54dc77d974a50147d6639dac6f59cb2c29207161 upstream.

Eric Paris explains: Since kauditd_send_multicast_skb() gets called in
audit_log_end(), which can come from any context (aka even a sleeping context)
GFP_KERNEL can't be used.  Since the audit_buffer knows what context it should
use, pass that down and use that.

See: https://lkml.org/lkml/2014/12/16/542

BUG: sleeping function called from invalid context at mm/slab.c:2849
in_atomic(): 1, irqs_disabled(): 0, pid: 885, name: sulogin
2 locks held by sulogin/885:
  #0:  (>cred_guard_mutex){+.+.+.}, at: [] 
prepare_bprm_creds+0x28/0x8b
  #1:  (tty_files_lock){+.+.+.}, at: [] 
selinux_bprm_committing_creds+0x55/0x22b
CPU: 1 PID: 885 Comm: sulogin Not tainted 3.18.0-next-20141216 #30
Hardware name: Dell Inc. Latitude E6530/07Y85M, BIOS A15 06/20/2014
  880223744f10 88022410f9b8 916ba529 0375
  880223744f10 88022410f9e8 91063185 0006
     88022410fa38
Call Trace:
  [] dump_stack+0x50/0xa8
  [] ___might_sleep+0x1b6/0x1be
  [] __might_sleep+0x119/0x128
  [] cache_alloc_debugcheck_before.isra.45+0x1d/0x1f
  [] kmem_cache_alloc+0x43/0x1c9
  [] __alloc_skb+0x42/0x1a3
  [] skb_copy+0x3e/0xa3
  [] audit_log_end+0x83/0x100
  [] ? avc_audit_pre_callback+0x103/0x103
  [] common_lsm_audit+0x441/0x450
  [] slow_avc_audit+0x63/0x67
  [] avc_has_perm+0xca/0xe3
  [] inode_has_perm+0x5a/0x65
  [] selinux_bprm_committing_creds+0x98/0x22b
  [] security_bprm_committing_creds+0xe/0x10
  [] install_exec_creds+0xe/0x79
  [] load_elf_binary+0xe36/0x10d7
  [] search_binary_handler+0x81/0x18c
  [] do_execveat_common.isra.31+0x4e3/0x7b7
  [] do_execve+0x1f/0x21
  [] SyS_execve+0x25/0x29
  [] stub_execve+0x69/0xa0

Reported-by: Valdis Kletnieks 
Signed-off-by: Richard Guy Briggs 
Tested-by: Valdis Kletnieks 
Signed-off-by: Paul Moore 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 kernel/audit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 6726aa6f82be..a0918e23d647 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -429,7 +429,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
  * This function doesn't consume an skb as might be expected since it has to
  * copy it anyways.
  */
-static void kauditd_send_multicast_skb(struct sk_buff *skb)
+static void kauditd_send_multicast_skb(struct sk_buff *skb, gfp_t gfp_mask)
 {
struct sk_buff  *copy;
struct audit_net*aunet = net_generic(_net, audit_net_id);
@@ -448,11 +448,11 @@ static void kauditd_send_multicast_skb(struct sk_buff 
*skb)
 * no reason for new multicast clients to continue with this
 * non-compliance.
 */
-   copy = skb_copy(skb, GFP_KERNEL);
+   copy = skb_copy(skb, gfp_mask);
if (!copy)
return;
 
-   nlmsg_multicast(sock, copy, 0, AUDIT_NLGRP_READLOG, GFP_KERNEL);
+   nlmsg_multicast(sock, copy, 0, AUDIT_NLGRP_READLOG, gfp_mask);
 }
 
 /*
@@ -1959,7 +1959,7 @@ void audit_log_end(struct audit_buffer *ab)
} else {
struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
 
-   kauditd_send_multicast_skb(ab->skb);
+   kauditd_send_multicast_skb(ab->skb, ab->gfp_mask);
 
/*
 * The original kaudit unicast socket sends up messages with
-- 
2.1.4

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


[PATCH 3.16.y-ckt 189/216] tick/powerclamp: Remove tick_nohz_idle abuse

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Thomas Gleixner 

commit a5fd9733a30d18d7ac23f17080e7e07bb3205b69 upstream.

commit 4dbd27711cd9 "tick: export nohz tick idle symbols for module
use" was merged via the thermal tree without an explicit ack from the
relevant maintainers.

The exports are abused by the intel powerclamp driver which implements
a fake idle state from a sched FIFO task. This causes all kinds of
wreckage in the NOHZ core code which rightfully assumes that
tick_nohz_idle_enter/exit() are only called from the idle task itself.

Recent changes in the NOHZ core lead to a failure of the powerclamp
driver and now people try to hack completely broken and backwards
workarounds into the NOHZ core code. This is completely unacceptable
and just papers over the real problem. There are way more subtle
issues lurking around the corner.

The real solution is to fix the powerclamp driver by rewriting it with
a sane concept, but that's beyond the scope of this.

So the only solution for now is to remove the calls into the core NOHZ
code from the powerclamp trainwreck along with the exports.

Fixes: d6d71ee4a14a "PM: Introduce Intel PowerClamp Driver"
Signed-off-by: Thomas Gleixner 
Cc: Preeti U Murthy 
Cc: Viresh Kumar 
Cc: Frederic Weisbecker 
Cc: Fengguang Wu 
Cc: Frederic Weisbecker 
Cc: Pan Jacob jun 
Cc: LKP 
Cc: Peter Zijlstra 
Cc: Zhang Rui 
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1412181110110.17382@nanos
Signed-off-by: Thomas Gleixner 
Signed-off-by: Luis Henriques 
---
 drivers/thermal/intel_powerclamp.c | 2 --
 kernel/time/tick-sched.c   | 2 --
 2 files changed, 4 deletions(-)

diff --git a/drivers/thermal/intel_powerclamp.c 
b/drivers/thermal/intel_powerclamp.c
index 95cb7fc20e17..6cb78497076a 100644
--- a/drivers/thermal/intel_powerclamp.c
+++ b/drivers/thermal/intel_powerclamp.c
@@ -435,7 +435,6 @@ static int clamp_thread(void *arg)
 * allowed. thus jiffies are updated properly.
 */
preempt_disable();
-   tick_nohz_idle_enter();
/* mwait until target jiffies is reached */
while (time_before(jiffies, target_jiffies)) {
unsigned long ecx = 1;
@@ -451,7 +450,6 @@ static int clamp_thread(void *arg)
start_critical_timings();
atomic_inc(_wakeup_counter);
}
-   tick_nohz_idle_exit();
preempt_enable();
}
del_timer_sync(_timer);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 6558b7ac112d..8c08a6f9cca0 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -807,7 +807,6 @@ void tick_nohz_idle_enter(void)
 
local_irq_enable();
 }
-EXPORT_SYMBOL_GPL(tick_nohz_idle_enter);
 
 /**
  * tick_nohz_irq_exit - update next tick event from interrupt exit
@@ -934,7 +933,6 @@ void tick_nohz_idle_exit(void)
 
local_irq_enable();
 }
-EXPORT_SYMBOL_GPL(tick_nohz_idle_exit);
 
 static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now)
 {
-- 
2.1.4

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


[PATCH 3.16.y-ckt 205/216] udf: Verify i_size when loading inode

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit e159332b9af4b04d882dbcfe1bb0117f0a6d4b58 upstream.

Verify that inode size is sane when loading inode with data stored in
ICB. Otherwise we may get confused later when working with the inode and
inode size is too big.

Reported-by: Carl Henrik Lunde 
Signed-off-by: Jan Kara 
[ luis: backported to 3.16:
  - Adjusted exit paths as commit 6d3d5e860a11 ("udf: Make udf_read_inode()
and udf_iget() return error") is not present in 3.16 kernel ]
Signed-off-by: Luis Henriques 
---
 fs/udf/inode.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index a932f7740b51..bf08a9fbb97e 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1496,6 +1496,24 @@ static void udf_fill_inode(struct inode *inode, struct 
buffer_head *bh)
iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
}
 
+   /* Sanity checks for files in ICB so that we don't get confused later */
+   if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
+   /*
+* For file in ICB data is stored in allocation descriptor
+* so sizes should match
+*/
+   if (iinfo->i_lenAlloc != inode->i_size) {
+   make_bad_inode(inode);
+   return;
+   }
+   /* File in ICB has to fit in there... */
+   if (inode->i_size > inode->i_sb->s_blocksize -
+   udf_file_entry_alloc_offset(inode)) {
+   make_bad_inode(inode);
+   return;
+   }
+   }
+
switch (fe->icbTag.fileType) {
case ICBTAG_FILE_TYPE_DIRECTORY:
inode->i_op = _dir_inode_operations;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 193/216] arm64: kernel: refactor the CPU suspend API for retention states

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Lorenzo Pieralisi 

commit 714f59925595b9c2ea9c22b107b340d38e3b3bc9 upstream.

CPU suspend is the standard kernel interface to be used to enter
low-power states on ARM64 systems. Current cpu_suspend implementation
by default assumes that all low power states are losing the CPU context,
so the CPU registers must be saved and cleaned to DRAM upon state
entry. Furthermore, the current cpu_suspend() implementation assumes
that if the CPU suspend back-end method returns when called, this has
to be considered an error regardless of the return code (which can be
successful) since the CPU was not expected to return from a code path that
is different from cpu_resume code path - eg returning from the reset vector.

All in all this means that the current API does not cope well with low-power
states that preserve the CPU context when entered (ie retention states),
since first of all the context is saved for nothing on state entry for
those states and a successful state entry can return as a normal function
return, which is considered an error by the current CPU suspend
implementation.

This patch refactors the cpu_suspend() API so that it can be split in
two separate functionalities. The arm64 cpu_suspend API just provides
a wrapper around CPU suspend operation hook. A new function is
introduced (for architecture code use only) for states that require
context saving upon entry:

__cpu_suspend(unsigned long arg, int (*fn)(unsigned long))

__cpu_suspend() saves the context on function entry and calls the
so called suspend finisher (ie fn) to complete the suspend operation.
The finisher is not expected to return, unless it fails in which case
the error is propagated back to the __cpu_suspend caller.

The API refactoring results in the following pseudo code call sequence for a
suspending CPU, when triggered from a kernel subsystem:

/*
 * int cpu_suspend(unsigned long idx)
 * @idx: idle state index
 */
{
-> cpu_suspend(idx)
|---> CPU operations suspend hook called, if present
|--> if (retention_state)
|--> direct suspend back-end call (eg PSCI suspend)
 else
|--> __cpu_suspend(idx, _end_finisher);
}

By refactoring the cpu_suspend API this way, the CPU operations back-end
has a chance to detect whether idle states require state saving or not
and can call the required suspend operations accordingly either through
simple function call or indirectly through __cpu_suspend() which carries out
state saving and suspend finisher dispatching to complete idle state entry.

Reviewed-by: Catalin Marinas 
Reviewed-by: Hanjun Guo 
Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Catalin Marinas 
[ luis: 3.16-stable prereq for
  f43c27188a49 "arm64: kernel: fix __cpu_suspend mm switch on warm-boot" ]
Signed-off-by: Luis Henriques 
---
 arch/arm64/include/asm/suspend.h |  1 +
 arch/arm64/kernel/sleep.S| 47 ---
 arch/arm64/kernel/suspend.c  | 48 
 3 files changed, 64 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h
index e9c149c042e0..456d67c1f0fa 100644
--- a/arch/arm64/include/asm/suspend.h
+++ b/arch/arm64/include/asm/suspend.h
@@ -21,6 +21,7 @@ struct sleep_save_sp {
phys_addr_t save_ptr_stash_phys;
 };
 
+extern int __cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
 extern void cpu_resume(void);
 extern int cpu_suspend(unsigned long);
 
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index b1925729c692..a564b440416a 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -49,28 +49,39 @@
orr \dst, \dst, \mask   // dst|=(aff3>>rs3)
.endm
 /*
- * Save CPU state for a suspend.  This saves callee registers, and allocates
- * space on the kernel stack to save the CPU specific registers + some
- * other data for resume.
+ * Save CPU state for a suspend and execute the suspend finisher.
+ * On success it will return 0 through cpu_resume - ie through a CPU
+ * soft/hard reboot from the reset vector.
+ * On failure it returns the suspend finisher return value or force
+ * -EOPNOTSUPP if the finisher erroneously returns 0 (the suspend finisher
+ * is not allowed to return, if it does this must be considered failure).
+ * It saves callee registers, and allocates space on the kernel stack
+ * to save the CPU specific registers + some other data for resume.
  *
  *  x0 = suspend finisher argument
+ *  x1 = suspend finisher function pointer
  */
-ENTRY(__cpu_suspend)
+ENTRY(__cpu_suspend_enter)
stp x29, lr, [sp, #-96]!
stp x19, x20, [sp,#16]
stp x21, x22, [sp,#32]
stp x23, x24, [sp,#48]
stp x25, x26, [sp,#64]
stp x27, x28, [sp,#80]
+   

[PATCH 3.16.y-ckt 194/216] arm64: Move cpu_resume into the text section

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Laura Abbott 

commit c3684fbb446501b48dec6677a6a9f61c215053de upstream.

The function cpu_resume currently lives in the .data section.
There's no reason for it to be there since we can use relative
instructions without a problem. Move a few cpu_resume data
structures out of the assembly file so the .data annotation
can be dropped completely and cpu_resume ends up in the read
only text section.

Reviewed-by: Kees Cook 
Reviewed-by: Mark Rutland 
Reviewed-by: Lorenzo Pieralisi 
Tested-by: Mark Rutland 
Tested-by: Lorenzo Pieralisi 
Tested-by: Kees Cook 
Acked-by: Ard Biesheuvel 
Signed-off-by: Laura Abbott 
Signed-off-by: Will Deacon 
[ luis: 3.16-stable prereq for
  f43c27188a49 "arm64: kernel: fix __cpu_suspend mm switch on warm-boot" ]
Signed-off-by: Luis Henriques 
---
 arch/arm64/kernel/sleep.S   | 36 ++--
 arch/arm64/kernel/suspend.c |  4 ++--
 2 files changed, 8 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index a564b440416a..ede186cdd452 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -147,14 +147,12 @@ cpu_resume_after_mmu:
ret
 ENDPROC(cpu_resume_after_mmu)
 
-   .data
 ENTRY(cpu_resume)
bl  el2_setup   // if in EL2 drop to EL1 cleanly
 #ifdef CONFIG_SMP
mrs x1, mpidr_el1
-   adr x4, mpidr_hash_ptr
-   ldr x5, [x4]
-   add x8, x4, x5  // x8 = struct mpidr_hash phys address
+   adrpx8, mpidr_hash
+   add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address
 /* retrieve mpidr_hash members to compute the hash */
ldr x2, [x8, #MPIDR_HASH_MASK]
ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS]
@@ -164,14 +162,15 @@ ENTRY(cpu_resume)
 #else
mov x7, xzr
 #endif
-   adr x0, sleep_save_sp
+   adrpx0, sleep_save_sp
+   add x0, x0, #:lo12:sleep_save_sp
ldr x0, [x0, #SLEEP_SAVE_SP_PHYS]
ldr x0, [x0, x7, lsl #3]
/* load sp from context */
ldr x2, [x0, #CPU_CTX_SP]
-   adr x1, sleep_idmap_phys
+   adrpx1, sleep_idmap_phys
/* load physical address of identity map page table in x1 */
-   ldr x1, [x1]
+   ldr x1, [x1, #:lo12:sleep_idmap_phys]
mov sp, x2
/*
 * cpu_do_resume expects x0 to contain context physical address
@@ -180,26 +179,3 @@ ENTRY(cpu_resume)
bl  cpu_do_resume   // PC relative jump, MMU off
b   cpu_resume_mmu  // Resume MMU, never returns
 ENDPROC(cpu_resume)
-
-   .align 3
-mpidr_hash_ptr:
-   /*
-* offset of mpidr_hash symbol from current location
-* used to obtain run-time mpidr_hash address with MMU off
- */
-   .quad   mpidr_hash - .
-/*
- * physical address of identity mapped page tables
- */
-   .type   sleep_idmap_phys, #object
-ENTRY(sleep_idmap_phys)
-   .quad   0
-/*
- * struct sleep_save_sp {
- * phys_addr_t *save_ptr_stash;
- * phys_addr_t save_ptr_stash_phys;
- * };
- */
-   .type   sleep_save_sp, #object
-ENTRY(sleep_save_sp)
-   .space  SLEEP_SAVE_SP_SZ// struct sleep_save_sp
diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 13ad4dbb1615..3771b72b6569 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -126,8 +126,8 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned 
long))
return ret;
 }
 
-extern struct sleep_save_sp sleep_save_sp;
-extern phys_addr_t sleep_idmap_phys;
+struct sleep_save_sp sleep_save_sp;
+phys_addr_t sleep_idmap_phys;
 
 static int __init cpu_suspend_init(void)
 {
-- 
2.1.4

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


[PATCH 3.16.y-ckt 197/216] parisc: fix out-of-register compiler error in ldcw inline assembler function

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: John David Anglin 

commit 45db07382a5c78b0c43b3b0002b63757fb60e873 upstream.

The __ldcw macro has a problem when its argument needs to be reloaded from
memory. The output memory operand and the input register operand both need to
be reloaded using a register in class R1_REGS when generating 64-bit code.
This fails because there's only a single register in the class. Instead, use a
memory clobber. This also makes the __ldcw macro a compiler memory barrier.

Signed-off-by: John David Anglin 
Signed-off-by: Helge Deller 
Signed-off-by: Luis Henriques 
---
 arch/parisc/include/asm/ldcw.h | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h
index d2d11b7055ba..8121aa6db2ff 100644
--- a/arch/parisc/include/asm/ldcw.h
+++ b/arch/parisc/include/asm/ldcw.h
@@ -33,11 +33,18 @@
 
 #endif /*!CONFIG_PA20*/
 
-/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*.  */
+/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*.
+   We don't explicitly expose that "*a" may be written as reload
+   fails to find a register in class R1_REGS when "a" needs to be
+   reloaded when generating 64-bit PIC code.  Instead, we clobber
+   memory to indicate to the compiler that the assembly code reads
+   or writes to items other than those listed in the input and output
+   operands.  This may pessimize the code somewhat but __ldcw is
+   usually used within code blocks surrounded by memory barriors.  */
 #define __ldcw(a) ({   \
unsigned __ret; \
-   __asm__ __volatile__(__LDCW " 0(%2),%0" \
-   : "=r" (__ret), "+m" (*(a)) : "r" (a)); \
+   __asm__ __volatile__(__LDCW " 0(%1),%0" \
+   : "=r" (__ret) : "r" (a) : "memory");   \
__ret;  \
 })
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 204/216] udf: Check path length when reading symlink

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit 0e5cc9a40ada6046e6bc3bdfcd0c0d7e4b706b14 upstream.

Symlink reading code does not check whether the resulting path fits into
the page provided by the generic code. This isn't as easy as just
checking the symlink size because of various encoding conversions we
perform on path. So we have to check whether there is still enough space
in the buffer on the fly.

Reported-by: Carl Henrik Lunde 
Signed-off-by: Jan Kara 
Signed-off-by: Luis Henriques 
---
 fs/udf/dir.c |  3 ++-
 fs/udf/namei.c   |  3 ++-
 fs/udf/symlink.c | 31 ++-
 fs/udf/udfdecl.h |  3 ++-
 fs/udf/unicode.c | 28 
 5 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index a012c51caffd..a7690b46ce0a 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -167,7 +167,8 @@ static int udf_readdir(struct file *file, struct 
dir_context *ctx)
continue;
}
 
-   flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
+   flen = udf_get_filename(dir->i_sb, nameptr, lfi, fname,
+   UDF_NAME_LEN);
if (!flen)
continue;
 
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 9737cba1357d..fd6bfa153f49 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -233,7 +233,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode 
*dir,
if (!lfi)
continue;
 
-   flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
+   flen = udf_get_filename(dir->i_sb, nameptr, lfi, fname,
+   UDF_NAME_LEN);
if (flen && udf_match(flen, fname, child->len, child->name))
goto out_ok;
}
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index d7c6dbe4194b..ab94e6671849 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -30,13 +30,16 @@
 #include 
 #include "udf_i.h"
 
-static void udf_pc_to_char(struct super_block *sb, unsigned char *from,
-  int fromlen, unsigned char *to)
+static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
+ int fromlen, unsigned char *to, int tolen)
 {
struct pathComponent *pc;
int elen = 0;
+   int comp_len;
unsigned char *p = to;
 
+   /* Reserve one byte for terminating \0 */
+   tolen--;
while (elen < fromlen) {
pc = (struct pathComponent *)(from + elen);
switch (pc->componentType) {
@@ -49,22 +52,37 @@ static void udf_pc_to_char(struct super_block *sb, unsigned 
char *from,
break;
/* Fall through */
case 2:
+   if (tolen == 0)
+   return -ENAMETOOLONG;
p = to;
*p++ = '/';
+   tolen--;
break;
case 3:
+   if (tolen < 3)
+   return -ENAMETOOLONG;
memcpy(p, "../", 3);
p += 3;
+   tolen -= 3;
break;
case 4:
+   if (tolen < 2)
+   return -ENAMETOOLONG;
memcpy(p, "./", 2);
p += 2;
+   tolen -= 2;
/* that would be . - just ignore */
break;
case 5:
-   p += udf_get_filename(sb, pc->componentIdent, p,
- pc->lengthComponentIdent);
+   comp_len = udf_get_filename(sb, pc->componentIdent,
+   pc->lengthComponentIdent,
+   p, tolen);
+   p += comp_len;
+   tolen -= comp_len;
+   if (tolen == 0)
+   return -ENAMETOOLONG;
*p++ = '/';
+   tolen--;
break;
}
elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
@@ -73,6 +91,7 @@ static void udf_pc_to_char(struct super_block *sb, unsigned 
char *from,
p[-1] = '\0';
else
p[0] = '\0';
+   return 0;
 }
 
 static int udf_symlink_filler(struct file *file, struct page *page)
@@ -100,8 +119,10 @@ static int udf_symlink_filler(struct file *file, struct 
page *page)
symlink = bh->b_data;
}
 
-   udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p);
+   err = udf_pc_to_char(inode->i_sb, 

[PATCH 3.16.y-ckt 198/216] kvm: x86: drop severity of "generation wraparound" message

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Paolo Bonzini 

commit a629df7eadffb03e6ce4a8616e62ea29fdf69b6b upstream.

Since most virtual machines raise this message once, it is a bit annoying.
Make it KERN_DEBUG severity.

Fixes: 7a2e8aaf0f6873b47bc2347f216ea5b0e4c258ab
Signed-off-by: Paolo Bonzini 
Signed-off-by: Luis Henriques 
---
 arch/x86/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1cd2a5fbde07..1bbf6861507e 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -4433,7 +4433,7 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm)
 * zap all shadow pages.
 */
if (unlikely(kvm_current_mmio_generation(kvm) == 0)) {
-   printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for 
mmio generation wraparound\n");
+   printk_ratelimited(KERN_DEBUG "kvm: zapping shadow pages for 
mmio generation wraparound\n");
kvm_mmu_invalidate_zap_all_pages(kvm);
}
 }
-- 
2.1.4

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


[PATCH 3.16.y-ckt 195/216] arm64: kernel: fix __cpu_suspend mm switch on warm-boot

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Lorenzo Pieralisi 

commit f43c27188a49111b58e9611afa2f0365b0b55625 upstream.

On arm64 the TTBR0_EL1 register is set to either the reserved TTBR0
page tables on boot or to the active_mm mappings belonging to user space
processes, it must never be set to swapper_pg_dir page tables mappings.

When a CPU is booted its active_mm is set to init_mm even though its
TTBR0_EL1 points at the reserved TTBR0 page mappings. This implies
that when __cpu_suspend is triggered the active_mm can point at
init_mm even if the current TTBR0_EL1 register contains the reserved
TTBR0_EL1 mappings.

Therefore, the mm save and restore executed in __cpu_suspend might
turn out to be erroneous in that, if the current->active_mm corresponds
to init_mm, on resume from low power it ends up restoring in the
TTBR0_EL1 the init_mm mappings that are global and can cause speculation
of TLB entries which end up being propagated to user space.

This patch fixes the issue by checking the active_mm pointer before
restoring the TTBR0 mappings. If the current active_mm == _mm,
the code sets the TTBR0_EL1 to the reserved TTBR0 mapping instead of
switching back to the active_mm, which is the expected behaviour
corresponding to the TTBR0_EL1 settings when __cpu_suspend was entered.

Fixes: 95322526ef62 ("arm64: kernel: cpu_{suspend/resume} implementation")
Cc: Will Deacon 
Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Catalin Marinas 
Signed-off-by: Luis Henriques 
---
 arch/arm64/kernel/suspend.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 3771b72b6569..2d6b6065fe7f 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -5,6 +5,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -98,7 +99,18 @@ int __cpu_suspend(unsigned long arg, int (*fn)(unsigned 
long))
 */
ret = __cpu_suspend_enter(arg, fn);
if (ret == 0) {
-   cpu_switch_mm(mm->pgd, mm);
+   /*
+* We are resuming from reset with TTBR0_EL1 set to the
+* idmap to enable the MMU; restore the active_mm mappings in
+* TTBR0_EL1 unless the active_mm == _mm, in which case
+* the thread entered __cpu_suspend with TTBR0_EL1 set to
+* reserved TTBR0 page tables and should be restored as such.
+*/
+   if (mm == _mm)
+   cpu_set_reserved_ttbr0();
+   else
+   cpu_switch_mm(mm->pgd, mm);
+
flush_tlb_all();
 
/*
-- 
2.1.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 03/10] clocksource: Remove clocksource_max_deferment()

2015-01-12 Thread John Stultz
On Sun, Jan 11, 2015 at 3:47 AM, Richard Cochran
 wrote:
>
> This series added:
>
> +   /* Return 50% of the actual maximum, so we can detect bad values */
> +   max_nsecs >>= 1;
>
> and then...
>
> On Fri, Jan 09, 2015 at 04:34:21PM -0800, John Stultz wrote:
>> @@ -760,7 +746,8 @@ void __clocksource_updatefreq_scale(struct clocksource 
>> *cs, u32 scale, u32 freq)
>>   cs->maxadj = clocksource_max_adjustment(cs);
>>   }
>>
>> - cs->max_idle_ns = clocksource_max_deferment(cs);
>> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
>> +  cs->maxadj, cs->mask);
>>  }
>>  EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
>>
>> @@ -807,7 +794,8 @@ int clocksource_register(struct clocksource *cs)
>>   cs->name);
>>
>>   /* calculate max idle time permitted for this clocksource */
>> - cs->max_idle_ns = clocksource_max_deferment(cs);
>> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
>> +  cs->maxadj, cs->mask);
>
> ... the whole world's maximum idle time is artificially reduced by
> half in order to catch some rare HW bug?  Not a very green solution.

So, the first patch had a cleanup which removed case where the max
mult value was being calculated assuming nanoseconds was a s64 instead
of a u64, which resulted in the max_idle_ns to be halved. So this
doesn't actually cost us more over what the current kernel does.

In fact, the cleanup removed the extra 12.5% reductions that were
applied, so for the HPET in qemu on my system, the max idle goes from
~16 secs to ~21 secs with this patchset (if I'm remembering
correctly).

But I'm open to put this under a debug config if its justified (part
of Linus' concern w/ clocksource code is that its had a few spots that
were needlessly complex, so some weighing of performance/power vs
simplified logic should be done). Do you have a specific case in mind
that you're worried about?

thanks
-john
--
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.16.y-ckt 203/216] crypto: af_alg - fix backlog handling

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Rabin Vincent 

commit 7e77bdebff5cb1e9876c561f69710b9ab8fa1f7e upstream.

If a request is backlogged, it's complete() handler will get called
twice: once with -EINPROGRESS, and once with the final error code.

af_alg's complete handler, unlike other users, does not handle the
-EINPROGRESS but instead always completes the completion that recvmsg()
is waiting on.  This can lead to a return to user space while the
request is still pending in the driver.  If userspace closes the sockets
before the requests are handled by the driver, this will lead to
use-after-frees (and potential crashes) in the kernel due to the tfm
having been freed.

The crashes can be easily reproduced (for example) by reducing the max
queue length in cryptod.c and running the following (from
http://www.chronox.de/libkcapi.html) on AES-NI capable hardware:

 $ while true; do kcapi -x 1 -e -c '__ecb-aes-aesni' \
-k  \
-p  >/dev/null & done

Signed-off-by: Rabin Vincent 
Signed-off-by: Herbert Xu 
Signed-off-by: Luis Henriques 
---
 crypto/af_alg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 6a3ad8011585..1de4beeb25f8 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -449,6 +449,9 @@ void af_alg_complete(struct crypto_async_request *req, int 
err)
 {
struct af_alg_completion *completion = req->data;
 
+   if (err == -EINPROGRESS)
+   return;
+
completion->err = err;
complete(>completion);
 }
-- 
2.1.4

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


[PATCH 3.16.y-ckt 206/216] udf: Verify symlink size before loading it

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit a1d47b262952a45aae62bd49cfaf33dd76c11a2c upstream.

UDF specification allows arbitrarily large symlinks. However we support
only symlinks at most one block large. Check the length of the symlink
so that we don't access memory beyond end of the symlink block.

Reported-by: Carl Henrik Lunde 
Signed-off-by: Jan Kara 
Signed-off-by: Luis Henriques 
---
 fs/udf/symlink.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index ab94e6671849..2d0c3720e9af 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -99,11 +99,17 @@ static int udf_symlink_filler(struct file *file, struct 
page *page)
struct inode *inode = page->mapping->host;
struct buffer_head *bh = NULL;
unsigned char *symlink;
-   int err = -EIO;
+   int err;
unsigned char *p = kmap(page);
struct udf_inode_info *iinfo;
uint32_t pos;
 
+   /* We don't support symlinks longer than one block */
+   if (inode->i_size > inode->i_sb->s_blocksize) {
+   err = -ENAMETOOLONG;
+   goto out_unmap;
+   }
+
iinfo = UDF_I(inode);
pos = udf_block_map(inode, 0);
 
@@ -113,8 +119,10 @@ static int udf_symlink_filler(struct file *file, struct 
page *page)
} else {
bh = sb_bread(inode->i_sb, pos);
 
-   if (!bh)
-   goto out;
+   if (!bh) {
+   err = -EIO;
+   goto out_unlock_inode;
+   }
 
symlink = bh->b_data;
}
@@ -130,9 +138,10 @@ static int udf_symlink_filler(struct file *file, struct 
page *page)
unlock_page(page);
return 0;
 
-out:
+out_unlock_inode:
up_read(>i_data_sem);
SetPageError(page);
+out_unmap:
kunmap(page);
unlock_page(page);
return err;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 207/216] udf: Check component length before reading it

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit e237ec37ec154564f8690c5bd1795339955eeef9 upstream.

Check that length specified in a component of a symlink fits in the
input buffer we are reading. Also properly ignore component length for
component types that do not use it. Otherwise we read memory after end
of buffer for corrupted udf image.

Reported-by: Carl Henrik Lunde 
Signed-off-by: Jan Kara 
Signed-off-by: Luis Henriques 
---
 fs/udf/symlink.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 2d0c3720e9af..0422b7b8369f 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -42,14 +42,17 @@ static int udf_pc_to_char(struct super_block *sb, unsigned 
char *from,
tolen--;
while (elen < fromlen) {
pc = (struct pathComponent *)(from + elen);
+   elen += sizeof(struct pathComponent);
switch (pc->componentType) {
case 1:
/*
 * Symlink points to some place which should be agreed
 * upon between originator and receiver of the media. 
Ignore.
 */
-   if (pc->lengthComponentIdent > 0)
+   if (pc->lengthComponentIdent > 0) {
+   elen += pc->lengthComponentIdent;
break;
+   }
/* Fall through */
case 2:
if (tolen == 0)
@@ -74,6 +77,9 @@ static int udf_pc_to_char(struct super_block *sb, unsigned 
char *from,
/* that would be . - just ignore */
break;
case 5:
+   elen += pc->lengthComponentIdent;
+   if (elen > fromlen)
+   return -EIO;
comp_len = udf_get_filename(sb, pc->componentIdent,
pc->lengthComponentIdent,
p, tolen);
@@ -85,7 +91,6 @@ static int udf_pc_to_char(struct super_block *sb, unsigned 
char *from,
tolen--;
break;
}
-   elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
}
if (p > to + 1)
p[-1] = '\0';
-- 
2.1.4

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


[PATCH 3.16.y-ckt 200/216] powercap / RAPL: add support for CPU model 0x3f

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jason Baron 

commit 64c7569c065564a066bb44161f904b4afc9f3e3a upstream.

I've confirmed that monitoring the package power usage as well as setting power
limits appear to be working as expected. Supports the package and dram domains.

Tested aginst cpu:

Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz

Signed-off-by: Jason Baron 
Acked-by: Jacob Pan 
Signed-off-by: Rafael J. Wysocki 
Cc: Pali Rohár 
Signed-off-by: Luis Henriques 
---
 drivers/powercap/intel_rapl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c
index b1cda6ffdbcc..a362dcc20ec0 100644
--- a/drivers/powercap/intel_rapl.c
+++ b/drivers/powercap/intel_rapl.c
@@ -953,6 +953,7 @@ static const struct x86_cpu_id rapl_ids[] = {
{ X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */
{ X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */
{ X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */
+   { X86_VENDOR_INTEL, 6, 0x3f},/* Haswell */
{ X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */
/* TODO: Add more CPU IDs after testing */
{}
-- 
2.1.4

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


[PATCH 3.16.y-ckt 212/216] platform/chrome: Add support for the acer c720p touchscreen.

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Michael Mullin 

commit b90b3c4ae06af135e279c9a5aa1c640d22787fc4 upstream.

Add support for the acer c720p touchscreen.
Tested manually by using the touchscreen on the acer c720p-2664

Based on the following patch by Dave Parker :
https://chromium-review.googlesource.com/#/c/167136/

Signed-off-by: Michael Mullin 
Reviewed-by: Benson Leung 
Signed-off-by: Olof Johansson 
Cc: Scot Doyle 
Signed-off-by: Luis Henriques 
---
 drivers/platform/chrome/chromeos_laptop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index 37fa570a7636..fd090efe5489 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -417,6 +417,8 @@ static struct chromeos_laptop acer_ac700 = {
 
 static struct chromeos_laptop acer_c720 = {
.i2c_peripherals = {
+   /* Touchscreen. */
+   { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 },
/* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
/* Light Sensor. */
-- 
2.1.4

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


[PATCH 3.16.y-ckt 199/216] Btrfs: fix loop writing of async reclaim

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Liu Bo 

commit 25ce459c1af138f95a3fd318461193397ebb825b upstream.

One of my tests shows that when we really don't have space to reclaim via
flush_space and also run out of space, this async reclaim work loops on adding
itself into the workqueue and keeps writing something to disk according to
iostat's results, and these writes mainly comes from commit_transaction which
writes super_block.  This's unacceptable as it can be bad to disks, especially
memeory storages.

This adds a check to avoid the above situation.

Signed-off-by: Liu Bo 
Signed-off-by: Chris Mason 
Cc: Alexander E. Patrakov 
Signed-off-by: Luis Henriques 
---
 fs/btrfs/extent-tree.c | 17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 47121133f4d8..58f014a2bba1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4349,11 +4349,21 @@ static inline int need_do_async_reclaim(struct 
btrfs_space_info *space_info,
 }
 
 static int btrfs_need_do_async_reclaim(struct btrfs_space_info *space_info,
-  struct btrfs_fs_info *fs_info)
+  struct btrfs_fs_info *fs_info,
+  int flush_state)
 {
u64 used;
 
spin_lock(_info->lock);
+   /*
+* We run out of space and have not got any free space via flush_space,
+* so don't bother doing async reclaim.
+*/
+   if (flush_state > COMMIT_TRANS && space_info->full) {
+   spin_unlock(_info->lock);
+   return 0;
+   }
+
used = space_info->bytes_used + space_info->bytes_reserved +
   space_info->bytes_pinned + space_info->bytes_readonly +
   space_info->bytes_may_use;
@@ -4386,11 +4396,12 @@ static void btrfs_async_reclaim_metadata_space(struct 
work_struct *work)
flush_space(fs_info->fs_root, space_info, to_reclaim,
to_reclaim, flush_state);
flush_state++;
-   if (!btrfs_need_do_async_reclaim(space_info, fs_info))
+   if (!btrfs_need_do_async_reclaim(space_info, fs_info,
+flush_state))
return;
} while (flush_state <= COMMIT_TRANS);
 
-   if (btrfs_need_do_async_reclaim(space_info, fs_info))
+   if (btrfs_need_do_async_reclaim(space_info, fs_info, flush_state))
queue_work(system_unbound_wq, work);
 }
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 202/216] isofs: Fix unchecked printing of ER records

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Jan Kara 

commit 4e2024624e678f0ebb916e6192bd23c1f9fdf696 upstream.

We didn't check length of rock ridge ER records before printing them.
Thus corrupted isofs image can cause us to access and print some memory
behind the buffer with obvious consequences.

Reported-and-tested-by: Carl Henrik Lunde 
Signed-off-by: Jan Kara 
Signed-off-by: Luis Henriques 
---
 fs/isofs/rock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c
index bb63254ed848..735d7522a3a9 100644
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -362,6 +362,9 @@ repeat:
rs.cont_size = isonum_733(rr->u.CE.size);
break;
case SIG('E', 'R'):
+   /* Invalid length of ER tag id? */
+   if (rr->u.ER.len_id + offsetof(struct rock_ridge, 
u.ER.data) > rr->len)
+   goto out;
ISOFS_SB(inode->i_sb)->s_rock = 1;
printk(KERN_DEBUG "ISO 9660 Extensions: ");
{
-- 
2.1.4

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


[PATCH 3.16.y-ckt 208/216] platform/chrome: chromeos_laptop - Add support for Acer C720

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Mika Westerberg 

commit da3b0ab75aadab63d1ffd5563100c9386e444dad upstream.

Acer C720 has touchpad and light sensor connected to a separate I2C buses.
Since the designware I2C host controller driver has two instances on this
particular machine we need a way to match the correct instance. Add support
for this and then register both C720 touchpad and light sensor.

This code is based on following patch from Benson Leung:

https://patchwork.kernel.org/patch/3074411/

Signed-off-by: Mika Westerberg 
Tested-by: Kirill A. Shutemov 
Signed-off-by: Benson Leung 
Reviewed-by: Mika Westerberg 
Signed-off-by: Olof Johansson 
Cc: Scot Doyle 
Signed-off-by: Luis Henriques 
---
 drivers/platform/chrome/chromeos_laptop.c | 45 ++-
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index 7f1a2e2711bd..a241e5fa6c83 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -45,6 +45,8 @@ static const char *i2c_adapter_names[] = {
"SMBus I801 adapter",
"i915 gmbus vga",
"i915 gmbus panel",
+   "i2c-designware-pci",
+   "i2c-designware-pci",
 };
 
 /* Keep this enum consistent with i2c_adapter_names */
@@ -52,6 +54,8 @@ enum i2c_adapter_type {
I2C_ADAPTER_SMBUS = 0,
I2C_ADAPTER_VGADDC,
I2C_ADAPTER_PANEL,
+   I2C_ADAPTER_DESIGNWARE_0,
+   I2C_ADAPTER_DESIGNWARE_1,
 };
 
 struct i2c_peripheral {
@@ -172,29 +176,42 @@ static struct i2c_client *__add_probed_i2c_device(
return client;
 }
 
+struct i2c_lookup {
+   const char *name;
+   int instance;
+   int n;
+};
+
 static int __find_i2c_adap(struct device *dev, void *data)
 {
-   const char *name = data;
+   struct i2c_lookup *lookup = data;
static const char *prefix = "i2c-";
struct i2c_adapter *adapter;
if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0)
return 0;
adapter = to_i2c_adapter(dev);
-   return (strncmp(adapter->name, name, strlen(name)) == 0);
+   if (strncmp(adapter->name, lookup->name, strlen(lookup->name)) == 0 &&
+   lookup->n++ == lookup->instance)
+   return 1;
+   return 0;
 }
 
 static int find_i2c_adapter_num(enum i2c_adapter_type type)
 {
struct device *dev = NULL;
struct i2c_adapter *adapter;
-   const char *name = i2c_adapter_names[type];
+   struct i2c_lookup lookup;
+
+   memset(, 0, sizeof(lookup));
+   lookup.name = i2c_adapter_names[type];
+   lookup.instance = (type == I2C_ADAPTER_DESIGNWARE_1) ? 1 : 0;
+
/* find the adapter by name */
-   dev = bus_find_device(_bus_type, NULL, (void *)name,
- __find_i2c_adap);
+   dev = bus_find_device(_bus_type, NULL, , __find_i2c_adap);
if (!dev) {
/* Adapters may appear later. Deferred probing will retry */
pr_notice("%s: i2c adapter %s not found on system.\n", __func__,
- name);
+ lookup.name);
return -ENODEV;
}
adapter = to_i2c_adapter(dev);
@@ -377,6 +394,15 @@ static struct chromeos_laptop acer_ac700 = {
},
 };
 
+static struct chromeos_laptop acer_c720 = {
+   .i2c_peripherals = {
+   /* Touchpad. */
+   { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
+   /* Light Sensor. */
+   { .add = setup_isl29018_als, I2C_ADAPTER_DESIGNWARE_1 },
+   },
+};
+
 static struct chromeos_laptop hp_pavilion_14_chromebook = {
.i2c_peripherals = {
/* Touchpad. */
@@ -434,6 +460,13 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] 
__initdata = {
_CBDD(acer_ac700),
},
{
+   .ident = "Acer C720",
+   .matches = {
+   DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"),
+   },
+   _CBDD(acer_c720),
+   },
+   {
.ident = "HP Pavilion 14 Chromebook",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Butterfly"),
-- 
2.1.4

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


[PATCH 3.16.y-ckt 210/216] platform/chrome: chromeos_laptop - Add Dell Chromebook 11 touch

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Mohammed Habibulla 

commit 0e1e5e590a457063c94d55c219b349bcf0d1f93a upstream.

Add support for Dell Chromebook 11's touch device, which is the same
as falco/peppy on the same bus using the LynxPoint-LP I2C via the
i2c-designware-pci driver.

Based on these patches from the chromeos-3.8 kernel:
https://chromium-review.googlesource.com/#/c/65320/
https://chromium-review.googlesource.com/#/c/174664/

Signed-off-by: Mohammed Habibulla 
Signed-off-by: Benson Leung 
Reviewed-by: Mika Westerberg 
Signed-off-by: Olof Johansson 
Cc: Scot Doyle 
Signed-off-by: Luis Henriques 
---
 drivers/platform/chrome/chromeos_laptop.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index 02e014b8927c..e0a671075b28 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -387,6 +387,13 @@ static struct chromeos_laptop hp_chromebook_14 = {
},
 };
 
+static struct chromeos_laptop dell_chromebook_11 = {
+   .i2c_peripherals = {
+   /* Touchpad. */
+   { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
+   },
+};
+
 static struct chromeos_laptop acer_c7_chromebook = {
.i2c_peripherals = {
/* Touchpad. */
@@ -453,6 +460,14 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] 
__initdata = {
_CBDD(chromebook_pixel),
},
{
+   .ident = "Wolf",
+   .matches = {
+   DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "Wolf"),
+   },
+   _CBDD(dell_chromebook_11),
+   },
+   {
.ident = "HP Chromebook 14",
.matches = {
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
-- 
2.1.4

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


[PATCH 3.16.y-ckt 201/216] iwlwifi: make U-APSD default configurable at compile time

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Johannes Berg 

commit d6ca18de129fc4dd4374389561930b32820f35ff upstream.

With a significant number of deployed APs, enabling uAPSD leads to the
AP never using aggregation sessions (likely due to the complexities
involved in handling uAPSD in those.) This obviously results in a large
drop in throughput with such APs.

On the other hand, uAPSD can result in some power consumption benefits,
but for now just disable it to get performance with affected APs back
up.

Signed-off-by: Johannes Berg 
Signed-off-by: Emmanuel Grumbach 
Signed-off-by: Luis Henriques 
---
 drivers/net/wireless/iwlwifi/Kconfig   | 10 ++
 drivers/net/wireless/iwlwifi/iwl-drv.c |  8 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/Kconfig 
b/drivers/net/wireless/iwlwifi/Kconfig
index 7fd50428b934..9c67e255c689 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -85,6 +85,16 @@ config IWLWIFI_BCAST_FILTERING
  If unsure, don't enable this option, as some programs might
  expect incoming broadcasts for their normal operations.
 
+config IWLWIFI_UAPSD
+   bool "enable U-APSD by default"
+   depends on IWLMVM
+   help
+ Say Y here to enable U-APSD by default. This may cause
+ interoperability problems with some APs, manifesting in lower than
+ expected throughput due to those APs not enabling aggregation
+
+ If unsure, say N.
+
 menu "Debugging Options"
depends on IWLWIFI
 
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c 
b/drivers/net/wireless/iwlwifi/iwl-drv.c
index f2a5c12269a3..a09ce04c0f63 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1243,7 +1243,9 @@ struct iwl_mod_params iwlwifi_mod_params = {
.bt_coex_active = true,
.power_level = IWL_POWER_INDEX_1,
.wd_disable = true,
-   .uapsd_disable = false,
+#ifndef CONFIG_IWLWIFI_UAPSD
+   .uapsd_disable = true,
+#endif /* CONFIG_IWLWIFI_UAPSD */
/* the rest are 0 by default */
 };
 IWL_EXPORT_SYMBOL(iwlwifi_mod_params);
@@ -1359,7 +1361,11 @@ MODULE_PARM_DESC(nvm_file, "NVM file name");
 
 module_param_named(uapsd_disable, iwlwifi_mod_params.uapsd_disable,
   bool, S_IRUGO);
+#ifdef CONFIG_IWLWIFI_UAPSD
 MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: N)");
+#else
+MODULE_PARM_DESC(uapsd_disable, "disable U-APSD functionality (default: Y)");
+#endif
 
 /*
  * set bt_coex_active to true, uCode will do kill/defer
-- 
2.1.4

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


[PATCH 3.16.y-ckt 216/216] KEYS: close race between key lookup and freeing

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sasha Levin 

commit a3a8784454692dd72e5d5d34dcdab17b4420e74c upstream.

When a key is being garbage collected, it's key->user would get put before
the ->destroy() callback is called, where the key is removed from it's
respective tracking structures.

This leaves a key hanging in a semi-invalid state which leaves a window open
for a different task to try an access key->user. An example is
find_keyring_by_name() which would dereference key->user for a key that is
in the process of being garbage collected (where key->user was freed but
->destroy() wasn't called yet - so it's still present in the linked list).

This would cause either a panic, or corrupt memory.

Fixes CVE-2014-9529.

Signed-off-by: Sasha Levin 
Signed-off-by: David Howells 
Cc: Moritz Muehlenhoff 
Signed-off-by: Luis Henriques 
---
 security/keys/gc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/keys/gc.c b/security/keys/gc.c
index d3222b6d7d59..009d9370c8fd 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -157,12 +157,12 @@ static noinline void key_gc_unused_keys(struct list_head 
*keys)
if (test_bit(KEY_FLAG_INSTANTIATED, >flags))
atomic_dec(>user->nikeys);
 
-   key_user_put(key->user);
-
/* now throw away the key memory */
if (key->type->destroy)
key->type->destroy(key);
 
+   key_user_put(key->user);
+
kfree(key->description);
 
 #ifdef KEY_DEBUGGING
-- 
2.1.4

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


[PATCH 3.16.y-ckt 215/216] deal with deadlock in d_walk()

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Al Viro 

commit ca5358ef75fc69fee5322a38a340f5739d997c10 upstream.

... by not hitting rename_retry for reasons other than rename having
happened.  In other words, do _not_ restart when finding that
between unlocking the child and locking the parent the former got
into __dentry_kill().  Skip the killed siblings instead...

Signed-off-by: Al Viro 
Cc: Moritz Muehlenhoff 
Signed-off-by: Luis Henriques 
---
 fs/dcache.c | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index c73c777b7c3f..e2dc0874a1f0 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -466,7 +466,7 @@ static void __dentry_kill(struct dentry *dentry)
}
/* if it was on the hash then remove it */
__d_drop(dentry);
-   list_del(>d_child);
+   __list_del_entry(>d_child);
/*
 * Inform d_walk() that we are no longer attached to the
 * dentry tree
@@ -1120,33 +1120,31 @@ resume:
/*
 * All done at this level ... ascend and resume the search.
 */
+   rcu_read_lock();
+ascend:
if (this_parent != parent) {
struct dentry *child = this_parent;
this_parent = child->d_parent;
 
-   rcu_read_lock();
spin_unlock(>d_lock);
spin_lock(_parent->d_lock);
 
-   /*
-* might go back up the wrong parent if we have had a rename
-* or deletion
-*/
-   if (this_parent != child->d_parent ||
-(child->d_flags & DCACHE_DENTRY_KILLED) ||
-need_seqretry(_lock, seq)) {
-   spin_unlock(_parent->d_lock);
-   rcu_read_unlock();
+   /* might go back up the wrong parent if we have had a rename. */
+   if (need_seqretry(_lock, seq))
goto rename_retry;
+   next = child->d_child.next;
+   while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
+   if (next == _parent->d_subdirs)
+   goto ascend;
+   child = list_entry(next, struct dentry, d_child);
+   next = next->next;
}
rcu_read_unlock();
-   next = child->d_child.next;
goto resume;
}
-   if (need_seqretry(_lock, seq)) {
-   spin_unlock(_parent->d_lock);
+   if (need_seqretry(_lock, seq))
goto rename_retry;
-   }
+   rcu_read_unlock();
if (finish)
finish(data);
 
@@ -1156,6 +1154,9 @@ out_unlock:
return;
 
 rename_retry:
+   spin_unlock(_parent->d_lock);
+   rcu_read_unlock();
+   BUG_ON(seq & 1);
if (!retry)
return;
seq = 1;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 211/216] platform/chrome: chromeos_laptop - Add Toshiba CB35 Touch

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Gene Chen 

commit 963cb6fa0f5f115986e970b9d97440e4906524fa upstream.

Add support for Leon touch devices, which is the same as
falco/peppy/wolf on the same buses using the LynxPoint-LP I2C
via the i2c-designware-pci driver.

Based on these patches from the chromeos-3.8 kernel:
https://chromium-review.googlesource.com/168351
https://chromium-review.googlesource.com/173445

Signed-off-by: Gene Chen 
Signed-off-by: Benson Leung 
Tested-by: Scot Doyle 
Reviewed-by: Mika Westerberg 
Signed-off-by: Olof Johansson 
Cc: Scot Doyle 
Signed-off-by: Luis Henriques 
---
 drivers/platform/chrome/chromeos_laptop.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index e0a671075b28..37fa570a7636 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -394,6 +394,13 @@ static struct chromeos_laptop dell_chromebook_11 = {
},
 };
 
+static struct chromeos_laptop toshiba_cb35 = {
+   .i2c_peripherals = {
+   /* Touchpad. */
+   { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
+   },
+};
+
 static struct chromeos_laptop acer_c7_chromebook = {
.i2c_peripherals = {
/* Touchpad. */
@@ -476,6 +483,14 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] 
__initdata = {
_CBDD(hp_chromebook_14),
},
{
+   .ident = "Toshiba CB35",
+   .matches = {
+   DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "Leon"),
+   },
+   _CBDD(toshiba_cb35),
+   },
+   {
.ident = "Acer C7 Chromebook",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Parrot"),
-- 
2.1.4

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


[PATCH 3.16.y-ckt 214/216] move d_rcu from overlapping d_child to overlapping d_alias

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Al Viro 

commit 946e51f2bf37f1656916eb75bd0742ba33983c28 upstream.

Signed-off-by: Al Viro 
[bwh: Backported to 3.16:
 - Apply name changes in all the different places we use d_alias and d_child
 - Adjust context]
Signed-off-by: Ben Hutchings 
Cc: Moritz Muehlenhoff 
Signed-off-by: Luis Henriques 
---
 arch/powerpc/platforms/cell/spufs/inode.c   |  2 +-
 drivers/staging/lustre/lustre/llite/dcache.c|  2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c |  2 +-
 drivers/staging/lustre/lustre/llite/namei.c |  8 ++--
 fs/affs/amigaffs.c  |  2 +-
 fs/autofs4/expire.c | 12 ++---
 fs/autofs4/root.c   |  2 +-
 fs/ceph/dir.c   |  8 ++--
 fs/ceph/inode.c |  2 +-
 fs/cifs/inode.c |  2 +-
 fs/coda/cache.c |  2 +-
 fs/dcache.c | 59 +
 fs/debugfs/inode.c  |  2 +-
 fs/exportfs/expfs.c |  2 +-
 fs/libfs.c  | 12 ++---
 fs/ncpfs/dir.c  |  2 +-
 fs/ncpfs/ncplib_kernel.h|  4 +-
 fs/nfs/getroot.c|  2 +-
 fs/notify/fsnotify.c|  4 +-
 fs/ocfs2/dcache.c   |  2 +-
 include/linux/dcache.h  |  8 ++--
 kernel/trace/trace.c|  4 +-
 kernel/trace/trace_events.c |  2 +-
 security/selinux/selinuxfs.c|  6 +--
 24 files changed, 77 insertions(+), 76 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/inode.c 
b/arch/powerpc/platforms/cell/spufs/inode.c
index 87ba7cf99cd7..65d633f20d37 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir)
struct dentry *dentry, *tmp;
 
mutex_lock(>d_inode->i_mutex);
-   list_for_each_entry_safe(dentry, tmp, >d_subdirs, d_u.d_child) {
+   list_for_each_entry_safe(dentry, tmp, >d_subdirs, d_child) {
spin_lock(>d_lock);
if (!(d_unhashed(dentry)) && dentry->d_inode) {
dget_dlock(dentry);
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 7d520d8f4a69..e5817f19f3c3 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -258,7 +258,7 @@ void ll_invalidate_aliases(struct inode *inode)
   inode->i_ino, inode->i_generation, inode);
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(dentry, p, >i_dentry, d_alias) {
+   ll_d_hlist_for_each_entry(dentry, p, >i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p "
   "inode %p flags %d\n", dentry->d_name.len,
   dentry->d_name.name, dentry, dentry->d_parent,
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index deca27ea33fe..0e507f53fd9b 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -704,7 +704,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
return;
 
list_for_each(tmp, >d_subdirs) {
-   struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child);
+   struct dentry *d = list_entry(tmp, struct dentry, d_child);
lustre_dump_dentry(d, recur - 1);
}
 }
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index dfa1e745dfd6..bfa8fa2362fa 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -167,14 +167,14 @@ static void ll_invalidate_negative_children(struct inode 
*dir)
struct ll_d_hlist_node *p;
 
ll_lock_dcache(dir);
-   ll_d_hlist_for_each_entry(dentry, p, >i_dentry, d_alias) {
+   ll_d_hlist_for_each_entry(dentry, p, >i_dentry, d_u.d_alias) {
spin_lock(>d_lock);
if (!list_empty(>d_subdirs)) {
struct dentry *child;
 
list_for_each_entry_safe(child, tmp_subdir,
 >d_subdirs,
-d_u.d_child) {
+d_child) {
if (child->d_inode == NULL)
d_lustre_invalidate(child, 1);
}
@@ 

[PATCH 3.16.y-ckt 213/216] batman-adv: Calculate extra tail size based on queued fragments

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Sven Eckelmann 

commit 5b6698b0e4a37053de35cc24ee695b98a7eb712b upstream.

The fragmentation code was replaced in 610bfc6bc99bc83680d190ebc69359a05fc7f605
("batman-adv: Receive fragmented packets and merge"). The new code provided a
mostly unused parameter skb for the merging function. It is used inside the
function to calculate the additionally needed skb tailroom. But instead of
increasing its own tailroom, it is only increasing the tailroom of the first
queued skb. This is not correct in some situations because the first queued
entry can be a different one than the parameter.

An observed problem was:

1. packet with size 104, total_size 1464, fragno 1 was received
   - packet is queued
2. packet with size 1400, total_size 1464, fragno 0 was received
   - packet is queued at the end of the list
3. enough data was received and can be given to the merge function
   (1464 == (1400 - 20) + (104 - 20))
   - merge functions gets 1400 byte large packet as skb argument
4. merge function gets first entry in queue (104 byte)
   - stored as skb_out
5. merge function calculates the required extra tail as total_size - skb->len
   - pskb_expand_head tail of skb_out with 64 bytes
6. merge function tries to squeeze the extra 1380 bytes from the second queued
   skb (1400 byte aka skb parameter) in the 64 extra tail bytes of skb_out

Instead calculate the extra required tail bytes for skb_out also using skb_out
instead of using the parameter skb. The skb parameter is only used to get the
total_size from the last received packet. This is also the total_size used to
decide that all fragments were received.

Reported-by: Philipp Psurek 
Signed-off-by: Sven Eckelmann 
Acked-by: Martin Hundebøll 
Signed-off-by: David S. Miller 
Cc: Moritz Muehlenhoff 
Signed-off-by: Luis Henriques 
---
 net/batman-adv/fragmentation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c
index 022d18ab27a6..57dd88db6bb7 100644
--- a/net/batman-adv/fragmentation.c
+++ b/net/batman-adv/fragmentation.c
@@ -251,7 +251,7 @@ batadv_frag_merge_packets(struct hlist_head *chain, struct 
sk_buff *skb)
kfree(entry);
 
/* Make room for the rest of the fragments. */
-   if (pskb_expand_head(skb_out, 0, size - skb->len, GFP_ATOMIC) < 0) {
+   if (pskb_expand_head(skb_out, 0, size - skb_out->len, GFP_ATOMIC) < 0) {
kfree_skb(skb_out);
skb_out = NULL;
goto free;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 209/216] platform/chrome: chromeos_laptop - Add HP Chromebook 14

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Benson Leung 

commit 5ea9567f6126846f5dcfa8515d7ef2c238133c0d upstream.

Add support for the trackpad on HP Chromebook 14.

Signed-off-by: Benson Leung 
Reviewed-by: Mika Westerberg 
Signed-off-by: Olof Johansson 
Cc: Scot Doyle 
Signed-off-by: Luis Henriques 
---
 drivers/platform/chrome/chromeos_laptop.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/platform/chrome/chromeos_laptop.c 
b/drivers/platform/chrome/chromeos_laptop.c
index a241e5fa6c83..02e014b8927c 100644
--- a/drivers/platform/chrome/chromeos_laptop.c
+++ b/drivers/platform/chrome/chromeos_laptop.c
@@ -380,6 +380,13 @@ static struct chromeos_laptop chromebook_pixel = {
},
 };
 
+static struct chromeos_laptop hp_chromebook_14 = {
+   .i2c_peripherals = {
+   /* Touchpad. */
+   { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
+   },
+};
+
 static struct chromeos_laptop acer_c7_chromebook = {
.i2c_peripherals = {
/* Touchpad. */
@@ -446,6 +453,14 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] 
__initdata = {
_CBDD(chromebook_pixel),
},
{
+   .ident = "HP Chromebook 14",
+   .matches = {
+   DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "Falco"),
+   },
+   _CBDD(hp_chromebook_14),
+   },
+   {
.ident = "Acer C7 Chromebook",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Parrot"),
-- 
2.1.4

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


[PATCH 3.16.y-ckt 192/216] arm64: kernel: add missing __init section marker to cpu_suspend_init

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Lorenzo Pieralisi 

commit 18ab7db6b749ac27aac08d572afbbd2f4d937934 upstream.

Suspend init function must be marked as __init, since it is not needed
after the kernel has booted. This patch moves the cpu_suspend_init()
function to the __init section.

Signed-off-by: Lorenzo Pieralisi 
Signed-off-by: Catalin Marinas 
[ luis: 3.16-stable prereq for
  f43c27188a49 "arm64: kernel: fix __cpu_suspend mm switch on warm-boot" ]
Signed-off-by: Luis Henriques 
---
 arch/arm64/kernel/suspend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c
index 1fa9ce4afd8f..55a99b9a97e0 100644
--- a/arch/arm64/kernel/suspend.c
+++ b/arch/arm64/kernel/suspend.c
@@ -119,7 +119,7 @@ int cpu_suspend(unsigned long arg)
 extern struct sleep_save_sp sleep_save_sp;
 extern phys_addr_t sleep_idmap_phys;
 
-static int cpu_suspend_init(void)
+static int __init cpu_suspend_init(void)
 {
void *ctx_ptr;
 
-- 
2.1.4

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


[PATCH 3.16.y-ckt 043/216] Btrfs: do not move em to modified list when unpinning

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Josef Bacik 

commit a28046956c71985046474283fa3bcd256915fb72 upstream.

We use the modified list to keep track of which extents have been modified so we
know which ones are candidates for logging at fsync() time.  Newly modified
extents are added to the list at modification time, around the same time the
ordered extent is created.  We do this so that we don't have to wait for ordered
extents to complete before we know what we need to log.  The problem is when
something like this happens

log extent 0-4k on inode 1
copy csum for 0-4k from ordered extent into log
sync log
commit transaction
log some other extent on inode 1
ordered extent for 0-4k completes and adds itself onto modified list again
log changed extents
see ordered extent for 0-4k has already been logged
at this point we assume the csum has been copied
sync log
crash

On replay we will see the extent 0-4k in the log, drop the original 0-4k extent
which is the same one that we are replaying which also drops the csum, and then
we won't find the csum in the log for that bytenr.  This of course causes us to
have errors about not having csums for certain ranges of our inode.  So remove
the modified list manipulation in unpin_extent_cache, any modified extents
should have been added well before now, and we don't want them re-logged.  This
fixes my test that I could reliably reproduce this problem with.  Thanks,

Signed-off-by: Josef Bacik 
Signed-off-by: Chris Mason 
Signed-off-by: Luis Henriques 
---
 fs/btrfs/extent_map.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 225302b39afb..6a98bddd8f33 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -287,8 +287,6 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 
start, u64 len,
if (!em)
goto out;
 
-   if (!test_bit(EXTENT_FLAG_LOGGING, >flags))
-   list_move(>list, >modified_extents);
em->generation = gen;
clear_bit(EXTENT_FLAG_PINNED, >flags);
em->mod_start = em->start;
-- 
2.1.4

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


[PATCH 3.16.y-ckt 042/216] Btrfs: make sure logged extents complete in the current transaction V3

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Josef Bacik 

commit 50d9aa99bd35c77200e0e3dd7a72274f8304701f upstream.

Liu Bo pointed out that my previous fix would lose the generation update in the
scenario I described.  It is actually much worse than that, we could lose the
entire extent if we lose power right after the transaction commits.  Consider
the following

write extent 0-4k
log extent in log tree
commit transaction
< power fail happens here
ordered extent completes

We would lose the 0-4k extent because it hasn't updated the actual fs tree, and
the transaction commit will reset the log so it isn't replayed.  If we lose
power before the transaction commit we are save, otherwise we are not.

Fix this by keeping track of all extents we logged in this transaction.  Then
when we go to commit the transaction make sure we wait for all of those ordered
extents to complete before proceeding.  This will make sure that if we lose
power after the transaction commit we still have our data.  This also fixes the
problem of the improperly updated extent generation.  Thanks,

Signed-off-by: Josef Bacik 
Signed-off-by: Chris Mason 
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques 
---
 fs/btrfs/disk-io.c  | 20 
 fs/btrfs/ordered-data.c |  9 +++--
 fs/btrfs/ordered-data.h |  8 +++-
 fs/btrfs/transaction.c  | 33 +
 fs/btrfs/transaction.h  |  2 ++
 fs/btrfs/tree-log.c |  6 +++---
 6 files changed, 72 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 0229c3720b30..de92db33ec7a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -4065,6 +4065,25 @@ again:
return 0;
 }
 
+static void btrfs_free_pending_ordered(struct btrfs_transaction *cur_trans,
+  struct btrfs_fs_info *fs_info)
+{
+   struct btrfs_ordered_extent *ordered;
+
+   spin_lock(_info->trans_lock);
+   while (!list_empty(_trans->pending_ordered)) {
+   ordered = list_first_entry(_trans->pending_ordered,
+  struct btrfs_ordered_extent,
+  trans_list);
+   list_del_init(>trans_list);
+   spin_unlock(_info->trans_lock);
+
+   btrfs_put_ordered_extent(ordered);
+   spin_lock(_info->trans_lock);
+   }
+   spin_unlock(_info->trans_lock);
+}
+
 void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
   struct btrfs_root *root)
 {
@@ -4076,6 +4095,7 @@ void btrfs_cleanup_one_transaction(struct 
btrfs_transaction *cur_trans,
cur_trans->state = TRANS_STATE_UNBLOCKED;
wake_up(>fs_info->transaction_wait);
 
+   btrfs_free_pending_ordered(cur_trans, root->fs_info);
btrfs_destroy_delayed_inodes(root);
btrfs_assert_delayed_root_empty(root);
 
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index ac734ec4cc20..269e21dd1506 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -220,6 +220,7 @@ static int __btrfs_add_ordered_extent(struct inode *inode, 
u64 file_offset,
INIT_LIST_HEAD(>work_list);
init_completion(>completion);
INIT_LIST_HEAD(>log_list);
+   INIT_LIST_HEAD(>trans_list);
 
trace_btrfs_ordered_extent_add(inode, entry);
 
@@ -443,6 +444,8 @@ void btrfs_get_logged_extents(struct inode *inode,
ordered = rb_entry(n, struct btrfs_ordered_extent, rb_node);
if (!list_empty(>log_list))
continue;
+   if (test_bit(BTRFS_ORDERED_LOGGED, >flags))
+   continue;
list_add_tail(>log_list, logged_list);
atomic_inc(>refs);
}
@@ -472,7 +475,8 @@ void btrfs_submit_logged_extents(struct list_head 
*logged_list,
spin_unlock_irq(>log_extents_lock[index]);
 }
 
-void btrfs_wait_logged_extents(struct btrfs_root *log, u64 transid)
+void btrfs_wait_logged_extents(struct btrfs_trans_handle *trans,
+  struct btrfs_root *log, u64 transid)
 {
struct btrfs_ordered_extent *ordered;
int index = transid % 2;
@@ -497,7 +501,8 @@ void btrfs_wait_logged_extents(struct btrfs_root *log, u64 
transid)
wait_event(ordered->wait, test_bit(BTRFS_ORDERED_IO_DONE,
   >flags));
 
-   btrfs_put_ordered_extent(ordered);
+   if (!test_and_set_bit(BTRFS_ORDERED_LOGGED, >flags))
+   list_add_tail(>trans_list, >ordered);
spin_lock_irq(>log_extents_lock[index]);
}
spin_unlock_irq(>log_extents_lock[index]);
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index d81a274d621e..0124bffc775f 100644
--- a/fs/btrfs/ordered-data.h

[PATCH 3.16.y-ckt 113/216] x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: Andy Lutomirski 

commit 29fa6825463c97e5157284db80107d1bfac5d77b upstream.

paravirt_enabled has the following effects:

 - Disables the F00F bug workaround warning.  There is no F00F bug
   workaround any more because Linux's standard IDT handling already
   works around the F00F bug, but the warning still exists.  This
   is only cosmetic, and, in any event, there is no such thing as
   KVM on a CPU with the F00F bug.

 - Disables 32-bit APM BIOS detection.  On a KVM paravirt system,
   there should be no APM BIOS anyway.

 - Disables tboot.  I think that the tboot code should check the
   CPUID hypervisor bit directly if it matters.

 - paravirt_enabled disables espfix32.  espfix32 should *not* be
   disabled under KVM paravirt.

The last point is the purpose of this patch.  It fixes a leak of the
high 16 bits of the kernel stack address on 32-bit KVM paravirt
guests.  Fixes CVE-2014-8134.

Suggested-by: Konrad Rzeszutek Wilk 
Signed-off-by: Andy Lutomirski 
Signed-off-by: Paolo Bonzini 
Signed-off-by: Luis Henriques 
---
 arch/x86/kernel/kvm.c  | 9 -
 arch/x86/kernel/kvmclock.c | 1 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 3dd8e2c4d74a..07de51f66deb 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -282,7 +282,14 @@ NOKPROBE_SYMBOL(do_async_page_fault);
 static void __init paravirt_ops_setup(void)
 {
pv_info.name = "KVM";
-   pv_info.paravirt_enabled = 1;
+
+   /*
+* KVM isn't paravirt in the sense of paravirt_enabled.  A KVM
+* guest kernel works like a bare metal kernel with additional
+* features, and paravirt_enabled is about features that are
+* missing.
+*/
+   pv_info.paravirt_enabled = 0;
 
if (kvm_para_has_feature(KVM_FEATURE_NOP_IO_DELAY))
pv_cpu_ops.io_delay = kvm_io_delay;
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index d9156ceecdff..a2de9bc7ac0b 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -263,7 +263,6 @@ void __init kvmclock_init(void)
 #endif
kvm_get_preset_lpj();
clocksource_register_hz(_clock, NSEC_PER_SEC);
-   pv_info.paravirt_enabled = 1;
pv_info.name = "KVM";
 
if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT))
-- 
2.1.4

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


[PATCH 3.16.y-ckt 127/216] userns: Add a knob to disable setgroups on a per user namespace basis

2015-01-12 Thread Luis Henriques
3.16.7-ckt4 -stable review patch.  If anyone has any objections, please let me 
know.

--

From: "Eric W. Biederman" 

commit 9cc46516ddf497ea16e8d7cb986ae03a0f6b92f8 upstream.

- Expose the knob to user space through a proc file /proc//setgroups

  A value of "deny" means the setgroups system call is disabled in the
  current processes user namespace and can not be enabled in the
  future in this user namespace.

  A value of "allow" means the segtoups system call is enabled.

- Descendant user namespaces inherit the value of setgroups from
  their parents.

- A proc file is used (instead of a sysctl) as sysctls currently do
  not allow checking the permissions at open time.

- Writing to the proc file is restricted to before the gid_map
  for the user namespace is set.

  This ensures that disabling setgroups at a user namespace
  level will never remove the ability to call setgroups
  from a process that already has that ability.

  A process may opt in to the setgroups disable for itself by
  creating, entering and configuring a user namespace or by calling
  setns on an existing user namespace with setgroups disabled.
  Processes without privileges already can not call setgroups so this
  is a noop.  Prodcess with privilege become processes without
  privilege when entering a user namespace and as with any other path
  to dropping privilege they would not have the ability to call
  setgroups.  So this remains within the bounds of what is possible
  without a knob to disable setgroups permanently in a user namespace.

Signed-off-by: "Eric W. Biederman" 
Signed-off-by: Luis Henriques 
---
 fs/proc/base.c | 53 ++
 include/linux/user_namespace.h |  7 
 kernel/user.c  |  1 +
 kernel/user_namespace.c| 85 ++
 4 files changed, 146 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 2d696b0c93bf..71d855747fe8 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2526,6 +2526,57 @@ static const struct file_operations 
proc_projid_map_operations = {
.llseek = seq_lseek,
.release= proc_id_map_release,
 };
+
+static int proc_setgroups_open(struct inode *inode, struct file *file)
+{
+   struct user_namespace *ns = NULL;
+   struct task_struct *task;
+   int ret;
+
+   ret = -ESRCH;
+   task = get_proc_task(inode);
+   if (task) {
+   rcu_read_lock();
+   ns = get_user_ns(task_cred_xxx(task, user_ns));
+   rcu_read_unlock();
+   put_task_struct(task);
+   }
+   if (!ns)
+   goto err;
+
+   if (file->f_mode & FMODE_WRITE) {
+   ret = -EACCES;
+   if (!ns_capable(ns, CAP_SYS_ADMIN))
+   goto err_put_ns;
+   }
+
+   ret = single_open(file, _setgroups_show, ns);
+   if (ret)
+   goto err_put_ns;
+
+   return 0;
+err_put_ns:
+   put_user_ns(ns);
+err:
+   return ret;
+}
+
+static int proc_setgroups_release(struct inode *inode, struct file *file)
+{
+   struct seq_file *seq = file->private_data;
+   struct user_namespace *ns = seq->private;
+   int ret = single_release(inode, file);
+   put_user_ns(ns);
+   return ret;
+}
+
+static const struct file_operations proc_setgroups_operations = {
+   .open   = proc_setgroups_open,
+   .write  = proc_setgroups_write,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= proc_setgroups_release,
+};
 #endif /* CONFIG_USER_NS */
 
 static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
@@ -2634,6 +2685,7 @@ static const struct pid_entry tgid_base_stuff[] = {
REG("uid_map",S_IRUGO|S_IWUSR, proc_uid_map_operations),
REG("gid_map",S_IRUGO|S_IWUSR, proc_gid_map_operations),
REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
+   REG("setgroups",  S_IRUGO|S_IWUSR, proc_setgroups_operations),
 #endif
 #ifdef CONFIG_CHECKPOINT_RESTORE
REG("timers", S_IRUGO, proc_timers_operations),
@@ -2969,6 +3021,7 @@ static const struct pid_entry tid_base_stuff[] = {
REG("uid_map",S_IRUGO|S_IWUSR, proc_uid_map_operations),
REG("gid_map",S_IRUGO|S_IWUSR, proc_gid_map_operations),
REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
+   REG("setgroups",  S_IRUGO|S_IWUSR, proc_setgroups_operations),
 #endif
 };
 
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index dd4f91b99b04..e92abf9e796f 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -17,6 +17,10 @@ struct uid_gid_map { /* 64 bytes -- 1 cache line */
} extent[UID_GID_MAP_MAX_EXTENTS];
 };
 
+#define USERNS_SETGROUPS_ALLOWED 1UL
+
+#define USERNS_INIT_FLAGS USERNS_SETGROUPS_ALLOWED
+
 struct user_namespace {
struct 

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