Skip to contentSkip to conversation

ACPI, APEI patches for 2.6.37

PATCH In review Huang Ying 3 participants 18 messages Oct 20, 2010 – Oct 25, 2010

Subsystems (11)
lore
Share & tools
lore

Huang Ying

author
#0 lore raw

cover ACPI, APEI patches for 2.6.37

[PATCH 1/9] ACPI, APEI, Add ERST record ID cache
[PATCH 2/9] Add lock-less version of bitmap_set/clear
[PATCH 3/9] lock-less NULL terminated single list implementation
[PATCH 4/9] lock-less general memory allocator
[PATCH 5/9] Hardware error device core
[PATCH 6/9] Hardware error record persistent support
[PATCH 7/9] ACPI, APEI, Use ERST for hardware error persisting before panic [PATCH 8/9] ACPI, APEI, Report GHES error record with hardware error device core [PATCH 9/9] ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support

author
#1 lore raw

PATCH 1/9 ACPI, APEI, Add ERST record ID cache

APEI ERST firmware interface and implementation has no multiple users in mind. For example, there is four records in storage with ID: 1, 2, 3 and 4, if two ERST readers enumerate the records via GET_NEXT_RECORD_ID as follow,

reader 1 reader 2
1

			2
3
			4
-1
			-1

where -1 signals there is no more record ID.

Reader 1 has no chance to check record 2 and 4, while reader 2 has no chance to check record 1 and 3. And any other GET_NEXT_RECORD_ID will return -1, that is, other readers will has no chance to check any record even they are not cleared by anyone.

This makes raw GET_NEXT_RECORD_ID not suitable for usage of multiple users.

To solve the issue, an in memory ERST record ID cache is designed and implemented. When enumerating record ID, the ID returned by GET_NEXT_RECORD_ID is added into cache in addition to be returned to caller. So other readers can check the cache to get all record ID available.

---
 arch/x86/kernel/cpu/mcheck/mce-apei.c |   40 +++--
 drivers/acpi/apei/erst-dbg.c          |   24 ++-
 drivers/acpi/apei/erst.c              |  241 +++++++++++++++++++++++++++-------
 include/acpi/apei.h                   |    5 
 4 files changed, 246 insertions(+), 64 deletions(-)
arch/x86/kernel/cpu/mcheck/mce-apei.c +25 -15
@@ -106,24 +106,34 @@ int apei_write_mce(struct mce *m)
 ssize_t apei_read_mce(struct mce *m, u64 *record_id)
 {
 	struct cper_mce_record rcd;
-	ssize_t len;
-
-	len = erst_read_next(&rcd.hdr, sizeof(rcd));
-	if (len <= 0)
-		return len;
-	/* Can not skip other records in storage via ERST unless clear them */
-	else if (len != sizeof(rcd) ||
-		 uuid_le_cmp(rcd.hdr.creator_id, CPER_CREATOR_MCE)) {
-		if (printk_ratelimit())
-			pr_warning(
-			"MCE-APEI: Can not skip the unknown record in ERST");
-		return -EIO;
-	}
+	int rc, pos;
 
+	rc = erst_get_record_id_begin(&pos);
+	if (rc)
+		return rc;
+retry:
+	rc = erst_get_record_id_next(&pos, record_id);
+	if (rc)
+		goto out;
+	/* no more record */
+	if (*record_id == APEI_ERST_INVALID_RECORD_ID)
+		goto out;
+	rc = erst_read(*record_id, &rcd.hdr, sizeof(rcd));
+	/* someone else has cleared the record, try next one */
+	if (rc == -ENOENT)
+		goto retry;
+	else if (rc < 0)
+		goto out;
+	/* try to skip other type records in storage */
+	else if (rc != sizeof(rcd) ||
+		 uuid_le_cmp(rcd.hdr.creator_id, CPER_CREATOR_MCE))
+		goto retry;
 	memcpy(m, &rcd.mce, sizeof(*m));
-	*record_id = rcd.hdr.record_id;
+	rc = sizeof(*m);
+out:
+	erst_get_record_id_end();
 
-	return sizeof(*m);
+	return rc;
 }
 
 /* Check whether there is record in ERST */
drivers/acpi/apei/erst-dbg.c +21 -3
@@ -43,12 +43,27 @@ static DEFINE_MUTEX(erst_dbg_mutex);
 
 static int erst_dbg_open(struct inode *inode, struct file *file)
 {
+	int rc, *pos;
+
 	if (erst_disable)
 		return -ENODEV;
 
+	pos = (int *)&file->private_data;
+
+	rc = erst_get_record_id_begin(pos);
+	if (rc)
+		return rc;
+
 	return nonseekable_open(inode, file);
 }
 
