Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp943891ybk; Sun, 10 May 2020 01:19:42 -0700 (PDT) X-Google-Smtp-Source: APiQypLG9hpw6gthwVMsRQfKgppoF/W9fJxIFTmzLpvc4WqP1mtLbXVghhhAdBlVZHly/z9YJKPx X-Received: by 2002:a50:f058:: with SMTP id u24mr8282589edl.171.1589098781999; Sun, 10 May 2020 01:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589098781; cv=none; d=google.com; s=arc-20160816; b=JiPZa+xRODkLt3ol0y/NldYLWBtDnXBaoy8h6coXSFv/mE6z5PuU3h5v6A4m5NsVYJ 9SapnByuHHf8hjSEJFIDIOPcmo02McQ3deGDhZ/qcaaWhmoagCAm/srqq/+T7NmwOwkZ 1zOOsfgFH0Yypf6cQPGJ5FkN4cAi+v84P21ixDcqIAZUmswvtotIrH1mTRHNxheSQOjf NKo/bas4oQJIHXuhIZxJfU9z8cEp53xEgswjQONMfX7CfD/pX8sB9HfAPkhWYMG0jUZ4 RGgfp0gkaN+nPIx4Z5oezOdnRoWPOl0gpYVqQmq+fioAsYncQcwo69OjGN/1xG5sMRSO TbUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/3a5EaAY7ElMnMPiTBTRAaKBKmGkZVUgP21cJpOiGsg=; b=TPQdeS4y/IvWV5jB8526JQfSDgFgjfDJpvNs4YkD0849ebnmej0VhugjD8A5Vz3MO/ PuwyPaZpJ8dPnzgF+0LD6+lVEn6THQgqBWRsuK9KRSLiHRP2oP8irTzOpeWQcGD+Upbz mIdp2yuvLBxh2rlEEeda4GNKAD8SBefWLtIdSn+tD6JQsYBXgMrbenm3KgDakHV6u5ND G3xOPxHZGrHMyuEz2VcXyxM6f8XAUQ/JpXPjSL2/IsHDPsf/N87lAr89JaiU+HnPTKa2 okR33W9lxuw1GKhh7NbdFZKw+MsVtp0f5kuKeH7JLlHCOsTU8M4TN++KMh4IgwNqjtbF z8/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si4278901edy.602.2020.05.10.01.19.18; Sun, 10 May 2020 01:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728786AbgEJIPV (ORCPT + 99 others); Sun, 10 May 2020 04:15:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:60116 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbgEJIPV (ORCPT ); Sun, 10 May 2020 04:15:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AF43EAC69; Sun, 10 May 2020 08:15:21 +0000 (UTC) Date: Sun, 10 May 2020 10:15:16 +0200 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , X86 ML , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , "Rafael J. Wysocki" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Vlastimil Babka , Michal Hocko , LKML , Linux ACPI , linux-arch , Linux-MM Subject: Re: [RFC PATCH 0/7] mm: Get rid of vmalloc_sync_(un)mappings() Message-ID: <20200510081516.GX8135@suse.de> References: <20200508144043.13893-1-joro@8bytes.org> <20200508213609.GU8135@suse.de> <20200509175217.GV8135@suse.de> <20200509215713.GE18353@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 09, 2020 at 10:05:43PM -0700, Andy Lutomirski wrote: > On Sat, May 9, 2020 at 2:57 PM Joerg Roedel wrote: > I spent some time looking at the code, and I'm guessing you're talking > about the 3-level !SHARED_KERNEL_PMD case. I can't quite figure out > what's going on. > > Can you explain what is actually going on that causes different > mms/pgds to have top-level entries in the kernel range that point to > different tables? Because I'm not seeing why this makes any sense. There are three cases where the PMDs are not shared on x86-32: 1) With non-PAE the top-level is already the PMD level, because the page-table only has two levels. Since the top-level can't be shared, the PMDs are also not shared. 2) For some reason Xen-PV also does not share kernel PMDs on PAE systems, but I havn't looked into why. 3) On 32-bit PAE with PTI enabled the kernel address space contains the LDT mapping, which is also different per-PGD. There is one PMD entry reserved for the LDT, giving it 2MB of address space. I implemented it this way to keep the 32-bit implementation of PTI mostly similar to the 64-bit one. > Why does it need to be partitioned at all? The only thing that comes > to mind is that the LDT range is per-mm. So I can imagine that the > PAE case with a 3G user / 1G kernel split has to have the vmalloc > range and the LDT range in the same top-level entry. Yuck. PAE with 3G user / 1G kernel has _all_ of the kernel mappings in one top-level entry (direct-mapping, vmalloc, ldt, fixmap). > If it's *just* the LDT that's a problem, we could plausibly shrink the > user address range a little bit and put the LDT in the user portion. > I suppose this could end up creating its own set of problems involving > tracking which code owns which page tables. Yeah, for the PTI case it is only the LDT that causes the unshared kernel PMDs, but even if we move the LDT somewhere else we still have two-level paging and the xen-pv case. Joerg