From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE01382899 for ; Sat, 11 Jan 2025 17:10:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736615459; cv=none; b=bY4BnscD+iJm4qsqfVCvvk0j9uiwZaUyjylbwW6p1gYjLxxK0oUScGarbH2BnxFFjpZ1MndnF0bOaU6o0TU6bqm2CrmI4Of88EgCZwpChDuznpMu+9d3+wfQ7CTDxIfKOVUsXzk3PHOq8lL3MKy2YakW1csexyGlNnmBVMa40G4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736615459; c=relaxed/simple; bh=sRWi3tG13fCkNDLa5qQCgTBRhfYvqA9E2NhsP3p2+2A=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=oRhzpF7JPtdG6bS/tYtPw96wjGTGZka/wsYksYQLpPF93vx06Qfoe9b1Ait9M6eQxNQdUjJKKhIndFqMbH2mdK3mUvQULMX2TZODb34vITD/DtK7WsanCFxOgkLqXSHQy21VUoqDdN8utaETa/xLV/5igJo9APoFurrELQ/hNZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=giI5U4UM; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="giI5U4UM" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2f441904a42so5314988a91.1 for ; Sat, 11 Jan 2025 09:10:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736615457; x=1737220257; darn=vger.kernel.org; h=references:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=oiDIac9UCgslMdyoZCP/7jQnvyDk7prCS5jJXe0SP8M=; b=giI5U4UM9ovNWDHsaytwvWpKkdvWIPCylyCH7aG2eVsYYDYEo57yOPDZ5AwAl4Rrwl 2XJueDC5L2q26bLq4d5ThQlne9woeF8yFjZHVLkmYPBOs9KSVtztgzjSXFOAIbFYJj5U Kty/LwdNpGbjGD4qLUyTVG+4U2OPvBNC0xBf9jzxi5YPT9mEjB5P8enXyESb4DYzgtx2 l/Jcb2JNLGioZ6FQwfcnHW36+o/z4rxlOjl/DV47eSnnKDdfO6T862V6ZlFYTypDEC4y XJLhIQG6HmCQx5KuyPupaGf1OAuY3r7thaRtFa1vnz0gA9pvnPVfpCNLr57iBsvuzfR/ KEFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736615457; x=1737220257; h=references:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oiDIac9UCgslMdyoZCP/7jQnvyDk7prCS5jJXe0SP8M=; b=myhzj2oFSYpwfkTTtmVwUyu7MU89PTT4ECBL9/ffgatTz2alkhjLkKIESJeXoZfUuB yVqDR1xrXCSt9Oa5KWeqsPGKYdUYNCTD2Bh+bX0JK6TDhRmvbpLEsilaBYD/ISmBfiSx o2HQGgPTEr94YPsQHf776mLhtLlgRwv9L6rMA1Ar87HnG8Ek5eN44UB+9grI2SNhAx7j xWyUOZn6LKudPFG9v9Aj3T4Gl5haf/41FHu8HKCW2xjXpUDUnv/98KiV7WU3xXh8ZWUa 04yQFdYWHq5Sn+JPTPNDS7pHFKwabxgrDgfPr1q2RNKx0UCmLG6Hjv6s2GfDeCnM85B9 phHw== X-Forwarded-Encrypted: i=1; AJvYcCVyOrDJKK3Ax7fXfQSttjMlVMZQXq93sXrU0Z9QSxnIFLmrGdiOn7VegUDRNmgjlDYyGHHHy18SkzUJB7w=@vger.kernel.org X-Gm-Message-State: AOJu0Yxdc3M14kNPAQm9mjpG460XTk0c3n+Ad3DgfLSonV5ZtvoTVrBn J7o+Mm1smBdAj2p/W9P9MyrEYnVNoozYg15+8cYKYaKotEGn4wXvv4oFcg== X-Gm-Gg: ASbGnctgmxJYB2ddsE4RXgJnUi/90m36vKQFZ7xIPlc1R2DMpAw3m4u2wmABYmfSodZ fmE1DJ+1rLYszmH8nP9GCFC3Kt4QQEJoRcSEz2v8ki+5mSHBDDyWuJvNoTlaVP9x4FO7nYE/4AL YNIbfO9S+haGWssjEp7mPaEnp8zfe8JefKKjMTbkkmfez3Q7pSXw2qsci196wD5bg9yOlXu23ot omALFWNllTXlblqZd7IAe0gEP0u+ITDhao5fSoHJ7iHF6i2 X-Google-Smtp-Source: AGHT+IHQdKqTwbYiK/nAlWC/6KumIvaC+qTQc/SilPBS3OQGqUFXiS/0kAwbi+fQRJYCJkv76bVryg== X-Received: by 2002:a05:6a20:72a1:b0:1e0:ae58:2945 with SMTP id adf61e73a8af0-1e88d0afc33mr28533903637.31.1736615456851; Sat, 11 Jan 2025 09:10:56 -0800 (PST) Received: from dw-tp ([171.76.81.42]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72d4056bc88sm3302165b3a.67.2025.01.11.09.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2025 09:10:56 -0800 (PST) From: Ritesh Harjani (IBM) To: Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Madhavan Srinivasan Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel test robot Subject: Re: [PATCH] powerpc/64s: Rewrite __real_pte() as a static inline In-Reply-To: <06750dbc7bf961e3ea7ef7a89d5c220972465ea5.1736331264.git.christophe.leroy@csgroup.eu> Date: Sat, 11 Jan 2025 22:33:04 +0530 Message-ID: <87o70duvuf.fsf@gmail.com> References: <06750dbc7bf961e3ea7ef7a89d5c220972465ea5.1736331264.git.christophe.leroy@csgroup.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Christophe Leroy writes: > Rewrite __real_pte() as a static inline in order to avoid > following warning/error when building with 4k page size: > > CC arch/powerpc/mm/book3s64/hash_tlb.o > arch/powerpc/mm/book3s64/hash_tlb.c: In function 'hpte_need_flush': > arch/powerpc/mm/book3s64/hash_tlb.c:49:16: error: variable 'offset' set but not used [-Werror=unused-but-set-variable] > 49 | int i, offset; > | ^~~~~~ > cc1: all warnings being treated as errors > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202501081741.AYFwybsq-lkp@intel.com/ Great. Why not fix the other warning as well which is reported in above link, which is... -- arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range': >> arch/powerpc/mm/book3s64/hash_native.c:786:29: warning: variable 'index' set but not used [-Wunused-but-set-variable] 786 | unsigned long hash, index, hidx, shift, slot; -- ...similar to how we fixed this warning by making the macro as static inline? That means something like this (not tested)? -#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT) +static inline unsigned long __rpte_to_hidx(real_pte_t r, unsigned long index) +{ + return pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT; +} -ritesh > Fixes: ff31e105464d ("powerpc/mm/hash64: Store the slot information at the right offset for hugetlb") > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h > index c3efacab4b94..a7a68ba9c71b 100644 > --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h > +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h > @@ -77,7 +77,10 @@ > /* > * With 4K page size the real_pte machinery is all nops. > */ > -#define __real_pte(e, p, o) ((real_pte_t){(e)}) > +static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset) > +{ > + return (real_pte_t){pte}; > +} > #define __rpte_to_pte(r) ((r).pte) > #define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT) > > -- > 2.47.0