aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch
diff options
context:
space:
mode:
authorYangbo Lu <yangbo.lu@nxp.com>2020-04-10 10:47:05 +0800
committerPetr Štetiar <ynezz@true.cz>2020-05-07 12:53:06 +0200
commitcddd4591404fb4c53dc0b3c0b15b942cdbed4356 (patch)
tree392c1179de46b0f804e3789edca19069b64e6b44 /target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch
parentd1d2c0b5579ea4f69a42246c9318539d61ba1999 (diff)
downloadupstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.gz
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.bz2
upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.zip
layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Diffstat (limited to 'target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch')
-rw-r--r--target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch112
1 files changed, 112 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch b/target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch
new file mode 100644
index 0000000000..38f34ed2c0
--- /dev/null
+++ b/target/linux/layerscape/patches-5.4/303-core-0003-cgroup-let-a-symlink-too-be-created-with-a-cftype-fi.patch
@@ -0,0 +1,112 @@
+From 3b4d888114a5f6c1e848f892a2236db4ccf8345f Mon Sep 17 00:00:00 2001
+From: Angelo Ruocco <angeloruocco90@gmail.com>
+Date: Tue, 21 May 2019 10:01:54 +0200
+Subject: [PATCH] cgroup: let a symlink too be created with a cftype file
+
+This commit enables a cftype to have a symlink (of any name) that
+points to the file associated with the cftype.
+
+Signed-off-by: Angelo Ruocco <angeloruocco90@gmail.com>
+Signed-off-by: Paolo Valente <paolo.valente@linaro.org>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+(cherry picked from commit 54b7b868e826b294687c439b68ec55fe20cafe5b)
+Signed-off-by: Li Yang <leoyang.li@nxp.com>
+---
+ include/linux/cgroup-defs.h | 3 +++
+ kernel/cgroup/cgroup.c | 33 +++++++++++++++++++++++++++++----
+ 2 files changed, 32 insertions(+), 4 deletions(-)
+
+--- a/include/linux/cgroup-defs.h
++++ b/include/linux/cgroup-defs.h
+@@ -106,6 +106,8 @@ enum {
+ CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */
+ CFTYPE_DEBUG = (1 << 5), /* create when cgroup_debug */
+
++ CFTYPE_SYMLINKED = (1 << 6), /* pointed to by symlink too */
++
+ /* internal flags, do not use outside cgroup core proper */
+ __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */
+ __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */
+@@ -544,6 +546,7 @@ struct cftype {
+ * end of cftype array.
+ */
+ char name[MAX_CFTYPE_NAME];
++ char link_name[MAX_CFTYPE_NAME];
+ unsigned long private;
+
+ /*
+--- a/kernel/cgroup/cgroup.c
++++ b/kernel/cgroup/cgroup.c
+@@ -1465,8 +1465,8 @@ struct cgroup *task_cgroup_from_root(str
+
+ static struct kernfs_syscall_ops cgroup_kf_syscall_ops;
+
+-static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
+- char *buf)
++static char *cgroup_fill_name(struct cgroup *cgrp, const struct cftype *cft,
++ char *buf, bool write_link_name)
+ {
+ struct cgroup_subsys *ss = cft->ss;
+
+@@ -1476,13 +1476,26 @@ static char *cgroup_file_name(struct cgr
+
+ snprintf(buf, CGROUP_FILE_NAME_MAX, "%s%s.%s",
+ dbg, cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
+- cft->name);
++ write_link_name ? cft->link_name : cft->name);
+ } else {
+- strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
++ strscpy(buf, write_link_name ? cft->link_name : cft->name,
++ CGROUP_FILE_NAME_MAX);
+ }
+ return buf;
+ }
+
++static char *cgroup_file_name(struct cgroup *cgrp, const struct cftype *cft,
++ char *buf)
++{
++ return cgroup_fill_name(cgrp, cft, buf, false);
++}
++
++static char *cgroup_link_name(struct cgroup *cgrp, const struct cftype *cft,
++ char *buf)
++{
++ return cgroup_fill_name(cgrp, cft, buf, true);
++}
++
+ /**
+ * cgroup_file_mode - deduce file mode of a control file
+ * @cft: the control file in question
+@@ -1641,6 +1654,9 @@ static void cgroup_rm_file(struct cgroup
+ }
+
+ kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name));
++ if (cft->flags & CFTYPE_SYMLINKED)
++ kernfs_remove_by_name(cgrp->kn,
++ cgroup_link_name(cgrp, cft, name));
+ }
+
+ /**
+@@ -3871,6 +3887,7 @@ static int cgroup_add_file(struct cgroup
+ {
+ char name[CGROUP_FILE_NAME_MAX];
+ struct kernfs_node *kn;
++ struct kernfs_node *kn_link;
+ struct lock_class_key *key = NULL;
+ int ret;
+
+@@ -3901,6 +3918,14 @@ static int cgroup_add_file(struct cgroup
+ spin_unlock_irq(&cgroup_file_kn_lock);
+ }
+
++ if (cft->flags & CFTYPE_SYMLINKED) {
++ kn_link = kernfs_create_link(cgrp->kn,
++ cgroup_link_name(cgrp, cft, name),
++ kn);
++ if (IS_ERR(kn_link))
++ return PTR_ERR(kn_link);
++ }
++
+ return 0;
+ }
+