Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp66033lqo; Wed, 27 Mar 2024 07:08:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBJ0ej8aWRN7EuWoZ7AxxH3diE0LGpSgCsKTXiC6kVM4tfKEv5znPiXRyl78Mnu54f8vdmBZ3G2IpvlQzM0DLjzekYf9mbxtOEdcCBBQ== X-Google-Smtp-Source: AGHT+IGkB01MphQ3SoIXpxOWippC/jg48BKEI6pUTkZaGzxIYEtxno2MYxEBSMgTdoIVuiQyRtg9 X-Received: by 2002:a19:7715:0:b0:513:e8a0:2d85 with SMTP id s21-20020a197715000000b00513e8a02d85mr2163118lfc.44.1711548536660; Wed, 27 Mar 2024 07:08:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711548536; cv=pass; d=google.com; s=arc-20160816; b=oKV3g1neRwcENGJqpLNN4ErKKfByfpGoccGyv4cpvEDOtYdGOcdDjeQExm0WP/R9UU EjVVDMyPgbsgRCRd2RvDH9MsvkrVnEUp8h6iyzC8l9x94/QqDaOsQJQsANFSRg2W9Q9n N2YEcPnpSPSeC5CQw0wAET08xI7+tM7Sy7ErQYSnEX7/zoMSstPp1EYqROmqxQ3pGbY2 0jsxO54JZQbKz+XxQqO5h4gv6zfU4oQvIiN3FJCOIVLTIxW0frEC13PeOKTTHntIEm6D J2TYUvR7NQndq99JkOK4tC2HPegPceU8yJ3562KtnqFOZozZICq9drXooUnghxZW80j7 DJJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=55Q5SpsZElVWKZr9SB1NRXT+WiEln+MZmh1au090Uyc=; fh=RDRrVsUVXA4qAJq0ECihFtdoUEKtxeKw0pFylLd9V5w=; b=Ndu0Ewo/hFdHfLzTUbQdYYwWoYvZQn+p4l6Ikbnwyaa9hZUGDTZ/gdrOkyptcsObfv v24bT99Hbj2qMWyXXhWTHtyzaYaqsRSYR5Lmlh0B5QmZDRJg+Drd0GHcSSnjnXgAeAjJ TFTCSV6195AcwNand3iNn48ujsRcmxCIS8WHAqBSqukzJzTGXiK5YUuJChN0IUhG2eCf t5tlIeFDSLF8TYBkcBGkQR+vCOlaTWiSqS27DTKJAElJ6N3I4DLTBqjeb6eeOKL76cIV lm5GmPhmDoJpsV/d1aejwUmplpVdqWbaa9AM4EDGsM74368pXwdxpwDWViqHOstRAskR 4VFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Y6U0j+OF; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-121281-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121281-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id pv14-20020a170907208e00b00a4dfe6567f2si956019ejb.368.2024.03.27.07.08.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 07:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121281-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Y6U0j+OF; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-121281-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121281-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5FDD01F2758A for ; Wed, 27 Mar 2024 14:08:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D71781BD5E4; Wed, 27 Mar 2024 12:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Y6U0j+OF" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 3F199130E26; Wed, 27 Mar 2024 12:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542548; cv=none; b=Tw/iOa/8uOggQaCwblsebKzAV/egqdOMxtBaYH4RsyT51yNl318X4S02affT/5jhLxwgBXKzxiT4TX/ov3zi7V7RUQpEDdDeC2jlivQ3n6NQQats4A/kLkQR3VEurO4ua8HqPs4JUcpVTYK5eJT9l00KSo6B6OtHJjz8wqBJ92Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542548; c=relaxed/simple; bh=CO5GH4EA8whWcoaMAqHIvlMBS85gT/fzeKfIasWL0u4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Nx2GuC8AGoqsOyrvF0Gq10GXvbhkpRA0V+0svAweb2rGZhwWYg4PR9luow6WN+lzK3F7HbEyznJh1KrZLSSTTgXHvHtDgZAViiVkPwkSBcUJ+IMAExxOvbd2LrOeAUjDRL42xmj5j5VJxqjA4Ho0+twwy8a6REhMG+NClBdudCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Y6U0j+OF; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.88.20] (91-154-34-181.elisa-laajakaista.fi [91.154.34.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D157F1803; Wed, 27 Mar 2024 13:28:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1711542513; bh=CO5GH4EA8whWcoaMAqHIvlMBS85gT/fzeKfIasWL0u4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Y6U0j+OFBoERo4NLXOKKaj2rQdhlzROnRmG0SPXr0BzC8cPgxX5eLyopVOCtZ6Fg1 PdY2shE1BVORLLodPIwDAcXWP69d0OZeMT+rgHTlw+QeUn/nzAYXhlfCy4qxAFWDop 6QEAlXuKLNUlooSiAoK7/AfWsIUZNemcLT3rMPlA= Message-ID: Date: Wed, 27 Mar 2024 14:29:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/3] dma: Add lockdep asserts to virt-dma Content-Language: en-US To: Sean Anderson Cc: Michal Simek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Laurent Pinchart , dmaengine@vger.kernel.org, Vinod Koul References: <20240308210034.3634938-1-sean.anderson@linux.dev> <20240308210034.3634938-4-sean.anderson@linux.dev> From: Tomi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K+Ygd56mV3lq0aFdwbaX16DG22c6flkkBSjyWXYepFtHz9KsBS0DaZb 4IkLmZwEXpZcIOQjQ71fqlpiXkXSIaQ6YMEs8WjBbpP81h7QxWIfWtp+VnwNGc6nq5IQDESH mvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe 9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S suYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq xKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII m9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU CH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B CFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof 92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a ueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F yjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw== In-Reply-To: <20240308210034.3634938-4-sean.anderson@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/03/2024 23:00, Sean Anderson wrote: > 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 > --- Reviewed-by: Tomi Valkeinen Tomi > 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);