Lines Matching refs:d
52 mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m,
55 cat_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r);
57 mba_wrmsr_amd(struct rdt_domain *d, struct msr_param *m,
363 mba_wrmsr_amd(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) in mba_wrmsr_amd() argument
368 wrmsrl(r->msr_base + i, d->ctrl_val[i]); in mba_wrmsr_amd()
386 mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m, in mba_wrmsr_intel() argument
393 wrmsrl(r->msr_base + i, delay_bw_map(d->ctrl_val[i], r)); in mba_wrmsr_intel()
397 cat_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) in cat_wrmsr() argument
402 wrmsrl(r->msr_base + cbm_idx(r, i), d->ctrl_val[i]); in cat_wrmsr()
407 struct rdt_domain *d; in get_domain_from_cpu() local
409 list_for_each_entry(d, &r->domains, list) { in get_domain_from_cpu()
411 if (cpumask_test_cpu(cpu, &d->cpu_mask)) in get_domain_from_cpu()
412 return d; in get_domain_from_cpu()
423 struct rdt_domain *d; in rdt_ctrl_update() local
425 d = get_domain_from_cpu(cpu, r); in rdt_ctrl_update()
426 if (d) { in rdt_ctrl_update()
427 r->msr_update(d, m, r); in rdt_ctrl_update()
445 struct rdt_domain *d; in rdt_find_domain() local
452 d = list_entry(l, struct rdt_domain, list); in rdt_find_domain()
454 if (id == d->id) in rdt_find_domain()
455 return d; in rdt_find_domain()
457 if (id < d->id) in rdt_find_domain()
483 static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d) in domain_setup_ctrlval() argument
488 dc = kmalloc_array(r->num_closid, sizeof(*d->ctrl_val), GFP_KERNEL); in domain_setup_ctrlval()
492 dm = kmalloc_array(r->num_closid, sizeof(*d->mbps_val), GFP_KERNEL); in domain_setup_ctrlval()
498 d->ctrl_val = dc; in domain_setup_ctrlval()
499 d->mbps_val = dm; in domain_setup_ctrlval()
504 r->msr_update(d, &m, r); in domain_setup_ctrlval()
508 static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d) in domain_setup_mon_state() argument
513 d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL); in domain_setup_mon_state()
514 if (!d->rmid_busy_llc) in domain_setup_mon_state()
516 INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo); in domain_setup_mon_state()
519 tsize = sizeof(*d->mbm_total); in domain_setup_mon_state()
520 d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL); in domain_setup_mon_state()
521 if (!d->mbm_total) { in domain_setup_mon_state()
522 bitmap_free(d->rmid_busy_llc); in domain_setup_mon_state()
527 tsize = sizeof(*d->mbm_local); in domain_setup_mon_state()
528 d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL); in domain_setup_mon_state()
529 if (!d->mbm_local) { in domain_setup_mon_state()
530 bitmap_free(d->rmid_busy_llc); in domain_setup_mon_state()
531 kfree(d->mbm_total); in domain_setup_mon_state()
537 INIT_DELAYED_WORK(&d->mbm_over, mbm_handle_overflow); in domain_setup_mon_state()
538 mbm_setup_overflow_handler(d, MBM_OVERFLOW_INTERVAL); in domain_setup_mon_state()
561 struct rdt_domain *d; in domain_add_cpu() local
563 d = rdt_find_domain(r, id, &add_pos); in domain_add_cpu()
564 if (IS_ERR(d)) { in domain_add_cpu()
569 if (d) { in domain_add_cpu()
570 cpumask_set_cpu(cpu, &d->cpu_mask); in domain_add_cpu()
574 d = kzalloc_node(sizeof(*d), GFP_KERNEL, cpu_to_node(cpu)); in domain_add_cpu()
575 if (!d) in domain_add_cpu()
578 d->id = id; in domain_add_cpu()
579 cpumask_set_cpu(cpu, &d->cpu_mask); in domain_add_cpu()
581 if (r->alloc_capable && domain_setup_ctrlval(r, d)) { in domain_add_cpu()
582 kfree(d); in domain_add_cpu()
586 if (r->mon_capable && domain_setup_mon_state(r, d)) { in domain_add_cpu()
587 kfree(d); in domain_add_cpu()
591 list_add_tail(&d->list, add_pos); in domain_add_cpu()
598 mkdir_mondata_subdir_allrdtgrp(r, d); in domain_add_cpu()
604 struct rdt_domain *d; in domain_remove_cpu() local
606 d = rdt_find_domain(r, id, NULL); in domain_remove_cpu()
607 if (IS_ERR_OR_NULL(d)) { in domain_remove_cpu()
612 cpumask_clear_cpu(cpu, &d->cpu_mask); in domain_remove_cpu()
613 if (cpumask_empty(&d->cpu_mask)) { in domain_remove_cpu()
619 rmdir_mondata_subdir_allrdtgrp(r, d->id); in domain_remove_cpu()
620 list_del(&d->list); in domain_remove_cpu()
622 cancel_delayed_work(&d->mbm_over); in domain_remove_cpu()
623 if (is_llc_occupancy_enabled() && has_busy_rmid(r, d)) { in domain_remove_cpu()
632 __check_limbo(d, true); in domain_remove_cpu()
633 cancel_delayed_work(&d->cqm_limbo); in domain_remove_cpu()
640 if (d->plr) in domain_remove_cpu()
641 d->plr->d = NULL; in domain_remove_cpu()
643 kfree(d->ctrl_val); in domain_remove_cpu()
644 kfree(d->mbps_val); in domain_remove_cpu()
645 bitmap_free(d->rmid_busy_llc); in domain_remove_cpu()
646 kfree(d->mbm_total); in domain_remove_cpu()
647 kfree(d->mbm_local); in domain_remove_cpu()
648 kfree(d); in domain_remove_cpu()
653 if (is_mbm_enabled() && cpu == d->mbm_work_cpu) { in domain_remove_cpu()
654 cancel_delayed_work(&d->mbm_over); in domain_remove_cpu()
655 mbm_setup_overflow_handler(d, 0); in domain_remove_cpu()
657 if (is_llc_occupancy_enabled() && cpu == d->cqm_work_cpu && in domain_remove_cpu()
658 has_busy_rmid(r, d)) { in domain_remove_cpu()
659 cancel_delayed_work(&d->cqm_limbo); in domain_remove_cpu()
660 cqm_setup_limbo_handler(d, 0); in domain_remove_cpu()