From patchwork Fri Jun 10 21:28:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 633965 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3rRFfN6d9dz9ssM for ; Sat, 11 Jun 2016 07:28:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=akamai.com header.i=@akamai.com header.b=z7qTjLgK; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbcFJV2n (ORCPT ); Fri, 10 Jun 2016 17:28:43 -0400 Received: from prod-mail-xrelay05.akamai.com ([23.79.238.179]:25499 "EHLO prod-mail-xrelay05.akamai.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbcFJV2m (ORCPT ); Fri, 10 Jun 2016 17:28:42 -0400 Received: from prod-mail-xrelay05.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 419913F4027; Fri, 10 Jun 2016 21:28:41 +0000 (GMT) Received: from prod-mail-relay10.akamai.com (prod-mail-relay10.akamai.com [172.27.118.251]) by prod-mail-xrelay05.akamai.com (Postfix) with ESMTP id 2145B3F4026; Fri, 10 Jun 2016 21:28:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; s=a1; t=1465594121; bh=4Diub3faA4s1eTVUdFDIn6GBl3K/NPzCQ7tLOQIczn8=; l=2909; h=To:References:CC:From:Date:In-Reply-To:From; b=z7qTjLgKc9jUuvhThIp+9CcBwWeKDZbkt8snLR3bIdMhuXGvG6KbvucDicY8i2VUl 0MXKPPobPGOGcBAToH/b0g1L6CSFZ139eoNOe33hVShh4djtV0RGKCvwjP6dpBHNk+ kEXU4pJJxPCrYRBvFjqhk/Mn+Df804mgdPn+7Eqo= Received: from email.msg.corp.akamai.com (ecp.msg.corp.akamai.com [172.27.123.33]) by prod-mail-relay10.akamai.com (Postfix) with ESMTP id 1D6971FC95; Fri, 10 Jun 2016 21:28:41 +0000 (GMT) Received: from USMA1EX-EXJRNL1.msg.corp.akamai.com (172.27.123.99) by usma1ex-dag1mb4.msg.corp.akamai.com (172.27.123.104) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Fri, 10 Jun 2016 17:28:40 -0400 Received: from USMA1EX-CAS1.msg.corp.akamai.com (172.27.123.30) by USMA1EX-EXJRNL1.msg.corp.akamai.com (172.27.123.99) with Microsoft SMTP Server (TLS) id 15.0.1130.7; Fri, 10 Jun 2016 17:28:40 -0400 Received: from [172.28.12.139] (172.28.12.139) by USMA1EX-CAS1.msg.corp.akamai.com (172.27.123.30) with Microsoft SMTP Server id 15.0.1130.7 via Frontend Transport; Fri, 10 Jun 2016 17:28:40 -0400 Subject: Re: [PATCH v2 4/4] dynamic_debug: add jump label support To: Arnd Bergmann References: <587263b37406eda0d2ab84874a9fd4c81eaeca1d.1463778029.git.jbaron@akamai.com> <3796097.4dlb9d7Id8@wuerfel> CC: , , , , "David S. Miller" , , From: Jason Baron X-Enigmail-Draft-Status: N1110 Message-ID: <575B3108.1020409@akamai.com> Date: Fri, 10 Jun 2016 17:28:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <3796097.4dlb9d7Id8@wuerfel> Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org On 06/10/2016 05:54 AM, Arnd Bergmann wrote: > On Friday, May 20, 2016 5:16:36 PM CEST Jason Baron wrote: >> Although dynamic debug is often only used for debug builds, sometimes its >> enabled for production builds as well. Minimize its impact by using jump >> labels. This reduces the text section by 7000+ bytes in the kernel image >> below. It does increase data, but this should only be referenced when >> changing the direction of the branches, and hence usually not in cache. >> >> text data bss dec hex filename >> 8194852 4879776 925696 14000324 d5a0c4 vmlinux.pre >> 8187337 4960224 925696 14073257 d6bda9 vmlinux.post >> >> Signed-off-by: Jason Baron >> --- > > This causes problems for some of my randconfig builds, when a dynamic > debug call is used inside of an __exit function: > > `.exit.text' referenced in section `__jump_table' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o > `.exit.text' referenced in section `__jump_table' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o > > Arnd > Hi Arnd, Ok, I managed to reproduce this on tile and sparc64 by adding static_branch_[un]likely() to __exit functions as you mentioned. Although I didn't find the actual broken config. I think its only an issue on those 2 arches b/c they have jump label support and discard __exit text at build time (most arches seem to do it at run-time). Thus, we can end up with references in the __jump_table to addresses that may be in an __exit section. The jump label code already protects itself from touch code in the init sections after it has been freed. Thus, simply having functions marked with __exit in the init section is sufficient here. I tried the following patches on tile and sparc and they at least now compile. If anybody has real h/w that would be helpful :) Thanks, -Jason . = (. - TEXT_OFFSET + PAGE_OFFSET); --- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S @@ -151,6 +151,12 @@ SECTIONS PERCPU_SECTION(SMP_CACHE_BYTES) . = ALIGN(PAGE_SIZE); + .exit.text : { + EXIT_TEXT + } + + . = ALIGN(PAGE_SIZE); + __init_end = .; BSS_SECTION(0, 0, 0) _end = . ; --- a/arch/tile/kernel/vmlinux.lds.S +++ b/arch/tile/kernel/vmlinux.lds.S @@ -58,7 +58,21 @@ SECTIONS _etext = .; /* "Init" is divided into two areas with very different virtual addresses. */ + . = ALIGN(PAGE_SIZE); + .init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) { + __init_begin = .; /* paired with __init_end */ + } + INIT_TEXT_SECTION(PAGE_SIZE) + .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { + EXIT_TEXT + } + + . = ALIGN(PAGE_SIZE); + /* freed after init ends here */ + .init.end : AT(ADDR(.init.end) - LOAD_OFFSET) { + __init_end = .; + } /* Now we skip back to PAGE_OFFSET for the data. */