From patchwork Fri Mar 20 16:48:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 11449851 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72213913 for ; Fri, 20 Mar 2020 16:50:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3DD5120767 for ; Fri, 20 Mar 2020 16:50:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="NaCjjzld" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DD5120767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4DD2E6B0008; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4656D6B000C; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D56B6B000A; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 0F8C16B0007 for ; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8FE02180AD81A for ; Fri, 20 Mar 2020 16:50:25 +0000 (UTC) X-FDA: 76616328810.28.wing57_3ab60f26f701 X-Spam-Summary: 2,0,0,ee8770e688a7897e,d41d8cd98f00b204,jgg@ziepe.ca,,RULES_HIT:41:69:355:379:541:800:960:968:973:988:989:1260:1311:1314:1345:1437:1515:1535:1542:1711:1730:1747:1777:1792:1801:2393:2559:2562:2693:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:4321:4605:5007:6119:6120:6261:6653:7576:7875:7901:7903:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:13894:14096:14181:14394:14721:21080:21325:21444:21451:21627:21740:21990:30012:30054:30070,0,RBL:209.85.222.194:@ziepe.ca:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none X-HE-Tag: wing57_3ab60f26f701 X-Filterd-Recvd-Size: 5707 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 16:50:25 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id q188so2227500qke.8 for ; Fri, 20 Mar 2020 09:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=87iKgwaPy8pXzXL9YA5WV3WZml27jYwBmFGI1UGSVUk=; b=NaCjjzldyTssF/3z0KZL0Fqab/MMlCzRVjrru2siMv9BUoCtsVnQTd1gi0e4g7Bv7C 7lWk8bdKCdsAa8UzZNISAM9HmDetrX83wCNt9BSFlOheErwFqT8tMGKNvHewjQr45veO HWg6Vy16BlP0KGklKKcCiS4VNcLzsIKutYoiODMmJPm1d2altsZ0q+sdSgGp2+g62JZb 3CyCsoqW0ZnZ0HCHgfI/B0TdbvC598XLc03bFzjXoW1P352HHxZ0KJ8lx/pW9bAVegn3 mG+bqtTK0HVO+f8zqeTr/natEqIDzoAw+jhHbk3xIlfLbjCkv7KSx/3qYUaodlY+D0bf kGQw== 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:mime-version :content-transfer-encoding; bh=87iKgwaPy8pXzXL9YA5WV3WZml27jYwBmFGI1UGSVUk=; b=U3YS5DWZnSwvYputY92NBxzs6PrRETvQ5bO6drIPca75jUQ68c5GPPb6kosaVESt02 KyuRAfEe2aytdFl+ONUTRgfCYHVtkd+2zm0hyFovrv8NSCsH5dpYmDliAnU6FeKtEUOk JcZWPFXGgTXDb4EyzttvbJWJsaYJcyEfiDJJP0o2tKV2fAuJxNFdc4oWAGCXGsv2ITzv hlOtE56oSNItKrFkl1+xktOWopIztlsawY3d7rTjI2xX7YPyb2oLHEYFxDhAH3zaKCx2 qzcZcqrQ9PWdhPwSSdHdvxnFFAHBHXEtHyadUQ1GAPPke758PllUNnts62ouYwBEeoeP ZoMA== X-Gm-Message-State: ANhLgQ1O66Weefm72QxiYrb5KvRFcUaK4TgK5pL3avoSoLyX9g2xieNi SeTymT2VL8Geh0hVINIcoaPqQw== X-Google-Smtp-Source: ADFU+vvveuclm6zQpq1BtpQVw2AZCya6AVI9ugZ2/VnoudKnWPkwAxuYh/+4WEp0jmf9H9GqVc8R6Q== X-Received: by 2002:a37:8581:: with SMTP id h123mr8465387qkd.158.1584723024381; Fri, 20 Mar 2020 09:50:24 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id x74sm4382043qkb.40.2020.03.20.09.50.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Mar 2020 09:50:23 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jFKql-0005jg-5N; Fri, 20 Mar 2020 13:50:23 -0300 From: Jason Gunthorpe To: Jerome Glisse , Ralph Campbell , Felix.Kuehling@amd.com Cc: linux-mm@kvack.org, John Hubbard , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Philip Yang , Jason Gunthorpe Subject: [PATCH hmm 0/6] Small hmm_range_fault() cleanups Date: Fri, 20 Mar 2020 13:48:59 -0300 Message-Id: <20200320164905.21722-1-jgg@ziepe.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Jason Gunthorpe I've had these in my work queue for a bit, nothing profound here, just some small edits for clarity. Ralph's hmm tester will need a small diff to work after this - which illustrates how setting default_flags == 0 is the same as what was called SNAPSHOT: Jason Gunthorpe (6): mm/hmm: remove pgmap checking for devmap pages mm/hmm: return the fault type from hmm_pte_need_fault() mm/hmm: remove unused code and tidy comments mm/hmm: remove HMM_FAULT_SNAPSHOT mm/hmm: remove the CONFIG_TRANSPARENT_HUGEPAGE #ifdef mm/hmm: use device_private_entry_to_pfn() Documentation/vm/hmm.rst | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- include/linux/hmm.h | 55 +----- mm/hmm.c | 238 +++++++++--------------- 5 files changed, 98 insertions(+), 211 deletions(-) Reviewed-by: Ralph Campbell diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 6ca953926dc13f..5f31f5b3e64cb9 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -300,7 +300,7 @@ static int dmirror_range_fault(struct dmirror *dmirror, range->notifier_seq = mmu_interval_read_begin(range->notifier); down_read(&mm->mmap_sem); - count = hmm_range_fault(range, 0); + count = hmm_range_fault(range); up_read(&mm->mmap_sem); if (count <= 0) { if (count == 0 || count == -EBUSY) @@ -337,8 +337,7 @@ static int dmirror_fault(struct dmirror *dmirror, unsigned long start, .flags = dmirror_hmm_flags, .values = dmirror_hmm_values, .pfn_shift = DPT_SHIFT, - .pfn_flags_mask = ~(dmirror_hmm_flags[HMM_PFN_VALID] | - dmirror_hmm_flags[HMM_PFN_WRITE]), + .pfn_flags_mask = 0, .default_flags = dmirror_hmm_flags[HMM_PFN_VALID] | (write ? dmirror_hmm_flags[HMM_PFN_WRITE] : 0), .dev_private_owner = dmirror->mdevice, @@ -872,7 +871,7 @@ static int dmirror_range_snapshot(struct dmirror *dmirror, range->notifier_seq = mmu_interval_read_begin(range->notifier); down_read(&mm->mmap_sem); - count = hmm_range_fault(range, HMM_FAULT_SNAPSHOT); + count = hmm_range_fault(range); up_read(&mm->mmap_sem); if (count <= 0) { if (count == 0 || count == -EBUSY) @@ -916,7 +915,7 @@ static int dmirror_snapshot(struct dmirror *dmirror, .flags = dmirror_hmm_flags, .values = dmirror_hmm_values, .pfn_shift = DPT_SHIFT, - .pfn_flags_mask = ~0ULL, + .pfn_flags_mask = 0, .dev_private_owner = dmirror->mdevice, }; int ret = 0;