Commit Graph

615385 Commits

Author SHA1 Message Date
Caesar Wang
2f6cac6889 ARM: dts: rockchip: enable rga for rk3288 linux and px3se evb board
Change-Id: I7510334bd5b7a6bd4ced351d2eec56f81d5c6e61
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2019-02-26 15:00:47 +08:00
Chaoqing Xu
97fd4333a8 camera: rockchip: camsys_drv: fix clk_out can't be closed
Change-Id: I19ac05c11d2ffa61f686cef543af7417b877201c
Signed-off-by: Chaoqing Xu <shawn.xu@rock-chips.com>
2019-02-26 15:00:19 +08:00
Chaoqing Xu
7229af9d0c arm64: dts: rockchip: rk3399-android: fix clk_cif_pll use wrong clk
Change-Id: I66e04ede6b528a0b016171ab05363e8a74d9ec0b
Signed-off-by: Chaoqing Xu <shawn.xu@rock-chips.com>
2019-02-26 15:00:07 +08:00
Elaine Zhang
af40bf2604 clk: rockchip: rk1808: add cpll as critical clk
Change-Id: Ibf02b6ed9916e774d7a82f33ac7f96e3395e4e88
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2019-02-26 14:58:01 +08:00
Zorro Liu
b57087c149 arm64: dts: rockchip: improve ddr freq when video play for rk3368 xikp and p9 boards
Change-Id: I8418040dd9f7bc5f2720fbcbec7a927a80994fc7
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2019-02-26 14:57:41 +08:00
Hu Kejun
be821a9b71 arm: dts: rk3288-evb-rk808-linux: add vm149c for ov13850
Change-Id: Ib889d113860072480027a7490f4fb5408dd32f55
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
3bc149e135 arm64: dts: rockchip: add vm149c for ov13850
Change-Id: I9ba3598533d6202490a927f5519da2386b7c2b13
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
b8de508a98 media: i2c: vm149c: register v4l2 subdev asynchronously
Change-Id: I77ff7754182aca5391cc1a565aeb18e052faa270
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
6003905842 media: spi: add module information
Change-Id: Ic7c56ba0179e30c34d5d714ab43106d0061fbab6
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
2d54d69b34 arm: dts: rockchip: add module information
Change-Id: I61255f42d9926c91d6f2731d950de3174d45a2bf
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
f36baf55ad arm64: dts: rockchip: add module information
Change-Id: I733735839208f27eefe3f6340b407ad6e8798acb
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
93d46b0c1c media: i2c: add module information
Change-Id: If3de15e8d5d9ea4bb82934c01d780cb167f5dc6d
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
832a59e8f8 media: i2c: ov8858: support get/set otp info
Change-Id: Iff05b663d4baaf758c5a05a5c98afe9de83a823c
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Hu Kejun
dcd128bc3a media: camera: add header for otp information
Change-Id: I903df1fb2ee26b5d771a3cfe2876e7afd837d1de
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-26 14:12:57 +08:00
Binyuan Lan
e30195cc6e ASoC: rockchip: rk817-codec: solve sound L/R channel conversion problem
There is playback's sound L/R channel conversion problem when recording is opened

Change-Id: Iae7160e25bdd834df9904fbd34fe964449c93560
Signed-off-by: Binyuan Lan <lby@rock-chips.com>
2019-02-25 18:34:28 +08:00
Romain Perier
74e95498c4 UPSTREAM: drm: dw-hdmi: add specific I2S and AHB functions for stream handling
Currently, CTS+N is forced to zero as a workaround of the IP block for
i.MX platforms. This is requested in the datasheet of the corresponding
IP for AHB mode only. However, we have seen that it introduces glitches
or delays when playing a sound on HDMI for I2S mode. This proves that we
cannot keep the current functions for handling audio stream as-is if
these contain workaround that are specific to a mode.

This commit introduces two callbacks, one for each variant.
dw_hdmi_setup defines the right function depending on the detected
variant. Then, the exported functions dw_hdmi_audio_enable and
dw_hdmi_audio_disable calls the corresponding callbacks

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Romain Perier <romain.perier@collabora.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170414083113.4255-2-romain.perier@collabora.com
(cherry picked from commit a7d555d2f2)

Change-Id: Ie988cdd7ab54466fa01135ae940ce0d2c27431d2
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-02-25 17:21:12 +08:00
XiaoDong Huang
22e601b986 arm64: rk1808_linux_defconfig: enable ARM_ROCKCHIP_BUS_DEVFREQ
Change-Id: I07546f41f83151bf11e6c3c522c66c2d3d14e2cc
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2019-02-25 16:26:49 +08:00
XiaoDong Huang
47f108732a arm64: dts: rockchip: add soc_bus support for rk1808
Change-Id: Ia7c4ac877f2758ca3da4d41603d6e47c68a164e6
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2019-02-25 16:26:39 +08:00
XiaoDong Huang
48d4855d3a PM / devfreq: rockchip_bus: add support for rk1808
Change-Id: I2be704a4b72fc0c2b6c8c864e2fb605038271ce5
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2019-02-25 16:26:39 +08:00
Finley Xiao
9dcdd7df70 arm64: dts: rockchip: add voltage restriction for rk3308k
Change-Id: Ib531f0659fe87b11fc6d80527de2a65cdb4b1053
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-02-25 14:11:24 +08:00
Hu Kejun
e577dc0365 media: rockchip: isp1: add macro to switch between old mipi and new mipi
Change-Id: I878099d6a38f00a255a7b99ff9f2a3c5770226e5
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-25 10:33:05 +08:00
Hu Kejun
312701d219 phy: rockchip: mipi-rx: update sensor mbus when stream start
Change-Id: I5ced164e38b3869da0d3ec12ed180b75ccd924a3
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-25 10:25:08 +08:00
Hu Kejun
78ea11541f media: rockchip: isp1: check first iq param is set or not
Change-Id: I334874c58f7788e7ea4309cbf2eee4f400a41cd7
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-25 10:13:14 +08:00
Hu Kejun
da97a12cb1 media: rockchip: isp1: support iesharp/demosaiclp/wdr
Change-Id: Id27d87c15d455d00ff8bfe09b470929c5746d511
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2019-02-25 10:13:14 +08:00
Sandy Huang
82b24cee15 arm64: dts: rockchip: enable rga for rk3399-linux.dtsi
Change-Id: I55389b59f54ba4195e9532d00d9a1f54a767f2fd
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2019-02-22 14:42:23 +08:00
Cai YiWei
ca2856326a phy: rockchip: mipi-dphy-rx: csi_mipidphy add stream off
Change-Id: Ifee3d6fb80425fc505ed716cbcbe6cc48a9e02bb
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
2019-02-22 11:56:41 +08:00
Jon Lin
3cbec52b29 arm: dts: rv1108: add nandc node
Change-Id: I34a1c10ada37b0473eb78d6daf650f1c152724d1
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2019-02-21 14:07:14 +08:00
Zorro Liu
197efdedb6 arm64: dts: rockchip: disable ddr auto freq for rk3368-xikp and rk3368-p9 boards
Change-Id: I7bc830e041f7ce5c984d90d45245a503e8039559
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2019-02-21 14:06:39 +08:00
Zheng Yang
01c37928eb drm: rockchip: dw-hdmi: fix rk3288 hdmi check YCbCr420 error
For platforms that do not support YCbCr420 output, it is not enough
to check only the pixel clock.

Change-Id: I0113ffb18aa4667384c621c4e80de2b68e4e8469
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2019-02-21 09:56:20 +08:00
Caesar Wang
c66526ad82 arm64: dts: rockchip: add the adc_keys for rk3399-sapphire-excavator-linux.dts
There are four adc keys on rk3399 sapphire excavator board, these are
ESC/MENU/VOL+/VOL- key.

Change-Id: I7ddb6343fd22240739a198665d9ccf82d4529af9
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2019-02-20 17:06:16 +08:00
Minchan Kim
7df0273f2c BACKPORT: mm: make unreserve highatomic functions reliable
Currently, unreserve_highatomic_pageblock bails out if it found highatomic
pageblock regardless of really moving free pages from the one so that it
could mitigate unreserve logic's goal which saves OOM of a process.

This patch makes unreserve functions bail out only if it moves some pages
out of !highatomic free list to avoid such false positive.

Another potential problem is that by race between page freeing and reserve
highatomic function, pages could be in highatomic free list even though
the pageblock is !high atomic migratetype.  In that case,
unreserve_highatomic_pageblock can be void if count of highatomic reserve
is less than pageblock_nr_pages.  We could solve it simply via draining
all of reserved pages before the OOM.  It would have a safeguard role to
exhuast reserved pages before converging to OOM.

BUG=chrome-os-partner:60028
TEST=for i in $(seq 100); do ./launchBalloons.sh 6 700 30 >/dev/null; done

Conflicts:
	mm/page_alloc.c
...this conflict resolution is trivial based on the conflict
resolution that was done as part of ("mm: try to exhaust highatomic
reserve before the OOM")

Link: http://lkml.kernel.org/r/1476259429-18279-5-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Sangseok Lee <sangseok.lee@lge.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from akpm via linuxnext
 commit df6e3cc2c9168bdbf3abecec2821a6f9ae1a2128)
