From patchwork Wed Jan 17 00:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 10168353 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 B73056055D for ; Wed, 17 Jan 2018 00:36:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92A2427F7F for ; Wed, 17 Jan 2018 00:36:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 872E627F85; Wed, 17 Jan 2018 00:36:22 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5102327F7F for ; Wed, 17 Jan 2018 00:36:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A53A6E333; Wed, 17 Jan 2018 00:36:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 686EF6E333 for ; Wed, 17 Jan 2018 00:36:19 +0000 (UTC) Received: by mail-pg0-x244.google.com with SMTP id k68so2732850pga.3 for ; Tue, 16 Jan 2018 16:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i7YJSJNgy9z5SrnXQocNCkxMsIkiLqWTqS1Zo/FFzgQ=; b=aY1tzUMtMTp1GC0YGaZEENuwfNJFz8LsIOUSkSzGazqMG2z4aLh8O6fJ2INf1v0rxD nc0JpbgIVtOhVjG+HYkS71lhd909XFxJ6Z+Mj+AtSjy7bKAYPGA9qK5ojV0tP2zOaZq0 OGUPq5NrfCMMMbw4lK9sDoE/MONwHC7is38LE= 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=i7YJSJNgy9z5SrnXQocNCkxMsIkiLqWTqS1Zo/FFzgQ=; b=DsUDCX0oPd5l48DCFPaawcF1qYjKxqPYVcfSGURGSiCXdKeAQsxBvPmz2/Cin+u7jb 0qX3MdR/kb77pX8nYE37qSf1fyJrC+hHVqyLrRgpjBo9JQyqIRz4LqrwWFdzwMg574+a MtTH6t9JTQN8y44fPAHw+TvHQgukJ91OL1G+raG08ZpE4y3Z2Yqe9ivcnKi/Qi70fc3h vUImWPZoeV2vQoVnuYqs2x6KEw50/9+dcmX4xhY8+YnptW6NR06Vo3mjVpM7ScB/b5Lt si92Uqafu2aZ2YQjbYmbufeak38ELulx8GHOEc/5D4aKIQ+jnDt24BzZg2fzXpLti7T7 z9KA== X-Gm-Message-State: AKGB3mKJum072PGjRQid+8D1ka4SFcsgg0x9iDCZxGi+7dmyD0TglIj1 dCazYAAxZntqXKvrVimNC2OaXQB9FvI= X-Google-Smtp-Source: ACJfBotBc5qCMeSQ6RMk04bs+tVbAuQDa1m7S+lcUz6jD/g6xbDHpIPHpCh1NHvPdiJcHgeORTH9gw== X-Received: by 10.98.246.17 with SMTP id x17mr31609722pfh.46.1516149378642; Tue, 16 Jan 2018 16:36:18 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:0:1000:1600:1dfc:23a3:37e7:107c]) by smtp.gmail.com with ESMTPSA id 15sm5792104pfi.97.2018.01.16.16.36.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 16:36:17 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/vgem: flush page during page fault Date: Tue, 16 Jan 2018 16:35:59 -0800 Message-Id: <20180117003559.67837-4-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180117003559.67837-1-gurchetansingh@chromium.org> References: <20180117003559.67837-1-gurchetansingh@chromium.org> Cc: Gurchetan Singh , thierry.reding@gmail.com, linux-tegra@vger.kernel.org, daniel.vetter@intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This is required to use buffers allocated by vgem on AMD and ARM devices. We're experiencing a case where eviction of the cache races with userspace writes. To fix this, flush the cache after retrieving a page. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/vgem/vgem_drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 35bfdfb746a7..fb263969f02d 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -112,6 +112,7 @@ static int vgem_gem_fault(struct vm_fault *vmf) break; } + drm_flush_pages(obj->base.dev->dev, &page, 1); } return ret; }