All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] pstore: Split pstore fragile flags
@ 2016-07-21  0:59 ` Namhyung Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2016-07-21  0:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck, Rafael J. Wysocki,
	Len Brown, Matt Fleming, linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	linux-efi-u79uwXL29TY76Z2rM5mHXA

This patch adds new PSTORE_FLAGS for each pstore type so that they can
be enabled separately.  This is a preparation for ongoing virtio-pstore
work to support those types flexibly.

The PSTORE_FLAGS_FRAGILE is changed to PSTORE_FLAGS_DMESG to preserve the
original behavior.

Cc: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>
Cc: Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Namhyung Kim <namhyung-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/acpi/apei/erst.c          |  2 +-
 drivers/firmware/efi/efi-pstore.c |  2 +-
 fs/pstore/platform.c              | 21 +++++++++++++--------
 fs/pstore/ram.c                   |  2 ++
 include/linux/pstore.h            |  7 ++++++-
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 006c3894c6ea..f0cb7b0fbac8 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -937,7 +937,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count,
 static struct pstore_info erst_info = {
 	.owner		= THIS_MODULE,
 	.name		= "erst",
-	.flags		= PSTORE_FLAGS_FRAGILE,
+	.flags		= PSTORE_FLAGS_DMESG,
 	.open		= erst_open_pstore,
 	.close		= erst_close_pstore,
 	.read		= erst_reader,
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index eac76a79a880..dcb61a6f7ea7 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -356,7 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
 static struct pstore_info efi_pstore_info = {
 	.owner		= THIS_MODULE,
 	.name		= "efi",
-	.flags		= PSTORE_FLAGS_FRAGILE,
+	.flags		= PSTORE_FLAGS_DMESG,
 	.open		= efi_pstore_open,
 	.close		= efi_pstore_close,
 	.read		= efi_pstore_read,
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 588461bb2dd4..6e86b7ea095d 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -467,13 +467,14 @@ int pstore_register(struct pstore_info *psi)
 	if (pstore_is_mounted())
 		pstore_get_records(0);
 
-	pstore_register_kmsg();
-
-	if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
+	if (psi->flags & PSTORE_FLAGS_DMESG)
+		pstore_register_kmsg();
+	if (psi->flags & PSTORE_FLAGS_CONSOLE)
 		pstore_register_console();
+	if (psi->flags & PSTORE_FLAGS_FTRACE)
 		pstore_register_ftrace();
+	if (psi->flags & PSTORE_FLAGS_PMSG)
 		pstore_register_pmsg();
-	}
 
 	if (pstore_update_ms >= 0) {
 		pstore_timer.expires = jiffies +
@@ -497,10 +498,14 @@ EXPORT_SYMBOL_GPL(pstore_register);
 
 void pstore_unregister(struct pstore_info *psi)
 {
-	pstore_unregister_pmsg();
-	pstore_unregister_ftrace();
-	pstore_unregister_console();
-	pstore_unregister_kmsg();
+	if (psi->flags & PSTORE_FLAGS_PMSG)
+		pstore_unregister_pmsg();
+	if (psi->flags & PSTORE_FLAGS_FTRACE)
+		pstore_unregister_ftrace();
+	if (psi->flags & PSTORE_FLAGS_CONSOLE)
+		pstore_unregister_console();
+	if (psi->flags & PSTORE_FLAGS_DMESG)
+		pstore_unregister_kmsg();
 
 	free_buf_for_compression();
 
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index bd9812e83461..d08bfd611b11 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -539,6 +539,8 @@ static int ramoops_probe(struct platform_device *pdev)
 		goto fail_clear;
 	}
 
+	cxt->pstore.flags = PSTORE_FLAGS_ALL;
+
 	err = pstore_register(&cxt->pstore);
 	if (err) {
 		pr_err("registering with pstore failed\n");
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 831479f8df8f..3ba0c1af40e5 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -73,7 +73,12 @@ struct pstore_info {
 	void		*data;
 };
 
-#define	PSTORE_FLAGS_FRAGILE	1
+#define PSTORE_FLAGS_DMESG	(1 << 0)
+#define PSTORE_FLAGS_CONSOLE	(1 << 1)
+#define PSTORE_FLAGS_FTRACE	(1 << 2)
+#define PSTORE_FLAGS_PMSG	(1 << 3)
+
+#define PSTORE_FLAGS_ALL	((1 << 4) - 1)
 
 extern int pstore_register(struct pstore_info *);
 extern void pstore_unregister(struct pstore_info *);
-- 
2.8.0

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

* [PATCH v3 1/2] pstore: Split pstore fragile flags
@ 2016-07-21  0:59 ` Namhyung Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2016-07-21  0:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck, Rafael J. Wysocki,
	Len Brown, Matt Fleming, linux-acpi, linux-efi

