linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
@ 2016-10-18  7:13 Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs() Nobuhiro Iwamatsu
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts, Nobuhiro Iwamatsu

The following series implements multiple pmsg. This feature allows
userspace program to control individual content aging or priority.

If a pstore backend module(e.g. ramoops) requires the multiple pmsg
instances when registering itself to pstore, multiple /dev/pmsg[ID]
are created. Writes to each /dev/pmsg[ID] are isolated each other. After
reboot, the contents are available in /sys/fs/pstore/pmsg-[backend]-[ID].

In addition, we add multiple pmsg support for ramoops. We can
specify multiple pmsg area size by its module parameter as follows.

 pmsg_size=0x1000,0x2000,...

I did check the operation of this feature on CycloneV (socfpga) Helio board.

v3:
  Rebase to v4.8.
  Split patch.
  merged device_create().
  Remove Blank lines.
  Update documentiation of DT binding.
  Update parsing function of ramoops_pmsg_size, add NULL termination.
  Update module parameters for pmsg_size list.

Hiraku Toyooka (2):
  pstore: support multiple pmsg instances
  selftests/pstore: add testcases for multiple pmsg instances

Nobuhiro Iwamatsu (6):
  pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs()
  pstore: Change parameter of ramoops_free_przs()
  ramoops: Add __ramoops_init_prz() as generic function
  pstore: Rename 'przs' to 'dprzs' in struct ramoops_context
  ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs()
  ramoops: support multiple pmsg instances

 .../bindings/reserved-memory/ramoops.txt           |   6 +-
 Documentation/ramoops.txt                          |  22 ++
 fs/pstore/pmsg.c                                   |  23 +-
 fs/pstore/ram.c                                    | 344 ++++++++++++++++-----
 include/linux/pstore.h                             |   1 +
 include/linux/pstore_ram.h                         |   8 +-
 tools/testing/selftests/pstore/common_tests        |  21 +-
 .../selftests/pstore/pstore_post_reboot_tests      |  27 +-
 tools/testing/selftests/pstore/pstore_tests        |  14 +-
 9 files changed, 360 insertions(+), 106 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs()
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 2/8] pstore: Change parameter of ramoops_free_przs() Nobuhiro Iwamatsu
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Mark Salyzyn, Seiji Aguchi, Shuah Khan

The script "checkpatch.pl" can point information out like the following.

    WARNING: Prefer kcalloc over kzalloc with multiply

Thus fix the affected source code places.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
    New patch.
---
 fs/pstore/ram.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 6ad831b..0bef455 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -424,8 +424,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 	if (!cxt->max_dump_cnt)
 		return -ENOMEM;
 
-	cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt,
-			     GFP_KERNEL);
+	cxt->przs = kcalloc(cxt->max_dump_cnt, sizeof(*cxt->przs),
+			    GFP_KERNEL);
 	if (!cxt->przs) {
 		dev_err(dev, "failed to initialize a prz array for dumps\n");
 		goto fail_mem;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/8] pstore: Change parameter of ramoops_free_przs()
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs() Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 3/8] ramoops: Add __ramoops_init_prz() as generic function Nobuhiro Iwamatsu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Hiraku Toyooka, Mark Salyzyn, Seiji Aguchi,
	Shuah Khan

This commit changes parameter of ramoops_free_przs() from
struct ramoops_context * into struct persistent_ram_zone * in order to
make it available for all prz array.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
   - Split patch.
   - Rebase.
---
 fs/pstore/ram.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 0bef455..691680f 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -392,18 +392,16 @@ static struct ramoops_context oops_cxt = {
 	},
 };
 
-static void ramoops_free_przs(struct ramoops_context *cxt)
+static void ramoops_free_przs(struct persistent_ram_zone **przs, int cnt)
 {
 	int i;
 
-	if (!cxt->przs)
+	if (!przs)
 		return;
 
-	for (i = 0; i < cxt->max_dump_cnt; i++)
-		persistent_ram_free(cxt->przs[i]);
-
-	kfree(cxt->przs);
-	cxt->max_dump_cnt = 0;
+	for (i = 0; i < cnt; i++)
+		persistent_ram_free(przs[i]);
+	kfree(przs);
 }
 
 static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
@@ -684,7 +682,8 @@ static int ramoops_probe(struct platform_device *pdev)
 fail_init_fprz:
 	persistent_ram_free(cxt->cprz);
 fail_init_cprz:
-	ramoops_free_przs(cxt);
+	ramoops_free_przs(cxt->przs, cxt->max_dump_cnt);
+	cxt->max_dump_cnt = 0;
 fail_out:
 	return err;
 }
@@ -701,7 +700,8 @@ static int ramoops_remove(struct platform_device *pdev)
 	persistent_ram_free(cxt->mprz);
 	persistent_ram_free(cxt->fprz);
 	persistent_ram_free(cxt->cprz);
-	ramoops_free_przs(cxt);
+	ramoops_free_przs(cxt->przs, cxt->max_dump_cnt);
+	cxt->max_dump_cnt = 0;
 
 	return 0;
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/8] ramoops: Add __ramoops_init_prz() as generic function
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs() Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 2/8] pstore: Change parameter of ramoops_free_przs() Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 4/8] pstore: Rename 'przs' to 'dprzs' in struct ramoops_context Nobuhiro Iwamatsu
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Hiraku Toyooka, Mark Salyzyn, Seiji Aguchi,
	Shuah Khan

This commit adds generic function __ramoops_init_prz() to reduce redundancy
between ramoops_init_prz() and ramoops_init_przs().

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
   Rebase.
   Split patch.
---
 fs/pstore/ram.c | 69 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 691680f..4fe27fb 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -404,6 +404,38 @@ static void ramoops_free_przs(struct persistent_ram_zone **przs, int cnt)
 	kfree(przs);
 }
 
+static int __ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
+			      struct persistent_ram_zone **prz,
+			      phys_addr_t *paddr, size_t sz, u32 sig, bool zap)
+{
+	if (!sz)
+		return 0;
+
+	if (*paddr + sz - cxt->phys_addr > cxt->size) {
+		dev_err(dev, "no room for mem region (0x%zx@0x%llx) in (0x%lx@0x%llx)\n",
+			sz, (unsigned long long)*paddr,
+			cxt->size, (unsigned long long)cxt->phys_addr);
+		return -ENOMEM;
+	}
+
+	*prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info,
+				  cxt->memtype);
+	if (IS_ERR(*prz)) {
+		int err = PTR_ERR(*prz);
+
+		dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
+			sz, (unsigned long long)*paddr, err);
+		return err;
+	}
+
+	if (zap)
+		persistent_ram_zap(*prz);
+
+	*paddr += sz;
+
+	return 0;
+}
+
 static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 			     phys_addr_t *paddr, size_t dump_mem_sz)
 {
@@ -430,21 +462,15 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 	}
 
 	for (i = 0; i < cxt->max_dump_cnt; i++) {
-		cxt->przs[i] = persistent_ram_new(*paddr, cxt->record_size, 0,
-						  &cxt->ecc_info,
-						  cxt->memtype);
-		if (IS_ERR(cxt->przs[i])) {
-			err = PTR_ERR(cxt->przs[i]);
-			dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
-				cxt->record_size, (unsigned long long)*paddr, err);
-
+		err = __ramoops_init_prz(dev, cxt, &cxt->przs[i], paddr,
+					 cxt->record_size, 0, false);
+		if (err) {
 			while (i > 0) {
 				i--;
 				persistent_ram_free(cxt->przs[i]);
 			}
 			goto fail_prz;
 		}
-		*paddr += cxt->record_size;
 	}
 
 	return 0;
