Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2944760img; Mon, 25 Mar 2019 00:00:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/RkPh1fqFyUtrrB8u+w7DM9fwDuwNARHRfMzzNzY9Q/wy/Fq6nYgpHoGNx1XUZactCJDm X-Received: by 2002:a17:902:be04:: with SMTP id r4mr10199403pls.218.1553497210672; Mon, 25 Mar 2019 00:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553497210; cv=none; d=google.com; s=arc-20160816; b=lI8qQoX36ZTTws4UootnoSYXR9y4+PhuFhapUMQ/1iIxvcOfTfa+Bzi6mTLEBQfbbd u51EfbZ17vcZleTFwIHBuL+AIfbXlfPHCkvVIN771DaClB00gw5LNqt18xNpaD5w6P7v 3VTMwdMtjwYDFxY8JHJUXGAFmZSoahIX9zhTLJSAOLEmNNGhBTSVZgL5TKlgxPaVXYpN zp1SsAmdvNKhGoOcmMcSX1LY2HPMaDwCI0ancS8793tQ/bEWv58Kgf5m4UD0TxmMSAbY DbzbZlZELFynSjYTd6jU+38ZE8OTOCWDET+ykPw4Uy+OBqhDSvVpCVu2k9QZvNNQ9i6m KALA== 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=N0CZYjFXovkJsI/9QEDEPROJKfnrmM28A3Czk4ehuJA=; b=GJVk/JccSm3bNdfL9rPe8IkfY38Ik2K2PkjQUWefw3Fo3kDIsYIXSGY7HoMlEFEkvu 2d+cn/5imLtddacfu7IzJ18J3CCRbX4se//BQejDbVBNq+KmDpapw9N95zLjRnZPVn5E 5wN0kgJcfADG6o+uV/RDeRD57MsQJo60HUBEXZGytcK7fRZWC+z6Zvf9NhuVFQpHV1ul 7VUeo+eTDmDjvIgWCnU8uiqu2Rok95rXUR8VIoqpcSQlxt5cjpezP3j45NcU5hGpstyN LjKAohwpBf0vJ9iW4T81i/QxDBxYyeMa5p/QL+pPM76g0wy/+Kr5JtmcplcIijwZYqpS UDWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=oCGunGSm; 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 j1si12823115pfe.189.2019.03.24.23.59.54; Mon, 25 Mar 2019 00:00:10 -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=oCGunGSm; 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 S1729760AbfCYG7N (ORCPT + 99 others); Mon, 25 Mar 2019 02:59:13 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46572 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729230AbfCYG7N (ORCPT ); Mon, 25 Mar 2019 02:59:13 -0400 Received: by mail-wr1-f67.google.com with SMTP id o1so8679578wrs.13 for ; Sun, 24 Mar 2019 23:59:12 -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=N0CZYjFXovkJsI/9QEDEPROJKfnrmM28A3Czk4ehuJA=; b=oCGunGSmmKDA7JdBCm21Xfd24OkSiuyoChBtmXQSA0fFH1TA0D6VZO2PDlmV1/l6aK KQB5BNj+8oIIQcYDfjkJ0t/+gKH3I6voTzNPzmWWMcMGifAhJH1ZMd14bbrSNyEZ7mEI hvIcELpCx40jr36iuwJrcAvzU474eJRwOq5r15NMR6I9ZUYSb8Gq8eey2im2B17M/Gkf Y/b6qFt6RmmdI0NHLxVQ1KwmttoG6WE5YDUE2iw4OC2gPHuiBV7xczemJluS2vKmg9Xt Czo45n4CATD2SS4QHRbNpbIRhG9gkK9e8eExInjJcVhVC0lGLrlYaW/wLI+5rf+P1Zer Zs6w== 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=N0CZYjFXovkJsI/9QEDEPROJKfnrmM28A3Czk4ehuJA=; b=AyhGitabRINDRE7J3sx/hzh6tUbKtv5DyB2ob3SUzVThFDqHPtoO6zle6hQxSrqXXl bS6Rx5+Jv6+i+E6+2flxDdzKn1aVfN2hlDf8KXhfwzqMQjkBeUDzw42nrAH8fhz0y/jz yI8XYaACZyi/b7CNKSr/j/iBijv+oKea1/Z4osvSMGHWTFtAJdoyUBtQ9z6X8IghlvV2 8CLJ8u8GWYV8eDAa1fRbTiMoeRb9LdpFICbNKk99I3NOR0WRf2ukNzpiCqjDtwkkeXay xZZxlgovsNxuiJTriZVwgUiIeYD/Q/JGuKc+AnNFi+nbezAUWH4VJ42wi9rcS06Ez6E+ /T3Q== X-Gm-Message-State: APjAAAVpvkPXdyTEB+4O/fqKWgqSaqNkWRYq8prNf9WC+ge8nGm1u6bV xglheoKpbwxqyncH6Dje5yyEnaP8kksECIG7/Q4XKQ== X-Received: by 2002:a5d:4087:: with SMTP id o7mr2766082wrp.9.1553497151665; Sun, 24 Mar 2019 23:59:11 -0700 (PDT) MIME-Version: 1.0 References: <20190325033648.16171-1-anup.patel@wdc.com> <20190325052550.GA30996@andestech.com> In-Reply-To: <20190325052550.GA30996@andestech.com> From: Anup Patel Date: Mon, 25 Mar 2019 12:29:00 +0530 Message-ID: Subject: Re: [PATCH v2] RISC-V: Always compile mm/init.c with cmodel=medany To: Alan Kao Cc: Anup Patel , Palmer Dabbelt , Albert Ou , "linux-kernel@vger.kernel.org" , Mike Rapoport , Christoph Hellwig , Atish Patra , Paul Walmsley , "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 Mon, Mar 25, 2019 at 10:56 AM Alan Kao wrote: > > Hi Anup, > > Sorry for being late to the party. I think one more thing should > move together with setup_vm(): > > On Mon, Mar 25, 2019 at 03:37:38AM +0000, Anup Patel wrote: > > The Linux RISC-V 32bit kernel is broken after we moved setup_vm() from > > kernel/setup.c to mm/init.c because Linux RISC-V 32bit kernel by default > > uses cmodel=medlow which results in a non-position-independent setup_vm(). > > > > This patch fixes Linux RISC-V 32bit kernel booting by: > > 1. Forcing cmodel=medany for mm/init.c > > 2. Moving remaing MM-related stuff va_pa_offset, pfn_base and > > empty_zero_page from kernel/setup.c to mm/init.c > > > > Fixes: 6f1e9e946f0b ("RISC-V: Move setup_vm() to mm/init.c") > > Suggested-by: Christoph Hellwig > > Suggested-by: Mike Rapoport > > Signed-off-by: Anup Patel > > --- > > v2: Removed CFLAGS_setup.o from kernel/Makefile and replaced SoBs > > --- > > arch/riscv/kernel/Makefile | 2 -- > > arch/riscv/kernel/setup.c | 8 -------- > > arch/riscv/mm/Makefile | 2 ++ > > arch/riscv/mm/init.c | 9 +++++++++ > > 4 files changed, 11 insertions(+), 10 deletions(-) > > > > diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile > > index f13f7f276639..8b9780b6bd7f 100644 > > --- a/arch/riscv/kernel/Makefile > > +++ b/arch/riscv/kernel/Makefile > > earlier in this file, there are four lines about ftrace, > > 5 ifdef CONFIG_FTRACE > 6 CFLAGS_REMOVE_ftrace.o = -pg > 7 CFLAGS_REMOVE_setup.o = -pg > 8 endif > > removing "-pg" flag from setup.o was necessary for ftrace to work, since > setup_vm() cannot process the trampoline of ftrace properly. > > As setup_vm() is being moved to mm/init.c, you may either mark it with a > "notrace" attribute with its declaration, or adding corresponding CFLAGS_REMOVE* > to mm/Makefile. Let's handle it in same way as it was handled for kernel/setup.o Most of the stuff is already moved to mm/init.c so no need for "CFLAGS_REMOVE_setup.o = -pg" I will send-out v3 with above changes and also update patch description accordingly. Regards, Anup