Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp135871pxa; Fri, 21 Aug 2020 03:24:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz29ssw3xw/1JRQCDGBz/A0cUhX5o3itMtRtO5VxfEqbF2zjSMOpwYJ2xP9RAxUV4qS5zLB X-Received: by 2002:a17:906:b2d7:: with SMTP id cf23mr2153058ejb.113.1598005486090; Fri, 21 Aug 2020 03:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598005486; cv=none; d=google.com; s=arc-20160816; b=O0mvxhRQqB/jQrHch1lMU9eC8zRDg1ZvVBGVIbf2V36OZq02apOoRaVVnvrkXOO4aX U2PQNxCMmZ11xfRDf+LYiJvW0zCmng9lI81mlRaqgCFLOe8T1/kahI3QsmJgKJuAbS2/ eXamy1+e0zatDxxGRDzulwFu3bdy4BLYwDqpIskvFAT3cIqiUqkWszB5CKeBX/DbCrga f5LgsAtKDrPCgmIF3TZ6vOaqouNg0lrZtHLpmg9LfWf2b3I3QeHW1yQKNHvwo46P64Fv QAE4QQ6b1qXkQSOqI3zj4oCnj3cGF0p2Tm8LPLOyFDTh75ebnIhpksZRNHArbOeqdagA enbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KwnTGoOiI1i/JaIMA5Zt50VonK44ahPjU0z2DklSNT4=; b=FBbqQIYnPJ6d9xLpHFKQ6TQ+6Evt1D9ZfcFJc7jHfIIsqq0BF9YzrV+sTbX2dIP6X4 DCdItPBcPb0dy4kYa7UqFgJ6xZI85BJuau4jx4lo++qhizAVefkNpqNPzA/dFU2t71nW Lf8FI3YTv2fiD2aQUoQP02aNlF41A8W8mqRDvm2XdAcGgMn5kpzjjH3q7NYAB8/pZDjH JqRB2QC2ClBDEcEfAO1JgpHtT2g04VcLJid864bUaxrZg4h9ET6vjehgNiCYzYO4vO2Q 3sZ9jvN6P5ufoh+eGpw3sjgdTfIDHF5bDwneOXV4uauEiRQKurF3DOljObyaNApIMpsb ERfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce6si905126ejb.734.2020.08.21.03.24.22; Fri, 21 Aug 2020 03:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728656AbgHUKWW (ORCPT + 99 others); Fri, 21 Aug 2020 06:22:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:55230 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728611AbgHUKWH (ORCPT ); Fri, 21 Aug 2020 06:22:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 07861B5E2; Fri, 21 Aug 2020 10:22:34 +0000 (UTC) Date: Fri, 21 Aug 2020 12:22:04 +0200 From: Joerg Roedel To: Chris Wilson Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, Pavel Machek , Andrew Morton , Linus Torvalds , Dave Airlie , Joonas Lahtinen , Rodrigo Vivi , David Vrabel , stable@vger.kernel.org Subject: Re: [PATCH 1/4] mm: Export flush_vm_area() to sync the PTEs upon construction Message-ID: <20200821102204.GH3354@suse.de> References: <20200821085011.28878-1-chris@chris-wilson.co.uk> <20200821095129.GF3354@suse.de> <159800366215.29194.8455636122843151159@build.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159800366215.29194.8455636122843151159@build.alporthouse.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 10:54:22AM +0100, Chris Wilson wrote: > Ok. I thought it had to be after assigning the *ptep. If we apply the > sync first, do not have to worry about PGTBL_PTE_MODIFIED from the > *ptep? Hmm, if I understand the code correctly, you are re-implementing some generic ioremap/vmalloc mapping logic in the i915 driver. I don't know the reason, but if it is valid you need to manually call arch_sync_kernel_mappings() from your driver like this to be correct: if (ARCH_PAGE_TABLE_SYNC_MASK & PGTBL_PTE_MODIFIED) arch_sync_kernel_mappings(); In practice this is a no-op, because nobody sets PGTBL_PTE_MODIFIED in ARCH_PAGE_TABLE_SYNC_MASK, so the above code would be optimized away. But what you really care about is the tracking in apply_to_page_range(), as that allocates the !pte levels of your page-table, which needs synchronization on x86-32. Btw, what are the reasons you can't use generic vmalloc/ioremap interfaces to map the range? Regards, Joerg