Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4501647ybp; Mon, 7 Oct 2019 09:21:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC9Y77yd8F8x5GebpxPt2Fb54GnCRUTYO9mfowmdgX1EhS9d4e7qmXTgvU40V79WdcSmG/ X-Received: by 2002:aa7:ce88:: with SMTP id y8mr30550127edv.145.1570465294654; Mon, 07 Oct 2019 09:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570465294; cv=none; d=google.com; s=arc-20160816; b=WkXdyg8jU/m2OV5aCHtowKfwMipBV7eIHYt3Bfgw5z17zQpdTLvgSI7GJP4Ztih6ja U7SMQcOAogKzwIotOvr2ordIXo8MCzXCaqUvQxvTu7dfg2uu8q0VuCwi4+i5UbniFlw5 I5BoifAzYa9Rt3wANtg5aPvQQt8jz9M1JRS6DxgxT+9+zHRW4s6IZtPhx+ZWhOTuNRJA wVc2URRml+Q2HlINTJlM3pwFoipreOwcdRBSckXsuVBcSHNb3C2EOQ7RfXp8T+i+FWff I7CBqZiROw7rHgomyG7VwgrvlCP3lFoqCUHQpAZLjd6BmljqYrs+A2ZswvvzYBAqPZi6 Fyvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=/NfxHrQ6mDEIKK4SpFSI9VqmfUNrcTols3Gs9LR6kUU=; b=K15MPAWj347ZxbMnNZzvIvpWIoP4PrmKG4zU+MXz51gBjYRWXylgBYfgFwlG1dC+4k i7e+HwMPeEr97s9DJCKT4dGU0YUIY1OVFxqF7VsR2nSXiHatxv6IJ+QBWfi5d9YO9Nci fOjrE78NXw9ZTA503sz4mEEy9CeDIxcAbQckEtEjVzMJnEagVKhDgN4oPAJ8ZEItqgIj v+SQz/40lcpO8F8D2mHNoBm8VxfYrZEfxoAjEBgOqP/0mXY3I0yMZ9OR/Chvqe/Eopnv xYMgFbX3Urgb2+lRhLi/V+dadTQR07aLlwextK6FoXU6mphsqCXyYSsEMPpIHC8BdNAa NgGA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b33si9379768edc.265.2019.10.07.09.21.10; Mon, 07 Oct 2019 09:21:34 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728743AbfJGQUf (ORCPT + 99 others); Mon, 7 Oct 2019 12:20:35 -0400 Received: from foss.arm.com ([217.140.110.172]:40048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728132AbfJGQUf (ORCPT ); Mon, 7 Oct 2019 12:20:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C2548142F; Mon, 7 Oct 2019 09:20:34 -0700 (PDT) Received: from [10.1.197.21] (unknown [10.1.197.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1EFC43F68E; Mon, 7 Oct 2019 09:20:32 -0700 (PDT) Subject: Re: [PATCH v11 14/22] mm: pagewalk: Add 'depth' parameter to pte_hole To: Jason Gunthorpe Cc: Mark Rutland , x86@kernel.org, Arnd Bergmann , Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , Dave Hansen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , James Morse , Thomas Gleixner , Will Deacon , Andrew Morton , linux-arm-kernel@lists.infradead.org, "Liang, Kan" References: <20191007153822.16518-1-steven.price@arm.com> <20191007153822.16518-15-steven.price@arm.com> <20191007161049.GA13229@ziepe.ca> From: Steven Price Message-ID: <6e570d6d-b29f-f4cb-1eb9-6ff6cab15a2e@arm.com> Date: Mon, 7 Oct 2019 17:20:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191007161049.GA13229@ziepe.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/10/2019 17:10, Jason Gunthorpe wrote: > On Mon, Oct 07, 2019 at 04:38:14PM +0100, Steven Price wrote: >> diff --git a/mm/hmm.c b/mm/hmm.c >> index 902f5fa6bf93..34fe904dd417 100644 >> +++ b/mm/hmm.c >> @@ -376,7 +376,7 @@ static void hmm_range_need_fault(const struct hmm_vma_walk *hmm_vma_walk, >> } >> >> static int hmm_vma_walk_hole(unsigned long addr, unsigned long end, >> - struct mm_walk *walk) >> + __always_unused int depth, struct mm_walk *walk) > > It this __always_unused on function arguments something we are doing > now? $ git grep __always_unused | wc -l 191 It's elsewhere in the kernel tree. It seems like a good way of both documenting and silencing compiler warnings. But I'm open to other suggestions. > Can we have negative depth? Should it be unsigned? As per the documentation added in this patch: * @pte_hole: if set, called for each hole at all levels, * depth is -1 if not known, 0:PGD, 1:P4D, 2:PUD, 3:PMD * 4:PTE. Any folded depths (where PTRS_PER_P?D is equal * to 1) are skipped. So it's signed to allow "-1" in the cases where pte_hole is called without knowing the actual depth. This is used in the function walk_page_test() because it don't walk the actual page tables, but is called on a VMA instead. This means that there may not be a single depth for the range provided. Steve >> { >> struct hmm_vma_walk *hmm_vma_walk = walk->private; >> struct hmm_range *range = hmm_vma_walk->range; >> @@ -564,7 +564,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, >> again: >> pmd = READ_ONCE(*pmdp); >> if (pmd_none(pmd)) >> - return hmm_vma_walk_hole(start, end, walk); >> + return hmm_vma_walk_hole(start, end, 0, walk); >> >> if (thp_migration_supported() && is_pmd_migration_entry(pmd)) { >> bool fault, write_fault; >> @@ -666,7 +666,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end, >> again: >> pud = READ_ONCE(*pudp); >> if (pud_none(pud)) >> - return hmm_vma_walk_hole(start, end, walk); >> + return hmm_vma_walk_hole(start, end, 0, walk); >> >> if (pud_huge(pud) && pud_devmap(pud)) { >> unsigned long i, npages, pfn; >> @@ -674,7 +674,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end, >> bool fault, write_fault; >> >> if (!pud_present(pud)) >> - return hmm_vma_walk_hole(start, end, walk); >> + return hmm_vma_walk_hole(start, end, 0, walk); >> >> i = (addr - range->start) >> PAGE_SHIFT; >> npages = (end - addr) >> PAGE_SHIFT; > > Otherwise this mechanical change to hmm.c looks OK to me > > Jason > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >