Received: by 10.213.65.68 with SMTP id h4csp911447imn; Tue, 20 Mar 2018 19:54:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELu+zQpMBfHJfRzAoYG49hjosmBmYOIl0xWwOn/SB9gokht8XlzGGzwTvR+YfLZUXpmXKVxf X-Received: by 10.99.110.5 with SMTP id j5mr5025203pgc.246.1521600870550; Tue, 20 Mar 2018 19:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521600870; cv=none; d=google.com; s=arc-20160816; b=cpLyeyp6dqN9Axbep4VCj+7gz8CEbznKe8ns/VdwFTmy+nLEp3OGCNdO+09LUSjNvR CKffvvfggg+/ZrXPMBRqXzid0eQcRoe61QXtVAoq0i4LJtrFkJSY1bEukBcYE1Stuord kZ/QVT8tm2gD9sZNFA5WfomKKye/Q+pWMKJr7SF/q6dTizbj9bwau3OJB2medpkoUmvD qsrXGAgfQ/qkalmlnfiAx5XZdbPSof4flEgWYheW0+nLZ3Cyh95U2OkvJdJdmhcqAlxT W5CweOhewzouBc5ZOC59VeXaa1ryDixhJn8D1+PocXROm2xBC/vTVfR9LT2HaP1SM4fI 80Ew== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=2th8O02/K04CDRuQD44pz05YJ/NDLEnZBnk/UJT+d9Y=; b=V3roActQTbg2es9rKe2dCj1pOITFSmwLakOBp5bc15Ut/Y6f1S9cO9rctpXz/aOsPH m9FOy/wGe9IhUPrgu0ch/qcQzik1DEJgfRpcNrofqHXUI558k709A7sR3nt7By3SdJ4r YgaL9ExZWhb0K4tEt9CWUrC3KasA1p0jcdJD+kVsEAZpfWggXYEEdpK1Li54hduSFJ1g MsG/paDw0ynbv4d9GuPUKJp+pvmf6RSMcFtPA1vg4zHZlTt6tsEov19mza3IpG6DvyIp YBfEWASy5jes31YKJ1dH44dx5Q/q/PbX3CPbbStVY1gaUT6uIPGcoaVar3ph9CEOBqhi NcbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M/ERlkhN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si2091896pgf.780.2018.03.20.19.54.15; Tue, 20 Mar 2018 19:54:30 -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=@gmail.com header.s=20161025 header.b=M/ERlkhN; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751635AbeCUCxZ (ORCPT + 99 others); Tue, 20 Mar 2018 22:53:25 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:39461 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbeCUCxY (ORCPT ); Tue, 20 Mar 2018 22:53:24 -0400 Received: by mail-io0-f196.google.com with SMTP id v13so4845337iob.6 for ; Tue, 20 Mar 2018 19:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2th8O02/K04CDRuQD44pz05YJ/NDLEnZBnk/UJT+d9Y=; b=M/ERlkhNZh8k4qbc0pBvLYdTEx9w+6i65sO4zgB26Cfyka37t57EiKPboVUiW1CRiM lrgxrbycVbqqGIerT1fCi9rE67gjbsCjCrBcVC0uNM91xsp9OuGi/b8bTsZbHNLOSRDM mxrEbtregd5sdcQt8n8ZGS5ixHSUVjaKI8/G0qYRl2j7rLgquuBhn/jnSxNp+tDzefJc 3iQRsY0rXZqO5n6hNXG/Eu/NSP5kHLagdU4Uz7eZ4NT+rcseu34+6JmQKORBXkK+u0RI OX7mYgO8oj6eUbE/8275/31hoGLY0nbc13MZWGE88lnkMkrAwoLr55O5nMwQwD4e9eT+ 62/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2th8O02/K04CDRuQD44pz05YJ/NDLEnZBnk/UJT+d9Y=; b=BHbs6cpzOONHo9/hCfURQsxH/t1wXGLtBmjYJ58jbPjpEMZVKse0q8zguJz7/teetD eT8elJVF53uqsiuKfHEOqYyOBm/sUW/3eMSLflDEK3NsgOdXctIFT6g9lBqERZ8QLzDx I1pieFsuDNNMDFnFp3AaJr7LR2qBb/2tMN7B+EaDMQYmFjUSR1WhuH0wO4eqNicf/fsH WtkrNpsyU22nAm8z/yDlJEyAe87JvEWdu0+6fPL4gKRYGAmm1YNYZDEFlFyye2sJ06JZ KdYr1/iW+Z1cX16Mvq6np8855iGM8MOJhmc/gedNqBgwnbWxkDaX3sWfZWXWU/x1keSk KBRg== X-Gm-Message-State: AElRT7GhUoGV6AaOcNVJ/tflvTMAwJaOyVEFeeVXjipN+SQ4COaPUeNH 3+bKITAA+1FERfz3BrVU9HrH9s/7kUiRZXfehkc= X-Received: by 10.107.185.69 with SMTP id j66mr17837437iof.141.1521600803540; Tue, 20 Mar 2018 19:53:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.69.149 with HTTP; Tue, 20 Mar 2018 19:53:22 -0700 (PDT) In-Reply-To: References: From: Zong Li Date: Wed, 21 Mar 2018 10:53:22 +0800 Message-ID: Subject: Re: [PATCH v2 00/11] RISC-V: Resolve the issue of loadable module on 64-bit To: Palmer Dabbelt Cc: Zong Li , albert@sifive.com, linux-riscv@lists.infradead.org, Linux Kernel Mailing List , greentime@andestech.com 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 2018-03-21 1:11 GMT+08:00 Palmer Dabbelt : > On Thu, 15 Mar 2018 01:50:40 PDT (-0700), zong@andestech.com wrote: >> >> These patches resolve the some issues of loadable module. >> - symbol out of ranges >> - unknown relocation types >> >> The reference of external variable and function symbols >> cannot exceed 32-bit offset ranges in kernel module. >> The module only can work on the 32-bit OS or the 64-bit >> OS with sv32 virtual addressing. >> >> These patches will generate the .got, .got.plt and >> .plt sections during loading module, let it can refer >> to the symbol which locate more than 32-bit offset. >> These sections depend on the relocation types: >> - R_RISCV_GOT_HI20 >> - R_RISCV_CALL_PLT >> >> These patches also support more relocation types >> - R_RISCV_CALL >> - R_RISCV_HI20 >> - R_RISCV_LO12_I >> - R_RISCV_LO12_S >> - R_RISCV_RVC_BRANCH >> - R_RISCV_RVC_JUMP >> - R_RISCV_ALIGN >> - R_RISCV_ADD32 >> - R_RISCV_SUB32 >> >> This is the list of testing modules: >> # lsmod >> btrfs 7876158 0 - Live 0xffffffd00745d000 >> ramoops 90806 0 - Live 0xffffffd0024b8000 >> lzo 10554 0 - Live 0xffffffd002050000 >> zstd_decompress 567575 1 btrfs, Live 0xffffffd00238b000 >> zstd_compress 1543837 1 btrfs, Live 0xffffffd002211000 >> zram 101300 0 - Live 0xffffffd0021b8000 >> xxhash 62254 2 zstd_decompress,zstd_compress, Live 0xffffffd0020cf000 >> xor 33246 1 btrfs, Live 0xffffffd002042000 >> xfs 4395343 0 - Live 0xffffffd00399e000 >> tun 252041 0 - Live 0xffffffd0038e0000 >> test_user_copy 5265 0 - Live 0xffffffd003783000 >> test_static_keys 19606 0 - Live 0xffffffd003717000 >> test_static_key_base 7374 1 test_static_keys, Live 0xffffffd0036dc000 >> test_printf 7804 0 [permanent], Live 0xffffffd00369c000 >> test_module 1557 0 - Live 0xffffffd003646000 >> test_kmod 49100 0 - Live 0xffffffd0035f2000 >> test_bpf 1599301 0 - Live 0xffffffd003000000 >> test_bitmap 4403 0 - Live 0xffffffd002dd8000 >> reed_solomon 38866 1 ramoops, Live 0xffffffd002d86000 >> raid6_pq 161872 1 btrfs, Live 0xffffffd002b9e000 >> netdevsim 65401 0 - Live 0xffffffd002910000 >> >> Signed-off-by: Zong Li >> --- >> Change in v2: >> - Add compile option 'mno-relax' for build kernel module >> - Just fail on ALIGN type, this is unexpected type with mno-relax. >> >> Zong Li (11): >> RISC-V: Add sections of PLT and GOT for kernel module >> RISC-V: Add section of GOT.PLT for kernel module >> RISC-V: Support GOT_HI20/CALL_PLT relocation type in kernel module >> RISC-V: Support CALL relocation type in kernel module >> RISC-V: Support HI20/LO12_I/LO12_S relocation type in kernel module >> RISC-V: Support RVC_BRANCH/JUMP relocation type in kernel modulewq >> RISC-V: Support ALIGN relocation type in kernel module >> RISC-V: Support ADD32 relocation type in kernel module >> RISC-V: Support SUB32 relocation type in kernel module >> RISC-V: Enable module support in defconfig >> RISC-V: Add definition of relocation types >> >> arch/riscv/Kconfig | 5 + >> arch/riscv/Makefile | 5 + >> arch/riscv/configs/defconfig | 2 + >> arch/riscv/include/asm/module.h | 113 +++++++++++++++++++++++ >> arch/riscv/include/uapi/asm/elf.h | 7 ++ >> arch/riscv/kernel/Makefile | 1 + >> arch/riscv/kernel/module-sections.c | 156 +++++++++++++++++++++++++++++++ >> arch/riscv/kernel/module.c | 179 >> ++++++++++++++++++++++++++++++++++-- >> arch/riscv/kernel/module.lds | 8 ++ >> 9 files changed, 470 insertions(+), 6 deletions(-) >> create mode 100644 arch/riscv/include/asm/module.h >> create mode 100644 arch/riscv/kernel/module-sections.c >> create mode 100644 arch/riscv/kernel/module.lds > > > Thanks! I've added this to our for-next branch, so it should start to get a > bit more testing soon. I've had a bit of the flu and am therefor a bit out > of > it, so I'll try to look closer before the next merge window. Thanks. Keep warm and take care yourself.