Received: by 10.223.176.5 with SMTP id f5csp1832598wra; Wed, 31 Jan 2018 12:18:20 -0800 (PST) X-Google-Smtp-Source: AH8x225seRuYMuPFP8sjcHCrUCyaHeAV9dHFcvji6DkX7LcbDWC7OFKfABQdsQPh2je0M8b5y9KL X-Received: by 10.98.103.209 with SMTP id t78mr34981902pfj.53.1517429900101; Wed, 31 Jan 2018 12:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517429900; cv=none; d=google.com; s=arc-20160816; b=ZmJwyJ/JpWMFy6P1CitbWVTEYz7nIuHUGSCDuf6dhOR4jvWftcw0dXAFO55Y7WRD3i wRmEBt5PMNl1PpLcpE9zrxA9HFckV9+ciOgDUk4M6w1gDSC1qLNbUi6EHgtYvN6/YmVa 551Ad3c2SzoaJNX7DBZkk+hMgJM3EYnOxNTU1micemHoW+ffq5a3P6kmekyThqqlHiOL 7LiLve50HEHWZ2w1rAhMC7hdw/22u/xGMg45ZkS8V4cOYFiD2tpBAnsHYQ0Ab7QxT1xa STt8twqoi0YXFZITp6TWfdNS2KqAvHjVWv5yp0uIe4YdEwk5PwcsUWJWJCjUqiB5tE8X NLhQ== 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=VmrXn/4z6QqPYXgVbs40ny5aCP85l+3Kqs+VBrKybes=; b=ImwSsvmlnNTwGMRSNU5/7X7kNqnr8/XqEDtPZMdG1BlHgci8EreqI1dEvZpX1P02Cu 1imzAHAACIEKX8FBp8w7uCFDqyU/Kw+WzlPKFti4LhuF5EL7TIrzxoUNmnmXZyRZW2ht NzNiY1T3zBGTGTI9Tee+CnOn1h2FLAW/DB44bJePTmfWBxkDamaUrwUs1adhJnZr4VbQ iQugsUjcUBIyhNzXQ15My82MMpBDA2RvSLePSB7gUUuIhJn0O6Yy2qXmes+3WckqfUvs o6rokGPKiQe+eWyUFc4OAukLWz1zGuzf98mb82WeyLiCh2AxoSpNvVTH6MQ5cNs/IoO8 KFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JHBR0gqE; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si15654088plk.720.2018.01.31.12.18.05; Wed, 31 Jan 2018 12:18:20 -0800 (PST) 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=@linaro.org header.s=google header.b=JHBR0gqE; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbeAaUPC (ORCPT + 99 others); Wed, 31 Jan 2018 15:15:02 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36830 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbeAaUOw (ORCPT ); Wed, 31 Jan 2018 15:14:52 -0500 Received: by mail-pf0-f196.google.com with SMTP id 23so13814896pfp.3 for ; Wed, 31 Jan 2018 12:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=VmrXn/4z6QqPYXgVbs40ny5aCP85l+3Kqs+VBrKybes=; b=JHBR0gqERRw1iVpb67iuMTzrvXmoplzHK2OS4qWeNPE6e0O8Pf8PQWUyfu+Tb3Mt4S NYLAiqStG1Z1wQIq7U9augUSsKW7khiDAoVt8Ihg8BO8zPSi4+gOvNPMYk5BZS3lwSnC /ZHo8F3D+bQLCUuhpGbklNTapGQWxISthMAAQ= 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=VmrXn/4z6QqPYXgVbs40ny5aCP85l+3Kqs+VBrKybes=; b=Im2RGZHa95aHV//89YXVwXxGBXZWIlGB1mjolhhQM99F4QZrMuqZDk4YE1XC+pgWzU 4ZrMLVbHEvjbgYhVcn0cEeu37u97E8fZE0f4dXdCSYiwERoVI1lm+KmBWOEku+/wEEah ZuluMUD9wm+8y+X2WciGqM1cZMF2vm0PKG202U/Dy1egF+KKbdivOlwnS2mcJIFKu7y6 mfdl9tSSbIWjBepgEnsNv1tNZsw4XC/rsZ4lGMWEn5qIHATxR53eH3TAe9ttvyBebAOi urAY5OTryWDq+RruGi/BmnQXRhIsU5BRSJbBnbnsCmWVW3ZcyfO8Qeebrf55yimSicC8 xE/w== X-Gm-Message-State: AKwxytfYh9wq+ofeLIM7SR4ILMEKOnm5zfY2ddP3AlU0/K/3wJTXWGL5 REUrFI2yjZqzNePIG+5ltX3ZA4lnW/KO0RR2Gd8ynQ== X-Received: by 2002:a17:902:2901:: with SMTP id g1-v6mr28667248plb.69.1517429692134; Wed, 31 Jan 2018 12:14:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.129.137 with HTTP; Wed, 31 Jan 2018 12:14:51 -0800 (PST) In-Reply-To: <20180131114628.GG9418@n2100.armlinux.org.uk> References: <20180129234900.11121-1-anders.roxell@linaro.org> <20180129235710.GA9418@n2100.armlinux.org.uk> <20180131114628.GG9418@n2100.armlinux.org.uk> From: Anders Roxell Date: Wed, 31 Jan 2018 21:14:51 +0100 Message-ID: Subject: Re: [PATCH] arch/arm/Kconfig: enable ARM_MODULE_PLTS when LOCKDEP=y To: Russell King - ARM Linux Cc: Arnd Bergmann , Linux Kernel Mailing List , Linux ARM 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 31 January 2018 at 12:46, Russell King - ARM Linux wrote: > On Wed, Jan 31, 2018 at 12:25:33PM +0100, Arnd Bergmann wrote: >> On Tue, Jan 30, 2018 at 12:57 AM, Russell King - ARM Linux >> wrote: >> > On Tue, Jan 30, 2018 at 12:49:00AM +0100, Anders Roxell wrote: >> >> While testing multi_v7_defconfig with LOCKDEP enabled, the kernel >> >> fails to load simple modules, as reported by kselftest: >> >> >> >> [ 34.107620] test_printf: section 4 reloc 2 sym 'memset': relocation >> >> 28 out of range (0xbf046044 -> 0xc109f720) >> >> selftests: printf.sh [FAIL] >> >> >> >> The problem that is seen when LOCKDEP is enabled without >> >> ARM_MODULE_PLTS, is that LOCKDEP eats so much memory that the top of the >> >> kernel gets out of reach from the bottom of the module area. >> > >> > This really doesn't follow IMHO - enabling various features can cause >> > this, and we're not going to end up stuffing the Kconfig full of these >> > select statements each time we find a combination of Kconfig symbols >> > that cause it. >> > >> > lockdep isn't that special - I can (and do) build kernels with lockdep >> > enabled, with modules, and I do not run into this problem. So it's >> > not as simple as you make out in this commit description. >> > >> > It's likely that you have either a fairly full kernel configuration (it >> > must be to place memset() more than 16MB) or you are not placing the >> > kernel at 0xc0008000 due to memory reservations in the low memory. >> > >> >> Suggested-by: Arnd Bergmann >> > >> > I guess this was discussed privately with Arnd, since there's no record >> > of the discussion on the lists - which is even more reason why the >> > commit message needs to describe better why you need this change. >> >> I don't remember the original discussion exactly, but it's clear that >> the addition of LOCKDEP to the build is what caused the size to >> grow dramatically and prevent module loading. > > As I say above, it does not follow "lockdep is enabled" therefore "we > need module plts" so I don't accept this argument. > > Yes, if you have a lot of features built in, then its entirely possible > that enabling lockdep will cause the kernel to overflow the non-plt > boundary. It will also be true that enabling a few more other features > will also cause the kernel to overflow the non-plt boundary as well. > Should we add those other features to a Kconfig expression too? At > what point do we stop adding these? > >> There are two alternative ways to do this without forcing >> ARM_MODULE_PLTS on all the time (which also triggered >> the 0day bot warning): > > Yes, 0day is pointing out yet again what a silly idea it is to select > symbols that (a) have dependencies and (b) are user visible, something > that I've long disagreed about. > >> a) we could make ARM_MODULE_PLTS default to 'y' when >> LOCKDEP is anbled, making it a more reasonable default while >> also letting users turn it off when the lockdep-enabled kernel >> is still small enough > > As I've said, I don't believe "LOCKDEP" therefore need "MODULE_PLTS" > follows. It's just a symptom of an already large kernel. I suspect > without lockdep, Ander's kernel is already approaching the > problematical 16MB mark. > > Another option that causes the kernel to grow by a few megabytes is > the kernel protection options (ronx etc). I suspect if Anders built > a kernel that had lockdep enabled and ronx etc disabled, that there > would be no need for module plts. Should we turn on module plts if > lockdep or ronx is enabled? > > I don't think there's a _sane_ solution to this other than defaulting > ARM_MODULE_PLTS to 'y' without any of these dependencies, and if people > want to turn it off, they still can if they're sure they won't run into > this situation. I'll send out a v2 with this change shortly. Thank you all for your comments. Cheers, Anders