Reviewed-on: https://chromium-review.googlesource.com/414640
Reviewed-by: Guenter Roeck <groeck@chromium.org>

Change-Id: Ib3e9764c0aaa3b43e3afd05192a8c43e225adb81
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-02-20 14:56:31 +08:00
Minchan Kim
79b42a1ce7 BACKPORT: mm: try to exhaust highatomic reserve before the OOM
I got OOM report from production team with v4.4 kernel.  It had enough
free memory but failed to allocate GFP_KERNEL order-0 page and finally
encountered OOM kill.  It occured during QA process which launches several
apps, switching and so on.  It happned rarely.  IOW, In normal situation,
it was not a problem but if we are unluck so that several apps uses peak
memory at the same time, it can happen.  If we manage to pass the phase,
the system can go working well.

I could reproduce it with my test(memory spike easily. Look at below.

The reason is free pages(19M) of DMA32 zone are reserved for
HIGHORDERATOMIC and doesn't unreserved before the OOM.

balloon invoked oom-killer: gfp_mask=0x24280ca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), order=0, oom_score_adj=0
balloon cpuset=/ mems_allowed=0
CPU: 1 PID: 8473 Comm: balloon Tainted: G        W  OE   4.8.0-rc7-00219-g3f74c9559583-dirty #3161
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
 0000000000000000 ffff88007f15bbc8 ffffffff8138eb13 ffff88007f15bd88
 ffff88005a72a4c0 ffff88007f15bc28 ffffffff811d2d13 ffff88007f15bc08
 ffffffff8146a5ca ffffffff81c8df60 0000000000000015 0000000000000206
Call Trace:
 [<ffffffff8138eb13>] dump_stack+0x63/0x90
 [<ffffffff811d2d13>] dump_header+0x5c/0x1ce
 [<ffffffff8146a5ca>] ? virtballoon_oom_notify+0x2a/0x80
 [<ffffffff81171e5e>] oom_kill_process+0x22e/0x400
 [<ffffffff8117222c>] out_of_memory+0x1ac/0x210
 [<ffffffff811775ce>] __alloc_pages_nodemask+0x101e/0x1040
 [<ffffffff811a245a>] handle_mm_fault+0xa0a/0xbf0
 [<ffffffff8106029d>] __do_page_fault+0x1dd/0x4d0
 [<ffffffff81060653>] trace_do_page_fault+0x43/0x130
 [<ffffffff81059bda>] do_async_page_fault+0x1a/0xa0
 [<ffffffff817a3f38>] async_page_fault+0x28/0x30
Mem-Info:
active_anon:383949 inactive_anon:106724 isolated_anon:0
 active_file:15 inactive_file:44 isolated_file:0
 unevictable:0 dirty:0 writeback:24 unstable:0
 slab_reclaimable:2483 slab_unreclaimable:3326
 mapped:0 shmem:0 pagetables:1906 bounce:0
 free:6898 free_pcp:291 free_cma:0
Node 0 active_anon:1535796kB inactive_anon:426896kB active_file:60kB inactive_file:176kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:96kB shmem:0kB writeback_tmp:0kB unstable:0kB pages_scanned:1418 all_unreclaimable? no
DMA free:8188kB min:44kB low:56kB high:68kB active_anon:7648kB inactive_anon:0kB active_file:0kB inactive_file:4kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:20kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
lowmem_reserve[]: 0 1952 1952 1952
DMA32 free:19404kB min:5628kB low:7624kB high:9620kB active_anon:1528148kB inactive_anon:426896kB active_file:60kB inactive_file:420kB unevictable:0kB writepending:96kB present:2080640kB managed:2030092kB mlocked:0kB slab_reclaimable:9932kB slab_unreclaimable:13284kB kernel_stack:2496kB pagetables:7624kB bounce:0kB free_pcp:900kB local_pcp:112kB free_cma:0kB
lowmem_reserve[]: 0 0 0 0
DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 2*4096kB (H) = 8192kB
DMA32: 7*4kB (H) 8*8kB (H) 30*16kB (H) 31*32kB (H) 14*64kB (H) 9*128kB (H) 2*256kB (H) 2*512kB (H) 4*1024kB (H) 5*2048kB (H) 0*4096kB = 19484kB
51131 total pagecache pages
50795 pages in swap cache
Swap cache stats: add 3532405601, delete 3532354806, find 124289150/1822712228
Free swap  = 8kB
Total swap = 255996kB
524158 pages RAM
0 pages HighMem/MovableOnly
12658 pages reserved
0 pages cma reserved
0 pages hwpoisoned

Another example exceeded the limit by the race is

in:imklog: page allocation failure: order:0, mode:0x2280020(GFP_ATOMIC|__GFP_NOTRACK)
CPU: 0 PID: 476 Comm: in:imklog Tainted: G            E   4.8.0-rc7-00217-g266ef83c51e5-dirty #3135
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
 0000000000000000 ffff880077c37590 ffffffff81389033 0000000000000000
 0000000000000000 ffff880077c37618 ffffffff8117519b 0228002000000000
 ffffffffffffffff ffffffff81cedb40 0000000000000000 0000000000000040
Call Trace:
 [<ffffffff81389033>] dump_stack+0x63/0x90
 [<ffffffff8117519b>] warn_alloc_failed+0xdb/0x130
 [<ffffffff81175746>] __alloc_pages_nodemask+0x4d6/0xdb0
 [<ffffffff8120c149>] ? bdev_write_page+0xa9/0xd0
 [<ffffffff811a97b3>] ? __page_check_address+0xd3/0x130
 [<ffffffff811ba4ea>] ? deactivate_slab+0x12a/0x3e0
 [<ffffffff811b9549>] new_slab+0x339/0x490
 [<ffffffff811bad37>] ___slab_alloc.constprop.74+0x367/0x480
 [<ffffffff814601ad>] ? alloc_indirect.isra.14+0x1d/0x50
 [<ffffffff8109d0c2>] ? default_wake_function+0x12/0x20
 [<ffffffff811bae70>] __slab_alloc.constprop.73+0x20/0x40
 [<ffffffff811bb034>] __kmalloc+0x1a4/0x1e0
 [<ffffffff814601ad>] alloc_indirect.isra.14+0x1d/0x50
 [<ffffffff81460434>] virtqueue_add_sgs+0x1c4/0x470
 [<ffffffff81365075>] ? __bt_get.isra.8+0xe5/0x1c0
 [<ffffffff8150973e>] __virtblk_add_req+0xae/0x1f0
 [<ffffffff810b37d0>] ? wake_atomic_t_function+0x60/0x60
 [<ffffffff810337b9>] ? sched_clock+0x9/0x10
 [<ffffffff81360afb>] ? __blk_mq_alloc_request+0x10b/0x230
 [<ffffffff8135e293>] ? blk_rq_map_sg+0x213/0x550
 [<ffffffff81509a1d>] virtio_queue_rq+0x12d/0x290
 [<ffffffff813629c9>] __blk_mq_run_hw_queue+0x239/0x370
 [<ffffffff8136276f>] blk_mq_run_hw_queue+0x8f/0xb0
 [<ffffffff8136397c>] blk_mq_insert_requests+0x18c/0x1a0
 [<ffffffff81364865>] blk_mq_flush_plug_list+0x125/0x140
 [<ffffffff813596a7>] blk_flush_plug_list+0xc7/0x220
 [<ffffffff81359bec>] blk_finish_plug+0x2c/0x40
 [<ffffffff8117b836>] __do_page_cache_readahead+0x196/0x230
 [<ffffffffa00006ba>] ? zram_free_page+0x3a/0xb0 [zram]
 [<ffffffff8116f928>] filemap_fault+0x448/0x4f0
 [<ffffffff8119e9e4>] ? alloc_set_pte+0xe4/0x350
 [<ffffffff8125fa16>] ext4_filemap_fault+0x36/0x50
 [<ffffffff8119be35>] __do_fault+0x75/0x140
 [<ffffffff8119f6cd>] handle_mm_fault+0x84d/0xbe0
 [<ffffffff812483e4>] ? kmsg_read+0x44/0x60
 [<ffffffff8106029d>] __do_page_fault+0x1dd/0x4d0
 [<ffffffff81060653>] trace_do_page_fault+0x43/0x130
 [<ffffffff81059bda>] do_async_page_fault+0x1a/0xa0
 [<ffffffff8179dcb8>] async_page_fault+0x28/0x30
Mem-Info:
active_anon:363826 inactive_anon:121283 isolated_anon:32
 active_file:65 inactive_file:152 isolated_file:0
 unevictable:0 dirty:0 writeback:46 unstable:0
 slab_reclaimable:2778 slab_unreclaimable:3070
 mapped:112 shmem:0 pagetables:1822 bounce:0
 free:9469 free_pcp:231 free_cma:0
