Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp241769rbe; Wed, 28 Feb 2024 19:52:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUbjHAhBAQOCpHm8kC6v9fs2e8t8DkMh/17uI7+rd+IN34tx1FL++d1QnjpUNUYi4xSlhfNbfJLXbRjzh9FdX46duYpeKYybWMlu1DbGQ== X-Google-Smtp-Source: AGHT+IFXESiHz/QcJSnWlt2mw2gmdboMXvQJFZQMPNz63TP1RHXqNlaeNucURb5eQQLvd9WoFXhU X-Received: by 2002:a17:906:f88a:b0:a44:4433:748b with SMTP id lg10-20020a170906f88a00b00a444433748bmr213724ejb.13.1709178766432; Wed, 28 Feb 2024 19:52:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709178766; cv=pass; d=google.com; s=arc-20160816; b=H+oNmAcoRE4xUbCbi7EFkH78FMS5BTELdRtjrp8IDCBXk0wCI007aFFSFlVIq8lMBY oo7zcddCsybu39fkRrAUI3jfrTdUDbZiYkE+7RY2ClCUHCf0OMtpk7v+9aKLts2CbHgP fG8cBs1XgFtro+UmvysirOwDo2pqqRzfvEhNQ9uxa1EntOsoeaF+UOhTIho9/LgWwmVi +9qOAbc2ji5tcJPiCDT8++e+B1e1MuVj3lRdjtKzW5bh9OL2QWBJrOn0grhHsR1Vdv8/ C/w15e1DepQyW79PGQeGFrm28sRiBZbMmzZaKdHGeAGjzHT9FLX38vPiRyXEuy56NbtW E4hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=6IBaSBsq7NUzgRxw1n2f4wn1xYCvHpIMB2hLDiJZRWs=; fh=6+gIlZx53Xkf3mNbzWZMAQ5fPqsnLWLkZykPZPcMSAc=; b=c8tvfwiAz+sMG29AoJon40Z3hddyRPnyB0WTi0PdKaYhfcZ3FymN68uwQHhJZrgOgJ Nv7PQ4M1H6T47wePFqq9hyFffEUAVpqglbWSjPD4r539ySP1jRw47QNfeKGrbsRtTRXt 4WbqS+d4kyfpnT3o+xUVJLtd4XxD5eEq7tF7MKKrC5+nlA/Vt8k+wjWo64eOCCuR9/Lu cgipCJt7Q7XhvRacc+rEgaRG8ap/d3R5lr5DjX/Ax1UmKbApW2Feb6gnxm7QNRAxlikF YWryOekR8jMhcqWnX2DDHkYYVkZnxasrbovVjmnrBZ4+BGmjSDFl97R6Gr3HbIppvigy EuEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rne5CSNE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id k4-20020a170906a38400b00a3f1b39e522si198004ejz.680.2024.02.28.19.52.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 19:52:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rne5CSNE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-86103-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86103-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E1F971F2235E for ; Thu, 29 Feb 2024 03:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3778376F4; Thu, 29 Feb 2024 03:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rne5CSNE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1CD5376E1 for ; Thu, 29 Feb 2024 03:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709178758; cv=none; b=sxU/BPunK7INjv1e8HnwvwdCg7+wDwPUZDnt9h+f0oTPIzG9XWT24YHhlUslSGM+g+ZbN/i5VWwedTAGaqZdGUxWFwAX7A2OnkzOPMRd/YlZGtx6Rz7iCTuGZto4TytF7royxdbdB50URSB2MII7njVIZHJ5C2f6K1zku0PK4sg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709178758; c=relaxed/simple; bh=yH4w3KkVCaD1LzUfUcTHguk7T7n3tQ9C/jrL4yRKV2Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=V+F+vm+ltCSTex5OwOVM8BuiPtQYgUcYmGv33WKfXggAryBdGNpT5KnXVwsApC8aB/r0deGP++QpA8mg/qsxvfwCb99uxy4VDkavPpVTYlKO05VMuodxZDgKD8Vmco9BqJj5oRyqOV+5qcmxz0XQcH8xMT/wbQobal2IiAPvc+A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rne5CSNE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEC1C433C7; Thu, 29 Feb 2024 03:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709178757; bh=yH4w3KkVCaD1LzUfUcTHguk7T7n3tQ9C/jrL4yRKV2Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=rne5CSNEbrCuAvMIy9L8aj3RaP76gvIKhcvYyEDQnfSvXYeE44McntiUxD2ZxjCSI ahRfHcLZ5L3tOwkI+nrW/SslxK2n8ZMl97MF9S6fc7z3ci2+1z/iJ5dWkAjM+G/rJk Az8XmkafDYhn101oldaQWz3ds74I5TsJL0pqHFAhrX9PRTi0OvrCa/mgLNgiKO7ptj rgwgHVLSHvSzw02KdSAzfoA4Z31LzyE1eGe/BaI7F/yn+hoEx6dL3k3AP9YJBypUsa zjvdsQjAKc8UdNwAw2V4oX47MEDyc6CwJXOLB1RdSeOdr0drpGkqueWnltKYWH2ngH eYnXrUvUbJ0Tw== X-Mailer: emacs 29.2 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Michael Ellerman , Kunwu Chan , npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen.n.rao@linux.ibm.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/mm: Code cleanup for __hash_page_thp In-Reply-To: <87jzmq5tjr.fsf@mail.lhotse> References: <20240125092624.537564-1-chentao@kylinos.cn> <87h6hva4b0.fsf@mail.lhotse> <87jzmq5tjr.fsf@mail.lhotse> Date: Thu, 29 Feb 2024 09:22:30 +0530 Message-ID: <87bk80kjup.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Michael Ellerman writes: > Kunwu Chan writes: >> Thanks for the reply. >> >> On 2024/2/26 18:49, Michael Ellerman wrote: >>> Kunwu Chan writes: >>>> This part was commented from commit 6d492ecc6489 >>>> ("powerpc/THP: Add code to handle HPTE faults for hugepages") >>>> in about 11 years before. >>>> >>>> If there are no plans to enable this part code in the future, >>>> we can remove this dead code. >>> >>> I agree the code can go. But I'd like it to be replaced with a comment >>> explaining what the dead code was trying to say. > >> Thanks, i'll update a new patch with the following comment: >> /* >> * No CPU has hugepages but lacks no execute, so we >> * don't need to worry about cpu no CPU_FTR_COHERENT_ICACHE feature case >> */ > > Maybe wait until we can get some input from Aneesh. I'm not sure the > code/comment are really up to date. > > cheers How about? modified arch/powerpc/mm/book3s64/hash_hugepage.c @@ -58,17 +58,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, return 0; rflags = htab_convert_pte_flags(new_pmd, flags); + /* + * THPs are only supported on platforms that can do mixed page size + * segments (MPSS) and all such platforms have coherent icache. Hence we + * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on + * noexecute fault. + */ -#if 0 - if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) { - - /* - * No CPU has hugepages but lacks no execute, so we - * don't need to worry about that case - */ - rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap); - } -#endif /* * Find the slot index details for this ea, using base page size. */