platform/kernel/linux-3.10.git
9 years agopackaging: update kernel version to 3.10.33
Chanho Park [Mon, 24 Mar 2014 05:12:04 +0000 (14:12 +0900)]
packaging: update kernel version to 3.10.33

Recently, we updated the kernel version from 3.10.19 to 3.10.33.
This patch also updates the kernel version in the spec file.

Change-Id: Ifc5239ea428e2178aa70ddd3b94364fdbb7ebe79
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agovmpressure: make sure there are no events queued after memcg is offlined
Michal Hocko [Wed, 31 Jul 2013 20:53:51 +0000 (13:53 -0700)]
vmpressure: make sure there are no events queued after memcg is offlined

vmpressure is called synchronously from reclaim where the target_memcg
is guaranteed to be alive but the eventfd is signaled from the work
queue context.  This means that memcg (along with vmpressure structure
which is embedded into it) might go away while the work item is pending
which would result in use-after-release bug.

We have two possible ways how to fix this.  Either vmpressure pins memcg
before it schedules vmpr->work and unpin it in vmpressure_work_fn or
explicitely flush the work item from the css_offline context (as
suggested by Tejun).

This patch implements the later one and it introduces vmpressure_cleanup
which flushes the vmpressure work queue item item.  It hooks into
mem_cgroup_css_offline after the memcg itself is cleaned up.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Tejun Heo <tj@kernel.org>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: I1deefca16b6e243f86bd78b84c561db02e7a20e8

9 years agovmpressure: do not check for pending work to prevent from new work
Michal Hocko [Wed, 31 Jul 2013 20:53:50 +0000 (13:53 -0700)]
vmpressure: do not check for pending work to prevent from new work

because it is racy and it doesn't give us much anyway as schedule_work
handles this case already.

Change-Id: I9946652da98eef2ed0312a5470e69db13fab0e4c
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Tejun Heo <tj@kernel.org>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agovmpressure: change vmpressure::sr_lock to spinlock
Michal Hocko [Wed, 31 Jul 2013 20:53:48 +0000 (13:53 -0700)]
vmpressure: change vmpressure::sr_lock to spinlock

There is nothing that can sleep inside critical sections protected by
this lock and those sections are really small so there doesn't make much
sense to use mutex for them.  Change the log to a spinlock

Change-Id: I54c8361a88ec810676cf631f3754c5b860d54b01
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Tejun Heo <tj@kernel.org>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agotizen: enable zswap/zsmalloc/zbud to compress swap memory
Chanho Park [Fri, 21 Mar 2014 07:24:26 +0000 (16:24 +0900)]
tizen: enable zswap/zsmalloc/zbud to compress swap memory

Change-Id: Iccf427f0acecad261b7cd8baa7114ecf9a421914
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
9 years agomodem: sipc4: Chagne the manner of recieving data for FMT,RFS type device
Jonghwa Lee [Thu, 20 Mar 2014 07:19:31 +0000 (16:19 +0900)]
modem: sipc4: Chagne the manner of recieving data for FMT,RFS type device

When packet arrives, link device call iodev's helper function to recieve
packets. The way of recieving data of IPC_FMT and IPC_RFS type iodevs differs
from IPC_RAW and IPC_MULTI_RAW. This patch adds specified method of recieving
data for FMT, RFS typed.

This modification references TIZEN 2.2 kernel.

Change-Id: I01efa7678bbabfbd1011ceba42571fc221313c4d
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agodrm/exynos: remove DRIVER_HAVE_IRQ feature
Joonyoung Shim [Thu, 20 Mar 2014 08:09:46 +0000 (17:09 +0900)]
drm/exynos: remove DRIVER_HAVE_IRQ feature

Exynos drm driver cannot support DRIVER_HAVE_IRQ feature because it uses
driver specific one instead of routine of drm framework to
install/uninstall irq handler.

Change-Id: I5796d7113cbc4283cbb41591384aaa69011818d4
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agorbtree: fix rbtree_postorder_for_each_entry_safe() iterator
Jan Kara [Tue, 12 Nov 2013 23:11:19 +0000 (15:11 -0800)]
rbtree: fix rbtree_postorder_for_each_entry_safe() iterator

The iterator rbtree_postorder_for_each_entry_safe() relies on pointer
underflow behavior when testing for loop termination.  In particular it
expects that

  &rb_entry(NULL, type, field)->field

is NULL.  But the result of this expression is not defined by a C standard
and some gcc versions (e.g.  4.3.4) assume the above expression can never
be equal to NULL.  The net result is an oops because the iteration is not
properly terminated.

Fix the problem by modifying the iterator to avoid pointer underflows.

