From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 936D8C433E0 for ; Thu, 9 Jul 2020 07:32:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DEB52076A for ; Thu, 9 Jul 2020 07:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594279926; bh=kakKZcSdsSt03vkEyqiFdKJJD1UpoTlT8bIHlJigmBk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=FYsyK0hCnl8RziksQ9tzeCKtGUUIMLmKy6gGKI1VkFKEUmpp1eM/6+SN+QudW9Svn 7ZTTEnrFtzaCvVVaNrnhyYmzuDgVqOpJbv9x0xhTA6s/5E1zN7iCuZMbXhXR+iUjD6 3JJWd6g3gj5t6eTSvOF6hZ+CNOMepFnRKWK4i390= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726286AbgGIHcF (ORCPT ); Thu, 9 Jul 2020 03:32:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:43432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgGIHcE (ORCPT ); Thu, 9 Jul 2020 03:32:04 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2674F20767; Thu, 9 Jul 2020 07:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594279924; bh=kakKZcSdsSt03vkEyqiFdKJJD1UpoTlT8bIHlJigmBk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0HEp8AIMosA+aX0/9PHIsVTDp/+r3qiQ/04W1r98dGizruyYLq/Ta7D+cHnPBZroh CB8PR4wIL7Yjoy5h0nnNNEuhmFhBrWjbqtFKvoAQ/3jxuXAL9S/Ub3eXde+GqK/xMD cAqOs2yrTUBa4ORtQdFc4E55sk8DISnRCsAZSCSM= Date: Thu, 9 Jul 2020 08:31:59 +0100 From: Will Deacon To: =?utf-8?B?5b2t5rWpKFJpY2hhcmQp?= Cc: Ard Biesheuvel , "catalin.marinas@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] arm64/module-plts: Consider the special case where plt_max_entries is 0 Message-ID: <20200709073159.GA27725@willie-the-truck> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 09, 2020 at 07:18:01AM +0000, 彭浩(Richard) wrote: > On Thu, 9 Jul 2020 at 09:50, 彭浩(Richard) wrote: > >> >Apparently, you are hitting a R_AARCH64_JUMP26 or R_AARCH64_CALL26 > >> >relocation that operates on a b or bl instruction that is more than > >> >128 megabytes away from its target. > >> > > >> My understanding is that a module that calls functions that are not part of the module will use PLT. > >> Plt_max_entries =0 May occur if a module does not depend on other module functions. > >> > > > >A PLT slot is allocated for each b or bl instruction that refers to a > >symbol that lives in a different section, either of the same module > > (e.g., bl in .init calling into .text), of another module, or of the > >core kernel. > > > >I don't see how you end up with plt_max_entries in this case, though. > if a module does not depend on other module functions, PLT entries in the module is equal to 0. This brings me back to my earlier question: if there are no PLT entries in the module, then count_plts() will not find any R_AARCH64_JUMP26 or R_AARCH64_CALL26 relocations that require PLTs and will therefore return 0. The absence of these relocations means that module_emit_plt_entry() will not be called by apply_relocate_add(), and so your patch should have no effect. You seem to be saying that module_emit_plt_entry() _is_ being called, despite count_plts() returning 0. One way that can happen is if PLTs are needed for branches within a single, very large text section, but you also say that's not the case. So I think we need more information from you so that we can either reproduce this ourselves, or better understand where things are going wrong. Finally, you said that your kernel is "5.6.0-rc3+". Are you able to reproduce with mainline (5.8-rc4)? Will P.S. whenever you reply, the mail threading breaks :( From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B78AC433E0 for ; Thu, 9 Jul 2020 07:33:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E89520767 for ; Thu, 9 Jul 2020 07:33:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3FVPd6Gi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="0HEp8AIM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E89520767 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jHr82nrBX72H8QffzBm0/WlRDmuzUFKpMKBFyY4vn6k=; b=3FVPd6GiWHwpBkSXdg2o/uyPj s/RskRQLo6mXeAqaINv5qdc2vpMlGCrdldmec556r1F76VW1h+gRqPqW7j7F8XB7vDunrhc3cP5qD ccyjAtOpxrNKf00DMmylAWG3MOvVngxnymidCmLxHTXyTU9v/bw+Q+AW5It2t32p5rDLtyOFWZ18u lYDoQ9uajpnKObWdFrleIbgm1umj9QNRfqrwkCMJq6Rf7SOBy9ttIvmoBXoilAcJEJD1DxIarrYvK zRGkyUr47NiRCvV9SYb2tQbeXYpaZF4Tvu7sCtotbFtxOlBCTsv6vkIYtfe4DoZbeJuqLB6BQrnaG Bu5POmKsw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtR2O-00036E-1K; Thu, 09 Jul 2020 07:32:08 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jtR2L-00035H-DX for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2020 07:32:06 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2674F20767; Thu, 9 Jul 2020 07:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594279924; bh=kakKZcSdsSt03vkEyqiFdKJJD1UpoTlT8bIHlJigmBk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0HEp8AIMosA+aX0/9PHIsVTDp/+r3qiQ/04W1r98dGizruyYLq/Ta7D+cHnPBZroh CB8PR4wIL7Yjoy5h0nnNNEuhmFhBrWjbqtFKvoAQ/3jxuXAL9S/Ub3eXde+GqK/xMD cAqOs2yrTUBa4ORtQdFc4E55sk8DISnRCsAZSCSM= Date: Thu, 9 Jul 2020 08:31:59 +0100 From: Will Deacon To: =?utf-8?B?5b2t5rWpKFJpY2hhcmQp?= Subject: Re: [PATCH] arm64/module-plts: Consider the special case where plt_max_entries is 0 Message-ID: <20200709073159.GA27725@willie-the-truck> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200709_033205_533192_3DC39DAA X-CRM114-Status: GOOD ( 17.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "catalin.marinas@arm.com" , Ard Biesheuvel , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gVGh1LCBKdWwgMDksIDIwMjAgYXQgMDc6MTg6MDFBTSArMDAwMCwg5b2t5rWpKFJpY2hhcmQp IHdyb3RlOgo+IE9uIFRodSwg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