Skip to contentSkip to conversation

make c/s 21089 work again with c/s 21092

PATCH In review Jan Beulich 3 participants 5 messages Apr 13, 2010 – Apr 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make c/s 21089 work again with c/s 21092

Unfortunately the latter c/s' change to mpparse.c yielded the former patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED state, yet must be allowed to get its trigger mode and polarity set up in order for it to be usable.

xen/arch/x86/mpparse.c +8 -1
@@ -1103,6 +1103,8 @@ int mp_register_gsi (u32 gsi, int trigge
 	int			ioapic = -1;
 	int			ioapic_pin = 0;
 	int			idx, bit = 0;
+	struct irq_desc *	desc;
+	unsigned long		flags;
 
 	/*
 	 * Mapping between Global System Interrups, which
@@ -1127,8 +1129,13 @@ int mp_register_gsi (u32 gsi, int trigge
 	if (ioapic_renumber_irq)
 		gsi = ioapic_renumber_irq(ioapic, gsi);
 
-	if (!(irq_to_desc(gsi)->status & IRQ_DISABLED))
+	desc = irq_to_desc(gsi);
+	spin_lock_irqsave(&desc->lock, flags);
+	if (!(desc->status & IRQ_DISABLED) && desc->handler != &no_irq_type) {
+		spin_unlock_irqrestore(&desc->lock, flags);
 		return -EEXIST;
+	}
+	spin_unlock_irqrestore(&desc->lock, flags);
 
 	/* 
 	 * Avoid pin reprogramming.  PRTs typically include entries  

Unfortunately the latter c/s' change to mpparse.c yielded the former patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED state, yet must be allowed to get its trigger mode and polarity set up in order for it to be usable.

xen/arch/x86/mpparse.c +8 -1
@@ -1103,6 +1103,8 @@ int mp_register_gsi (u32 gsi, int trigge
 	int			ioapic = -1;
 	int			ioapic_pin = 0;
 	int			idx, bit = 0;
+	struct irq_desc *	desc;
+	unsigned long		flags;
 
 	/*
 	 * Mapping between Global System Interrups, which
@@ -1127,8 +1129,13 @@ int mp_register_gsi (u32 gsi, int trigge
 	if (ioapic_renumber_irq)
 		gsi = ioapic_renumber_irq(ioapic, gsi);
 
-	if (!(irq_to_desc(gsi)->status & IRQ_DISABLED))
+	desc = irq_to_desc(gsi);
+	spin_lock_irqsave(&desc->lock, flags);
+	if (!(desc->status & IRQ_DISABLED) && desc->handler != &no_irq_type) {
+		spin_unlock_irqrestore(&desc->lock, flags);
 		return -EEXIST;
+	}
+	spin_unlock_irqrestore(&desc->lock, flags);
 
 	/* 
 	 * Avoid pin reprogramming.  PRTs typically include entries  

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 4 lines · Jan Beulich

Unfortunately the latter c/s' change to mpparse.c yielded the former patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED state, yet must be allowed to get its trigger mode and polarity set up in order for it to be usable.

This looks not right. The original patch was designed to keep this function away from the irqs of the serial port. This patch adds another check for disallowing access but does not touch the IQR_DISABLED check.

Please explain which machines have non-legacy configured interrupts for the first two serial ports.

Bastian

Signature · 2 lines
There are certain things men must do to remain men.
		-- Kirk, "The Ultimate Computer", stardate 4929.4
#2 lore raw
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Bastian Blank <[email protected]> 13.04.10 17:10 >>>

Quoted 4 lines · Jan Beulich

Unfortunately the latter c/s' change to mpparse.c yielded the former patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED state, yet must be allowed to get its trigger mode and polarity set up in order for it to be usable.

Quoted 6 lines

This looks not right. The original patch was designed to keep this function away from the irqs of the serial port. This patch adds another check for disallowing access but does not touch the IQR_DISABLED check.

Please explain which machines have non-legacy configured interrupts for the first two serial ports.

I'm talking about PCI serial cards - in the one case I'm working with, it sits on IRQ 17 (level, low) and hence Xen can't enable it until Dom0 retrieved sufficient information from ACPI. Since desc->status doesn't have IRQ_DISABLED for such an interrupt anymore, your patch basically made it impossible for the needed information to be processed, and hence the IRQ could (again, i.e. as before my patch was applied) not be enabled.

Jan

#3 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line

Bastian Blank <[email protected]> 13.04.10 17:10 >>>

Quoted 4 lines · Jan Beulich

Unfortunately the latter c/s' change to mpparse.c yielded the former patch non-functional - Xen's serial port IRQ is not in IQR_DISABLED state, yet must be allowed to get its trigger mode and polarity set up in order for it to be usable.

Quoted 8 lines
Quoted 6 lines

This looks not right. The original patch was designed to keep this function away from the irqs of the serial port. This patch adds another check for disallowing access but does not touch the IQR_DISABLED check.

Please explain which machines have non-legacy configured interrupts for the first two serial ports.

I'm talking about PCI serial cards - in the one case I'm working with,

Can't you use polling for it? For example this is what I do for my PCI serial card:

com1=115200,8n1,0xd800,0

#4 lore raw
In reply to Jan Beulich

Review

Quoted 1 line · Jan Beulich
(quoted diff) +1 -0
+	spin_lock_irqsave(&desc->lock, flags);

Why do you lock here? The whole thing is racy anyway and this should only battle against concurent registrations from dom0.

Bastian

Signature · 3 lines
It is a human characteristic to love little animals, especially if
they're attractive in some way.
		-- McCoy, "The Trouble with Tribbles", stardate 4525.6