Change-Id: I06d5983b5335412be6cb6ebd95db3c682e26ed38
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: <stable@vger.kernel.org> [3.12.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agorbtree: add rbtree_postorder_for_each_entry_safe() helper
Cody P Schafer [Wed, 11 Sep 2013 21:25:11 +0000 (14:25 -0700)]
rbtree: add rbtree_postorder_for_each_entry_safe() helper

Because deletion (of the entire tree) is a relatively common use of the
rbtree_postorder iteration, and because doing it safely means fiddling
with temporary storage, provide a helper to simplify postorder rbtree
iteration.

Change-Id: I8442bc3efc79dca08bfbc6ebb63607cf4e83bcf6
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agorbtree: add postorder iteration functions
Cody P Schafer [Wed, 11 Sep 2013 21:25:10 +0000 (14:25 -0700)]
rbtree: add postorder iteration functions

Postorder iteration yields all of a node's children prior to yielding the
node itself, and this particular implementation also avoids examining the
leaf links in a node after that node has been yielded.

In what I expect will be its most common usage, postorder iteration allows
the deletion of every node in an rbtree without modifying the rbtree nodes
(no _requirement_ that they be nulled) while avoiding referencing child
nodes after they have been "deleted" (most commonly, freed).

I have only updated zswap to use this functionality at this point, but
numerous bits of code (most notably in the filesystem drivers) use a hand
rolled postorder iteration that NULLs child links as it traverses the
tree.  Each of those instances could be replaced with this common
implementation.

1 & 2 add rbtree postorder iteration functions.
3 adds testing of the iteration to the rbtree runtime tests
4 allows building the rbtree runtime tests as builtins
5 updates zswap.

This patch:

Add postorder iteration functions for rbtree.  These are useful for safely
freeing an entire rbtree without modifying the tree at all.

Change-Id: Ibc97f0e13288030501b5e84defc6603eeb1adca6
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap.c: change params from hidden to ro
Dan Streetman [Thu, 23 Jan 2014 23:52:48 +0000 (15:52 -0800)]
mm/zswap.c: change params from hidden to ro

The "compressor" and "enabled" params are currently hidden, this changes
them to read-only, so userspace can tell if zswap is enabled or not and
see what compressor is in use.

Change-Id: I42d8ac2544ccbf981de26d98b772417e183360f6
Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Cc: Vladimir Murzin <murzin.v@gmail.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Weijie Yang <weijie.yang@samsung.com>
Acked-by: Seth Jennings <sjennings@variantweb.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap: refactor the get/put routines
Weijie Yang [Tue, 12 Nov 2013 23:08:27 +0000 (15:08 -0800)]
mm/zswap: refactor the get/put routines

The refcount routine was not fit the kernel get/put semantic exactly,
There were too many judgement statements on refcount and it could be
minus.

This patch does the following:

 - move refcount judgement to zswap_entry_put() to hide resource free function.

 - add a new function zswap_entry_find_get(), so that callers can use
   easily in the following pattern:

     zswap_entry_find_get
     .../* do something */
     zswap_entry_put

 - to eliminate compile error, move some functions declaration

This patch is based on Minchan Kim <minchan@kernel.org> 's idea and suggestion.

Change-Id: I8510ffe4f49a1a5f00b53be89b2ee33854464db8
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Cc: Seth Jennings <sjennings@variantweb.net>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap: bugfix: memory leak when invalidate and reclaim occur concurrently
Weijie Yang [Tue, 12 Nov 2013 23:08:26 +0000 (15:08 -0800)]
mm/zswap: bugfix: memory leak when invalidate and reclaim occur concurrently

Consider the following scenario:

thread 0: reclaim entry x (get refcount, but not call zswap_get_swap_cache_page)
thread 1: call zswap_frontswap_invalidate_page to invalidate entry x.
finished, entry x and its zbud is not freed as its refcount != 0
now, the swap_map[x] = 0
thread 0: now call zswap_get_swap_cache_page
swapcache_prepare return -ENOENT because entry x is not used any more
zswap_get_swap_cache_page return ZSWAP_SWAPCACHE_NOMEM
zswap_writeback_entry do nothing except put refcount

Now, the memory of zswap_entry x and its zpage leak.

Modify:
 - check the refcount in fail path, free memory if it is not referenced.

 - use ZSWAP_SWAPCACHE_FAIL instead of ZSWAP_SWAPCACHE_NOMEM as the fail path
   can be not only caused by nomem but also by invalidate.

Change-Id: I3d76f21a11f2d9ff0bec412c90b3895efce6478d
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap: avoid unnecessary page scanning
Weijie Yang [Tue, 12 Nov 2013 23:07:52 +0000 (15:07 -0800)]
mm/zswap: avoid unnecessary page scanning

Add SetPageReclaim() before __swap_writepage() so that page can be moved
to the tail of the inactive list, which can avoid unnecessary page
scanning as this page was reclaimed by swap subsystem before.

Change-Id: If1ed52e3161c332d9f1f6fdd8851e97b5d3b4271
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap: bugfix: memory leak when re-swapon
Weijie Yang [Wed, 16 Oct 2013 20:46:54 +0000 (13:46 -0700)]
mm/zswap: bugfix: memory leak when re-swapon

zswap_tree is not freed when swapoff, and it got re-kmalloced in swapon,
so a memory leak occurs.

Free the memory of zswap_tree in zswap_frontswap_invalidate_area().

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
From: Weijie Yang <weijie.yang@samsung.com>
Subject: mm/zswap: bugfix: memory leak when invalidate and reclaim occur concurrently

Consider the following scenario:
thread 0: reclaim entry x (get refcount, but not call zswap_get_swap_cache_page)
thread 1: call zswap_frontswap_invalidate_page to invalidate entry x.
finished, entry x and its zbud is not freed as its refcount != 0
now, the swap_map[x] = 0
thread 0: now call zswap_get_swap_cache_page
swapcache_prepare return -ENOENT because entry x is not used any more
zswap_get_swap_cache_page return ZSWAP_SWAPCACHE_NOMEM
zswap_writeback_entry do nothing except put refcount
Now, the memory of zswap_entry x and its zpage leak.

Modify:
 - check the refcount in fail path, free memory if it is not referenced.

 - use ZSWAP_SWAPCACHE_FAIL instead of ZSWAP_SWAPCACHE_NOMEM as the fail path
   can be not only caused by nomem but also by invalidate.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Change-Id: I4a875e48714d73bf2c1f75b60d90776365c047de
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap: use postorder iteration when destroying rbtree
Cody P Schafer [Wed, 11 Sep 2013 21:25:33 +0000 (14:25 -0700)]
mm/zswap: use postorder iteration when destroying rbtree

Change-Id: I83b93b7eaadb7c66981f1119eda1119c978d1b9c
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zbud: fix some trivial typos in comments
Jianguo Wu [Wed, 11 Sep 2013 21:21:42 +0000 (14:21 -0700)]
mm/zbud: fix some trivial typos in comments

Change-Id: I1acb8c1f4ff9ab8dbd698380a731daef51d028fc
Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm/zswap.c: get swapper address_space by using macro
Sunghan Suh [Wed, 11 Sep 2013 21:20:22 +0000 (14:20 -0700)]
mm/zswap.c: get swapper address_space by using macro

There is a proper macro to get the corresponding swapper address space
from a swap entry.  Instead of directly accessing "swapper_spaces" array,
use the "swap_address_space" macro.

Change-Id: I145f9a3fad914ff83853cd80c60af61f40eab1cf
Signed-off-by: Sunghan Suh <sunghan.suh@samsung.com>
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm: zbud: fix condition check on allocation size
Heesub Shin [Wed, 31 Jul 2013 20:53:40 +0000 (13:53 -0700)]
mm: zbud: fix condition check on allocation size

zbud_alloc() incorrectly verifies the size of allocation limit.  It
should deny the allocation request greater than (PAGE_SIZE -
ZHDR_SIZE_ALIGNED - CHUNK_SIZE), not (PAGE_SIZE - ZHDR_SIZE_ALIGNED)
which has no remaining spaces for its buddy.  There is no point in
spending the entire zbud page storing only a single page, since we don't
have any benefits.

Change-Id: Ief305088b6983c01426300a0638520f51b17ad2a
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Dongjun Shin <d.j.shin@samsung.com>
Cc: Sunae Seo <sunae.seo@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: remove zram->lock in read path and change it with mutex
Minchan Kim [Thu, 30 Jan 2014 23:46:06 +0000 (15:46 -0800)]
zram: remove zram->lock in read path and change it with mutex

Finally, we separated zram->lock dependency from 32bit stat/ table
handling so there is no reason to use rw_semaphore between read and
write path so this patch removes the lock from read path totally and
changes rw_semaphore with mutex.  So, we could do

old:

  read-read: OK
  read-write: NO
  write-write: NO

Now:

  read-read: OK
  read-write: OK
  write-write: NO

The below data proves mixed workload performs well 11 times and there is
also enhance on write-write path because current rw-semaphore doesn't
support SPIN_ON_OWNER.  It's side effect but anyway good thing for us.

Write-related tests perform better (from 61% to 1058%) but read path has
good/bad(from -2.22% to 1.45%) but they are all marginal within stddev.

  CPU 12
  iozone -t -T -l 12 -u 12 -r 16K -s 60M -I +Z -V 0

  ==Initial write                ==Initial write
  records: 10                    records: 10
  avg:  516189.16                avg:  839907.96
  std:   22486.53 (4.36%)        std:   47902.17 (5.70%)
  max:  546970.60                max:  909910.35
  min:  481131.54                min:  751148.38
  ==Rewrite                      ==Rewrite
  records: 10                    records: 10
  avg:  509527.98                avg: 1050156.37
  std:   45799.94 (8.99%)        std:   40695.44 (3.88%)
  max:  611574.27                max: 1111929.26
  min:  443679.95                min:  980409.62
  ==Read                         ==Read
  records: 10                    records: 10
  avg: 4408624.17                avg: 4472546.76
  std:  281152.61 (6.38%)        std:  163662.78 (3.66%)
  max: 4867888.66                max: 4727351.03
  min: 4058347.69                min: 4126520.88
  ==Re-read                      ==Re-read
  records: 10                    records: 10
  avg: 4462147.53                avg: 4363257.75
  std:  283546.11 (6.35%)        std:  247292.63 (5.67%)
  max: 4912894.44                max: 4677241.75
  min: 4131386.50                min: 4035235.84
  ==Reverse Read                 ==Reverse Read
  records: 10                    records: 10
  avg: 4565865.97                avg: 4485818.08
  std:  313395.63 (6.86%)        std:  248470.10 (5.54%)
  max: 5232749.16                max: 4789749.94
  min: 4185809.62                min: 3963081.34
  ==Stride read                  ==Stride read
  records: 10                    records: 10
  avg: 4515981.80                avg: 4418806.01
  std:  211192.32 (4.68%)        std:  212837.97 (4.82%)
  max: 4889287.28                max: 4686967.22
  min: 4210362.00                min: 4083041.84
  ==Random read                  ==Random read
  records: 10                    records: 10
  avg: 4410525.23                avg: 4387093.18
  std:  236693.22 (5.37%)        std:  235285.23 (5.36%)
  max: 4713698.47                max: 4669760.62
  min: 4057163.62                min: 3952002.16
  ==Mixed workload               ==Mixed workload
  records: 10                    records: 10
  avg:  243234.25                avg: 2818677.27
  std:   28505.07 (11.72%)       std:  195569.70 (6.94%)
  max:  288905.23                max: 3126478.11
  min:  212473.16                min: 2484150.69
  ==Random write                 ==Random write
  records: 10                    records: 10
  avg:  555887.07                avg: 1053057.79
  std:   70841.98 (12.74%)       std:   35195.36 (3.34%)
  max:  683188.28                max: 1096125.73
  min:  437299.57                min:  992481.93
  ==Pwrite                       ==Pwrite
  records: 10                    records: 10
  avg:  501745.93                avg:  810363.09
  std:   16373.54 (3.26%)        std:   19245.01 (2.37%)
  max:  518724.52                max:  833359.70
  min:  464208.73                min:  765501.87
  ==Pread                        ==Pread
  records: 10                    records: 10
  avg: 4539894.60                avg: 4457680.58
  std:  197094.66 (4.34%)        std:  188965.60 (4.24%)
  max: 4877170.38                max: 4689905.53
  min: 4226326.03                min: 4095739.72

Change-Id: I7d2299149ce6982d76caaaadb936b7385cbee515
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: remove workqueue for freeing removed pending slot
Minchan Kim [Thu, 30 Jan 2014 23:46:04 +0000 (15:46 -0800)]
zram: remove workqueue for freeing removed pending slot

Commit a0c516cbfc74 ("zram: don't grab mutex in zram_slot_free_noity")
introduced free request pending code to avoid scheduling by mutex under
spinlock and it was a mess which made code lenghty and increased
overhead.

Now, we don't need zram->lock any more to free slot so this patch
reverts it and then, tb_lock should protect it.

Change-Id: I3429e568bab78c197da3fc5cbd5afb9355bf7d21
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: introduce zram->tb_lock
Minchan Kim [Thu, 30 Jan 2014 23:46:03 +0000 (15:46 -0800)]
zram: introduce zram->tb_lock

Currently, the zram table is protected by zram->lock but it's rather
coarse-grained lock and it makes hard for scalibility.

Let's use own rwlock instead of depending on zram->lock.  This patch
adds new locking so obviously, it would make slow but this patch is just
prepartion for removing coarse-grained rw_semaphore(ie, zram->lock)
which is hurdle about zram scalability.

Final patch in this patchset series will remove the lock from read-path
and change rw_semaphore with mutex in write path.  With bonus, we could
drop pending slot free mess in next patch.

Change-Id: If5456f871bc6b0d6ee1f8218fde3f5a13d261c8b
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: use atomic operation for stat
Minchan Kim [Thu, 30 Jan 2014 23:46:02 +0000 (15:46 -0800)]
zram: use atomic operation for stat

Some of fields in zram->stats are protected by zram->lock which is
rather coarse-grained so let's use atomic operation without explict
locking.

This patch is ready for removing dependency of zram->lock in read path
which is very coarse-grained rw_semaphore.  Of course, this patch adds
new atomic operation so it might make slow but my 12CPU test couldn't
spot any regression.  All gain/lose is marginal within stddev.

  iozone -t -T -l 12 -u 12 -r 16K -s 60M -I +Z -V 0

  ==Initial write                ==Initial write
  records: 50                    records: 50
  avg:  412875.17                avg:  415638.23
  std:   38543.12 (9.34%)        std:   36601.11 (8.81%)
  max:  521262.03                max:  502976.72
  min:  343263.13                min:  351389.12
  ==Rewrite                      ==Rewrite
  records: 50                    records: 50
  avg:  416640.34                avg:  397914.33
  std:   60798.92 (14.59%)       std:   46150.42 (11.60%)
  max:  543057.07                max:  522669.17
  min:  304071.67                min:  316588.77
  ==Read                         ==Read
  records: 50                    records: 50
  avg: 4147338.63                avg: 4070736.51
  std:  179333.25 (4.32%)        std:  223499.89 (5.49%)
  max: 4459295.28                max: 4539514.44
  min: 3753057.53                min: 3444686.31
  ==Re-read                      ==Re-read
  records: 50                    records: 50
  avg: 4096706.71                avg: 4117218.57
  std:  229735.04 (5.61%)        std:  171676.25 (4.17%)
  max: 4430012.09                max: 4459263.94
  min: 2987217.80                min: 3666904.28
  ==Reverse Read                 ==Reverse Read
  records: 50                    records: 50
  avg: 4062763.83                avg: 4078508.32
  std:  186208.46 (4.58%)        std:  172684.34 (4.23%)
  max: 4401358.78                max: 4424757.22
  min: 3381625.00                min: 3679359.94
  ==Stride read                  ==Stride read
  records: 50                    records: 50
  avg: 4094933.49                avg: 4082170.22
  std:  185710.52 (4.54%)        std:  196346.68 (4.81%)
  max: 4478241.25                max: 4460060.97
  min: 3732593.23                min: 3584125.78
  ==Random read                  ==Random read
  records: 50                    records: 50
  avg: 4031070.04                avg: 4074847.49
  std:  192065.51 (4.76%)        std:  206911.33 (5.08%)
  max: 4356931.16                max: 4399442.56
  min: 3481619.62                min: 3548372.44
  ==Mixed workload               ==Mixed workload
  records: 50                    records: 50
  avg:  149925.73                avg:  149675.54
  std:    7701.26 (5.14%)        std:    6902.09 (4.61%)
  max:  191301.56                max:  175162.05
  min:  133566.28                min:  137762.87
  ==Random write                 ==Random write
  records: 50                    records: 50
  avg:  404050.11                avg:  393021.47
  std:   58887.57 (14.57%)       std:   42813.70 (10.89%)
  max:  601798.09                max:  524533.43
  min:  325176.99                min:  313255.34
  ==Pwrite                       ==Pwrite
  records: 50                    records: 50
  avg:  411217.70                avg:  411237.96
  std:   43114.99 (10.48%)       std:   33136.29 (8.06%)
  max:  530766.79                max:  471899.76
  min:  320786.84                min:  317906.94
  ==Pread                        ==Pread
  records: 50                    records: 50
  avg: 4154908.65                avg: 4087121.92
  std:  151272.08 (3.64%)        std:  219505.04 (5.37%)
  max: 4459478.12                max: 4435857.38
  min: 3730512.41                min: 3101101.67

Change-Id: Ib0d538597fbc4a2037b0464f8d62fb73fa0b0c24
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: remove unnecessary free
Minchan Kim [Thu, 30 Jan 2014 23:46:01 +0000 (15:46 -0800)]
zram: remove unnecessary free

Commit a0c516cbfc74 ("zram: don't grab mutex in zram_slot_free_noity")
introduced pending zram slot free in zram's write path in case of
missing slot free by memory allocation failure in zram_slot_free_notify
but it is not necessary because we have already freed the slot right
before overwriting.

Change-Id: I5048bce2ca8c377d9539f0397a04bddc5f5a5e92
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jerome Marchand <jmarchan@redhat.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: delay pending free request in read path
Minchan Kim [Thu, 30 Jan 2014 23:46:00 +0000 (15:46 -0800)]
zram: delay pending free request in read path

Sergey reported we don't need to handle pending free request every I/O
so that this patch removes it in read path while we remain it in write
path.

Let's consider below example.

Swap subsystem ask to zram "A" block free by swap_slot_free_notify but
zram had been pended it without real freeing.  Swap subsystem allocates
"A" block for new data but request pended for a long time just handled
and zram blindly free new data on the "A" block.  :(

That's why we couldn't remove handle pending free request right before
zram-write.

Change-Id: Ib4409bfad7b1ae263e2708c74875c322da72c7b3
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: fix race between reset and flushing pending work
Minchan Kim [Thu, 30 Jan 2014 23:45:58 +0000 (15:45 -0800)]
zram: fix race between reset and flushing pending work

Dan and Sergey reported that there is a racy between reset and flushing
of pending work so that it could make oops by freeing zram->meta in
reset while zram_slot_free can access zram->meta if new request is
adding during the race window.

This patch moves flush after taking init_lock so it prevents new request
so that it closes the race.

Change-Id: Ibc09001d1ad4a4ef852d661384259b53f0f9c19b
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jerome Marchand <jmarchan@redhat.com>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozsmalloc: add maintainers
Minchan Kim [Thu, 30 Jan 2014 23:45:57 +0000 (15:45 -0800)]
zsmalloc: add maintainers

tAdd adds maintainer information for zsmalloc into the MAINTAINERS file.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
MAINTAINERS

Change-Id: I315effbbfbd5aabb96dcadd1d35d9592ee24182d

9 years agozram: add zram maintainers
Minchan Kim [Thu, 30 Jan 2014 23:45:56 +0000 (15:45 -0800)]
zram: add zram maintainers

Add maintainer information for zram into the MAINTAINERS file.

Change-Id: I8a6b11120f55b76aeccf18ce004293721e48081a
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozsmalloc: add copyright
Minchan Kim [Thu, 30 Jan 2014 23:45:55 +0000 (15:45 -0800)]
zsmalloc: add copyright

Add my copyright to the zsmalloc source code which I maintain.

Change-Id: Ic3dd8dd11297ef902f4cb913e40c52249282d947
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: add copyright
Minchan Kim [Thu, 30 Jan 2014 23:45:55 +0000 (15:45 -0800)]
zram: add copyright

Add my copyright to the zram source code which I maintain.

Change-Id: I8816064aa958c9304c53fae0972e011060cc2bcc
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: remove old private project comment
Minchan Kim [Thu, 30 Jan 2014 23:45:54 +0000 (15:45 -0800)]
zram: remove old private project comment

Remove the old private compcache project address so upcoming patches
should be sent to LKML because we Linux kernel community will take care.

Change-Id: Ia5bf208791c8fa6e96161fd9fb842d6829f14698
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agozram: promote zram from staging
Minchan Kim [Thu, 30 Jan 2014 23:45:52 +0000 (15:45 -0800)]
zram: promote zram from staging

Zram has lived in staging for a LONG LONG time and have been
fixed/improved by many contributors so code is clean and stable now.  Of
course, there are lots of product using zram in real practice.

The major TV companys have used zram as swap since two years ago and
recently our production team released android smart phone with zram
which is used as swap, too and recently Android Kitkat start to use zram
for small memory smart phone.  And there was a report Google released
their ChromeOS with zram, too and cyanogenmod have been used zram long
time ago.  And I heard some disto have used zram block device for tmpfs.
In addition, I saw many report from many other peoples.  For example,
Lubuntu start to use it.

The benefit of zram is very clear.  With my experience, one of the
benefit was to remove jitter of video application with backgroud memory
pressure.  It would be effect of efficient memory usage by compression
but more issue is whether swap is there or not in the system.  Recent
mobile platforms have used JAVA so there are many anonymous pages.  But
embedded system normally are reluctant to use eMMC or SDCard as swap
because there is wear-leveling and latency issues so if we do not use
swap, it means we can't reclaim anoymous pages and at last, we could
encounter OOM kill.  :(

Although we have real storage as swap, it was a problem, too.  Because
it sometime ends up making system very unresponsible caused by slow swap
storage performance.

Quote from Luigi on Google
 "Since Chrome OS was mentioned: the main reason why we don't use swap
  to a disk (rotating or SSD) is because it doesn't degrade gracefully
  and leads to a bad interactive experience.  Generally we prefer to
  manage RAM at a higher level, by transparently killing and restarting
  processes.  But we noticed that zram is fast enough to be competitive
  with the latter, and it lets us make more efficient use of the
  available RAM.  " and he announced.
http://www.spinics.net/lists/linux-mm/msg57717.html

Other uses case is to use zram for block device.  Zram is block device
so anyone can format the block device and mount on it so some guys on
the internet start zram as /var/tmp.
http://forums.gentoo.org/viewtopic-t-838198-start-0.html

Let's promote zram and enhance/maintain it instead of removing.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Luigi Semenzato <semenzato@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
drivers/block/Makefile

Change-Id: I368f76a5368fffaacbf349cfd78f79cba5da0a0d

9 years agozsmalloc: move it under mm
Minchan Kim [Thu, 30 Jan 2014 23:45:50 +0000 (15:45 -0800)]
zsmalloc: move it under mm

This patch moves zsmalloc under mm directory.

Before that, description will explain why we have needed custom
allocator.

Zsmalloc is a new slab-based memory allocator for storing compressed
pages.  It is designed for low fragmentation and high allocation success
rate on large object, but <= PAGE_SIZE allocations.

zsmalloc differs from the kernel slab allocator in two primary ways to
achieve these design goals.

zsmalloc never requires high order page allocations to back slabs, or
"size classes" in zsmalloc terms.  Instead it allows multiple
single-order pages to be stitched together into a "zspage" which backs
the slab.  This allows for higher allocation success rate under memory
pressure.

Also, zsmalloc allows objects to span page boundaries within the zspage.
This allows for lower fragmentation than could be had with the kernel
slab allocator for objects between PAGE_SIZE/2 and PAGE_SIZE.  With the
kernel slab allocator, if a page compresses to 60% of it original size,
the memory savings gained through compression is lost in fragmentation
because another object of the same size can't be stored in the leftover
space.

This ability to span pages results in zsmalloc allocations not being
directly addressable by the user.  The user is given an
non-dereferencable handle in response to an allocation request.  That
handle must be mapped, using zs_map_object(), which returns a pointer to
the mapped region that can be used.  The mapping is necessary since the
object data may reside in two different noncontigious pages.

The zsmalloc fulfills the allocation needs for zram perfectly

[sjenning@linux.vnet.ibm.com: borrow Seth's quote]
Signed-off-by: Minchan Kim <minchan@kernel.org>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Luigi Semenzato <semenzato@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Conflicts:
mm/Kconfig

Change-Id: I57dad090a3c48db4a67c88e6fa20a4bdbb82d984

9 years agozsmalloc: add more comment
Nitin Cupta [Wed, 11 Dec 2013 02:04:37 +0000 (11:04 +0900)]
zsmalloc: add more comment

This patch adds lots of comments and it will help others
to review and enhance.

Change-Id: I743596bf18e8acf1082c21437c2caef5f15aad71
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozsmalloc: add Kconfig for enabling page table method
Minchan Kim [Wed, 11 Dec 2013 02:04:36 +0000 (11:04 +0900)]
zsmalloc: add Kconfig for enabling page table method

Zsmalloc has two methods 1) copy-based and 2) pte based to
access objects that span two pages.
You can see history why we supported two approach from [1].

But it was bad choice that adding hard coding to select arch
which want to use pte based method because there are lots of
SoC in an architecure and they can have different cache size,
CPU speed and so on so it would be better to expose it to user
as selectable Kconfig option like Andrew Morton suggested.

[1] https://lkml.org/lkml/2012/7/11/58

Change-Id: Ieedde9cfac0a7d9bbcb3d5d5b36318efd41132eb
Acked-by: Nitin Gupta <ngupta@vflare.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: zram: Fix memory leak by refcount mismatch
Rashika Kheria [Sun, 10 Nov 2013 16:43:53 +0000 (22:13 +0530)]
Staging: zram: Fix memory leak by refcount mismatch

As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
get the block device (bdget_disk()) but it does not put it (bdput()) when
it's done using it. The usage count is therefore incremented but never
decremented."

This patch also puts bdput() for all error cases.

Change-Id: I92198df5ff42242ef3627e5d3db4acece7940d61
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: zram: Fix access of NULL pointer
Rashika Kheria [Wed, 30 Oct 2013 13:06:32 +0000 (18:36 +0530)]
Staging: zram: Fix access of NULL pointer

This patch fixes the bug in reset_store caused by accessing NULL pointer.

The bdev gets its value from bdget_disk() which could fail when memory
pressure is severe and hence can return NULL because allocation of
inode in bdget could fail.

Hence, this patch introduces a check for bdev to prevent reference to a
NULL pointer in the later part of the code. It also removes unnecessary
check of bdev for fsync_bdev().

Change-Id: I47cdcc08076df7958a19406b8502627802c7bd07
Cc: stable <stable@vger.kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: zram: Fix variable dereferenced before check
Rashika Kheria [Wed, 30 Oct 2013 13:13:32 +0000 (18:43 +0530)]
Staging: zram: Fix variable dereferenced before check

This patch fixes the following Smatch warning in zram_drv.c-
drivers/staging/zram/zram_drv.c:899
destroy_device() warn: variable dereferenced before check 'zram->disk' (see line 896)

Change-Id: If920cb9e1328289c561de89e074523071cd772b5
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozsmalloc: Fix "map_vm_area" undefined reference errors.
Majunath Goudar [Tue, 8 Oct 2013 10:32:15 +0000 (16:02 +0530)]
zsmalloc: Fix "map_vm_area" undefined reference errors.

This patch adds a MMU dependency to configure the ZSMALLOC in
drivers/staging/zsmalloc/Kconfig. Without this patch, build
system can lead to build failure. This was observed during
randconfig testing, in which ZSMALLOC was enabled w/o MMU being
enabled. Following was the error:

LD      vmlinux
drivers/built-in.o: In function `__zs_map_object':
drivers/staging/zsmalloc/zsmalloc-main.c:650: undefined reference to `map_vm_area'
make: *** [vmlinux] Error 1

Change-Id: Ia78fb6b91949e85f3b9fee18eaffa18205aaccb9
Signed-off-by: Manjunath Goudar <csmanjuvijay@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoRevert "staging: zram: Add auto loading of module if user opens /dev/zram."
Greg Kroah-Hartman [Thu, 12 Sep 2013 22:41:31 +0000 (15:41 -0700)]
Revert "staging: zram: Add auto loading of module if user opens /dev/zram."

This reverts commit c70bda992c12e593e411c02a52e4bd6985407539.

It's incorrect, Kay writes:
Please just remove it. "devname" is meant to be used for
single-instance devices with a static dev_t, never for things
like zramX.

It will not do anything useful here, it does nothing really
without a statically assigned dev_t, and it should not be used
for devices of this kind anyway.

Change-Id: Ia1503b3cff95e5dd31c934f420025ea252f09129
Reported-by: Tom Gundersen <teg@jklm.no>
Reported-by: Kay Sievers <kay@vrfy.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: don't grab mutex in zram_slot_free_noity
Minchan Kim [Mon, 12 Aug 2013 06:13:56 +0000 (15:13 +0900)]
zram: don't grab mutex in zram_slot_free_noity

[1] introduced down_write in zram_slot_free_notify to prevent race
between zram_slot_free_notify and zram_bvec_[read|write]. The race
could happen if somebody who has right permission to open swap device
is reading swap device while it is used by swap in parallel.

However, zram_slot_free_notify is called with holding spin_lock of
swap layer so we shouldn't avoid holing mutex. Otherwise, lockdep
warns it.

This patch adds new list to handle free slot and workqueue
so zram_slot_free_notify just registers slot index to be freed and
registers the request to workqueue. If workqueue is expired,
it holds mutex_lock so there is no problem any more.

If any I/O is issued, zram handles pending slot-free request
caused by zram_slot_free_notify right before handling issued
request because workqueue wouldn't be expired yet so zram I/O
request handling function can miss it.

Lastly, when zram is reset, flush_work could handle all of pending
free request so we shouldn't have memory leak.

NOTE: If zram_slot_free_notify's kmalloc with GFP_ATOMIC would be
failed, the slot will be freed when next write I/O write the slot.

[1] [57ab0485, zram: use zram->lock to protect zram_free_page()
    in swap free notify path]

* from v2
  * refactoring

* from v1
  * totally redesign

Change-Id: I7f478fa9b00215eb0a3e16433e607a2f73151f27
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: fix invalid memory access
Minchan Kim [Mon, 12 Aug 2013 06:13:55 +0000 (15:13 +0900)]
zram: fix invalid memory access

[1] tried to fix invalid memory access on zram->disk but it didn't
fix properly because get_disk failed during module exit path.

Actually, we don't need to reset zram->disk's capacity to zero
in module exit path so that this patch introduces new argument
"reset_capacity" on zram_reset_divice and it only reset it when
reset_store is called.

[1] 6030ea9b,  zram: avoid invalid memory access in zram_exit()

Change-Id: Ibc554559bbd533bd986c6001ffb9cfb22f8c9f49
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: zram: zram_drv.c: Fixed Error of trailing whitespace
Kumar Gaurav [Thu, 8 Aug 2013 18:23:24 +0000 (23:53 +0530)]
Staging: zram: zram_drv.c: Fixed Error of trailing whitespace

Fixed by removing trailing whitespace

Change-Id: Ia789db213c6917b2f9eeb795d573d9d2ae4c19cd
Signed-off-by: Kumar Gaurav <kumargauravgupta3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: zram: protect zram_reset_device() call
Sergey Senozhatsky [Wed, 26 Jun 2013 12:28:39 +0000 (15:28 +0300)]
staging: zram: protect zram_reset_device() call

Commit 9b3bb7abcdf2df0f1b2657e6cbc9d06bc2b3b36f (remove
zram_sysfs file (v2)) accidentally made zram_reset_device()
racy. Protect zram_reset_device() call with zram->lock.

Change-Id: Ia8cd8eb9eae37ccc142efc1c21980076f2aa007d
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Jerome Marchand <jmarchand@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: prevent data loss in error cases of function zram_bvec_write()
Sunghan Suh [Wed, 3 Jul 2013 11:10:05 +0000 (20:10 +0900)]
zram: prevent data loss in error cases of function zram_bvec_write()

In function zram_bvec_write(), previous data at the index is
already freed by function zram_free_page().
When failed to compress or zs_malloc, there is no way to restore old data.
Therefore, free previous data when it's about to update.

Also, no need to check whether table is not empty outside of
function zram_free_page(), because the function properly checks inside.

Change-Id: Ieeecfa00839cd4440781ece7f9bbed123e3651d5
Signed-off-by: Sunghan Suh <sunghan.suh@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: zram: Add auto loading of module if user opens /dev/zram.
Konrad Rzeszutek Wilk [Fri, 12 Jul 2013 18:20:52 +0000 (14:20 -0400)]
staging: zram: Add auto loading of module if user opens /dev/zram.

Greg spotted that said driver is not subscribing to the automagic
mechanism of auto-loading if a user tries to open /dev/zram.

This fixes it.

Change-Id: I934d034752f1c677076f439b95da178b45384243
CC: Minchan Kim <minchan@kernel.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: zsmalloc: access page->private by using page_private macro
Sunghan Suh [Fri, 12 Jul 2013 07:08:13 +0000 (16:08 +0900)]
staging: zsmalloc: access page->private by using page_private macro

Change-Id: I3fb9c7c58baeac6268961750ed859518c421b770
Signed-off-by: Sunghan Suh <sunghan.suh@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: allow request end to coincide with disksize
Sergey Senozhatsky [Sat, 22 Jun 2013 14:21:00 +0000 (17:21 +0300)]
zram: allow request end to coincide with disksize

Pass valid_io_request() checks if request end coincides with disksize
(end equals bound), only fail if we attempt to read beyond the bound.

mkfs.ext2 produces numerous errors:
[ 2164.632747] quiet_error: 1 callbacks suppressed
[ 2164.633260] Buffer I/O error on device zram0, logical block 153599
[ 2164.633265] lost page write due to I/O error on zram0

Change-Id: Ife5ddef82610e1470d233ce4bdf042ed738064b6
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: remove zram_sysfs file (v2)
Sergey Senozhatsky [Sat, 22 Jun 2013 00:21:18 +0000 (03:21 +0300)]
zram: remove zram_sysfs file (v2)

Move zram sysfs code to zram drv and remove zram_sysfs.c
file. This gives ability to make static a number of previously
exported zram functions, used from zram sysfs, e.g. internal zram
zram_meta_alloc/free(). We also can drop zram_drv wrapper
functions, used from zram sysfs:
e.g. zram_reset_device()/__zram_reset_device() pair.

v2: as suggested by Greg K-H, move MODULE description to the
bottom of the file.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:
drivers/staging/zram/zram_drv.c

Change-Id: Icb484d81dde622e474a097f7ad7a2b7dfa016cdb

9 years agozram: use atomic64_xxx() to replace zram_stat64_xxx()
Jiang Liu [Thu, 6 Jun 2013 16:07:31 +0000 (00:07 +0800)]
zram: use atomic64_xxx() to replace zram_stat64_xxx()

Use atomic64_xxx() to replace open-coded zram_stat64_xxx().
Some architectures have native support of atomic64 operations,
so we can get rid of the spin_lock() in zram_stat64_xxx().
On the other hand, for platforms use generic version of atomic64
implement, it may cause an extra save/restore of the interrupt
flag.  So it's a tradeoff.

Change-Id: Ie2582688a71f89b457b006c9d2f3cda1d24c93ec
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: optimize memory operations with clear_page()/copy_page()
Jiang Liu [Thu, 6 Jun 2013 16:07:30 +0000 (00:07 +0800)]
zram: optimize memory operations with clear_page()/copy_page()

Some architectures provides architecture-specific, optimized version of
clear_page()/copy_page(), which may have better performance than
memset()/memcpy(). So use clear_page()/copy_page() to optimize zram
performance if possible.

Change-Id: If33e01891f1bc3790144f85c02e0869a02d0faae
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: kill unused zram_get_num_devices()
Jiang Liu [Thu, 6 Jun 2013 16:07:29 +0000 (00:07 +0800)]
zram: kill unused zram_get_num_devices()

Now there's no caller of zram_get_num_devices(), so kill it.
And change zram_devices to static because it's only used in zram_drv.c.

Change-Id: Iffd94b2456d86692703b3aff02b6e6d7a3ac5957
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agozram: simplify and optimize dev_to_zram()
Jiang Liu [Thu, 6 Jun 2013 16:07:28 +0000 (00:07 +0800)]
zram: simplify and optimize dev_to_zram()

Simplify and optimize dev_to_zram() without walking the zram_devices
array.

Change-Id: Ib1ee8afe8fc0596f57c4cc7b8e41a817b405c263
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/zsmalloc: Fixed up incorrect formatted comments
Sara Bird [Mon, 20 May 2013 19:18:14 +0000 (15:18 -0400)]
staging/zsmalloc: Fixed up incorrect formatted comments

The existing comments are using an odd style. Fixed them up to adhere
to the StyleGuide. No code changes.

Change-Id: I8e6d8cfa84fa87fb79f5ffc6973d7ab12287ba67
Signed-off-by: Sara Bird <sara.bird.iar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: Fixes string split across lines in zram
Marlies Ruck [Thu, 16 May 2013 18:30:39 +0000 (14:30 -0400)]
Staging: Fixes string split across lines in zram

Fixes the following checkpatch warning in zram_drv.c:
WARNING: quoted string split across lines

Change-Id: Icd77f2e0465dc821b3af5b27178029194e67ff70
Signed-off-by: Marlies Ruck <marlies.ruck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: Fixes string split across lines in zsmalloc zsmalloc-main
Marlies Ruck [Wed, 15 May 2013 20:56:49 +0000 (16:56 -0400)]
Staging: Fixes string split across lines in zsmalloc zsmalloc-main

Fixes the following checkpatch warning:
WARNING: quoted string split across lines

Change-Id: Ib5855942b855de05743b974cb842fa2127ff07da
Signed-off-by: Marlies Ruck <marlies.ruck@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoextcon: max77693: Fix a bug occured at changing ADC debounce time.
Jonghwa Lee [Tue, 18 Mar 2014 15:55:10 +0000 (00:55 +0900)]
extcon: max77693: Fix a bug occured at changing ADC debounce time.

During the initialzation of max77693 muic device, it has been suffered from
abnormal interrupt and accidental reset of certain register when it changes
ADC debounce time. All these happens occured by mistakenly writing some value
to BLTDset and JIGset from CONTROL3 register.
BLTDset and JIGset are not configurable and only reflect actual pin status.
If you write some value other than 0 to them, muic device will return false
information.

To set ADC debounce time properly, give 0 to BLTDset and JIGset when writing
CONTORL3 register.

Previous workaround patches are now purged.

Change-Id: If87e01785115d460b1153e24271a50125d1631fb
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoRevert "extcon: max77693: Fix bug related to MAX77693 irq when set ADC debounce time"
Jonghwa Lee [Tue, 18 Mar 2014 15:41:36 +0000 (00:41 +0900)]
Revert "extcon: max77693: Fix bug related to MAX77693 irq when set ADC debounce time"

This reverts commit b64315125400f4eec9f74f7536acca3e8eeca720.
Upcoming patch will fix a bug thus all related workaournds are now purged.

Change-Id: Iab88c25ef9470a5167be73990ceb7859e076ddd8
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoRevert "extcon: max77693: Force using UART path for jig"
Jonghwa Lee [Tue, 18 Mar 2014 15:41:20 +0000 (00:41 +0900)]
Revert "extcon: max77693: Force using UART path for jig"

This reverts commit ec05e8de55043b87a1dafccec5477db9a6ecf9a1.
Upcoming patch will fix a bug thus all related workaournds are now purged.

Change-Id: I52b4456867dd887c7d29a4f485c952860c6dc45c
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoRevert "extcon: max77693: Fix inaccurate extcon event for JIG with USB cable"
Jonghwa Lee [Tue, 18 Mar 2014 15:41:04 +0000 (00:41 +0900)]
Revert "extcon: max77693: Fix inaccurate extcon event for JIG with USB cable"

This reverts commit 36bdb901c8c61448d9e1320641c3debebde03321.
Upcoming patch will fix a bug thus all related workaournds are now purged.

Change-Id: Idafdbcadff0d99320502676ef371d6bc0bd1fcf7
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoextcon: max77693: Fix inaccurate extcon event for JIG with USB cable
Jonghwa Lee [Mon, 17 Mar 2014 08:44:06 +0000 (17:44 +0900)]
extcon: max77693: Fix inaccurate extcon event for JIG with USB cable

Dmitry's patch 'extcon: max77693: Force using UART~' fixes problem when
device is connected JIG with USB cable. However, with the patch, driver
sends inaccurate event "USB" even muic keeps path to UART not USB. This
would make users confused.

This patch keeps Dmitry's modification working and also bypasses signaling
event "USB" when device is connected to JIG with USB cable.

Change-Id: Ia5f3328e5b0827378178502c70cb90da48e9e3f7
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
9 years agoARM: dts: odroidx2: remove fimd node
Joonyoung Shim [Tue, 11 Mar 2014 05:07:29 +0000 (14:07 +0900)]
ARM: dts: odroidx2: remove fimd node

Our odroidx2 board doesn't have any LCD panel, so it is unnecessary to
use fimd.

Change-Id: I1924ee52cd34d5763aab989035c51b387de98311
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: EXYNOS: register master power domain for genpd from DT
Joonyoung Shim [Tue, 11 Mar 2014 04:44:20 +0000 (13:44 +0900)]
ARM: EXYNOS: register master power domain for genpd from DT

There is one case for EXYNOS4412 that mixer needs LCD0 power domain as
well as TV power domain. If disable LCD0 power domain, mixer occurs
underflow of mixer graphic layer0 line buffer and we can't output normal
data from hdmi. I don't know why mixer has dependency of LCD0 power
domain.

We can control the dependency as LCD0 power domain register to master of
TV power domain on genpd framework.

Change-Id: I71ef5bba37393d2e00c4dd7ea3f7da09d72e8db7
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: odroidx2: update defconfig to enable DRM_EXYNOS_FIMC
Joonyoung Shim [Tue, 11 Mar 2014 02:49:32 +0000 (11:49 +0900)]
ARM: odroidx2: update defconfig to enable DRM_EXYNOS_FIMC

DRM_EXYNOS_FIMC needs to use FIMC from DRM.

Change-Id: I854807ae13d356761b68a19860a0d618eb4f14fc
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agomedia: s5p-mfc: Add support for V4L2_MEMORY_DMABUF type
Seung-Woo Kim [Fri, 29 Nov 2013 07:57:34 +0000 (16:57 +0900)]
media: s5p-mfc: Add support for V4L2_MEMORY_DMABUF type

There is memory constraint that it should be within 128MB from
firmware address. But if IOMMU is supported, then this constraint
is meaningless and DMABUF importing can be used.
So this patch adds V4L2_MEMORY_DMABUF type support for both decoder
and encoder.

Change-Id: I2c893da31f906fcd3f26edeed67ad1e4667e6081
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
9 years agoARM: odroidx2: update defconfig to enable ANDROID_LOGGER
Joonyoung Shim [Sat, 8 Mar 2014 05:04:57 +0000 (14:04 +0900)]
ARM: odroidx2: update defconfig to enable ANDROID_LOGGER

ANDROID_LOGGER needs to use dlogutil at tizen.

Change-Id: Ibcad389c6edf8216441948931e9733aa45b04aa1
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agoARM: dts: fix base address of sysmmu_tv for exynos4
Joonyoung Shim [Sat, 8 Mar 2014 04:55:56 +0000 (13:55 +0900)]
ARM: dts: fix base address of sysmmu_tv for exynos4

The base address of sysmmu_tv is 0x12E20000, not 0x13E20000. Wrong base
address problem causes below error when kernel boots.

[    2.450988] Unhandled fault: imprecise external abort (0xc06) at 0xb6fd2068

Change-Id: Icc896d02e25800b18659c66cad853fdbf54cae9c
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
9 years agodts: exynos4412-trats2: Remove unused device node on trats2 board
Beomho Seo [Thu, 6 Mar 2014 02:44:40 +0000 (11:44 +0900)]
dts: exynos4412-trats2: Remove unused  device node on trats2 board

GP2AP002A00F ligth/proximity sensor is unused on trats2 board.

Change-Id: I4ef414eea4aaf336200ec0b97485fcfde2645c2f
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
9 years agocpufreq:LAB: Remove MODULE_* macros since it is not possible to compile LAB as a...
Lukasz Majewski [Tue, 4 Mar 2014 11:29:04 +0000 (12:29 +0100)]
cpufreq:LAB: Remove MODULE_* macros since it is not possible to compile LAB as a module

LAB cannot be compiled as a module, so MODULE_* macros are in fact a dead
code.

Change-Id: I10f8e5650631b00850631aea1295c1d88e53104a
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agoARM: odroidx2: update defconfig to fix the number of cores
Hyungwon Hwang [Wed, 5 Mar 2014 06:37:26 +0000 (15:37 +0900)]
ARM: odroidx2: update defconfig to fix the number of cores

The processor on Odroid X2 is Exynos4412 which has 4 processing cores.
The number of cores on the config file was 2, not 4.

Change-Id: Ia153c28e5c00a7a8cec2cda9ee0d24caa0d0c1ba
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
9 years agodts: arm: odroidx2: add support for external buttons
Hyungwon Hwang [Wed, 5 Mar 2014 05:44:41 +0000 (14:44 +0900)]
dts: arm: odroidx2: add support for external buttons

Add support for two external buttons (power & home buttons)

Change-Id: I90544bf89c804329dfc78709d48d9eedc2c4a181
Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
9 years agoARM: odroidx2: update defconfig
Marek Szyprowski [Tue, 4 Mar 2014 11:30:01 +0000 (12:30 +0100)]
ARM: odroidx2: update defconfig

Added drivers for MALI GPU, DMAbuf, DMAbuf-sync, exynos drm iommu and
cpufreq.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I427332db24aa52daf4d4addbf9fbad8bc116b62e

9 years agoARM: dts: odroidx2: add mali gpu and cpu freq
Marek Szyprowski [Tue, 4 Mar 2014 11:28:51 +0000 (12:28 +0100)]
ARM: dts: odroidx2: add mali gpu and cpu freq

Add nodes to enable MALI gpu and CPU freq drivers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Id1cc80e7b4278698603422da8e8a7a07fca38904

9 years agoARM: dts: odroidx2: remove obsoleted register debug node
Marek Szyprowski [Tue, 4 Mar 2014 11:27:53 +0000 (12:27 +0100)]
ARM: dts: odroidx2: remove obsoleted register debug node

Register-debug node was used for some internal debug, it is not needed
at in release code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3cefb94755850a9c3caa609ed0fb5c5e56d1fc94

9 years agocpufreq:LAB: Replace NR_CPUS with num_possible_cpus() function
Lukasz Majewski [Tue, 4 Mar 2014 11:27:50 +0000 (12:27 +0100)]
cpufreq:LAB: Replace NR_CPUS with num_possible_cpus() function

The usage of NR_CPUS constant is deprecated, since this value can be the
maximal possible number of cores on a SMP machine.

The num_possible_cpus() represents the number of available cores on the
system.
This change has caused replacement of global tables by ones allocated with
kzalloc().

Change-Id: Ib0bfa27296740a91a25b1af0ece0e573a9756846
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:cosmetic: Cosmetic code cleanup
Lukasz Majewski [Tue, 4 Mar 2014 11:20:34 +0000 (12:20 +0100)]
cpufreq:LAB:cosmetic: Cosmetic code cleanup

Initialization of static variable is not necessary, since it will be placed
at BSS section.

Also proper format comments have been added.

Change-Id: Id5e30a97d7d3cdb851f09a69e944c77223fa8a82
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:dts:trats2: Add attributes necessary for correct LAB operation
Lukasz Majewski [Wed, 26 Feb 2014 12:12:36 +0000 (13:12 +0100)]
cpufreq:LAB:dts:trats2: Add attributes necessary for correct LAB operation

Two extra attributes have been added. The "lab-num-of-states" describes how
many ranges will be used during LAB operation. Now the span of it equals to
20 (100 / 5).
The lab-ctrl-freq attribute maps number of idle CPUs and workload (from
scheduler) to LAB operations.

It is possible to specify exact freq (e.g. 1300000), enable boost
(e.g. 0xFFFFFFFF), set frequency to minimum (0xFFFFFFFE) or rely on
ONDEMAND governor to find suitable frequency.

Change-Id: I0ea6ffd8626aded5bed34166c59b9d34278feef2
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:ondemand: Enable usage of ONDEMAND specific methods at LAB governor
Lukasz Majewski [Thu, 27 Feb 2014 12:35:03 +0000 (13:35 +0100)]
cpufreq:LAB:ondemand: Enable usage of ONDEMAND specific methods at LAB governor

Two methods from ondemand, namely store_sampling_rate() and od_check_cpu()
are now utilized in LAB governor.

Moreover the od_cpu_dbs_info_s structure shall be regarded as a common one.
Therefore in LAB only its declaration is necessary.

Change-Id: I3408b2f8cfdb292cd69568c931da46d8f957099c
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:cpufreq_governor: Remove redundant LAB code from cpufreq_governor.[h|c]
Lukasz Majewski [Wed, 26 Feb 2014 14:50:05 +0000 (15:50 +0100)]
cpufreq:LAB:cpufreq_governor: Remove redundant LAB code from cpufreq_governor.[h|c]

Since the Ondemand code has been reused for LAB, it is now possible to remove
code specially defined for LAB governor at the cpufreq_governor.[h|c] code.

Change-Id: I9c48eade8ffe6a94efd0145b7d48afb405961155
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:ondemand: Ondemand governor adjustments necessary for correct LAB operation
Lukasz Majewski [Wed, 26 Feb 2014 12:42:04 +0000 (13:42 +0100)]
cpufreq:LAB:ondemand: Ondemand governor adjustments necessary for correct LAB operation

Ondemand code needs to be slightly modified for LAB governor operation.
The biggest problem is with the update_sampling_rate function, which shall
not be executed with wrong governor.

Change-Id: I149204bda15b11546c57a77a75a51c4f4f8522b8
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:core: Redesign of LAB code to work on top of ONDEMAND governor
Lukasz Majewski [Thu, 27 Feb 2014 12:30:06 +0000 (13:30 +0100)]
cpufreq:LAB:core: Redesign of LAB code to work on top of ONDEMAND governor

The code for LAB has been redesigned to be able to work on top of Ondemand
governor.
Previous version of LAB - the one which used the polynomial approximation
has been replaced with more readable approach.
The LAB control approach is now read from device tree.

User is allowed to specify following operations (based on load and number of
idle CPUs):
- Force a particular frequency
- Explicitly enable boost for a specific kind of load
- Use ondemand governor

By using ondemand one can be sure that for non critical frequencies correct
value will be chosen.
LAB, which works on top of it, can clamp the freq (an thereof power management)
or explicitly enable boost.

Change-Id: Ieaf84d245463edf90fb2baaf825c0534970eab7e
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:ondemand: REMOVE from LAB governor code duplicated at ondemand
Lukasz Majewski [Wed, 26 Feb 2014 13:07:17 +0000 (14:07 +0100)]
cpufreq:LAB:ondemand: REMOVE from LAB governor code duplicated at ondemand

LAB is very similar to ondemand governor in its structure.
Both use the same code for:
- governor init and exit
- demand based switching timer code
- governor specific ops

In this way the LAB can be stacked on top of ondemand governor and hence it
is possible to reuse its logic when needed.

Change-Id: I78e0da90bb2f07677fe6f8d451139107994f5a6f
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:core: Remove code responsible for removing LAB module
Lukasz Majewski [Thu, 27 Feb 2014 09:01:03 +0000 (10:01 +0100)]
cpufreq:LAB:core: Remove code responsible for removing LAB module

Since we don't support LAB compiled in as module this code shall be
regarded as a dead one.

Change-Id: I8aba33449e08aabed38393e15519f30ccf27ab0f
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:Kconfig: Do not allow LAB to be build as a module
Lukasz Majewski [Thu, 27 Feb 2014 12:38:51 +0000 (13:38 +0100)]
cpufreq:LAB:Kconfig: Do not allow LAB to be build as a module

Since LAB depends on ONDEMAND, one needs to prevent situation when both
governors are compiled as modules.

Change-Id: I5e4f65a856d548397ef53338a8949879bd34051c
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agocpufreq:LAB:Kconfig: Make LAB dependent on the ONDEMAND governor
Lukasz Majewski [Wed, 26 Feb 2014 12:53:23 +0000 (13:53 +0100)]
cpufreq:LAB:Kconfig: Make LAB dependent on the ONDEMAND governor

The LAB is supposed to be an extension of the ONDEMAND governor.
For this reason it shall be not possible to compile in LAB without
ONDEMAND in the system.

Change-Id: I8c9e46b535bb7452782c21163703a4e73bdaf96d
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
9 years agoiio:common:st: Prevent disable after read info raw data
Lukasz Czerwinski [Wed, 5 Mar 2014 07:52:56 +0000 (08:52 +0100)]
iio:common:st: Prevent disable after read info raw data

This patch prevents disable sensor after read info raw data when
events are enabled.

Change-Id: Ifc160e7aa5a633c5dc976ea8b775a790a0efaf69
Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com>
9 years agodrivers: power: hide some excessive debugs
Marek Szyprowski [Tue, 4 Mar 2014 07:17:46 +0000 (08:17 +0100)]
drivers: power: hide some excessive debugs

Hide following excessive debug messages, which are really not helpful
for anything:
device xyz: start latency exceeded, new value XXX ns
device xyz: state restore latency exceeded, new value YYY ns

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Idab765ebd307ac40af1a556c0b08e26938a1c9cf

9 years agousb: misc: usb3503: Support operation with no I2C control
Mark Brown [Fri, 9 Aug 2013 10:41:58 +0000 (11:41 +0100)]
usb: misc: usb3503: Support operation with no I2C control

Refactor so that register writes for configuration are only performed if
the device has a regmap provided and also register as a platform driver.
This allows the driver to be used to manage GPIO based control of the
device.

Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: devicetree@vger.kernel.org
Reviewed-by: Dongjin Kim <tobetter@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 3f0d1c67fa20d524fdcb4a7dcda19ed76c59be44]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3f0d1c67fa20d524fdcb4a7dcda19ed76c59be44

9 years agousb: misc: usb3503: Add USB3503A to the compatible list
Mark Brown [Fri, 9 Aug 2013 10:41:56 +0000 (11:41 +0100)]
usb: misc: usb3503: Add USB3503A to the compatible list

There are no software visible differences that I am aware of but in case
any are discovered allow the DTS to specify exactly which device is
present.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 5bdd1f4a1daf398042203b72430891dfc40c0fa6]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I5bdd1f4a1daf398042203b72430891dfc40c0fa6

