spinlock.c (3310bbedac497b793b96184e1b9b5da4f747d53a) spinlock.c (fb78e58c275599a961557bca201dd897565833ca)
1/*
2 * Split spinlock implementation out into its own file, so it can be
3 * compiled in a FTRACE-compatible way.
4 */
5#include <linux/kernel_stat.h>
6#include <linux/spinlock.h>
7#include <linux/debugfs.h>
8#include <linux/log2.h>

--- 216 unchanged lines hidden (view full) ---

225 char *name;
226
227 if (!xen_pvspin)
228 return;
229
230 WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
231 cpu, per_cpu(lock_kicker_irq, cpu));
232
1/*
2 * Split spinlock implementation out into its own file, so it can be
3 * compiled in a FTRACE-compatible way.
4 */
5#include <linux/kernel_stat.h>
6#include <linux/spinlock.h>
7#include <linux/debugfs.h>
8#include <linux/log2.h>

--- 216 unchanged lines hidden (view full) ---

225 char *name;
226
227 if (!xen_pvspin)
228 return;
229
230 WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
231 cpu, per_cpu(lock_kicker_irq, cpu));
232
233 /*
234 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
235 * (xen: disable PV spinlocks on HVM)
236 */
237 if (xen_hvm_domain())
238 return;
239
240 name = kasprintf(GFP_KERNEL, "spinlock%d", cpu);
241 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
242 cpu,
243 dummy_handler,
244 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
245 name,
246 NULL);
247
248 if (irq >= 0) {
249 disable_irq(irq); /* make sure it's never delivered */
250 per_cpu(lock_kicker_irq, cpu) = irq;
251 per_cpu(irq_name, cpu) = name;
252 }
253
254 printk("cpu %d spinlock event irq %d\n", cpu, irq);
255}
256
257void xen_uninit_lock_cpu(int cpu)
258{
233 name = kasprintf(GFP_KERNEL, "spinlock%d", cpu);
234 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
235 cpu,
236 dummy_handler,
237 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
238 name,
239 NULL);
240
241 if (irq >= 0) {
242 disable_irq(irq); /* make sure it's never delivered */
243 per_cpu(lock_kicker_irq, cpu) = irq;
244 per_cpu(irq_name, cpu) = name;
245 }
246
247 printk("cpu %d spinlock event irq %d\n", cpu, irq);
248}
249
250void xen_uninit_lock_cpu(int cpu)
251{
259 /*
260 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
261 * (xen: disable PV spinlocks on HVM)
262 */
263 if (xen_hvm_domain())
264 return;
265
266 if (!xen_pvspin)
267 return;
268
269 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
270 per_cpu(lock_kicker_irq, cpu) = -1;
271 kfree(per_cpu(irq_name, cpu));
272 per_cpu(irq_name, cpu) = NULL;
273}
274
275
276void __init xen_init_spinlocks(void)
277{
252 if (!xen_pvspin)
253 return;
254
255 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
256 per_cpu(lock_kicker_irq, cpu) = -1;
257 kfree(per_cpu(irq_name, cpu));
258 per_cpu(irq_name, cpu) = NULL;
259}
260
261
262void __init xen_init_spinlocks(void)
263{
278 /*
279 * See git commit f10cd522c5fbfec9ae3cc01967868c9c2401ed23
280 * (xen: disable PV spinlocks on HVM)
281 */
282 if (xen_hvm_domain())
283 return;
284
285 if (!xen_pvspin) {
286 printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
287 return;
288 }
289
290 static_key_slow_inc(&paravirt_ticketlocks_enabled);
291

--- 52 unchanged lines hidden ---
264
265 if (!xen_pvspin) {
266 printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
267 return;
268 }
269
270 static_key_slow_inc(&paravirt_ticketlocks_enabled);
271

--- 52 unchanged lines hidden ---