From patchwork Wed Jan 24 02:56:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 10181313 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 E663260467 for ; Wed, 24 Jan 2018 02:56:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA544285BA for ; Wed, 24 Jan 2018 02:56:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF34128631; Wed, 24 Jan 2018 02:56:37 +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 99D29285BA for ; Wed, 24 Jan 2018 02:56:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A9876E4F9; Wed, 24 Jan 2018 02:56:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id A68166E4F9 for ; Wed, 24 Jan 2018 02:56:33 +0000 (UTC) Received: by mail-pg0-x243.google.com with SMTP id q67so1708453pga.9 for ; Tue, 23 Jan 2018 18:56:33 -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=qE8n1ZWXT9AzXGSwOMIBRJiSbgtyU1QP9O0YdWHsMC0=; b=AxdZeDnOgw58EAZe9p4IY80SLxWg1CqQ3q3+yiNL1lvnIaMIwr+EI/ntWo4U5OAQfr FmvBNcSUUAoRm9K5lAa97jODxuPEJmjEMOsZSDquQR6WCo959vXqRCyy78sZ5Aj/Kfuu DwS9Ha6YtcqkoygLwriyLEuR+C8ZKztWx59Dw= 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=qE8n1ZWXT9AzXGSwOMIBRJiSbgtyU1QP9O0YdWHsMC0=; b=dlnrrR9FTaA41AOA/X30+Pfc00Ri1vyaRnxZ4Vwaivna8JsAMmJ1SvrT3G9Q7xKEy+ gX87F+YAQ5mlKNDOKsmSNAo53AtJrN0FzUCsTtzi6PgOjcK96S/eCBJUXpVSZe8+SD0N Y/w86K1rGN7u75jEjX0JztU1K1h8xrikOz5nOc+kDgfs2+fIcItNM/hDsJXNBJp8mqGO LwhVN7ddxg4TtkWLf1WwawtCR98KA9KL0TckR9311FNHUtWEGq27N8o+/mClngVmjsI4 atEV6IwnMkIUuZ8Dzz82QJ8ZBe4jynzzMDy9uENKEZdeKYA6OfuNf3wE4gjEvOYw06WR d8cw== X-Gm-Message-State: AKwxytfcwFecWdfHeELoBPbTw1Pvu4Hyc3uC8tsuQU9sNOxVi8AFZkYP vxTYtNjfFfxp40UXdv3Y7Aj00FI+z/Q= X-Google-Smtp-Source: AH8x225h07wA7ngv950Pl1dRsbKDfsUWyoqSsWTBv9Y42J6TrQdDUeKiK4lUYsR3TyfK1/50MQvlLQ== X-Received: by 2002:a17:902:242:: with SMTP id 60-v6mr7081588plc.376.1516762592832; Tue, 23 Jan 2018 18:56:32 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:0:1000:1600:f560:c8e6:9f8d:ba54]) by smtp.gmail.com with ESMTPSA id i20sm7041301pfj.58.2018.01.23.18.56.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 18:56:32 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/5] drm/vgem: flush page during page fault Date: Tue, 23 Jan 2018 18:56:05 -0800 Message-Id: <20180124025606.3020-4-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180124025606.3020-2-gurchetansingh@chromium.org> References: <20180124025606.3020-2-gurchetansingh@chromium.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gurchetan Singh , thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, daniel.vetter@intel.com, linux-arm-kernel@lists.infradead.org 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 802a97e1a4bf..ed6db7218f04 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(&page, 1); } return ret; }