9 years agousb: misc: usb3503: Default to hub mode
Mark Brown [Fri, 9 Aug 2013 10:41:55 +0000 (11:41 +0100)]
usb: misc: usb3503: Default to hub mode

Since there is no runtime interface for changing modes this is probably
the most sensible default.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit e5a0c874ec7babc1931a67489b292de152d2a641]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ie5a0c874ec7babc1931a67489b292de152d2a641

9 years agousb: misc: usb3503: Fix typos in error messages
Mark Brown [Fri, 9 Aug 2013 10:41:54 +0000 (11:41 +0100)]
usb: misc: usb3503: Fix typos in error messages

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit dd8e670d2775c02169a3b9e4c8d84c8652342836]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Idd8e670d2775c02169a3b9e4c8d84c8652342836

9 years agousb: misc: usb3503: Factor out I2C probe
Mark Brown [Fri, 9 Aug 2013 10:41:53 +0000 (11:41 +0100)]
usb: misc: usb3503: Factor out I2C probe

In preparation for supporting operation without an I2C control interface
factor out the I2C-specific parts of the probe routine from those that
don't do any register I/O.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 2487e3ee33dd6c4fa3dabbe11bc988883be81f1e]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I2487e3ee33dd6c4fa3dabbe11bc988883be81f1e