@@ -459,30 +485,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
 			    struct persistent_ram_zone **prz,
 			    phys_addr_t *paddr, size_t sz, u32 sig)
 {
-	if (!sz)
-		return 0;
-
-	if (*paddr + sz - cxt->phys_addr > cxt->size) {
-		dev_err(dev, "no room for mem region (0x%zx@0x%llx) in (0x%lx@0x%llx)\n",
-			sz, (unsigned long long)*paddr,
-			cxt->size, (unsigned long long)cxt->phys_addr);
-		return -ENOMEM;
-	}
-
-	*prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info, cxt->memtype);
-	if (IS_ERR(*prz)) {
-		int err = PTR_ERR(*prz);
-
-		dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
-			sz, (unsigned long long)*paddr, err);
-		return err;
-	}
-
-	persistent_ram_zap(*prz);
-
-	*paddr += sz;
-
-	return 0;
+	return __ramoops_init_prz(dev, cxt, prz, paddr, sz, sig, true);
 }
 
 static int ramoops_parse_dt_size(struct platform_device *pdev,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 4/8] pstore: Rename 'przs' to 'dprzs' in struct ramoops_context
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (2 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 3/8] ramoops: Add __ramoops_init_prz() as generic function Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 5/8] ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs() Nobuhiro Iwamatsu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Hiraku Toyooka, Mark Salyzyn, Seiji Aguchi,
	Shuah Khan

This commit renames 'przs' member in struct ramoops_context to 'dprzs'
so that it stands for 'dump przs'.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
  Rebase.
  Split patch.
---
 fs/pstore/ram.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 4fe27fb..e27c2ec 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -85,9 +85,13 @@ MODULE_PARM_DESC(ramoops_ecc,
 		"bytes ECC)");
 
 struct ramoops_context {
-	struct persistent_ram_zone **przs;
+	/* for dump przs */
+	struct persistent_ram_zone **dprzs;
+	/* for console przs */
 	struct persistent_ram_zone *cprz;
+	/* for ftrace przs */
 	struct persistent_ram_zone *fprz;
+	/* for pmsg przs */
 	struct persistent_ram_zone *mprz;
 	phys_addr_t phys_addr;
 	unsigned long size;
@@ -201,7 +205,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
 
 	/* Find the next valid persistent_ram_zone for DMESG */
 	while (cxt->dump_read_cnt < cxt->max_dump_cnt && !prz) {
-		prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt,
+		prz = ramoops_get_next_prz(cxt->dprzs, &cxt->dump_read_cnt,
 					   cxt->max_dump_cnt, id, type,
 					   PSTORE_TYPE_DMESG, 1);
 		if (!prz_ok(prz))
@@ -217,12 +221,15 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
 	}
 
 	if (!prz_ok(prz))
+		/* get console prz */
 		prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt,
 					   1, id, type, PSTORE_TYPE_CONSOLE, 0);
 	if (!prz_ok(prz))
+		/* get ftrace prz */
 		prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt,
 					   1, id, type, PSTORE_TYPE_FTRACE, 0);
 	if (!prz_ok(prz))
+		/* get pmsg prz */
 		prz = ramoops_get_next_prz(&cxt->mprz, &cxt->pmsg_read_cnt,
 					   1, id, type, PSTORE_TYPE_PMSG, 0);
 	if (!prz_ok(prz))
@@ -316,10 +323,10 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
 	if (part != 1)
 		return -ENOSPC;
 
-	if (!cxt->przs)
+	if (!cxt->dprzs)
 		return -ENOSPC;
 
-	prz = cxt->przs[cxt->dump_write_cnt];
+	prz = cxt->dprzs[cxt->dump_write_cnt];
 
 	hlen = ramoops_write_kmsg_hdr(prz, compressed);
 	if (size + hlen > prz->buffer_size)
@@ -359,7 +366,7 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, int count,
 	case PSTORE_TYPE_DMESG:
 		if (id >= cxt->max_dump_cnt)
 			return -EINVAL;
-		prz = cxt->przs[id];
+		prz = cxt->dprzs[id];
 		break;
 	case PSTORE_TYPE_CONSOLE:
 		prz = cxt->cprz;
@@ -454,28 +461,23 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 	if (!cxt->max_dump_cnt)
 		return -ENOMEM;
 
-	cxt->przs = kcalloc(cxt->max_dump_cnt, sizeof(*cxt->przs),
+	cxt->dprzs = kcalloc(cxt->max_dump_cnt, sizeof(*cxt->dprzs),
 			    GFP_KERNEL);
-	if (!cxt->przs) {
+	if (!cxt->dprzs) {
 		dev_err(dev, "failed to initialize a prz array for dumps\n");
 		goto fail_mem;
 	}
 
 	for (i = 0; i < cxt->max_dump_cnt; i++) {
-		err = __ramoops_init_prz(dev, cxt, &cxt->przs[i], paddr,
+		err = __ramoops_init_prz(dev, cxt, &cxt->dprzs[i], paddr,
 					 cxt->record_size, 0, false);
-		if (err) {
-			while (i > 0) {
-				i--;
-				persistent_ram_free(cxt->przs[i]);
-			}
+		if (err)
 			goto fail_prz;
-		}
 	}
 
 	return 0;
 fail_prz:
-	kfree(cxt->przs);
+	ramoops_free_przs(cxt->dprzs, i);
 fail_mem:
 	cxt->max_dump_cnt = 0;
 	return err;
@@ -607,20 +609,24 @@ static int ramoops_probe(struct platform_device *pdev)
 
 	dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size
 			- cxt->pmsg_size;
+	/* init dump przs */
 	err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz);
 	if (err)
 		goto fail_out;
 
+	/* init console prz */
 	err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr,
 			       cxt->console_size, 0);
 	if (err)
 		goto fail_init_cprz;
 
+	/* init ftrace prz */
 	err = ramoops_init_prz(dev, cxt, &cxt->fprz, &paddr, cxt->ftrace_size,
 			       LINUX_VERSION_CODE);
 	if (err)
 		goto fail_init_fprz;
 
+	/* init pmsg przs */
 	err = ramoops_init_prz(dev, cxt, &cxt->mprz, &paddr, cxt->pmsg_size, 0);
 	if (err)
 		goto fail_init_mprz;
@@ -685,7 +691,7 @@ static int ramoops_probe(struct platform_device *pdev)
 fail_init_fprz:
 	persistent_ram_free(cxt->cprz);
 fail_init_cprz:
-	ramoops_free_przs(cxt->przs, cxt->max_dump_cnt);
+	ramoops_free_przs(cxt->dprzs, cxt->max_dump_cnt);
 	cxt->max_dump_cnt = 0;
 fail_out:
 	return err;
@@ -703,7 +709,7 @@ static int ramoops_remove(struct platform_device *pdev)
 	persistent_ram_free(cxt->mprz);
 	persistent_ram_free(cxt->fprz);
 	persistent_ram_free(cxt->cprz);
-	ramoops_free_przs(cxt->przs, cxt->max_dump_cnt);
+	ramoops_free_przs(cxt->dprzs, cxt->max_dump_cnt);
 	cxt->max_dump_cnt = 0;
 
 	return 0;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 5/8] ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs()
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (3 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 4/8] pstore: Rename 'przs' to 'dprzs' in struct ramoops_context Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 6/8] pstore: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Hiraku Toyooka, Mark Salyzyn, Seiji Aguchi,
	Shuah Khan

This commit renames ramoops_init_prz() to ramoops_init_dprzs() so that
it stands for 'dump przs'.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
  Rebase.
  Split patch.
---
 fs/pstore/ram.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index e27c2ec..e9ec522 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -443,7 +443,8 @@ static int __ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
 	return 0;
 }
 
-static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
+/* init function for dump przs */
+static int ramoops_init_dprzs(struct device *dev, struct ramoops_context *cxt,
 			     phys_addr_t *paddr, size_t dump_mem_sz)
 {
 	int err = -ENOMEM;
@@ -472,17 +473,18 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
 		err = __ramoops_init_prz(dev, cxt, &cxt->dprzs[i], paddr,
 					 cxt->record_size, 0, false);
 		if (err)
-			goto fail_prz;
+			goto fail_dprz;
 	}
 
 	return 0;
-fail_prz:
+fail_dprz:
 	ramoops_free_przs(cxt->dprzs, i);
 fail_mem:
 	cxt->max_dump_cnt = 0;
 	return err;
 }
 
+/* int function for console, ftrace and pmsg przs */
 static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
 			    struct persistent_ram_zone **prz,
 			    phys_addr_t *paddr, size_t sz, u32 sig)
@@ -610,7 +612,7 @@ static int ramoops_probe(struct platform_device *pdev)
 	dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size
 			- cxt->pmsg_size;
 	/* init dump przs */
-	err = ramoops_init_przs(dev, cxt, &paddr, dump_mem_sz);
+	err = ramoops_init_dprzs(dev, cxt, &paddr, dump_mem_sz);
 	if (err)
 		goto fail_out;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 6/8] pstore: support multiple pmsg instances
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (4 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 5/8] ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs() Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 7/8] ramoops: " Nobuhiro Iwamatsu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Hiraku Toyooka, Nobuhiro Iwamatsu, Mark Salyzyn, Seiji Aguchi

From: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>

This enables pmsg to deal with multiple instances. One possible
use is content priority control on limited persistent store space. By
using different buffers, we can prevent important messages from being
overwritten by less important messages.

When pstore backend module specifies the number of instances (num_pmsg)
in pstore_info, multiple /dev/pmsg[ID] appear. (ID is an integer
starting at 0. It corresponds to minor number of the each char device.)
Writes to each /dev/pmsg[ID] are isolated each other. After reboot, the
contents are available in /sys/fs/pstore/pmsg-[backend]-[ID].

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
    rebase.
    merged device_create().
---
 fs/pstore/pmsg.c       | 23 ++++++++++++++++-------
 include/linux/pstore.h |  1 +
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c
index 78f6176..5da5cba 100644
--- a/fs/pstore/pmsg.c
+++ b/fs/pstore/pmsg.c
@@ -34,7 +34,8 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,
 		return -EFAULT;
 
 	mutex_lock(&pmsg_lock);