Node 0 active_anon:1455304kB inactive_anon:485132kB active_file:260kB inactive_file:608kB unevictable:0kB isolated(anon):128kB isolated(file):0kB mapped:448kB dirty:0kB writeback:184kB shmem:0kB writeback_tmp:0kB unstable:0kB pages_scanned:13641 all_unreclaimable? no
DMA free:7748kB min:44kB low:56kB high:68kB active_anon:7944kB inactive_anon:104kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:108kB kernel_stack:0kB pagetables:4kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
lowmem_reserve[]: 0 1952 1952 1952
DMA32 free:30128kB min:5628kB low:7624kB high:9620kB active_anon:1447360kB inactive_anon:485028kB active_file:260kB inactive_file:608kB unevictable:0kB writepending:184kB present:2080640kB managed:2030132kB mlocked:0kB slab_reclaimable:11112kB slab_unreclaimable:12172kB kernel_stack:2400kB pagetables:7284kB bounce:0kB free_pcp:924kB local_pcp:72kB free_cma:0kB
lowmem_reserve[]: 0 0 0 0
DMA: 7*4kB (UE) 3*8kB (UH) 1*16kB (M) 0*32kB 2*64kB (U) 1*128kB (M) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (U) 1*4096kB (H) = 7748kB
DMA32: 10*4kB (H) 3*8kB (H) 47*16kB (H) 38*32kB (H) 5*64kB (H) 1*128kB (H) 2*256kB (H) 3*512kB (H) 3*1024kB (H) 3*2048kB (H) 4*4096kB (H) = 30128kB
2775 total pagecache pages
2536 pages in swap cache
Swap cache stats: add 206786828, delete 206784292, find 7323106/106686077
Free swap  = 108744kB
Total swap = 255996kB
524158 pages RAM
0 pages HighMem/MovableOnly
12648 pages reserved
0 pages cma reserved
0 pages hwpoisoned

It's weird to show that zone has enough free memory above min
watermark but OOMed with 4K GFP_KERNEL allocation due to
reserved highatomic pages. As last resort, try to unreserve
highatomic pages again and if it has moved pages to
non-highatmoc free list, retry reclaim once more.

BUG=chrome-os-partner:60028
TEST=for i in $(seq 100); do ./launchBalloons.sh 6 700 30 >/dev/null; done

Conflicts:
	mm/page_alloc.c
...upstream has a whole lot of differences.  I took my best guess at
the location for the new call to unreserve_highatomic_pageblock().

Link: http://lkml.kernel.org/r/1476259429-18279-4-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Sangseok Lee <sangseok.lee@lge.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked akpm via linuxnext
 from commit 4284cb9a20e1f1c75f7b173b3f8ba6fea781cf77)
Reviewed-on: https://chromium-review.googlesource.com/414639
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>

Change-Id: Idaec3271e337469d03a55e99e0cd00f6d79d196e
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-02-20 14:56:31 +08:00
Minchan Kim
9b95697cc7 UPSTREAM: mm: don't steal highatomic pageblock
Patch series "use up highorder free pages before OOM", v3.

I got OOM report from production team with v4.4 kernel.  It had enough
free memory but failed to allocate GFP_KERNEL order-0 page and finally
encountered OOM kill.  It occured during QA process which launches
several apps, switching and so on.  It happned rarely.  IOW, In normal
situation, it was not a problem but if we are unluck so that several
apps uses peak memory at the same time, it can happen.  If we manage to
pass the phase, the system can go working well.

