Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4828024pxb; Tue, 5 Oct 2021 11:08:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKZAlv4BMU52stbtZJDGjgokAxW9QeXs2/ZCHa5JbkLMkZAATqVSdEnkiUTKN6YHclECC7 X-Received: by 2002:a17:90b:1642:: with SMTP id il2mr5391726pjb.167.1633457334580; Tue, 05 Oct 2021 11:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633457334; cv=none; d=google.com; s=arc-20160816; b=qrUqwVQc/k0Xll2o5Us8KMCmfUA4IHrIqW1q+BDf1KLM/YLKIQKg8pJ8+un32kYkl0 uzVUve0d3VgM/rmBAIFT0LllF++wZxnpQk5Z+0nqSzpPp1ICZ2tOyhxkW+L6vEw7ZcwJ TEqvza8gnUXzB3NNnfV5Mp2Itqkih8giDzSM/5/9VL1H/ZjEGNJpyhJ3p2tXOjAJfaIw 7L9PiPloKta40FRaCDtxeGOtZKEsDHN9xpe72LxGOso32msJ3oHeZJh/JGNDWQHEp4Fb 3drzg/IZZQPUcwZ3MeYgp7HLUU+0eR0FfDMQstRDTklAGfR+4qrl/npVypvw02/3IMUz l5ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=tfKh6mHkN2x9qWMzx/jgb3e4/+PZ5d3ilSaKBX4BnfE=; b=QFuFvOMlcdVqYBc3OGKw7KN5XzO7I6zje+VTFAlAEM6E7FCPSwlNTKH0hGAsq39rzC w3coyAU0I5DHaxa+16Anc678TGafL/vbd5M0+F+hW6glbXPefjn3JkjKgDNziBQLHYTm F0QIP+meXZqtpyvet8kW+2SHyg+hODOvvoAD7b82VA2eeaczN4uED6y7Rqs4vinCVsT5 YWmCGDl2m5gpFSpO/xrelKbKdMgkN3IOgLcXPZJzVHX8CREFNfLZEBXiqhXIhP8EkAw5 aFOPZvDe5GPQoHxDOYBCXY0JTuyQfjsHPhuZX0pCOVrZ23amqE0lb0jj5ah95RuvbT8p IOpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=J1O8CHua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si24916444pgu.251.2021.10.05.11.08.41; Tue, 05 Oct 2021 11:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=J1O8CHua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234830AbhJESI0 (ORCPT + 99 others); Tue, 5 Oct 2021 14:08:26 -0400 Received: from mail.efficios.com ([167.114.26.124]:58954 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbhJESIZ (ORCPT ); Tue, 5 Oct 2021 14:08:25 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id B0E2438EEEF; Tue, 5 Oct 2021 14:06:33 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id iZsE1lZA6tlX; Tue, 5 Oct 2021 14:06:33 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 2ABCC38EEEE; Tue, 5 Oct 2021 14:06:33 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2ABCC38EEEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1633457193; bh=tfKh6mHkN2x9qWMzx/jgb3e4/+PZ5d3ilSaKBX4BnfE=; h=Date:From:To:Message-ID:MIME-Version; b=J1O8CHuaXrbI7ETe8Lggn0Ls3THmmH6Z255M+LFzCsvbwZvBjLaWEfdtRLINCrWKF h+hFmLwjsWKIFlLaxcszT1refvDhhwvXpKU0PgW+dj2kjV4E98m+bevWK2dxNpkV5M Qe/iIuKd4hwBKoQRGEVNQVmBIRi2/KxaS0E3saN0ArKs82vUSXgdzIGctghBcm5mlI bdQx2RQCRwI7UTH7y3Au+l6horu4X28A/qMAUyWPTaJxqElbOhvK9Ujp8p1e9xeR5h MvWQjVHa4IekTRKcmedzI4kcmRCof5bK/Jz+8LUOgiYWVnRydMteIRMgQQTnz/+47W 2i7Fugh/Da13Q== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id PKk_2bA41C_h; Tue, 5 Oct 2021 14:06:33 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 0EC1B38F196; Tue, 5 Oct 2021 14:06:33 -0400 (EDT) Date: Tue, 5 Oct 2021 14:06:32 -0400 (EDT) From: Mathieu Desnoyers To: Rasmus Villemoes Cc: rostedt , linux-kernel , Linus Torvalds , Paul , Josh Triplett , Lai Jiangshan , "Joel Fernandes, Google" , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , rcu , netfilter-devel , coreteam , netdev Message-ID: <639278914.2878.1633457192964.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20211005094728.203ecef2@gandalf.local.home> Subject: Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) * MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4156 (ZimbraWebClient - FF92 (Linux)/8.8.15_GA_4156) Thread-Topic: Use typeof(p) instead of typeof(*p) * Thread-Index: RjCoJoA6Ynqqjw2vHnEn40XORyRWhA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Oct 5, 2021, at 2:01 PM, Rasmus Villemoes linux@rasmusvillemoes.dk wrote: > On 05/10/2021 15.47, Steven Rostedt wrote: > >> That is, instead of declaring: typeof(*p) *_p; just do: >> typeof(p) _p; >> >> Also had to update a lot of the function pointer initialization in the >> networking code, as a function address must be passed as an argument in >> RCU_INIT_POINTER() > > I would think that one could avoid that churn by saying > > typeof((p) + 0) > > instead of just "typeof(p)", to force the decay to a pointer. If the type of @p is an integer, (p) + 0 is still valid, so it will not prevent users from passing an integer type as argument, which is what the current implementation prevents. Also, AFAIU, the compiler wants to know the sizeof(p) in order to evaluate (p + 0). Steven's goal is to hide the structure declaration, so that would not work either. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com