-	ret = psinfo->write_buf_user(PSTORE_TYPE_PMSG, 0, &id, 0, buf, 0, count,
+	ret = psinfo->write_buf_user(PSTORE_TYPE_PMSG, 0, &id,
+				     iminor(file->f_inode), buf, 0, count,
 				     psinfo);
 	mutex_unlock(&pmsg_lock);
 	return ret ? ret : count;
@@ -61,7 +62,7 @@ static char *pmsg_devnode(struct device *dev, umode_t *mode)
 
 void pstore_register_pmsg(void)
 {
-	struct device *pmsg_device;
+	int i;
 
 	pmsg_major = register_chrdev(0, PMSG_NAME, &pmsg_fops);
 	if (pmsg_major < 0) {
@@ -76,15 +77,23 @@ void pstore_register_pmsg(void)
 	}
 	pmsg_class->devnode = pmsg_devnode;
 
-	pmsg_device = device_create(pmsg_class, NULL, MKDEV(pmsg_major, 0),
-					NULL, "%s%d", PMSG_NAME, 0);
-	if (IS_ERR(pmsg_device)) {
-		pr_err("failed to create device\n");
-		goto err_device;
+	/* allocate additional /dev/pmsg[ID] */
+	for (i = 0; i < psinfo->num_pmsg; i++) {
+		struct device *pmsg_device;
+
+		pmsg_device = device_create(pmsg_class, NULL,
+					    MKDEV(pmsg_major, i), NULL, "%s%d",
+					    PMSG_NAME, i);
+		if (IS_ERR(pmsg_device)) {
+			pr_err("failed to create device\n");
+			goto err_device;
+		}
 	}
 	return;
 
 err_device:
+	for (i--; i >= 0; i--)
+		device_destroy(pmsg_class, MKDEV(pmsg_major, i));
 	class_destroy(pmsg_class);
 err_class:
 	unregister_chrdev(pmsg_major, PMSG_NAME);
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 92013cc..a606656 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -55,6 +55,7 @@ struct pstore_info {
 	size_t		bufsize;
 	struct mutex	read_mutex;	/* serialize open/read/close */
 	int		flags;
+	unsigned int	num_pmsg;
 	int		(*open)(struct pstore_info *psi);
 	int		(*close)(struct pstore_info *psi);
 	ssize_t		(*read)(u64 *id, enum pstore_type_id *type,
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 7/8] ramoops: support multiple pmsg instances
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (5 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 6/8] pstore: support multiple pmsg instances Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-10-18  7:13 ` [PATCH v3 8/8] selftests/pstore: add testcases for " Nobuhiro Iwamatsu
  2016-11-11 22:24 ` [PATCH v3 0/8] pstore: ramoops: support " Kees Cook
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Nobuhiro Iwamatsu, Hiraku Toyooka, Jonathan Corbet, Mark Salyzyn,
	Seiji Aguchi

This enables ramoops to deal with multiple pmsg instances.
A User can configure the size of each buffers by its module parameter
as follows.

  pmsg_size=0x1000,0x2000,...

Then, the ramoops allocates multiple buffers and tells the number
of buffers to pstore to create multiple /dev/pmsg[ID].

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
  - Rebase.
  - Update documentiation of DT binding.
  - Update parsing function of ramoops_pmsg_size, add NULL termination.
  - Update module parameters for pmsg_size list.
---
 .../bindings/reserved-memory/ramoops.txt           |   6 +-
 Documentation/ramoops.txt                          |  22 ++
 fs/pstore/ram.c                                    | 229 ++++++++++++++++++---
 include/linux/pstore_ram.h                         |   8 +-
 4 files changed, 235 insertions(+), 30 deletions(-)

diff --git a/Documentation/devicetree/bindings/reserved-memory/ramoops.txt b/Documentation/devicetree/bindings/reserved-memory/ramoops.txt
index e81f821..85ffea0 100644
--- a/Documentation/devicetree/bindings/reserved-memory/ramoops.txt
+++ b/Documentation/devicetree/bindings/reserved-memory/ramoops.txt
@@ -39,7 +39,11 @@ Optional properties:
 - ftrace-size: size in bytes of log buffer reserved for function tracing and
   profiling (defaults to 0: disabled)
 
-- pmsg-size: size in bytes of log buffer reserved for userspace messages
+- pmsg-size: array of value that are used to size in bytes of log buffer
+  reserved for userspace messages.
+
+	pmsg-size = <0x10000 0x10000>;
+
   (defaults to 0: disabled)
 
 - unbuffered: if present, use unbuffered mappings to map the reserved region
diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt
index 26b9f31..25010a9 100644
--- a/Documentation/ramoops.txt
+++ b/Documentation/ramoops.txt
@@ -144,3 +144,25 @@ file. Here is an example of usage:
  0 ffffffff811d9c54  ffffffff8101a7a0  __const_udelay <- native_machine_emergency_restart+0x110/0x1e0
  0 ffffffff811d9c34  ffffffff811d9c80  __delay <- __const_udelay+0x30/0x40
  0 ffffffff811d9d14  ffffffff811d9c3f  delay_tsc <- __delay+0xf/0x20
+
+6. Pmsg support
+
+Ramoops supports pmsg - logging userspace mesages in persistent store. By
+default, one pmsg area becomes available in ramoops. You can write data into
+/dev/pmsg0, e.g.:
+
+ # echo foo > /dev/pmsg0
+
+After reboot, the stored data can be read from pmsg-ramoops-0 on the pstore
+filesystem.
+
+You can specify size of the pmsg area by additional kernel command line, e.g.:
+
+ "ramoops.pmsg_size=0x1000"
+
+You can also use multiple pmsg areas, e.g.:
+
+ "ramoops.pmsg_size=0x1000,0x2000,..."
+
+Then, pmsg0, pmsg1, ... will appear on /dev. This is useful to control
+individual content aging or priority.
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index e9ec522..ea4a427 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -53,8 +53,8 @@ static ulong ramoops_ftrace_size = MIN_MEM_SIZE;
 module_param_named(ftrace_size, ramoops_ftrace_size, ulong, 0400);
 MODULE_PARM_DESC(ftrace_size, "size of ftrace log");
 
-static ulong ramoops_pmsg_size = MIN_MEM_SIZE;
-module_param_named(pmsg_size, ramoops_pmsg_size, ulong, 0400);
+static char *ramoops_pmsg_size_str;
+module_param_named(pmsg_size, ramoops_pmsg_size_str, charp, 0400);
 MODULE_PARM_DESC(pmsg_size, "size of user space message log");
 
 static unsigned long long mem_address;
@@ -92,14 +92,14 @@ struct ramoops_context {
 	/* for ftrace przs */
 	struct persistent_ram_zone *fprz;
 	/* for pmsg przs */
-	struct persistent_ram_zone *mprz;
+	struct persistent_ram_zone **mprzs;
 	phys_addr_t phys_addr;
 	unsigned long size;
 	unsigned int memtype;
 	size_t record_size;
 	size_t console_size;
 	size_t ftrace_size;
-	size_t pmsg_size;
+	size_t *pmsg_size;
 	int dump_oops;
 	struct persistent_ram_ecc_info ecc_info;
 	unsigned int max_dump_cnt;
@@ -228,10 +228,11 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
 		/* get ftrace prz */
 		prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt,
 					   1, id, type, PSTORE_TYPE_FTRACE, 0);
-	if (!prz_ok(prz))
+	while (cxt->pmsg_read_cnt < cxt->pstore.num_pmsg && !prz)
 		/* get pmsg prz */
-		prz = ramoops_get_next_prz(&cxt->mprz, &cxt->pmsg_read_cnt,
-					   1, id, type, PSTORE_TYPE_PMSG, 0);
+		prz = ramoops_get_next_prz(cxt->mprzs, &cxt->pmsg_read_cnt,
+					   cxt->pstore.num_pmsg, id, type,
+					   PSTORE_TYPE_PMSG, 0);
 	if (!prz_ok(prz))
 		return 0;
 
@@ -295,9 +296,11 @@ static int notrace ramoops_pstore_write_buf(enum pstore_type_id type,
 		persistent_ram_write(cxt->fprz, buf, size);
 		return 0;
 	} else if (type == PSTORE_TYPE_PMSG) {
-		if (!cxt->mprz)
+		if (part >= cxt->pstore.num_pmsg)
+			return -EINVAL;
+		if (!cxt->mprzs || !cxt->mprzs[part])
 			return -ENOMEM;
-		persistent_ram_write(cxt->mprz, buf, size);
+		persistent_ram_write(cxt->mprzs[part], buf, size);
 		return 0;
 	}
 
@@ -348,9 +351,9 @@ static int notrace ramoops_pstore_write_buf_user(enum pstore_type_id type,
 	if (type == PSTORE_TYPE_PMSG) {
 		struct ramoops_context *cxt = psi->data;
 
-		if (!cxt->mprz)
+		if (!cxt->mprzs)
 			return -ENOMEM;
-		return persistent_ram_write_user(cxt->mprz, buf, size);
+		return persistent_ram_write_user(cxt->mprzs[part], buf, size);
 	}
 
 	return -EINVAL;
@@ -375,7 +378,9 @@ static int ramoops_pstore_erase(enum pstore_type_id type, u64 id, int count,
 		prz = cxt->fprz;
 		break;
 	case PSTORE_TYPE_PMSG:
-		prz = cxt->mprz;
+		if (id >= cxt->pstore.num_pmsg)
+			return -EINVAL;
+		prz = cxt->mprzs[id];
 		break;
 	default:
 		return -EINVAL;
@@ -484,7 +489,40 @@ static int ramoops_init_dprzs(struct device *dev, struct ramoops_context *cxt,
 	return err;
 }
 
-/* int function for console, ftrace and pmsg przs */
+/* int function for pmsg przs */
+static int ramoops_init_mprzs(struct device *dev, struct ramoops_context *cxt,
+			      phys_addr_t *paddr, unsigned long total)
+{
+	int err = -ENOMEM;
+	int i;
+
+	if (!total)
+		return 0;
+
+	if (*paddr + total - cxt->phys_addr > cxt->size) {
+		dev_err(dev, "no room for pmsg\n");
+		return -ENOMEM;
+	}
+
+	cxt->mprzs = kcalloc(cxt->pstore.num_pmsg, sizeof(*cxt->mprzs),
+			     GFP_KERNEL);
+	if (!cxt->mprzs)
+		return -ENOMEM;
+
+	for (i = 0; i < cxt->pstore.num_pmsg; i++) {
+		err = __ramoops_init_prz(dev, cxt, &cxt->mprzs[i], paddr,
+					 cxt->pmsg_size[i], 0, true);
+		if (err)
+			goto fail_mprz;
+	}
+
+	return 0;
+fail_mprz:
+	ramoops_free_przs(cxt->mprzs, i);
+	return err;
+}
+
+/* int function for console and ftrace przs */
 static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
 			    struct persistent_ram_zone **prz,
 			    phys_addr_t *paddr, size_t sz, u32 sig)
@@ -520,7 +558,8 @@ static int ramoops_parse_dt(struct platform_device *pdev,
 	struct device_node *of_node = pdev->dev.of_node;
 	struct resource *res;
 	u32 value;
-	int ret;
+	int ret, i;
+	unsigned int num_pmsg;
 
 	dev_dbg(&pdev->dev, "using Device Tree\n");
 
@@ -546,11 +585,70 @@ static int ramoops_parse_dt(struct platform_device *pdev,
 	parse_size("record-size", pdata->record_size);
 	parse_size("console-size", pdata->console_size);
 	parse_size("ftrace-size", pdata->ftrace_size);
-	parse_size("pmsg-size", pdata->pmsg_size);
 	parse_size("ecc-size", pdata->ecc_info.ecc_size);
 
 #undef parse_size
 
+	/* Parse pmesg size */
+	if (!of_find_property(of_node, "pmsg-size", &num_pmsg))
+		return 0; /* no data */
+
+	num_pmsg = num_pmsg / sizeof(u32);
+
+	pdata->pmsg_size =
+		devm_kzalloc(&pdev->dev, sizeof(size_t) * (num_pmsg + 1),
+			     GFP_KERNEL);
+	if (!pdata->pmsg_size)
+		return -ENOMEM;
+
+	for (i = 0; i < num_pmsg; i++) {
+		ret = of_property_read_u32_index(of_node, "pmsg-size",
+						 i, &value);
+		if (ret) {
+			dev_warn(&pdev->dev,
+				"%s: failed to read pmsg-size[%d]: %d\n",
+				 __func__, i, ret);
+			return -EINVAL;
+		}
+
+		/* CHECK INT_MAX */
+		if (value > INT_MAX) {
+			dev_err(&pdev->dev, "value %x > INT_MAX\n", value);
+			return -EOVERFLOW;
+		}
+		pdata->pmsg_size[i] = value;
+	}
+
+	return 0;
+}
+
+#define ADDR_STRING_SIZE	10 /* "0x00000000" */
+static int update_pmsg_size_mod_param(size_t *pmsg_size, int num)
+{
+	int i, len;
+
+	/* string size + commas count + NULL-terminated */
+	len = ADDR_STRING_SIZE * num + (num - 1) + 1;
+
+	/* using commandline or already allocation buffer.*/
+	if (ramoops_pmsg_size_str)
+		goto out;
+
+	ramoops_pmsg_size_str = kzalloc(len, GFP_KERNEL);
+	if (!ramoops_pmsg_size_str)
+		return -ENOMEM;
+
+	for (i = 0 ; i < num; i++) {
+		char str[ADDR_STRING_SIZE + 1];
+
+		memset(str, 0, sizeof(str));
+		if (i == num - 1)
+			snprintf(str, sizeof(str), "0x%x", pmsg_size[i]);
+		else
+			snprintf(str, sizeof(str), "0x%x,", pmsg_size[i]);
+		strcat(ramoops_pmsg_size_str, str);
+	}
+out:
 	return 0;
 }
 
@@ -562,6 +660,8 @@ static int ramoops_probe(struct platform_device *pdev)
 	size_t dump_mem_sz;
 	phys_addr_t paddr;
 	int err = -EINVAL;
+	unsigned long pmsg_size_total = 0;
+	unsigned int num_pmsg = 0;
 
 	if (dev_of_node(dev) && !pdata) {
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
@@ -594,8 +694,20 @@ static int ramoops_probe(struct platform_device *pdev)
 		pdata->console_size = rounddown_pow_of_two(pdata->console_size);
 	if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size))
 		pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size);
-	if (pdata->pmsg_size && !is_power_of_2(pdata->pmsg_size))
-		pdata->pmsg_size = rounddown_pow_of_two(pdata->pmsg_size);
+
+	if (pdata->pmsg_size) {
+		for (;; num_pmsg++) {
+			unsigned long size = pdata->pmsg_size[num_pmsg];
+
+			if (!size)
+				break;
+
+			if (!is_power_of_2(size))
+				pdata->pmsg_size[num_pmsg]
+					= rounddown_pow_of_two(size);
+			pmsg_size_total += size;
+		}
+	}
 
 	cxt->size = pdata->mem_size;
 	cxt->phys_addr = pdata->mem_address;
@@ -603,18 +715,27 @@ static int ramoops_probe(struct platform_device *pdev)
 	cxt->record_size = pdata->record_size;
 	cxt->console_size = pdata->console_size;
 	cxt->ftrace_size = pdata->ftrace_size;
-	cxt->pmsg_size = pdata->pmsg_size;
 	cxt->dump_oops = pdata->dump_oops;
 	cxt->ecc_info = pdata->ecc_info;
+	cxt->pstore.num_pmsg = num_pmsg;
 
-	paddr = cxt->phys_addr;
+	if (num_pmsg) {
+		cxt->pmsg_size = kcalloc(num_pmsg, sizeof(size_t), GFP_KERNEL);
+		if (!cxt->pmsg_size) {
+			err = -ENOMEM;
+			goto fail_out;
+		}
+		memcpy(cxt->pmsg_size, pdata->pmsg_size,
+		       sizeof(size_t) * num_pmsg);
+	}
 
+	paddr = cxt->phys_addr;
 	dump_mem_sz = cxt->size - cxt->console_size - cxt->ftrace_size
-			- cxt->pmsg_size;
+			- pmsg_size_total;
 	/* init dump przs */
 	err = ramoops_init_dprzs(dev, cxt, &paddr, dump_mem_sz);
 	if (err)
-		goto fail_out;
+		goto fail_init_dprzs;
 
 	/* init console prz */
 	err = ramoops_init_prz(dev, cxt, &cxt->cprz, &paddr,
@@ -629,9 +750,9 @@ static int ramoops_probe(struct platform_device *pdev)
 		goto fail_init_fprz;
 
 	/* init pmsg przs */
-	err = ramoops_init_prz(dev, cxt, &cxt->mprz, &paddr, cxt->pmsg_size, 0);
+	err = ramoops_init_mprzs(dev, cxt, &paddr, pmsg_size_total);
 	if (err)
-		goto fail_init_mprz;
+		goto fail_init_mprzs;
 
 	cxt->pstore.data = cxt;
 	/*
@@ -674,8 +795,8 @@ static int ramoops_probe(struct platform_device *pdev)
 	record_size = pdata->record_size;
 	dump_oops = pdata->dump_oops;
 	ramoops_console_size = pdata->console_size;
-	ramoops_pmsg_size = pdata->pmsg_size;
 	ramoops_ftrace_size = pdata->ftrace_size;
+	update_pmsg_size_mod_param(cxt->pmsg_size, cxt->pstore.num_pmsg);
 
 	pr_info("attached 0x%lx@0x%llx, ecc: %d/%d\n",
 		cxt->size, (unsigned long long)cxt->phys_addr,
@@ -687,14 +808,17 @@ static int ramoops_probe(struct platform_device *pdev)
 	kfree(cxt->pstore.buf);
 fail_clear:
 	cxt->pstore.bufsize = 0;
-	persistent_ram_free(cxt->mprz);
-fail_init_mprz:
+	ramoops_free_przs(cxt->mprzs, cxt->pstore.num_pmsg);
+fail_init_mprzs:
+	cxt->pstore.num_pmsg = 0;
 	persistent_ram_free(cxt->fprz);
 fail_init_fprz:
 	persistent_ram_free(cxt->cprz);
 fail_init_cprz:
 	ramoops_free_przs(cxt->dprzs, cxt->max_dump_cnt);
 	cxt->max_dump_cnt = 0;
+fail_init_dprzs:
+	kfree(cxt->pmsg_size);
 fail_out:
 	return err;
 }
@@ -707,8 +831,10 @@ static int ramoops_remove(struct platform_device *pdev)
 
 	kfree(cxt->pstore.buf);
 	cxt->pstore.bufsize = 0;
+	kfree(cxt->pmsg_size);
 
-	persistent_ram_free(cxt->mprz);
+	ramoops_free_przs(cxt->mprzs, cxt->pstore.num_pmsg);
+	cxt->pstore.num_pmsg = 0;
 	persistent_ram_free(cxt->fprz);
 	persistent_ram_free(cxt->cprz);
 	ramoops_free_przs(cxt->dprzs, cxt->max_dump_cnt);
@@ -731,6 +857,43 @@ static struct platform_driver ramoops_driver = {
 	},
 };
 
+static unsigned long *parse_size_str(char *size_str)
+{
+	int i, ret;
+	unsigned long *size_array, count = 1;
+
+	if (size_str) {
+		char *s = size_str;
+
+		/* Necessary array size is the number of commas + 1 */
+		for (; (s = strchr(s, ',')); s++)
+			count++;
+	}
+
+	/* Add NULL termination */
+	count++;
+
+	size_array = kcalloc(count, sizeof(unsigned long), GFP_KERNEL);
+	if (!size_array)
+		goto out;
+
+	if (size_str) {
+		for (i = 0; i < count; i++) {
+			ret = get_option(&size_str, (int *)&size_array[i]);
+			if (ret == 1)
+				break;
+			else if (ret != 2) {
+				size_array[i] = 0;
+				break;
+			}
+		}
+	} else
+		size_array[0] = MIN_MEM_SIZE;
+
+out:
+	return size_array;
+}
+
 static void ramoops_register_dummy(void)
 {
 	if (!mem_size)
@@ -750,7 +913,10 @@ static void ramoops_register_dummy(void)
 	dummy_data->record_size = record_size;
 	dummy_data->console_size = ramoops_console_size;
 	dummy_data->ftrace_size = ramoops_ftrace_size;
-	dummy_data->pmsg_size = ramoops_pmsg_size;
+	dummy_data->pmsg_size = parse_size_str(ramoops_pmsg_size_str);
+
+	if (!dummy_data->pmsg_size)
+		goto fail_pmsg_size;
 	dummy_data->dump_oops = dump_oops;
 	/*
 	 * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC
@@ -763,7 +929,13 @@ static void ramoops_register_dummy(void)
 	if (IS_ERR(dummy)) {
 		pr_info("could not create platform device: %ld\n",
 			PTR_ERR(dummy));
+		goto fail_pdev;
 	}
+	return;
+fail_pdev:
+	kfree(dummy_data->pmsg_size);
+fail_pmsg_size:
+	kfree(dummy_data);
 }
 
 static int __init ramoops_init(void)
@@ -777,6 +949,7 @@ static void __exit ramoops_exit(void)
 {
 	platform_driver_unregister(&ramoops_driver);
 	platform_device_unregister(dummy);
+	kfree(dummy_data->pmsg_size);
 	kfree(dummy_data);
 }
 module_exit(ramoops_exit);
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index c668c86..5f82d7b 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -75,6 +75,12 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
  * Ramoops platform data
  * @mem_size	memory size for ramoops
  * @mem_address	physical memory address to contain ramoops
+ * @pmsg_size	array containing size of each pmsg area. 0 value in the array
+ *		indicates the end of the content. For example, if the following
+ *		array is given,
+ *		    .pmsg_size = { 0x1000, 0x2000, 0x0, 0x3000, };
+ *		then, pmsg areas are allocated for the first two size values
+ *		and '0x3000' is just ignored.
  */
 
 struct ramoops_platform_data {
@@ -84,7 +90,7 @@ struct ramoops_platform_data {
 	unsigned long	record_size;
 	unsigned long	console_size;
 	unsigned long	ftrace_size;
-	unsigned long	pmsg_size;
+	unsigned long	*pmsg_size;
 	int		dump_oops;
 	struct persistent_ram_ecc_info ecc_info;
 };
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 8/8] selftests/pstore: add testcases for multiple pmsg instances
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (6 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 7/8] ramoops: " Nobuhiro Iwamatsu
@ 2016-10-18  7:13 ` Nobuhiro Iwamatsu
  2016-11-11 22:24 ` [PATCH v3 0/8] pstore: ramoops: support " Kees Cook
  8 siblings, 0 replies; 13+ messages in thread
From: Nobuhiro Iwamatsu @ 2016-10-18  7:13 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, cti.systems-productivity-manager.ts,
	Hiraku Toyooka, Nobuhiro Iwamatsu, Mark Salyzyn, Seiji Aguchi,
	Shuah Khan

From: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>

To test multiple pmsg, we should check that /dev/pmsg[N] (N > 0) is
available. After reboot, we should check that pmsg-[backend]-[N] which
keeps content is detected even if pmsg-[backend]-[N-M] (0 < M <= N)
doesn't exist due to lack of contents.

So this adds the following testcases.
 - pstore_tests
   - Write unique string to the last /dev/pmsgN
 - pstore_post_reboot_tests
   - Check the last pmsg area is detected

Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@hitachi.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Tony Luck <tony.luck@intel.com>

V3:
  Remove Blank lines.
---
 tools/testing/selftests/pstore/common_tests        | 21 +++++++++++++++--
 .../selftests/pstore/pstore_post_reboot_tests      | 27 ++++++++++++----------
 tools/testing/selftests/pstore/pstore_tests        | 14 ++++++++---
 3 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/tools/testing/selftests/pstore/common_tests b/tools/testing/selftests/pstore/common_tests
index 3ea64d7..566a25d 100755
--- a/tools/testing/selftests/pstore/common_tests
+++ b/tools/testing/selftests/pstore/common_tests
@@ -27,9 +27,9 @@ show_result() { # result_value
 }
 
 check_files_exist() { # type of pstorefs file
-    if [ -e ${1}-${backend}-0 ]; then
+    if [ -e ${1}0 ]; then
 	prlog "ok"
-	for f in `ls ${1}-${backend}-*`; do
+	for f in `ls ${1}*`; do
             prlog -e "\t${f}"
 	done
     else
@@ -53,6 +53,23 @@ operate_files() { # tested value, files, operation
     fi
 }
 
+check_pmsg_content() { # pmsg filename
+    prev_uuid=`cat $TOP_DIR/prev_uuid`
+    if [ $? -eq 0 ]; then
+	nr_matched=`grep -c "$TEST_STRING_PATTERN" $1`
+	if [ "$nr_matched" = "1" ]; then
+	    grep -q "$TEST_STRING_PATTERN"$prev_uuid $1
+	    show_result $?
+	else
+	    prlog "FAIL"
+	    rc=1
+	fi
+    else
+	prlog "FAIL"
+	rc=1
+    fi
+}
+
 # Parameters
 TEST_STRING_PATTERN="Testing pstore: uuid="
 UUID=`cat /proc/sys/kernel/random/uuid`
diff --git a/tools/testing/selftests/pstore/pstore_post_reboot_tests b/tools/testing/selftests/pstore/pstore_post_reboot_tests
index 6ccb154..272498f 100755
--- a/tools/testing/selftests/pstore/pstore_post_reboot_tests
+++ b/tools/testing/selftests/pstore/pstore_post_reboot_tests
@@ -35,13 +35,13 @@ fi
 cd ${mount_point}
 
 prlog -n "Checking dmesg files exist in pstore filesystem ... "
-check_files_exist dmesg
+check_files_exist dmesg-${backend}-
 
 prlog -n "Checking console files exist in pstore filesystem ... "
-check_files_exist console
+check_files_exist console-${backend}-
 
 prlog -n "Checking pmsg files exist in pstore filesystem ... "
-check_files_exist pmsg
+check_files_exist pmsg-${backend}-
 
 prlog -n "Checking dmesg files contain oops end marker"
 grep_end_trace() {
@@ -54,16 +54,19 @@ prlog -n "Checking console file contains oops end marker ... "
 grep -q "\---\[ end trace" console-${backend}-0
 show_result $?
 
-prlog -n "Checking pmsg file properly keeps the content written before crash ... "
-prev_uuid=`cat $TOP_DIR/prev_uuid`
-if [ $? -eq 0 ]; then
-    nr_matched=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`
-    if [ $nr_matched -eq 1 ]; then
-	grep -q "$TEST_STRING_PATTERN"$prev_uuid pmsg-${backend}-0
-	show_result $?
+prlog -n "Checking pmsg-"${backend}"-0 properly keeps the content written before crash ... "
+check_pmsg_content pmsg-${backend}-0
+
+prlog -n "Checking the last pmsg area is detected "
+last_num_pmsg=`ls -v pmsg-* | tail -n1 | sed -e "s/^pmsg-${backend}-\([0-9]*\).*$/\1/"`
+last_num_devpmsg=`ls -v /dev/pmsg* | tail -n1 | sed -e "s/^\/dev\/pmsg\([0-9]*\).*$/\1/"`
+#checks the last number of pmsg-*-* and /dev/pmsg* correspond.
+if [ "$last_num_pmsg" -eq "$last_num_devpmsg" ]; then
+    if [ "$last_num_pmsg" = "0" ]; then
+	prlog "... No multiple pmsg-*-* exists. We skip this testcase."
     else
-	prlog "FAIL"
-	rc=1
+	prlog -n "(pmsg-${backend}-${last_num_pmsg}) ... "
+	check_pmsg_content pmsg-${backend}-${last_num_pmsg}
     fi
 else
     prlog "FAIL"
diff --git a/tools/testing/selftests/pstore/pstore_tests b/tools/testing/selftests/pstore/pstore_tests
index f25d2a3..b74b3af 100755
--- a/tools/testing/selftests/pstore/pstore_tests
+++ b/tools/testing/selftests/pstore/pstore_tests
@@ -13,9 +13,8 @@ prlog -n "Checking pstore console is registered ... "
 dmesg | grep -q "console \[pstore"
 show_result $?
 
-prlog -n "Checking /dev/pmsg0 exists ... "
-test -e /dev/pmsg0
-show_result $?
+prlog -n "Checking /dev/pmsg files exist ... "
+check_files_exist /dev/pmsg
 
 prlog -n "Writing unique string to /dev/pmsg0 ... "
 if [ -e "/dev/pmsg0" ]; then
@@ -27,4 +26,13 @@ else
     rc=1
 fi
 
+last_devpmsg=`ls -v /dev/pmsg* | tail -n1`
+prlog -n "Writing unique string to the last /dev/pmsgN "
+if [ "$last_devpmsg" = "/dev/pmsg0" ]; then
+    prlog "... No multiple /dev/pmsg* exists. We skip this testcase."
+else
+    prlog -n "(${last_devpmsg}) ... "
+    echo "${TEST_STRING_PATTERN}""$UUID" > ${last_devpmsg}
+    show_result $?
+fi
 exit $rc
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
  2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
                   ` (7 preceding siblings ...)
  2016-10-18  7:13 ` [PATCH v3 8/8] selftests/pstore: add testcases for " Nobuhiro Iwamatsu
@ 2016-11-11 22:24 ` Kees Cook
  2016-12-05  1:47   ` 岩松信洋 / IWAMATSU,NOBUHIRO
  8 siblings, 1 reply; 13+ messages in thread
From: Kees Cook @ 2016-11-11 22:24 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu
  Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML,
	cti.systems-productivity-manager.ts

On Tue, Oct 18, 2016 at 12:13 AM, Nobuhiro Iwamatsu
<nobuhiro.iwamatsu.kw@hitachi.com> wrote:
> The following series implements multiple pmsg. This feature allows
> userspace program to control individual content aging or priority.
>
> If a pstore backend module(e.g. ramoops) requires the multiple pmsg
> instances when registering itself to pstore, multiple /dev/pmsg[ID]
> are created. Writes to each /dev/pmsg[ID] are isolated each other. After
> reboot, the contents are available in /sys/fs/pstore/pmsg-[backend]-[ID].
>
> In addition, we add multiple pmsg support for ramoops. We can
> specify multiple pmsg area size by its module parameter as follows.
>
>  pmsg_size=0x1000,0x2000,...
>
> I did check the operation of this feature on CycloneV (socfpga) Helio board.
>
> v3:
>   Rebase to v4.8.
>   Split patch.
>   merged device_create().
>   Remove Blank lines.
>   Update documentiation of DT binding.
>   Update parsing function of ramoops_pmsg_size, add NULL termination.
>   Update module parameters for pmsg_size list.

Thanks for this v3! Sorry for the delay, I should be able to review
this shortly.

-Kees

>
> Hiraku Toyooka (2):
>   pstore: support multiple pmsg instances
>   selftests/pstore: add testcases for multiple pmsg instances
>
> Nobuhiro Iwamatsu (6):
>   pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs()
>   pstore: Change parameter of ramoops_free_przs()
>   ramoops: Add __ramoops_init_prz() as generic function
>   pstore: Rename 'przs' to 'dprzs' in struct ramoops_context
>   ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs()
>   ramoops: support multiple pmsg instances
>
>  .../bindings/reserved-memory/ramoops.txt           |   6 +-
>  Documentation/ramoops.txt                          |  22 ++
>  fs/pstore/pmsg.c                                   |  23 +-
>  fs/pstore/ram.c                                    | 344 ++++++++++++++++-----
>  include/linux/pstore.h                             |   1 +
>  include/linux/pstore_ram.h                         |   8 +-
>  tools/testing/selftests/pstore/common_tests        |  21 +-
>  .../selftests/pstore/pstore_post_reboot_tests      |  27 +-
>  tools/testing/selftests/pstore/pstore_tests        |  14 +-
>  9 files changed, 360 insertions(+), 106 deletions(-)
>
> --
> 2.9.3
>
>



-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
  2016-11-11 22:24 ` [PATCH v3 0/8] pstore: ramoops: support " Kees Cook
@ 2016-12-05  1:47   ` 岩松信洋 / IWAMATSU,NOBUHIRO
  2016-12-27  0:48     ` 岩松信洋 / IWAMATSU,NOBUHIRO
  0 siblings, 1 reply; 13+ messages in thread
From: 岩松信洋 / IWAMATSU,NOBUHIRO @ 2016-12-05  1:47 UTC (permalink / raw)
  To: Kees Cook
  Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML,
	cti.systems-productivity-manager.ts

Hi, Kees.

> -----Original Message-----
> From: keescook@google.com [mailto:keescook@google.com] On Behalf Of Kees
> Cook
> Sent: Saturday, November 12, 2016 7:24 AM
> To: 岩松信洋 / IWAMATSU,NOBUHIRO
> Cc: Anton Vorontsov; Colin Cross; Tony Luck; LKML;
> cti.systems-productivity-manager.ts@hitachi.com
> Subject: Re: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
> 
> On Tue, Oct 18, 2016 at 12:13 AM, Nobuhiro Iwamatsu
> <nobuhiro.iwamatsu.kw@hitachi.com> wrote:
> > The following series implements multiple pmsg. This feature allows
> > userspace program to control individual content aging or priority.
> >
> > If a pstore backend module(e.g. ramoops) requires the multiple pmsg
> > instances when registering itself to pstore, multiple /dev/pmsg[ID]
> > are created. Writes to each /dev/pmsg[ID] are isolated each other.
> > After reboot, the contents are available in
> /sys/fs/pstore/pmsg-[backend]-[ID].
> >
> > In addition, we add multiple pmsg support for ramoops. We can specify
> > multiple pmsg area size by its module parameter as follows.
> >
> >  pmsg_size=0x1000,0x2000,...
> >
> > I did check the operation of this feature on CycloneV (socfpga) Helio
> board.
> >
> > v3:
> >   Rebase to v4.8.
> >   Split patch.
> >   merged device_create().
> >   Remove Blank lines.
> >   Update documentiation of DT binding.
> >   Update parsing function of ramoops_pmsg_size, add NULL termination.
> >   Update module parameters for pmsg_size list.
> 
> Thanks for this v3! Sorry for the delay, I should be able to review this
> shortly.

Thank you.
I will wait for your review.

> 
> -Kees
> 

Best regards,
  Nobuhiro

> >
> > Hiraku Toyooka (2):
> >   pstore: support multiple pmsg instances
> >   selftests/pstore: add testcases for multiple pmsg instances
> >
> > Nobuhiro Iwamatsu (6):
> >   pstore: Replace four kzalloc() calls by kcalloc() in
> ramoops_init_przs()
> >   pstore: Change parameter of ramoops_free_przs()
> >   ramoops: Add __ramoops_init_prz() as generic function
> >   pstore: Rename 'przs' to 'dprzs' in struct ramoops_context
> >   ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs()
> >   ramoops: support multiple pmsg instances
> >
> >  .../bindings/reserved-memory/ramoops.txt           |   6 +-
> >  Documentation/ramoops.txt                          |  22 ++
> >  fs/pstore/pmsg.c                                   |  23 +-
> >  fs/pstore/ram.c                                    | 344
> ++++++++++++++++-----
> >  include/linux/pstore.h                             |   1 +
> >  include/linux/pstore_ram.h                         |   8 +-
> >  tools/testing/selftests/pstore/common_tests        |  21 +-
> >  .../selftests/pstore/pstore_post_reboot_tests      |  27 +-
> >  tools/testing/selftests/pstore/pstore_tests        |  14 +-
> >  9 files changed, 360 insertions(+), 106 deletions(-)
> >
> > --
> > 2.9.3
> >
> >
> 
> 
> 
> --
> Kees Cook
> Nexus Security

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
  2016-12-05  1:47   ` 岩松信洋 / IWAMATSU,NOBUHIRO
@ 2016-12-27  0:48     ` 岩松信洋 / IWAMATSU,NOBUHIRO
  2017-01-04  6:20       ` Kees Cook
  0 siblings, 1 reply; 13+ messages in thread
From: 岩松信洋 / IWAMATSU,NOBUHIRO @ 2016-12-27  0:48 UTC (permalink / raw)
  To: 岩松信洋 / IWAMATSU,NOBUHIRO, Kees Cook
  Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML,
	cti.systems-productivity-manager.ts

Ping?_

> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of 岩松信洋 /
> IWAMATSU,NOBUHIRO
> Sent: Monday, December 05, 2016 10:47 AM
> To: Kees Cook
> Cc: Anton Vorontsov; Colin Cross; Tony Luck; LKML;
> cti.systems-productivity-manager.ts@hitachi.com
> Subject: RE: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
> 
> Hi, Kees.
> 
> > -----Original Message-----
> > From: keescook@google.com [mailto:keescook@google.com] On Behalf Of
> > Kees Cook
> > Sent: Saturday, November 12, 2016 7:24 AM
> > To: 岩松信洋 / IWAMATSU,NOBUHIRO
> > Cc: Anton Vorontsov; Colin Cross; Tony Luck; LKML;
> > cti.systems-productivity-manager.ts@hitachi.com
> > Subject: Re: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg
> > instances
> >
> > On Tue, Oct 18, 2016 at 12:13 AM, Nobuhiro Iwamatsu
> > <nobuhiro.iwamatsu.kw@hitachi.com> wrote:
> > > The following series implements multiple pmsg. This feature allows
> > > userspace program to control individual content aging or priority.
> > >
> > > If a pstore backend module(e.g. ramoops) requires the multiple pmsg
> > > instances when registering itself to pstore, multiple /dev/pmsg[ID]
> > > are created. Writes to each /dev/pmsg[ID] are isolated each other.
> > > After reboot, the contents are available in
> > /sys/fs/pstore/pmsg-[backend]-[ID].
> > >
> > > In addition, we add multiple pmsg support for ramoops. We can
> > > specify multiple pmsg area size by its module parameter as follows.
> > >
> > >  pmsg_size=0x1000,0x2000,...
> > >
> > > I did check the operation of this feature on CycloneV (socfpga)
> > > Helio
> > board.
> > >
> > > v3:
> > >   Rebase to v4.8.
> > >   Split patch.
> > >   merged device_create().
> > >   Remove Blank lines.
> > >   Update documentiation of DT binding.
> > >   Update parsing function of ramoops_pmsg_size, add NULL termination.
> > >   Update module parameters for pmsg_size list.
> >
> > Thanks for this v3! Sorry for the delay, I should be able to review
> > this shortly.
> 
> Thank you.
> I will wait for your review.
> 
> >
> > -Kees
> >
> 
> Best regards,
>   Nobuhiro
> 
> > >
> > > Hiraku Toyooka (2):
> > >   pstore: support multiple pmsg instances
> > >   selftests/pstore: add testcases for multiple pmsg instances
> > >
> > > Nobuhiro Iwamatsu (6):
> > >   pstore: Replace four kzalloc() calls by kcalloc() in
> > ramoops_init_przs()
> > >   pstore: Change parameter of ramoops_free_przs()
> > >   ramoops: Add __ramoops_init_prz() as generic function
> > >   pstore: Rename 'przs' to 'dprzs' in struct ramoops_context
> > >   ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs()
> > >   ramoops: support multiple pmsg instances
> > >
> > >  .../bindings/reserved-memory/ramoops.txt           |   6 +-
> > >  Documentation/ramoops.txt                          |  22 ++
> > >  fs/pstore/pmsg.c                                   |  23 +-
> > >  fs/pstore/ram.c                                    | 344
> > ++++++++++++++++-----
> > >  include/linux/pstore.h                             |   1 +
> > >  include/linux/pstore_ram.h                         |   8 +-
> > >  tools/testing/selftests/pstore/common_tests        |  21 +-
> > >  .../selftests/pstore/pstore_post_reboot_tests      |  27 +-
> > >  tools/testing/selftests/pstore/pstore_tests        |  14 +-
> > >  9 files changed, 360 insertions(+), 106 deletions(-)
> > >
> > > --
> > > 2.9.3
> > >
> > >
> >
> >
> >
> > --
> > Kees Cook
> > Nexus Security

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
  2016-12-27  0:48     ` 岩松信洋 / IWAMATSU,NOBUHIRO
@ 2017-01-04  6:20       ` Kees Cook
  0 siblings, 0 replies; 13+ messages in thread
From: Kees Cook @ 2017-01-04  6:20 UTC (permalink / raw)
  To: 岩松信洋 / IWAMATSU,NOBUHIRO
  Cc: Anton Vorontsov, Colin Cross, Tony Luck, LKML,
	cti.systems-productivity-manager.ts

On Mon, Dec 26, 2016 at 4:48 PM, 岩松信洋 / IWAMATSU,NOBUHIRO
<nobuhiro.iwamatsu.kw@hitachi.com> wrote:
> Ping?_
>
>> -----Original Message-----
>> From: linux-kernel-owner@vger.kernel.org
>> [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of 岩松信洋 /
>> IWAMATSU,NOBUHIRO
>> Sent: Monday, December 05, 2016 10:47 AM
>> To: Kees Cook
>> Cc: Anton Vorontsov; Colin Cross; Tony Luck; LKML;
>> cti.systems-productivity-manager.ts@hitachi.com
>> Subject: RE: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances
>>
>> Hi, Kees.
>>
>> > -----Original Message-----
>> > From: keescook@google.com [mailto:keescook@google.com] On Behalf Of
>> > Kees Cook
>> > Sent: Saturday, November 12, 2016 7:24 AM
>> > To: 岩松信洋 / IWAMATSU,NOBUHIRO
>> > Cc: Anton Vorontsov; Colin Cross; Tony Luck; LKML;
>> > cti.systems-productivity-manager.ts@hitachi.com
>> > Subject: Re: [PATCH v3 0/8] pstore: ramoops: support multiple pmsg
>> > instances
>> >
>> > On Tue, Oct 18, 2016 at 12:13 AM, Nobuhiro Iwamatsu
>> > <nobuhiro.iwamatsu.kw@hitachi.com> wrote:
>> > > The following series implements multiple pmsg. This feature allows
>> > > userspace program to control individual content aging or priority.
>> > >
>> > > If a pstore backend module(e.g. ramoops) requires the multiple pmsg
>> > > instances when registering itself to pstore, multiple /dev/pmsg[ID]
>> > > are created. Writes to each /dev/pmsg[ID] are isolated each other.
>> > > After reboot, the contents are available in
>> > /sys/fs/pstore/pmsg-[backend]-[ID].
>> > >
>> > > In addition, we add multiple pmsg support for ramoops. We can
>> > > specify multiple pmsg area size by its module parameter as follows.
>> > >
>> > >  pmsg_size=0x1000,0x2000,...
>> > >
>> > > I did check the operation of this feature on CycloneV (socfpga)
>> > > Helio
>> > board.
>> > >
>> > > v3:
>> > >   Rebase to v4.8.
>> > >   Split patch.
>> > >   merged device_create().
>> > >   Remove Blank lines.
>> > >   Update documentiation of DT binding.
>> > >   Update parsing function of ramoops_pmsg_size, add NULL termination.
>> > >   Update module parameters for pmsg_size list.
>> >
>> > Thanks for this v3! Sorry for the delay, I should be able to review
>> > this shortly.
>>
>> Thank you.
>> I will wait for your review.

Now that the big changes have landed in Linus's tree, are you able to
rebase your series on those?

-Kees

-- 
Kees Cook
Nexus Security

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-01-04  6:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18  7:13 [PATCH v3 0/8] pstore: ramoops: support multiple pmsg instances Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs() Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 2/8] pstore: Change parameter of ramoops_free_przs() Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 3/8] ramoops: Add __ramoops_init_prz() as generic function Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 4/8] pstore: Rename 'przs' to 'dprzs' in struct ramoops_context Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 5/8] ramoops: Rename ramoops_init_prz() to ramoops_init_dprzs() Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 6/8] pstore: support multiple pmsg instances Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 7/8] ramoops: " Nobuhiro Iwamatsu
2016-10-18  7:13 ` [PATCH v3 8/8] selftests/pstore: add testcases for " Nobuhiro Iwamatsu
2016-11-11 22:24 ` [PATCH v3 0/8] pstore: ramoops: support " Kees Cook
2016-12-05  1:47   ` 岩松信洋 / IWAMATSU,NOBUHIRO
2016-12-27  0:48     ` 岩松信洋 / IWAMATSU,NOBUHIRO
2017-01-04  6:20       ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).