Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp220669ybh; Tue, 21 Jul 2020 21:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNo34Zh2zCYL//S6XuSOTCVquTrS+uplQ+7wLEYz/OCSpC9KfYYIksiCt99o2bABbOJYwt X-Received: by 2002:aa7:d845:: with SMTP id f5mr28298685eds.162.1595393489119; Tue, 21 Jul 2020 21:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595393489; cv=none; d=google.com; s=arc-20160816; b=laxfHnwYOA9/hn0cxMOV5ccRCCjyw+xy662j+999IUUqWf3uoWwhEL+I4l4bbfZIka khbsBAnHgQnGOx3HiD3aCbjlECcJajDxaPCcLyi24Lf/FTUpP2L/1YOOsESZA0L2i1ZA KPHT9EO/8IcNJX0RH2ZhdZl7Mryzq8EqjdlZv6JOljomyNt5JHHt/gygboiJO3oJWFJ5 HHOLFGR4uxOMY4NLqMk7Qi9ikDY+FqyLjO2l72DgcYIYMpGaLyLwmNPXbj2mLfjDnxoL brwphz8BtLRcUgzVLW0gT95Ws+tCq1bds8zHMYR0MJSvX0CWxjrAFxokS5S1IoYotpVJ fnyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=Xrkg3LlctTmxsMOJHPxijmge261omJwWQjJKwGgVktI=; b=nNk1oOZ+Kl1r0VR+F8BvySwQLcoBfjjGDQsBJ6D97uOjmgiPAMuBkQHAe7zOwq7U1p y85j6rOf7WfaWNnAijgmDoa4gBLt4NNUNQf3cwpNVX4Lgutdo9Lp+NitmG7zME4+bQsH 9nWMa6Kaeqowrt43U8MjUW1MK1hAoMaVzLWsL05qT8s/CjqTneNdwjZjiu9NUkSTKEFE T1WBvJioZxFV9c44HhfQGkXYZ9QQVq5azHD4P0g5VqDzOacINtn8zIrifHgYdVpsM5JT m/GrHE9mjGUIBWgTYplybRHJcZMvbkpne+yFrBEW+HNXIUKR/4LkUl8CrCU++NRwH2o5 xcyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=O2t3NNmb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si14434364edq.546.2020.07.21.21.51.06; Tue, 21 Jul 2020 21:51:29 -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=@ellerman.id.au header.s=201909 header.b=O2t3NNmb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgGVEur (ORCPT + 99 others); Wed, 22 Jul 2020 00:50:47 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:48487 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbgGVEur (ORCPT ); Wed, 22 Jul 2020 00:50:47 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BBNM73Xpmz9sSn; Wed, 22 Jul 2020 14:50:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1595393445; bh=EikksBvUVVSgx7PbC9PoBMWAYLrAx1ActPVYUU8rTkE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=O2t3NNmb0TZYIhUfd294PgsE0mDk0NkX5s1kaEv2oF7KxbCWK0AOu14+8RiOCoTRa T4mAWJ+SJSElYmJQtB6y4fi3rvkBiIaQ7NXxAaODgjyE5nInphmmRww0/Im03/ehaX ypJjRz/oqooZ3L0EP63rd83/6xZX4mIoxF/UOZCC8S2P+Ki2CbMaWsG/zNTpIL74Tc GKWn3cXJ1Ki3jrENb3I3H3VSUbEIj07AZbgiHDrz0d1ftQBb8OhUd140mXnnmd4Fvg 9H3ACTDWC9E10Oi0TdCkgLIebySHJ/MqkcThKvaYh9PRK4/yDDXQ/XhMG7u5XBB1xk VNFfjcFWrSAHA== From: Michael Ellerman To: Benjamin Herrenschmidt , Palmer Dabbelt Cc: alex@ghiti.fr, paulus@samba.org, Paul Walmsley , aou@eecs.berkeley.edu, Anup Patel , Atish Patra , zong.li@sifive.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v5 1/4] riscv: Move kernel mapping to vmalloc zone In-Reply-To: References: Date: Wed, 22 Jul 2020 14:50:42 +1000 Message-ID: <87sgdkqhjx.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Benjamin Herrenschmidt writes: > On Tue, 2020-07-21 at 16:48 -0700, Palmer Dabbelt wrote: >> > Why ? Branch distance limits ? You can't use trampolines ? >> >> Nothing fundamental, it's just that we don't have a large code model in the C >> compiler. As a result all the global symbols are resolved as 32-bit >> PC-relative accesses. We could fix this with a fast large code model, but then >> the kernel would need to relax global symbol references in modules and we don't >> even do that for the simple code models we have now. FWIW, some of the >> proposed large code models are essentially just split-PLT/GOT and therefor >> don't require relaxation, but at that point we're essentially PIC until we >> have more that 2GiB of kernel text -- and even then, we keep all the >> performance issues. > > My memory might be out of date but I *think* we do it on powerpc > without going to a large code model, but just having the in-kernel > linker insert trampolines. We build modules with the large code model, and always have AFAIK: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/Makefile?commit=4fa640dc52302b5e62b01b05c755b055549633ae#n129 # -mcmodel=medium breaks modules because it uses 32bit offsets from # the TOC pointer to create pointers where possible. Pointers into the # percpu data area are created by this method. # # The kernel module loader relocates the percpu data section from the # original location (starting with 0xd...) to somewhere in the base # kernel percpu data space (starting with 0xc...). We need a full # 64bit relocation for this to work, hence -mcmodel=large. KBUILD_CFLAGS_MODULE += -mcmodel=large We also insert trampolines for branches, but IIUC that's a separate issue. cheers