Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6090643ybc; Wed, 27 Nov 2019 14:55:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyBF9OMh8MWCnwwtNnwi8dGZv1dW5OQvjuZJkKtEHqLI+4JTq5+vCnaudP003G5w2J3zq6y X-Received: by 2002:a17:906:82d0:: with SMTP id a16mr23939066ejy.206.1574895355069; Wed, 27 Nov 2019 14:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574895355; cv=none; d=google.com; s=arc-20160816; b=PZEOLk3nN6sf34Qtuxa6pUdNqBW6462KTcHJrMsvyI32La2dUznuFx+vhU4SQGzTHm y2ZVcwLLRpFJpElfKbk0mG9/S9euMw+vDv58GOOm9W6pG6F1Kl+U5SxRqD/FfUdM8OR5 +z7CuOk+WEKLMT9ceEGpFhACyAXZ+p6JCtcFYHEBXa/LJ7k+uETqkLcb/S0ZUz+x/x3P eLozZo+OB4gGRGMYGksCVMSzw2a5OYjRXwMgFUHFfHxCur0V1UqrdwJGONv+ncaWD8Aa oTkYW6Cmvj4ugnaEYj4pMm8++8dBn7LuwmrE5Kr6QvBCauCFZEwPjBOtZSSxlidxl33X Ivow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ei5H/fe8y0i51Hlp0Sp0kPBO0gWbv7up2qZD6Qbfv08=; b=BTiH3mrx/jB4p4K+yNctdaCppET8IUtYvE+0IxEQYEpNzFJURuSG0ktz26WleWmyWC gZ1poqFlbF2xrCAXFuHBg7MFPgUG7B6EWyfrYuwfW3EeaE9ffT/hfYlkfysGT1OBZp7n /5oipzDOWo3VkcBlJ1zoklst4lO19VXKHqOdOpQXpCkdT38YsnyjX6mYDuA650tztuTg waSq7HDNUR/dDC1dThL0EwGBnlqfwmGAHP6711dqQrVlPXjW8YHcsmjpJ3j2KviHmoMr 39JTQqX5gXsYQiQW282TQj7NR4pOowfKy6fKhoKfmGYOtck0Se5UzwDoR5EVmwF/XO4t G6zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kkXp8Il+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si10900484ejc.350.2019.11.27.14.55.30; Wed, 27 Nov 2019 14:55:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kkXp8Il+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727258AbfK0Wyg (ORCPT + 99 others); Wed, 27 Nov 2019 17:54:36 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43147 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726984AbfK0Wyf (ORCPT ); Wed, 27 Nov 2019 17:54:35 -0500 Received: by mail-wr1-f65.google.com with SMTP id n1so28747323wra.10; Wed, 27 Nov 2019 14:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ei5H/fe8y0i51Hlp0Sp0kPBO0gWbv7up2qZD6Qbfv08=; b=kkXp8Il+CBvPorSOC0gcvVSGexyfvC8aQ2zss1zL7jteVMBM7fcIx2LKXlrGb2cbpG lja/0KKJN7NehN5d5+FBJtB0+2pdxHynWwBuaDtSNPqs6WyEoIlBhrjoHkukAP11qlIR D8LdvIDJ5lsQe82ap4JuESQ6E7OcKZSigRuKOJ27KodnT4y2HXBrc3jNFLNaPK4beAV9 gR5wGIPnS3MkaTRLAUxcwjd990+jg4i/y5YDICoAs2uyYJzuBEf0oCARxEDYZkuBQIX4 a33t8jbMNDPmr6YjghuUjF/kmnWdy8JcCwN2f74v6ynXnaiYP4CkLCezp+bd4802GP35 wFxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ei5H/fe8y0i51Hlp0Sp0kPBO0gWbv7up2qZD6Qbfv08=; b=smq91O+YxGxHf05dzTIZWQIKuPGm5JW5cw2aHB04fkvLIiiDYMoKXC/b/nFaJHyMJu R+K6GigYPoMgWXr8Tlj5ppai12UNHCnttvYnYphY2pTnnAAg9wW3xpYLw3uTdbUG9SwE 51UBGZbRMSsI58Vhs6G2lCDLE0RSWM/vsWwPi2S7crbOrbR5migzyLz/Fh6kaU6mFShQ u0cdDGhBv64liAoBnvNxMQ8WPDoHaSBLVbstQbpxC57TKcF9tNsHNsdt+7HaCDpWw/PU RZ9Y/e/gjWKg4LL3B0OVNhJ7kq5+dTmY2iZTPBOt9gBvnVP9NQhsH2UkbTEV0hYzM37m KnSw== X-Gm-Message-State: APjAAAUwN9sHJj9jJvbJb6fCQ8pUED0XJ9U8x8jKwogXCqLH/g75vhvp Y/36IBBZgQrijpn2Is24i7A= X-Received: by 2002:adf:f606:: with SMTP id t6mr28166657wrp.85.1574895273418; Wed, 27 Nov 2019 14:54:33 -0800 (PST) Received: from ltop.local ([2a02:a03f:404e:f500:2dc4:827a:b71a:1d2b]) by smtp.gmail.com with ESMTPSA id m1sm20706034wrv.37.2019.11.27.14.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 14:54:32 -0800 (PST) Date: Wed, 27 Nov 2019 23:54:32 +0100 From: Luc Van Oostenryck To: Dennis Zhou Cc: Christopher Lameter , Ben Dooks , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo , Nicholas Piggin , Arnd Bergmann Subject: Re: [PATCH] fix __percpu annotation in asm-generic Message-ID: <20191127225432.ttwxm3hxtg5utfaz@ltop.local> References: <20191126200619.63348-1-luc.vanoostenryck@gmail.com> <20191127175350.GA52308@dennisz-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191127175350.GA52308@dennisz-mbp.dhcp.thefacebook.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 27, 2019 at 12:53:50PM -0500, Dennis Zhou wrote: > On Wed, Nov 27, 2019 at 03:55:19PM +0000, Christopher Lameter wrote: > > On Tue, 26 Nov 2019, Luc Van Oostenryck wrote: > > > > > So, fix the declaration of the 'pcp' variable to its correct type: > > > the plain (non-percpu) pointer corresponding to its address. > > > Same for raw_cpu_generic_xchg(), raw_cpu_generic_cmpxchg() & > > > raw_cpu_generic_cmpxchg_double(). > > > > Acked-by: Christoph Lameter > > > > Maybe a better fix is to come up with a typeof_strip_percu() or so > > macro for all the places where this needs to be done? > > I like the idea of typeof_strip_percpu(). Luc do you mind spinning v2 > with a macro for this instead? I wouldn't mind at all (I already thought about doing something like this several times) but: 1) it would strip any address space, not just __percpu, so: it would need to be combined with __verify_pcpu_ptr() or, * a better name should be used, * it should be defined in a generic header, any idea where? * I fear it would be abused to escape sloppy typing (like __force and casts are already often used). 2) while I find the current solution: typeof(T) __kernel __force *ptr = ...; quite readable and relatively easy to understand, the solution I have for doing it with a macro (that behaves like typeof) is, IMO, much much less readable and understandable: #define typeof_strip_percpu(T) \ typeof(({ typeof(T) __kernel __force __fakename; __fakename; })) typeof_strip_perpcu(T) * ptr = ...; So, if you insist I can do it but I would really prefer not. Best regards, -- Luc