Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3196106imu; Mon, 17 Dec 2018 15:16:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/X/Hq+RhDipFtpgudxuWRjagv7aRLCIMbkGoa9YaNFzslr40Dn2nDBRBV8hDi1xhx7ilYCn X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr14629564plb.107.1545088597712; Mon, 17 Dec 2018 15:16:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545088597; cv=none; d=google.com; s=arc-20160816; b=tliTJkqwySJZaFytN+6EoRF99MBUsNNPAnCrUmCObOuEl9jAZcfeu4dFlS8Tz/kvNA QQfESodAJ6t/EyunlpDAno01YK1CFVb+11mC8ol1CE6UtlKm/m4/yPWdG2FuNCxbUM/X fYI6XkpmWelomYDMp79/P8TnnbYEbUKwoNMeDKuLu9+PDMn+xL/zTxxyoE9X2IxNaRVU 1Lkxn8X94czK448ZP3WNma6stNoMqzuFkC7ylYWlX+thHnMOndXehxXoEmZRVmWBMssv 3olj50PnZ7lL7j0RXTLp9n7m/zKBFRiopcbSWkuaM2cQswbiDSUQxl0PeG5/Z70/3bf/ iyog== 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; bh=fAJ/acTcg0CQvF/TmvKTugedoSrvidRs/D9XOLJwqAo=; b=sQBRyK/hKyVBO7xnVggjFqi4WkSK+wt3eKKTmjfV2hRHOBZF42dFHOA2rugM/nOi5m Y65YEvB52f0uqxWtKe7rgHmcfcUamD8eA2VYy3DNrqETba017G/B49JLsbkTwH3gS5C0 LqgnS5i0iB6h6bDdCDOBRicPGHWex35oKQ8kYop2RRHLt8X2I84hnWZcA4aTUjH+ftyQ cFKFtEGnL33+j0dq0S9nzsBZ9thJf4DpdKlNRjPqbcXxRlWkyWo2qGQC8NNJ1vrJ1c7F fEEF9CXk2beVpylFuaIvVyx/flremVry7P1a3XZi9zsah6RVEi3uIpuzkzlJGxPXVDBE IEGA== ARC-Authentication-Results: i=1; mx.google.com; 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 e2si11775161pgs.94.2018.12.17.15.16.22; Mon, 17 Dec 2018 15:16:37 -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; 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 S1727878AbeLQTXQ (ORCPT + 99 others); Mon, 17 Dec 2018 14:23:16 -0500 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:55811 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726815AbeLQTXP (ORCPT ); Mon, 17 Dec 2018 14:23:15 -0500 Received: by mail.osadl.at (Postfix, from userid 1001) id E0CF65C0FFC; Mon, 17 Dec 2018 20:23:08 +0100 (CET) Date: Mon, 17 Dec 2018 20:23:08 +0100 From: Nicholas Mc Guire To: Joe Lawrence Cc: Miroslav Benes , Nicholas Mc Guire , Josh Poimboeuf , Jessica Yu , Jiri Kosina , Petr Mladek , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] livepatch: fix non-static warnings Message-ID: <20181217192308.GB26825@osadl.at> References: <1544965657-26804-1-git-send-email-hofrat@osadl.org> <20ef1d3a-2916-ce00-2938-3397746efac9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20ef1d3a-2916-ce00-2938-3397746efac9@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 17, 2018 at 10:44:36AM -0500, Joe Lawrence wrote: > On 12/17/2018 07:03 AM, Miroslav Benes wrote: > > Hi, > > > > I'm sorry for being late to the party. > > > > On Sun, 16 Dec 2018, Nicholas Mc Guire wrote: > > > >> Sparse reported warnings about non-static symbols. For the variables > >> a simple static attribute is fine - for those symbols referenced by > >> livepatch via klp_func the symbol-names must be unmodified in the > >> symbol table - to resolve this the __noclone attribute is used > >> for the shared statically declared functions. > >> > >> Signed-off-by: Nicholas Mc Guire > >> Suggested-by: Joe Lawrence > >> Link: https://lkml.org/lkml/2018/12/13/827 > > > > A nit, but I'd reorder the tags. Link, Suggested-by:, Signed-off-by:. Also > > it would be great if you used https://lkml.kernel.org/r/${Msg-ID} > > redirection. > > > >> --- > >> > >> V2: not all static functions shared need to carry the __noclone > >> attribute only those that need to be resolved at runtime by > >> livepatch - so drop the unnecessary __noclone attributes as > >> well as the Note on __noclone as suggested by Joe Lawrence > >> - thanks ! > > > > I talked to Martin Jambor (GCC) and he suggested __attribute__((used)). It > > should be better than __noclone, which was reportedly implemented only for > > testing purposes (which is why it does not imply noinline, although > > inlining internally uses cloning). Newer gcc also has "noipa" attribute, > > but "used" would definitely be safe. > > > > Sorry for not responding earlier. > > > > Hi Miroslav, > > Thanks for following up on this. "noipa" would have been nice to use, > but as you say, is a newer gcc attribute. > > Regarding "used" vs. "noclone", can we assume that "used" implies that > the function name remains unchanged? > > The gcc online doc [1] speaks about ensuring that "code must be > emitted". This reads like it solves our > static-function-not-directly-referenced problem, but isn't explicit > about naming. > > used > > This attribute, attached to a function, means that code must be > emitted for the function even if it appears that the function is not > referenced. This is useful, for example, when the function is > referenced only in inline assembly. > > Perhaps it's equivalent to a "I want to keep this function and leave > it's symbols alone" attribute. FWIW, I modified Nicholas' change on my > box to use "used" and it worked as Martin advertised, so it would get my > Ack. > > I'm just being picky about its documentation and how we should note its > usage in the v3 patch. Think that s/__noclone/used/g of the v2 commit > message would be sufficient? > should that then not be __used as this is provided in compiler_attributes.h see also: https://lkml.org/lkml/2018/9/20/909 also would it be reasonable to maybe add something like: #define __livepatch __attribute__((__noclone__, __noinline__)) in compiler_attributes.h ? it would make it imediately clear that the attributes are related to the way lp works internally. thx! hofrat > > [1] > https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute > > > Thanks, > > -- Joe