Lines Matching refs:sfb

96 	struct sf_buffer sfb;  member
109 struct sf_buffer sfb; /* Sampling buffer */ member
175 return !!cpuhw->sfb.sdbt; in sf_buffer_available()
181 static void free_sampling_buffer(struct sf_buffer *sfb) in free_sampling_buffer() argument
185 if (!sfb->sdbt) in free_sampling_buffer()
188 sdbt = sfb->sdbt; in free_sampling_buffer()
203 if (curr == sfb->sdbt) in free_sampling_buffer()
216 memset(sfb, 0, sizeof(*sfb)); in free_sampling_buffer()
248 static int realloc_sampling_buffer(struct sf_buffer *sfb, in realloc_sampling_buffer() argument
254 if (!sfb->sdbt || !sfb->tail) in realloc_sampling_buffer()
257 if (!is_link_entry(sfb->tail)) in realloc_sampling_buffer()
265 tail = sfb->tail; in realloc_sampling_buffer()
270 if (sfb->sdbt != get_next_sdbt(tail)) { in realloc_sampling_buffer()
272 __func__, (unsigned long)sfb->sdbt, in realloc_sampling_buffer()
287 sfb->num_sdbt++; in realloc_sampling_buffer()
307 sfb->num_sdbt--; in realloc_sampling_buffer()
313 sfb->num_sdb++; in realloc_sampling_buffer()
319 *tail = virt_to_phys(sfb->sdbt) + 1; in realloc_sampling_buffer()
320 sfb->tail = tail; in realloc_sampling_buffer()
336 static int alloc_sampling_buffer(struct sf_buffer *sfb, unsigned long num_sdb) in alloc_sampling_buffer() argument
340 if (sfb->sdbt) in alloc_sampling_buffer()
344 sfb->sdbt = (unsigned long *)get_zeroed_page(GFP_KERNEL); in alloc_sampling_buffer()
345 if (!sfb->sdbt) in alloc_sampling_buffer()
347 sfb->num_sdb = 0; in alloc_sampling_buffer()
348 sfb->num_sdbt = 1; in alloc_sampling_buffer()
353 sfb->tail = sfb->sdbt; in alloc_sampling_buffer()
354 *sfb->tail = virt_to_phys((void *)sfb->sdbt) + 1; in alloc_sampling_buffer()
357 rc = realloc_sampling_buffer(sfb, num_sdb, GFP_KERNEL); in alloc_sampling_buffer()
359 free_sampling_buffer(sfb); in alloc_sampling_buffer()
381 static unsigned long sfb_pending_allocs(struct sf_buffer *sfb, in sfb_pending_allocs() argument
384 if (!sfb->sdbt) in sfb_pending_allocs()
386 if (SFB_ALLOC_REG(hwc) > sfb->num_sdb) in sfb_pending_allocs()
387 return SFB_ALLOC_REG(hwc) - sfb->num_sdb; in sfb_pending_allocs()
407 if (cpuhw->sfb.sdbt) in deallocate_buffers()
408 free_sampling_buffer(&cpuhw->sfb); in deallocate_buffers()
459 return alloc_sampling_buffer(&cpuhw->sfb, in allocate_buffers()
460 sfb_pending_allocs(&cpuhw->sfb, hwc)); in allocate_buffers()
507 ratio = DIV_ROUND_UP(100 * OVERFLOW_REG(hwc) * cpuhw->sfb.num_sdb, in sfb_account_overflows()
511 num = compute_sfb_extent(ratio, cpuhw->sfb.num_sdb); in sfb_account_overflows()
529 static void extend_sampling_buffer(struct sf_buffer *sfb, in extend_sampling_buffer() argument
534 num = sfb_pending_allocs(sfb, hwc); in extend_sampling_buffer()
548 realloc_sampling_buffer(sfb, num, GFP_ATOMIC); in extend_sampling_buffer()
938 extend_sampling_buffer(&cpuhw->sfb, hwc); in cpumsf_pmu_enable()
1282 return i % aux->sfb.num_sdb; in aux_sdb_index()
1534 num_sdb = aux->sfb.num_sdb; in hw_collect_aux()
1563 "pages to overflow\n", aux->sfb.num_sdb); in hw_collect_aux()
1583 num_sdbt = aux->sfb.num_sdbt; in aux_buffer_free()
1620 struct sf_buffer *sfb; in aux_buffer_setup() local
1644 sfb = &aux->sfb; in aux_buffer_setup()
1658 sfb->num_sdbt = 0; in aux_buffer_setup()
1659 sfb->sdbt = (unsigned long *)get_zeroed_page(GFP_KERNEL); in aux_buffer_setup()
1660 if (!sfb->sdbt) in aux_buffer_setup()
1662 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)sfb->sdbt; in aux_buffer_setup()
1663 tail = sfb->tail = sfb->sdbt; in aux_buffer_setup()
1674 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)new; in aux_buffer_setup()
1684 sfb->num_sdb = nr_pages; in aux_buffer_setup()
1687 *tail = virt_to_phys(sfb->sdbt) + 1; in aux_buffer_setup()
1688 sfb->tail = tail; in aux_buffer_setup()
1695 aux->empty_mark = sfb->num_sdb - 1; in aux_buffer_setup()
1701 for (i = 0; i < sfb->num_sdbt; i++) in aux_buffer_setup()
1798 if (!SAMPL_DIAG_MODE(&event->hw) && !cpuhw->sfb.sdbt) in cpumsf_pmu_add()
1814 cpuhw->lsctl.tear = virt_to_phys(cpuhw->sfb.sdbt); in cpumsf_pmu_add()
1815 cpuhw->lsctl.dear = *(unsigned long *)cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1816 TEAR_REG(&event->hw) = (unsigned long)cpuhw->sfb.sdbt; in cpumsf_pmu_add()