9 years agousb: misc: usb3503: Convert to regmap
Mark Brown [Fri, 9 Aug 2013 10:41:52 +0000 (11:41 +0100)]
usb: misc: usb3503: Convert to regmap

This will give access to the diagnostic infrastructure regmap has but
the main point is to support future refactoring.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 68b14134be55eca7340b9a8b3ec4cb8f79622a3c]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I68b14134be55eca7340b9a8b3ec4cb8f79622a3c

9 years agousb: misc: usb3503: Actively manage Hub Connect GPIO
Mark Brown [Fri, 9 Aug 2013 10:41:51 +0000 (11:41 +0100)]
usb: misc: usb3503: Actively manage Hub Connect GPIO

If the connect signal is pulled high then the device will start up meaning
that if we just pull it high on probe then the device will start running
prior to the configuration being written out. Fix this by pulling the GPIO
low when we reset and only pulling it high when configuration is finished.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 8e7245b8386cb1dc941e10a4c97307e3f48da5da]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8e7245b8386cb1dc941e10a4c97307e3f48da5da

9 years agousb: misc: usb3503: Use gpio_set_value_cansleep()
Mark Brown [Fri, 9 Aug 2013 10:41:49 +0000 (11:41 +0100)]
usb: misc: usb3503: Use gpio_set_value_cansleep()

