Lines Matching refs:psb
673 pfm_smpl_buffer_desc_t *psb = (pfm_smpl_buffer_desc_t *)vma->vm_private_data; in pfm_vm_close() local
675 if (psb == NULL) { in pfm_vm_close()
706 LOCK_PSB(psb); in pfm_vm_close()
708 if (psb->psb_refcnt == 0) { in pfm_vm_close()
710 psb->psb_next = current->thread.pfm_smpl_buf_list; in pfm_vm_close()
711 current->thread.pfm_smpl_buf_list = psb; in pfm_vm_close()
714 current->pid, psb->psb_hdr, psb->psb_size, psb->psb_flags)); in pfm_vm_close()
717 current->pid, psb->psb_flags, psb->psb_hdr, psb->psb_size)); in pfm_vm_close()
721 psb->psb_flags &= ~PSB_HAS_VMA; in pfm_vm_close()
723 UNLOCK_PSB(psb); in pfm_vm_close()
734 pfm_smpl_buffer_desc_t *psb; in pfm_remove_smpl_mapping() local
744 psb = ctx->ctx_psb; in pfm_remove_smpl_mapping()
748 r = do_munmap(task->mm, ctx->ctx_smpl_vaddr, psb->psb_size); in pfm_remove_smpl_mapping()
753 "@0x%lx size=%ld\n", task->pid, ctx->ctx_smpl_vaddr, psb->psb_size); in pfm_remove_smpl_mapping()
757 task->pid, ctx->ctx_smpl_vaddr, psb->psb_size, r, psb->psb_refcnt, psb->psb_flags)); in pfm_remove_smpl_mapping()
834 pfm_smpl_buffer_desc_t *psb; in pfm_smpl_buffer_alloc() local
879 psb = kmalloc(sizeof(*psb), GFP_KERNEL); in pfm_smpl_buffer_alloc()
880 if (psb == NULL) { in pfm_smpl_buffer_alloc()
907 vma->vm_private_data = psb; /* information needed by the pfm_vm_close() function */ in pfm_smpl_buffer_alloc()
914 psb->psb_hdr = smpl_buf; in pfm_smpl_buffer_alloc()
915 psb->psb_addr = ((char *)smpl_buf)+sizeof(perfmon_smpl_hdr_t); /* first entry */ in pfm_smpl_buffer_alloc()
916 psb->psb_size = size; /* aligned size */ in pfm_smpl_buffer_alloc()
917 psb->psb_index = 0; in pfm_smpl_buffer_alloc()
918 psb->psb_entries = entries; in pfm_smpl_buffer_alloc()
919 psb->psb_refcnt = 1; in pfm_smpl_buffer_alloc()
920 psb->psb_flags = PSB_HAS_VMA; in pfm_smpl_buffer_alloc()
922 spin_lock_init(&psb->psb_lock); in pfm_smpl_buffer_alloc()
928 psb->psb_entry_size = sizeof(perfmon_smpl_entry_t) + regcount*sizeof(u64); in pfm_smpl_buffer_alloc()
931 (void *)psb,psb->psb_entry_size, (void *)psb->psb_hdr, in pfm_smpl_buffer_alloc()
932 (void *)psb->psb_addr, psb->psb_refcnt, psb->psb_flags)); in pfm_smpl_buffer_alloc()
935 psb->psb_hdr->hdr_version = PFM_SMPL_VERSION; in pfm_smpl_buffer_alloc()
936 psb->psb_hdr->hdr_entry_size = psb->psb_entry_size; in pfm_smpl_buffer_alloc()
937 psb->psb_hdr->hdr_pmds[0] = which_pmds[0]; in pfm_smpl_buffer_alloc()
981 ctx->ctx_psb = psb; in pfm_smpl_buffer_alloc()
993 kfree(psb); in pfm_smpl_buffer_alloc()
2846 pfm_smpl_buffer_desc_t *psb = ctx->ctx_psb; in pfm_record_sample() local
2851 idx = ia64_fetch_and_add(1, &psb->psb_index); in pfm_record_sample()
2852 DBprintk_ovfl(("recording index=%ld entries=%ld\n", idx-1, psb->psb_entries)); in pfm_record_sample()
2862 if (idx > psb->psb_entries) return 0; in pfm_record_sample()
2867 h = (perfmon_smpl_entry_t *)(((char *)psb->psb_addr) + idx*(psb->psb_entry_size)); in pfm_record_sample()
2905 ia64_fetch_and_add(1, &psb->psb_hdr->hdr_count); in pfm_record_sample()
2908 idx, psb->psb_entries, psb->psb_hdr->hdr_count)); in pfm_record_sample()
2912 if (idx == (psb->psb_entries-1)) { in pfm_record_sample()
4194 pfm_smpl_buffer_desc_t *psb = ctx->ctx_psb; in pfm_context_exit() local
4196 LOCK_PSB(psb); in pfm_context_exit()
4200 psb->psb_hdr, psb->psb_size, psb->psb_refcnt, psb->psb_flags)); in pfm_context_exit()
4206 psb->psb_refcnt--; in pfm_context_exit()
4208 if (psb->psb_refcnt == 0) { in pfm_context_exit()
4223 if ((psb->psb_flags & PSB_HAS_VMA) == 0) { in pfm_context_exit()
4227 psb->psb_hdr, psb->psb_size)); in pfm_context_exit()
4232 pfm_rvfree(psb->psb_hdr, psb->psb_size); in pfm_context_exit()
4233 kfree(psb); in pfm_context_exit()
4234 psb = NULL; in pfm_context_exit()
4238 if (psb) UNLOCK_PSB(psb); in pfm_context_exit()
4312 pfm_smpl_buffer_desc_t *tmp, *psb = task->thread.pfm_smpl_buf_list; in pfm_cleanup_smpl_buf() local
4314 if (psb == NULL) { in pfm_cleanup_smpl_buf()
4321 while (psb) { in pfm_cleanup_smpl_buf()
4322 DBprintk(("[%d] freeing smpl @%p size %ld\n", current->pid, psb->psb_hdr, psb->psb_size)); in pfm_cleanup_smpl_buf()
4324 pfm_rvfree(psb->psb_hdr, psb->psb_size); in pfm_cleanup_smpl_buf()
4325 tmp = psb->psb_next; in pfm_cleanup_smpl_buf()
4326 kfree(psb); in pfm_cleanup_smpl_buf()
4327 psb = tmp; in pfm_cleanup_smpl_buf()