Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4485819yba; Tue, 9 Apr 2019 21:12:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdA3wuNaR1805+6VBrCjgJBefkLRyoprPYsKw2UnL+/KHOBIW+c71sy95cDskkN7XgAg+W X-Received: by 2002:a63:2f44:: with SMTP id v65mr38279071pgv.141.1554869527794; Tue, 09 Apr 2019 21:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554869527; cv=none; d=google.com; s=arc-20160816; b=DtiSPXEJxhHhdWvipyXQea3RHi+bN16Zrt+DwJD1mwhgkbWzd10Bf822Yny1vJVUUh 1PW024x5h1p6Qt+NB6nnHPYOPPvXJG1lWZpBtReAddNzHFd4RliZ1IvMthvoQGjKIAXZ TMgUiAGFFU82tB6kWClDSmP0d/LtHkaQnN21lx5U/H7IWoXiIqVRNXQGRTO1ZQAAK8O3 eKgObEuZGn1fgWNUuTI51S9jermoKtGF5LXZabmgM5UGlRfTgwIb2WDXyhiYpVi5u0PL zyohPaCsT2pciF2ZSk+gH4cRtFWOTjD5QTc65ybYvEGoBKgE0jnPXbuQnMwVEWyT5tBI cZmw== 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=IewjcLSJnQrO08PbnPGd5ADILHnS1hScA5/IGBONAXw=; b=fFsoHCSibmgTh8oG6sm2MRYqd/8I5UJo5nGJSsINQoaI41I2lVVgo/BR0oiIOGlQux 0O/9W9N+s2E1gg2NWmwr1ZJcH3L4zzSTMNobRG8lwAy9UL05wr3Ycqd375f9/xazFkXn 6jd1vlmqLrrACNgCImS5LDnP+5e/dL1xDQUjqb7V/fVCagEqBnA3k+cS6hL17fxG1wHj 6y2fWWCI6pYf71bs2n3uFn8KbcNdkWw2V8GxluJ2kopS4yQrJfd/yj9cSjlWE4hUlonF p1R0SFIzdd1Ysfg+w1P2zwkxYMw9HJEDuf70TF7+gnsg1/ni33TeA8aDMBQ6ZV7ox1WA rGKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=Pqji4CEp; 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 w4si29106116pga.39.2019.04.09.21.11.52; Tue, 09 Apr 2019 21:12:07 -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=Pqji4CEp; 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 S1727337AbfDJELA (ORCPT + 99 others); Wed, 10 Apr 2019 00:11:00 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34407 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726832AbfDJEK4 (ORCPT ); Wed, 10 Apr 2019 00:10:56 -0400 Received: by mail-wr1-f66.google.com with SMTP id p10so1154187wrq.1 for ; Tue, 09 Apr 2019 21:10:55 -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=IewjcLSJnQrO08PbnPGd5ADILHnS1hScA5/IGBONAXw=; b=Pqji4CEps5vlS2C6w+QeTo4oa1s6i51fB1ohQC71pRVe8DUty81aas0k1RLuJjLOz3 hsmYd2AwdQQ5COgc4BSDA/KMlV4//yjuOJ34RMxWLnXu4eGLgMheoTPgX2Sgogf/9aFc kq1FFXy+xBgXjV0IjUv/sh6ImN/BZLKR3V57+4v4L8lmrEdJ1ins4kdd6y6S3izGSKJM gKczDPHxKbwymzhWWwVZLNcZ/2YODkHYhNaVVfsg6nzGlHWE8GUhRPMOCaMAqsdQvU5G JCxCj1/eWVnYPca7XH0s3qb17fEdW9a1ctt1mhmg79q8vg0vhr1LLiy4pn1uPLpMaCzA ScJw== 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=IewjcLSJnQrO08PbnPGd5ADILHnS1hScA5/IGBONAXw=; b=E1rDjbI74+ajIgzrnpYRKWnLYoWr1PwfuzMCD9TEqNFdQpjyU804QjhjvlIZh9wY6W ZLxoEzTEK2qFjvxzRkJZE+VU9D8VNnWi9jbBoYGk6cyWdzfsl4YrBSCdN0qP5STTAf9L lFCVwUuKbxiRpp2ulyBIeu/L1r97lqFUGWvQbmI/VNX4fnseWatMZKMY8Gc3quKKSpJ+ 5O53L1jJ6ztdmtp4kA+qDqjtjCjQiC+4Tw/s5x/CoKK2IWDKE8/Cmm0pM3A3SE42pvoe kkj9MnBjCL/6l4NmdiqBDdVFUFD1axFI14f32HVwGd7JOiin+j1B+Qa4NUsZK9Wr0gNZ ClBw== X-Gm-Message-State: APjAAAW+zquJaiTWqEOl1EAuECp2YKjlTjQS8VE0xi5m4T4FhfLKyMMA EqfMlfEC8X1KOBvhpKieRfz0/6N6cbz1tlyi/+2S+JFjWyE= X-Received: by 2002:adf:e610:: with SMTP id p16mr24936946wrm.64.1554869454862; Tue, 09 Apr 2019 21:10:54 -0700 (PDT) MIME-Version: 1.0 References: <20190312220752.128141-3-anup.patel@wdc.com> In-Reply-To: From: Anup Patel Date: Wed, 10 Apr 2019 09:40:43 +0530 Message-ID: Subject: Re: [PATCH 2/3] RISC-V: Make setup_vm() independent of GCC code model To: Palmer Dabbelt Cc: Anup Patel , Albert Ou , Atish Patra , Paul Walmsley , Christoph Hellwig , Mike Rapoport , linux-riscv@lists.infradead.org, "linux-kernel@vger.kernel.org List" 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 Tue, Apr 9, 2019 at 10:17 PM Palmer Dabbelt wrote: > > On Tue, 12 Mar 2019 15:08:16 PDT (-0700), Anup Patel wrote: > > The setup_vm() must access kernel symbols in a position independent way > > because it will be called from head.S with MMU off. > > > > If we compile kernel with cmodel=medany then PC-relative addressing will > > be used in setup_vm() to access kernel symbols so it works perfectly fine. > > > > Although, if we compile kernel with cmodel=medlow then either absolute > > addressing or PC-relative addressing (based on whichever requires fewer > > instructions) is used to access kernel symbols in setup_vm(). This can > > break setup_vm() whenever any absolute addressing is used to access > > kernel symbols. > > > > With the movement of setup_vm() from kernel/setup.c to mm/init.c, the > > setup_vm() is now broken for cmodel=medlow but it works perfectly fine > > for cmodel=medany. > > > > This patch fixes setup_vm() and makes it independent of GCC code model > > by accessing kernel symbols relative to kernel load address instead of > > assuming PC-relative addressing. > > I think we ended up with a cleaner solution as 387181dcdb6c ("RISC-V: Always > compile mm/init.c with cmodel=medany and notrace"), but let me know if I missed > something here. Yes, please ignore this patch. I have dropped it in latest version of this patch series. Regards, Anup