Lines Matching refs:sbp

70 static struct sbprof_tb sbp;
125 #define TB_FULL (sbp.next_tb_sample == MAX_TB_SAMPLES)
186 sbp.tb_armed = 1;
195 if (sbp.next_tb_sample < MAX_TB_SAMPLES) {
197 u64 *p = sbp.sbprof_tbbuf[sbp.next_tb_sample++];
219 if (!sbp.tb_enable) {
223 sbp.tb_armed = 0;
224 wake_up_interruptible(&sbp.tb_sync);
233 sbp.tb_armed = 0;
234 if (!sbp.tb_enable)
235 wake_up_interruptible(&sbp.tb_sync);
236 wake_up_interruptible(&sbp.tb_read);
258 if (xchg(&sbp.tb_enable, 1))
263 sbp.next_tb_sample = 0;
267 DEVNAME " trace freeze", &sbp);
283 if (request_irq(K_INT_PERF_CNT, sbprof_pc_intr, 0, DEVNAME " scd perfcnt", &sbp)) {
284 free_irq(K_INT_TRACE_FREEZE, &sbp);
366 if (sbp.tb_enable) {
373 err = wait_event_interruptible(sbp.tb_sync, !sbp.tb_armed);
379 sbp.tb_enable = 0;
380 free_irq(K_INT_TRACE_FREEZE, &sbp);
381 free_irq(K_INT_PERF_CNT, &sbp);
397 if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED)
400 memset(&sbp, 0, sizeof(struct sbprof_tb));
401 sbp.sbprof_tbbuf = vzalloc(MAX_TBSAMPLE_BYTES);
402 if (!sbp.sbprof_tbbuf) {
403 sbp.open = SB_CLOSED;
408 init_waitqueue_head(&sbp.tb_sync);
409 init_waitqueue_head(&sbp.tb_read);
410 mutex_init(&sbp.lock);
412 sbp.open = SB_OPEN;
423 if (minor != 0 || sbp.open != SB_CLOSED)
426 mutex_lock(&sbp.lock);
428 if (sbp.tb_armed || sbp.tb_enable)
431 vfree(sbp.sbprof_tbbuf);
432 sbp.open = SB_CLOSED;
435 mutex_unlock(&sbp.lock);
452 mutex_lock(&sbp.lock);
459 while (size && (cur_sample < sbp.next_tb_sample)) {
463 src = (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off);
467 mutex_unlock(&sbp.lock);
486 mutex_unlock(&sbp.lock);
499 mutex_lock(&sbp.lock);
501 mutex_unlock(&sbp.lock);
505 mutex_lock(&sbp.lock);
507 mutex_unlock(&sbp.lock);
511 err = wait_event_interruptible(sbp.tb_read, TB_FULL);
565 sbp.open = SB_CLOSED;