From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 124DFECAAD5 for ; Fri, 2 Sep 2022 16:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236193AbiIBQ27 (ORCPT ); Fri, 2 Sep 2022 12:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236404AbiIBQ25 (ORCPT ); Fri, 2 Sep 2022 12:28:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B7FDAA2E for ; Fri, 2 Sep 2022 09:28:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D30B61FDB for ; Fri, 2 Sep 2022 16:28:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3E34C433D6; Fri, 2 Sep 2022 16:28:50 +0000 (UTC) Date: Fri, 2 Sep 2022 17:28:47 +0100 From: Catalin Marinas To: Steven Price Cc: Peter Collingbourne , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Cornelia Huck , Will Deacon , Marc Zyngier , Evgenii Stepanov , kvm@vger.kernel.org, Vincenzo Frascino Subject: Re: [PATCH v3 4/7] arm64: mte: Lock a page for MTE tag initialisation Message-ID: References: <20220810193033.1090251-1-pcc@google.com> <20220810193033.1090251-5-pcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Sep 02, 2022 at 03:47:33PM +0100, Steven Price wrote: > On 10/08/2022 20:30, Peter Collingbourne wrote: > > diff --git a/arch/arm64/mm/mteswap.c b/arch/arm64/mm/mteswap.c > > index a78c1db23c68..cd5ad0936e16 100644 > > --- a/arch/arm64/mm/mteswap.c > > +++ b/arch/arm64/mm/mteswap.c > > @@ -53,6 +53,9 @@ bool mte_restore_tags(swp_entry_t entry, struct page *page) > > if (!tags) > > return false; > > > > + /* racing tag restoring? */ > > + if (!try_page_mte_tagging(page)) > > + return false; > > mte_restore_page_tags(page_address(page), tags); > > I feel like adding a "set_page_mte_tagged(page);" in here would avoid > the need for the comments about mte_restore_tags() taking the lock. Good point. I think I blindly followed the set_bit() places but it makes sense to move the bit setting to mte_restore_tags(). Thanks for the review. -- Catalin