Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4244414yba; Tue, 9 Apr 2019 14:28:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDPqpbSXd85BvXFrdR9aWd9PIFM+bqVTKzyWBW/SaYjm+aLGvb/Ak3w2dli52deNVkCEWE X-Received: by 2002:a17:902:781:: with SMTP id 1mr39034781plj.300.1554845302098; Tue, 09 Apr 2019 14:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554845302; cv=none; d=google.com; s=arc-20160816; b=zKpD5NEGb6CWctLHNf+bv4fjyUWxiZrcYn3u1UuBP6lLdAkcEXAUB+drR+rrGYEoPm H+WuztU4qfvuJ2/SvDvFwJ+lAKf7lDymwLrW7QGs7RoKhifEI83GiYBRQmbODpHUEOlU FJivMitdpG6rc1IFA5fa4c+Uye2KR39XQWVjEvMyMTNnxbaSvPvqJH/MYn168t/AWTfq EhqCzsDIMGtqAii84/sWge2BQAQ9cqwWZUMWWYchOmAtr05amD6aeaxARDA99EF06Z31 IwKR2XHu72AqBPwiXqyT3GuJTgVR+wsiBM2Y4j/TPjDo03HZ+nsZUc9FvFYu/ojg8yXh H5yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DEibYvnJOT/AXrEykbQH+ZEm0O+Co96okaAqfEd0oe0=; b=AZ75QNSyNp8T5XiX7oQ2ADEynSRHBiM1prSSDb5F9c3L3D1rIMgXjDhtVh2naI2/H7 K5mCq9PtISF1bdj65eQIHVN08yw+iBsELtUYC8F1H8mWY1JilOwmeT65IEtAb5+bYq0+ i2Db921WepKH4WR4uaQ9yAdd3uReSrU/BsknT/H75/AtCQKZy5gLeqsGlfjinxIWsXO8 0DDlGqWLNtyw7e3anuVvxHt3FqjcP8HAa/ViH224hQMUYALyb1RW3d2AmgfcF5dQBzeS dJlwRxUrpj70GdeuzOia1qhXwjPkNUM8BIHgXlVPlQnFBjYNdbZEoBSPXNH1uD3EuwGm WaPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=ApftFrBp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r184si28940009pgr.24.2019.04.09.14.28.05; Tue, 09 Apr 2019 14:28:22 -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=@rasmusvillemoes.dk header.s=google header.b=ApftFrBp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbfDIVZx (ORCPT + 99 others); Tue, 9 Apr 2019 17:25:53 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45725 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbfDIVZx (ORCPT ); Tue, 9 Apr 2019 17:25:53 -0400 Received: by mail-ed1-f68.google.com with SMTP id o26so95818edv.12 for ; Tue, 09 Apr 2019 14:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DEibYvnJOT/AXrEykbQH+ZEm0O+Co96okaAqfEd0oe0=; b=ApftFrBp2GKWzpizNkRot6/E2kafAeHEayvgCvWkzyqFMUHkPv0Puo84qIaJIvHuOG 7E9HbLIukZFDuX/ZSXdx8fRQYnraVsKdfurUV90y8HiVkho++04I5EJjBUUhLwH5lUUX GrcQFZwHiCD34KHgRUcacicW+Gf80EXMJVX90= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DEibYvnJOT/AXrEykbQH+ZEm0O+Co96okaAqfEd0oe0=; b=ShoW/XV7yARgl//GXpReYvtdXRPn4eWsHomiHA2zoRYTdKlcH1Cb6l0EVgjmZqlHeu o2ClMsLA2rUffxTwDKTv9UtVr+b41LO9bfDTatd6gCVIJPjFE94ULImvm5oc2+4MHk2M LAbdxeqVJDQJEOx+WjsLD0j83q1XDlRYfT1zu/RCzr7hu6ecA0+IizKJChoyT7GF/UBX nLZd+UkT1aHWvJF8mYvd/m7AvyDPOC2OdL8E4rlJVG8jJOjab+oYTj1cQr6WRrOIvAEC dsC+EI8OPg4c7lOvAeT6wJmceOZLwHPmp13RRir/IXqmpH8hKre5Kb+PzPvSeNuaqOr6 U27w== X-Gm-Message-State: APjAAAVKp4gpQ+p/hR2lJ5u4TX/QzMXjugfQ6u6jIf+qTECRvbix8Tcg L1nwFRn02/sDJSIr5UTo/KlV4JH4FEbPmkCr X-Received: by 2002:a17:906:5149:: with SMTP id s9mr21353914ejl.25.1554845151506; Tue, 09 Apr 2019 14:25:51 -0700 (PDT) Received: from prevas-ravi.prevas.se (ip-5-186-118-63.cgn.fibianet.dk. [5.186.118.63]) by smtp.gmail.com with ESMTPSA id i26sm3477986ejc.51.2019.04.09.14.25.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 14:25:50 -0700 (PDT) From: Rasmus Villemoes To: Andrew Morton Cc: Jason Baron , linux-kernel@vger.kernel.org, Rasmus Villemoes , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, Michael Ellerman , Will Deacon , Ingo Molnar Subject: [PATCH 00/10] implement DYNAMIC_DEBUG_RELATIVE_POINTERS Date: Tue, 9 Apr 2019 23:25:07 +0200 Message-Id: <20190409212517.7321-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Similar to CONFIG_GENERIC_BUG_RELATIVE_POINTERS that replaces (8 byte) const char* members by (4 byte) signed offsets from the bug_entry, this implements the similar thing for struct _ddebug, the descriptors underlying pr_debug() and friends in a CONFIG_DYNAMIC_DEBUG kernel. Since struct _ddebug has four string members, we save 16 byte per instance. The total savings seem to be comparable to what is saved by an architecture selecting GENERIC_BUG_RELATIVE_POINTERS (see patch 8 for some numbers for a common distro config). While refreshing these patches, which were orignally just targeted at x86-64, it occured to me that despite the implementation relying on inline asm, there's nothing x86 specific about it, and indeed it seems to work out-of-the-box for ppc64 and arm64 as well, but those have only been compile-tested. The first 6 patches are rather pedestrian preparations. The fun stuff is in patch 7, and the remaining three patches are just the minimal boilerplate to hook up the config option and asm-generic header on the three architectures. Rasmus Villemoes (10): linux/device.h: use unique identifier for each struct _ddebug linux/net.h: use unique identifier for each struct _ddebug linux/printk.h: use unique identifier for each struct _ddebug dynamic_debug: introduce accessors for string members of struct _ddebug dynamic_debug: drop use of bitfields in struct _ddebug dynamic_debug: introduce CONFIG_DYNAMIC_DEBUG_RELATIVE_POINTERS dynamic_debug: add asm-generic implementation for DYNAMIC_DEBUG_RELATIVE_POINTERS x86-64: select DYNAMIC_DEBUG_RELATIVE_POINTERS arm64: select DYNAMIC_DEBUG_RELATIVE_POINTERS powerpc: select DYNAMIC_DEBUG_RELATIVE_POINTERS for PPC64 arch/arm64/Kconfig | 1 + arch/arm64/include/asm/Kbuild | 1 + arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/Kbuild | 1 + arch/x86/Kconfig | 1 + arch/x86/entry/vdso/vdso32/vclock_gettime.c | 1 + arch/x86/include/asm/Kbuild | 1 + include/asm-generic/dynamic_debug.h | 116 ++++++++++++++++++++ include/linux/device.h | 4 +- include/linux/dynamic_debug.h | 26 +++-- include/linux/jump_label.h | 2 + include/linux/net.h | 4 +- include/linux/printk.h | 4 +- lib/Kconfig.debug | 3 + lib/dynamic_debug.c | 111 ++++++++++++++----- 15 files changed, 237 insertions(+), 40 deletions(-) create mode 100644 include/asm-generic/dynamic_debug.h -- 2.20.1