From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ED23C433E1 for ; Wed, 1 Jul 2020 06:09:53 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 424952074D for ; Wed, 1 Jul 2020 06:09:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tHVAS6YA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 424952074D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 12ED5894F0; Wed, 1 Jul 2020 06:09:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9zy8TF2H_0MV; Wed, 1 Jul 2020 06:09:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 95D5E894EC; Wed, 1 Jul 2020 06:09:52 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A0CC11BF83C for ; Wed, 1 Jul 2020 06:09:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9CECD894EB for ; Wed, 1 Jul 2020 06:09:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 93S3Yf2CTK1l for ; Wed, 1 Jul 2020 06:09:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 14B43894E5 for ; Wed, 1 Jul 2020 06:09:50 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id o13so8210124pgf.0 for ; Tue, 30 Jun 2020 23:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xo4kx1NAZFSrQlqrR4fKrSHkld4dOPpLGIHAf+LkV2I=; b=tHVAS6YA5XDLIVdffU924/kQYhbNx0e+NPD1VKUWOt2+bCxjYGRlTrt2H3OFxUmTZu ek3swGqtZUoFwUO4HjMxAIzdoXwYhCOv+EG+NCGO7Xy/QuposvsMJ176j3WwIu6G/LzF ysDs6e8FQkDo0Hvji4QAnJDDQdfyvmIRqJzVg1AEt63gnQW157fpJrPNWn0D9SNQMP7K eBNk6uwhIWn+4KaClmwSNyKcF0wDF1X/j7ibvThLoyjcLfHPPtFyvIf0bg6vpZuf78qL HBvwGs3TK43oyHSXDa/n4kla1vPE6a2kFx3wwY8bE1yTJJKaQjXIeYzgkGWUIgeOc9cN xttQ== 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=xo4kx1NAZFSrQlqrR4fKrSHkld4dOPpLGIHAf+LkV2I=; b=bGk643sluQR1RRiU70XJ7e4b3D5i2CbbxBQzf93e5u2puSEpPhUsWQfTOeKZglzQK3 0egvMR8Af8c2b41Kl4b4rto3+S2FqzSCyoaR/Je1t5y8rdytXcVveDGafufvZ7B1OLXL zUZbPM7LzCcS5YwWnCFNHHY4CWHTxMptOUrPSatvZP0ePlw0GjAi6M38o7Jh0Rrt9CP8 ixYDtVVBbfa4DpN1TKzhmYkvm8Nstvbp8TWavpTAm8vyQB6Nt3uvlmsU3i61I9iw0TqP B7RMr1wPgFzuKHMDuvjr1kJZN3acwDzqFktzoCy6Zw+5uGRYhYbSJRG4DVMRGk3cP9mH RVcQ== X-Gm-Message-State: AOAM532wJ0aGP8/eW4U1pq/FQNr03MZoXSg11A250f77uczbRPT1sqW+ JnlUSLivQdt0qhT9MeFcZn4= X-Google-Smtp-Source: ABdhPJzkKFMl5l3MTjtmmjB/I87a8WxbDI0qFkgqt2jrF81H3n99Hikz+/xQ+XVI8San/xdxbliuTw== X-Received: by 2002:a63:34c3:: with SMTP id b186mr18323931pga.173.1593583789643; Tue, 30 Jun 2020 23:09:49 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC.domain.name ([122.171.42.200]) by smtp.gmail.com with ESMTPSA id 127sm4694073pgf.5.2020.06.30.23.09.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2020 23:09:48 -0700 (PDT) From: Souptick Joarder To: gregkh@linuxfoundation.org, jane.pnx9@gmail.com, daniel.m.jordan@oracle.com, simon@nikanor.nu, harshjain32@gmail.com, pakki001@umn.edu Subject: [PATCH v3 2/4] staging: kpc2000: kpc_dma: Convert set_page_dirty() --> set_page_dirty_lock() Date: Wed, 1 Jul 2020 11:47:42 +0530 Message-Id: <1593584264-16982-3-git-send-email-jrdr.linux@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1593584264-16982-1-git-send-email-jrdr.linux@gmail.com> References: <1593584264-16982-1-git-send-email-jrdr.linux@gmail.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Bharath Vedartham , John Hubbard , linux-kernel@vger.kernel.org, Souptick Joarder , Dan Carpenter MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" First, convert set_page_dirty() to set_page_dirty_lock() Second, there is an interval in there after set_page_dirty() and before put_page(), in which the device could be running and setting pages dirty. Moving set_page_dirty_lock() after dma_unmap_sg(). Signed-off-by: Souptick Joarder Suggested-by: John Hubbard Cc: John Hubbard Cc: Bharath Vedartham Cc: Dan Carpenter --- drivers/staging/kpc2000/kpc_dma/fileops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c index becdb41..08d90a6 100644 --- a/drivers/staging/kpc2000/kpc_dma/fileops.c +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c @@ -215,13 +215,13 @@ void transfer_complete_cb(struct aio_cb_data *acd, size_t xfr_count, u32 flags) BUG_ON(!acd->ldev); BUG_ON(!acd->ldev->pldev); + dma_unmap_sg(&acd->ldev->pldev->dev, acd->sgt.sgl, acd->sgt.nents, acd->ldev->dir); + for (i = 0 ; i < acd->page_count ; i++) { if (!PageReserved(acd->user_pages[i])) - set_page_dirty(acd->user_pages[i]); + set_page_dirty_lock(acd->user_pages[i]); } - dma_unmap_sg(&acd->ldev->pldev->dev, acd->sgt.sgl, acd->sgt.nents, acd->ldev->dir); - for (i = 0 ; i < acd->page_count ; i++) put_page(acd->user_pages[i]); -- 1.9.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel