Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3440646ybc; Mon, 25 Nov 2019 14:42:44 -0800 (PST) X-Google-Smtp-Source: APXvYqy056IwlJigA+VMMuJyMmSGzcHcx2GNcucATMh2V2Q3ITKCGp38hPH6jGTubm1D6IkiVTEy X-Received: by 2002:a17:906:9458:: with SMTP id z24mr39213605ejx.289.1574721764781; Mon, 25 Nov 2019 14:42:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574721764; cv=none; d=google.com; s=arc-20160816; b=jAHSR3O6Mqf16l3/lsSijRv0nDn2s29S+vFDYGlWTm0oOGq7WhfHKzZNIiKv/idrvI DOqug1M0sTxO10yUM6pG+A7Vas2ylMgFTLo6PkTGlJj7zYo5BDe36B938dF2bbTd8xnM 8sQPzU8CS3uaOndMvzJoYq/VfLEkOnfIEQmJxpZyCaYdLdzPwMa0MS79BJW/KtrhkEZY x3ZFI1dboM2QcGRMrte/GOeZT3OHalvPPtqSRkup9l5WvrhytUMYMehukEMjdJchkNor 4W5C2IoFCL8GV8LZZfa5NyfZkQrECAUmuBLkip5Hhecxr9biQI9KqxCNVRdAUB+0QQmK 66Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Q3hL+mhvMKtQdk1PWTs3KdMciCCix20V4ciU42QvLSs=; b=tONGi3vQbWflSi1lvueIATLSWSW0W4m9yJzKd0YAz49R1QserSQBZNnUJ8WdAB/RiF fxudTUvDRCtSp32xG98U+JNG6RW2X9yLENHsrJCjpfxSVdOqWZQ4IX1n3zIua1ap6NET J/k3t3psGbnYl9dqyA4c0fWhpy/xom3a3meqoORRUgKcadn1JZp6QfIhWEMc0+o5qf9/ jutzyDvF3v0YHzt9eh70wHyvNnhz6QjXE/Zdp2jKv2CCNFEDaZz4Fi8rExVdCVV7wuFo vV1XRrrRgqYC8bHu624HjDskLtpIGH0N2GPD9pJqvFowFPk6YAGNmxSf6ebAhFU3q8jP MyRA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si5569390ejz.314.2019.11.25.14.42.20; Mon, 25 Nov 2019 14:42:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbfKYWlY (ORCPT + 99 others); Mon, 25 Nov 2019 17:41:24 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:44470 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727217AbfKYWlY (ORCPT ); Mon, 25 Nov 2019 17:41:24 -0500 Received: by mail-qk1-f196.google.com with SMTP id m16so14376644qki.11 for ; Mon, 25 Nov 2019 14:41:23 -0800 (PST) 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:user-agent; bh=Q3hL+mhvMKtQdk1PWTs3KdMciCCix20V4ciU42QvLSs=; b=cbxRGVQ5MQzpVRqAv7Rvt/zeJOgAeAuisvRTR1y8nM0l8pGSvHElg7q2A7bwYUN+1w xPhQ/9K5XQFKbHMTmeM9EcG6ruFbyZBzzh5RY/Pk3IcnwwRFW02fqLLKWEUKOYTztQsc 8D+bneRRVw3IHdeGZ6a9slSVh5FaTU7gFwjiS38yMVj4rO6kiKwqFpWaOASxBFOGhrXg KTXI7O7GEKaFBM7cgWOBqCLn2anmpGBD3pbazWccqM28DeAcdiaAdJTPUFpWVAIY9fVP EI/C0pwyiImB7/aykA2lP4VTXGWtRJMdxkF4/lCGV0B7Rqf180WxnbiVuy0IhUaWq5/A /kmg== X-Gm-Message-State: APjAAAXEVdcP2+B/EvatbxW9f6ebhj96Q+b46yuqG5zQxONvJ8sZtURM hj+3ZpzeAnOjhllNvg5jZvg= X-Received: by 2002:a37:64a:: with SMTP id 71mr28528362qkg.50.1574721682681; Mon, 25 Nov 2019 14:41:22 -0800 (PST) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:500::2:6080]) by smtp.gmail.com with ESMTPSA id o139sm4054924qke.95.2019.11.25.14.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 14:41:22 -0800 (PST) Date: Mon, 25 Nov 2019 17:41:19 -0500 From: Dennis Zhou To: Dennis Zhou Cc: Ben Dooks , linux-kernel@lists.codethink.co.uk, Tejun Heo , Christoph Lameter , linux-kernel@vger.kernel.org Subject: Re: [PATCH] percpu: add __percpu to SHIFT_PERCPU_PTR Message-ID: <20191125224119.GA37611@dennisz-mbp.dhcp.thefacebook.com> References: <20191015102615.11430-1-ben.dooks@codethink.co.uk> <20191017181301.GA32546@dennisz-mbp.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191017181301.GA32546@dennisz-mbp.dhcp.thefacebook.com> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 02:13:01PM -0400, Dennis Zhou wrote: > On Tue, Oct 15, 2019 at 11:26:15AM +0100, Ben Dooks wrote: > > The SHIFT_PERCPU_PTR() returns a pointer used by a number > > of functions that expect the pointer to be __percpu annotated > > (sparse address space 3). Adding __percpu to this makes the > > following sparse warnings go away. > > > > Note, this then creates the problem the __percup is marked > > as noderef, which may need removing for some of the internal > > functions, or to remove other warnings. > > > > mm/vmstat.c:385:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:385:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:385:13: got signed char * > > mm/vmstat.c:385:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:385:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:385:13: got signed char * > > mm/vmstat.c:385:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:385:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:385:13: got signed char * > > mm/vmstat.c:385:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:385:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:385:13: got signed char * > > mm/vmstat.c:401:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:401:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:401:13: got signed char * > > mm/vmstat.c:401:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:401:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:401:13: got signed char * > > mm/vmstat.c:401:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:401:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:401:13: got signed char * > > mm/vmstat.c:401:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:401:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:401:13: got signed char * > > mm/vmstat.c:429:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:429:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:429:13: got signed char * > > mm/vmstat.c:429:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:429:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:429:13: got signed char * > > mm/vmstat.c:429:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:429:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:429:13: got signed char * > > mm/vmstat.c:429:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:429:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:429:13: got signed char * > > mm/vmstat.c:445:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:445:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:445:13: got signed char * > > mm/vmstat.c:445:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:445:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:445:13: got signed char * > > mm/vmstat.c:445:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:445:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:445:13: got signed char * > > mm/vmstat.c:445:13: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:445:13: expected signed char [noderef] [usertype] *__p > > mm/vmstat.c:445:13: got signed char * > > mm/vmstat.c:763:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:763:29: expected signed char [noderef] *__p > > mm/vmstat.c:763:29: got signed char * > > mm/vmstat.c:763:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:763:29: expected signed char [noderef] *__p > > mm/vmstat.c:763:29: got signed char * > > mm/vmstat.c:763:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:763:29: expected signed char [noderef] *__p > > mm/vmstat.c:763:29: got signed char * > > mm/vmstat.c:763:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:763:29: expected signed char [noderef] *__p > > mm/vmstat.c:763:29: got signed char * > > mm/vmstat.c:825:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:825:29: expected signed char [noderef] *__p > > mm/vmstat.c:825:29: got signed char * > > mm/vmstat.c:825:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:825:29: expected signed char [noderef] *__p > > mm/vmstat.c:825:29: got signed char * > > mm/vmstat.c:825:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:825:29: expected signed char [noderef] *__p > > mm/vmstat.c:825:29: got signed char * > > mm/vmstat.c:825:29: warning: incorrect type in initializer (different address spaces) > > mm/vmstat.c:825:29: expected signed char [noderef] *__p > > mm/vmstat.c:825:29: got signed char * > > > > Signed-off-by: Ben Dooks > > --- > > Cc: Dennis Zhou > > Cc: Tejun Heo > > Cc: Christoph Lameter > > Cc: linux-kernel@vger.kernel.org > > --- > > include/linux/percpu-defs.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h > > index a6fabd865211..a49b6c702598 100644 > > --- a/include/linux/percpu-defs.h > > +++ b/include/linux/percpu-defs.h > > @@ -229,7 +229,7 @@ do { \ > > * pointer value. The weird cast keeps both GCC and sparse happy. > > */ > > #define SHIFT_PERCPU_PTR(__p, __offset) \ > > - RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset)) > > + RELOC_HIDE((typeof(*(__p)) __kernel __percpu __force *)(__p), (__offset)) > > > > #define per_cpu_ptr(ptr, cpu) \ > > ({ \ > > -- > > 2.23.0 > > > > Hello, > > I've applied it for-5.5. > > Thanks, > Dennis Hi Ben, I've reverted this commit. After spending a little more time on it, I don't think this is the fix we want because after we call RELOC_HIDE, we are shifting from __percpu to __kernel address spaces as we're adding the offset here. Thanks, Dennis