Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2239989ybl; Sun, 18 Aug 2019 21:50:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwO9uNwBXhdO04szJGFFKR7bNIqXUscIylLoHPDNTVDMYW5EUBLKRc7oHHzSgmljaK98wGr X-Received: by 2002:a17:902:ca:: with SMTP id a68mr20306751pla.204.1566190248618; Sun, 18 Aug 2019 21:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566190248; cv=none; d=google.com; s=arc-20160816; b=H5Ok76Syx++COY6yr98n6xjrC73Ru8HAlvUUSmTJimwH01pMFsGUJ7nhcq5n+4oc4r 0PFvdEgzK4TT5/IwrBvd3mF/ll2yWnWv4eCXV5Uz7Tpp+BwBJNlehJhYqedjEF2k0ppV vyD29hoG82W0sUPaj/s93fxJV8C9jVd17cZOsa7MH2Hw/lsDibvsvcNntF7n4+AETk4J i2JXdeHp5YgQVYI+p1Qc0KGDFDSDPmyc0IwOJ46UNh58Lt1tL7yDfJeuEUQvl7H8nFXC 7u3UTZ5SeXT5WO3dcL2YTaWfFFXO9tGB1GKOBSv7w71RzaDXjgacl4mxYtnghvL9Aqqh 7D/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=60R/A+kC11q0AvPf3oQzvFsQ9aUEzwZLL3SNB5rWKEw=; b=ZEp1QkFvTC9XzpvM2PKQbUDwnZ1+DqK5ENIV/f++gMAYAj0XMmtWJR09XbaOYElOG1 6rV/Jl0Xmsmv4mUijAEbWcpTLZsDoTsIDORvbjEaD8EXThbFRUNIemmvK9eamiE+95E5 wr+3gX66n6YHkoX62jP06rws+K76PjC0FggpDsHA/Ta2ClI1AiGT3IJNklTQWjKr/TMv ABcVBqcW7nQhOn6k4vAOvLEhAWgd9ny7pFK15CZJc4Hy5svfTFcf5eV4K8UZ2LyE/oGA zYc/CTXp4aur6FdCdRDy57vqgQA3ngK0JMPzwXSqaDaysr3iW4dez2Fk557EBd5yPa17 XgTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=nL8FCkBR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si4968120pll.35.2019.08.18.21.50.33; Sun, 18 Aug 2019 21:50:48 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=nL8FCkBR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726487AbfHSEtP (ORCPT + 99 others); Mon, 19 Aug 2019 00:49:15 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:34921 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfHSEtP (ORCPT ); Mon, 19 Aug 2019 00:49:15 -0400 Received: by mail-wm1-f65.google.com with SMTP id l2so374423wmg.0 for ; Sun, 18 Aug 2019 21:49:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=60R/A+kC11q0AvPf3oQzvFsQ9aUEzwZLL3SNB5rWKEw=; b=nL8FCkBRIA9ZswKPpogtISq5zl3WUFiheZbLSi4QEdbvtLimsxQoQLIeMP5JtAlFDb ykekZsfnKLDai2fFfF6b69ku6rZ1zeROwWKbI1b80N6JfI5MB8jllwsI5CFVXgQuuuxN e9UCBmJsfHCY8xOf0ovTQbF9ScYF5/EckXpbRiSxJ3tI8PWZ3Tceg/KpRmzFp9H0hT/h WP6bXwT6hKDIXh27OqGvbD8AYcnweAMzQLz8+kZVzsJPT0fkkD8qOmmPWNI6aikATE3u 39AKL36oW88Kc2Qvtj9T1hqdFnJN3ANrwExyfgA+wg1rrEtxGzcqwoRbpbzWelINbDYn rBpw== 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=60R/A+kC11q0AvPf3oQzvFsQ9aUEzwZLL3SNB5rWKEw=; b=twSFI1yweVsXoOsKOJCJr733VaIw6+TADyw0PVp9reWLZdt5SJfmr4wYl2lwDLEzkB N/Ma4X1v0cKo5XQCj1OLlyJU8jjKKrxiigDWoc5KHAx3DOrWUGRhsAZyg1CG7qKV0eT8 Mv6qOB49hxXeo/H5T1l03KIkzgIyH3efvsXaVX84YMQlqz/8XXwvm79W85xh3ttO5Y7U DCblaB5y2J5KjDgy6ls6DiHKmuVCvQVBqjB/vNnKMX9hNaH514jhPXyZ84s0gGYIrTAe 9Zvu88Onxms0TPp9Zg2eBQOh31jMLP2ukeqMY2UgF9v5B/yi4xqZNSwcGeIPCPCf14R0 mI6Q== X-Gm-Message-State: APjAAAW+c24MOgXAoGFD05GAjvrhp7ARdAkPiU6LJKn/FdrP8YL5DtL1 G78CTGXOz3SuSTuAI3cnH9OSY1w/CU745B4dcDQsRA== X-Received: by 2002:a1c:c909:: with SMTP id f9mr5518379wmb.52.1566190152793; Sun, 18 Aug 2019 21:49:12 -0700 (PDT) MIME-Version: 1.0 References: <20190816114915.4648-1-anup.patel@wdc.com> <20190818181914.GB20217@infradead.org> In-Reply-To: <20190818181914.GB20217@infradead.org> From: Anup Patel Date: Mon, 19 Aug 2019 10:19:01 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: Fix FIXMAP area corruption on RV32 systems To: Christoph Hellwig Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , "linux-kernel@vger.kernel.org" , Atish Patra , Alistair Francis , "linux-riscv@lists.infradead.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 18, 2019 at 11:49 PM Christoph Hellwig wrote: > > > +#define FIXADDR_TOP (VMALLOC_START) > > Nit: no need for the braces, the definitions below don't use it > either. Sure, I will update and send v2 soon. > > > +#ifdef CONFIG_64BIT > > +#define FIXADDR_SIZE PMD_SIZE > > +#else > > +#define FIXADDR_SIZE PGDIR_SIZE > > +#endif > > +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) > > + > > /* > > - * Task size is 0x4000000000 for RV64 or 0xb800000 for RV32. > > + * Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32. > > * Note that PGDIR_SIZE must evenly divide TASK_SIZE. > > */ > > #ifdef CONFIG_64BIT > > #define TASK_SIZE (PGDIR_SIZE * PTRS_PER_PGD / 2) > > #else > > -#define TASK_SIZE VMALLOC_START > > +#define TASK_SIZE FIXADDR_START > > #endif > > Mentioning the addresses is a little weird. IMHO this would be > a much nicer place to explain the high-level memory layout, including > maybe a little ASCII art. Also we could have one #ifdef CONFIG_64BIT > for both related values. Last but not least instead of saying that > something should be dividable it would be nice to have a BUILD_BUG_ON > to enforce it. > > Either way we are late in the cycle, so I guess this is ok for now: > > Reviewed-by: Christoph Hellwig > > But I'd love to see this area improved a little further as it is full > of mine fields. I agree with you. We also have Sparsemem and KASAN patches which touch virtual memory layout so it's important to have virtual memory layout documented clearly. I can add the required documentation as separate patch. I think the best place to add ASCII art would be asm/pgtable.h where all virtual memory related defines are placed. Suggestions?? Regards, Anup