The /RESET GPIO is not manipulated from atomic context so support GPIOs
that can't be written from atomic context by using _cansleep().

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 24455b09b4838cdc0165af0f24ca63ec9ad54e44]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I24455b09b4838cdc0165af0f24ca63ec9ad54e44

9 years agousb: misc: usb3503: Convert to devm_ APIs
Mark Brown [Wed, 7 Aug 2013 21:02:54 +0000 (22:02 +0100)]
usb: misc: usb3503: Convert to devm_ APIs

Saves us a bit of code.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit cffedd6794bb32c4fbc03600fac61beca7950f08]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Icffedd6794bb32c4fbc03600fac61beca7950f08

9 years agoARM: dts: exynos4412: fix usb3503 swapped gpio properties
Marek Szyprowski [Tue, 4 Mar 2014 07:18:06 +0000 (08:18 +0100)]
ARM: dts: exynos4412: fix usb3503 swapped gpio properties

GPIO properties were swapped in the USB3503 driver. This has been fixed
by mainline commit 42416cc81f4990ad8d425b41a0fc8cd985eb5fa5, so now also
fix the DTS using this driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I42416cc81f4990ad8d425b41a0fc8cd985eb5fa6

9 years agousb: misc: Fix swapped properties in usb3503 DT parsing
Mark Brown [Wed, 7 Aug 2013 19:28:24 +0000 (20:28 +0100)]
usb: misc: Fix swapped properties in usb3503 DT parsing

