Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-5.14-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
"A small cleanup patch and a fix of a rare race in the Xen evtchn
driver"

* tag 'for-linus-5.14-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen/events: Fix race in set_evtchn_to_irq
xen/events: remove redundant initialization of variable irq

+15 -7
+15 -7
drivers/xen/events/events_base.c
··· 198 198 199 199 static DEFINE_PER_CPU(unsigned int, irq_epoch); 200 200 201 - static void clear_evtchn_to_irq_row(unsigned row) 201 + static void clear_evtchn_to_irq_row(int *evtchn_row) 202 202 { 203 203 unsigned col; 204 204 205 205 for (col = 0; col < EVTCHN_PER_ROW; col++) 206 - WRITE_ONCE(evtchn_to_irq[row][col], -1); 206 + WRITE_ONCE(evtchn_row[col], -1); 207 207 } 208 208 209 209 static void clear_evtchn_to_irq_all(void) ··· 213 213 for (row = 0; row < EVTCHN_ROW(xen_evtchn_max_channels()); row++) { 214 214 if (evtchn_to_irq[row] == NULL) 215 215 continue; 216 - clear_evtchn_to_irq_row(row); 216 + clear_evtchn_to_irq_row(evtchn_to_irq[row]); 217 217 } 218 218 } 219 219 ··· 221 221 { 222 222 unsigned row; 223 223 unsigned col; 224 + int *evtchn_row; 224 225 225 226 if (evtchn >= xen_evtchn_max_channels()) 226 227 return -EINVAL; ··· 234 233 if (irq == -1) 235 234 return 0; 236 235 237 - evtchn_to_irq[row] = (int *)get_zeroed_page(GFP_KERNEL); 238 - if (evtchn_to_irq[row] == NULL) 236 + evtchn_row = (int *) __get_free_pages(GFP_KERNEL, 0); 237 + if (evtchn_row == NULL) 239 238 return -ENOMEM; 240 239 241 - clear_evtchn_to_irq_row(row); 240 + clear_evtchn_to_irq_row(evtchn_row); 241 + 242 + /* 243 + * We've prepared an empty row for the mapping. If a different 244 + * thread was faster inserting it, we can drop ours. 245 + */ 246 + if (cmpxchg(&evtchn_to_irq[row], NULL, evtchn_row) != NULL) 247 + free_page((unsigned long) evtchn_row); 242 248 } 243 249 244 250 WRITE_ONCE(evtchn_to_irq[row][col], irq); ··· 1017 1009 int xen_bind_pirq_gsi_to_irq(unsigned gsi, 1018 1010 unsigned pirq, int shareable, char *name) 1019 1011 { 1020 - int irq = -1; 1012 + int irq; 1021 1013 struct physdev_irq irq_op; 1022 1014 int ret; 1023 1015