aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeiji Aguchi <seiji.aguchi@hds.com>2012-11-26 19:07:44 -0500
committerTony Luck <tony.luck@intel.com>2012-11-26 19:07:44 -0500
commit755d4fe46529018ae45bc7c86df682de45ace764 (patch)
tree470788ad3e9fa704ef41fa62ac9e770193010853
parenta9efd39cd547223597cfe7c53acec44c099b9264 (diff)
efi_pstore: Add a sequence counter to a variable name
[Issue] Currently, a variable name, which identifies each entry, consists of type, id and ctime. But if multiple events happens in a short time, a second/third event may fail to log because efi_pstore can't distinguish each event with current variable name. [Solution] A reasonable way to identify all events precisely is introducing a sequence counter to the variable name. The sequence counter has already supported in a pstore layer with "oopscount". So, this patch adds it to a variable name. Also, it is passed to read/erase callbacks of platform drivers in accordance with the modification of the variable name. <before applying this patch> a variable name of first event: dump-type0-1-12345678 a variable name of second event: dump-type0-1-12345678 type:0 id:1 ctime:12345678 If multiple events happen in a short time, efi_pstore can't distinguish them because variable names are same among them. <after applying this patch> it can be distinguishable by adding a sequence counter as follows. a variable name of first event: dump-type0-1-1-12345678 a variable name of Second event: dump-type0-1-2-12345678 type:0 id:1 sequence counter: 1(first event), 2(second event) ctime:12345678 In case of a write callback executed in pstore_console_write(), "0" is added to an argument of the write callback because it just logs all kernel messages and doesn't need to care about multiple events. Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mike Waychison <mikew@google.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--drivers/acpi/apei/erst.c12
-rw-r--r--drivers/firmware/efivars.c23
-rw-r--r--fs/pstore/inode.c8
-rw-r--r--fs/pstore/internal.h2
-rw-r--r--fs/pstore/platform.c13
-rw-r--r--fs/pstore/ram.c7
-rw-r--r--include/linux/pstore.h8
7 files changed, 41 insertions, 32 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 0bd6ae4a899f..6d894bfd8b8f 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -931,13 +931,13 @@ static int erst_check_table(struct acpi_table_erst *erst_tab)
931 931
932static int erst_open_pstore(struct pstore_info *psi); 932static int erst_open_pstore(struct pstore_info *psi);
933static int erst_close_pstore(struct pstore_info *psi); 933static int erst_close_pstore(struct pstore_info *psi);
934static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, 934static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
935 struct timespec *time, char **buf, 935 struct timespec *time, char **buf,
936 struct pstore_info *psi); 936 struct pstore_info *psi);
937static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 937static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
938 u64 *id, unsigned int part, 938 u64 *id, unsigned int part, int count,
939 size_t size, struct pstore_info *psi); 939 size_t size, struct pstore_info *psi);
940static int erst_clearer(enum pstore_type_id type, u64 id, 940static int erst_clearer(enum pstore_type_id type, u64 id, int count,
941 struct timespec time, struct pstore_info *psi); 941 struct timespec time, struct pstore_info *psi);
942 942
943static struct pstore_info erst_info = { 943static struct pstore_info erst_info = {
@@ -987,7 +987,7 @@ static int erst_close_pstore(struct pstore_info *psi)
987 return 0; 987 return 0;
988} 988}
989 989
990static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, 990static ssize_t erst_reader(u64 *id, enum pstore_type_id *type, int *count,
991 struct timespec *time, char **buf, 991 struct timespec *time, char **buf,
992 struct pstore_info *psi) 992 struct pstore_info *psi)
993{ 993{
@@ -1055,7 +1055,7 @@ out:
1055} 1055}
1056 1056
1057static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason, 1057static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
1058 u64 *id, unsigned int part, 1058 u64 *id, unsigned int part, int count,
1059 size_t size, struct pstore_info *psi) 1059 size_t size, struct pstore_info *psi)
1060{ 1060{
1061 struct cper_pstore_record *rcd = (struct cper_pstore_record *) 1061 struct cper_pstore_record *rcd = (struct cper_pstore_record *)
@@ -1101,7 +1101,7 @@ static int erst_writer(enum pstore_type_id type, enum kmsg_dump_reason reason,
1101 return ret; 1101 return ret;
1102} 1102}
1103 1103
1104static int erst_clearer(enum pstore_type_id type, u64 id, 1104static int erst_clearer(enum pstore_type_id type, u64 id, int count,
1105 struct timespec time, struct pstore_info *psi) 1105 struct timespec time, struct pstore_info *psi)
1106{ 1106{
1107 return erst_clear(id); 1107 return erst_clear(id);
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 3803621c0d45..7ad3aae6e085 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -658,13 +658,14 @@ static int efi_pstore_close(struct pstore_info *psi)
658} 658}
659 659
660static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, 660static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
661 struct timespec *timespec, 661 int *count, struct timespec *timespec,
662 char **buf, struct pstore_info *psi) 662 char **buf, struct pstore_info *psi)
663{ 663{
664 efi_guid_t vendor = LINUX_EFI_CRASH_GUID; 664 efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
665 struct efivars *efivars = psi->data; 665 struct efivars *efivars = psi->data;
666 char name[DUMP_NAME_LEN]; 666 char name[DUMP_NAME_LEN];
667 int i; 667 int i;
668 int cnt;
668 unsigned int part, size; 669 unsigned int part, size;
669 unsigned long time; 670 unsigned long time;
670 671
@@ -674,8 +675,10 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
674 for (i = 0; i < DUMP_NAME_LEN; i++) { 675 for (i = 0; i < DUMP_NAME_LEN; i++) {
675 name[i] = efivars->walk_entry->var.VariableName[i]; 676 name[i] = efivars->walk_entry->var.VariableName[i];
676 } 677 }
677 if (sscanf(name, "dump-type%u-%u-%lu", type, &part, &time) == 3) { 678 if (sscanf(name, "dump-type%u-%u-%d-%lu",
679 type, &part, &cnt, &time) == 4) {
678 *id = part; 680 *id = part;
681 *count = cnt;
679 timespec->tv_sec = time; 682 timespec->tv_sec = time;
680 timespec->tv_nsec = 0; 683 timespec->tv_nsec = 0;
681 get_var_data_locked(efivars, &efivars->walk_entry->var); 684 get_var_data_locked(efivars, &efivars->walk_entry->var);
@@ -698,7 +701,8 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
698 701
699static int efi_pstore_write(enum pstore_type_id type, 702static int efi_pstore_write(enum pstore_type_id type,
700 enum kmsg_dump_reason reason, u64 *id, 703 enum kmsg_dump_reason reason, u64 *id,
701 unsigned int part, size_t size, struct pstore_info *psi) 704 unsigned int part, int count, size_t size,
705 struct pstore_info *psi)
702{ 706{
703 char name[DUMP_NAME_LEN]; 707 char name[DUMP_NAME_LEN];
704 efi_char16_t efi_name[DUMP_NAME_LEN]; 708 efi_char16_t efi_name[DUMP_NAME_LEN];
@@ -725,7 +729,7 @@ static int efi_pstore_write(enum pstore_type_id type,
725 return -ENOSPC; 729 return -ENOSPC;
726 } 730 }
727 731
728 sprintf(name, "dump-type%u-%u-%lu", type, part, 732 sprintf(name, "dump-type%u-%u-%d-%lu", type, part, count,
729 get_seconds()); 733 get_seconds());
730 734
731 for (i = 0; i < DUMP_NAME_LEN; i++) 735 for (i = 0; i < DUMP_NAME_LEN; i++)
@@ -746,7 +750,7 @@ static int efi_pstore_write(enum pstore_type_id type,
746 return ret; 750 return ret;
747}; 751};
748 752
749static int efi_pstore_erase(enum pstore_type_id type, u64 id, 753static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
750 struct timespec time, struct pstore_info *psi) 754 struct timespec time, struct pstore_info *psi)
751{ 755{
752 char name[DUMP_NAME_LEN]; 756 char name[DUMP_NAME_LEN];
@@ -756,7 +760,7 @@ static int efi_pstore_erase(enum pstore_type_id type, u64 id,
756 struct efivar_entry *entry, *found = NULL; 760 struct efivar_entry *entry, *found = NULL;
757 int i; 761 int i;
758 762
759 sprintf(name, "dump-type%u-%u-%lu", type, (unsigned int)id, 763 sprintf(name, "dump-type%u-%u-%d-%lu", type, (unsigned int)id, count,
760 time.tv_sec); 764 time.tv_sec);
761 765
762 spin_lock(&efivars->lock); 766 spin_lock(&efivars->lock);
@@ -807,7 +811,7 @@ static int efi_pstore_close(struct pstore_info *psi)
807 return 0; 811 return 0;
808} 812}
809 813
810static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, 814static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type, int *count,
811 struct timespec *timespec, 815 struct timespec *timespec,
812 char **buf, struct pstore_info *psi) 816 char **buf, struct pstore_info *psi)
813{ 817{
@@ -816,12 +820,13 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
816 820
817static int efi_pstore_write(enum pstore_type_id type, 821static int efi_pstore_write(enum pstore_type_id type,
818 enum kmsg_dump_reason reason, u64 *id, 822 enum kmsg_dump_reason reason, u64 *id,
819 unsigned int part, size_t size, struct pstore_info *psi) 823 unsigned int part, int count, size_t size,
824 struct pstore_info *psi)
820{ 825{
821 return 0; 826 return 0;
822} 827}
823 828
824static int efi_pstore_erase(enum pstore_type_id type, u64 id, 829static int efi_pstore_erase(enum pstore_type_id type, u64 id, int count,
825 struct timespec time, struct pstore_info *psi) 830 struct timespec time, struct pstore_info *psi)
826{ 831{
827 return 0; 832 return 0;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 4300af654710..ed1d8c7212da 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -49,6 +49,7 @@ struct pstore_private {
49 struct pstore_info *psi; 49 struct pstore_info *psi;
50 enum pstore_type_id type; 50