Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp385362ima; Fri, 1 Feb 2019 04:59:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ98fZ5JbfBa024+4V9BlJOPddR7KgLk65107GGOZsIypWe9LPWkUuCx2f3bnzb8dl5f2aL X-Received: by 2002:a63:955a:: with SMTP id t26mr2208012pgn.449.1549025988408; Fri, 01 Feb 2019 04:59:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549025988; cv=none; d=google.com; s=arc-20160816; b=n08kvcnvqvHUkdxi5N+8VhrWHl1mWeBgvSHD5m4q55tiBBtgo1EyBxxVumxSN9/aZZ fxVUjwGGA1flI0gQ4hot6P913UGfxdAxP9ZK5Ie72L6YL2aHI4e7z2i8krO06ZCZrqQs ypz3cZ+ptuFus8VC6rKrlK1MFxZqNWuHO1me3cvVb6e4+WjTrseKkru5+elwL5ql+qeT FWz+9izuwvLb6bZ5JCw+1cdvgNR0P4VeSzsJqjcaWHBRrNfTDXF/T/gd+QP+Di89iZUe NoxSIloRAUqcrJqEwSajH5ZJx7K8PxpPdFDEx5UM4NVpdG/CgS3jOBPHvlw7pW1n+9e8 0Otw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature; bh=WXxNonisvEEGsJcrJ12yHRZbUb6lt7CD6ZwqgsaLB7g=; b=kcK1b5Npyd1m/iu1pcFXybTp0OMMApolP+ptUPE7n6TIBwbW07UhkuZK/F1zeQPW/V J52Fs4bFpHBfbFJYIP4W99DehQRNR/rWezzrpk8IWFCC4vJz314w/YgHlkq8ZnBWVYWw wFUvy2iyfaFuL2mruCpvKxLSVHskAnY7oNY2K7vrrN6KbkT+HsMgFKmi/A1Fe34VknnI qEjSswP5WXmCrDlPGrOgO5BHbclWnacqhuAV1VNvHRNy34i2PlKm0p0/C1zg+D/wfuJJ VowcFWt0nKtUmElkMS3EXXKAM3pBfXX5DrU7LBA0YdY5UrTJPjWKLpyYS4dbkkw07GGg mpZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M4RnDbpk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v61si7878918plb.54.2019.02.01.04.58.51; Fri, 01 Feb 2019 04:59:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M4RnDbpk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727952AbfBAMY6 (ORCPT + 99 others); Fri, 1 Feb 2019 07:24:58 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36723 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726172AbfBAMY6 (ORCPT ); Fri, 1 Feb 2019 07:24:58 -0500 Received: by mail-wm1-f67.google.com with SMTP id p6so6008122wmc.1; Fri, 01 Feb 2019 04:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=WXxNonisvEEGsJcrJ12yHRZbUb6lt7CD6ZwqgsaLB7g=; b=M4RnDbpkBe7khiuH/YflEZDCjdNGpPFKhoTM/Sj20K1EuyuNHLNl1iLtvRygCtjGIn QVoQuiSoSa7VqghdJtmY829X1iWfnGuJPx3goPFXXs3N0EOiAEqiodDwYN1LG97YmFsN FQw8XB2Zcs9tFXKGUGOpHG28fyM7r21ooHNcMzE13000y1Bv//O1/balf5DgflWPPVft pUKjo1FQAGRl10krk1LZ5gALq2ISgEkBp+19gQvt1FCmhtOrB53fS0/P7q9P7w9LcPJd JKa1144z6CWbMhf56ra6u8bH2kULV0CPC7ZycnHfNcrdR9Iyt0xGPJURHx/YJRZrK8XO wLDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=WXxNonisvEEGsJcrJ12yHRZbUb6lt7CD6ZwqgsaLB7g=; b=CJrwUeqRUO8c5R9DJ3VkCDI1L6vq3kl9B2I0CWMLE5qOFont/7WFR8yBNw7jRpgScU pTMGY1833XbNx3Zn84OKMI1HRK/WECAfB9t6Zn/1I7cj6OsFHkY8i2VDqqKG6EfmXi1I rkoWHamKnEk1z4puSWtBIvh6hhZCvcKwj5uGp52l+MtQTBgwV4YhCmjXHvtcLreBg3zM rBpOO1PRbzQAN98ObuvKuTbNbwYfSDaji7TN5uAXrMVEiEXWp+Nb4iQG9MjC9485TdWa JIwm1iNXMRjv3bRotk+KnT77bues8Y5UvT228crIHCmAm3VphMmnlq/wOGTcINUS+COV 3WQQ== X-Gm-Message-State: AHQUAuaFtuOHdKtfLxCAYVp148m6U5YWRi0Qh1CWmqdUMCWqmmnaleRc kY0ENXsLM5oleQtb/M13jXA= X-Received: by 2002:a1c:a755:: with SMTP id q82mr2322317wme.6.1549023895272; Fri, 01 Feb 2019 04:24:55 -0800 (PST) Received: from ?IPv6:2a02:908:1252:fb60:be8a:bd56:1f94:86e7? ([2a02:908:1252:fb60:be8a:bd56:1f94:86e7]) by smtp.gmail.com with ESMTPSA id h13sm10030054wrp.61.2019.02.01.04.24.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Feb 2019 04:24:54 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH v4 0/9] mmu notifier provide context informations To: Jerome Glisse , Andrew Morton , linux-mm@kvack.org Cc: Ralph Campbell , Jan Kara , Arnd Bergmann , kvm@vger.kernel.org, Matthew Wilcox , linux-rdma@vger.kernel.org, John Hubbard , Felix Kuehling , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michal Hocko , Jason Gunthorpe , Ross Zwisler , linux-fsdevel@vger.kernel.org, Paolo Bonzini , Dan Williams , =?UTF-8?Q?Christian_K=c3=b6nig?= References: <20190123222315.1122-1-jglisse@redhat.com> <20190131161006.GA16593@redhat.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Fri, 1 Feb 2019 13:24:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190131161006.GA16593@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 31.01.19 um 17:10 schrieb Jerome Glisse: > Andrew what is your plan for this ? I had a discussion with Peter Xu > and Andrea about change_pte() and kvm. Today the change_pte() kvm > optimization is effectively disabled because of invalidate_range > calls. With a minimal couple lines patch on top of this patchset > we can bring back the kvm change_pte optimization and we can also > optimize some other cases like for instance when write protecting > after fork (but i am not sure this is something qemu does often so > it might not help for real kvm workload). > > I will be posting a the extra patch as an RFC, but in the meantime > i wanted to know what was the status for this. > > > Jan, Christian does your previous ACK still holds for this ? At least the general approach still sounds perfectly sane to me. Regarding how to merge these patches I think we should just get the general infrastructure into Linus tree and when can then merge the DRM patches one release later when we are sure that it doesn't break anything. Christian. > > > On Wed, Jan 23, 2019 at 05:23:06PM -0500, jglisse@redhat.com wrote: >> From: Jérôme Glisse >> >> Hi Andrew, i see that you still have my event patch in you queue [1]. >> This patchset replace that single patch and is broken down in further >> step so that it is easier to review and ascertain that no mistake were >> made during mechanical changes. Here are the step: >> >> Patch 1 - add the enum values >> Patch 2 - coccinelle semantic patch to convert all call site of >> mmu_notifier_range_init to default enum value and also >> to passing down the vma when it is available >> Patch 3 - update many call site to more accurate enum values >> Patch 4 - add the information to the mmu_notifier_range struct >> Patch 5 - helper to test if a range is updated to read only >> >> All the remaining patches are update to various driver to demonstrate >> how this new information get use by device driver. I build tested >> with make all and make all minus everything that enable mmu notifier >> ie building with MMU_NOTIFIER=no. Also tested with some radeon,amd >> gpu and intel gpu. >> >> If they are no objections i believe best plan would be to merge the >> the first 5 patches (all mm changes) through your queue for 5.1 and >> then to delay driver update to each individual driver tree for 5.2. >> This will allow each individual device driver maintainer time to more >> thouroughly test this more then my own testing. >> >> Note that i also intend to use this feature further in nouveau and >> HMM down the road. I also expect that other user like KVM might be >> interested into leveraging this new information to optimize some of >> there secondary page table invalidation. >> >> Here is an explaination on the rational for this patchset: >> >> >> CPU page table update can happens for many reasons, not only as a result >> of a syscall (munmap(), mprotect(), mremap(), madvise(), ...) but also >> as a result of kernel activities (memory compression, reclaim, migration, >> ...). >> >> This patch introduce a set of enums that can be associated with each of >> the events triggering a mmu notifier. Latter patches take advantages of >> those enum values. >> >> - UNMAP: munmap() or mremap() >> - CLEAR: page table is cleared (migration, compaction, reclaim, ...) >> - PROTECTION_VMA: change in access protections for the range >> - PROTECTION_PAGE: change in access protections for page in the range >> - SOFT_DIRTY: soft dirtyness tracking >> >> Being able to identify munmap() and mremap() from other reasons why the >> page table is cleared is important to allow user of mmu notifier to >> update their own internal tracking structure accordingly (on munmap or >> mremap it is not longer needed to track range of virtual address as it >> becomes invalid). >> >> [1] https://www.ozlabs.org/~akpm/mmotm/broken-out/mm-mmu_notifier-contextual-information-for-event-triggering-invalidation-v2.patch >> >> Cc: Christian König >> Cc: Jan Kara >> Cc: Felix Kuehling >> Cc: Jason Gunthorpe >> Cc: Andrew Morton >> Cc: Matthew Wilcox >> Cc: Ross Zwisler >> Cc: Dan Williams >> Cc: Paolo Bonzini >> Cc: Radim Krčmář >> Cc: Michal Hocko >> Cc: Ralph Campbell >> Cc: John Hubbard >> Cc: kvm@vger.kernel.org >> Cc: dri-devel@lists.freedesktop.org >> Cc: linux-rdma@vger.kernel.org >> Cc: linux-fsdevel@vger.kernel.org >> Cc: Arnd Bergmann >> >> Jérôme Glisse (9): >> mm/mmu_notifier: contextual information for event enums >> mm/mmu_notifier: contextual information for event triggering >> invalidation >> mm/mmu_notifier: use correct mmu_notifier events for each invalidation >> mm/mmu_notifier: pass down vma and reasons why mmu notifier is >> happening >> mm/mmu_notifier: mmu_notifier_range_update_to_read_only() helper >> gpu/drm/radeon: optimize out the case when a range is updated to read >> only >> gpu/drm/amdgpu: optimize out the case when a range is updated to read >> only >> gpu/drm/i915: optimize out the case when a range is updated to read >> only >> RDMA/umem_odp: optimize out the case when a range is updated to read >> only >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 13 ++++++++ >> drivers/gpu/drm/i915/i915_gem_userptr.c | 16 ++++++++++ >> drivers/gpu/drm/radeon/radeon_mn.c | 13 ++++++++ >> drivers/infiniband/core/umem_odp.c | 22 +++++++++++-- >> fs/proc/task_mmu.c | 3 +- >> include/linux/mmu_notifier.h | 42 ++++++++++++++++++++++++- >> include/rdma/ib_umem_odp.h | 1 + >> kernel/events/uprobes.c | 3 +- >> mm/huge_memory.c | 14 +++++---- >> mm/hugetlb.c | 11 ++++--- >> mm/khugepaged.c | 3 +- >> mm/ksm.c | 6 ++-- >> mm/madvise.c | 3 +- >> mm/memory.c | 25 +++++++++------ >> mm/migrate.c | 5 ++- >> mm/mmu_notifier.c | 10 ++++++ >> mm/mprotect.c | 4 ++- >> mm/mremap.c | 3 +- >> mm/oom_kill.c | 3 +- >> mm/rmap.c | 6 ++-- >> 20 files changed, 171 insertions(+), 35 deletions(-) >> >> -- >> 2.17.2 >> > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel