From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 378FFC64E8A for ; Mon, 30 Nov 2020 15:31:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 955BE206CA for ; Mon, 30 Nov 2020 15:31:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="n1NlO+k6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 955BE206CA 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 E17838D000B; Mon, 30 Nov 2020 10:31:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC6248D0002; Mon, 30 Nov 2020 10:31:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB49D8D000B; Mon, 30 Nov 2020 10:31:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id B218C8D0002 for ; Mon, 30 Nov 2020 10:31:23 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 506223629 for ; Mon, 30 Nov 2020 15:31:23 +0000 (UTC) X-FDA: 77541473646.16.drum95_3c17c6b273a3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 160DA100E6912 for ; Mon, 30 Nov 2020 15:31:23 +0000 (UTC) X-HE-Tag: drum95_3c17c6b273a3 X-Filterd-Recvd-Size: 5033 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 15:31:22 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id n132so11156147qke.1 for ; Mon, 30 Nov 2020 07:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=U8nOrVaPuX5bihpcc78kkshqsob3zo9wigFFV5UIQ8s=; b=n1NlO+k6OaI0DsbSSo80XTYnquXpXq+Qn/eDOdnfypY/RctUmGTuxRJLMO2+pYHOqt EZ/VfMBnOLT47dZ+eawBc4SPmjIeqy89Spq3vxxtlltx7S9uzuNX5CZHAX6vK3XIgO+r +aVAQqgmmKb2kZss9gTtgE2W6TaNuqYE3WjQ9PqIeeTHEDiiJNFOdMyEgSTYp+dRVVyx JA6VM//OLDbFxtaO3KFl0x8rxkFMjSExRoINNLq1gvyL2YfF9k8MdxhANw7++aOQAhEe ke30+uwtL4TcSwfqQV9DMwfiZnwtPM7SrGjQykbAIa0J8e7aKSkcFGNEqRueWkuTWO2M UH+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=U8nOrVaPuX5bihpcc78kkshqsob3zo9wigFFV5UIQ8s=; b=VYR3bRle+1jCADUlpB5ZQas0NrwSsSRtm1kjDv6oKrPennwqaprt4YicU239jz8nrE VNVAzqjKPnorQFr0LWMPZpnwkaF5NsymmctG0Or6Z/gG0UMZG44bMd0vfAGGWQFyKUyW Z3Mm5J1xACq0mO+qmADsiF3B93EST6HFBKLT/VwSXCEnG9IS1/ar4DGA4vwyBb16xPjg o5yYPwninKqq7c8TFJr+h08vW1pDA6LoZeP68qZJhZvAbsmXDwOgEHUEhqRY0rdpY2BR gZXmPnoaMmXYLiGNkakpl5FnkNr8dzVqI/t/en3j5dkpFbVr8IYe91vYAj96pS4uk6xW LgYA== X-Gm-Message-State: AOAM530PmrWqDKuZ/pGrmiv0dwmsNZYLaXowCVyJxAQTkELydM6oJigr qdmzM7tiyfWNtpzLe3lrSafawg== X-Google-Smtp-Source: ABdhPJx7gKRSYCvH2HyMkfzeCX3aFgKsSb6376UCt6J34b5E3+q/1dALMhmOskD6A8yu12/U4Pr00A== X-Received: by 2002:a37:4658:: with SMTP id t85mr20664892qka.210.1606750281813; Mon, 30 Nov 2020 07:31:21 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id n21sm15860261qke.32.2020.11.30.07.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 07:31:20 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kjl96-0044kf-5M; Mon, 30 Nov 2020 11:31:20 -0400 Date: Mon, 30 Nov 2020 11:31:20 -0400 From: Jason Gunthorpe To: Peter Zijlstra Cc: x86@kernel.org, willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de Subject: Re: [RFC][PATCH 5/9] mm: Rename pmd_read_atomic() Message-ID: <20201130153120.GZ5487@ziepe.ca> References: <20201130112705.900705277@infradead.org> <20201130113603.079835817@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201130113603.079835817@infradead.org> 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: On Mon, Nov 30, 2020 at 12:27:10PM +0100, Peter Zijlstra wrote: > There's no point in having the identical routines for PTE/PMD have > different names. > > Signed-off-by: Peter Zijlstra (Intel) > include/linux/pgtable.h | 7 +------ > mm/hmm.c | 2 +- > mm/mapping_dirty_helpers.c | 2 +- > mm/mprotect.c | 2 +- > mm/userfaultfd.c | 2 +- > 5 files changed, 5 insertions(+), 10 deletions(-) > > +++ b/include/linux/pgtable.h > @@ -1244,11 +1244,6 @@ static inline int pud_trans_unstable(pud > #endif > } > > -static inline pmd_t pmd_read_atomic(pmd_t *pmdp) > -{ > - return pmdp_get_lockless(pmdp); > -} > - > #ifndef arch_needs_pgtable_deposit > #define arch_needs_pgtable_deposit() (false) > #endif > @@ -1275,7 +1270,7 @@ static inline pmd_t pmd_read_atomic(pmd_ > */ > static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) > { > - pmd_t pmdval = pmd_read_atomic(pmd); > + pmd_t pmdval = pmdp_get_lockless(pmd); > /* > * The barrier will stabilize the pmdval in a register or on > * the stack so that it will stop changing under the code. > +++ b/mm/hmm.c > @@ -356,7 +356,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, > * huge or device mapping one and compute corresponding pfn > * values. > */ > - pmd = pmd_read_atomic(pmdp); > + pmd = pmdp_get_lockless(pmdp); > barrier(); > if (!pmd_devmap(pmd) && !pmd_trans_huge(pmd)) > goto again; The pagewalk API doesn't call the functions with interrupts disabled, doesn't this mean we hit this assertion? +#if CONFIG_PGTABLE_LEVELS > 2 +static inline pmd_t pmdp_get_lockless(pmd_t *pmdp) +{ + pmd_t pmd; + + lockdep_assert_irqs_disabled(); + It is only holding the read side of the mmap_sem here Jason