MCPcopy Create free account
hub / github.com/F-Stack/f-stack / taskqgroup_attach_cpu

Function taskqgroup_attach_cpu

freebsd/kern/subr_gtaskqueue.c:699–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699int
700taskqgroup_attach_cpu(struct taskqgroup *qgroup, struct grouptask *gtask,
701 void *uniq, int cpu, device_t dev, struct resource *irq, const char *name)
702{
703 int i, qid, error;
704
705 gtask->gt_uniq = uniq;
706 snprintf(gtask->gt_name, GROUPTASK_NAMELEN, "%s", name ? name : "grouptask");
707 gtask->gt_dev = dev;
708 gtask->gt_irq = irq;
709 gtask->gt_cpu = cpu;
710 mtx_lock(&qgroup->tqg_lock);
711 for (i = 0, qid = -1; i < qgroup->tqg_cnt; i++)
712 if (qgroup->tqg_queue[i].tgc_cpu == cpu) {
713 qid = i;
714 break;
715 }
716 if (qid == -1) {
717 mtx_unlock(&qgroup->tqg_lock);
718 printf("%s: qid not found for %s cpu=%d\n", __func__, gtask->gt_name, cpu);
719 return (EINVAL);
720 }
721 qgroup->tqg_queue[qid].tgc_cnt++;
722 LIST_INSERT_HEAD(&qgroup->tqg_queue[qid].tgc_tasks, gtask, gt_list);
723 gtask->gt_taskqueue = qgroup->tqg_queue[qid].tgc_taskq;
724 cpu = qgroup->tqg_queue[qid].tgc_cpu;
725 mtx_unlock(&qgroup->tqg_lock);
726
727 if (dev != NULL && irq != NULL) {
728 error = bus_bind_intr(dev, irq, cpu);
729 if (error)
730 printf("%s: binding interrupt failed for %s: %d\n",
731 __func__, gtask->gt_name, error);
732 }
733 return (0);
734}
735
736void
737taskqgroup_detach(struct taskqgroup *qgroup, struct grouptask *gtask)

Callers 3

epoch_initFunction · 0.85
iflib_irq_set_affinityFunction · 0.85
iflib_io_tqg_attachFunction · 0.85

Calls 5

snprintfFunction · 0.85
bus_bind_intrFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
printfFunction · 0.70

Tested by

no test coverage detected