This patch adds new PSTORE_FLAGS for each pstore type so that they can
be enabled separately.  This is a preparation for ongoing virtio-pstore
work to support those types flexibly.

The PSTORE_FLAGS_FRAGILE is changed to PSTORE_FLAGS_DMESG to preserve the
original behavior.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: linux-acpi@vger.kernel.org
Cc: linux-efi@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 drivers/acpi/apei/erst.c          |  2 +-
 drivers/firmware/efi/efi-pstore.c |  2 +-
 fs/pstore/platform.c              | 21 +++++++++++++--------
 fs/pstore/ram.c                   |  2 ++
 include/linux/pstore.h            |  7 ++++++-
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 006c3894c6ea..f0cb7b0fbac8 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -937,7 +937,7 @@ static int erst_clearer(enum pstore_type_id type, u64 id, int count,
 static struct pstore_info erst_info = {
 	.owner		= THIS_MODULE,
 	.name		= "erst",
-	.flags		= PSTORE_FLAGS_FRAGILE,
+	.flags		= PSTORE_FLAGS_DMESG,
 	.open		= erst_open_pstore,
 	.close		= erst_close_pstore,
 	.read		= erst_reader,
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index eac76a79a880..dcb61a6f7ea7 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -356,7 +356,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
 static struct pstore_info efi_pstore_info = {
 	.owner		= THIS_MODULE,
 	.name		= "efi",
-	.flags		= PSTORE_FLAGS_FRAGILE,
+	.flags		= PSTORE_FLAGS_DMESG,
 	.open		= efi_pstore_open,
 	.close		= efi_pstore_close,
 	.read		= efi_pstore_read,
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 588461bb2dd4..6e86b7ea095d 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -467,13 +467,14 @@ int pstore_register(struct pstore_info *psi)
 	if (pstore_is_mounted())
 		pstore_get_records(0);
 
-	pstore_register_kmsg();
-
-	if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
+	if (psi->flags & PSTORE_FLAGS_DMESG)
+		pstore_register_kmsg();
+	if (psi->flags & PSTORE_FLAGS_CONSOLE)
 		pstore_register_console();
+	if (psi->flags & PSTORE_FLAGS_FTRACE)
 		pstore_register_ftrace();
+	if (psi->flags & PSTORE_FLAGS_PMSG)
 		pstore_register_pmsg();
-	}
 
 	if (pstore_update_ms >= 0) {
 		pstore_timer.expires = jiffies +
@@ -497,10 +498,14 @@ EXPORT_SYMBOL_GPL(pstore_register);
 
 void pstore_unregister(struct pstore_info *psi)
 {
-	pstore_unregister_pmsg();
-	pstore_unregister_ftrace();
-	pstore_unregister_console();
-	pstore_unregister_kmsg();
+	if (psi->flags & PSTORE_FLAGS_PMSG)
+		pstore_unregister_pmsg();
+	if (psi->flags & PSTORE_FLAGS_FTRACE)
+		pstore_unregister_ftrace();
+	if (psi->flags & PSTORE_FLAGS_CONSOLE)
+		pstore_unregister_console();
+	if (psi->flags & PSTORE_FLAGS_DMESG)
+		pstore_unregister_kmsg();
 
 	free_buf_for_compression();
 
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index bd9812e83461..d08bfd611b11 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -539,6 +539,8 @@ static int ramoops_probe(struct platform_device *pdev)
 		goto fail_clear;
 	}
 
+	cxt->pstore.flags = PSTORE_FLAGS_ALL;
+
 	err = pstore_register(&cxt->pstore);
 	if (err) {
 		pr_err("registering with pstore failed\n");
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 831479f8df8f..3ba0c1af40e5 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -73,7 +73,12 @@ struct pstore_info {
 	void		*data;
 };
 
-#define	PSTORE_FLAGS_FRAGILE	1
+#define PSTORE_FLAGS_DMESG	(1 << 0)
+#define PSTORE_FLAGS_CONSOLE	(1 << 1)
+#define PSTORE_FLAGS_FTRACE	(1 << 2)
+#define PSTORE_FLAGS_PMSG	(1 << 3)
+
+#define PSTORE_FLAGS_ALL	((1 << 4) - 1)
 
 extern int pstore_register(struct pstore_info *);
 extern void pstore_unregister(struct pstore_info *);
-- 
2.8.0

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

* [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically
  2016-07-21  0:59 ` Namhyung Kim
  (?)
@ 2016-07-21  0:59 ` Namhyung Kim
  2016-07-21 23:07   ` kbuild test robot
  2016-07-22  0:17   ` kbuild test robot
  -1 siblings, 2 replies; 8+ messages in thread
From: Namhyung Kim @ 2016-07-21  0:59 UTC (permalink / raw)
  To: Kees Cook; +Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck

The ramoops can be configured to enable each pstore type by setting
their size.  In that case, it'd be better not to register disabled types
in the first place.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 fs/pstore/ram.c        | 8 +++++++-
 include/linux/pstore.h | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index d08bfd611b11..80a4d44464fc 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -539,7 +539,13 @@ static int ramoops_probe(struct platform_device *pdev)
 		goto fail_clear;
 	}
 
-	cxt->pstore.flags = PSTORE_FLAGS_ALL;
+	cxt->pstore.flags = PSTORE_FLAGS_DMESG;
+	if (ctx->console_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_CONOLE;
+	if (ctx->ftrace_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
+	if (ctx->pmsg_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_PMSG;
 
 	err = pstore_register(&cxt->pstore);
 	if (err) {
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 3ba0c1af40e5..a6d80bd960cb 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -78,8 +78,6 @@ struct pstore_info {
 #define PSTORE_FLAGS_FTRACE	(1 << 2)
 #define PSTORE_FLAGS_PMSG	(1 << 3)
 
-#define PSTORE_FLAGS_ALL	((1 << 4) - 1)
-
 extern int pstore_register(struct pstore_info *);
 extern void pstore_unregister(struct pstore_info *);
 extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
-- 
2.8.0

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

* Re: [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically
  2016-07-21  0:59 ` [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically Namhyung Kim
@ 2016-07-21 23:07   ` kbuild test robot
  2016-07-22  0:17   ` kbuild test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2016-07-21 23:07 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: kbuild-all, Kees Cook, LKML, Anton Vorontsov, Colin Cross, Tony Luck

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

Hi,

[auto build test ERROR on ia64/next]
[also build test ERROR on v4.7-rc7]
[cannot apply to next-20160721]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Namhyung-Kim/pstore-Split-pstore-fragile-flags/20160722-060839
base:   https://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git next
config: x86_64-randconfig-i0-201629 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.3-14) 4.9.3
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   fs/pstore/ram.c: In function 'ramoops_probe':
>> fs/pstore/ram.c:543:6: error: 'ctx' undeclared (first use in this function)
     if (ctx->console_size)
         ^
   fs/pstore/ram.c:543:6: note: each undeclared identifier is reported only once for each function it appears in
>> fs/pstore/ram.c:544:24: error: 'PSTORE_FLAGS_CONOLE' undeclared (first use in this function)
      cxt->pstore.flags |= PSTORE_FLAGS_CONOLE;
                           ^

vim +/ctx +543 fs/pstore/ram.c

   537			pr_err("cannot allocate pstore buffer\n");
   538			err = -ENOMEM;
   539			goto fail_clear;
   540		}
   541	
   542		cxt->pstore.flags = PSTORE_FLAGS_DMESG;
 > 543		if (ctx->console_size)
 > 544			cxt->pstore.flags |= PSTORE_FLAGS_CONOLE;
   545		if (ctx->ftrace_size)
   546			cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
   547		if (ctx->pmsg_size)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 30002 bytes --]

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

* Re: [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically
  2016-07-21  0:59 ` [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically Namhyung Kim
  2016-07-21 23:07   ` kbuild test robot
@ 2016-07-22  0:17   ` kbuild test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kbuild test robot @ 2016-07-22  0:17 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: kbuild-all, Kees Cook, LKML, Anton Vorontsov, Colin Cross, Tony Luck

[-- Attachment #1: Type: text/plain, Size: 3011 bytes --]

Hi,

[auto build test WARNING on ia64/next]
[also build test WARNING on v4.7-rc7]
[cannot apply to next-20160721]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Namhyung-Kim/pstore-Split-pstore-fragile-flags/20160722-060839
base:   https://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git next
config: i386-randconfig-x0-07220732 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from fs/pstore/ram.c:25:
   fs/pstore/ram.c: In function 'ramoops_probe':
   fs/pstore/ram.c:543:6: error: 'ctx' undeclared (first use in this function)
     if (ctx->console_size)
         ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> fs/pstore/ram.c:543:2: note: in expansion of macro 'if'
     if (ctx->console_size)
     ^~
   fs/pstore/ram.c:543:6: note: each undeclared identifier is reported only once for each function it appears in
     if (ctx->console_size)
         ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> fs/pstore/ram.c:543:2: note: in expansion of macro 'if'
     if (ctx->console_size)
     ^~
   fs/pstore/ram.c:544:24: error: 'PSTORE_FLAGS_CONOLE' undeclared (first use in this function)
      cxt->pstore.flags |= PSTORE_FLAGS_CONOLE;
                           ^~~~~~~~~~~~~~~~~~~

vim +/if +543 fs/pstore/ram.c

   527		 * have to handle dumps, we must have at least record_size buffer. And
   528		 * for ftrace, bufsize is irrelevant (if bufsize is 0, buf will be
   529		 * ZERO_SIZE_PTR).
   530		 */
   531		if (cxt->console_size)
   532			cxt->pstore.bufsize = 1024; /* LOG_LINE_MAX */
   533		cxt->pstore.bufsize = max(cxt->record_size, cxt->pstore.bufsize);
   534		cxt->pstore.buf = kmalloc(cxt->pstore.bufsize, GFP_KERNEL);
   535		spin_lock_init(&cxt->pstore.buf_lock);
   536		if (!cxt->pstore.buf) {
   537			pr_err("cannot allocate pstore buffer\n");
   538			err = -ENOMEM;
   539			goto fail_clear;
   540		}
   541	
   542		cxt->pstore.flags = PSTORE_FLAGS_DMESG;
 > 543		if (ctx->console_size)
   544			cxt->pstore.flags |= PSTORE_FLAGS_CONOLE;
   545		if (ctx->ftrace_size)
   546			cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
   547		if (ctx->pmsg_size)
   548			cxt->pstore.flags |= PSTORE_FLAGS_PMSG;
   549	
   550		err = pstore_register(&cxt->pstore);
   551		if (err) {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 23781 bytes --]

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

* [PATCH v3.1 2/2] pstore/ram: Set pstore flags dynamically
  2016-07-21  0:59 ` Namhyung Kim
  (?)
  (?)
@ 2016-07-22 13:45 ` Namhyung Kim
  2016-09-08 20:37   ` Kees Cook
  -1 siblings, 1 reply; 8+ messages in thread
From: Namhyung Kim @ 2016-07-22 13:45 UTC (permalink / raw)
  To: Kees Cook; +Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck

The ramoops can be configured to enable each pstore type by setting
their size.  In that case, it'd be better not to register disabled types
in the first place.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 fs/pstore/ram.c        | 8 +++++++-
 include/linux/pstore.h | 2 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index d08bfd611b11..c5316c0ac756 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -539,7 +539,13 @@ static int ramoops_probe(struct platform_device *pdev)
 		goto fail_clear;
 	}
 
-	cxt->pstore.flags = PSTORE_FLAGS_ALL;
+	cxt->pstore.flags = PSTORE_FLAGS_DMESG;
+	if (cxt->console_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE;
+	if (cxt->ftrace_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
+	if (cxt->pmsg_size)
+		cxt->pstore.flags |= PSTORE_FLAGS_PMSG;
 
 	err = pstore_register(&cxt->pstore);
 	if (err) {
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 3ba0c1af40e5..a6d80bd960cb 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -78,8 +78,6 @@ struct pstore_info {
 #define PSTORE_FLAGS_FTRACE	(1 << 2)
 #define PSTORE_FLAGS_PMSG	(1 << 3)
 
-#define PSTORE_FLAGS_ALL	((1 << 4) - 1)
-
 extern int pstore_register(struct pstore_info *);
 extern void pstore_unregister(struct pstore_info *);
 extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
-- 
2.8.0

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

* Re: [PATCH v3.1 2/2] pstore/ram: Set pstore flags dynamically
  2016-07-22 13:45 ` [PATCH v3.1 " Namhyung Kim
@ 2016-09-08 20:37   ` Kees Cook
  2016-09-09  5:56     ` Namhyung Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2016-09-08 20:37 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck

On Fri, Jul 22, 2016 at 6:45 AM, Namhyung Kim <namhyung@kernel.org> wrote:
> The ramoops can be configured to enable each pstore type by setting
> their size.  In that case, it'd be better not to register disabled types
> in the first place.
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  fs/pstore/ram.c        | 8 +++++++-
>  include/linux/pstore.h | 2 --
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index d08bfd611b11..c5316c0ac756 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -539,7 +539,13 @@ static int ramoops_probe(struct platform_device *pdev)
>                 goto fail_clear;
>         }
>
> -       cxt->pstore.flags = PSTORE_FLAGS_ALL;
> +       cxt->pstore.flags = PSTORE_FLAGS_DMESG;
> +       if (cxt->console_size)
> +               cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE;
> +       if (cxt->ftrace_size)
> +               cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
> +       if (cxt->pmsg_size)
> +               cxt->pstore.flags |= PSTORE_FLAGS_PMSG;
>
>         err = pstore_register(&cxt->pstore);
>         if (err) {
> diff --git a/include/linux/pstore.h b/include/linux/pstore.h
> index 3ba0c1af40e5..a6d80bd960cb 100644
> --- a/include/linux/pstore.h
> +++ b/include/linux/pstore.h
> @@ -78,8 +78,6 @@ struct pstore_info {
>  #define PSTORE_FLAGS_FTRACE    (1 << 2)
>  #define PSTORE_FLAGS_PMSG      (1 << 3)
>
> -#define PSTORE_FLAGS_ALL       ((1 << 4) - 1)
> -
>  extern int pstore_register(struct pstore_info *);
>  extern void pstore_unregister(struct pstore_info *);
>  extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
> --
> 2.8.0
>

Hi!

I've pulled this and the 1/2 patch for -next now. I made one small
change, which was to leave FLAGS_FRAGILE defined as FLAGS_DMESG just
to make merging the virtio driver easier.

-Kees

-- 
Kees Cook
Nexus Security

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

* Re: [PATCH v3.1 2/2] pstore/ram: Set pstore flags dynamically
  2016-09-08 20:37   ` Kees Cook
@ 2016-09-09  5:56     ` Namhyung Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2016-09-09  5:56 UTC (permalink / raw)
  To: Kees Cook; +Cc: LKML, Anton Vorontsov, Colin Cross, Tony Luck

Hi Kees,

On Fri, Sep 9, 2016 at 5:37 AM, Kees Cook <keescook@chromium.org> wrote:
> On Fri, Jul 22, 2016 at 6:45 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>> The ramoops can be configured to enable each pstore type by setting
>> their size.  In that case, it'd be better not to register disabled types
>> in the first place.
>>
>> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>> ---
>>  fs/pstore/ram.c        | 8 +++++++-
>>  include/linux/pstore.h | 2 --
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
>> index d08bfd611b11..c5316c0ac756 100644
>> --- a/fs/pstore/ram.c
>> +++ b/fs/pstore/ram.c
>> @@ -539,7 +539,13 @@ static int ramoops_probe(struct platform_device *pdev)
>>                 goto fail_clear;
>>         }
>>
>> -       cxt->pstore.flags = PSTORE_FLAGS_ALL;
>> +       cxt->pstore.flags = PSTORE_FLAGS_DMESG;
>> +       if (cxt->console_size)
>> +               cxt->pstore.flags |= PSTORE_FLAGS_CONSOLE;
>> +       if (cxt->ftrace_size)
>> +               cxt->pstore.flags |= PSTORE_FLAGS_FTRACE;
>> +       if (cxt->pmsg_size)
>> +               cxt->pstore.flags |= PSTORE_FLAGS_PMSG;
>>
>>         err = pstore_register(&cxt->pstore);
>>         if (err) {
>> diff --git a/include/linux/pstore.h b/include/linux/pstore.h
>> index 3ba0c1af40e5..a6d80bd960cb 100644
>> --- a/include/linux/pstore.h
>> +++ b/include/linux/pstore.h
>> @@ -78,8 +78,6 @@ struct pstore_info {
>>  #define PSTORE_FLAGS_FTRACE    (1 << 2)
>>  #define PSTORE_FLAGS_PMSG      (1 << 3)
>>
>> -#define PSTORE_FLAGS_ALL       ((1 << 4) - 1)
>> -
>>  extern int pstore_register(struct pstore_info *);
>>  extern void pstore_unregister(struct pstore_info *);
>>  extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
>> --
>> 2.8.0
>>
>
> Hi!
>
> I've pulled this and the 1/2 patch for -next now. I made one small
> change, which was to leave FLAGS_FRAGILE defined as FLAGS_DMESG just
> to make merging the virtio driver easier.

Thanks for your help. :)

Namhyung

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

end of thread, other threads:[~2016-09-09  6:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21  0:59 [PATCH v3 1/2] pstore: Split pstore fragile flags Namhyung Kim
2016-07-21  0:59 ` Namhyung Kim
2016-07-21  0:59 ` [PATCH v3 2/2] pstore/ram: Set pstore flags dynamically Namhyung Kim
2016-07-21 23:07   ` kbuild test robot
2016-07-22  0:17   ` kbuild test robot
2016-07-22 13:45 ` [PATCH v3.1 " Namhyung Kim
2016-09-08 20:37   ` Kees Cook
2016-09-09  5:56     ` Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.