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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 04D36C43331 for ; Mon, 30 Mar 2020 12:17:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC9F1206F6 for ; Mon, 30 Mar 2020 12:17:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CgpMiKLF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC9F1206F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rK3XHe1KppVtJX3Js8QEdnTLaTCt1Ndtl8ueU6q6fXo=; b=CgpMiKLFuSOt/b v3VvC8Ih6+DSDkd8vM48OrO8/R3J76gkCWoAXoA/ebQfFqtXHAq3NKSmBgfCmwjWe13IFXivfUXyQ kqGKKUvihyIkb6gfluU3f384hz2PzsVdyPf1kklrzfRc44vyhyqicHOka7TBJyUbLd+V9Oax6UwmQ O3yQcWGqlnGn3L/TxbLEcJBjaJeCaj6cQ2fvpfASRoQayp6u0ef3J4Oh0oqHnYprW2JzNQ0FHnW6p GCAbYlhrv74NYHZiOfO+lXxm64HBNyImKYBb4Lg/uYPIK8Y1Bwa0ob+1kDESeGbr7PcFmA5cCawVa LA05DVlJTL8oCcNbp9Cg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jItLi-0004XY-CO; Mon, 30 Mar 2020 12:17:02 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jItLd-0004XC-Ka; Mon, 30 Mar 2020 12:16:57 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id EAFAE303C41; Mon, 30 Mar 2020 14:16:54 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CDA5F29D04D6E; Mon, 30 Mar 2020 14:16:54 +0200 (CEST) Date: Mon, 30 Mar 2020 14:16:54 +0200 From: Peter Zijlstra To: Zhenyu Ye Subject: Re: [RFC][Qusetion] the value of cleared_(ptes|pmds|puds|p4ds) in struct mmu_gather Message-ID: <20200330121654.GL20696@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Marc Zyngier , will.deacon@arm.com, linux-kernel@vger.kernel.org, npiggin@gmail.com, arm@kernel.org, bp@alien8.de, xiexiangyou@huawei.com, luto@kernel.org, schwidefsky@de.ibm.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, mingo@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Mar 28, 2020 at 12:30:50PM +0800, Zhenyu Ye wrote: > Hi all, > > commit a6d60245 "Track which levels of the page tables have been cleared" > added cleared_(ptes|pmds|puds|p4ds) in struct mmu_gather, and the values > of them are set in some places. For example: > > In include/asm-generic/tlb.h, pte_free_tlb() set the tlb->cleared_pmds: > ---8<--- > #ifndef pte_free_tlb > #define pte_free_tlb(tlb, ptep, address) \ > do { \ > __tlb_adjust_range(tlb, address, PAGE_SIZE); \ > tlb->freed_tables = 1; \ > tlb->cleared_pmds = 1; \ > __pte_free_tlb(tlb, ptep, address); \ > } while (0) > #endif > ---8<--- > > > However, in arch/s390/include/asm/tlb.h, pte_free_tlb() set the tlb->cleared_ptes: > ---8<--- > static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > unsigned long address) > { > __tlb_adjust_range(tlb, address, PAGE_SIZE); > tlb->mm->context.flush_mm = 1; > tlb->freed_tables = 1; > tlb->cleared_ptes = 1; > /* > * page_table_free_rcu takes care of the allocation bit masks > * of the 2K table fragments in the 4K page table page, > * then calls tlb_remove_table. > */ > page_table_free_rcu(tlb, (unsigned long *) pte, address); > } > ---8<--- > > > In my view, the cleared_(ptes|pmds|puds) and (pte|pmd|pud)_free_tlb > correspond one-to-one. So we should set cleared_ptes in pte_free_tlb(), > then use it when needed. So pte_free_tlb() clears a table of PTE entries, or a PMD level entity, also see free_pte_range(). So the generic code makes sense to me. The PTE level invalidations will have happened on tlb_remove_tlb_entry(). > I'm very confused about this. Which is wrong? Or is there something > I understand wrong? I agree the s390 case is puzzling, Martin does s390 need a PTE level invalidate for removing a PTE table or was this a mistake? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel