Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp831056lqc; Fri, 8 Mar 2024 13:01:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmDpzEqZYwLn1eElWt3/S/NcRCahbPIrUFYLfkgdooVQ6jEP5KaaeRDiObkChSv/e/RdGEmLse8Lk63lkI0EQ+C6PMddOxfo2k5wcktQ== X-Google-Smtp-Source: AGHT+IEJQxFYm+819+x5UnW9h6B+1Mk+ABa0QDEGhM4PcAt7NxswovBQTPhnCySfiP4t8H4ymYzy X-Received: by 2002:a17:902:7844:b0:1db:e9ed:bbca with SMTP id e4-20020a170902784400b001dbe9edbbcamr188643pln.52.1709931692786; Fri, 08 Mar 2024 13:01:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709931692; cv=pass; d=google.com; s=arc-20160816; b=z04hRCqgLef/yBh1VFIT1TPmXSZBaXqo4FDvG29MNs9+p+/Zh7C/y6WVpHRa3PQHLX Aerzybljw9atQ8tv8ZYZsVQSbX6/j1GoZIQFwCxHZ2lvb4WFIzCOf5CPbLGQyxBt+nhm p8kjAHXa2UdKDuloxNk6QySPA+8UD1PpG/NNFL8HWK4ZAb5lKZtvrq37UI7ns8L4MTS1 S6kaxOU4RdlmWTV/OGbT++Db0QxqJrWKwJuv0iHjZs0iN2FDY2jzv9gQ931UTEZpLSCJ kRMbxx59kQtJ+g85+Bs49dzISlznCwWgVX1UmDGJ/tURbJMLKcmtfTSQ3SSLAEYwBT5c KFpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3TBItYHtNpx6y+be/gmPb27c0lB7KPRGke/Atz5DFWA=; fh=G9nh8K0oEG7DmsNBVUQGUVpXUbg67CleAK9fSTiph6g=; b=mJoZnWsoOxspuKeQK6PxTwWrPik+M6gneQLQeJGB5X7v99AJQBIAo0nZAjW1HeQv7g yBkQMhdP2irxQXigIST/FE+ghZe7WTDY7UDnWQ0PERXIRjBz7wCi2vKTyCz/puLuyLCK 5ZHQ+Ya0w/RrU9L/xS3lafdRGWkkKpAlIzb9c6VSgnNLCa/LVtTcxJidEG57h3hV0Vja wJ3rIJwV+xtxekxkLgoFgTu7PWsib9bd+Ywykh3FnRh7DjwUG/yL/+jRrr+ajBTz3Dpp bnW55RCyfcKdQ25uFsyBl8Zb6+Wpl9ZOx5Z45NM3221OoLX//WoKn/Bad4Y+eNP/bliZ 5HLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LM8CdNqT; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-97584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c11-20020a170903234b00b001dd707d5ff9si152455plh.370.2024.03.08.13.01.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 13:01:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LM8CdNqT; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-97584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97584-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 98AD7283924 for ; Fri, 8 Mar 2024 21:01:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FF31604B3; Fri, 8 Mar 2024 21:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="LM8CdNqT" Received: from out-175.mta1.migadu.com (out-175.mta1.migadu.com [95.215.58.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B0AF5FB90 for ; Fri, 8 Mar 2024 21:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709931647; cv=none; b=X6Zp2AprlCl25MZQFxaWYvKdCtBVHyzhqnpAYN754QUZuP84nOHcnDT+WuaJu3fgLu2P6j9/2ksZfCsQHzPRXxtL5om02IS4uEoFfi/HzvOkrFre4Los9rWjGjb90QAi22pL6hl5w9ONiUSLWARQN7tiKaY12rGNpwYqJl65DpM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709931647; c=relaxed/simple; bh=PfOtw4OihwZuOwZcHtxjLP/RlXrLSDvq77dCrKgYKKo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rOlAR7StUGeA05wvWcw/Mm5tEei16NKI+MC7ksHMXVRNtfJW7Bh4x48fp3klBPdH9cTcF2C1flsV6Pt03UZNdLJIHIV6iobo4TpxtxhrXMdXaLPZvzhjYKMbmE5CNVlAYApaQ6WZqhT9S76iy2NlX3Fds5bv6HnsHvJk1Rvo6s0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=LM8CdNqT; arc=none smtp.client-ip=95.215.58.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709931644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3TBItYHtNpx6y+be/gmPb27c0lB7KPRGke/Atz5DFWA=; b=LM8CdNqT0MBTgf9TwPay3IyWuxlOK352de/uQ2LfvOQ3j0wQXrJxi6XmPm08hhqA1uqcXP o+r16RKkbia3KozpbmnzKugqodpFmc7a3+mgAuXVKMtSv1LFI32Vm09Omv+pWAL0MJPPEH T071LojHi+2P2g3dsvDAjfrKbdfkfb4= From: Sean Anderson To: Laurent Pinchart , Vinod Koul , dmaengine@vger.kernel.org Cc: Michal Simek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Anderson Subject: [PATCH 3/3] dma: Add lockdep asserts to virt-dma Date: Fri, 8 Mar 2024 16:00:34 -0500 Message-Id: <20240308210034.3634938-4-sean.anderson@linux.dev> In-Reply-To: <20240308210034.3634938-1-sean.anderson@linux.dev> References: <20240308210034.3634938-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Add lockdep asserts to all functions with "vc.lock must be held by caller" in their documentation. This will help catch cases where these assumptions do not hold. Signed-off-by: Sean Anderson --- drivers/dma/virt-dma.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index e9f5250fbe4d..59d9eabc8b67 100644 --- a/drivers/dma/virt-dma.h +++ b/drivers/dma/virt-dma.h @@ -81,6 +81,8 @@ static inline struct dma_async_tx_descriptor *vchan_tx_prep(struct virt_dma_chan */ static inline bool vchan_issue_pending(struct virt_dma_chan *vc) { + lockdep_assert_held(&vc->lock); + list_splice_tail_init(&vc->desc_submitted, &vc->desc_issued); return !list_empty(&vc->desc_issued); } @@ -96,6 +98,8 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd) struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan); dma_cookie_t cookie; + lockdep_assert_held(&vc->lock); + cookie = vd->tx.cookie; dma_cookie_complete(&vd->tx); dev_vdbg(vc->chan.device->dev, "txd %p[%x]: marked complete\n", @@ -146,6 +150,8 @@ static inline void vchan_terminate_vdesc(struct virt_dma_desc *vd) { struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan); + lockdep_assert_held(&vc->lock); + list_add_tail(&vd->node, &vc->desc_terminated); if (vc->cyclic == vd) @@ -160,6 +166,8 @@ static inline void vchan_terminate_vdesc(struct virt_dma_desc *vd) */ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) { + lockdep_assert_held(&vc->lock); + return list_first_entry_or_null(&vc->desc_issued, struct virt_dma_desc, node); } @@ -177,6 +185,8 @@ static inline struct virt_dma_desc *vchan_next_desc(struct virt_dma_chan *vc) static inline void vchan_get_all_descriptors(struct virt_dma_chan *vc, struct list_head *head) { + lockdep_assert_held(&vc->lock); + list_splice_tail_init(&vc->desc_allocated, head); list_splice_tail_init(&vc->desc_submitted, head); list_splice_tail_init(&vc->desc_issued, head); -- 2.35.1.1320.gc452695387.dirty