+static int erst_dbg_release(struct inode *inode, struct file *file)
+{
+	erst_get_record_id_end();
+
+	return 0;
+}
+
 static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 {
 	int rc;
@@ -79,18 +94,20 @@ static long erst_dbg_ioctl(struct file *
 static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf,
 			     size_t usize, loff_t *off)
 {
-	int rc;
+	int rc, *pos;
 	ssize_t len = 0;
 	u64 id;
 
-	if (*off != 0)
+	if (*off)
 		return -EINVAL;
 
 	if (mutex_lock_interruptible(&erst_dbg_mutex) != 0)
 		return -EINTR;
 
+	pos = (int *)&filp->private_data;
+
 retry_next:
-	rc = erst_get_next_record_id(&id);
+	rc = erst_get_record_id_next(pos, &id);
 	if (rc)
 		goto out;
 	/* no more record */
@@ -181,6 +198,7 @@ out:
 static const struct file_operations erst_dbg_ops = {
 	.owner		= THIS_MODULE,
 	.open		= erst_dbg_open,
+	.release	= erst_dbg_release,
 	.read		= erst_dbg_read,
 	.write		= erst_dbg_write,
 	.unlocked_ioctl	= erst_dbg_ioctl,
drivers/acpi/apei/erst.c +197 -44

285 lines not on this page · raw message

include/acpi/apei.h +3 -2
@@ -24,10 +24,11 @@ int apei_hest_parse(apei_hest_func_t fun
 
 int erst_write(const struct cper_record_header *record);
 ssize_t erst_get_record_count(void);
-int erst_get_next_record_id(u64 *record_id);
+int erst_get_record_id_begin(int *pos);
+int erst_get_record_id_next(int *pos, u64 *record_id);
+void erst_get_record_id_end(void);
 ssize_t erst_read(u64 record_id, struct cper_record_header *record,
 		  size_t buflen);
-ssize_t erst_read_next(struct cper_record_header *record, size_t buflen);
 int erst_clear(u64 record_id);
 
 #endif
Reviewed-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] ACPI, APEI, Add ERST record ID cache

Quoted 14 lines · Huang Ying

1

			2
3
			4
-1
			-1

where -1 signals there is no more record ID.

Reader 1 has no chance to check record 2 and 4, while reader 2 has no chance to check record 1 and 3. And any other GET_NEXT_RECORD_ID will return -1, that is, other readers will has no chance to check any record even they are not cleared by anyone.

Quoted 8 lines

This makes raw GET_NEXT_RECORD_ID not suitable for usage of multiple users.

To solve the issue, an in memory ERST record ID cache is designed and implemented. When enumerating record ID, the ID returned by GET_NEXT_RECORD_ID is added into cache in addition to be returned to caller. So other readers can check the cache to get all record ID available.

Generally it looks ok, just a minor cleanup nit below.

Quoted 30 lines
drivers/acpi/apei/erst.c +30 -0
+static int erst_record_id_cache_add_one(void)
+{
+	u64 id, prev_id, first_id;
+	int i, rc;
+	struct erst_record_id_entry *entries;
+	unsigned long flags;
+
+	id = prev_id = first_id = APEI_ERST_INVALID_RECORD_ID;
+retry:
+	spin_lock_irqsave(&erst_lock, flags);
+	rc = __erst_get_next_record_id(&id);
+	spin_unlock_irqrestore(&erst_lock, flags);
+	if (rc == -ENOENT)
+		return 0;
+	if (rc)
+		return rc;
+	if (id == APEI_ERST_INVALID_RECORD_ID)
+		return 0;
+	/* can not skip current ID, or look back to first ID */
+	if (id == prev_id || id == first_id)
+		return 0;
+	if (first_id == APEI_ERST_INVALID_RECORD_ID)
+		first_id = id;
+	prev_id = id;
+
+	entries = erst_record_id_cache.entries;
+	for (i = 0; i < erst_record_id_cache.len; i++) {
+		if (!entries[i].cleared && entries[i].id == id)
+			break;
+	}

drivers/acpi/apei/erst.c static int __erst_get_next_record_id(u64 · line 526

Quoted 10 lines
drivers/acpi/apei/erst.c +10 -0
+	/* record id already in cache, try next */
+	if (i < erst_record_id_cache.len)
+		goto retry;
+	if (erst_record_id_cache.len >= erst_record_id_cache.size) {
+		int new_size, alloc_size;
+		struct erst_record_id_entry *new_entries;
+
+		new_size = erst_record_id_cache.size * 2;
+		new_size = max_t(int, new_size, ERST_RECORD_ID_CACHE_SIZE_MIN);
+		new_size = min_t(int, new_size, ERST_RECORD_ID_CACHE_SIZE_MAX);

This is clamp_t()

drivers/acpi/apei/erst.c static int __erst_get_next_record_id(u64 · line 537

Quoted 11 lines
drivers/acpi/apei/erst.c +11 -0
+		if (new_size <= erst_record_id_cache.size) {
+			if (printk_ratelimit())
+				pr_warning(FW_WARN ERST_PFX
+					   "too many record ID!\n");
+			return 0;
+		}
+		alloc_size = new_size * sizeof(struct erst_record_id_entry);
+		if (alloc_size < PAGE_SIZE)
+			new_entries = kmalloc(alloc_size, GFP_KERNEL);
+		else
+			new_entries = vmalloc(alloc_size);

This is essentially kremalloc with vmalloc. Since this a common pattern it would be nicer to put a generic helper for this somewhere.

-Andi

drivers/acpi/apei/erst.c static int __erst_get_next_record_id(u64 · line 545

Quoted 8 lines
drivers/acpi/apei/erst.c +8 -0
+		if (!new_entries)
+			return -ENOMEM;
+		memcpy(new_entries, entries,
+		       erst_record_id_cache.len * sizeof(entries[0]));
+		if (erst_record_id_cache.size < PAGE_SIZE)
+			kfree(entries);
+		else
+			vfree(entries);

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
author
#3 lore raw

Re: [PATCH 1/9] ACPI, APEI, Add ERST record ID cache

Hi, Andi,

Quoted 24 lines · Andi Kleen
Quoted 14 lines · Huang Ying

1

			2
3
			4
-1
			-1

where -1 signals there is no more record ID.

Reader 1 has no chance to check record 2 and 4, while reader 2 has no chance to check record 1 and 3. And any other GET_NEXT_RECORD_ID will return -1, that is, other readers will has no chance to check any record even they are not cleared by anyone.

Quoted 8 lines

This makes raw GET_NEXT_RECORD_ID not suitable for usage of multiple users.

To solve the issue, an in memory ERST record ID cache is designed and implemented. When enumerating record ID, the ID returned by GET_NEXT_RECORD_ID is added into cache in addition to be returned to caller. So other readers can check the cache to get all record ID available.

Quoted 3 lines

Generally it looks ok, just a minor cleanup nit below.

Thanks.

Quoted 34 lines
Quoted 34 lines
drivers/acpi/apei/erst.c +34 -0
+static int erst_record_id_cache_add_one(void)
+{
+	u64 id, prev_id, first_id;
+	int i, rc;
+	struct erst_record_id_entry *entries;
+	unsigned long flags;
+
+	id = prev_id = first_id = APEI_ERST_INVALID_RECORD_ID;
+retry:
+	spin_lock_irqsave(&erst_lock, flags);
+	rc = __erst_get_next_record_id(&id);
+	spin_unlock_irqrestore(&erst_lock, flags);
+	if (rc == -ENOENT)
+		return 0;
+	if (rc)
+		return rc;
+	if (id == APEI_ERST_INVALID_RECORD_ID)
+		return 0;
+	/* can not skip current ID, or look back to first ID */
+	if (id == prev_id || id == first_id)
+		return 0;
+	if (first_id == APEI_ERST_INVALID_RECORD_ID)
+		first_id = id;
+	prev_id = id;
+
+	entries = erst_record_id_cache.entries;
+	for (i = 0; i < erst_record_id_cache.len; i++) {
+		if (!entries[i].cleared && entries[i].id == id)
+			break;
+	}
+	/* record id already in cache, try next */
+	if (i < erst_record_id_cache.len)
+		goto retry;
+	if (erst_record_id_cache.len >= erst_record_id_cache.size) {
Quoted 8 lines

drivers/acpi/apei/erst.c static int __erst_get_next_record_id(u64 · line 526

Quoted 6 lines
drivers/acpi/apei/erst.c +6 -0
+		int new_size, alloc_size;
+		struct erst_record_id_entry *new_entries;
+
+		new_size = erst_record_id_cache.size * 2;
+		new_size = max_t(int, new_size, ERST_RECORD_ID_CACHE_SIZE_MIN);
+		new_size = min_t(int, new_size, ERST_RECORD_ID_CACHE_SIZE_MAX);

This is clamp_t()

Yes. Will change it.

Quoted 6 lines
Quoted 6 lines
drivers/acpi/apei/erst.c +6 -0
+		if (new_size <= erst_record_id_cache.size) {
+			if (printk_ratelimit())
+				pr_warning(FW_WARN ERST_PFX
+					   "too many record ID!\n");
+			return 0;
+		}
Quoted 8 lines

drivers/acpi/apei/erst.c static int __erst_get_next_record_id(u64 · line 537

Quoted 5 lines
drivers/acpi/apei/erst.c +5 -0
+		alloc_size = new_size * sizeof(struct erst_record_id_entry);
+		if (alloc_size < PAGE_SIZE)
+			new_entries = kmalloc(alloc_size, GFP_KERNEL);
+		else
+			new_entries = vmalloc(alloc_size);

This is essentially kremalloc with vmalloc. Since this a common pattern it would be nicer to put a generic helper for this somewhere.

Yes. But will try to do that in another patch.

Best Regards,
Huang Ying

author
#4 lore raw

PATCH 2/9 Add lock-less version of bitmap_set/clear

In reply to Huang Ying

cmpxchg is used to change the bitmap instead of the ordinary unsigned long assigning. Several users can set/clear the same bitmap simultaneously without lock. If there is conflict between two user, (set/clear same bit), one will return remain bits immediately.

This can be used to implement the lock-less resource allocator.

---
 include/linux/bitmap.h |    4 +
 lib/bitmap.c           |  101 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+)
include/linux/bitmap.h +4 -0
@@ -44,6 +44,8 @@
  * bitmap_weight(src, nbits)			Hamming Weight: number set bits
  * bitmap_set(dst, pos, nbits)			Set specified bit area
  * bitmap_clear(dst, pos, nbits)		Clear specified bit area
+ * bitmap_set_ll(dst, pos, nbits)		Set specified bit area, lock-less version
+ * bitmap_clear_ll(dst, pos, nbits)		Clear specified bit area, lock-less version
  * bitmap_find_next_zero_area(buf, len, pos, n, mask)	Find bit free area
  * bitmap_shift_right(dst, src, n, nbits)	*dst = *src >> n
  * bitmap_shift_left(dst, src, n, nbits)	*dst = *src << n
@@ -113,6 +115,8 @@ extern int __bitmap_weight(const unsigne
 
 extern void bitmap_set(unsigned long *map, int i, int len);
 extern void bitmap_clear(unsigned long *map, int start, int nr);
+extern int bitmap_set_ll(unsigned long *map, int i, int len);
+extern int bitmap_clear_ll(unsigned long *map, int start, int nr);
 extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
 					 unsigned long size,
 					 unsigned long start,
lib/bitmap.c +101 -0

107 lines not on this page · raw message

author
#5 lore raw

PATCH 3/9 lock-less NULL terminated single list implementation

In reply to Huang Ying

Cmpxchg is used to implement adding new entry to list, deleting first entry of the list and some other operations.

Because this is a single list, so the tail can not be accessed in O(1).

This can be used in NMI handler.

---
 include/linux/llist.h |   64 +++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig           |    3 +
 lib/Makefile          |    2 +
 lib/llist.c           |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 147 insertions(+)
 create mode 100644 include/linux/llist.h
 create mode 100644 lib/llist.c
include/linux/llist.h new file +64 -0
@@ -0,0 +1,64 @@
+#ifndef LLIST_H
+#define LLIST_H
+
+/* lock-less NULL terminated single linked list */
+struct llist_head {
+	struct llist_head *next;
+};
+
+#define LLIST_HEAD_INIT(name) { NULL }
+
+#define LLIST_HEAD(name)				\
+	struct llist_head name = LLIST_HEAD_INIT(name)
+
+/**
+ * init_llist_head - initialize lock-less list head
+ * @head:	the head for your lock-less list
+ */
+static inline void init_llist_head(struct llist_head *list)
+{
+	list->next = NULL;
+}
+
+/**
+ * llist_entry - get the struct of this entry
+ * @ptr:	the &struct llist_head pointer.
+ * @type:	the type of the struct this is embedded in.
+ * @member:	the name of the llist_head within the struct.
+ */
+#define llist_entry(ptr, type, member)		\
+	container_of(ptr, type, member)
+
+/**
+ * llist_for_each - iterate over a lock-less list
+ * @pos:	the &struct llist_head to use as a loop cursor
+ * @head:	the head for your lock-less list
+ */
+#define llist_for_each(pos, head)					\
+	for (pos = (head)->next; pos; pos = pos->next)
+
+/**
+ * llist_for_each_entry - iterate over lock-less list of given type
+ * @pos:	the type * to use as a loop cursor.
+ * @head:	the head for your lock-less list.
+ * @member:	the name of the llist_head with the struct.
+ */
+#define llist_for_each_entry(pos, head, member)				\
+	for (pos = llist_entry((head)->next, typeof(*pos), member);	\
+	     &pos->member != NULL;					\
+	     pos = llist_entry(pos->member.next, typeof(*pos), member))
+
+/**
+ * llist_empty - tests whether a lock-less list is empty
+ * @head:	the list to test
+ */
+static inline int llist_empty(const struct llist_head *head)
+{
+	return head->next == NULL;
+}
+
+void llist_add(struct llist_head *new, struct llist_head *head);
+struct llist_head *llist_del_first(struct llist_head *head);
+void llist_move_all(struct llist_head *list, struct llist_head *head);
+
+#endif /* LLIST_H */
lib/Kconfig +3 -0
@@ -210,4 +210,7 @@ config GENERIC_ATOMIC64
 config LRU_CACHE
 	tristate
 
+config LLIST
+	bool
+
 endmenu
lib/Makefile +2 -0
@@ -106,6 +106,8 @@ obj-$(CONFIG_GENERIC_ATOMIC64) += atomic
 
 obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
 
+obj-$(CONFIG_LLIST) += llist.o
+
 hostprogs-y	:= gen_crc32table
 clean-files	:= crc32table.h
 
lib/llist.c new file +78 -0

78 lines not on this page · raw message

author
#6 lore raw

PATCH 4/9 lock-less general memory allocator

In reply to Huang Ying

Lock-less memory allocator, can be used to allocate/free memory in IRQ/NMI handler. This is useful for hardware error handling, which needs to collect hardware error information in IRQ/NMI handler.

The memory pages for lock-less memory allocator are pre-allocated during initialization. Bitmap is used to record allocated/free memory blocks. To support lock-less allocate/free operation, lock-less bitmap set/clear operations are used.

The difference between this allocator and the gen_pool implementation in lib/genalloc.c is that memory can be allocated/freed by multiple users simultaneously without lock.

---
 include/linux/llalloc.h |   27 +++++
 lib/Kconfig             |    3 
 lib/Makefile            |    1 
 lib/llalloc.c           |  259 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 290 insertions(+)
 create mode 100644 include/linux/llalloc.h
 create mode 100644 lib/llalloc.c
include/linux/llalloc.h new file +27 -0
@@ -0,0 +1,27 @@
+#ifndef LLALLOC_H
+#define LLALLOC_H
+
+struct ll_pool;
+
+struct ll_pool_chunk {
+	atomic_t avail;
+	void *data;
+	struct ll_pool *pool;
+	unsigned long bitmap[0];
+};
+
+struct ll_pool {
+	int min_alloc_order;
+	int chunk_order;
+	int chunk_num;
+	struct ll_pool_chunk *chunks[0];
+};
+
+struct ll_pool *ll_pool_create(int min_alloc_order, int chunk_order,
+			       int chunk_num, int nid);
+void ll_pool_destroy(struct ll_pool *pool);
+void *ll_pool_alloc(struct ll_pool *pool, size_t len);
+void ll_pool_free(const void *p, size_t len);
+size_t ll_pool_avail(struct ll_pool *pool);
+size_t ll_pool_size(struct ll_pool *pool);
+#endif /* LLALLOC_H */
lib/Kconfig +3 -0
@@ -213,4 +213,7 @@ config LRU_CACHE
 config LLIST
 	bool
 
+config LLALLOC
+	bool
+
 endmenu
lib/Makefile +1 -0
@@ -107,6 +107,7 @@ obj-$(CONFIG_GENERIC_ATOMIC64) += atomic
 obj-$(CONFIG_ATOMIC64_SELFTEST) += atomic64_test.o
 
 obj-$(CONFIG_LLIST) += llist.o
+obj-$(CONFIG_LLALLOC) += llalloc.o
 
 hostprogs-y	:= gen_crc32table
 clean-files	:= crc32table.h
lib/llalloc.c new file +259 -0

259 lines not on this page · raw message

author
#7 lore raw

PATCH 5/9 Hardware error device core

In reply to Huang Ying

Hardware error device is a kind of device which can report hardware errors. The examples of hardware error device include APEI GHES, PCIe AER, etc.

Hardware error device core in this patch provides common services for various hardware error devices.

Hardware error record data structure is defined to accommodate various hardware error information. Several error sections can be incorporated into one error record to accumulate information for multiple hardware components related to one error. For example, for an error on a device on the secondary side of a PCIe bridge, it is useful to record error information from PCIe bridge and from the PCIe device.

To manage various hardware error devices, struct herr_dev is defined as a "sub-class" of "struct device". It should be created as the child device of the "real" hardware error device such as APEI GHES to represent the hardware error reporting aspect of the device. The class of struct herr_dev instances is "error", so that all hardware error devices can be enumerated via listing all links in /sys/class/error.

The most important functionality that this patch provided is hardware error reporting support. Details is as follow.

A lock-less hardware error record allocator is provided. So for hardware error that can be ignored (such as corrected errors), it is not needed to pre-allocate the error record or allocate the error record on stack.

After filling in all necessary fields in hardware error record, the error reporting is quite straightforward, just calling herr_record_report, parameters are the error record itself and the corresponding struct herr_dev. All other special processing including user space interface is handled by hardware error device core, this make it much easier to write a hardware error handler.

Because the possibility for two or more hardware parts to go error simultaneously is quite low, it is not necessary to create one device file for each hardware error device. One device file (/dev/error) which mixed error records from all hardware error devices is created as the user space interface. Then, the user space hardware error daemon can do some further processing (including logging into disk), based on the hardware error records read from the device file.

Although the in-kernel and user space interface of hardware error reporting is quite simple, there is some special consideration in hardware error reporting implementation.

Hardware errors may burst, for example, same hardware errors may be reported at high rate within a short interval, this will use up all pre-allocated memory for error reporting, so that other hardware errors come from same or different hardware device can not be logged. To deal with this issue, a burst control algorithm is implemented. The logging rate for errors come from one hardware error device is throttled based on the available pre-allocated memory for error reporting. In this way we can log as many kinds of errors as possible comes from as many error devices as possible.

This patch is designed by Andi Kleen and Huang Ying.

---
 drivers/char/Kconfig            |    2 
 drivers/char/Makefile           |    2 
 drivers/char/herror/Kconfig     |    4 
 drivers/char/herror/Makefile    |    1 
 drivers/char/herror/herr-core.c |  599 ++++++++++++++++++++++++++++++++++++++++
 include/linux/Kbuild            |    1 
 include/linux/herror.h          |   69 ++++
 include/linux/herror_record.h   |  100 ++++++
 8 files changed, 778 insertions(+)
 create mode 100644 drivers/char/herror/Kconfig
 create mode 100644 drivers/char/herror/Makefile
 create mode 100644 drivers/char/herror/herr-core.c
 create mode 100644 include/linux/herror.h
 create mode 100644 include/linux/herror_record.h
drivers/char/Kconfig +2 -0
@@ -1129,5 +1129,7 @@ config RAMOOPS
 	  This enables panic and oops messages to be logged to a circular
 	  buffer in RAM where it can be read back at some later point.
 
+source "drivers/char/herror/Kconfig"
+
 endmenu
 
drivers/char/Makefile +2 -0
@@ -115,6 +115,8 @@ obj-$(CONFIG_RAMOOPS)		+= ramoops.o
 obj-$(CONFIG_JS_RTC)		+= js-rtc.o
 js-rtc-y = rtc.o
 
+obj-$(CONFIG_HERR_DEV_CORE)	+= herror/
+
 # Files generated that shall be removed upon make clean
 clean-files := consolemap_deftbl.c defkeymap.c
 
drivers/char/herror/Kconfig new file +4 -0
@@ -0,0 +1,4 @@
+config HERR_DEV_CORE
+	bool
+	select LLIST
+	select LLALLOC
drivers/char/herror/Makefile new file +1 -0
@@ -0,0 +1 @@
+obj-y				+= herr-core.o
drivers/char/herror/herr-core.c new file +599 -0

599 lines not on this page · raw message

include/linux/Kbuild +1 -0
@@ -140,6 +140,7 @@ header-y += gigaset_dev.h
 header-y += hdlc.h
 header-y += hdlcdrv.h
 header-y += hdreg.h
+header-y += herror_record.h
 header-y += hid.h
 header-y += hiddev.h
 header-y += hidraw.h
include/linux/herror.h new file +69 -0

69 lines not on this page · raw message

include/linux/herror_record.h new file +100 -0

100 lines not on this page · raw message

author
#8 lore raw

PATCH 6/9 Hardware error record persistent support

In reply to Huang Ying

Normally, corrected hardware error records will go through the kernel processing and be logged to disk or network finally. But for uncorrected errors, system may go panic directly for better error containment, disk or network is not usable in this half-working system. To avoid losing these valuable hardware error records, the error records are saved into some kind of simple persistent storage such as flash before panic, so that they can be read out after system reboot successfully.

Different kind of simple persistent storage implementation mechanisms are provided on different platforms, so an abstract interface for persistent storage is defined. Different implementations of the interface can be registered.

This patch is designed by Andi Kleen and Huang Ying.

---
 drivers/char/herror/Makefile        |    2 
 drivers/char/herror/herr-core.c     |   39 +++++++-
 drivers/char/herror/herr-internal.h |   12 ++
 drivers/char/herror/herr-persist.c  |  174 ++++++++++++++++++++++++++++++++++++
 include/linux/Kbuild                |    1 
 include/linux/herror.h              |   48 +++++++++
 6 files changed, 271 insertions(+), 5 deletions(-)
 create mode 100644 drivers/char/herror/herr-internal.h
 create mode 100644 drivers/char/herror/herr-persist.c
drivers/char/herror/Makefile +1 -1
@@ -1 +1 @@
-obj-y				+= herr-core.o
+obj-y				+= herr-core.o herr-persist.o
drivers/char/herror/herr-core.c +36 -3
@@ -43,9 +43,9 @@
 #include <linux/llalloc.h>
 #include <linux/herror.h>
 
-#define HERR_NOTIFY_BIT			0
+#include "herr-internal.h"
 
-static unsigned long herr_flags;
+unsigned long herr_flags;
 
 /*
  * Record list management and error reporting
@@ -524,6 +524,7 @@ static ssize_t herr_mix_read(struct file
 {
 	int rc;
 	static DEFINE_MUTEX(read_mutex);
+	u64 record_id;
 
 	if (*off != 0)
 		return -EINVAL;
@@ -531,7 +532,14 @@ static ssize_t herr_mix_read(struct file
 	rc = mutex_lock_interruptible(&read_mutex);
 	if (rc)
 		return rc;
+	rc = herr_persist_peek_user(&record_id, ubuf, usize);
+	if (rc > 0) {
+		herr_persist_clear(record_id);
+		goto out;
+	}
+
 	rc = herr_rcd_lists_read(ubuf, usize, &read_mutex);
+out:
 	mutex_unlock(&read_mutex);
 
 	return rc;
@@ -540,15 +548,40 @@ static ssize_t herr_mix_read(struct file
 static unsigned int herr_mix_poll(struct file *file, poll_table *wait)
 {
 	poll_wait(file, &herr_mix_wait, wait);
-	if (!herr_rcd_lists_is_empty())
+	if (!herr_rcd_lists_is_empty() || !herr_persist_read_done())
 		return POLLIN | POLLRDNORM;
 	return 0;
 }
 
+static long herr_mix_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
+{
+	void __user *p = (void __user *)arg;
+	int rc;
+	u64 record_id;
+	struct herr_persist_buffer buf;
+
+	switch (cmd) {
+	case HERR_PERSIST_PEEK:
+		rc = copy_from_user(&buf, p, sizeof(buf));
+		if (rc)
+			return -EFAULT;
+		return herr_persist_peek_user(&record_id, buf.buf,
+					      buf.buf_size);
+	case HERR_PERSIST_CLEAR:
+		rc = copy_from_user(&record_id, p, sizeof(record_id));
+		if (rc)
+			return -EFAULT;
+		return herr_persist_clear(record_id);
+	default:
+		return -ENOTTY;
+	}
+}
+
 static const struct file_operations herr_mix_dev_fops = {
 	.owner		= THIS_MODULE,
 	.read		= herr_mix_read,
 	.poll		= herr_mix_poll,
+	.unlocked_ioctl	= herr_mix_ioctl,
 };
 
 static int __init herr_mix_dev_init(void)
drivers/char/herror/herr-internal.h new file +12 -0
@@ -0,0 +1,12 @@
+#ifndef HERR_INTERNAL_H
+#define HERR_INTERNAL_H
+
+#define HERR_NOTIFY_BIT			0
+
+extern unsigned long herr_flags;
+
+int herr_persist_read_done(void);
+ssize_t herr_persist_peek_user(u64 *record_id, char __user *ercd,
+			       size_t bufsiz);
+int herr_persist_clear(u64 record_id);
+#endif /* HERR_INTERNAL_H */
drivers/char/herror/herr-persist.c new file +174 -0

174 lines not on this page · raw message

include/linux/Kbuild +1 -0
@@ -141,6 +141,7 @@ header-y += hdlc.h
 header-y += hdlcdrv.h
 header-y += hdreg.h
 header-y += herror_record.h
+header-y += herror.h
 header-y += hid.h
 header-y += hiddev.h
 header-y += hidraw.h
include/linux/herror.h +47 -1

61 lines not on this page · raw message

author
#9 lore raw

PATCH 7/9 ACPI, APEI, Use ERST for hardware error persisting before panic

In reply to Huang Ying

Corrected/Recoverable hardware errors can usually be saved into disk and/or sent to network for logging. But if uncorrected/fatal hardware errors occur, system may not reliable enough for desk and/or network accessing and needs to go panic as soon as possible for error containment. In this situation, ERST can be used to save the valuable error records into some persistent storage such as flash.

This patch implements herr_persist interface using ERST. So that hardware error device core can use ERST to save hardware error record before panic.

---
 drivers/acpi/apei/Kconfig |    1 
 drivers/acpi/apei/cper.c  |   19 +++++
 drivers/acpi/apei/erst.c  |  169 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/cper.h      |    1 
 4 files changed, 190 insertions(+)
drivers/acpi/apei/cper.c +19 -0
@@ -29,6 +29,25 @@
 #include <linux/time.h>
 #include <linux/cper.h>
 #include <linux/acpi.h>
+#include <linux/herror_record.h>
+
+int herr_severity_to_cper(int herr_severity)
+{
+	switch (herr_severity) {
+	case HERR_SEV_NONE:
+		return CPER_SEV_INFORMATIONAL;
+	case HERR_SEV_CORRECTED:
+		return CPER_SEV_CORRECTED;
+	case HERR_SEV_RECOVERABLE:
+		return CPER_SEV_RECOVERABLE;
+	case HERR_SEV_FATAL:
+		return CPER_SEV_FATAL;
+	default:
+		BUG();
+		return CPER_SEV_FATAL;
+	}
+}
+EXPORT_SYMBOL_GPL(herr_severity_to_cper);
 
 /*
  * CPER record ID need to be unique even after reboot, because record
drivers/acpi/apei/erst.c +169 -0

204 lines not on this page · raw message

include/linux/cper.h +1 -0
@@ -309,6 +309,7 @@ struct cper_sec_mem_err {
 /* Reset to default packing */
 #pragma pack()
 
+int herr_severity_to_cper(int herr_severity);
 u64 cper_next_record_id(void);
 
 #endif
drivers/acpi/apei/Kconfig +1 -0
@@ -1,6 +1,7 @@
 config ACPI_APEI
 	bool "ACPI Platform Error Interface (APEI)"
 	depends on X86
+	select HERR_DEV_CORE
 	help
 	  APEI allows to report errors (for example from the chipset)
 	  to the operating system. This improves NMI handling
author
#10 lore raw

PATCH 8/9 ACPI, APEI, Report GHES error record with hardware error device core

In reply to Huang Ying

One hardware error device (struct herr_dev) is created for each GHES in GHES platform device "probe" function. Then when GHES hardware error handler is notified by firmware, the hardware error records will be reported on the struct herr_dev.

In the previous GHES support, only corrected memory error can be reported to user space via /dev/mcelog, now all kinds of hardware errors notified with SCI can be reported.

---
 drivers/acpi/apei/cper.c |   18 +++++++
 drivers/acpi/apei/ghes.c |  119 +++++++++++++++++++++++++++++++----------------
 include/linux/cper.h     |    2 
 3 files changed, 99 insertions(+), 40 deletions(-)
drivers/acpi/apei/cper.c +18 -0
@@ -49,6 +49,24 @@ int herr_severity_to_cper(int herr_sever
 }
 EXPORT_SYMBOL_GPL(herr_severity_to_cper);
 
+int cper_severity_to_herr(int cper_severity)
+{
+	switch (cper_severity) {
+	case CPER_SEV_INFORMATIONAL:
+		return HERR_SEV_NONE;
+	case CPER_SEV_CORRECTED:
+		return HERR_SEV_CORRECTED;
+	case CPER_SEV_RECOVERABLE:
+		return HERR_SEV_RECOVERABLE;
+	case CPER_SEV_FATAL:
+		return HERR_SEV_FATAL;
+	default:
+		/* Unknown, default to fatal */
+		return HERR_SEV_FATAL;
+	}
+}
+EXPORT_SYMBOL_GPL(cper_severity_to_herr);
+
 /*
  * CPER record ID need to be unique even after reboot, because record
  * ID is used as index for ERST storage, while CPER records from
drivers/acpi/apei/ghes.c +79 -40

185 lines not on this page · raw message

include/linux/cper.h +2 -0
@@ -22,6 +22,7 @@
 #define LINUX_CPER_H
 
 #include <linux/uuid.h>
+#include <linux/herror_record.h>
 
 /* CPER record signature and the size */
 #define CPER_SIG_RECORD				"CPER"
@@ -310,6 +311,7 @@ struct cper_sec_mem_err {
 #pragma pack()
 
 int herr_severity_to_cper(int herr_severity);
+int cper_severity_to_herr(int cper_severity);
 u64 cper_next_record_id(void);
 
 #endif
author
#11 lore raw

PATCH 9/9 ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support

In reply to Huang Ying

Generic Hardware Error Source provides a way to report platform hardware errors (such as that from chipset). It works in so called "Firmware First" mode, that is, hardware errors are reported to firmware firstly, then reported to Linux by firmware. This way, some non-standard hardware error registers or non-standard hardware link can be checked by firmware to produce more valuable hardware error information for Linux.

This patch adds POLL/IRQ/NMI notification types support.

Because the memory area used to transfer hardware error information from BIOS to Linux can be determined only in NMI, IRQ or timer handler, but general ioremap can not be used in atomic context, so a special version of atomic ioremap is implemented for that.

---
 arch/x86/kernel/acpi/boot.c |    1 
 arch/x86/kernel/dumpstack.c |    1 
 drivers/acpi/apei/ghes.c    |  366 +++++++++++++++++++++++++++++++++++---------
 kernel/panic.c              |    1 
 lib/ioremap.c               |    2 
 mm/vmalloc.c                |    1 
 6 files changed, 304 insertions(+), 68 deletions(-)
arch/x86/kernel/acpi/boot.c +1 -0
@@ -512,6 +512,7 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq
 	*gsi = irq_to_gsi(isa_irq);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 
 /*
  * success: return IRQ number (>=0)
arch/x86/kernel/dumpstack.c +1 -0
@@ -240,6 +240,7 @@ unsigned __kprobes long oops_begin(void)
 	bust_spinlocks(1);
 	return flags;
 }
+EXPORT_SYMBOL_GPL(oops_begin);
 
 void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
 {
drivers/acpi/apei/ghes.c +298 -68

516 lines not on this page · raw message

kernel/panic.c +1 -0
@@ -34,6 +34,7 @@ static int pause_on_oops_flag;
 static DEFINE_SPINLOCK(pause_on_oops_lock);
 
 int panic_timeout;
+EXPORT_SYMBOL_GPL(panic_timeout);
 
 ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
 
lib/ioremap.c +2 -0
@@ -9,6 +9,7 @@
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/io.h>
+#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/pgtable.h>
 
@@ -90,3 +91,4 @@ int ioremap_page_range(unsigned long add
 
 	return err;
 }
+EXPORT_SYMBOL_GPL(ioremap_page_range);
mm/vmalloc.c +1 -0
@@ -1160,6 +1160,7 @@ void unmap_kernel_range_noflush(unsigned
 {
 	vunmap_page_range(addr, addr + size);
 }
+EXPORT_SYMBOL_GPL(unmap_kernel_range_noflush);
 
 /**
  * unmap_kernel_range - unmap kernel VM area and flush cache and TLB
Reviewed-by on v1 9/9
#12 lore raw

Re: [PATCH 9/9] ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support

On Wed, Oct 20, 2010 at 09:37:00AM +0800, Huang Ying wrote:

Hi Ying,

Only some minor nits found in review.

I don't think they're merge blockers, but could be all fixed in followups later.

Overall it looks all good.

drivers/acpi/apei/ghes.c line 117

Quoted 9 lines

+ * These 2 spinlock is used to prevent atomic ioremap virtual memory
+ * area from being mapped simultaneously.
+ */

drivers/acpi/apei/ghes.c +6 -0
+static DEFINE_RAW_SPINLOCK(ghes_ioremap_lock_nmi);
+static DEFINE_SPINLOCK(ghes_ioremap_lock_irq);
+
+static int ghes_ioremap_init(void)
+{
+	ghes_ioremap_area = __get_vm_area(PAGE_SIZE * 2, VM_IOREMAP,

Should make the magic PAGE_SIZE * 2 into a define with a comment?

drivers/acpi/apei/ghes.c static inline int ghes_severity(int seve · line 258

Quoted 11 lines
drivers/acpi/apei/ghes.c +11 -0
+			vaddr = ghes_ioremap_pfn_nmi(paddr >> PAGE_SHIFT);
+		} else {
+			spin_lock_irqsave(&ghes_ioremap_lock_irq, flags);
+			vaddr = ghes_ioremap_pfn_irq(paddr >> PAGE_SHIFT);
+		}
+		trunk = PAGE_SIZE - offset;
+		trunk = min(trunk, len);
+		if (from_phys)
+			memcpy(buffer, vaddr + offset, trunk);
+		else
+			memcpy(vaddr + offset, buffer, trunk);

In generic Linux this would be memcpy_fromio. On x86 of course it's the same. Still perhaps better use that to prevent sparse from freaking out with its address space checks.

drivers/acpi/apei/ghes.c out: · line 400

Quoted 12 lines
drivers/acpi/apei/ghes.c +8 -0
@@ -303,6 +390,43 @@ out:
 	return 0;
 }
 
+static void ghes_add_timer(struct ghes *ghes)
+{
+	struct acpi_hest_generic *g = ghes->generic;
+	unsigned long expire;
+
+	if (!g->notify.poll_interval) {
+		pr_warning(FW_WARN GHES_PFX "Poll interval is 0 for "
+			   "generaic hardware error source: %d, disabled.",

generaic -> generic

This is user visible so should be fixed.

drivers/acpi/apei/ghes.c out: · line 406

Quoted 6 lines
drivers/acpi/apei/ghes.c +6 -0
+			   g->header.source_id);
+		return;
+	}
+	expire = jiffies + msecs_to_jiffies(g->notify.poll_interval);
+	ghes->timer.expires = round_jiffies_relative(expire);
+	add_timer(&ghes->timer);

Could actually make this a deferrable timer I guess to be even more friendly to power.

Quoted 4 lines
drivers/acpi/apei/ghes.c +4 -0
+		}
+		ret = NOTIFY_STOP;
+	}
+

drivers/acpi/apei/ghes.c static int ghes_notify_sci(struct notifi · line 480

Quoted 10 lines
drivers/acpi/apei/ghes.c +10 -0
+	if (ret == NOTIFY_DONE)
+		goto out;
+
+	if (sev_global >= GHES_SEV_PANIC) {
+		herr_persist_all_records();
+		oops_begin();
+		/* reboot to log the error! */
+		if (panic_timeout == 0)
+			panic_timeout = ghes_panic_timeout;
+		panic(GHES_PFX "generic hardware fatal error!\n");

I suspect need some more explanation on this one.

drivers/acpi/apei/ghes.c static int __devexit ghes_remove(struct · line 642

Quoted 7 lines
drivers/acpi/apei/ghes.c +7 -0
+	case ACPI_HEST_NOTIFY_NMI:
+		mutex_lock(&ghes_list_mutex);
+		list_del_rcu(&ghes->list);
+		if (list_empty(&ghes_nmi))
+			unregister_die_notifier(&ghes_notifier_nmi);
+		mutex_unlock(&ghes_list_mutex);
+		synchronize_rcu();

Should normally have a comment to describe what it synchronizes against. The NMI in this case I guess.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
author
#13 lore raw

Re: [PATCH 9/9] ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support

Hi, Andi,

Thank you very much for your review!

Quoted 13 lines · Andi Kleen

On Wed, Oct 20, 2010 at 09:37:00AM +0800, Huang Ying wrote:

Hi Ying,

Only some minor nits found in review.

I don't think they're merge blockers, but could be all fixed in followups later.

Overall it looks all good.

Quoted 11 lines

drivers/acpi/apei/ghes.c line 117

Quoted 9 lines

+ * These 2 spinlock is used to prevent atomic ioremap virtual memory
+ * area from being mapped simultaneously.
+ */

drivers/acpi/apei/ghes.c +6 -0
+static DEFINE_RAW_SPINLOCK(ghes_ioremap_lock_nmi);
+static DEFINE_SPINLOCK(ghes_ioremap_lock_irq);
+
+static int ghes_ioremap_init(void)
+{
+	ghes_ioremap_area = __get_vm_area(PAGE_SIZE * 2, VM_IOREMAP,

Should make the magic PAGE_SIZE * 2 into a define with a comment?

Yes. Will do it.

Quoted 7 lines
Quoted 7 lines
drivers/acpi/apei/ghes.c +7 -0
+			vaddr = ghes_ioremap_pfn_nmi(paddr >> PAGE_SHIFT);
+		} else {
+			spin_lock_irqsave(&ghes_ioremap_lock_irq, flags);
+			vaddr = ghes_ioremap_pfn_irq(paddr >> PAGE_SHIFT);
+		}
+		trunk = PAGE_SIZE - offset;
+		trunk = min(trunk, len);
Quoted 8 lines

drivers/acpi/apei/ghes.c static inline int ghes_severity(int seve · line 258

Quoted 4 lines
drivers/acpi/apei/ghes.c +4 -0
+		if (from_phys)
+			memcpy(buffer, vaddr + offset, trunk);
+		else
+			memcpy(vaddr + offset, buffer, trunk);

In generic Linux this would be memcpy_fromio. On x86 of course it's the same. Still perhaps better use that to prevent sparse from freaking out with its address space checks.

Will do it.

Quoted 15 lines

drivers/acpi/apei/ghes.c out: · line 400

Quoted 12 lines
drivers/acpi/apei/ghes.c +8 -0
@@ -303,6 +390,43 @@ out:
 	return 0;
 }
 
+static void ghes_add_timer(struct ghes *ghes)
+{
+	struct acpi_hest_generic *g = ghes->generic;
+	unsigned long expire;
+
+	if (!g->notify.poll_interval) {
+		pr_warning(FW_WARN GHES_PFX "Poll interval is 0 for "
+			   "generaic hardware error source: %d, disabled.",

generaic -> generic

Quoted 1 line

This is user visible so should be fixed.

Yes. Will do it.

Quoted 9 lines

drivers/acpi/apei/ghes.c out: · line 406

Quoted 6 lines
drivers/acpi/apei/ghes.c +6 -0
+			   g->header.source_id);
+		return;
+	}
+	expire = jiffies + msecs_to_jiffies(g->notify.poll_interval);
+	ghes->timer.expires = round_jiffies_relative(expire);
+	add_timer(&ghes->timer);

Could actually make this a deferrable timer I guess to be even more friendly to power.

Yes. Will do it.

Quoted 8 lines
Quoted 8 lines
drivers/acpi/apei/ghes.c +8 -0
+		}
+		ret = NOTIFY_STOP;
+	}
+
+	if (ret == NOTIFY_DONE)
+		goto out;
+
+	if (sev_global >= GHES_SEV_PANIC) {
Quoted 8 lines

drivers/acpi/apei/ghes.c static int ghes_notify_sci(struct notifi · line 480

Quoted 6 lines
drivers/acpi/apei/ghes.c +6 -0
+		herr_persist_all_records();
+		oops_begin();
+		/* reboot to log the error! */
+		if (panic_timeout == 0)
+			panic_timeout = ghes_panic_timeout;
+		panic(GHES_PFX "generic hardware fatal error!\n");

I suspect need some more explanation on this one.

Yes. Will do it.

Quoted 7 lines

drivers/acpi/apei/ghes.c static int __devexit ghes_remove(struct · line 642

Quoted 7 lines
drivers/acpi/apei/ghes.c +7 -0
+	case ACPI_HEST_NOTIFY_NMI:
+		mutex_lock(&ghes_list_mutex);
+		list_del_rcu(&ghes->list);
+		if (list_empty(&ghes_nmi))
+			unregister_die_notifier(&ghes_notifier_nmi);
+		mutex_unlock(&ghes_list_mutex);
+		synchronize_rcu();

Best Regards,
Huang Ying

reviewer
#14 lore raw
In reply to Huang Ying
Quoted 3 lines · Huang Ying

[PATCH 2/9] Add lock-less version of bitmap_set/clear [PATCH 3/9] lock-less NULL terminated single list implementation [PATCH 4/9] lock-less general memory allocator

What kinds of tests has this lockless lib code been subject to? This is generic code, does it play on multiple architectures?

thanks,
Len Brown Intel Open Source Technology Center

author
#15 lore raw
Quoted 7 lines · Len Brown
Quoted 3 lines · Huang Ying

[PATCH 2/9] Add lock-less version of bitmap_set/clear [PATCH 3/9] lock-less NULL terminated single list implementation [PATCH 4/9] lock-less general memory allocator

What kinds of tests has this lockless lib code been subject to?

These code are used by GHES only now. We have a test suite for GHES. These code works well for GHES.

At the same time, we have test code dedicated for these lib too, including stress testing.

Quoted 1 line

This is generic code, does it play on multiple architectures?

We have tested the code on x86_64 and i386 architectures. For some other architectures, we have done compile testing. The code is quite simple, so I think it should run properly on other architectures too.

Best Regards,
Huang Ying

#16 lore raw
In reply to Len Brown
Quoted 8 lines · Len Brown
Quoted 3 lines · Huang Ying

[PATCH 2/9] Add lock-less version of bitmap_set/clear [PATCH 3/9] lock-less NULL terminated single list implementation [PATCH 4/9] lock-less general memory allocator

What kinds of tests has this lockless lib code been subject to? This is generic code, does it play on multiple architectures?

cmpxchg is universal these days, so it should be ok everywhere.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
Reviewed-by on the v1 series
#17 lore raw
In reply to Huang Ying
Quoted 9 lines · Huang Ying

[PATCH 1/9] ACPI, APEI, Add ERST record ID cache
[PATCH 2/9] Add lock-less version of bitmap_set/clear
[PATCH 3/9] lock-less NULL terminated single list implementation
[PATCH 4/9] lock-less general memory allocator
[PATCH 5/9] Hardware error device core
[PATCH 6/9] Hardware error record persistent support
[PATCH 7/9] ACPI, APEI, Use ERST for hardware error persisting before panic [PATCH 8/9] ACPI, APEI, Report GHES error record with hardware error device core [PATCH 9/9] ACPI, APEI, Generic Hardware Error Source POLL/IRQ/NMI notification type support

I reviewed the whole series and it all looks good to me.

Some things could be cleaned up, but it's all very minor.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.