Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1816043imm; Sat, 4 Aug 2018 11:24:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfE/Q1UoHQBm7mRbMEpa6/duvUA2hY/9Q7uFwm9eOINGyRfFrUkF1ohbLyxW4tMxHEt69k9 X-Received: by 2002:a63:b43:: with SMTP id a3-v6mr8439443pgl.50.1533407085775; Sat, 04 Aug 2018 11:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533407085; cv=none; d=google.com; s=arc-20160816; b=rjGCEb5XpzZFfMFm/QJQUCyFYXalgh+fRE9ZWd0DL/ZMIPkya2A+tXFByoAW3QsVTy 0+vzeMfUTPiVzkN5oEc6jPFMcTnGtG/JSz1vrosKwr0GN1W3tCINwjcPbPBGCw5VP6jB lMjsPuNNyzENiPz2mAsCYqazDSYSFiJx/uxnJqg3fhTL7jBXqDTsMFZml7eyKAnN96sV A8XBavZAGNdZSIEqKRZ3+66DW9WqYPR5TDCv/Yss30P1OVIAxFyqp/18yQEi0tsPetDM Eb8UbVCNtPGiCnwi6UlbaPZj0qNYKLF6tG6CCwRJKkL86wO7gabB3usHgWTanMrXbpFP hcbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=bCwe84L7p9AwTasKI4cVE0v5oPhE5ctCQBIpeDuk1N8=; b=GPtgUq2537RNDfqM9cqDIObRElQYu6ZNvh6NrP4cr504FsubU5IctxUsC9mRLNJLJB /5+si3+MmJ8nJivDKYgVdy0s+7nu9j7m6/AsI3Ycd0tzFI2HeIa225I+jUuMgLCXOsJx B2Be9pCv8m82V0aCHvMDlpvB4W7hTSWaQc0kdHZWoDYyqpddZqMrNeAejzsFdadjW3zr yYfVNkWVetrntXFsqkDflJ5HLm1BwxDmfKumsZRFlixJEwClu/vpFXKoZg/h9oiu8D66 c3zxFR9vo1Lenx0VzzHFD7YUtCYDNH73PN17PYGK249aO3PT3WVtIVziWtJu5EroKcSZ zwAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M16qRQJA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16-v6si8025428pfo.339.2018.08.04.11.24.31; Sat, 04 Aug 2018 11:24:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M16qRQJA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729648AbeHDUZP (ORCPT + 99 others); Sat, 4 Aug 2018 16:25:15 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36710 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728054AbeHDUZP (ORCPT ); Sat, 4 Aug 2018 16:25:15 -0400 Received: by mail-pl0-f66.google.com with SMTP id e11-v6so3942807plb.3 for ; Sat, 04 Aug 2018 11:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=bCwe84L7p9AwTasKI4cVE0v5oPhE5ctCQBIpeDuk1N8=; b=M16qRQJAEdku+HjQgS3mukQo1x8APQFNStaWoDB8OlU3EeAOimC55zQE7tp3EbN2mO UvyuRwiwpeEigR8YNDMaIvAmEXtqp7Adtzw3AzckXOo6JosWb8fLmWjaiO+yIZ1KBYw2 /hIil+DUytD/ya4yzVCjKVi4ArFv+kCKdEt1nJssbuyLwvtVMZcknJYaEnIbnl5dX2rO TWOqGWyH6qFOWi0nDauzzZl884uQqJ/OUm4QEfy5ycmggryb6Gbe9PLhVvy5/gi3cakL ykcM61S3PzaSVwdkJx3y5s1B0QA4SlRxuEqQM4Ha5drFcxq4vQAL72KMdaH08wVB/gaR 1yDg== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=bCwe84L7p9AwTasKI4cVE0v5oPhE5ctCQBIpeDuk1N8=; b=Ah+/jfeiRUCoAnwNt7XXOcwHHgrYMWsqNbvj2QaS/OAAFyZU2e2r7/BZeBz3mL7Inm Rpu2LuEvPDvFsMXT2RA8dBwZSauSQomNS7cufUBjexKaVZ4USJt53oQl/GTvLvgGb+CU KqU2dL0n3wbJRJ22F66Z9tnIDbxmiKh415uNTM4vNUiDgsgFnegejcMWciZxBhFZ99Fc nTWsmY7EJjSNqkMzfzxtn9FREoEvaIeAneddOaXVHHRgSCVTL8z1CGt1ETA4IL4g9TUw QkCUojGcdCC+egjV5Hpb6ZXHpiOr5hLjVkB/sskd98jyUs61eBw1UZBX0+7V6VbuUK02 OKTA== X-Gm-Message-State: AOUpUlEfFav/nVYxfimxoW4eIhMIFeWLW8fNbe3nYqChgktYKE2VQCB5 I9IYez+mAVsQvdkNzJFT8WlwIg== X-Received: by 2002:a17:902:6193:: with SMTP id u19-v6mr8016733plj.133.1533407023630; Sat, 04 Aug 2018 11:23:43 -0700 (PDT) Received: from [100.112.67.156] ([104.133.9.108]) by smtp.gmail.com with ESMTPSA id r83-v6sm17451965pgr.8.2018.08.04.11.23.41 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Aug 2018 11:23:41 -0700 (PDT) Date: Sat, 4 Aug 2018 11:23:34 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Linus Torvalds cc: Hugh Dickins , Dave Hansen , Linux Kernel Mailing List , Kees Cook , Thomas Gleixner , Ingo Molnar , Andrea Arcangeli , =?UTF-8?Q?J=C3=BCrgen_Gro=C3=9F?= , Josh Poimboeuf , Greg Kroah-Hartman , Peter Zijlstra , Borislav Petkov , Andrew Lutomirski , Andi Kleen Subject: Re: [PATCH 3/7] x86/mm/init: pass unconverted symbol addresses to free_init_pages() In-Reply-To: Message-ID: References: <20180802225823.4711C55B@viggo.jf.intel.com> <20180802225828.89B2D0E2@viggo.jf.intel.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 4 Aug 2018, Linus Torvalds wrote: > On Fri, Aug 3, 2018 at 5:19 PM Hugh Dickins wrote: > > > > I thought that virt_to_page() only works on virtual addresses > > in the direct map > > You're right that virt_to_page() does not work on any _actual_ virtual > mappings (ie no user pages, and no vmalloc() pages etc). It does not > follow page tables at all. > > And on 32-bit, it literally ends up doing (see __phys_addr_nodebug()) a simple > > #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) > > However, on x86-64, we have *two* cases of direct mappings: we have > the one at __START_KERNEL_map, and we have the one at PAGE_OFFSET. > > And virt_to_page() handles both of those direct mappings. > > Annoying? Yes. And it has caused bugs in the past. And I entirely > forget why we needed it on x86-64. > > [ Goes around and rummages ] > > Oh, never mind, looking around reminded me why: we want to map the > kernel text in the top 31 bits, so that we can use the faster > -mcmodel=kernel because all symbols fit in sign-extended 32 bits. > > Maybe there was some other reason too, but I think that's it. Thanks a lot for writing that up. You shamed me into grepping a little harder than I did yesterday, when all I could find were "- PAGE_OFFSET" conversions (maybe I got lost in 32-bit-land). I had missed __phys_addr_nodebug(), where the __START_KERNEL_map alternative is handled. Hugh