Commit 90af9514ac99f51e81682c7bec8f9fb88a17a95c
Committed by
Ingo Molnar
1 parent
3445a8fd7c
Exists in
master
and in
7 other branches
xen: explicitly initialise the cpu field of irq_info
I was seeing a very odd crash on 64 bit in bind_evtchn_to_cpu because cpu_from_irq(irq) was coming out as -1. I found this was coming direct from the mk_ipi_info call. It's not clear to me that this isn't a compiler bug (implicit initialisation to zero of unsigned shorts in a struct not handled correctly?). On the other hand is it true that all event channels start of bound to CPU 0? If not then -1 might be correct and the various other functions should cope with this. Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 6 additions and 5 deletions Side-by-side Diff
drivers/xen/events.c
... | ... | @@ -115,26 +115,27 @@ |
115 | 115 | |
116 | 116 | static struct irq_info mk_evtchn_info(unsigned short evtchn) |
117 | 117 | { |
118 | - return (struct irq_info) { .type = IRQT_EVTCHN, .evtchn = evtchn }; | |
118 | + return (struct irq_info) { .type = IRQT_EVTCHN, .evtchn = evtchn, | |
119 | + .cpu = 0 }; | |
119 | 120 | } |
120 | 121 | |
121 | 122 | static struct irq_info mk_ipi_info(unsigned short evtchn, enum ipi_vector ipi) |
122 | 123 | { |
123 | 124 | return (struct irq_info) { .type = IRQT_IPI, .evtchn = evtchn, |
124 | - .u.ipi = ipi }; | |
125 | + .cpu = 0, .u.ipi = ipi }; | |
125 | 126 | } |
126 | 127 | |
127 | 128 | static struct irq_info mk_virq_info(unsigned short evtchn, unsigned short virq) |
128 | 129 | { |
129 | 130 | return (struct irq_info) { .type = IRQT_VIRQ, .evtchn = evtchn, |
130 | - .u.virq = virq }; | |
131 | + .cpu = 0, .u.virq = virq }; | |
131 | 132 | } |
132 | 133 | |
133 | 134 | static struct irq_info mk_pirq_info(unsigned short evtchn, |
134 | 135 | unsigned short gsi, unsigned short vector) |
135 | 136 | { |
136 | 137 | return (struct irq_info) { .type = IRQT_PIRQ, .evtchn = evtchn, |
137 | - .u.pirq = { .gsi = gsi, .vector = vector } }; | |
138 | + .cpu = 0, .u.pirq = { .gsi = gsi, .vector = vector } }; | |
138 | 139 | } |
139 | 140 | |
140 | 141 | /* |
... | ... | @@ -375,6 +376,7 @@ |
375 | 376 | spin_lock(&irq_mapping_update_lock); |
376 | 377 | |
377 | 378 | irq = per_cpu(ipi_to_irq, cpu)[ipi]; |
379 | + | |
378 | 380 | if (irq == -1) { |
379 | 381 | irq = find_unbound_irq(); |
380 | 382 | if (irq < 0) |
... | ... | @@ -391,7 +393,6 @@ |
391 | 393 | |
392 | 394 | evtchn_to_irq[evtchn] = irq; |
393 | 395 | irq_info[irq] = mk_ipi_info(evtchn, ipi); |
394 | - | |
395 | 396 | per_cpu(ipi_to_irq, cpu)[ipi] = irq; |
396 | 397 | |
397 | 398 | bind_evtchn_to_cpu(evtchn, cpu); |