Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754847AbbLKWpA (ORCPT ); Fri, 11 Dec 2015 17:45:00 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:33753 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754230AbbLKWo6 (ORCPT ); Fri, 11 Dec 2015 17:44:58 -0500 MIME-Version: 1.0 In-Reply-To: <20151211143300.0ac516fbd219a67954698f9a@linux-foundation.org> References: <20151211143300.0ac516fbd219a67954698f9a@linux-foundation.org> From: Andy Lutomirski Date: Fri, 11 Dec 2015 14:44:38 -0800 Message-ID: Subject: Re: [PATCH 2/6] mm: Add vm_insert_pfn_prot To: Andrew Morton Cc: Andy Lutomirski , X86 ML , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2001 Lines: 53 On Fri, Dec 11, 2015 at 2:33 PM, Andrew Morton wrote: > On Thu, 10 Dec 2015 19:21:43 -0800 Andy Lutomirski wrote: > >> The x86 vvar mapping contains pages with differing cacheability >> flags. This is currently only supported using (io_)remap_pfn_range, >> but those functions can't be used inside page faults. > > Foggy. What does "support" mean here? We currently have a hack in which every x86 mm has a "vvar" vma that has a .fault handler that always fails (it's the vm_special_mapping fault handler backed by an empty pages array). To make everything work, at mm startup, the vdso code uses remap_pfn_range and io_remap_pfn_range to poke the pfns into the page tables. I'd much rather implement this using the new .fault mechanism, and the canonical way to implement .fault seems to be vm_insert_pfn, and vm_insert_pfn doesn't allow setting per-page cacheability. Unfortunately, one of the three x86 vvar pages needs to be uncacheable because it's a genuine IO page, so I can't use vm_insert_pfn. I suppose I could just call io_remap_pfn_range from .fault, but I think that's frowned upon. Admittedly, I wasn't really sure *why* that's frowned upon. This goes way back to 2007 (e0dc0d8f4a327d033bfb63d43f113d5f31d11b3c) when .fault got fancier. > >> Add vm_insert_pfn_prot to support varying cacheability within the >> same non-COW VMA in a more sane manner. > > Here, "support" presumably means "insertion of pfns". Can we spell all > this out more completely please? Yes, will fix. > >> x86 needs this to avoid a CRIU-breaking and memory-wasting explosion >> of VMAs when supporting userspace access to the HPET. >> > > OtherwiseAck. --Andy -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/