blob: f42e78de1e107d662e3d806d1dc88ceeaf77ca02 [file] [log] [blame]
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -07001/*
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>
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -07007#include <linux/debugfs.h>
8#include <linux/log2.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09009#include <linux/gfp.h>
Konrad Rzeszutek Wilk354e7b72013-06-05 10:44:47 -040010#include <linux/slab.h>
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -070011
12#include <asm/paravirt.h>
13
14#include <xen/interface/xen.h>
15#include <xen/events.h>
16
17#include "xen-ops.h"
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -070018#include "debugfs.h"
19
David Vrabele95e6f12015-04-24 14:56:40 -040020static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
21static DEFINE_PER_CPU(char *, irq_name);
22static bool xen_pvspin = true;
23
Ingo Molnar62c7a1e2015-05-11 09:47:23 +020024#ifdef CONFIG_QUEUED_SPINLOCKS
David Vrabele95e6f12015-04-24 14:56:40 -040025
26#include <asm/qspinlock.h>
27
28static void xen_qlock_kick(int cpu)
29{
Ross Lagerwall707e59b2016-04-22 13:05:31 +010030 int irq = per_cpu(lock_kicker_irq, cpu);
31
32 /* Don't kick if the target's kicker interrupt is not initialized. */
33 if (irq == -1)
34 return;
35
David Vrabele95e6f12015-04-24 14:56:40 -040036 xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
37}
38
39/*
40 * Halt the current CPU & release it back to the host
41 */
42static void xen_qlock_wait(u8 *byte, u8 val)
43{
44 int irq = __this_cpu_read(lock_kicker_irq);
45
46 /* If kicker interrupts not initialized yet, just spin */
47 if (irq == -1)
48 return;
49
50 /* clear pending */
51 xen_clear_irq_pending(irq);
52 barrier();
53
54 /*
55 * We check the byte value after clearing pending IRQ to make sure
56 * that we won't miss a wakeup event because of the clearing.
57 *
58 * The sync_clear_bit() call in xen_clear_irq_pending() is atomic.
59 * So it is effectively a memory barrier for x86.
60 */
61 if (READ_ONCE(*byte) != val)
62 return;
63
64 /*
65 * If an interrupt happens here, it will leave the wakeup irq
66 * pending, which will cause xen_poll_irq() to return
67 * immediately.
68 */
69
70 /* Block until irq becomes pending (or perhaps a spurious wakeup) */
71 xen_poll_irq(irq);
72}
73
Ingo Molnar62c7a1e2015-05-11 09:47:23 +020074#else /* CONFIG_QUEUED_SPINLOCKS */
David Vrabele95e6f12015-04-24 14:56:40 -040075
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +053076enum xen_contention_stat {
77 TAKEN_SLOW,
78 TAKEN_SLOW_PICKUP,
79 TAKEN_SLOW_SPURIOUS,
80 RELEASED_SLOW,
81 RELEASED_SLOW_KICKED,
82 NR_CONTENTION_STATS
83};
84
85
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -070086#ifdef CONFIG_XEN_DEBUG_FS
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +053087#define HISTO_BUCKETS 30
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -070088static struct xen_spinlock_stats
89{
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +053090 u32 contention_stats[NR_CONTENTION_STATS];
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -070091 u32 histo_spin_blocked[HISTO_BUCKETS+1];
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -070092 u64 time_blocked;
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -070093} spinlock_stats;
94
95static u8 zero_stats;
96
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -070097static inline void check_zero(void)
98{
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +053099 u8 ret;
Raghavendra K Td6abfdb2015-02-06 16:44:11 +0530100 u8 old = READ_ONCE(zero_stats);
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530101 if (unlikely(old)) {
102 ret = cmpxchg(&zero_stats, old, 0);
103 /* This ensures only one fellow resets the stat */
104 if (ret == old)
105 memset(&spinlock_stats, 0, sizeof(spinlock_stats));
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700106 }
107}
108
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530109static inline void add_stats(enum xen_contention_stat var, u32 val)
110{
111 check_zero();
112 spinlock_stats.contention_stats[var] += val;
113}
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700114
115static inline u64 spin_time_start(void)
116{
117 return xen_clocksource_read();
118}
119
120static void __spin_time_accum(u64 delta, u32 *array)
121{
122 unsigned index = ilog2(delta);
123
124 check_zero();
125
126 if (index < HISTO_BUCKETS)
127 array[index]++;
128 else
129 array[HISTO_BUCKETS]++;
130}
131
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700132static inline void spin_time_accum_blocked(u64 start)
133{
134 u32 delta = xen_clocksource_read() - start;
135
136 __spin_time_accum(delta, spinlock_stats.histo_spin_blocked);
137 spinlock_stats.time_blocked += delta;
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700138}
139#else /* !CONFIG_XEN_DEBUG_FS */
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530140static inline void add_stats(enum xen_contention_stat var, u32 val)
141{
142}
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700143
144static inline u64 spin_time_start(void)
145{
146 return 0;
147}
148
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700149static inline void spin_time_accum_blocked(u64 start)
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700150{
151}
152#endif /* CONFIG_XEN_DEBUG_FS */
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700153
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530154struct xen_lock_waiting {
155 struct arch_spinlock *lock;
156 __ticket_t want;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700157};
158
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530159static DEFINE_PER_CPU(struct xen_lock_waiting, lock_waiting);
160static cpumask_t waiting_cpus;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700161
Andi Kleendd41f812013-10-22 09:07:58 -0700162__visible void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700163{
Christoph Lameter780f36d2010-12-06 11:16:29 -0600164 int irq = __this_cpu_read(lock_kicker_irq);
Christoph Lameter89cbc762014-08-17 12:30:40 -0500165 struct xen_lock_waiting *w = this_cpu_ptr(&lock_waiting);
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530166 int cpu = smp_processor_id();
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700167 u64 start;
Raghavendra K Td6abfdb2015-02-06 16:44:11 +0530168 __ticket_t head;
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530169 unsigned long flags;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700170
171 /* If kicker interrupts not initialized yet, just spin */
172 if (irq == -1)
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530173 return;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700174
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700175 start = spin_time_start();
176
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530177 /*
178 * Make sure an interrupt handler can't upset things in a
179 * partially setup state.
180 */
181 local_irq_save(flags);
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530182 /*
183 * We don't really care if we're overwriting some other
184 * (lock,want) pair, as that would mean that we're currently
185 * in an interrupt context, and the outer context had
186 * interrupts enabled. That has already kicked the VCPU out
187 * of xen_poll_irq(), so it will just return spuriously and
188 * retry with newly setup (lock,want).
189 *
190 * The ordering protocol on this is that the "lock" pointer
191 * may only be set non-NULL if the "want" ticket is correct.
192 * If we're updating "want", we must first clear "lock".
193 */
194 w->lock = NULL;
195 smp_wmb();
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530196 w->want = want;
197 smp_wmb();
198 w->lock = lock;
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700199
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530200 /* This uses set_bit, which atomic and therefore a barrier */
201 cpumask_set_cpu(cpu, &waiting_cpus);
202 add_stats(TAKEN_SLOW, 1);
Jeremy Fitzhardinge4d576b52009-09-09 12:33:51 -0700203
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530204 /* clear pending */
205 xen_clear_irq_pending(irq);
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700206
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530207 /* Only check lock once pending cleared */
208 barrier();
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700209
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530210 /*
211 * Mark entry to slowpath before doing the pickup test to make
212 * sure we don't deadlock with an unlocker.
213 */
Jeremy Fitzhardinge96f853e2013-08-09 19:51:58 +0530214 __ticket_enter_slowpath(lock);
215
Raghavendra K Td6abfdb2015-02-06 16:44:11 +0530216 /* make sure enter_slowpath, which is atomic does not cross the read */
217 smp_mb__after_atomic();
218
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530219 /*
220 * check again make sure it didn't become free while
221 * we weren't looking
222 */
Raghavendra K Td6abfdb2015-02-06 16:44:11 +0530223 head = READ_ONCE(lock->tickets.head);
224 if (__tickets_equal(head, want)) {
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530225 add_stats(TAKEN_SLOW_PICKUP, 1);
226 goto out;
227 }
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530228
229 /* Allow interrupts while blocked */
230 local_irq_restore(flags);
231
232 /*
233 * If an interrupt happens here, it will leave the wakeup irq
234 * pending, which will cause xen_poll_irq() to return
235 * immediately.
236 */
237
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530238 /* Block until irq becomes pending (or perhaps a spurious wakeup) */
239 xen_poll_irq(irq);
240 add_stats(TAKEN_SLOW_SPURIOUS, !xen_test_irq_pending(irq));
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530241
242 local_irq_save(flags);
243
Thomas Gleixner770144e2014-02-23 21:40:16 +0000244 kstat_incr_irq_this_cpu(irq);
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700245out:
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530246 cpumask_clear_cpu(cpu, &waiting_cpus);
247 w->lock = NULL;
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530248
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530249 local_irq_restore(flags);
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530250
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700251 spin_time_accum_blocked(start);
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700252}
Jeremy Fitzhardinge354714d2013-08-09 19:51:55 +0530253PV_CALLEE_SAVE_REGS_THUNK(xen_lock_spinning);
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700254
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530255static void xen_unlock_kick(struct arch_spinlock *lock, __ticket_t next)
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700256{
257 int cpu;
258
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530259 add_stats(RELEASED_SLOW, 1);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700260
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530261 for_each_cpu(cpu, &waiting_cpus) {
262 const struct xen_lock_waiting *w = &per_cpu(lock_waiting, cpu);
263
Jeremy Fitzhardinge1ed7bf52013-08-09 19:51:59 +0530264 /* Make sure we read lock before want */
Raghavendra K Td6abfdb2015-02-06 16:44:11 +0530265 if (READ_ONCE(w->lock) == lock &&
266 READ_ONCE(w->want) == next) {
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530267 add_stats(RELEASED_SLOW_KICKED, 1);
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700268 xen_send_IPI_one(cpu, XEN_SPIN_UNLOCK_VECTOR);
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530269 break;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700270 }
271 }
272}
Ingo Molnar62c7a1e2015-05-11 09:47:23 +0200273#endif /* CONFIG_QUEUED_SPINLOCKS */
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700274
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700275static irqreturn_t dummy_handler(int irq, void *dev_id)
276{
277 BUG();
278 return IRQ_HANDLED;
279}
280
Paul Gortmaker148f9bb2013-06-18 18:23:59 -0400281void xen_init_lock_cpu(int cpu)
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700282{
283 int irq;
Konrad Rzeszutek Wilk354e7b72013-06-05 10:44:47 -0400284 char *name;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700285
Konrad Rzeszutek Wilk3310bbe2013-08-26 14:28:06 -0400286 if (!xen_pvspin)
287 return;
288
Konrad Rzeszutek Wilkcb91f8f2013-05-06 08:33:15 -0400289 WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
Konrad Rzeszutek Wilkcb9c6f12013-04-16 14:33:20 -0400290 cpu, per_cpu(lock_kicker_irq, cpu));
291
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700292 name = kasprintf(GFP_KERNEL, "spinlock%d", cpu);
293 irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
294 cpu,
295 dummy_handler,
Michael Opdenacker9d71cee2013-09-07 08:46:49 +0200296 IRQF_PERCPU|IRQF_NOBALANCING,
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700297 name,
298 NULL);
299
300 if (irq >= 0) {
301 disable_irq(irq); /* make sure it's never delivered */
302 per_cpu(lock_kicker_irq, cpu) = irq;
Konrad Rzeszutek Wilk354e7b72013-06-05 10:44:47 -0400303 per_cpu(irq_name, cpu) = name;
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700304 }
305
306 printk("cpu %d spinlock event irq %d\n", cpu, irq);
307}
308
Alex Nixond68d82a2008-08-22 11:52:15 +0100309void xen_uninit_lock_cpu(int cpu)
310{
Konrad Rzeszutek Wilk3310bbe2013-08-26 14:28:06 -0400311 if (!xen_pvspin)
312 return;
313
Alex Nixond68d82a2008-08-22 11:52:15 +0100314 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
Konrad Rzeszutek Wilkcb9c6f12013-04-16 14:33:20 -0400315 per_cpu(lock_kicker_irq, cpu) = -1;
Konrad Rzeszutek Wilk354e7b72013-06-05 10:44:47 -0400316 kfree(per_cpu(irq_name, cpu));
317 per_cpu(irq_name, cpu) = NULL;
Alex Nixond68d82a2008-08-22 11:52:15 +0100318}
319
Jeremy Fitzhardingeb8fa70b2013-08-09 19:51:54 +0530320
Konrad Rzeszutek Wilka9459282013-09-12 22:29:44 -0400321/*
322 * Our init of PV spinlocks is split in two init functions due to us
323 * using paravirt patching and jump labels patching and having to do
324 * all of this before SMP code is invoked.
325 *
326 * The paravirt patching needs to be done _before_ the alternative asm code
327 * is started, otherwise we would not patch the core kernel code.
328 */
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700329void __init xen_init_spinlocks(void)
330{
Konrad Rzeszutek Wilk70dd4992013-04-16 14:34:45 -0400331
Jeremy Fitzhardingeb8fa70b2013-08-09 19:51:54 +0530332 if (!xen_pvspin) {
333 printk(KERN_DEBUG "xen: PV spinlocks disabled\n");
334 return;
335 }
Konrad Rzeszutek Wilke0fc17a2014-04-04 14:48:04 -0400336 printk(KERN_DEBUG "xen: PV spinlocks enabled\n");
Ingo Molnar62c7a1e2015-05-11 09:47:23 +0200337#ifdef CONFIG_QUEUED_SPINLOCKS
David Vrabele95e6f12015-04-24 14:56:40 -0400338 __pv_init_lock_hash();
339 pv_lock_ops.queued_spin_lock_slowpath = __pv_queued_spin_lock_slowpath;
340 pv_lock_ops.queued_spin_unlock = PV_CALLEE_SAVE(__pv_queued_spin_unlock);
341 pv_lock_ops.wait = xen_qlock_wait;
342 pv_lock_ops.kick = xen_qlock_kick;
343#else
Jeremy Fitzhardinge354714d2013-08-09 19:51:55 +0530344 pv_lock_ops.lock_spinning = PV_CALLEE_SAVE(xen_lock_spinning);
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530345 pv_lock_ops.unlock_kick = xen_unlock_kick;
David Vrabele95e6f12015-04-24 14:56:40 -0400346#endif
Jeremy Fitzhardinged5de8842008-07-23 13:28:58 -0700347}
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700348
Konrad Rzeszutek Wilka9459282013-09-12 22:29:44 -0400349/*
350 * While the jump_label init code needs to happend _after_ the jump labels are
351 * enabled and before SMP is started. Hence we use pre-SMP initcall level
352 * init. We cannot do it in xen_init_spinlocks as that is done before
353 * jump labels are activated.
354 */
355static __init int xen_init_spinlocks_jump(void)
356{
357 if (!xen_pvspin)
358 return 0;
359
Konrad Rzeszutek Wilke0fc17a2014-04-04 14:48:04 -0400360 if (!xen_domain())
361 return 0;
362
Konrad Rzeszutek Wilka9459282013-09-12 22:29:44 -0400363 static_key_slow_inc(&paravirt_ticketlocks_enabled);
364 return 0;
365}
366early_initcall(xen_init_spinlocks_jump);
367
Jeremy Fitzhardingeb8fa70b2013-08-09 19:51:54 +0530368static __init int xen_parse_nopvspin(char *arg)
369{
370 xen_pvspin = false;
371 return 0;
372}
373early_param("xen_nopvspin", xen_parse_nopvspin);
374
Ingo Molnar62c7a1e2015-05-11 09:47:23 +0200375#if defined(CONFIG_XEN_DEBUG_FS) && !defined(CONFIG_QUEUED_SPINLOCKS)
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700376
377static struct dentry *d_spin_debug;
378
379static int __init xen_spinlock_debugfs(void)
380{
381 struct dentry *d_xen = xen_init_debugfs();
382
383 if (d_xen == NULL)
384 return -ENOMEM;
385
Konrad Rzeszutek Wilk3310bbe2013-08-26 14:28:06 -0400386 if (!xen_pvspin)
387 return 0;
388
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700389 d_spin_debug = debugfs_create_dir("spinlocks", d_xen);
390
391 debugfs_create_u8("zero_stats", 0644, d_spin_debug, &zero_stats);
392
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700393 debugfs_create_u32("taken_slow", 0444, d_spin_debug,
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530394 &spinlock_stats.contention_stats[TAKEN_SLOW]);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700395 debugfs_create_u32("taken_slow_pickup", 0444, d_spin_debug,
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530396 &spinlock_stats.contention_stats[TAKEN_SLOW_PICKUP]);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700397 debugfs_create_u32("taken_slow_spurious", 0444, d_spin_debug,
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530398 &spinlock_stats.contention_stats[TAKEN_SLOW_SPURIOUS]);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700399
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700400 debugfs_create_u32("released_slow", 0444, d_spin_debug,
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530401 &spinlock_stats.contention_stats[RELEASED_SLOW]);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700402 debugfs_create_u32("released_slow_kicked", 0444, d_spin_debug,
Jeremy Fitzhardinge80bd58f2013-08-09 19:51:53 +0530403 &spinlock_stats.contention_stats[RELEASED_SLOW_KICKED]);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700404
Jeremy Fitzhardingef8eca412008-08-20 17:02:21 -0700405 debugfs_create_u64("time_blocked", 0444, d_spin_debug,
406 &spinlock_stats.time_blocked);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700407
Srivatsa Vaddagiri9fe2a702012-03-23 13:36:28 +0530408 debugfs_create_u32_array("histo_blocked", 0444, d_spin_debug,
409 spinlock_stats.histo_spin_blocked, HISTO_BUCKETS + 1);
Jeremy Fitzhardinge994025c2008-08-20 17:02:19 -0700410
411 return 0;
412}
413fs_initcall(xen_spinlock_debugfs);
414
415#endif /* CONFIG_XEN_DEBUG_FS */