Lines Matching refs:sfb
79 struct sf_buffer sfb; member
92 struct sf_buffer sfb; /* Sampling buffer */ member
118 return !!cpuhw->sfb.sdbt; in sf_buffer_available()
124 static void free_sampling_buffer(struct sf_buffer *sfb) in free_sampling_buffer() argument
128 if (!sfb->sdbt) in free_sampling_buffer()
131 sdbt = sfb->sdbt; in free_sampling_buffer()
146 if (curr == sfb->sdbt) in free_sampling_buffer()
160 (unsigned long)sfb->sdbt); in free_sampling_buffer()
161 memset(sfb, 0, sizeof(*sfb)); in free_sampling_buffer()
192 static int realloc_sampling_buffer(struct sf_buffer *sfb, in realloc_sampling_buffer() argument
198 if (!sfb->sdbt || !sfb->tail) in realloc_sampling_buffer()
201 if (!is_link_entry(sfb->tail)) in realloc_sampling_buffer()
209 tail = sfb->tail; in realloc_sampling_buffer()
214 if (sfb->sdbt != get_next_sdbt(tail)) { in realloc_sampling_buffer()
218 (unsigned long)sfb->sdbt, in realloc_sampling_buffer()
233 sfb->num_sdbt++; in realloc_sampling_buffer()
253 sfb->num_sdbt--; in realloc_sampling_buffer()
259 sfb->num_sdb++; in realloc_sampling_buffer()
265 *tail = (unsigned long) sfb->sdbt + 1; in realloc_sampling_buffer()
266 sfb->tail = tail; in realloc_sampling_buffer()
270 sfb->num_sdbt, sfb->num_sdb); in realloc_sampling_buffer()
285 static int alloc_sampling_buffer(struct sf_buffer *sfb, unsigned long num_sdb) in alloc_sampling_buffer() argument
289 if (sfb->sdbt) in alloc_sampling_buffer()
293 sfb->sdbt = (unsigned long *) get_zeroed_page(GFP_KERNEL); in alloc_sampling_buffer()
294 if (!sfb->sdbt) in alloc_sampling_buffer()
296 sfb->num_sdb = 0; in alloc_sampling_buffer()
297 sfb->num_sdbt = 1; in alloc_sampling_buffer()
302 sfb->tail = sfb->sdbt; in alloc_sampling_buffer()
303 *sfb->tail = (unsigned long)(void *) sfb->sdbt + 1; in alloc_sampling_buffer()
306 rc = realloc_sampling_buffer(sfb, num_sdb, GFP_KERNEL); in alloc_sampling_buffer()
308 free_sampling_buffer(sfb); in alloc_sampling_buffer()
315 (unsigned long)sfb->sdbt, (unsigned long)*sfb->sdbt); in alloc_sampling_buffer()
337 static unsigned long sfb_pending_allocs(struct sf_buffer *sfb, in sfb_pending_allocs() argument
340 if (!sfb->sdbt) in sfb_pending_allocs()
342 if (SFB_ALLOC_REG(hwc) > sfb->num_sdb) in sfb_pending_allocs()
343 return SFB_ALLOC_REG(hwc) - sfb->num_sdb; in sfb_pending_allocs()
347 static int sfb_has_pending_allocs(struct sf_buffer *sfb, in sfb_has_pending_allocs() argument
350 return sfb_pending_allocs(sfb, hwc) > 0; in sfb_has_pending_allocs()
369 if (cpuhw->sfb.sdbt) in deallocate_buffers()
370 free_sampling_buffer(&cpuhw->sfb); in deallocate_buffers()
429 return alloc_sampling_buffer(&cpuhw->sfb, in allocate_buffers()
430 sfb_pending_allocs(&cpuhw->sfb, hwc)); in allocate_buffers()
477 ratio = DIV_ROUND_UP(100 * OVERFLOW_REG(hwc) * cpuhw->sfb.num_sdb, in sfb_account_overflows()
481 num = compute_sfb_extent(ratio, cpuhw->sfb.num_sdb); in sfb_account_overflows()
501 static void extend_sampling_buffer(struct sf_buffer *sfb, in extend_sampling_buffer() argument
507 num = sfb_pending_allocs(sfb, hwc); in extend_sampling_buffer()
510 num_old = sfb->num_sdb; in extend_sampling_buffer()
522 rc = realloc_sampling_buffer(sfb, num, GFP_ATOMIC); in extend_sampling_buffer()
527 if (sfb_has_pending_allocs(sfb, hwc)) in extend_sampling_buffer()
530 __func__, num, sfb->num_sdb - num_old, in extend_sampling_buffer()
531 sfb_pending_allocs(sfb, hwc)); in extend_sampling_buffer()
972 extend_sampling_buffer(&cpuhw->sfb, hwc); in cpumsf_pmu_enable()
1347 #define AUX_SDB_INDEX(aux, i) ((i) % aux->sfb.num_sdb)
1602 num_sdb = aux->sfb.num_sdb; in hw_collect_aux()
1634 "pages to overflow\n", aux->sfb.num_sdb); in hw_collect_aux()
1666 num_sdbt = aux->sfb.num_sdbt; in aux_buffer_free()
1705 struct sf_buffer *sfb; in aux_buffer_setup() local
1729 sfb = &aux->sfb; in aux_buffer_setup()
1743 sfb->num_sdbt = 0; in aux_buffer_setup()
1744 sfb->sdbt = (unsigned long *) get_zeroed_page(GFP_KERNEL); in aux_buffer_setup()
1745 if (!sfb->sdbt) in aux_buffer_setup()
1747 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)sfb->sdbt; in aux_buffer_setup()
1748 tail = sfb->tail = sfb->sdbt; in aux_buffer_setup()
1759 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)new; in aux_buffer_setup()
1769 sfb->num_sdb = nr_pages; in aux_buffer_setup()
1772 *tail = (unsigned long) sfb->sdbt + 1; in aux_buffer_setup()
1773 sfb->tail = tail; in aux_buffer_setup()
1780 aux->empty_mark = sfb->num_sdb - 1; in aux_buffer_setup()
1783 sfb->num_sdbt, sfb->num_sdb); in aux_buffer_setup()
1789 for (i = 0; i < sfb->num_sdbt; i++) in aux_buffer_setup()
1895 if (!SAMPL_DIAG_MODE(&event->hw) && !cpuhw->sfb.sdbt) in cpumsf_pmu_add()
1912 cpuhw->lsctl.tear = (unsigned long) cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1913 cpuhw->lsctl.dear = *(unsigned long *) cpuhw->sfb.sdbt; in cpumsf_pmu_add()
1914 TEAR_REG(&event->hw) = (unsigned long) cpuhw->sfb.sdbt; in cpumsf_pmu_add()