Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4578192rdb; Tue, 12 Dec 2023 03:49:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqVaPIvHLR3+0wGI4W6FtKL7ntGFbWaJb0Q5ncGnLhMBewHlUGa81VT5ZBkcqgT/NOjCCW X-Received: by 2002:a17:90b:2289:b0:286:6cc1:270 with SMTP id kx9-20020a17090b228900b002866cc10270mr2569564pjb.59.1702381766256; Tue, 12 Dec 2023 03:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702381766; cv=none; d=google.com; s=arc-20160816; b=rMrm1CgCQo1cvbWVpSCZdHyrBXfgaitkx2XbNMBZYm3JuBNJE7X6d8xK5/h0fWgcnU qwrBzKmu5v6/lmAlJCKzpZorSgxJcfOnpDw9Ve8t93x3hKE5HQBaIucGgrWGcIunoq4k f9tjIsRgW/zJkmHxdcAK/r7kaE2GRgY+5Eitoht2F6AXfIUlEBbrV6hexBxNRFDuwLjE U/6hjsO5RON3tdwVIVamxJty1LIRm2NR8zY65tboXfijRoDFKW5kz7cFH5hdZclGytes TSas37XSA95ImWAmo+Oi9MaEeSnZBsYni3YUbr5NShOjHrL4o3giaLMkbVEp3i4mD9MS fkdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=qGo6VQ1GH3r8vh3FHA5skwhCVAe71E+aOwZCWSOJx4Q=; fh=JmripaXcG1nUkR+bJdxKwpL44/WPXQZU8nK9YTrry6M=; b=a/6x28u9JPsw4uKBgIwp6JA4f8guigeaY96RtWvohus4xwdSpp0AhTr+LbClqzoL+2 NrC6s91JNbUOVjFA/BjU+Lc/649Knu0quFhY5NA+m1TBAN7qmVytE7r3H8598FTwa8+B CN7EW69+XIsi9bz+F0vC34ilbnqGKvQXmEQ3efUQCiaYfD2gWLYam/F1h5JVKcLfgQJ7 nihKWuJPt9l8Xn2Wo2rDn9T3ohGjsjG39ZyWbZSl4ckHaXb+eP+4kgC/1EDji4Rs9eLX VuWx5cR1XWk/QBRH/Cvpm4xKO5huozf96uCiPt5xHC0UPaCoTAtfN2fE4fw3JNPnBICU aHng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IEeG14i2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y3-20020a17090a86c300b0028649cc70b2si9067987pjv.14.2023.12.12.03.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:49:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IEeG14i2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4ECAB80A2214; Tue, 12 Dec 2023 03:49:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346300AbjLLLtJ (ORCPT + 99 others); Tue, 12 Dec 2023 06:49:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232383AbjLLLtI (ORCPT ); Tue, 12 Dec 2023 06:49:08 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A34FA6 for ; Tue, 12 Dec 2023 03:49:14 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50bf7bc38c0so6315778e87.2 for ; Tue, 12 Dec 2023 03:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702381752; x=1702986552; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=qGo6VQ1GH3r8vh3FHA5skwhCVAe71E+aOwZCWSOJx4Q=; b=IEeG14i2r5a9V4hO9+sQnVLKuxFQjSYKnJL9Op7MROYUTI9bfrK3ZbFkhDRIqImgt6 O/WINTT4sMALzhPl8C+a9wLDb6YrMuop4X5f3+QZtcYW+3D98gJSvrCLt78aha2bLUuZ Q9LF9xMT8dAT+oYb4Ql6dk97e/kG8HMDDqi0XVorSpaYmluMagWRALhu99cV2O5Q4hla h6nhvhhmBugEfKosyS7x7Kccg6nNj1yvCLIXsNC2gIjKsBtphOJegKu41aPfdNbq6wxU CkWW9Ft/x417kXkHZvBt/FRouN6XP3GI5yI4/NGxk/F+IyquoJYRbO/9HkfIPWnCVHob oK1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702381752; x=1702986552; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qGo6VQ1GH3r8vh3FHA5skwhCVAe71E+aOwZCWSOJx4Q=; b=dq57oo/RVZRzKvKuc079j9lHy+Dgn9SdBSPgOjfLZUo7/ZPGi4U9C2JBTzRPlI6DYp UTS84qcINH8l5/FMDLbZYSgcTbz3syrorZCK8yBkdu9+HYnwXR0o/LsoB5GVRpWXN2Fb IZSZwNXlctrbjLyinc3Ecqq4WuHumYZHKeo4eQEPwt63+xdkynvbVSLiXF1RZFV8tH8R rZcErRoQLYRhF7slJiN6QBfyz9tQ3AEJkDCy/giH2BDc6KE0Onkwf31+VFnp3KkfVRwa g4uPwnNVwUejAbYDsNVSWRUHa/XwuPJVd0SsZHSsjbB6fXe14hSkrbi7ZDkp1JdGTJ7F FK8g== X-Gm-Message-State: AOJu0YxSEM+djrAnS2qd365zBibh3HBpK4ai2RWWsrru1pPoV+zFJGht zMlDpA04/QhAdnKYon/o+g== X-Received: by 2002:ac2:4d91:0:b0:50b:ee87:eeb4 with SMTP id g17-20020ac24d91000000b0050bee87eeb4mr2859443lfe.54.1702381752342; Tue, 12 Dec 2023 03:49:12 -0800 (PST) Received: from p183 ([46.53.250.155]) by smtp.gmail.com with ESMTPSA id vs6-20020a170907a58600b00a1fa6a70b8dsm2530499ejc.133.2023.12.12.03.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 03:49:12 -0800 (PST) Date: Tue, 12 Dec 2023 14:49:10 +0300 From: Alexey Dobriyan To: Brian Gerst Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Dennis Zhou , Tejun Heo , Christoph Lameter , x86@kernel.org Subject: cast inside __pcpu_cast_1 macro Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 03:49:22 -0800 (PST) Hi, Brian. You've added the following macros in commit 6865dc3ae93b9acb336ca48bd7b2db3446d89370 x86/percpu: Introduce size abstraction macros +#define __pcpu_cast_1(val) ((u8)(((unsigned long) val) & 0xff)) +#define __pcpu_cast_2(val) ((u16)(((unsigned long) val) & 0xffff)) +#define __pcpu_cast_4(val) ((u32)(((unsigned long) val) & 0xffffffff)) +#define __pcpu_cast_8(val) ((u64)(val)) They break complation if "val" is something complex like this_cpu_write(pcp, *x = 1); Only __pcpu_cast_8() is correct in this regard. "val" should be in parenthesis at least. Is there a reason for casts to "unsigned long"? Why not just #define __pcpu_cast_1(val) ((u8)(val))