Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp392953pxu; Thu, 15 Oct 2020 06:43:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4300pZ1UfLZdfKsGBupBx5no6Y+dH43FEfmw0fcndUaOZJOjxuvHRSzHOScsAhjqO24T/ X-Received: by 2002:aa7:d783:: with SMTP id s3mr4543044edq.214.1602769387427; Thu, 15 Oct 2020 06:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602769387; cv=none; d=google.com; s=arc-20160816; b=TwOKanskqV7wPbpkO3iOcOlMJehXguUczzagsj5p91mIykkscAKJ9z3uqxFYF8yhvz Sk/PqnpXBAqD1IXaIZRAglT9Yy9s4wQZu/DUVn1BskPgCSs+ME/F02WuW2F7qUT9Dyrw 65XrYsYfECPpjGhuvzphcjwJHnqhfPl6+t4/qRlGL/vz0RsZdu48nm+2yK+X+zORmqfv HTA2nsgIB3hSXHjAXoougVP+1IxRdJeGsPeIEQXqz7POk5ujsEyBcyPwbjqbMIWQZCi3 +cB21jL+5MpNwnb3iJBvW05Sv82LP+uMpBknTswdkYLN3TxFZ2GzyoDH7BuBjlOHyJXl C8Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tMBdVD7OKhIC3ci0bLAJhMYJOJKQVbkF/Id6z/zKZcE=; b=aVqJ8yVHyOGzxB+92SHXV2Hs2n79PjuekGkT8yyAVbdi9v0OZo3smXATFp38K/y69e Nr2S2Wvtpvlgnw7vEqtCKuhUKBkzW9widn7o7KlHrtyytYnswnUEC2uUTTaOg8VscK/L TsJxlCuTHHwHNn3gEQhkxzjq1SCvJX96cNxcMGR57ktULIHEUIyWZ9shL40SYajjx4aT ZII3wywtOhr3AN5KRbMt7N3gZvuU3lOCg3e0AeWpCmB/VEK/3KR1lKO+s3W5RDiq3lJD CxrwyAuzrmXxnHO/+5YgsiQEQUAbddzjqSJSLXdWT2bbrz6wgvLzTHko22muauZHrvOb UT1A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e18si2210178eji.106.2020.10.15.06.42.38; Thu, 15 Oct 2020 06:43:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729983AbgJONj6 (ORCPT + 99 others); Thu, 15 Oct 2020 09:39:58 -0400 Received: from foss.arm.com ([217.140.110.172]:43946 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbgJONj6 (ORCPT ); Thu, 15 Oct 2020 09:39:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8CFC013D5; Thu, 15 Oct 2020 06:39:57 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.51.4]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 58A683F719; Thu, 15 Oct 2020 06:39:51 -0700 (PDT) Date: Thu, 15 Oct 2020 14:39:48 +0100 From: Mark Rutland To: Marco Elver Cc: Alexander Potapenko , Will Deacon , Andrew Morton , "H. Peter Anvin" , "Paul E. McKenney" , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , Catalin Marinas , Christoph Lameter , Dave Hansen , David Rientjes , Dmitriy Vyukov , Eric Dumazet , Greg Kroah-Hartman , Hillf Danton , Ingo Molnar , Jann Horn , Jonathan Cameron , Jonathan Corbet , Joonsoo Kim , Kees Cook , Pekka Enberg , Peter Zijlstra , SeongJae Park , Thomas Gleixner , Vlastimil Babka , the arch/x86 maintainers , "open list:DOCUMENTATION" , LKML , kasan-dev , Linux ARM , Linux Memory Management List Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 Message-ID: <20201015133948.GB50416@C02TD0UTHF1T.local> References: <20200921132611.1700350-1-elver@google.com> <20200921132611.1700350-4-elver@google.com> <20200921143059.GO2139@willie-the-truck> <20200929140226.GB53442@C02TD0UTHF1T.local> <20201001175716.GA89689@C02TD0UTHF1T.local> <20201008104501.GB72325@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 09:12:37PM +0200, Marco Elver wrote: > On Thu, 8 Oct 2020 at 12:45, Mark Rutland wrote: > > On Thu, Oct 08, 2020 at 11:40:52AM +0200, Marco Elver wrote: > > > On Thu, 1 Oct 2020 at 19:58, Mark Rutland wrote: > > > > > > If you need virt_to_page() to work, the address has to be part of the > > > > > > linear/direct map. > > > We're going with dynamically allocating the pool (for both x86 and > > > arm64), [...] > We've got most of this sorted now for v5 -- thank you! > > The only thing we're wondering now, is if there are any corner cases > with using memblock_alloc'd memory for the KFENCE pool? (We'd like to > avoid page alloc's MAX_ORDER limit.) We have a version that passes > tests on x86 and arm64, but checking just in case. :-) AFAICT otherwise the only noticeable difference might be PageSlab(), if that's clear for KFENCE allocated pages? A few helpers appear to check that to determine how something was allocated (e.g. in the scatterlist and hwpoison code), and I suspect that needs to behave the same. Otherwise, I *think* using memblock_alloc should be fine on arm64; I'm not entirely sure for x86 (but suspect it's similar). On arm64: * All memory is given a struct page via memblocks_present() adding all memory memblocks. This includes memory allocated by memblock_alloc(). * All memory is mapped into the linear map via arm64's map_mem() adding all (non-nomap) memory memblocks. This includes memory allocated by memblock_alloc(). Thanks, Mark.