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=-3.8 required=3.0 tests=BAYES_00,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 039E7C433DB for ; Mon, 15 Feb 2021 22:30:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 ACF8764DF4 for ; Mon, 15 Feb 2021 22:30:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACF8764DF4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wDQmBt2IOKZWCWP4MiM1bHv82VdlAxAMIyB46M4B6Rc=; b=a3ns9K5UU0iWQPOvWN3lxK76m cdpTc8xVaMS/Q9Rqu4lB91pkN/JrEaeD0zqQ5SKwnMh0ZOMJzsuHOtGkdhp2GdKsIzLOvIYDcpayW FnIIpCT4791syKNhK6ILlshXCmkh4yu0EfzMS7Nu112yV43grF8Sd7ce+ppxTvc7pCgCYoQFWpZ6M z7F4W7hWGKEYuGRAD1jqPFbRbCBt8Gq0kFuz5Vpn41Vg3q8A4xzcmYt/qQvcTnxMFB/ibZ9gGRRFj C0NjQF2+IbpTaVI5Vuh84PpbjOPUOE4g2D5EBPoYaAqj5rXR1YVt7+i9ISRQWsQAvR02gmLcwhmSL MmgGvlcBQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBmMU-0007IK-TQ; Mon, 15 Feb 2021 22:28:58 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBmMS-0007I0-1I for linux-arm-kernel@lists.infradead.org; Mon, 15 Feb 2021 22:28:57 +0000 Received: by mail-ej1-x635.google.com with SMTP id b14so7725421eju.7 for ; Mon, 15 Feb 2021 14:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=05sKoXexSadkBXq5ZLjKbpzzvxIWvEZ9WIX+KtkpeFk=; b=hbEm1biyfMPQ9xoQ/26FfJzhfO5zc00EskdHHaT7wcWjPapSTYbJ+2p38X78sho2Zc ZSF8Y2wdnem5naK4FiKeqj4nQdJ/XRIxIT6vyUD/QuH0nmThAd1x29pG+TBitmMvaifh vA86bOc/XNw7W0I0uFIN9cOry/+MisZf1khg7bpn2gLXxMen+X/5yzs/XF6LTwFWuGjg AEXDBQTiGrf8dWpsicuKBc4Qlr7TPLAQSN6myNk3xdXXWmemFFTiBtq7sxDZa2MGvWkX 39J+cYJgU4gccTpFiyYEUrNNDjLOWWZMWK0oNeDrwsB2K/mYVSbroOhR8lreknwFvgVp bojA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=05sKoXexSadkBXq5ZLjKbpzzvxIWvEZ9WIX+KtkpeFk=; b=l4ts6qSkE4+oaOSX+X+6rKYcDox20q89q6VAKNWTtOA6hBD4T4WdjZaseYkvg8DUIL w8X+Jd/Lg/E5yv3e0qlSgR/8/3HweabzAjo5dSWGp0KWnf3nAJiMav8c0rBSE8R8RDT6 L4KevT86L41txEE5Ryf/ErXCl1EZjsfy96PIUMbnhK3mPrKaI3gLQ52sEDUzpqdZFDbt jQJ5pPhGNuzE8xwPjNuBmlY/N+HgB0U0lgo8nMUITJbBoCibvX9XJi43LvxGXHmwAlBI ZeZhCUlaCE+WtIEMU9irLMyFONMViGbi8XUNRIKACc1vOa1V4h9mNHHWlDYHZYLLBXNk O9oA== X-Gm-Message-State: AOAM530W5vWO/bK6+bFhd0GqmgZcws1jxmzYZe6uL4cnE/ik0eTjupQm fCsDZrg+bb86kKM+fGYLjA8Ykeja82V/5ZkAD4qf+w== X-Google-Smtp-Source: ABdhPJwo6M51ZPNwR1JeEZZAoGD7aJzC15GZYcmvrLuRs7Mg0ECy/y7xCy7b9S+7FWMZGLydULUFXPaiPHns2xt4ags= X-Received: by 2002:a17:906:f1d0:: with SMTP id gx16mr9784520ejb.383.1613428134360; Mon, 15 Feb 2021 14:28:54 -0800 (PST) MIME-Version: 1.0 References: <20210215192237.362706-1-pasha.tatashin@soleen.com> <20210215192237.362706-2-pasha.tatashin@soleen.com> In-Reply-To: From: Pavel Tatashin Date: Mon, 15 Feb 2021 17:28:18 -0500 Message-ID: Subject: Re: [PATCH v2 1/1] arm64: mm: correct the inside linear map boundaries during hotplug check To: Ard Biesheuvel X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210215_172856_401355_104B58AF X-CRM114-Status: GOOD ( 12.85 ) 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: Anshuman Khandual , Catalin Marinas , James Morris , Linux Kernel Mailing List , Logan Gunthorpe , Tyler Hicks , Linux ARM , Andrew Morton , Will Deacon , Mike Rapoport Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > > > > Btw, the KASLR check is incorrect: memstart_addr could also be > > negative when running the 52-bit VA kernel on hardware that is only > > 48-bit VA capable. > > Good point! > > if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52) && (vabits_actual != 52)) > memstart_addr -= _PAGE_OFFSET(48) - _PAGE_OFFSET(52); > > So, I will remove IS_ENABLED(CONFIG_RANDOMIZE_BASE) again. Hi Ard, Actually, looking more at this, I do not see how with 52VA on a 48VA processor start offset can become negative unless randomization is involved. The start of the linear map will point to the first physical address that is reported by memblock_start_of_DRAM(). However, memstart_addr will be negative. So, I think the current approach using IS_ENABLED(CONFIG_RANDOMIZE_BASE) is good. 48VA processor with VA_BITS_48: memstart_addr 40000000 start_linear_pa 40000000 end_linear_pa 80003fffffff 48VA processor with VA_BITS_52: memstart_addr fff1000040000000 <- Negative start_linear_pa 40000000 <- positive, and the first PA address end_linear_pa 80003fffffff Thank you, Pasha _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel