Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp418921pxu; Thu, 15 Oct 2020 07:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSkvZQItV1TopSEs2Us7GcIC+RUCsph4ijFpfskaRFiSvvbetkcBRNGAkRlchXvYkrW26E X-Received: by 2002:a17:906:7f8c:: with SMTP id f12mr4953690ejr.8.1602771437866; Thu, 15 Oct 2020 07:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602771437; cv=none; d=google.com; s=arc-20160816; b=JCrJt+ky0BMma/k4QHwEMBHvUloZhaYCq/cwbxnEHkbgT+cRJ35equAZTqvrX5wX54 vMBi271uxGVGC62l/THoyZdAWvtGdWYjC9aBcWFBO2Fg0aRoHUrO6mx4dASPEtPWxKmR oJA66kTDn/y8DBP4KNGK2IQ1vx76V/B5oO9llETpC6zwSFrMjhSmyhn5JDD0qk3lxekn X1jm1zlwVbYsE5VAz1movVkYbMoRTyi6bg4OojxfkyCYNQHEbnWHoLljNZcaaJuiFNn5 P+AeWkx1Y69mUsSKDoRrEz5tgvCBkWVbV++7lL//OEuWCZ9GENvFBRSTe9DzoU8y3oP3 B9jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=myXCOQxC7yXdiZx9nG9HTWtecWE6QzVgfe61cEeMHyM=; b=O32ylM4WtYsd+Wf8p/Kv6egvMjdjh9DzomnUFdrYVYyq6W4dkvAl9GKFuEe2rCyxjv EormIoVQD4QGzN0yXrk+CUTohBDXti6mNWvj7Vy+V4auxmovEqvylZllqvtwLTsrzn36 Q4sWED80xc64C+8bR8/WQYDeS3ACGHF+ykBU968KW0MtB49iurVv03HZDllf82z5zOdu PaFwJiFbFySRc8dw06Iq0tjT1iBbqY1s5PNS905Zsi+NugR7wwzwAhgDh2LAeTzjHTlw 21V36AybTYD67UyYTwRjaKuSmlEMVIYmXJgMRskCdj55CDdlAYsAr9nR/xhighOYcz1a HE0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ENts0Dm6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si2244278ejr.545.2020.10.15.07.16.47; Thu, 15 Oct 2020 07:17:17 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=ENts0Dm6; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730681AbgJOOPQ (ORCPT + 99 others); Thu, 15 Oct 2020 10:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbgJOOPP (ORCPT ); Thu, 15 Oct 2020 10:15:15 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBEEBC061755 for ; Thu, 15 Oct 2020 07:15:15 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id q136so3250446oic.8 for ; Thu, 15 Oct 2020 07:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=myXCOQxC7yXdiZx9nG9HTWtecWE6QzVgfe61cEeMHyM=; b=ENts0Dm6VGl7JCrVX9DHKihoOjKWkL7zveAIJ88O1VvyEPa+oWNJrNnTUWLffpC6YL TKZfpXNJbyP7fOMAXYpJ0KmJMck477GzDbGvCHaRGkgeHkHFOsBsY/s6bxT9DLFL20Wg Lp9tAvWitbNSqAceLGVBs2lBdVwx4XkdZ63C6gQF6eEnSWbzQiJmzL8b0lQnxlxxHsjn 2SbT8k3vEXKhH9Fcm8pjPRq8G6g4Y8Ss/j2S4HlSy1iO2NEchpEGTtl13KO8zAtQPtjj oL0+DzHoIHfHbQeV7XLjRxB12RnVxxOZsxBn8uVVr9NnNtMqM/Aih4wmRUg22V6JXiEA aL/A== 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=myXCOQxC7yXdiZx9nG9HTWtecWE6QzVgfe61cEeMHyM=; b=D4w0qy1Zr1RL7wFgCTwBid95TVMcHf1IcZxtOmrsWrfTky4hPj8jpl8fT8yhq2MfvF W5GcyNNXSINT3z+WN03bzmbg72sz0bcjbMzz43PuRz9YjyPMhd4r+Fnk0+Mp1rwIb04Z yK8tgVV6cmY/6jSmX1mOtnFss6Wq7IbIgRIe9Y1lNalAG8+kZtX7LhDKYZC9lkZDYHOx VOGwF56k6VIBogz6BO8ugrwROO/qGIf8Cq1Ikmv6uy+UVDpt9Ccr77Zja2r1DzAyEEQ/ HBHJQy0za6qxm7NEfZ2dVnvmS7vR0mnKmu/sjCqqZtI5MdDGGLNTlVNzYfYS38Zx5gqH TJnw== X-Gm-Message-State: AOAM5302mbwTH/ut3LNtOUFBKXD8pmKBFYTABujPCmJ+z6lFad+KpuhT vtZqAHI+HWzuETvnaDlzo/8DkvHAvC62jf7OVCh0jA== X-Received: by 2002:aca:6206:: with SMTP id w6mr1155830oib.121.1602771314808; Thu, 15 Oct 2020 07:15:14 -0700 (PDT) MIME-Version: 1.0 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> <20201015133948.GB50416@C02TD0UTHF1T.local> In-Reply-To: <20201015133948.GB50416@C02TD0UTHF1T.local> From: Marco Elver Date: Thu, 15 Oct 2020 16:15:03 +0200 Message-ID: Subject: Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64 To: Mark Rutland 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Oct 2020 at 15:39, Mark Rutland wrote: > 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. We had to take care of setting PageSlab before, too. We do this during kfence_init(). > 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(). Very good, thank you. We'll send v5 with these changes rebased on 5.10-rc1 (in ~2 weeks). Thanks, -- Marco