I could reproduce it with my test(memory spike easily.  Look at below.

The reason is free pages(19M) of DMA32 zone are reserved for
HIGHORDERATOMIC and doesn't unreserved before the OOM.

  balloon invoked oom-killer: gfp_mask=0x24280ca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), order=0, oom_score_adj=0
  balloon cpuset=/ mems_allowed=0
  CPU: 1 PID: 8473 Comm: balloon Tainted: G        W  OE   4.8.0-rc7-00219-g3f74c9559583-dirty #3161
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
  Call Trace:
    dump_stack+0x63/0x90
    dump_header+0x5c/0x1ce
    oom_kill_process+0x22e/0x400
    out_of_memory+0x1ac/0x210
    __alloc_pages_nodemask+0x101e/0x1040
    handle_mm_fault+0xa0a/0xbf0
    __do_page_fault+0x1dd/0x4d0
    trace_do_page_fault+0x43/0x130
    do_async_page_fault+0x1a/0xa0
    async_page_fault+0x28/0x30
  Mem-Info:
  active_anon:383949 inactive_anon:106724 isolated_anon:0
   active_file:15 inactive_file:44 isolated_file:0
   unevictable:0 dirty:0 writeback:24 unstable:0
   slab_reclaimable:2483 slab_unreclaimable:3326
   mapped:0 shmem:0 pagetables:1906 bounce:0
   free:6898 free_pcp:291 free_cma:0
  Node 0 active_anon:1535796kB inactive_anon:426896kB active_file:60kB inactive_file:176kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:0kB dirty:0kB writeback:96kB shmem:0kB writeback_tmp:0kB unstable:0kB pages_scanned:1418 all_unreclaimable? no
  DMA free:8188kB min:44kB low:56kB high:68kB active_anon:7648kB inactive_anon:0kB active_file:0kB inactive_file:4kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:20kB kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
  lowmem_reserve[]: 0 1952 1952 1952
  DMA32 free:19404kB min:5628kB low:7624kB high:9620kB active_anon:1528148kB inactive_anon:426896kB active_file:60kB inactive_file:420kB unevictable:0kB writepending:96kB present:2080640kB managed:2030092kB mlocked:0kB slab_reclaimable:9932kB slab_unreclaimable:13284kB kernel_stack:2496kB pagetables:7624kB bounce:0kB free_pcp:900kB local_pcp:112kB free_cma:0kB
  lowmem_reserve[]: 0 0 0 0
  DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 2*4096kB (H) = 8192kB
  DMA32: 7*4kB (H) 8*8kB (H) 30*16kB (H) 31*32kB (H) 14*64kB (H) 9*128kB (H) 2*256kB (H) 2*512kB (H) 4*1024kB (H) 5*2048kB (H) 0*4096kB = 19484kB
  51131 total pagecache pages
  50795 pages in swap cache
  Swap cache stats: add 3532405601, delete 3532354806, find 124289150/1822712228
  Free swap  = 8kB
  Total swap = 255996kB
  524158 pages RAM
  0 pages HighMem/MovableOnly
  12658 pages reserved
  0 pages cma reserved
  0 pages hwpoisoned

Another example exceeded the limit by the race is

  in:imklog: page allocation failure: order:0, mode:0x2280020(GFP_ATOMIC|__GFP_NOTRACK)
  CPU: 0 PID: 476 Comm: in:imklog Tainted: G            E   4.8.0-rc7-00217-g266ef83c51e5-dirty #3135
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
  Call Trace:
    dump_stack+0x63/0x90
    warn_alloc_failed+0xdb/0x130
    __alloc_pages_nodemask+0x4d6/0xdb0
    new_slab+0x339/0x490
    ___slab_alloc.constprop.74+0x367/0x480
    __slab_alloc.constprop.73+0x20/0x40
    __kmalloc+0x1a4/0x1e0
    alloc_indirect.isra.14+0x1d/0x50
    virtqueue_add_sgs+0x1c4/0x470
    __virtblk_add_req+0xae/0x1f0
    virtio_queue_rq+0x12d/0x290
    __blk_mq_run_hw_queue+0x239/0x370
    blk_mq_run_hw_queue+0x8f/0xb0
    blk_mq_insert_requests+0x18c/0x1a0
    blk_mq_flush_plug_list+0x125/0x140
    blk_flush_plug_list+0xc7/0x220
    blk_finish_plug+0x2c/0x40
    __do_page_cache_readahead+0x196/0x230
    filemap_fault+0x448/0x4f0
    ext4_filemap_fault+0x36/0x50
    __do_fault+0x75/0x140
    handle_mm_fault+0x84d/0xbe0
    __do_page_fault+0x1dd/0x4d0
    trace_do_page_fault+0x43/0x130
    do_async_page_fault+0x1a/0xa0
    async_page_fault+0x28/0x30
  Mem-Info:
  active_anon:363826 inactive_anon:121283 isolated_anon:32
   active_file:65 inactive_file:152 isolated_file:0
   unevictable:0 dirty:0 writeback:46 unstable:0
   slab_reclaimable:2778 slab_unreclaimable:3070
   mapped:112 shmem:0 pagetables:1822 bounce:0
   free:9469 free_pcp:231 free_cma:0
  Node 0 active_anon:1455304kB inactive_anon:485132kB active_file:260kB inactive_file:608kB unevictable:0kB isolated(anon):128kB isolated(file):0kB mapped:448kB dirty:0kB writeback:184kB shmem:0kB writeback_tmp:0kB unstable:0kB pages_scanned:13641 all_unreclaimable? no
  DMA free:7748kB min:44kB low:56kB high:68kB active_anon:7944kB inactive_anon:104kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB present:15992kB managed:15908kB mlocked:0kB slab_reclaimable:0kB slab_unreclaimable:108kB kernel_stack:0kB pagetables:4kB bounce:0kB free_pcp:0kB local_pcp:0kB free_cma:0kB
  lowmem_reserve[]: 0 1952 1952 1952
  DMA32 free:30128kB min:5628kB low:7624kB high:9620kB active_anon:1447360kB inactive_anon:485028kB active_file:260kB inactive_file:608kB unevictable:0kB writepending:184kB present:2080640kB managed:2030132kB mlocked:0kB slab_reclaimable:11112kB slab_unreclaimable:12172kB kernel_stack:2400kB pagetables:7284kB bounce:0kB free_pcp:924kB local_pcp:72kB free_cma:0kB
  lowmem_reserve[]: 0 0 0 0
  DMA: 7*4kB (UE) 3*8kB (UH) 1*16kB (M) 0*32kB 2*64kB (U) 1*128kB (M) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (U) 1*4096kB (H) = 7748kB
  DMA32: 10*4kB (H) 3*8kB (H) 47*16kB (H) 38*32kB (H) 5*64kB (H) 1*128kB (H) 2*256kB (H) 3*512kB (H) 3*1024kB (H) 3*2048kB (H) 4*4096kB (H) = 30128kB
  2775 total pagecache pages
  2536 pages in swap cache
  Swap cache stats: add 206786828, delete 206784292, find 7323106/106686077
  Free swap  = 108744kB
  Total swap = 255996kB
  524158 pages RAM
  0 pages HighMem/MovableOnly
  12648 pages reserved
  0 pages cma reserved
  0 pages hwpoisoned

During the investigation, I found some problems with highatomic so this
patch aims to solve the problems and the final goal is to unreserve
every highatomic free pages before the OOM kill.

This patch (of 4):

In page freeing path, migratetype is racy so that a highorderatomic page
could free into non-highorderatomic free list.  If that page is
allocated, VM can change the pageblock from higorderatomic to something.
In that case, highatomic pageblock accounting is broken so it doesn't
work(e.g., VM cannot reserve highorderatomic pageblocks any more
although it doesn't reach 1% limit).

So, this patch prohibits the changing from highatomic to other type.
It's no problem because MIGRATE_HIGHATOMIC is not listed in fallback
array so stealing will only happen due to unexpected races which is
really rare.  Also, such prohibiting keeps highatomic pageblock more
longer so it would be better for highorderatomic page allocation.

Link: http://lkml.kernel.org/r/1476259429-18279-2-git-send-email-minchan@kernel.org
Signed-off-by: Minchan Kim <minchan@kernel.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Sangseok Lee <sangseok.lee@lge.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 88ed365ea2)

Change-Id: I446fe4977b45d56da322638d051f3ac0eb35238d
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2019-02-20 14:56:31 +08:00
Simon Xue
733e2b512a arm64: dts: rockchip: miss RK3328 WDT clock
Change-Id: I4df6373a3323ebf0fed74dddabc387164cd0aa5c
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-02-20 14:10:17 +08:00
Shixiang Zheng
8f2b75df0e ARM: dts: rockchip: rk3288-android: add assigned clocks for rga
Change-Id: Ice88b6a58b2f7c766b5cd42291bddbdbfb50cb2d
Signed-off-by: Shixiang Zheng <shixiang.zheng@rock-chips.com>
2019-02-20 11:34:34 +08:00
Wyon Bi
b7c62bbf2d ARM: dts: rockchip: remove lvds bus format comment
Change-Id: I9e46b6d026db584365a88f918f20f1773bff15cc
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:12:31 +08:00
Wyon Bi
361ae22ff9 arm64: dts: rockchip: remove lvds bus format comment
Change-Id: I0693ef2a36222df0eca676837662e41972b9706b
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:12:30 +08:00
Wyon Bi
48a6e78673 drm/rockchip/rk618: lvds: Add support for MEDIA_BUS_FMT_RGB666_1X7X3_JEIDA bus format
Change-Id: I2d173633373137ac103946aceedc39bb8118d35a
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:12:29 +08:00
Wyon Bi
1688ac79be drm/rockchip: vop: Add support for MEDIA_BUS_FMT_RGB666_1X7X3_JEIDA bus format
Change-Id: Ie615fe85d8e0500033b0e876e00ed923756b5898
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:12:28 +08:00
Wyon Bi
58ef97d6a9 drm/rockchip: lvds: Add support for MEDIA_BUS_FMT_RGB666_1X7X3_JEIDA bus format
Change-Id: I1aaa9d6ea899704b784e97450441bcdeabb095a6
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:12:27 +08:00
Wyon Bi
346a749a73 dt-bindings: display: media-bus-format: Sync with include/uapi/linux/media-bus-format.h
Change-Id: I3f6deb2e264956205da725aa78f79ee7404d13a8
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:10:11 +08:00
Wyon Bi
fb2e95bef9 media: Add MEDIA_BUS_FMT_RGB666_1X7X3_JEIDA media bus code definitions
This patch adds a new RGB media bus formats that describe
18-bit samples transferred over an LVDS bus with three
differential data pairs, serialized into 7 time slots,
using standard JEIDA data ordering.

Change-Id: Ia0bedd53e57aa34829a0d61b144aa99a1c98cffd
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 14:08:12 +08:00
Wyon Bi
85a84917d5 video/drm: lvds: Correct P2S_EN register field on px30
Change-Id: Ia82a463437fbcf0b45805f65647e9bbfd0cdf43e
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2019-02-19 12:54:25 +08:00
XiaoDong Huang
f611ec6c1c arm64: dts: rockchip: rk1808-evb: change pmic pinctrl of the pmic_sleep pin
For sleep function, switch gpio0_a4 iomux to gpio;
For reset function, switch gpio0_a4 iomux to pmic_sleep;

Change-Id: I2f49eaa1522bc2af01d1c6a8061af7fc60915b3d
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
2019-02-18 16:06:38 +08:00
Longjian Lin
b5dc63f92c arm64: dts: rockchip: pulldown BT irq gpio for rk3399pro evb
Change-Id: I0426e9335154b9069fa3d73068250745b8481053
Signed-off-by: Longjian Lin <llj@rock-chips.com>
2019-02-18 16:06:20 +08:00
Caesar Wang
d8bc92af0a regulator: core: Fix device link error when registering regulator
The sysfs device link can only be created after regulator device
registered.

Otherwise, the regulator always have some warning logs.
...
[    1.033024] DCDC_REG1: supplied by vcc5v0_sys
[    1.033427] vcc5v0_sys: could not add device link regulator.3 err -2
[    1.034302] vdd_center: 750 <--> 1350 mV at 900 mV
[    1.034862] rk808 0-0020: Looking up vcc2-supply from device tree
[    1.034907] DCDC_REG2: supplied by vcc5v0_sys
[    1.035298] vcc5v0_sys: could not add device link regulator.4 err -2
[    1.036301] vdd_cpu_l: 750 <--> 1350 mV at 900 mV
[    1.036837] rk808 0-0020: Looking up vcc3-supply from device tree
[    1.036880] DCDC_REG3: supplied by vcc5v0_sys
[    1.037271] vcc5v0_sys: could not add device link regulator.5 err -2
[    1.037985] vcc_ddr: at 500 mV
[    1.038508] rk808 0-0020: Looking up vcc4-supply from device tree
[    1.038550] DCDC_REG4: supplied by vcc5v0_sys
[    1.038941] vcc5v0_sys: could not add device link regulator.6 err -2
[    1.039657] vcc3v3_sys: 3300 mV
[    1.040179] rk808 0-0020: Looking up vcc9-supply from device tree
[    1.040223] DCDC_REG5: supplied by vcc5v0_sys

Fixes: c438b9d017 ("regulator: core: Move registration of regulator device")

Change-Id: Ie20421eab45f3f8229a5bedf3fecf99c757160bb
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2019-02-18 16:03:19 +08:00
Wang Panzhenzhuan
5e0baa55b6 media: rockchip: isp1: fix high fps preview blurred bug
fix following camera err:
    rkisp1: CIF_ISP_PIC_SIZE_ERROR (0x00000002)

Change-Id: I6168d352d521cf75d7537ffe70a9af6f2ec07282
Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
2019-02-18 09:45:40 +08:00
Liang Chen
83ad402c20 arm64: dts: rockchip: adjust opp-table for rk1808 SoCs
Auto select opp-table level by pvtm value.

Change-Id: I6043bd768452c84290715428500e4f72068eac0d
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-02-15 18:05:25 +08:00
Simon Xue
9642bc8824 PCI: rockchip: fix failed to enter L2 link state
The ioremap operation for the msg_region move to the bottom of the
rockchip_cfg_atu to make msg_region make sense which used for sending
PME_TURN_OFF message to make PCIe link enter L2 state

Change-Id: I50d1bef5d534102ed5b7db474c3f819e656fd626
Signed-off-by: Simon Xue <xxm@rock-chips.com>
2019-02-15 17:53:20 +08:00
Shunqian Zheng
646ffe1fc1 ARM: dts: rk3128/px3se: enable video phy node for linux dts
Change-Id: I6a1e5139709c8d367e636c80533cc85ddb1e496e
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
2019-02-15 14:24:13 +08:00