Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp892690pxu; Thu, 3 Dec 2020 15:40:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQcNU3Pj7hnM1Uuc7HJ9hBELJ4NLKP2lDlB3fkD7BDUtMxnKMCM7UIwAgEY1x4IBFeZGpV X-Received: by 2002:a50:a694:: with SMTP id e20mr5075607edc.261.1607038800302; Thu, 03 Dec 2020 15:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607038800; cv=none; d=google.com; s=arc-20160816; b=MEf1M/YC2y9u9PbViZWDBeA6rEaOMxyKE3gafc0T3MTIW4XJibEUTvsGYkyMsB9oQK we/WVKXysqseDNR0swyNQjyxP1ISgUhJ7AJVeU86pcdeGW2avdxKC9iV8QE77RL+62lp QNgtFRSQDg+JH+bHxiJd1B7nG7xBwj95AyTUqHO+z6+pqt4ujKkP9tsaaItxIXRXO7ma R78M2ScEvzOeZTJEJAX3/4tMd9A1jzU9N5VvvcaR6H+wxKsB1ovs5Pnnp4B8jEtLyEje IjweNZK6XY9GbnBXoBSI8a3zbo4fGI5Fi2eKwT0OtOaJd/dZJ4y8WA6uybmbFguza82F OhGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:dkim-signature :date; bh=oHUdwEYVi2HqoQc3U2F78bnMW7TP2yhSZctiUTuc9kI=; b=iLeqUGNY00H2+9W0mB3ePXy/hgwAcC5tiDur3Qv54YDnHXjld2GiJGBJTRg4gDNKYU XLpCUnGZBfTPbNQbNH35cRZdGFf5qPxaY2igVTvCz6bqNcTxN0YB9KZD+L/P8mkzsj+b w6AgjuYcBKgQFz2j9tli8fwk+sv+6IA1Nx9c9bcoMlKwWooM9Zn186SAwJ5ZGW0aOuTU vsI0op56pJXN6X8k8a2/Pf1BrKnH671XlGQQoiF9NDucxf0GhQrM8p2yvpSIDxf8J8oB FJP+fcdPMgRW6dqafgBhDpE6xlqftpSjwnNGzIB65zUjPSPBN8vRBlJ90G1+BIb53jbE TuVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=kuOijURD; 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 m17si315549ejn.194.2020.12.03.15.39.37; Thu, 03 Dec 2020 15:40:00 -0800 (PST) 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; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=kuOijURD; 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 S1729738AbgLCXgy (ORCPT + 99 others); Thu, 3 Dec 2020 18:36:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:43522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgLCXgy (ORCPT ); Thu, 3 Dec 2020 18:36:54 -0500 Date: Thu, 3 Dec 2020 15:36:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1607038573; bh=Pa4oRfRRHtvNG6DkXhfCABnpMt5dHNY/S5ZIo3xu0I8=; h=From:To:Cc:Subject:In-Reply-To:References:From; b=kuOijURD2S/LKZN7m2xU1Yqs8aTgSaE+8PAXCjOUF+k6SmWXgnBX1a127MGk9xsxD Zehgx/bS+bttrniAwVRGaqKRk/HeHmkpC5g5mw+66gde6sKC1WxOhrIrOWZsRz9QI2 m7IWOOo+Ox/qds8Kx515xXzlhgz0bQmTT4jC/P9M= From: Andrew Morton To: Mike Rapoport Cc: Alexander Viro , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christopher Lameter , Dan Williams , Dave Hansen , David Hildenbrand , Elena Reshetova , "H. Peter Anvin" , Ingo Molnar , James Bottomley , "Kirill A. Shutemov" , Matthew Wilcox , Mark Rutland , Mike Rapoport , Michael Kerrisk , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Rick Edgecombe , Roman Gushchin , Shakeel Butt , Shuah Khan , Thomas Gleixner , Tycho Andersen , Will Deacon , linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-riscv@lists.infradead.org, x86@kernel.org Subject: Re: [PATCH v14 04/10] set_memory: allow querying whether set_direct_map_*() is actually enabled Message-Id: <20201203153610.724f40f26ca1620247bc6b09@linux-foundation.org> In-Reply-To: <20201203062949.5484-5-rppt@kernel.org> References: <20201203062949.5484-1-rppt@kernel.org> <20201203062949.5484-5-rppt@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Dec 2020 08:29:43 +0200 Mike Rapoport wrote: > From: Mike Rapoport > > On arm64, set_direct_map_*() functions may return 0 without actually > changing the linear map. This behaviour can be controlled using kernel > parameters, so we need a way to determine at runtime whether calls to > set_direct_map_invalid_noflush() and set_direct_map_default_noflush() have > any effect. > > Extend set_memory API with can_set_direct_map() function that allows > checking if calling set_direct_map_*() will actually change the page table, > replace several occurrences of open coded checks in arm64 with the new > function and provide a generic stub for architectures that always modify > page tables upon calls to set_direct_map APIs. > > ... > > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -477,7 +478,7 @@ static void __init map_mem(pgd_t *pgdp) > int flags = 0; > u64 i; > > - if (rodata_full || debug_pagealloc_enabled()) > + if (can_set_direct_map()) > flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; Changes in -next turned this into if (can_set_direct_map() || crash_mem_map)