Dongwoo Lee [Mon, 6 Nov 2017 07:11:08 +0000 (16:11 +0900)]
usb: dwc2: gadget: Prevent wrong extcon notification
In sometimes, USB disconnection triggers enumeration-done interrupt
even though it is false state. Actually, this interrupt is ignored by
dwc2 irq handler, but extcon notfication can be mis-delivered to
user-space. Thus, this patch make worker determined the current state
by itself, and it also prevent some cases which have chance for wrong
notification such as repeatedly connect/disconnecting usb cable.
Change-Id: Iff88cf2c030b627f3d2da23930b10e9f3a84c8e1
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Fri, 10 Nov 2017 02:55:12 +0000 (11:55 +0900)]
gpu: drm: nexell: Add extcon notification for hdmi connection
Currently, HDMI cable connection generates only uevent by drm core. In
addition, it has no inforation about connection state. But, in tizen,
to handle TV-out mode uevent should be generated by extcon subsystem
with connection state. To this end, this patch will add extcon
notification for hdmi connection.
Change-Id: I101bf3b582498fbe46733839e3cbd75c292cf88f
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Jaehoon Chung [Fri, 3 Nov 2017 05:29:07 +0000 (14:29 +0900)]
rtc: ds1307: prevent to set the specific time value
When using the time over "date 2038-01-19 03:14", Systemd is displaying
the below log as spamming.
"systemd[1]: Time has been changed"
This patch is workaround for preventing to set the value over
"2038-01-19".
Refer to https://patchwork.kernel.org/patch/7133531/
Change-Id: Iab3823b63d738c0c63d4cee439ab53da335f4ef0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Jaehoon Chung [Tue, 24 Oct 2017 09:11:11 +0000 (18:11 +0900)]
misc: tizen-artik-reboot: support the reboot notifier
Tizen platform needs to provide the reboot parameter.
This file is for supporting reboot notifier on Tizen platform.
Note: ALIVESCRATCH7 register should maintain the value upon rebooting.
(ALIVESCRATCH 0~5 are already used.)
Change-Id: I512e6b2ca26c355a847435f20910be85cbf28fb2
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Junghoon Kim <jhoon20.kim@samsung.com>
Dongwoo Lee [Mon, 30 Oct 2017 06:05:16 +0000 (15:05 +0900)]
ARM64: dts: artik710_raptor: Enable extcon notifcation for usb connection
ARTIK710 has no specific peripheral for detecting USB connection,
but Tizen requires uevent on USB cable connection for executing SDB
daemon. To generate uevent for USB connection in dwc2 gadget driver
directly, this patch allows extcon notification feature.
Change-Id: I8a2f6749d763cdeb2272e5a0e6ac17d5b9dc9407
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
egukim [Wed, 11 Oct 2017 08:59:25 +0000 (17:59 +0900)]
ARM64: configs: artik710_raptor: Enable OPTEE Driver
Enable OPTEE Driver option.
Change-Id: Ibff6f828920ef24b9a6155ff8aea07c61da74b19
Signed-off-by: egukim <egukim@dignsys.com>
egukim [Tue, 24 Oct 2017 02:18:38 +0000 (11:18 +0900)]
ARM64: dts: s5p6816: Add optee node
Add device node for optee kernel driver.
Change-Id: I8e1dd750d49864ffa005c8ec3c59049ac46afa2b
Signed-off-by: egukim <egukim@dignsys.com>
Arnd Bergmann [Wed, 10 May 2017 19:05:16 +0000 (21:05 +0200)]
tee: add ARM_SMCCC dependency
For the moment, the tee subsystem only makes sense in combination with
the op-tee driver that depends on ARM_SMCCC, so let's hide the subsystem
from users that can't select that.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: I043b28e0e44ee8b9bb1310af4ff811af39fd5f84
Jens Wiklander [Mon, 1 Jun 2015 14:15:25 +0000 (16:15 +0200)]
Documentation: tee subsystem and op-tee driver
Acked-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: Iacbff6e88dff06afbde79a31bf46815555f26893
Jens Wiklander [Tue, 14 Apr 2015 12:33:20 +0000 (14:33 +0200)]
tee: add OP-TEE driver
Adds a OP-TEE driver which also can be compiled as a loadable module.
* Targets ARM and ARM64
* Supports using reserved memory from OP-TEE as shared memory
* Probes OP-TEE version using SMCs
* Accepts requests on privileged and unprivileged device
* Uses OPTEE message protocol version 2 to communicate with secure world
Acked-by: Andreas Dannenberg <dannenberg@ti.com>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey)
Tested-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> (RCAR H3)
Tested-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: I87123dc487f373028c56b2c6d2dc6dccf0248cfb
Jens Wiklander [Wed, 11 Mar 2015 13:39:39 +0000 (14:39 +0100)]
tee: generic TEE subsystem
Initial patch for generic TEE subsystem.
This subsystem provides:
* Registration/un-registration of TEE drivers.
* Shared memory between normal world and secure world.
* Ioctl interface for interaction with user space.
* Sysfs implementation_id of TEE driver
A TEE (Trusted Execution Environment) driver is a driver that interfaces
with a trusted OS running in some secure environment, for example,
TrustZone on ARM cpus, or a separate secure co-processor etc.
The TEE subsystem can serve a TEE driver for a Global Platform compliant
TEE, but it's not limited to only Global Platform TEEs.
This patch builds on other similar implementations trying to solve
the same problem:
* "optee_linuxdriver" by among others
Jean-michel DELORME<jean-michel.delorme@st.com> and
Emmanuel MICHEL <emmanuel.michel@st.com>
* "Generic TrustZone Driver" by Javier González <javier@javigon.com>
Acked-by: Andreas Dannenberg <dannenberg@ti.com>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey)
Tested-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> (RCAR H3)
Tested-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: Ie2c81bc713362b45389c3e7f9ce88513fd4dad5f
Jens Wiklander [Thu, 21 May 2015 05:47:09 +0000 (07:47 +0200)]
dt/bindings: add bindings for optee
Introduces linaro prefix and adds bindings for ARM TrustZone based OP-TEE
implementation.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: I56cdb480ee0fbcbbea1385c9da4583e8d5f2bebe
Gustavo Padovan [Tue, 26 Apr 2016 15:32:27 +0000 (12:32 -0300)]
kernel.h: add u64_to_user_ptr()
This function had copies in 3 different files. Unify them in kernel.h.
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Acked-by: Daniel Vetter <daniel.vetter@intel.com> [drm/i915/]
Acked-by: Rob Clark <robdclark@gmail.com> [drm/msm/]
Acked-by: Lucas Stach <l.stach@pengutronix.de> [drm/etinav/]
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[egukim: Backported from mainline kernel v4.12
- However, this patch does not include drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
- because it currently does not have an etnaviv driver on the base]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: Id2983d11540c58081f62d816b1048aec662a3ee3
Jens Wiklander [Mon, 4 Jan 2016 14:44:32 +0000 (15:44 +0100)]
ARM: 8480/2: arm64: add implementation for arm-smccc
Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: Idcb36da8256e308d48a8982b1d682e8ab7416175
Jens Wiklander [Mon, 4 Jan 2016 14:42:55 +0000 (15:42 +0100)]
ARM: 8479/2: add implementation for arm-smccc
Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC for
architectures that may support arm-smccc. It's the responsibility of the
caller to know if the SMC instruction is supported by the platform.
Reviewed-by: Lars Persson <lars.persson@axis.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: I029e75b9f2f623bf1e4c2e243537e930d96dc6cf
Jens Wiklander [Mon, 4 Jan 2016 14:37:32 +0000 (15:37 +0100)]
ARM: 8478/2: arm/arm64: add arm-smccc
Adds helpers to do SMC and HVC based on ARM SMC Calling Convention.
CONFIG_HAVE_ARM_SMCCC is enabled for architectures that may support the
SMC or HVC instruction. It's the responsibility of the caller to know if
the SMC instruction is supported by the platform.
This patch doesn't provide an implementation of the declared functions.
Later patches will bring in implementations and set
CONFIG_HAVE_ARM_SMCCC for ARM and ARM64 respectively.
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
[egukim: Backported from mainline kernel v4.12]
Signed-off-by:eunggu kim <egukim@dignsys.com>
Change-Id: I020f669ceb3925b2f71c5e3a0bb6694fffee30f5
Seung-Woo Kim [Wed, 25 Oct 2017 08:20:09 +0000 (17:20 +0900)]
packaging: add debuginfo package
Add debuginfo package with debug symbol including vmlinux,
System.map and build config.
Change-Id: I40c4fd0b95d45261da6e41e335f22dc380808f4c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Fri, 20 Oct 2017 06:05:27 +0000 (15:05 +0900)]
ARM: hw_breakpoint: blacklist nexell CPUs
On s5p4418 nexell soc, the kernel crashes in arch_hw_breakpoint_init
when CONFIG_PERF_EVENTS option is enabled, taking an undefined
instruction trap. Blacklist nexell CPUs as like Scorpion CPUs.
Reference:
ddc37832a134 ("ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs")
Change-Id: I2aa6f43467d2369e1d08ae02dd1b64fc4410a701
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Jaehoon Chung [Mon, 23 Oct 2017 10:50:36 +0000 (19:50 +0900)]
net: wireless: sd8977: Makefile: disable the CONFIG_DEBUG
Current debug level is used LEVEL1.
But it is displayed the log message like spamming.
Disable the CONFIG_DEBUG for wifi debug.
Change-Id: I9b112ae75375a17f373b8abccd7ae428e292edb4
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Karol Lewandowski [Wed, 18 Oct 2017 09:53:06 +0000 (11:53 +0200)]
arm: configs: artik530_raptor: Enable kprobes & uprobes
Enable features needed for D-Bus Observability Tools.
Change-Id: Ia9cb475a5befeedc948ea0e2969103ef34dcaf73
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Dongwoo Lee [Mon, 16 Oct 2017 07:03:02 +0000 (16:03 +0900)]
arm: dts: artik530_raptor: Enable extcon notification for usb connection
ARTIK530 has no extra peripheral for detecting USB cable connection,
but Tizen requires uevent on USB cable connection for enabling SDB
and MTP. To generate uevent for USB connection in dwc2 gadget driver
directly, this patch allows extcon notification of it.
Change-Id: I3d5b43c961b2f7c7f6d24294c2e34ba730495f3c
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Dongwoo Lee [Tue, 10 Oct 2017 06:06:57 +0000 (15:06 +0900)]
usb: dwc2: gadget: Add support for extcon notification
To provide extcon notification for the device which has no separated
peripherals for recognizing and notifying cable connection, this patch
adds support for extcon notification into dwc2 gadget interrupt
handler. If we set 'g-extcon-notify' property to dts, gadget driver
will directly generate extcon event for cable connection.
Change-Id: I6fd12c026e3e867a31d25a157921abb34bbd98dd
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Jaehoon Chung [Fri, 13 Oct 2017 10:03:56 +0000 (19:03 +0900)]
arm: config: arti530_raptor: disable the SWAP configuration
Disable the SWAP configuration.
Change-Id: Ic634b99ae19f80e5d7f9ebb82f5cbc831c3d6220
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Dongwoo Lee [Wed, 11 Oct 2017 01:18:21 +0000 (10:18 +0900)]
arm: configs: artik530_raptor: Enable extcon framework
Tizen activates its gadget such as MTP and SDB as following uevent
states. Thus, in order to generate uevent when USB cable is
connected, extcon framework will be used.
Change-Id: I040d444dd1b3f0d00807d64708df7fa5c330ad6b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
kibak.yoon [Fri, 13 Oct 2017 04:26:59 +0000 (13:26 +0900)]
configs: artik530/artik710_raptor: add i2c-stub to module
We need a test method for the i2c driver and framework on Artik.
And using a fake device is more convenient than a physical hardware device.
Therefore it would be good to enable i2c-stub for testing i2c feature on Artik.
This will be used for testing purposes only.
Change-Id: I893da44f54219dbd4c00fce0c8a2f0f97e93e967
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
Seung-Woo Kim [Tue, 26 Sep 2017 05:56:42 +0000 (14:56 +0900)]
configs: artik530_raptor/artik710_raptor: remove default hostname
Currently, tizen gets hostname from /proc/sys/kernel/hostname and
default hostname in config causes not matched result from
System.Net.Dns.GetHostName().
Remove the default hostname from each artik defconfigs.
Change-Id: Id95fab651726c3a0e833c337d5f80b90c4ef590d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Mon, 25 Sep 2017 11:03:07 +0000 (20:03 +0900)]
gpu: arm: mali400: r5p2_rel0: remove unused function build warnings
There are unused function build warnings. Remove the warnings with
__maybe_unused build macro.
Change-Id: If78df13c03a42a0c5f3e32956c39662aa4bac214
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Sat, 21 Jan 2017 03:28:57 +0000 (12:28 +0900)]
net: bcmdhd: fix non proper indent for if clause
non proper indent for if clause causes build error with gcc 6.
Fix the non proper indent to fix following build warning:
drivers/net/wireless/bcmdhd/dhd_sdio.c: In function 'dhd_bus_devreset':
drivers/net/wireless/bcmdhd/dhd_sdio.c:8919:6: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
} else
^~~~
drivers/net/wireless/bcmdhd/dhd_sdio.c:8922:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
dhd_os_sdunlock(dhdp);
^~~~~~~~~~~~~~~
Change-Id: I032eee3c74768988c5fb3bc75651ce802ba8954d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 17 Jan 2017 04:22:22 +0000 (13:22 +0900)]
net: bcmdhd: fix not to check same value in macro
When BCMBUSTYPE is not defined, then BUSTYPE(bustype) is just
bustype. So comparing bustype and BUSTYPE(bustype) is not necessary.
Fix not to check the same values.
This patch removes following build warning with gcc 6.
drivers/net/wireless/bcmdhd/siutils.c: In function 'si_doattach':
drivers/net/wireless/bcmdhd/siutils.c:564:14: warning: self-comparison always evaluates to false [-Wtautological-compare]
if (bustype != BUSTYPE(bustype)) {
^~
Change-Id: I1cac3dd31bcb86983469830013a1093ed9ceaa89
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Inki Dae [Mon, 25 Sep 2017 09:47:47 +0000 (18:47 +0900)]
drm/nexell: add render node support
Add render node support to rendering relevant ioctls.
Clients require access authorization from DRM master to access
some rendering relevant interfaces - especially flink things,
and it incurs performance drop due to hand-shaking between
Client and Server, DRM master.
So this patch makes access to these interfaces not to be required
anymore.
Change-Id: I73e6d448ce3bc2ac1770826d485e8eb54323e9ae
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Daniel Thompson [Tue, 22 Dec 2015 21:36:44 +0000 (19:36 -0200)]
drm: prime: Honour O_RDWR during prime-handle-to-fd
Currently DRM_IOCTL_PRIME_HANDLE_TO_FD rejects all flags except
(DRM|O)_CLOEXEC making it difficult (maybe impossible) for userspace
to mmap() the resulting dma-buf even when this is supported by the
DRM driver.
It is trivial to relax the restriction and permit read/write access.
This is safe because the flags are seldom touched by drm; mostly they
are passed verbatim to dma_buf calls.
v3 (Tiago): removed unused flags variable from drm_prime_handle_to_fd_ioctl.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1450820214-12509-2-git-send-email-tiago.vignatti@intel.com
[sw0312.kim: cherry-pick from mainline to support write mmap on dmabuf fd]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I906c4736840000c4c158cb641d3954bca2e27fca
Seung-Woo Kim [Mon, 12 Dec 2016 08:35:26 +0000 (17:35 +0900)]
Smack: ignore private inode for file functions
The access to fd from anon_inode is always failed because there is
no set xattr operations. So this patch fixes to ignore private
inode including anon_inode for file functions.
It was only ignored for smack_file_receive() to share dma-buf fd,
but dma-buf has other functions like ioctl and mmap.
Reference: https://lkml.org/lkml/2015/4/17/16
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[sw0312.kim: cherry-pick from mainline to fix SMACK issue during mmap on dmabuf fd]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I29c68baf9246779d468833182b06e0721f3eb51a
Rafal Krypa [Fri, 9 Dec 2016 13:03:04 +0000 (14:03 +0100)]
Smack: fix d_instantiate logic for sockfs and pipefs
Since
4b936885a (v2.6.32) all inodes on sockfs and pipefs are disconnected.
It caused filesystem specific code in smack_d_instantiate to be skipped,
because all inodes on those pseudo filesystems were treated as root inodes.
As a result all sockfs inodes had the Smack label set to floor.
In most cases access checks for sockets use socket_smack data so the inode
label is not important. But there are special cases that were broken.
One example would be calling fcntl with F_SETOWN command on a socket fd.
Now smack_d_instantiate expects all pipefs and sockfs inodes to be
disconnected and has the logic in appropriate place.
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[sw0312.kim: cherry-pick from main to fix SMACK issue realted with socket]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I1b55a8829b26259f4e0502f12aa27e423dd1cafe
Seung-Woo Kim [Tue, 29 Aug 2017 07:51:59 +0000 (16:51 +0900)]
ARM64: configs: artik710_raptor: disable SMACK permissive mode
Tizen should support security smack without permissive mode.
Change-Id: I03f61148ed3852d466ca798a6f43fddece400aab
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 07:50:40 +0000 (16:50 +0900)]
arm: configs: artik530_raptor: disable SMACK permissive mode
Tizen should support security smack without permissive mode.
Change-Id: I0084422d799c2f0469701feb39c6d5e5a7b1fe22
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 05:56:16 +0000 (14:56 +0900)]
ARM64: configs: artik710_raptor: enable AUDIT and SMACK_NETFILTER
On Tizen, nether service is failed because security smack netfilter
related configs are not enabled. So, enable related configs
including CONFIG_AUDIT, CONFIG_NETWORK_SECMARK, and
CONFIG_SECURITY_SMACK_NETFILTER and others.
Change-Id: If81a80cac377dea09424610f258ac3135c8a08d5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 05:50:01 +0000 (14:50 +0900)]
arm: configs: artik530_raptor: enable AUDIT and SMACK_NETFILTER
On Tizen, nether service is failed because security smack netfilter
related configs are not enabled. So, enable related configs
including CONFIG_AUDIT, CONFIG_NETWORK_SECMARK, and
CONFIG_SECURITY_SMACK_NETFILTER and others.
Change-Id: I5f41abd19e90edc72f38ea3e19bd699d3117a626
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Jaehoon Chung [Tue, 19 Sep 2017 05:39:01 +0000 (14:39 +0900)]
packaging: update the version nunmber
Update the version from 4.4.19 to 4.4.71.
Change-Id: If731f5502ff0a10a47e4694c748bd84d0058a289
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Inki Dae [Mon, 18 Sep 2017 06:54:14 +0000 (15:54 +0900)]
arm: configs: artik530_raptor_defconfig: reduce CMA area size
Reduce CMA area size from 256MB to 128MB due to faling CMA area reservation.
Change-Id: I2c4d76894ba9e00c40693adbb915d0b1aea31a3c
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Youngbok Park [Mon, 18 Sep 2017 04:55:31 +0000 (13:55 +0900)]
gpu: arm: mali400: Modified to use write_sec_by_id
This patch Modified to use secure device id write_sec_by_id().
Signed-off-by: Youngbok Park <ybpark@nexell.co.kr>
backported from ds kernel.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Change-Id: I71e17097ead042ef9b250c1db3af39e3685847ff
INSUN PYO [Mon, 4 Sep 2017 08:46:23 +0000 (17:46 +0900)]
configs: artik530_raptor/artik710_raptor: enable android logger
To support logger driver backend from Tizen dlog framework, enable
android logger.
Change-Id: I02bc6c4df6d8c75b335e16b9b3e0b4af51f6ff6d
Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 07:51:59 +0000 (16:51 +0900)]
ARM64: configs: artik710_raptor: disable SMACK permissive mode
Tizen should support security smack without permissive mode.
Change-Id: I03f61148ed3852d466ca798a6f43fddece400aab
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 07:50:40 +0000 (16:50 +0900)]
arm: configs: artik530_raptor: disable SMACK permissive mode
Tizen should support security smack without permissive mode.
Change-Id: I0084422d799c2f0469701feb39c6d5e5a7b1fe22
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 05:56:16 +0000 (14:56 +0900)]
ARM64: configs: artik710_raptor: enable AUDIT and SMACK_NETFILTER
On Tizen, nether service is failed because security smack netfilter
related configs are not enabled. So, enable related configs
including CONFIG_AUDIT, CONFIG_NETWORK_SECMARK, and
CONFIG_SECURITY_SMACK_NETFILTER and others.
Change-Id: If81a80cac377dea09424610f258ac3135c8a08d5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Tue, 29 Aug 2017 05:50:01 +0000 (14:50 +0900)]
arm: configs: artik530_raptor: enable AUDIT and SMACK_NETFILTER
On Tizen, nether service is failed because security smack netfilter
related configs are not enabled. So, enable related configs
including CONFIG_AUDIT, CONFIG_NETWORK_SECMARK, and
CONFIG_SECURITY_SMACK_NETFILTER and others.
Change-Id: I5f41abd19e90edc72f38ea3e19bd699d3117a626
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Denis Khalikov [Fri, 25 Aug 2017 13:11:14 +0000 (16:11 +0300)]
packaging: Disable UBSan build
UBSan build on kernel will cause build error because kernel has its own
sanitizer build options. So, dislable UBSan build from packaging spec.
Change-Id: I44d21706dfb917f098d8ad7cdc0742431059963e
Signed-off-by: Denis Khalikov <d.khalikov@partner.samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Karol Lewandowski [Mon, 3 Jul 2017 12:11:50 +0000 (14:11 +0200)]
staging: logger: rename log_events to log_apps for backward compatibility
Artik uses log_apps buffer instead of log_events
Change-Id: Ifd6cd5a98c9c74db2251da153bd767be177ee8fa
(cherry picked from commit
fc5c1f0b950c49a70f1ad11b2425298231f476a7)
Signed-off-by: scott park <scott.park@dignsys.com>
Inki Dae [Mon, 4 Jul 2016 08:28:46 +0000 (17:28 +0900)]
staging: logger: fix build error due to removed ki_nbytes
This patch fixes build error. Logger driver was removed
from mainline kernel and after that there was some changes and
one of them is that ki_nbytes member was removed from kiocb structure.
66ee59a fs: remove ki_nbytes
This patch makes count member of iov_iter structure to be used instead.
Change-Id: I070587d650596eb7ed93df7d99398f9e401a6579
Signed-off-by: Inki Dae <inki.dae@samsung.com>
(cherry picked from commit
71e4f7bd7ba18b540fcee954231b4c84ef046f0a)
Signed-off-by: scott park <scott.park@dignsys.com>
Karol Lewandowski [Mon, 3 Jul 2017 12:01:57 +0000 (14:01 +0200)]
Revert "staging: Remove logger and alarm-dev from android Makefile"
This reverts commit
71e365ed0ca893cae8d72cbd4b476a9589003098.
Conflicts:
drivers/staging/android/Makefile
Change-Id: I9acccb2b749d273338374413ffc3d188867ab6a4
(cherry picked from commit
6c34110bd759f6934be5f232027341296704060f)
Signed-off-by: scott park <scott.park@dignsys.com>
Karol Lewandowski [Mon, 3 Jul 2017 12:00:55 +0000 (14:00 +0200)]
Revert "staging: Remove the Android logger driver"
This reverts commit
a0a23bbce7818c90c3d3370af966fefce07a8c9b.
Conflicts:
drivers/staging/android/Kconfig
Change-Id: I142371b55700855750d67ad28699af1c5d1122a4
(cherry picked from commit
eb4c157d434ed5d15d9a9935c9e4cf4f1ab3d4f6)
Signed-off-by: scott park <scott.park@dignsys.com>
Gonzha Dmitriy Evgenevich [Wed, 24 May 2017 10:55:00 +0000 (13:55 +0300)]
Turn off building with ASan
Turn off ASan for ASan sanitized firmware build
Change-Id: Id497bff3bd43459d25b338ae1cd14e40711a125d
jino.cho [Tue, 31 Jan 2017 10:46:11 +0000 (19:46 +0900)]
packaging: add provided name for kernel image package
This patch adds default provided name for kernel image package as
linux-kernel.
Change-Id: I3cfc1178f0b17deabc09f9f7e8ed293c2c8c40c5
Signed-off-by: jino.cho <jino.cho@samsung.com>
Hyeongsik Min [Tue, 17 Jan 2017 06:46:26 +0000 (15:46 +0900)]
artik530_raptor: configs: fix linux kernel version
Change-Id: Ia7ed0c32272e94052e42505efa00c24c8c282a91
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
Hyeongsik Min [Tue, 17 Jan 2017 06:45:55 +0000 (15:45 +0900)]
artik710_raptor: configs: fix linux kernel version
Change-Id: I5adce88240d65344d82de3cf6498cd82dcec83d5
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
jino.cho [Wed, 7 Dec 2016 07:26:38 +0000 (16:26 +0900)]
Revert "artik710_raptor: configs: enable MALI_DMA_BUF_FENCE"
This reverts commit
0e6d1ad1801c1e72577bb62bdc6c24741a0f8407.
Conflicts:
arch/arm64/configs/artik710_raptor_defconfig
Change-Id: Id7a6c446e20725d0358747a70bfb08928818015f
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Wed, 7 Dec 2016 07:25:24 +0000 (16:25 +0900)]
Revert "artik530_raptor: configs: enable MALI_DMA_BUF_FENCE"
This reverts commit
3fac355f6f1a6d2c4f6af23df675d11d68aa6821.
Conflicts:
arch/arm/configs/artik530_raptor_defconfig
Change-Id: I97885263f136dc089f6d5d00d462b4c4499bac2f
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Mon, 7 Nov 2016 08:30:52 +0000 (17:30 +0900)]
packaging: add artik530 tizen build
This patch supports tizen rpmbuild for artik530 and modify artik710
build.
Change-Id: I755c74ea5d935b63d0c3a9d38028dbb1b1f82e4c
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 13 Oct 2016 02:35:16 +0000 (11:35 +0900)]
arm: defconfig: artik530: update configs for tizen
This patch updates configs for tizen.
Change-Id: I8ac7a4b04d5fc6f8a113454999c83d0e0baaa862
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 13 Oct 2016 02:30:03 +0000 (11:30 +0900)]
arm: dts: artik530: add panel physical size
This patch adds the physical size information of DSI panel
Change-Id: Ife8a7c8c2d2927c9dd324dce03a41a05179c910d
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 13 Oct 2016 02:27:25 +0000 (11:27 +0900)]
arm: dts: artik530: add Back key.
This patch adds Back key in order to exit application when it runs.
Change-Id: Iea4321ad162204816dd18ae94d5749922666a376
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 13 Oct 2016 02:21:04 +0000 (11:21 +0900)]
gpu: arm: mali400: use offscreen rendering dvfs policy
This modification brought from r6p2_01rel0.
This patch changes mali dvfs policy to offscreen rendering
because current mali dvfs policy is totally wrong.
For nexell chip, it doesn't need to select any other
clock value instead of full clock. During rendering,
the bus clock goes to maximum. If the GPU is idle,
the bus clock will be minimum.
Change-Id: I5e03b6596630c4f63cf5c45b20dff0171c205456
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 13 Oct 2016 01:14:43 +0000 (10:14 +0900)]
gpu: arm: mali400: add workaround code for secure access
This modification brought from r6p2_01rel0.
This patch adds workaround code for s5p4418. If s5p4418 runs kernel in
normal mode, access to mali register induces fault like below message.
"Unhandled fault: imprecise external abort (0x406) at 0xbe8bcdd0"
Access to mali register is possible by psci secure access extension.
This patch uses {write|read}_sec_reg api that is made for this case.
Change-Id: I23cc60047f81dafb6e8c22e568bccba30373522e
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Mon, 10 Oct 2016 10:30:20 +0000 (19:30 +0900)]
arm64: defconfig: artik710: disable unused security configs
This patch disables unused security configs below.
# CONFIG_SECURITY_SELINUX is not set
# CONFIG_SECURITY_APPARMOR is not set
# CONFIG_DEFAULT_SECURITY_DAC is not set
Change-Id: I7a53b453e4dcd01017caac2bc327fbf9214e07e0
Signed-off-by: jino.cho <jino.cho@samsung.com>
Chanho Park [Tue, 3 Jun 2014 10:54:53 +0000 (19:54 +0900)]
smack: add permissive mode for debugging purpose
This patch adds smack permissive mode.
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Conflicts:
security/smack/smack.h
security/smack/smackfs.c
Change-Id: Iea04a3ec4f82294b6655cb778804f5861f7a83a9
jino.cho [Thu, 18 Aug 2016 06:02:48 +0000 (15:02 +0900)]
drm: fix data structure mismatch between kernel and user
This patch fixes data structure mismatch issue between kerenl and user
space. In compat fuction, compat_drm_mode_addfb2(), there was no
consideration about the data structure mismatch.
Change-Id: Iae6568e6112a206f98ed7a380ba462de9d71ee5f
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Mon, 12 Sep 2016 08:31:12 +0000 (17:31 +0900)]
bcmdhd: Makefile: Enable the configuration for Tizen
Enable WRITE_MACADDR & PLATFORM_SLP option to create ".mac.info" file
for Tizen.
Change-Id: If6af5a38304ba64a4a8a2161a60c73c556fc65a2
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Wed, 28 Sep 2016 06:02:08 +0000 (15:02 +0900)]
net: wireless: bcmdhd: Fix NULL pointer error
This patch fixes NULL pointer error when the pointer of file path is NULL.
Change-Id: I344cf119f6900c1ebb8976af4b16227f393ab81c
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Mon, 12 Sep 2016 08:37:08 +0000 (17:37 +0900)]
LOCAL / net: bcmdbd: call vfs functions instead of direct file ops
This patch was made by reference to Przemyslaw Marczak's patch
on linux-exynos repository of Tizen Git.
LOCAL / net: bcm4358: call vfs functions instead of direct file ops
author Przemyslaw Marczak <p.marczak@samsung.com>
Mon, 2 Nov 2015 23:16:27 +0900 (15:16 +0100)
committer Marek Szyprowski <m.szyprowski@samsung.com>
Mon, 16 May 2016 16:19:57 +0900 (09:19 +0200)
commit
a0ca5befacaa52b9b876dee29c1b3db1e61fac24
LOCAL / net: bcm4358: call vfs functions instead of direct file ops
After enable writing the card's MAC address to filesystem by:
commit: LOCAL / net: bcm4358: Enable the some configurations
in the driver's code for bcmdhd4358, filesystem access is required
to read/write some settings, especially the card's MAC address.
Instead of calling proper fs functions, a direct calls were used
to particular file operations methods.
Since read/write operations are deprecated, the present code without
null pointer checking, refers to null function pointers.
This causes kernel panic when runs wpa_supplicant application.
This commit moves the direct calls to proper function calls,
which fixes the panic issue.
Change-Id: If964fc062a7ec791658a92930b48263bd474ffcb
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 25 Aug 2016 06:42:09 +0000 (15:42 +0900)]
arm64: dts: artik: add Back key.
This patch adds Back key in order to exit application when it runs.
Change-Id: Ic304c735229b40ece91374a71ec1e45052de6e3e
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Mon, 29 Aug 2016 10:03:55 +0000 (19:03 +0900)]
gpu: arm: mali400: set r5p2_rel0 as a default driver
This patch adds nexell platform codes on r5p2_rel0, and set r5p2_rel0 as
a default build driver because tizen 3.0 supports r5p2 only.
Change-Id: I951e751ce8d41b22b6360152036a4d1cf228b7d3
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 25 Aug 2016 06:28:20 +0000 (15:28 +0900)]
gpu: arm: mali400: add r5p2_rel0 driver
This patch adds mali400 original driver version r5p2 from ARM.
Signed-off-by: jino.cho <jino.cho@samsung.com>
Conflicts:
drivers/gpu/arm/mali400/Makefile
Change-Id: I580a6e909047170c152ae7b1357a5a4a7024387c
jino.cho [Thu, 25 Aug 2016 05:18:51 +0000 (14:18 +0900)]
gpu: arm: mali400: move mali driver to a r6p2-01rel0 folder
This is initial work to support multiple mali driver in mali400
directory.
Change-Id: I22a26a235db94d5c6c9f0713fb26109ff1c412b8
Signed-off-by: jino.cho <jino.cho@samsung.com>
jino.cho [Thu, 25 Aug 2016 05:04:33 +0000 (14:04 +0900)]
arm64: defconfig: set mali driver to a built-in module
This patch set mali driver to a built-in module in order to load
automatically after kernel boot.
Change-Id: I8d58f6dc491a9686de380c289a303bb411a02a39
Signed-off-by: jino.cho <jino.cho@samsung.com>
Conflicts:
arch/arm64/configs/artik710_raptor_defconfig
jino.cho [Thu, 25 Aug 2016 06:39:55 +0000 (15:39 +0900)]
arm64: defconfig: enable smack permissive mode
This patch turns on permissive mode to avoid
smack blocking during development. After fully supporting the
smack on the platform side, this option will be removed.
Change-Id: I66e56554ff31069d28bb1f81faf8845cf779182c
Signed-off-by: jino.cho <jino.cho@samsung.com>
Conflicts:
arch/arm64/configs/artik710_raptor_defconfig
jooseong lee [Wed, 20 Jul 2016 01:07:11 +0000 (10:07 +0900)]
Smack: Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook
Creating struct sock by sk_alloc function in various kernel subsystems
like bluetooth dosen't call smack_socket_post_create(). In such case,
received sock label is the floor('_') label and makes access deny.
Refers to:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=
7412301b76bd53ee53b860f611fc3b5b1c2245b5
Change-Id: I614c5f0e6d59be5ca6b49f0581edfef79fc334cf
Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
Roman Kubiak [Thu, 17 Dec 2015 12:24:35 +0000 (13:24 +0100)]
Smack: type confusion in smak sendmsg() handler
Smack security handler for sendmsg() syscall
is vulnerable to type confusion issue what
can allow to privilege escalation into root
or cause denial of service.
A malicious attacker can create socket of one
type for example AF_UNIX and pass is into
sendmsg() function ensuring that this is
AF_INET socket.
Remedy
Do not trust user supplied data.
Proposed fix below.
Signed-off-by: Roman Kubiak <r.kubiak@samsung.com>
Signed-off-by: Mateusz Fruba <m.fruba@samsung.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Casey Schaufler [Mon, 7 Dec 2015 22:34:32 +0000 (14:34 -0800)]
Smack: File receive for sockets
The existing file receive hook checks for access on
the file inode even for UDS. This is not right, as
the inode is not used by Smack to make access checks
for sockets. This change checks for an appropriate
access relationship between the receiving (current)
process and the socket. If the process can't write
to the socket's send label or the socket's receive
label can't write to the process fail.
This will allow the legitimate cases, where the
socket sender and socket receiver can freely communicate.
Only strangly set socket labels should cause a problem.
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
jinocho00 [Wed, 3 Aug 2016 05:18:21 +0000 (14:18 +0900)]
arm64: defconfig: update configs for tizen
This patch updates configs for tizen.
Change-Id: Ia3983421857147a1778ae2b5ad9558ce05dec099
Signed-off-by: jinocho00 <jino.cho@samsung.com>
Conflicts:
arch/arm64/configs/artik710_raptor_defconfig
jinocho00 [Wed, 17 Aug 2016 04:12:42 +0000 (13:12 +0900)]
arm64: dts: artik710-raptor-common: add panel physical size
This patch adds the physical size information of DSI panel.
Change-Id: I39013562a37c2a413123202f798692ff635f3403
Signed-off-by: jinocho00 <jino.cho@samsung.com>
jino.cho [Thu, 25 Aug 2016 06:44:53 +0000 (15:44 +0900)]
misc: tizen_global_lock: change node name
This patch changes the device node name of tizen_global_lock to "tgl".
Because, the libtbm backend module for ARTIK710 device looks for "tgl" as
a driver node name.
Change-Id: I62733ff2cff79f379b5ab9da3eb38cc7ec0130e8
Signed-off-by: jino.cho <jino.cho@samsung.com>
Seung-Woo Kim [Tue, 1 Sep 2015 12:41:14 +0000 (21:41 +0900)]
misc: tizen_global_lock: apply uaccess
This patch applies uaccess for user pointer to fix user memory
access.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Seung-Woo Kim [Wed, 4 Mar 2015 08:38:19 +0000 (17:38 +0900)]
misc: tizen_global_lock: add support for 32bt compat mode from 64bit
This patch adds support for 32bit compat mode, including compat_ioctl,
pointer casting and compat ioctl cmd, from 64bit system.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Joonyoung Shim [Tue, 29 Jan 2013 08:00:09 +0000 (17:00 +0900)]
misc: add global lock driver for TIZEN
This is the driver for tizen global lock feature for TIZEN specific and
will be removed if dma fence feature is enabled.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
jino.cho [Mon, 10 Oct 2016 06:48:03 +0000 (15:48 +0900)]
usb: gadget: fix build error
Change-Id: I22b53ddb02585333b32f88902bc2fdb29a5a3e08
Signed-off-by: jino.cho <jino.cho@samsung.com>
Jaewon Kim [Thu, 26 Feb 2015 07:38:13 +0000 (16:38 +0900)]
LOCAL / usb: gadget: change gadget connect order
This patch changes usb_gadget_connect() order before add config.
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Jaewon Kim [Tue, 2 Dec 2014 12:34:54 +0000 (21:34 +0900)]
local / usb: gadget: Add slp composite gadget
This patch adds slp composite gadget for tizen platform.
slp composite gadget code comes from android.c
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Jaehoon Chung [Tue, 29 Jan 2019 02:24:52 +0000 (11:24 +0900)]
Merge tag 'v4.4.172' into artik-nexell-4.4
This is the 4.4.172 stable release
Change-Id: I7e57d853856a713e162b4333e122e702e36974b0
Greg Kroah-Hartman [Sat, 26 Jan 2019 08:42:55 +0000 (09:42 +0100)]
Linux 4.4.172
Corey Minyard [Fri, 16 Nov 2018 15:59:21 +0000 (09:59 -0600)]
ipmi:ssif: Fix handling of multi-part return messages
commit
7d6380cd40f7993f75c4bde5b36f6019237e8719 upstream.
The block number was not being compared right, it was off by one
when checking the response.
Some statistics wouldn't be incremented properly in some cases.
Check to see if that middle-part messages always have 31 bytes of
data.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org # 4.4
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eric Dumazet [Sat, 23 Sep 2017 19:39:12 +0000 (12:39 -0700)]
net: speed up skb_rbtree_purge()
commit
7c90584c66cc4b033a3b684b0e0950f79e7b7166 upstream.
As measured in my prior patch ("sch_netem: faster rb tree removal"),
rbtree_postorder_for_each_entry_safe() is nice looking but much slower
than using rb_next() directly, except when tree is small enough
to fit in CPU caches (then the cost is the same)
Also note that there is not even an increase of text size :
$ size net/core/skbuff.o.before net/core/skbuff.o
text data bss dec hex filename
40711 1298 0 42009 a419 net/core/skbuff.o.before
40711 1298 0 42009 a419 net/core/skbuff.o
From: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michal Hocko [Fri, 28 Dec 2018 08:38:17 +0000 (00:38 -0800)]
mm, proc: be more verbose about unstable VMA flags in /proc/<pid>/smaps
[ Upstream commit
7550c6079846a24f30d15ac75a941c8515dbedfb ]
Patch series "THP eligibility reporting via proc".
This series of three patches aims at making THP eligibility reporting much
more robust and long term sustainable. The trigger for the change is a
regression report [2] and the long follow up discussion. In short the
specific application didn't have good API to query whether a particular
mapping can be backed by THP so it has used VMA flags to workaround that.
These flags represent a deep internal state of VMAs and as such they
should be used by userspace with a great deal of caution.
A similar has happened for [3] when users complained that VM_MIXEDMAP is
no longer set on DAX mappings. Again a lack of a proper API led to an
abuse.
The first patch in the series tries to emphasise that that the semantic of
flags might change and any application consuming those should be really
careful.
The remaining two patches provide a more suitable interface to address [2]
and provide a consistent API to query the THP status both for each VMA and
process wide as well. [1]
http://lkml.kernel.org/r/
20181120103515.25280-1-mhocko@kernel.org [2]
http://lkml.kernel.org/r/http://lkml.kernel.org/r/alpine.DEB.2.21.
1809241054050.224429@chino.kir.corp.google.com
[3] http://lkml.kernel.org/r/
20181002100531.GC4135@quack2.suse.cz
This patch (of 3):
Even though vma flags exported via /proc/<pid>/smaps are explicitly
documented to be not guaranteed for future compatibility the warning
doesn't go far enough because it doesn't mention semantic changes to those
flags. And they are important as well because these flags are a deep
implementation internal to the MM code and the semantic might change at
any time.
Let's consider two recent examples:
http://lkml.kernel.org/r/
20181002100531.GC4135@quack2.suse.cz
: commit
e1fb4a086495 "dax: remove VM_MIXEDMAP for fsdax and device dax" has
: removed VM_MIXEDMAP flag from DAX VMAs. Now our testing shows that in the
: mean time certain customer of ours started poking into /proc/<pid>/smaps
: and looks at VMA flags there and if VM_MIXEDMAP is missing among the VMA
: flags, the application just fails to start complaining that DAX support is
: missing in the kernel.
http://lkml.kernel.org/r/alpine.DEB.2.21.
1809241054050.224429@chino.kir.corp.google.com
: Commit
1860033237d4 ("mm: make PR_SET_THP_DISABLE immediately active")
: introduced a regression in that userspace cannot always determine the set
: of vmas where thp is ineligible.
: Userspace relies on the "nh" flag being emitted as part of /proc/pid/smaps
: to determine if a vma is eligible to be backed by hugepages.
: Previous to this commit, prctl(PR_SET_THP_DISABLE, 1) would cause thp to
: be disabled and emit "nh" as a flag for the corresponding vmas as part of
: /proc/pid/smaps. After the commit, thp is disabled by means of an mm
: flag and "nh" is not emitted.
: This causes smaps parsing libraries to assume a vma is eligible for thp
: and ends up puzzling the user on why its memory is not backed by thp.
In both cases userspace was relying on a semantic of a specific VMA flag.
The primary reason why that happened is a lack of a proper interface.
While this has been worked on and it will be fixed properly, it seems that
our wording could see some refinement and be more vocal about semantic
aspect of these flags as well.
Link: http://lkml.kernel.org/r/20181211143641.3503-2-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Paul Oppenheimer <bepvte@gmail.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Brian Foster [Fri, 28 Dec 2018 08:37:20 +0000 (00:37 -0800)]
mm/page-writeback.c: don't break integrity writeback on ->writepage() error
[ Upstream commit
3fa750dcf29e8606e3969d13d8e188cc1c0f511d ]
write_cache_pages() is used in both background and integrity writeback
scenarios by various filesystems. Background writeback is mostly
concerned with cleaning a certain number of dirty pages based on various
mm heuristics. It may not write the full set of dirty pages or wait for
I/O to complete. Integrity writeback is responsible for persisting a set
of dirty pages before the writeback job completes. For example, an
fsync() call must perform integrity writeback to ensure data is on disk
before the call returns.
write_cache_pages() unconditionally breaks out of its processing loop in
the event of a ->writepage() error. This is fine for background
writeback, which had no strict requirements and will eventually come
around again. This can cause problems for integrity writeback on
filesystems that might need to clean up state associated with failed page
writeouts. For example, XFS performs internal delayed allocation
accounting before returning a ->writepage() error, where applicable. If
the current writeback happens to be associated with an unmount and
write_cache_pages() completes the writeback prematurely due to error, the
filesystem is unmounted in an inconsistent state if dirty+delalloc pages
still exist.
To handle this problem, update write_cache_pages() to always process the
full set of pages for integrity writeback regardless of ->writepage()
errors. Save the first encountered error and return it to the caller once
complete. This facilitates XFS (or any other fs that expects integrity
writeback to process the entire set of dirty pages) to clean up its
internal state completely in the event of persistent mapping errors.
Background writeback continues to exit on the first error encountered.
[akpm@linux-foundation.org: fix typo in comment]
Link: http://lkml.kernel.org/r/20181116134304.32440-1-bfoster@redhat.com
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Junxiao Bi [Fri, 28 Dec 2018 08:32:50 +0000 (00:32 -0800)]
ocfs2: fix panic due to unrecovered local alloc
[ Upstream commit
532e1e54c8140188e192348c790317921cb2dc1c ]
mount.ocfs2 ignore the inconsistent error that journal is clean but
local alloc is unrecovered. After mount, local alloc not empty, then
reserver cluster didn't alloc a new local alloc window, reserveration
map is empty(ocfs2_reservation_map.m_bitmap_len = 0), that triggered the
following panic.
This issue was reported at
https://oss.oracle.com/pipermail/ocfs2-devel/2015-May/010854.html
and was advised to fixed during mount. But this is a very unusual
inconsistent state, usually journal dirty flag should be cleared at the
last stage of umount until every other things go right. We may need do
further debug to check that. Any way to avoid possible futher
corruption, mount should be abort and fsck should be run.
(mount.ocfs2,1765,1):ocfs2_load_local_alloc:353 ERROR: Local alloc hasn't been recovered!
found = 6518, set = 6518, taken = 8192, off =
15912372
ocfs2: Mounting device (202,64) on (node 0, slot 3) with ordered data mode.
o2dlm: Joining domain
89CEAC63CC4F4D03AC185B44E0EE0F3F ( 0 1 2 3 4 5 6 8 ) 8 nodes
ocfs2: Mounting device (202,80) on (node 0, slot 3) with ordered data mode.
o2hb: Region
89CEAC63CC4F4D03AC185B44E0EE0F3F (xvdf) is now a quorum device
o2net: Accepted connection from node yvwsoa17p (num 7) at 172.22.77.88:7777
o2dlm: Node 7 joins domain
64FE421C8C984E6D96ED12C55FEE2435 ( 0 1 2 3 4 5 6 7 8 ) 9 nodes
o2dlm: Node 7 joins domain
89CEAC63CC4F4D03AC185B44E0EE0F3F ( 0 1 2 3 4 5 6 7 8 ) 9 nodes
------------[ cut here ]------------
kernel BUG at fs/ocfs2/reservations.c:507!
invalid opcode: 0000 [#1] SMP
Modules linked in: ocfs2 rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs fscache lockd grace ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs sunrpc ipt_REJECT nf_reject_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 ovmapi ppdev parport_pc parport xen_netfront fb_sys_fops sysimgblt sysfillrect syscopyarea acpi_cpufreq pcspkr i2c_piix4 i2c_core sg ext4 jbd2 mbcache2 sr_mod cdrom xen_blkfront pata_acpi ata_generic ata_piix floppy dm_mirror dm_region_hash dm_log dm_mod
CPU: 0 PID: 4349 Comm: startWebLogic.s Not tainted 4.1.12-124.19.2.el6uek.x86_64 #2
Hardware name: Xen HVM domU, BIOS 4.4.4OVM 09/06/2018
task:
ffff8803fb04e200 ti:
ffff8800ea4d8000 task.ti:
ffff8800ea4d8000
RIP: 0010:[<
ffffffffa05e96a8>] [<
ffffffffa05e96a8>] __ocfs2_resv_find_window+0x498/0x760 [ocfs2]
Call Trace:
ocfs2_resmap_resv_bits+0x10d/0x400 [ocfs2]
ocfs2_claim_local_alloc_bits+0xd0/0x640 [ocfs2]
__ocfs2_claim_clusters+0x178/0x360 [ocfs2]
ocfs2_claim_clusters+0x1f/0x30 [ocfs2]
ocfs2_convert_inline_data_to_extents+0x634/0xa60 [ocfs2]
ocfs2_write_begin_nolock+0x1c6/0x1da0 [ocfs2]
ocfs2_write_begin+0x13e/0x230 [ocfs2]
generic_perform_write+0xbf/0x1c0
__generic_file_write_iter+0x19c/0x1d0
ocfs2_file_write_iter+0x589/0x1360 [ocfs2]
__vfs_write+0xb8/0x110
vfs_write+0xa9/0x1b0
SyS_write+0x46/0xb0
system_call_fastpath+0x18/0xd7
Code: ff ff 8b 75 b8 39 75 b0 8b 45 c8 89 45 98 0f 84 e5 fe ff ff 45 8b 74 24 18 41 8b 54 24 1c e9 56 fc ff ff 85 c0 0f 85 48 ff ff ff <0f> 0b 48 8b 05 cf c3 de ff 48 ba 00 00 00 00 00 00 00 10 48 85
RIP __ocfs2_resv_find_window+0x498/0x760 [ocfs2]
RSP <
ffff8800ea4db668>
---[ end trace
566f07529f2edf3c ]---
Kernel panic - not syncing: Fatal exception
Kernel Offset: disabled
Link: http://lkml.kernel.org/r/20181121020023.3034-2-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Acked-by: Joseph Qi <jiangqi903@gmail.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Qian Cai [Thu, 13 Dec 2018 13:27:27 +0000 (08:27 -0500)]
scsi: megaraid: fix out-of-bound array accesses
[ Upstream commit
c7a082e4242fd8cd21a441071e622f87c16bdacc ]
UBSAN reported those with MegaRAID SAS-3 3108,
[ 77.467308] UBSAN: Undefined behaviour in drivers/scsi/megaraid/megaraid_sas_fp.c:117:32
[ 77.475402] index 255 is out of range for type 'MR_LD_SPAN_MAP [1]'
[ 77.481677] CPU: 16 PID: 333 Comm: kworker/16:1 Not tainted 4.20.0-rc5+ #1
[ 77.488556] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.50 06/01/2018
[ 77.495791] Workqueue: events work_for_cpu_fn
[ 77.500154] Call trace:
[ 77.502610] dump_backtrace+0x0/0x2c8
[ 77.506279] show_stack+0x24/0x30
[ 77.509604] dump_stack+0x118/0x19c
[ 77.513098] ubsan_epilogue+0x14/0x60
[ 77.516765] __ubsan_handle_out_of_bounds+0xfc/0x13c
[ 77.521767] mr_update_load_balance_params+0x150/0x158 [megaraid_sas]
[ 77.528230] MR_ValidateMapInfo+0x2cc/0x10d0 [megaraid_sas]
[ 77.533825] megasas_get_map_info+0x244/0x2f0 [megaraid_sas]
[ 77.539505] megasas_init_adapter_fusion+0x9b0/0xf48 [megaraid_sas]
[ 77.545794] megasas_init_fw+0x1ab4/0x3518 [megaraid_sas]
[ 77.551212] megasas_probe_one+0x2c4/0xbe0 [megaraid_sas]
[ 77.556614] local_pci_probe+0x7c/0xf0
[ 77.560365] work_for_cpu_fn+0x34/0x50
[ 77.564118] process_one_work+0x61c/0xf08
[ 77.568129] worker_thread+0x534/0xa70
[ 77.571882] kthread+0x1c8/0x1d0
[ 77.575114] ret_from_fork+0x10/0x1c
[ 89.240332] UBSAN: Undefined behaviour in drivers/scsi/megaraid/megaraid_sas_fp.c:117:32
[ 89.248426] index 255 is out of range for type 'MR_LD_SPAN_MAP [1]'
[ 89.254700] CPU: 16 PID: 95 Comm: kworker/u130:0 Not tainted 4.20.0-rc5+ #1
[ 89.261665] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.50 06/01/2018
[ 89.268903] Workqueue: events_unbound async_run_entry_fn
[ 89.274222] Call trace:
[ 89.276680] dump_backtrace+0x0/0x2c8
[ 89.280348] show_stack+0x24/0x30
[ 89.283671] dump_stack+0x118/0x19c
[ 89.287167] ubsan_epilogue+0x14/0x60
[ 89.290835] __ubsan_handle_out_of_bounds+0xfc/0x13c
[ 89.295828] MR_LdRaidGet+0x50/0x58 [megaraid_sas]
[ 89.300638] megasas_build_io_fusion+0xbb8/0xd90 [megaraid_sas]
[ 89.306576] megasas_build_and_issue_cmd_fusion+0x138/0x460 [megaraid_sas]
[ 89.313468] megasas_queue_command+0x398/0x3d0 [megaraid_sas]
[ 89.319222] scsi_dispatch_cmd+0x1dc/0x8a8
[ 89.323321] scsi_request_fn+0x8e8/0xdd0
[ 89.327249] __blk_run_queue+0xc4/0x158
[ 89.331090] blk_execute_rq_nowait+0xf4/0x158
[ 89.335449] blk_execute_rq+0xdc/0x158
[ 89.339202] __scsi_execute+0x130/0x258
[ 89.343041] scsi_probe_and_add_lun+0x2fc/0x1488
[ 89.347661] __scsi_scan_target+0x1cc/0x8c8
[ 89.351848] scsi_scan_channel.part.3+0x8c/0xc0
[ 89.356382] scsi_scan_host_selected+0x130/0x1f0
[ 89.361002] do_scsi_scan_host+0xd8/0xf0
[ 89.364927] do_scan_async+0x9c/0x320
[ 89.368594] async_run_entry_fn+0x138/0x420
[ 89.372780] process_one_work+0x61c/0xf08
[ 89.376793] worker_thread+0x13c/0xa70
[ 89.380546] kthread+0x1c8/0x1d0
[ 89.383778] ret_from_fork+0x10/0x1c
This is because when populating Driver Map using firmware raid map, all
non-existing VDs set their ldTgtIdToLd to 0xff, so it can be skipped later.
From drivers/scsi/megaraid/megaraid_sas_base.c ,
memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
From drivers/scsi/megaraid/megaraid_sas_fp.c ,
/* For non existing VDs, iterate to next VD*/
if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
continue;
However, there are a few places that failed to skip those non-existing VDs
due to off-by-one errors. Then, those 0xff leaked into MR_LdRaidGet(0xff,
map) and triggered the out-of-bound accesses.
Fixes:
51087a8617fe ("megaraid_sas : Extended VD support")
Signed-off-by: Qian Cai <cai@lca.pw>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Daniel Vetter [Wed, 19 Dec 2018 12:39:09 +0000 (13:39 +0100)]
sysfs: Disable lockdep for driver bind/unbind files
[ Upstream commit
4f4b374332ec0ae9c738ff8ec9bed5cd97ff9adc ]
This is the much more correct fix for my earlier attempt at:
https://lkml.org/lkml/2018/12/10/118
Short recap:
- There's not actually a locking issue, it's just lockdep being a bit
too eager to complain about a possible deadlock.
- Contrary to what I claimed the real problem is recursion on
kn->count. Greg pointed me at sysfs_break_active_protection(), used
by the scsi subsystem to allow a sysfs file to unbind itself. That
would be a real deadlock, which isn't what's happening here. Also,
breaking the active protection means we'd need to manually handle
all the lifetime fun.
- With Rafael we discussed the task_work approach, which kinda works,
but has two downsides: It's a functional change for a lockdep
annotation issue, and it won't work for the bind file (which needs
to get the errno from the driver load function back to userspace).
- Greg also asked why this never showed up: To hit this you need to
unregister a 2nd driver from the unload code of your first driver. I
guess only gpus do that. The bug has always been there, but only
with a recent patch series did we add more locks so that lockdep
built a chain from unbinding the snd-hda driver to the
acpi_video_unregister call.
Full lockdep splat:
[12301.898799] ============================================
[12301.898805] WARNING: possible recursive locking detected
[12301.898811] 4.20.0-rc7+ #84 Not tainted
[12301.898815] --------------------------------------------
[12301.898821] bash/5297 is trying to acquire lock:
[12301.898826]
00000000f61c6093 (kn->count#39){++++}, at: kernfs_remove_by_name_ns+0x3b/0x80
[12301.898841] but task is already holding lock:
[12301.898847]
000000005f634021 (kn->count#39){++++}, at: kernfs_fop_write+0xdc/0x190
[12301.898856] other info that might help us debug this:
[12301.898862] Possible unsafe locking scenario:
[12301.898867] CPU0
[12301.898870] ----
[12301.898874] lock(kn->count#39);
[12301.898879] lock(kn->count#39);
[12301.898883] *** DEADLOCK ***
[12301.898891] May be due to missing lock nesting notation
[12301.898899] 5 locks held by bash/5297:
[12301.898903] #0:
00000000cd800e54 (sb_writers#4){.+.+}, at: vfs_write+0x17f/0x1b0
[12301.898915] #1:
000000000465e7c2 (&of->mutex){+.+.}, at: kernfs_fop_write+0xd3/0x190
[12301.898925] #2:
000000005f634021 (kn->count#39){++++}, at: kernfs_fop_write+0xdc/0x190
[12301.898936] #3:
00000000414ef7ac (&dev->mutex){....}, at: device_release_driver_internal+0x34/0x240
[12301.898950] #4:
000000003218fbdf (register_count_mutex){+.+.}, at: acpi_video_unregister+0xe/0x40
[12301.898960] stack backtrace:
[12301.898968] CPU: 1 PID: 5297 Comm: bash Not tainted 4.20.0-rc7+ #84
[12301.898974] Hardware name: Hewlett-Packard HP EliteBook 8460p/161C, BIOS 68SCF Ver. F.01 03/11/2011
[12301.898982] Call Trace:
[12301.898989] dump_stack+0x67/0x9b
[12301.898997] __lock_acquire+0x6ad/0x1410
[12301.899003] ? kernfs_remove_by_name_ns+0x3b/0x80
[12301.899010] ? find_held_lock+0x2d/0x90
[12301.899017] ? mutex_spin_on_owner+0xe4/0x150
[12301.899023] ? find_held_lock+0x2d/0x90
[12301.899030] ? lock_acquire+0x90/0x180
[12301.899036] lock_acquire+0x90/0x180
[12301.899042] ? kernfs_remove_by_name_ns+0x3b/0x80
[12301.899049] __kernfs_remove+0x296/0x310
[12301.899055] ? kernfs_remove_by_name_ns+0x3b/0x80
[12301.899060] ? kernfs_name_hash+0xd/0x80
[12301.899066] ? kernfs_find_ns+0x6c/0x100
[12301.899073] kernfs_remove_by_name_ns+0x3b/0x80
[12301.899080] bus_remove_driver+0x92/0xa0
[12301.899085] acpi_video_unregister+0x24/0x40
[12301.899127] i915_driver_unload+0x42/0x130 [i915]
[12301.899160] i915_pci_remove+0x19/0x30 [i915]
[12301.899169] pci_device_remove+0x36/0xb0
[12301.899176] device_release_driver_internal+0x185/0x240
[12301.899183] unbind_store+0xaf/0x180
[12301.899189] kernfs_fop_write+0x104/0x190
[12301.899195] __vfs_write+0x31/0x180
[12301.899203] ? rcu_read_lock_sched_held+0x6f/0x80
[12301.899209] ? rcu_sync_lockdep_assert+0x29/0x50
[12301.899216] ? __sb_start_write+0x13c/0x1a0
[12301.899221] ? vfs_write+0x17f/0x1b0
[12301.899227] vfs_write+0xb9/0x1b0
[12301.899233] ksys_write+0x50/0xc0
[12301.899239] do_syscall_64+0x4b/0x180
[12301.899247] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[12301.899253] RIP: 0033:0x7f452ac7f7a4
[12301.899259] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 80 00 00 00 00 8b 05 aa f0 2c 00 48 63 ff 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 f3 c3 66 90 55 53 48 89 d5 48 89 f3 48 83
[12301.899273] RSP: 002b:
00007ffceafa6918 EFLAGS:
00000246 ORIG_RAX:
0000000000000001
[12301.899282] RAX:
ffffffffffffffda RBX:
000000000000000d RCX:
00007f452ac7f7a4
[12301.899288] RDX:
000000000000000d RSI:
00005612a1abf7c0 RDI:
0000000000000001
[12301.899295] RBP:
00005612a1abf7c0 R08:
000000000000000a R09:
00005612a1c46730
[12301.899301] R10:
000000000000000a R11:
0000000000000246 R12:
000000000000000d
[12301.899308] R13:
0000000000000001 R14:
00007f452af4a740 R15:
000000000000000d
Looking around I've noticed that usb and i2c already handle similar
recursion problems, where a sysfs file can unbind the same type of
sysfs somewhere else in the hierarchy. Relevant commits are:
commit
356c05d58af05d582e634b54b40050c73609617b
Author: Alan Stern <stern@rowland.harvard.edu>
Date: Mon May 14 13:30:03 2012 -0400
sysfs: get rid of some lockdep false positives
commit
e9b526fe704812364bca07edd15eadeba163ebfb
Author: Alexander Sverdlin <alexander.sverdlin@nsn.com>
Date: Fri May 17 14:56:35 2013 +0200
i2c: suppress lockdep warning on delete_device
Implement the same trick for driver bind/unbind.
v2: Put the macro into bus.c (Greg).
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Ramalingam C <ramalingam.c@intel.com>
Cc: Arend van Spriel <aspriel@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Vivek Gautam <vivek.gautam@codeaurora.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Takashi Sakamoto [Wed, 19 Dec 2018 11:00:42 +0000 (20:00 +0900)]
ALSA: bebob: fix model-id of unit for Apogee Ensemble
[ Upstream commit
644b2e97405b0b74845e1d3c2b4fe4c34858062b ]
This commit fixes hard-coded model-id for an unit of Apogee Ensemble with
a correct value. This unit uses DM1500 ASIC produced ArchWave AG (formerly
known as BridgeCo AG).
I note that this model supports three modes in the number of data channels
in tx/rx streams; 8 ch pairs, 10 ch pairs, 18 ch pairs. The mode is
switched by Vendor-dependent AV/C command, like:
$ cd linux-firewire-utils
$ ./firewire-request /dev/fw1 fcp 0x00ff000003dbeb0600000000 (8ch pairs)
$ ./firewire-request /dev/fw1 fcp 0x00ff000003dbeb0601000000 (10ch pairs)
$ ./firewire-request /dev/fw1 fcp 0x00ff000003dbeb0602000000 (18ch pairs)
When switching between different mode, the unit disappears from IEEE 1394
bus, then appears on the bus with different combination of stream formats.
In a mode of 18 ch pairs, available sampling rate is up to 96.0 kHz, else
up to 192.0 kHz.
$ ./hinawa-config-rom-printer /dev/fw1
{ 'bus-info': { 'adj': False,
'bmc': True,
'chip_ID':
21474898341,
'cmc': True,
'cyc_clk_acc': 100,
'generation': 2,
'imc': True,
'isc': True,
'link_spd': 2,
'max_ROM': 1,
'max_rec': 512,
'name': '1394',
'node_vendor_ID': 987,
'pmc': False},
'root-directory': [ ['HARDWARE_VERSION', 19],
[ 'NODE_CAPABILITIES',
{ 'addressing': {'64': True, 'fix': True, 'prv': False},
'misc': {'int': False, 'ms': False, 'spt': True},
'state': { 'atn': False,
'ded': False,
'drq': True,
'elo': False,
'init': False,
'lst': True,
'off': False},
'testing': {'bas': False, 'ext': False}}],
['VENDOR', 987],
['DESCRIPTOR', 'Apogee Electronics'],
['MODEL', 126702],
['DESCRIPTOR', 'Ensemble'],
['VERSION', 5297],
[ 'UNIT',
[ ['SPECIFIER_ID', 41005],
['VERSION', 65537],
['MODEL', 126702],
['DESCRIPTOR', 'Ensemble']]],
[ 'DEPENDENT_INFO',
[ ['SPECIFIER_ID', 2037],
['VERSION', 1],
[(58, 'IMMEDIATE'),
16777159],
[(59, 'IMMEDIATE'), 1048576],
[(60, 'IMMEDIATE'),
16777159],
[(61, 'IMMEDIATE'), 6291456]]]]}
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Nikos Tsironis [Wed, 31 Oct 2018 21:53:08 +0000 (17:53 -0400)]
dm snapshot: Fix excessive memory usage and workqueue stalls
[ Upstream commit
721b1d98fb517ae99ab3b757021cf81db41e67be ]
kcopyd has no upper limit to the number of jobs one can allocate and
issue. Under certain workloads this can lead to excessive memory usage
and workqueue stalls. For example, when creating multiple dm-snapshot
targets with a 4K chunk size and then writing to the origin through the
page cache. Syncing the page cache causes a large number of BIOs to be
issued to the dm-snapshot origin target, which itself issues an even
larger (because of the BIO splitting taking place) number of kcopyd
jobs.
Running the following test, from the device mapper test suite [1],
dmtest run --suite snapshot -n many_snapshots_of_same_volume_N
, with 8 active snapshots, results in the kcopyd job slab cache growing
to 10G. Depending on the available system RAM this can lead to the OOM
killer killing user processes:
[463.492878] kthreadd invoked oom-killer: gfp_mask=0x6040c0(GFP_KERNEL|__GFP_COMP),
nodemask=(null), order=1, oom_score_adj=0
[463.492894] kthreadd cpuset=/ mems_allowed=0
[463.492948] CPU: 7 PID: 2 Comm: kthreadd Not tainted 4.19.0-rc7 #3
[463.492950] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
[463.492952] Call Trace:
[463.492964] dump_stack+0x7d/0xbb
[463.492973] dump_header+0x6b/0x2fc
[463.492987] ? lockdep_hardirqs_on+0xee/0x190
[463.493012] oom_kill_process+0x302/0x370
[463.493021] out_of_memory+0x113/0x560
[463.493030] __alloc_pages_slowpath+0xf40/0x1020
[463.493055] __alloc_pages_nodemask+0x348/0x3c0
[463.493067] cache_grow_begin+0x81/0x8b0
[463.493072] ? cache_grow_begin+0x874/0x8b0
[463.493078] fallback_alloc+0x1e4/0x280
[463.493092] kmem_cache_alloc_node+0xd6/0x370
[463.493098] ? copy_process.part.31+0x1c5/0x20d0
[463.493105] copy_process.part.31+0x1c5/0x20d0
[463.493115] ? __lock_acquire+0x3cc/0x1550
[463.493121] ? __switch_to_asm+0x34/0x70
[463.493129] ? kthread_create_worker_on_cpu+0x70/0x70
[463.493135] ? finish_task_switch+0x90/0x280
[463.493165] _do_fork+0xe0/0x6d0
[463.493191] ? kthreadd+0x19f/0x220
[463.493233] kernel_thread+0x25/0x30
[463.493235] kthreadd+0x1bf/0x220
[463.493242] ? kthread_create_on_cpu+0x90/0x90
[463.493248] ret_from_fork+0x3a/0x50
[463.493279] Mem-Info:
[463.493285] active_anon:20631 inactive_anon:4831 isolated_anon:0
[463.493285] active_file:80216 inactive_file:80107 isolated_file:435
[463.493285] unevictable:0 dirty:51266 writeback:109372 unstable:0
[463.493285] slab_reclaimable:31191 slab_unreclaimable:3483521
[463.493285] mapped:526 shmem:4903 pagetables:1759 bounce:0
[463.493285] free:33623 free_pcp:2392 free_cma:0
...
[463.493489] Unreclaimable slab info:
[463.493513] Name Used Total
[463.493522] bio-6 1028KB 1028KB
[463.493525] bio-5 1028KB 1028KB
[463.493528] dm_snap_pending_exception 236783KB 243789KB
[463.493531] dm_exception 41KB 42KB
[463.493534] bio-4 1216KB 1216KB
[463.493537] bio-3 439396KB 439396KB
[463.493539] kcopyd_job 6973427KB 6973427KB
...
[463.494340] Out of memory: Kill process 1298 (ruby2.3) score 1 or sacrifice child
[463.494673] Killed process 1298 (ruby2.3) total-vm:435740kB, anon-rss:20180kB, file-rss:4kB, shmem-rss:0kB
[463.506437] oom_reaper: reaped process 1298 (ruby2.3), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Moreover, issuing a large number of kcopyd jobs results in kcopyd
hogging the CPU, while processing them. As a result, processing of work
items, queued for execution on the same CPU as the currently running
kcopyd thread, is stalled for long periods of time, hurting performance.
Running the aforementioned test we get, in dmesg, messages like the
following:
[67501.194592] BUG: workqueue lockup - pool cpus=4 node=0 flags=0x0 nice=0 stuck for 27s!
[67501.195586] Showing busy workqueues and worker pools:
[67501.195591] workqueue events: flags=0x0
[67501.195597] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195611] pending: cache_reap
[67501.195641] workqueue mm_percpu_wq: flags=0x8
[67501.195645] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195656] pending: vmstat_update
[67501.195682] workqueue kblockd: flags=0x18
[67501.195687] pwq 5: cpus=2 node=0 flags=0x0 nice=-20 active=1/256
[67501.195698] pending: blk_timeout_work
[67501.195753] workqueue kcopyd: flags=0x8
[67501.195757] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195768] pending: do_work [dm_mod]
[67501.195802] workqueue kcopyd: flags=0x8
[67501.195806] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195817] pending: do_work [dm_mod]
[67501.195834] workqueue kcopyd: flags=0x8
[67501.195838] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195848] pending: do_work [dm_mod]
[67501.195881] workqueue kcopyd: flags=0x8
[67501.195885] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=1/256
[67501.195896] pending: do_work [dm_mod]
[67501.195920] workqueue kcopyd: flags=0x8
[67501.195924] pwq 8: cpus=4 node=0 flags=0x0 nice=0 active=2/256
[67501.195935] in-flight: 67:do_work [dm_mod]
[67501.195945] pending: do_work [dm_mod]
[67501.195961] pool 8: cpus=4 node=0 flags=0x0 nice=0 hung=27s workers=3 idle: 129 23765
The root cause for these issues is the way dm-snapshot uses kcopyd. In
particular, the lack of an explicit or implicit limit to the maximum
number of in-flight COW jobs. The merging path is not affected because
it implicitly limits the in-flight kcopyd jobs to one.
Fix these issues by using a semaphore to limit the maximum number of
in-flight kcopyd jobs. We grab the semaphore before allocating a new
kcopyd job in start_copy() and start_full_bio() and release it after the
job finishes in copy_callback().
The initial semaphore value is configurable through a module parameter,
to allow fine tuning the maximum number of in-flight COW jobs. Setting
this parameter to zero initializes the semaphore to INT_MAX.
A default value of 2048 maximum in-flight kcopyd jobs was chosen. This
value was decided experimentally as a trade-off between memory
consumption, stalling the kernel's workqueues and maintaining a high
enough throughput.
Re-running the aforementioned test:
* Workqueue stalls are eliminated
* kcopyd's job slab cache uses a maximum of 130MB
* The time taken by the test to write to the snapshot-origin target is
reduced from 05m20.48s to 03m26.38s
[1] https://github.com/jthornber/device-mapper-test-suite
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Ilias Tsitsimpis <iliastsi@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Nikos Tsironis [Wed, 31 Oct 2018 21:53:09 +0000 (17:53 -0400)]
dm kcopyd: Fix bug causing workqueue stalls
[ Upstream commit
d7e6b8dfc7bcb3f4f3a18313581f67486a725b52 ]
When using kcopyd to run callbacks through dm_kcopyd_do_callback() or
submitting copy jobs with a source size of 0, the jobs are pushed
directly to the complete_jobs list, which could be under processing by
the kcopyd thread. As a result, the kcopyd thread can continue running
completed jobs indefinitely, without releasing the CPU, as long as
someone keeps submitting new completed jobs through the aforementioned
paths. Processing of work items, queued for execution on the same CPU as
the currently running kcopyd thread, is thus stalled for excessive
amounts of time, hurting performance.
Running the following test, from the device mapper test suite [1],
dmtest run --suite snapshot -n parallel_io_to_many_snaps_N
, with 8 active snapshots, we get, in dmesg, messages like the
following:
[68899.948523] BUG: workqueue lockup - pool cpus=0 node=0 flags=0x0 nice=0 stuck for 95s!
[68899.949282] Showing busy workqueues and worker pools:
[68899.949288] workqueue events: flags=0x0
[68899.949295] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=2/256
[68899.949306] pending: vmstat_shepherd, cache_reap
[68899.949331] workqueue mm_percpu_wq: flags=0x8
[68899.949337] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256
[68899.949345] pending: vmstat_update
[68899.949387] workqueue dm_bufio_cache: flags=0x8
[68899.949392] pwq 4: cpus=2 node=0 flags=0x0 nice=0 active=1/256
[68899.949400] pending: work_fn [dm_bufio]
[68899.949423] workqueue kcopyd: flags=0x8
[68899.949429] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256
[68899.949437] pending: do_work [dm_mod]
[68899.949452] workqueue kcopyd: flags=0x8
[68899.949458] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=2/256
[68899.949466] in-flight: 13:do_work [dm_mod]
[68899.949474] pending: do_work [dm_mod]
[68899.949487] workqueue kcopyd: flags=0x8
[68899.949493] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256
[68899.949501] pending: do_work [dm_mod]
[68899.949515] workqueue kcopyd: flags=0x8
[68899.949521] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256
[68899.949529] pending: do_work [dm_mod]
[68899.949541] workqueue kcopyd: flags=0x8
[68899.949547] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256
[68899.949555] pending: do_work [dm_mod]
[68899.949568] pool 0: cpus=0 node=0 flags=0x0 nice=0 hung=95s workers=4 idle: 27130 27223 1084
Fix this by splitting the complete_jobs list into two parts: A user
facing part, named callback_jobs, and one used internally by kcopyd,
retaining the name complete_jobs. dm_kcopyd_do_callback() and
dispatch_job() now push their jobs to the callback_jobs list, which is
spliced to the complete_jobs list once, every time the kcopyd thread
wakes up. This prevents kcopyd from hogging the CPU indefinitely and
causing workqueue stalls.
Re-running the aforementioned test:
* Workqueue stalls are eliminated
* The maximum writing time among all targets is reduced from 09m37.10s
to 06m04.85s and the total run time of the test is reduced from
10m43.591s to 7m19.199s
[1] https://github.com/jthornber/device-mapper-test-suite
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Ilias Tsitsimpis <iliastsi@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Arnaldo Carvalho de Melo [Thu, 6 Dec 2018 16:52:13 +0000 (13:52 -0300)]
perf parse-events: Fix unchecked usage of strncpy()
[ Upstream commit
bd8d57fb7e25e9fcf67a9eef5fa13aabe2016e07 ]
The strncpy() function may leave the destination string buffer
unterminated, better use strlcpy() that we have a __weak fallback
implementation for systems without it.
This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
util/parse-events.c: In function 'print_symbol_events':
util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
strncpy(name, syms->symbol, MAX_NAME_LEN);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'print_symbol_events.constprop',
inlined from 'print_events' at util/parse-events.c:2508:2:
util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
strncpy(name, syms->symbol, MAX_NAME_LEN);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'print_symbol_events.constprop',
inlined from 'print_events' at util/parse-events.c:2511:2:
util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
strncpy(name, syms->symbol, MAX_NAME_LEN);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes:
947b4ad1d198 ("perf list: Fix max event string size")
Link: https://lkml.kernel.org/n/tip-b663e33bm6x8hrkie4uxh7u2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Arnaldo Carvalho de Melo [Thu, 6 Dec 2018 14:29:48 +0000 (11:29 -0300)]
perf svghelper: Fix unchecked usage of strncpy()
[ Upstream commit
2f5302533f306d5ee87bd375aef9ca35b91762cb ]
The strncpy() function may leave the destination string buffer
unterminated, better use strlcpy() that we have a __weak fallback
implementation for systems without it.
In this specific case this would only happen if fgets() was buggy, as
its man page states that it should read one less byte than the size of
the destination buffer, so that it can put the nul byte at the end of
it, so it would never copy 255 non-nul chars, as fgets reads into the
orig buffer at most 254 non-nul chars and terminates it. But lets just
switch to strlcpy to keep the original intent and silence the gcc 8.2
warning.
This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
In function 'cpu_model',
inlined from 'svg_cpu_box' at util/svghelper.c:378:2:
util/svghelper.c:337:5: error: 'strncpy' output may be truncated copying 255 bytes from a string of length 255 [-Werror=stringop-truncation]
strncpy(cpu_m, &buf[13], 255);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Fixes:
f48d55ce7871 ("perf: Add a SVG helper library file")
Link: https://lkml.kernel.org/n/tip-xzkoo0gyr56gej39ltivuh9g@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>