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: 9981705 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 E778060375 for ; Tue, 3 Oct 2017 05:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE40E1FFAE for ; Tue, 3 Oct 2017 05:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F1C1FFCA; Tue, 3 Oct 2017 05:24:21 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DC5E1FFAE for ; Tue, 3 Oct 2017 05:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750838AbdJCFYU (ORCPT ); Tue, 3 Oct 2017 01:24:20 -0400 Received: from mail-qk0-f175.google.com ([209.85.220.175]:52748 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751877AbdJCFX0 (ORCPT ); Tue, 3 Oct 2017 01:23:26 -0400 Received: by mail-qk0-f175.google.com with SMTP id b15so5214393qkg.9 for ; Mon, 02 Oct 2017 22:23:25 -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=MBRV3kExB5aPFc95Ms62Uo2ekZO3ZPAxzWc86GKVNyv/Ff0j1c5sprPPruUG4lrLIY dFzLV7JJHcdVVjdnsXKcy4XbWhR8xrsSwPHRKqTei9padlS/FBjrsiIlavD2FtazE+6n 0t53IjZykXMx3ShHhW6nK7TsFQXKW8al+kBN0BfDDHZlIuoAcUpvdhbkMMft7GDebLGo CDysng3zjNHmWXfWcDhnO8pwXvPdHFZPtgXvPmsz3eRtpDTf4dC5E8Fn+fsF6HqMXOqr z4mvAQn0o4DuNAb1zSbX/IekfxdXJ3gK+AazK+S6P2FI4bbqn1sUelgp34uZaPsuINuC FXRA== X-Gm-Message-State: AMCzsaVteoejsLckYGRutDlxDJPb/Fb36hmeC9MincJqYNKEvY5HNsEY 3B02zVDEl5IqPZqiZ2qBQW9/ew== 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 Cc: Ray Jui , Scott Branden , Florian Fainelli , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Anup Patel 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> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.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;