The intn and connect GPIO properties are swapped in the code which will
cause failures at runtime if these are connected, fix the code.

There are currently no in-tree users of this device to check or update.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 42416cc81f4990ad8d425b41a0fc8cd985eb5fa5]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I42416cc81f4990ad8d425b41a0fc8cd985eb5fa5

9 years agousb: misc: usb3503: use dev_get_platdata()
Jingoo Han [Tue, 30 Jul 2013 08:05:28 +0000 (17:05 +0900)]
usb: misc: usb3503: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit b977a3068a284b2ad4612cdb8ca326cbd2a7ffc9]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib977a3068a284b2ad4612cdb8ca326cbd2a7ffc9

9 years agousb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet
Julius Werner [Sat, 1 Jun 2013 01:34:52 +0000 (18:34 -0700)]
usb: misc: usb3503: Remove 100ms sleep on reset, conform to data sheet

The usb3503 driver sleeps a flat 100ms when resetting the chip, with a
comment about waiting for the reference clock. This seems to be a
board-specific detail that should not hold up boot across all platforms.
This patch reduces the sleep to the 4ms initialization delay that the
chip itself actually requires (as per its data sheet). If certain boards
require more time to set up the reference clock, they should change this
through local patches or add a proper, configurable synchronization
mechanism.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[mszyprow: mainline commit 06a962fa7f9bf068eb1238d7aa20453b9e11a9fd]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I06a962fa7f9bf068eb1238d7aa20453b9e11a9fd