From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5CB5C6FD1F for ; Wed, 22 Mar 2023 18:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y0rcf4G+qafbFbP792qEj/PqDFrUOKdKnTTblWA91HE=; b=Bh4bEfWa8Ok3vi TL6p7dcCPg8qFz0unWTU5uaSP6QoOXYfa7Et5D1npf4L/HHZfluxjnth5ow/otUEbcpGO7GoPmthb QOUqMXpCBbqW643o5e155Wo0tyCNxLCi2cHfkSasG+kO9nZjk8HrnmbjHGOAvGHMUw/aA9rjwfRC7 qGfx04h26KZVHv7whYHusSB1cfX7CzOtkHZ9xgzkQuDmuVUEjtMBkZhhrTpPqF3aEqLj1/DhTD42g H2hV0oD1WttsWEzOdHBovILnFtnPceJA55cx2R0dfoMHlwU2A6O6loHhfa30LNJemd2Zwi0kfH9Mw qpXLrlf6k6ES47S2wg0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pf3Sg-00H3g1-03; Wed, 22 Mar 2023 18:45:26 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pf3Sc-00H3ep-2v for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 18:45:24 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFB1762276; Wed, 22 Mar 2023 18:45:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9170CC433D2; Wed, 22 Mar 2023 18:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679510721; bh=khs4WyDC4bsNM7Qsr87hszfKJX33A8kySjsYmIbzpXM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a9XS7Qx3zeZfbNZaT5WGwlM40Nj0P9NYG6/733ExbmB/MS4s+3NqHG3zxQNtSGZWM SVIzSNUx1JY3TMrTnuSPZ1HUsba2yl/4lCBN2ePGX66NBzG4DMBWHJM4ZnzIqY1Y4/ 4BPx1C10Anj5BXuhobKb0xRuZ7ZU0Y7Be2x1bhILDULUtkVZnglz9Cw4VGIf0KCIj5 2b5dAIqg+pf0T3t/RLLZFqR8m0YJDp8EG1m+gifKIGsz2XZtdQLSf4pl2bzY1W+6Ti TLeqB5nzueurRfctBX+aaWRmGu87yJuzUBLe+r1m94t1XQOTKmD1O4cwME69FDo72B ZAkG5Epf0lldQ== Date: Wed, 22 Mar 2023 11:45:18 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Mark Rutland , Jason Baron , Steven Rostedt , Ard Biesheuvel , Christophe Leroy , Paolo Bonzini , Sean Christopherson , Sami Tolvanen , Nick Desaulniers , Will McVicker , Kees Cook , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 11/11] static_call: Remove DEFINE_STATIC_CALL_RET0() Message-ID: <20230322184518.wjgfp7dyxvg5la5p@treble> References: <8aab02492c2bf512c7ffe458e41acc1b930ed2dc.1679456900.git.jpoimboe@kernel.org> <20230322151532.GG2357380@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230322151532.GG2357380@hirez.programming.kicks-ass.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_114523_009647_54016BBE X-CRM114-Status: GOOD ( 26.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 22, 2023 at 04:15:32PM +0100, Peter Zijlstra wrote: > On Tue, Mar 21, 2023 at 09:00:17PM -0700, Josh Poimboeuf wrote: > > NULL and RET0 static calls are both slightly different ways of nopping a > > static call. A not-insignificant amount of code and complexity is spent > > maintaining them separately. It's also somewhat tricky for the user who > > has to try to remember to use the correct one for the given function > > type. > > Well, I have very little sympathy for that argument. The return type > should be a big frigging clue. > > > Simplify things all around by just combining them, such that NULL static > > calls always return 0. > > > > While it doesn't necessarily make sense for void-return functions to > > return 0, it's pretty much harmless. The return value register is > > already callee-clobbered, and an extra "xor %eax, %eax" shouldn't affect > > performance (knock on wood). > > Urgh.. OTOH I do like the lines removes. So this patch is more of an RFC than the others. I'm not fully convinced myself, but I very much liked the removed lines and simpler interface. > > This "do nothing return 0" default should work for the vast majority of > > NULL cases. Otherwise it can be easily overridden with a user-specified > > function which panics or returns 0xdeadbeef or does whatever one wants. > > > > This simplifies the static call code and also tends to help simplify > > users' code as well. > > Can we at least keep the DEFINE_STATIC_CALL_RET0() and > __static_call_return0 as aliases? It reads really daft to use _NULL or > __static_call_nop for non-void functions. I disagree, to me NULL means "nop the function (including any return value)". Nice and easy. Keeping those other ret0 defines around would negate some of the cool deletions. -- Josh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel