Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1550240pxa; Thu, 20 Aug 2020 14:22:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFkW++9lFm8j5/6M9Z4ooEWl/tk4CtsjBzYLhM3ymg1CgIAFi6KWn3wWdsOiYcy2cJo/B3 X-Received: by 2002:a17:906:4ec3:: with SMTP id i3mr581108ejv.215.1597958574250; Thu, 20 Aug 2020 14:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597958574; cv=none; d=google.com; s=arc-20160816; b=l+/RCPW8WR9Yg4eC82qPu40zaU2EHBPDL2EquOwkUrJf9Mh8BJ09jQ+1EQZPYTD0QQ nooyS/R+TLHVGimPqbdmX1bSiwDu9tBuB+ka+5tsgQ8p6Sil0Sb14VE96buT6zKuMhhp T9IRxOnpZEWAZo8R1QOMtuqAXxhGDoYdTtl/3pugkP9doxy9ONuxmVld7kNYhRi86lC7 IgHdEQBu2DNVXSsgWxeHh3zJZ7W8zsO6WcYlvYWLdUW4Zu6881GtXhFc/+7HSeq81/xn VdXCfGzQYV9ibtQe+pbPXX6vCDRbiRGQFFCXNB/UIBxTrM7AE297NTGCrQtyCAAhufM0 dtbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=Oe+2PzmcXagWqtHK6eruhPSrZ2v5G13GkG9wQ/HZ1cs=; b=hq74QPe00znITmLkVjPaltH98iSrOaDTiX9E8OmeacK0Ubo3cG0XtqZVhWfn8XRcvC UYfmz9ZrwHbaGGIOBmO7yQBjVrAOnpStc5X9pDxNM9CJ+LHWp68rlk3MKPhTE/U15LSy rClRtchG7kbnv2YG7dOKT/+AauRuv4si58YlgWmf2hSKIo0oldZVhr7zOWEv7kxRBjp6 +zKGEk68MpMgTSITDHWzEFeQfOOFOhucuAT+lAf5IFpDYhqTelKQS++ZE1dGKNdTq3Ls P1YR7tws7m/4JYIsZVTWD93QuH2rQ0xH1JpFpLlut3GDYXQvxKc6s/vvlUm8bOjbWRpP JWrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=fYAtf8gw; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c21si1920484ejb.724.2020.08.20.14.22.30; Thu, 20 Aug 2020 14:22:54 -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=fail header.i=@crapouillou.net header.s=mail header.b=fYAtf8gw; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727846AbgHTSq7 (ORCPT + 99 others); Thu, 20 Aug 2020 14:46:59 -0400 Received: from crapouillou.net ([89.234.176.41]:39054 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbgHTSq6 (ORCPT ); Thu, 20 Aug 2020 14:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1597949214; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Oe+2PzmcXagWqtHK6eruhPSrZ2v5G13GkG9wQ/HZ1cs=; b=fYAtf8gwkPTmy7EvKXUOId6/yyPBKKLJcTIWeZXyz17Z/uNiLIfqfi27YdH2m5E5i/3iNw pNxIjqBMUz4Mq2KCE20q1qqzJ9eE5Zp7qa3vurFMyTH2YGOdmisubrVsRiR3o4N7xQ0CpZ slrqpspbtoTDQWy0l9X7GA2z5ySVo5A= Date: Thu, 20 Aug 2020 20:46:43 +0200 From: Paul Cercueil Subject: Re: [PATCH] drivers/dma/dma-jz4780: Fix race condition between probe and irq handler To: Lars-Peter Clausen Cc: 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 Message-Id: In-Reply-To: References: <20200816072253.13817-1-madhuparnabhowmik10@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le jeu. 20 ao=FBt 2020 =E0 20:23, Lars-Peter Clausen a=20 =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=20 >> =E9crit : >>> From: Madhuparna Bhowmik >>>=20 >>> In probe IRQ is requested before zchan->id is initialized which can=20 >>> be >>> read in the irq handler. Hence, shift request irq and enable clock=20 >>> after >>> other initializations complete. Here, enable clock part is not part=20 >>> of >>> the race, it is just shifted down after request_irq to keep the=20 >>> 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=20 >> =7Fcalled before the DMA is registered. >>=20 > From a purely formal verification perspective there is a bug. The=20 > interrupt could fire if i.e. the hardware is buggy or something. In=20 > general it is a good idea to not request the IRQ until all the=20 > resources that are used in the interrupt handler are properly set up.=20 > Even if you know that in practice the interrupt will never fire this=20 > early. >=20 Fair enough, I'm fine with that, but the patch should be reworked so=20 that the clk_prepare_enable() call is not moved. Cheers, -Paul