Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1732516pxa; Thu, 20 Aug 2020 20:17:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDXB3+aGpnyvvpCLA9pfn2yPmOCcTxgYCcwmgWNJmy+ioJ43r1DZCDmcca52WXa9hJkq8d X-Received: by 2002:a17:906:4f8f:: with SMTP id o15mr926542eju.220.1597979846314; Thu, 20 Aug 2020 20:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597979846; cv=none; d=google.com; s=arc-20160816; b=kOysjcC2yyHo2qYVNd21UkZWnNSca3juP1DV4LlZTTiiRyh8OoHtqWUNZe0e8bEi+1 INcCAynvCeRZqpqqxoaMJZZ9dgKNXtQpv302ox/G8JhswDww1y6b/gixy0rF81im3MC7 CmHItwrkrhTlNv6rQcXgcrtzm4KZ2qbqDsE/oXLyiDnCmEFGAQKEyuJmTadoFIFEgaEr hLLLaUqjDae1Rq46J0czxBgoTL+5tlNuI4jPPEji3tORR0CUBcD771YBhuuL8DE8FY+t 7mifkTotrTvfJ12gpGjH3farTw92IkkB5/6SLtYDD8XF5/NROBq8YmkqEkAQWnE9M50p mFGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:date:from:dkim-signature; bh=zuSfrbRroXjdvycDvIKeih7mu1rrI15reoeLUG4u7xg=; b=clpM744GdaEqdjc4pJ/f6dbxQou6vMn7cXZ6nN8FodXalDqU6e6oKpdx8hLE5+Z9AH hNbPr2awn8heDZGDXd0EbUPF7Se6dwlT/zo9Ub5sMNZ6c3DZUxcCb0JtC3mvFz5TP8Nb 6rAE8enC4h3Ihr42mcCY7lP1xhYDBvqjNa7X7WTelDNe+YCrB/n13Z9TylA5RkPvQMM2 YGXcolCDyrGJKhimfbfyLFggbOICWP0MsaI1nICCUqRVMQtefYuRro+tS5H3uv/CsKoR Qcryn09yxHPXeqWkQb/2o/dxepZ8r5wkz7dntDZT8CdNA6T6awHEhg5LgNR5etH55278 Fg4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="MO/bFuRi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si333259ejc.440.2020.08.20.20.17.03; Thu, 20 Aug 2020 20:17:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="MO/bFuRi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727791AbgHUDQY (ORCPT + 99 others); Thu, 20 Aug 2020 23:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbgHUDQX (ORCPT ); Thu, 20 Aug 2020 23:16:23 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0339C061385; Thu, 20 Aug 2020 20:16:22 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id x6so323097pgx.12; Thu, 20 Aug 2020 20:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=zuSfrbRroXjdvycDvIKeih7mu1rrI15reoeLUG4u7xg=; b=MO/bFuRiKH6hf5dJApCZCir/8evOymPRRUSN+uJy3KDAIjWRhxKu+ebYmc2P2q+bCr daLgzJQPaQQZWr2W95guKOrpFvLaQE6scTY00kbhjNVKJKfvHAqxait9qGYLNFbbAmxg utGtWnrOBuYtGQPMb2y6lCDdg1tO308bit4SPmgYxef+gvKzslF5m1H+zRbGNFKi1t0F yU2I4dEntx+5GQjyu/UiaB7Ya8XLBkTV+HoCCQKowT0wRbtVmSAX05olaPYOH0H3doJ8 /gnkbBJ5N16n5PWkthfMHcQSasfkFE5s8b4p2I+DVo7Mx6jWeC6Z5/9bZbYpoSwX36ej MXyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=zuSfrbRroXjdvycDvIKeih7mu1rrI15reoeLUG4u7xg=; b=NExE8Qm3lKKHdAI7pc2cFFNGq2XxiAJoWOpgwKJ+bTC7Zvyx1X9FmxrqqVHV8Mksnj 2jAwaB9x4amlBVjjefX48zgx/qA9fxyuO+SePMHFIO9eMOi+1lNCPV/ztwMz2hIuwVkC wTds58a4S02qYRjWGV5mBtkXvaQMcoGAhQuhFCzK0ACIPr0A8bZLHfHhsO1KAQBLpB1H VeLMYcIN8cmBMut6chJ+P3dTfOyZXoXqx3ZEikmmumVE9aP3WvwFC8KR97hIElMKv2R3 S5w5q3V0iPBRMM6ZtULfBNmANUdbgBkzMjM1QdtT6cwIRbDVgULeUlzoJdkjnWiNN1Vm 0KFA== X-Gm-Message-State: AOAM530fjA3SPQV1SrVrCsVjuIRBaVizuLO7V8cMz3YTh7k8lLZoarNP r6gcHS0n+hxTfyYph/uc9A== X-Received: by 2002:a63:e747:: with SMTP id j7mr846297pgk.107.1597979782380; Thu, 20 Aug 2020 20:16:22 -0700 (PDT) Received: from madhuparna-HP-Notebook ([2402:3a80:cfa:ca54:b051:6744:d734:a674]) by smtp.gmail.com with ESMTPSA id y1sm568390pfr.207.2020.08.20.20.16.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Aug 2020 20:16:21 -0700 (PDT) From: Madhuparna Bhowmik X-Google-Original-From: Madhuparna Bhowmik Date: Fri, 21 Aug 2020 08:46:16 +0530 To: Paul Cercueil Cc: Lars-Peter Clausen , madhuparnabhowmik10@gmail.com, dan.j.williams@intel.com, vkoul@kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, andrianov@ispras.ru, ldv-project@linuxtesting.org Subject: Re: [PATCH] drivers/dma/dma-jz4780: Fix race condition between probe and irq handler Message-ID: <20200821031616.GA7874@madhuparna-HP-Notebook> References: <20200816072253.13817-1-madhuparnabhowmik10@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 20, 2020 at 08:46:43PM +0200, Paul Cercueil wrote: >=20 >=20 > Le jeu. 20 ao=FBt 2020 =E0 20:23, Lars-Peter Clausen a = =E9crit : > > On 8/20/20 1:59 PM, Paul Cercueil wrote: > > > Hi, > > >=20 > > > Le dim. 16 ao=FBt 2020 =E0 12:52, madhuparnabhowmik10@gmail.com a =E9= crit > > > : > > > > From: Madhuparna Bhowmik > > > >=20 > > > > In probe IRQ is requested before zchan->id is initialized which > > > > can be > > > > read in the irq handler. Hence, shift request irq and enable > > > > clock after > > > > other initializations complete. Here, enable clock part is not > > > > part of > > > > the race, it is just shifted down after request_irq to keep the > > > > error > > > > path same as before. > > > >=20 > > > > Found by Linux Driver Verification project (linuxtesting.org). > > > >=20 > > > > Signed-off-by: Madhuparna Bhowmik > > >=20 > > > I don't think there is a race at all, the interrupt handler won't be > > > =7Fcalled before the DMA is registered. > > >=20 > > From a purely formal verification perspective there is a bug. The > > interrupt could fire if i.e. the hardware is buggy or something. In > > general it is a good idea to not request the IRQ until all the resources > > that are used in the interrupt handler are properly set up. Even if you > > know that in practice the interrupt will never fire this early. > >=20 > > Fair enough, I'm fine with that, but the patch should be reworked so that > the clk_prepare_enable() call is not moved. > Sure, I will send the v2 of the patch with this change soon. Thanks, Madhuparna > Cheers, > -Paul >=20 >=20