Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1351333rwo; Wed, 2 Aug 2023 12:35:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlEihxPFc7gSgg4mLGC55nL3cDGmjrTtQqjU/G6jMCNmKA9yUUPNSY1KDkl88q+dldP3T7GO X-Received: by 2002:a05:6512:ea1:b0:4fb:8cd1:1679 with SMTP id bi33-20020a0565120ea100b004fb8cd11679mr5409640lfb.44.1691004899790; Wed, 02 Aug 2023 12:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691004899; cv=none; d=google.com; s=arc-20160816; b=Ch9x5ytGbTiIG/814R684tVaLiJoz3Ja0ypJwkVhbXGA2IjZPA5D+Dg5c5MwY105Sl eWXkD1VicIChvZDjEYjc/XOfo2ylqn4nZyajE77GOFPnNr/vLjhFYN2U6hHx5Gf8KZh5 roTT//bGNymNL++SPCA4wcyJfLC2vL8vFZ3cS8YImSqSFntl23Pl6Y30twCbo3xR62O6 hA3iMwMOxoYluG+m2ygKtk5QaOKd7Ccaa4ruw66J4g++7MbPRPCXqz3YGVZMFntucgKL ycvJNcHjTcNhqXJFsMx3sfSwIrRfwmjoy1CKRnir4FjVygFf7/ceTFz8McyarL3Rw4MD tHCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=wI5fJCWtldNJpYYx2IN0TkebJJo3zlk8V0xQL2JeTko=; fh=VQhsOL4ofHYk7xfRxlNuLN7/Hez7kHSGgGIs12/PrcU=; b=ZA8vlLMDkz4LKGFjQzDhHbeQ2+W3aJy5W5OAg/Qq1HhrIUHe4tEnY+FAB5Si2tTbKx CeXJ5phRLg8knkexAAFAWmDmySh4a3JnA6Yk1REOpq2WVd+UES+eSZ3VWXqhtf1NtRcV oo4iUG4Gkxgb6iOe2Ecw6nYcyaeB240QVAMfV6AnyaZI9ULPJAS+eHjFMXpFo6/ctbVF ip0gRQA+oTZLItLEM5KMK9pMeM7z6suH6vxrwUduWsO2diAfdwijuM8IrhWoxO2f+3hZ vnDfRZTGhhtTpDlEVRBd84dYhgCHBkiGg9EA3BLsjY9q/y8SgO8N9ltUuOuXeTH3bqa7 stUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="2Nmf/GfP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a056402128500b00522e601b5e1si2676630edv.212.2023.08.02.12.34.35; Wed, 02 Aug 2023 12:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="2Nmf/GfP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbjHBSEw (ORCPT + 99 others); Wed, 2 Aug 2023 14:04:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233815AbjHBSEe (ORCPT ); Wed, 2 Aug 2023 14:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B35449EE; Wed, 2 Aug 2023 11:03:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D667661A8D; Wed, 2 Aug 2023 18:03:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64E5EC433C9; Wed, 2 Aug 2023 18:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1690999385; bh=b3H1cxTxktEnjXl+iExW/YcKRfU1BuhonrjVJGBbVXY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2Nmf/GfPEkagF9BmZl/oPNQfos2XuRpiubItnG9HrgJX4XueGbgDG2UGKJAUVJy/r FBg7gFXRVOU8DbSBGdtmS0/rfnaquGaBhHiYQoAOsVOsIGq7SOMeugtLr9/uyaM/Ox gX/17ad4oY8MT9g0HDCZS34KX6zvvb3mBpCF8an8= Date: Wed, 2 Aug 2023 11:03:03 -0700 From: Andrew Morton To: Marco Elver Cc: Kees Cook , Guenter Roeck , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Miguel Ojeda , Nick Desaulniers , Nathan Chancellor , Tom Rix , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Dmitry Vyukov , Alexander Potapenko , kasan-dev@googlegroups.com, linux-toolchains@vger.kernel.org Subject: Re: [PATCH 1/3] Compiler attributes: Introduce the __preserve_most function attribute Message-Id: <20230802110303.1e3ceeba5a96076f723d1d08@linux-foundation.org> In-Reply-To: <20230802150712.3583252-1-elver@google.com> References: <20230802150712.3583252-1-elver@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Aug 2023 17:06:37 +0200 Marco Elver wrote: > [1]: "On X86-64 and AArch64 targets, this attribute changes the calling > convention of a function. The preserve_most calling convention attempts > to make the code in the caller as unintrusive as possible. This > convention behaves identically to the C calling convention on how > arguments and return values are passed, but it uses a different set of > caller/callee-saved registers. This alleviates the burden of saving and > recovering a large register set before and after the call in the > caller." > > [1] https://clang.llvm.org/docs/AttributeReference.html#preserve-most > > Use of this attribute results in better code generation for calls to > very rarely called functions, such as error-reporting functions, or > rarely executed slow paths. > > Introduce the attribute to compiler_attributes.h. That sounds fairly radical. And no changes are needed for assembly code or asm statements? I'll add "LLVM" to the patch title to make it clear that gcc isn't affected.