Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp368549lqm; Wed, 1 May 2024 03:13:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9i1nlQ0WzambZd0v7jKEpE1AQEAicSdCxfbwhbaPpOCAENVDw1hLszZenDmfey3koVvOVVwNm16KsJGDhw0qSB32MQvM7HHsXRoDp8w== X-Google-Smtp-Source: AGHT+IEhOVUSvDxT9Bcm/+EyqZnyn2HwhSZQUbSr1LR67f6bR7Q9gAHpT9CnLURxQckrzuLKx2ce X-Received: by 2002:a05:6870:819d:b0:229:e422:4ff9 with SMTP id k29-20020a056870819d00b00229e4224ff9mr2278561oae.18.1714558431270; Wed, 01 May 2024 03:13:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714558431; cv=pass; d=google.com; s=arc-20160816; b=CCpDUkRZlyMttP1qEysVZldKe61gFznWU88rzE3auvk2JbuOrSzi7b+Ylk0UA2tiHp Rb3tnsDWeAfq4bY6+hYDeFJV/aWqeJoi74uWNBmOknOkH7oaeTnoRybnBY0OpZoYw45P g6YNZZGnpjgaLd6X1kn0D95vo2cpkRrz05QhPI4TaRryDcWXCO0jb18nfN8jEICYxTDt IlUl6KCOaqGu81Lvf8l9YhlNDn/nFV7kikMlyZIaWnwnOg1fSf+zIWs1HnVIsf2oYx9v Mjtpdc95Jj8RaG3sN5yq8PEQmadiTLDMfDM1pzkDjJRkpNfIHXmrHhw8oK7CC6fsAcOK +DeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=tDFIiTrUaOmiTuUmx31m39y8Uw4dcSJQoVf1W1OzA14=; fh=zOigN/lPTnsUDOoQPdOGx2GJ9Gkl2rvSpI7N1DpQ40E=; b=dnYw6Relu3dSs7Y6BoR85GIJ6xXgc4/Xg+eTR+FLnZUoK9itTVBSpGf7+hXYt7Qjko 0ahQZxxwPZ8xt7DCm7LYLd00zlmRxAhYf35smptTq0oCtWUCmr3UsKluWJoG8J5Z7EU6 IvBTskzav0mWjU9pYmpWtD4IT0O+r07jVGvcyTVZOU8lFKV6JzHZqK2je3BfdYdDaJ+x T8KPCL3Z0fQlHtirHHnGNhvRIrcomOnNQbR2MIsX4XsjDk/9fN/2SWlTGM1+EuVKMGvh 0KXV8RBaAa/GkTDD1RyVZkegVa3kIaHT1RPveWNe1Xbu1Zt5PWQRmPQEle4jD50aqD5M NRqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165128-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k4-20020a05620a414400b00790efad4caesi8600878qko.586.2024.05.01.03.13.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 03:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-165128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165128-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 031801C231FD for ; Wed, 1 May 2024 10:13:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3080C52F9C; Wed, 1 May 2024 10:13:44 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC9DD50A68; Wed, 1 May 2024 10:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714558423; cv=none; b=B1wOz6hkvlvZ7q+XuVvtwzuVig4ShH+2E9v3MRtCp2iLiBfl5EGKCOLYI8iRORhry4pLX9OXXHyMkdy4MU9MFpABNNslWri6Ww31VUaipnpCJCEm3iwhLmA5lojWrpnFQa4wUXZxhuXn+xhzhd2RT7E9yjCSmByr9neycZ6nMyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714558423; c=relaxed/simple; bh=LwgA5tUBh5T6l1zxzQp/kd1I2Hf2cwtWXTWzbe9e+BU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WoNEQB3qaKD0cI5am5pGNVUZspfrFCQNi2+5YE5SvaS3MssfRTwyPPl5b7fhNT/1jpQaEWPbtsgQys8Cxgo+xl5wLX+FkCfHaf9DTAuQwYk8KQmb3iWo5hWsEtaPvJYJt+JpRbBoaTMqkcAI4XQ7KhoiyDvj7D2QbYmvzOOzQ2A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 49E292F4; Wed, 1 May 2024 03:14:07 -0700 (PDT) Received: from [10.57.65.146] (unknown [10.57.65.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A2F2E3F793; Wed, 1 May 2024 03:13:39 -0700 (PDT) Message-ID: Date: Wed, 1 May 2024 11:13:38 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] arm64/mm: pmd_mkinvalid() must handle swap pmds Content-Language: en-GB To: Catalin Marinas Cc: Will Deacon , Mark Rutland , Anshuman Khandual , Andrew Morton , Zi Yan , "Aneesh Kumar K.V" , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20240430133138.732088-1-ryan.roberts@arm.com> <171449974870.639201.3165060270571039049.b4-ty@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 01/05/2024 11:04, Catalin Marinas wrote: > On Wed, May 01, 2024 at 09:05:17AM +0100, Ryan Roberts wrote: >> On 30/04/2024 18:57, Catalin Marinas wrote: >>> On Tue, 30 Apr 2024 14:31:38 +0100, Ryan Roberts wrote: >>>> __split_huge_pmd_locked() can be called for a present THP, devmap or >>>> (non-present) migration entry. It calls pmdp_invalidate() >>>> unconditionally on the pmdp and only determines if it is present or not >>>> based on the returned old pmd. >>>> >>>> But arm64's pmd_mkinvalid(), called by pmdp_invalidate(), >>>> unconditionally sets the PMD_PRESENT_INVALID flag, which causes future >>>> pmd_present() calls to return true - even for a swap pmd. Therefore any >>>> lockless pgtable walker could see the migration entry pmd in this state >>>> and start interpretting the fields (e.g. pmd_pfn()) as if it were >>>> present, leading to BadThings (TM). GUP-fast appears to be one such >>>> lockless pgtable walker. >>>> >>>> [...] >>> >>> Applied to arm64 (for-next/fixes), thanks! It should land in 6.9-rc7. I >>> removed the debug/test code, please send it as a separate patch for >>> 6.10. >> >> Thanks Catalin! I'm guessing this will turn up in today's linux-next, so if I >> send the tests today and Andrew puts them straight in mm-unstable (which will >> goto linux-next) there is no risk that the tests are there without the fix? Or >> do I need to hold off until the fix is in v6.9-rc7? > > It looks like we don't push for-next/fixes to linux-next, it's > short-lived usually, it ends up upstream quickly. I can send the pull > request later today, should turn up in mainline by tomorrow. You can add > a note to your patch for Andrew that it will fail on arm64 until the fix > ends up upstream. It's a matter of a couple of days anyway. OK, I just didn't want to send it only for our CI to start failing. I'll do as you suggest.