Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1699622ybv; Thu, 6 Feb 2020 08:18:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyKYChc15jvy897j7U2Zmjs791CP9Pv7CrRcrsPoAqxTo55xdqLoAmHs6/uA9hfjqK8x4/O X-Received: by 2002:aca:889:: with SMTP id 131mr7084665oii.3.1581005933819; Thu, 06 Feb 2020 08:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581005933; cv=none; d=google.com; s=arc-20160816; b=VIIFd/RCa8CQcbsqDwNdMiQaItF/IXP7YyT5MqqTr6VK2UfxZnhDEGCMGJp8AxQaFJ 7fAb2L7McqlbZC7IU2klaY6G3goxUBjpitnu/nSFPsLF+6s4tgmSieSLZFvvQmWB2Fix Qyd+GcVvcMco5pebAbd5H/pjHjg4RiQGMM8NLpj5ejC6DlEL1KcCPXDrJcrZ2QawrpRx HNHfRo3aI+3ysV9Wa+hJaJqVcfWj4VDU6Nyzs0tFwYLTTQQf3Tixk7BZU7qQDhXWiVqY 0abgMjWQFRQLtDTrhHpinkrXX6p/FrmApQ1gaPBfRPhN+L9zoawUERdXvbytz7Z3Dt6e u+AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WQsOr/IVWp27dNug1WtqOw9okINpGHdd5WHi9kRo0ZE=; b=sx5do+Gz47VLZnYQhdfNd8jaBw9anFIciRDhbhwFXRML3R12Fvsb0p2F/MHE6+Ugla uuztgI6ivXP2eV8i1RujjO1o8tj1kb/eApHoOFl10WsohKKbXkhQkwQ/SpaMDR8PB92n hKg5E0bBCjhDlBLaQADgKZYe7EzKkpa2+8CSVfRzLZ+HWFJGmHt5er8sxQVOFnao2VyA fYczGCi5zQmTzg2KYlSyMDpuMWNWdd7md3I0CQxohfs3oebVd1QLYrId4dg30SgTqUEI 9B0RGDzNfbcgk8NrxACwVrOka5X5ibFzgGII1JSuyHwpYHq+VndE64AMYB54935YIPbG 7cUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UCtyQCus; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si7445otc.160.2020.02.06.08.18.40; Thu, 06 Feb 2020 08:18:53 -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=@google.com header.s=20161025 header.b=UCtyQCus; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727574AbgBFQRb (ORCPT + 99 others); Thu, 6 Feb 2020 11:17:31 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36053 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726925AbgBFQRb (ORCPT ); Thu, 6 Feb 2020 11:17:31 -0500 Received: by mail-wm1-f65.google.com with SMTP id p17so695354wma.1 for ; Thu, 06 Feb 2020 08:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WQsOr/IVWp27dNug1WtqOw9okINpGHdd5WHi9kRo0ZE=; b=UCtyQCus59AS4hIHczJXWmirhprctTwMqVGMaarNOJQIrkOlRaQHhHMCKLYjcSGW08 sP8hduus9SvlQDbHULm2kdnn8oOX7BJbKkeQ8iLj3gw5135UaDKHhi0am533gBFlk++m 4WQPVlhBvZLDTWFdONQT60RUHyMmXFAstAdKBI8wHLN4LvRQPFBdRdkdNhtxMIT7G62Z vlRdZerRfH8Gpfome0OpPN54xyNvWg1E75YBaXRFPu1KC2NbiN2qUWlzXCg0vTN+dxMD /I2YFYjz4os0Pk1nduM92o6bip6nOPSxWYRGTxFGXo8D1YSXZp3fk3BTJGOa0DzS8I3X GlHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WQsOr/IVWp27dNug1WtqOw9okINpGHdd5WHi9kRo0ZE=; b=Bb5nSE/h6RV4WKJpuEP4b4k21e2RjMYMLdam8T6jx7mZPeVBbj/SM3qdoubxkchQP7 jO/NvQC+eltX4hyrgfRngkZQFhXUKYrWBGNqMUqHYOkopFHYwnpmzNb/bW/O72N/3Y0k Fg52fnIWqaFqPiCh7Z9J7yJ2v4PKA9a27h+el3O+BGaZcjE9XSeWnGVHuCn5yUVnfgyy zgsZ6aG9VTOyNY0b11CAsy3LGAfi2rv3J4BSMk78J01sPiKjdpl2RrAS2M1ly6nH+KYP vVSsMUtytOpk3DOGq4M45l2y9g6fMHImOj0r7977YTs1d4759SvVMRmyS7sA0dSBLnag Oueg== X-Gm-Message-State: APjAAAXnbO1S1ohA3j1xNhuASO8BgR5iyNDp780tu1uknrdun1uJke6N Ty2RaRjpkB3/pgcCu7nH6slJoV+SJpw= X-Received: by 2002:a7b:c932:: with SMTP id h18mr5360458wml.171.1581005848974; Thu, 06 Feb 2020 08:17:28 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id c9sm4064448wmc.47.2020.02.06.08.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 08:17:28 -0800 (PST) Date: Thu, 6 Feb 2020 16:17:25 +0000 From: Quentin Perret To: Jessica Yu Cc: masahiroy@kernel.org, nico@fluxnic.net, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, maennich@google.com, kernel-team@android.com Subject: Re: [PATCH v2] kbuild: allow symbol whitelisting with TRIM_UNUSED_KSYMS Message-ID: <20200206161725.GA235676@google.com> References: <20200129181541.105335-1-qperret@google.com> <20200206155651.GC16783@linux-8ccs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200206155651.GC16783@linux-8ccs> 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 Hi Jessica, On Thursday 06 Feb 2020 at 16:56:51 (+0100), Jessica Yu wrote: > +++ Quentin Perret [29/01/20 18:15 +0000]: > > +config UNUSED_KSYMS_WHITELIST > > + string "Whitelist of symbols to keep in ksymtab" > > + depends on TRIM_UNUSED_KSYMS > > + help > > + By default, all unused exported symbols will be trimmed from the > > + build when TRIM_UNUSED_KSYMS is selected. > > Hm, I thought TRIM_UNUSED_KSYMS just *unexports* unused symbols, no? Right. > "Trimmed from the build" sounds like the symbols are not compiled in > or dropped completely. Please correct me if I misunderstood. Good point. I tried to re-use the wording from the help text of TRIM_UNUSED_KSYMS ("This option allows for unused exported symbols to be dropped from the build"), but I agree this is a bit confusing. I'll re-write the help text in v3. > > > + UNUSED_KSYMS_WHITELIST allows to whitelist symbols that must be kept > > + exported at all times, even in absence of in-tree users. The value to > > + set here is the path to a text file containing the list of symbols, > > + one per line. > > + > > endif # MODULES > > > > config MODULES_TREE_LOOKUP > > diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > > index a904bf1f5e67..8e1b7f70e800 100755 > > --- a/scripts/adjust_autoksyms.sh > > +++ b/scripts/adjust_autoksyms.sh > > @@ -48,6 +48,7 @@ cat > "$new_ksyms_file" << EOT > > EOT > > sed 's/ko$/mod/' modules.order | > > xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | > > +cat - "${CONFIG_UNUSED_KSYMS_WHITELIST:-/dev/null}" | > > sort -u | > > sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" > > In general, I agree with the motivation behind this patch, even though > we try not to provide too much support for out-of-tree modules. > However, in this particular case, I think it's fair to provide some > mechanism to keep some exported symbols around that we know will have > users, despite having no in-tree users for a particular > configuration/build. For example, livepatch exports symbols that have > no in-tree users (except for the sample livepatch module, but you'd > have to enable SAMPLES), and all livepatch users will always be out of > tree. > > I also agree with Matthias' feedback, so assuming that gets > incorporated into v3: > > Acked-by: Jessica Yu Thanks for the review! Quentin