From patchwork Tue Oct 3 05:22:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9981707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19B4C60375 for ; Tue, 3 Oct 2017 05:24:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FF841FFAE for ; Tue, 3 Oct 2017 05:24:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04CFB1FFCA; Tue, 3 Oct 2017 05:24:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 850DA1FFAE for ; Tue, 3 Oct 2017 05:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ze7sdFEg8SNZ+Arx6Og4ze8vxjr77d/32EkDuaZJcDc=; b=Js8WKZOl7uJaYAgN9MtZtSoTn7 uaxqAnuoPjkHwet2sXiWQCUXvWhnzvLkTqKASopJFxytu5EE7p20BhNZzBC5KjcJ0f2wW2YAwqS7v rwsQWozwNorB46jbq3xiyiRoPa3Hx8umVyh+2XEq0GEy5IX/PzvvW3Rbhi38jOZBvYa9t0ZL8nYS3 XwdsOsYbtYIrCvM/rhB9dGn+eQ4vSbziWcobxE5PhzrIC0mTRvLoWUYC80P+NembZyOO6h17bCw2N SQaU1JlCQO3Yj5j5cCdbRX9+OFy5696duQlzRaNTUgnyhMnb95bgDtR3aIrTAo7SdOXGBL+8B2/Ag C4j3HE7w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzFgs-0001MK-AJ; Tue, 03 Oct 2017 05:24:22 +0000 Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzFgI-0000rd-Re for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2017 05:24:19 +0000 Received: by mail-qk0-x229.google.com with SMTP id k123so3846485qke.3 for ; Mon, 02 Oct 2017 22:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vPSl2dlSth1C/3Zigl+VD9k7pvxrV1Qvnv9yIrlVWss=; b=YaBgb4VH3gUazxjHQspdb5Bv4KjD+8IaVIjm9FaWuaNnCZ+suNd33KnngUo+8yc9eb R7rVuU32g9NKdzVkCFXOhgLyJGCs26cWzh4e4shASYuHlUKEVqx1KR8jSr/Il/NcjJmk Jw3/1o6L7qqWcdDncuQzPYELNvBYZz1MhpAgc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vPSl2dlSth1C/3Zigl+VD9k7pvxrV1Qvnv9yIrlVWss=; b=W4/1/lnAk3sGuuhVqNW+ToAee4nSCF18H0gdJR7XMxheV7g6gk/1qOad9Pxf9RAlc5 tbe7mr2bE/hm0LNoX0sOCs9e+sylZeohO6ftkyrWoNoZ2PPoCjkviQbmUcL77stuErPP ultFev9IsMBTYBMZFRM23DvbUbp2tBR6wYceXIUbMuRSNDkIHr8HeVT2riXwcRDs+Vnh YFo9iECFGVD6JSMbZ/nWD5TF+HLWg5ls6yV1AFG8en86oQo+Z3gL15nKM2ZUdsUDLdsr so9B718u0SHGIvh6TASI5tIXmj7bw+Gw3E/+IY4+8y9rr4hmojOc04MhC2weQpJhqb// a1EQ== X-Gm-Message-State: AMCzsaUuKcwZ0mNgeaQME3c8UpsP0rQ/wsuKO56rROEkCCCq8iTi8QII xo7PpUYSa4xeNHa2kE9df+78PQ== X-Google-Smtp-Source: AOwi7QAu0jZ90KKkRj4DuxI8T2tglUEOmRO1HK5XjYD0XRuP5DSU4ZiC/6m0rKEkaVJ3SjF6rcDaWQ== X-Received: by 10.55.212.80 with SMTP id l77mr9670310qki.82.1507008205279; Mon, 02 Oct 2017 22:23:25 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id d205sm7725518qke.56.2017.10.02.22.23.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Oct 2017 22:23:24 -0700 (PDT) From: Anup Patel To: Vinod Koul , Dan Williams Subject: [PATCH 1/4] dmaengine: bcm-sba-raid: serialize dma_cookie_complete() using reqs_lock Date: Tue, 3 Oct 2017 10:52:57 +0530 Message-Id: <1507008180-27171-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507008180-27171-1-git-send-email-anup.patel@broadcom.com> References: <1507008180-27171-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171002_222347_383440_EACB5604 X-CRM114-Status: GOOD ( 10.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As-per documentation in driver/dma/dmaengine.h, the dma_cookie_complete() API should be called with lock held. This patch ensures that Broadcom SBA RAID driver calls the dma_cookie_complete() API with reqs_lock held. Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden --- drivers/dma/bcm-sba-raid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 6c2c447..15c5585 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -442,7 +442,9 @@ static void sba_process_received_request(struct sba_device *sba, WARN_ON(tx->cookie < 0); if (tx->cookie > 0) { + spin_lock_irqsave(&sba->reqs_lock, flags); dma_cookie_complete(tx); + spin_unlock_irqrestore(&sba->reqs_lock, flags); dmaengine_desc_get_callback_invoke(tx, NULL); dma_descriptor_unmap(tx); tx->callback = NULL;