Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1999074rwl; Thu, 6 Apr 2023 04:35:49 -0700 (PDT) X-Google-Smtp-Source: AKy350Z349hy5qHbSonzO8NHoUJyzqGiM7rWmk1zEweo3VjEFd/kgr6d5wQJqilMl/SX6ZUifsCZ X-Received: by 2002:a17:907:1629:b0:8de:502e:2061 with SMTP id hb41-20020a170907162900b008de502e2061mr6212011ejc.3.1680780948882; Thu, 06 Apr 2023 04:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680780948; cv=none; d=google.com; s=arc-20160816; b=pEQXiJ3MkwFhQmeaYEIC7eXcvZZgbqGgxbNJ1jaTSUzaLfW+2RwRQcitMx4xNFNsiV JyqaGS7/fvRR2qxy7EORzTo9n9TxgQ47U9d9IEN6aidzyfGk9bl3BaoTIBUPaKFPGnAN ODuUAKFvXfd9BM2Fb1kxwBY+OexoYOljLGJ3z6MH6A5aJ0dt27Hvlgr/Kd4f5PzL18fQ awYiYrgqVOHuC2qCsuKcRthzUkZhHOD3SyhUjAHQo9VI+QGOMAPdv+vgRNgvE+4WlWdj 4BZF4p22gOlDkuweYwpIiLqKkeX5pe4h0WV5Nggsf/NNBBIr1hiw9caxMOxJ+aRIiC4v ZtfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QwWZXY+TxuCVvQw9ER2qw2mWXQ6bYR1k+mishI1l8Ss=; b=N800Q1yogeWroOAy5yGjUDPsqGSvd/rZGBSsgmgBEJh+vghC4efuKVZ1o+iKospUuu VXT91Qd6f4pYWnIcorJ01RZYitumlh6n76Y/2c+JnYU5i/ZjkebUL3MGbXVCqQNdtK9N IGq8TkQy+v4FfNKHuHAt9HKWEaxl5D9VOIgRVDbKhVb02/ij1eNct9n9hcuwGaaHynrs F93rgunw4JUc/d9aGTo/AnR8RrPdC0jAx5ZwtdbUq9DNLHHMUIPISrHN5YS/vQ/d6pfO aXRIAQMXhcTPTZp9TK960UUgCyjD18qb8qLh4r2+DW6SfiZ26qYlMdpLW1dwATHtGN2i U4xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="RlX/Lik6"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wf6-20020a170907d68600b009186b84c076si971120ejc.738.2023.04.06.04.35.23; Thu, 06 Apr 2023 04:35:48 -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=@google.com header.s=20210112 header.b="RlX/Lik6"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236669AbjDFLWJ (ORCPT + 99 others); Thu, 6 Apr 2023 07:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237300AbjDFLWI (ORCPT ); Thu, 6 Apr 2023 07:22:08 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B515A5FE1 for ; Thu, 6 Apr 2023 04:22:06 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id o10so9063169iou.5 for ; Thu, 06 Apr 2023 04:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1680780126; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=QwWZXY+TxuCVvQw9ER2qw2mWXQ6bYR1k+mishI1l8Ss=; b=RlX/Lik6GGvAOPVCqjVn1pOFGgcDXsPn5yrZ2ndXAB5RBLZT1xBeGkkcvXGfzOMVly UZcRepZbWPcqunSFc3X1orce1AF/i/vuZimB/u7uHDGsjQfAA3MLFPbPxMMdqEDTYKXM 6Y1a7oaa+yAP2DYpX/9IIPFNke0oJPm7+hVhu5ZV7l7t6H6vey0WAtxp/DAQsYuEiAMS Dg7eIfAMyzOZDfgoTjgnLux2YkCZWilcxBty+/5YRO7LfVzuvTUTpw7amD9zd3M5m1Ye Wk94sz6vBN1uYgKlWhicdrjVAZQHpaDQW7R6wV2nbdepbxFQ7qbe1CcW4Anq7QMPVr1t V7vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680780126; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QwWZXY+TxuCVvQw9ER2qw2mWXQ6bYR1k+mishI1l8Ss=; b=V9eDIL1EPUAS/MdzhzNfIaJywnl0HkjlZqi/MiqRkWh7pPM8xcwUbRT7xvmNCUDSPJ wCe0s0CusyHV6JTtGVCCvGeYdGPQYOGvBtdqmkJlN0P8wnrDUshE9LbpdGuFSxJ5bt+V GpIq1Xq9DW0E8XI0r+o9nzzPS4DD7Sx4GV1bY8juQnhQYpkDhLPx0VUzB6QwhImqnFxw WCFlbGq/Muho1reJhmFXIyromaudhd5uarwNvRdnXTu1zQtXxCI9JBTjNpU0GHOzCO8s MLGUdGWLxeUUE7u/SwEqhp/S2i0qH4RkD53PLVSNjFt3rv/yDSihI5ErY6qAKX+BKS4Q Hr+g== X-Gm-Message-State: AAQBX9fSdE8Qg8F2v5mrzPs5KL7vAWWW5x0d1sDkSeiZ4e/hql66M7ca Ga1A4lUanbgDhZ2mM7VQO0+rHoBdB8selujZ6BKQPA== X-Received: by 2002:a6b:7803:0:b0:71b:5cd7:fcd9 with SMTP id j3-20020a6b7803000000b0071b5cd7fcd9mr6538150iom.20.1680780125984; Thu, 06 Apr 2023 04:22:05 -0700 (PDT) MIME-Version: 1.0 References: <20230405175111.5974-1-wedsonaf@gmail.com> <20230405175111.5974-3-wedsonaf@gmail.com> <2023040554-promoter-chevron-10b2@gregkh> <2023040509-tamer-clinic-c14c@gregkh> <20230405191826.GA365912@hirez.programming.kicks-ass.net> <20230405202932.GG365912@hirez.programming.kicks-ass.net> <20230405204942.GH365912@hirez.programming.kicks-ass.net> In-Reply-To: From: Marco Elver Date: Thu, 6 Apr 2023 13:21:28 +0200 Message-ID: Subject: Re: [PATCH v2 03/13] rust: lock: introduce `Mutex` To: David Laight Cc: Peter Zijlstra , Wedson Almeida Filho , Greg KH , "rust-for-linux@vger.kernel.org" , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , "linux-kernel@vger.kernel.org" , Wedson Almeida Filho , Ingo Molnar , Will Deacon , Waiman Long Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-15.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=unavailable 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 Thu, 6 Apr 2023 at 10:38, David Laight wrote: > > From: Peter Zijlstra > > Sent: 05 April 2023 21:50 > > > > On Wed, Apr 05, 2023 at 05:40:39PM -0300, Wedson Almeida Filho wrote: > ... > > > So the situation is improved in that we don't need to manually write (and > > > commit) the helpers. It may improve further in the future if we get better > > > integration of the languages. > > > > But yeah, feel free to convert macros to inline functions where the > > difference is moot. There is indeed no real reason for mutex_lock() to > > not be an inline function in that case. > > mutex_lock() is probably ok. > But there are cases where gcc generates much better code > for #defines than for inline functions. > Almost certainly because the front end gets to optimise > #defines, but inlines are done much later on. For macro to inline function conversions, the most conservative option would be __always_inline. We've also seen things go wrong with "inline" only paired with various kinds of instrumentation. Can bindgen deal with "static __always_inline" functions?