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 99AF1C6FD1C for ; Wed, 22 Mar 2023 15:16:32 +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=T6wnbQouQUNVF9XoL9QoHgtA/VCHWa5mFo6o+S9AaxU=; b=s+hwg7scFgxxRg GfXwPYYMjqceO8b7mzcsgCJdEpILnQhgzposLXTPQQQIbcxZ4MO432ntF8WMuCQV8Hp224cAFE7jt L65X1PlT/Wlu8bF1GGZFP4BpbdFGr+KoFEThUYB/cyapyO5zDpxzdr8ANoM81p5JMcTN4L8k+ZG+F gi2C7JCDemdpC7bjTknwL4JONPJPw7q8IlW1Y92BByOr+TFYA1ZVvjzg1j+Ag1jzFjcCQbalhhxQS IXgjRCFD5l0AnGyAZamjI3RwZVjhJSZNqaMXI3aEJnUY4r07tiYjaP2m2XO57l6W25mAdNpeahnv3 g/Tz3vT8AXd6rtPU3PFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pf0Bj-00GT9j-0V; Wed, 22 Mar 2023 15:15:43 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pf0Bh-00GT8q-1g for linux-arm-kernel@bombadil.infradead.org; Wed, 22 Mar 2023 15:15:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Oo95ksNo438JOehySiTYm2xvtjpxki70aoJy1x654ic=; b=AmZ2yrsZzD4hIqyo5kv7jGnakK Xp5HymcULYHKiPmU0NelZiXniuv5bFpGR4XawrJ9sicQHGWK8yJCFBqUzgBSY/VQtud4N1DN87+KC c7pFK8A2II1Hy5hc2crVFOA5N7MCOp5rAIYa90s0SQ7AY8EXjL0hhDQc/gXoq9tiv/K9baikGBPuv tdWmywNXyOa5NgV+l9hSZzN+DLj+qPo6+FCxVGRHhNucOHc+/gY86qQAlEH8bmbuJkIW+4qve6g/o iIO3PraeOxVCPa+EqiGS2TzqFHBGsT2QddsWck3WlnOr5TUuy1ZDh5l3SATp28cz6IY8w6zsEqqEg VX7N1KXA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pf0Bb-0036gM-8p; Wed, 22 Mar 2023 15:15:35 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6D005300379; Wed, 22 Mar 2023 16:15:32 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 33289201FFA49; Wed, 22 Mar 2023 16:15:32 +0100 (CET) Date: Wed, 22 Mar 2023 16:15:32 +0100 From: Peter Zijlstra To: Josh Poimboeuf 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: <20230322151532.GG2357380@hirez.programming.kicks-ass.net> References: <8aab02492c2bf512c7ffe458e41acc1b930ed2dc.1679456900.git.jpoimboe@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <8aab02492c2bf512c7ffe458e41acc1b930ed2dc.1679456900.git.jpoimboe@kernel.org> 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 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. > 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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel