Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 289d773e authored by Keith Owens's avatar Keith Owens Committed by Tony Luck
Browse files

[IA64] MCA/INIT: avoid reading INIT record during INIT event



Reading the INIT record from SAL during the INIT event has proved to be
unreliable, and a source of hangs during INIT processing.  The new
MCA/INIT handlers remove the need to get the INIT record from SAL.
Change salinfo.c so mca.c can just flag that a new record is available,
without having to read the record during INIT processing.  This patch
can be applied without the new MCA/INIT handlers.

Also clean up some usage of NR_CPUS which should have been using
cpu_online().

Signed-off-by: default avatarKeith Owens <kaos@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent e619ae0b
Loading
Loading
Loading
Loading
+34 −28
Original line number Original line Diff line number Diff line
@@ -22,6 +22,11 @@
 *
 *
 * Dec  5 2004	kaos@sgi.com
 * Dec  5 2004	kaos@sgi.com
 *   Standardize which records are cleared automatically.
 *   Standardize which records are cleared automatically.
 *
 * Aug 18 2005	kaos@sgi.com
 *   mca.c may not pass a buffer, a NULL buffer just indicates that a new
 *   record is available in SAL.
 *   Replace some NR_CPUS by cpus_online, for hotplug cpu.
 */
 */


#include <linux/types.h>
#include <linux/types.h>
@@ -193,7 +198,7 @@ shift1_data_saved (struct salinfo_data *data, int shift)
 * The buffer passed from mca.c points to the output from ia64_log_get. This is
 * The buffer passed from mca.c points to the output from ia64_log_get. This is
 * a persistent buffer but its contents can change between the interrupt and
 * a persistent buffer but its contents can change between the interrupt and
 * when user space processes the record.  Save the record id to identify
 * when user space processes the record.  Save the record id to identify
 * changes.
 * changes.  If the buffer is NULL then just update the bitmap.
 */
 */
void
void
salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
@@ -206,6 +211,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)


	BUG_ON(type >= ARRAY_SIZE(salinfo_log_name));
	BUG_ON(type >= ARRAY_SIZE(salinfo_log_name));


	if (buffer) {
		if (irqsafe)
		if (irqsafe)
			spin_lock_irqsave(&data_saved_lock, flags);
			spin_lock_irqsave(&data_saved_lock, flags);
		for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) {
		for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) {
@@ -227,6 +233,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
		}
		}
		if (irqsafe)
		if (irqsafe)
			spin_unlock_irqrestore(&data_saved_lock, flags);
			spin_unlock_irqrestore(&data_saved_lock, flags);
	}


	if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) {
	if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) {
		if (irqsafe)
		if (irqsafe)
@@ -244,7 +251,7 @@ salinfo_timeout_check(struct salinfo_data *data)
	int i;
	int i;
	if (!data->open)
	if (!data->open)
		return;
		return;
	for (i = 0; i < NR_CPUS; ++i) {
	for_each_online_cpu(i) {
		if (test_bit(i, &data->cpu_event)) {
		if (test_bit(i, &data->cpu_event)) {
			/* double up() is not a problem, user space will see no
			/* double up() is not a problem, user space will see no
			 * records for the additional "events".
			 * records for the additional "events".
@@ -291,7 +298,7 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t


	n = data->cpu_check;
	n = data->cpu_check;
	for (i = 0; i < NR_CPUS; i++) {
	for (i = 0; i < NR_CPUS; i++) {
		if (test_bit(n, &data->cpu_event)) {
		if (test_bit(n, &data->cpu_event) && cpu_online(n)) {
			cpu = n;
			cpu = n;
			break;
			break;
		}
		}
@@ -585,8 +592,7 @@ salinfo_init(void)


		/* we missed any events before now */
		/* we missed any events before now */
		online = 0;
		online = 0;
		for (j = 0; j < NR_CPUS; j++)
		for_each_online_cpu(j) {
			if (cpu_online(j)) {
			set_bit(j, &data->cpu_event);
			set_bit(j, &data->cpu_event);
			++online;
			++online;
		}
		}