From: kettenis Date: Sun, 18 Aug 2024 10:50:22 +0000 (+0000) Subject: Some machines have more than one DCP, so apldcp(4) can attach multiple X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ff7b876d70f9189de5a50a2cd5e94953d53cde90;p=openbsd Some machines have more than one DCP, so apldcp(4) can attach multiple times. So make the task pool private to each instance to avoid initializing the pool again, which would panic the kernel. ok tobhe@ --- diff --git a/sys/dev/pci/drm/apple/apldcp.c b/sys/dev/pci/drm/apple/apldcp.c index 6ab379c6b5f..d64682cc598 100644 --- a/sys/dev/pci/drm/apple/apldcp.c +++ b/sys/dev/pci/drm/apple/apldcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apldcp.c,v 1.2 2024/07/12 10:01:28 tobhe Exp $ */ +/* $OpenBSD: apldcp.c,v 1.3 2024/08/18 10:50:22 kettenis Exp $ */ /* * Copyright (c) 2023 Mark Kettenis * @@ -115,14 +115,13 @@ struct apple_rtkit_ep { uint8_t ep; }; -static struct pool rtktask_pool; - struct apple_rtkit { struct rtkit_state *state; struct apple_rtkit_ep ep[64]; void *cookie; struct platform_device *pdev; const struct apple_rtkit_ops *ops; + struct pool task_pool; struct taskq *tq; }; @@ -181,7 +180,7 @@ apple_rtkit_do_recv(void *arg) struct apple_rtkit *rtk = rtkep->rtk; rtk->ops->recv_message(rtk->cookie, rtkep->ep, rtktask->msg); - pool_put(&rtktask_pool, rtktask); + pool_put(&rtk->task_pool, rtktask); } void @@ -191,7 +190,7 @@ apple_rtkit_recv(void *cookie, uint64_t msg) struct apple_rtkit *rtk = rtkep->rtk; struct apple_rtkit_task *rtktask; - rtktask = pool_get(&rtktask_pool, PR_NOWAIT | PR_ZERO); + rtktask = pool_get(&rtk->task_pool, PR_NOWAIT | PR_ZERO); KASSERT(rtktask != NULL); rtktask->rtkep = rtkep; @@ -251,7 +250,7 @@ devm_apple_rtkit_init(struct device *dev, void *cookie, return ERR_PTR(ENOMEM); } - pool_init(&rtktask_pool, sizeof(struct apple_rtkit_task), 0, IPL_TTY, + pool_init(&rtk->task_pool, sizeof(struct apple_rtkit_task), 0, IPL_TTY, 0, "apldcp_rtkit", NULL); rk = malloc(sizeof(*rk), M_DEVBUF, M_WAITOK | M_ZERO);