Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp457030lqh; Tue, 7 May 2024 04:44:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVI0b9AibK6lzRh3Xs8Gsq3Bcibtw7r81+nzqAzZSWfsuwJkdLnPDyJbabrzSXYKZ8Sa6Cii5x/0XxAWQgDdd2tr+YcKNkvX6qvZTOi0g== X-Google-Smtp-Source: AGHT+IE3HKP25awHdjXPh2nXOEafxUSk8oXX1kiURYhSx4vhto1iut4fBEc/5t/+3etXhX+mNhoh X-Received: by 2002:a17:902:ea8c:b0:1e0:bae4:48f9 with SMTP id x12-20020a170902ea8c00b001e0bae448f9mr11666003plb.32.1715082267956; Tue, 07 May 2024 04:44:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715082267; cv=pass; d=google.com; s=arc-20160816; b=t5vGCql71lcaNhOUwzafE32jmbL4oE5X4pUrxaBb6i/vOtS/nyiStBDkWtZgNThqFK UDXvQf69mCH5lMypBigcMNXoW8PLKAVyVwjwKMa+ZIKyWt44/c890VZbrSKJnfA1lwWF ugMhUUUYc5LL2z3r9Lo/lOrPTjSI13cPh8trCp8mYcwp/m8dwEobru+bVi8o7CEW/bqt 4hK06f5QFUKMg2EED8WZHFhSnxmYuRyXIipRvM2+vx8OlcMGdi8ItH575eX6V+lDyOJu TmT/MBQWxMECSa4xEd+BxUTRTiPFg20oBg983gweN+LW9omxWDZ5/ZgWTiQ42KTZOdRM NbDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=nUVaoXiu44BiAXrCqxjBhtMw9DuZOXrqazpAQ7VM7I8=; fh=gzvX8Pt3SVy9GATTDtg4NZavJRRhnAAWUeFnWRzfof0=; b=J/HFGE3qmMFUAGKe32DX4QyDSB8nCpkb4Z0ahGghf+QBnj//QUK9jvW5awMzlpxJSc 0jDOxgsMYUFx47TWKXnD4+CrF2OtHJVnQ73MgbKXSEciqcBwcSQlTL7L4klX/SrM3DO8 l6d02NfT9J0/Uyf9JxhYRyQbnnnJf6xEGPHOhHdqPEqc+SQVaJg2iu1VEJcSa8c03Odg L9SnaZ6HSiKvQ1kz0WAvERlzoUTc6YtH0864vUQqmbhMm/TcaCruhRHFV1ztqkEG5kL1 srdD8rvjmWSoJXKNdsOshGjpI0dh1jqKfMMmbJb6ys1LxtiyVYxkNaGRtWJRWtrV95OT jwjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FLTe9Fpj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z1-20020a170903018100b001e90519bdfcsi9077783plg.19.2024.05.07.04.44.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 04:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FLTe9Fpj; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F35AC28377D for ; Tue, 7 May 2024 11:44:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97AFD152DF5; Tue, 7 May 2024 11:44:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FLTe9Fpj" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 185B6152DEA for ; Tue, 7 May 2024 11:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715082246; cv=none; b=n/myauhCfNrGcnwZMuidpuDvkS4OMHsuNHaugOFgzeQ9CUwFtip8Z6etq+HZx+Nf9VIM5iwfVwQEpTn9unwfJt07FkmU+mdySjYDqJlVYtyZ8NG62rmEYyXcH8TphLyX1G8an5EETnlo2sNKrYni1vG4AP33Qqu/W7eq7L+Bg5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715082246; c=relaxed/simple; bh=zeSc0zMRaHwEe3WALkGgrfChiRHog7dzLDFVfwgftZg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=G5dx/Qh+fWNpfkwW641M1tyyG/AML/mgEUctvmWNy2sPLvx9732hGZQROBCDSY3RQrg8XTOM75o4N6hy0SkahE4fp5++3ZLclOTz/zTSxIhZx8TG1A7qxviXQzPwJoWHV4wYkD3WlbVHHqn0wWH6ec6VtaO7hHVxJRqCCXOENJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=FLTe9Fpj; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715082243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=nUVaoXiu44BiAXrCqxjBhtMw9DuZOXrqazpAQ7VM7I8=; b=FLTe9FpjUwbd53JyQKuTy2Br6dJX/iL3HZnU0IakaySak6FmZXnDndQwex9Dd3wNoTOOY6 gS1QPRxIAaurGK75pjviSZUPx5vEnynUuVUZU9PkqFVlsebPKw1+k4bDG4aBIJNxN1CDOP +5pB6AG5j09ZFLTmw3rOJXpe8IeZMs8= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-DqLPgC7IPPijUX7Lee0nYQ-1; Tue, 07 May 2024 07:44:02 -0400 X-MC-Unique: DqLPgC7IPPijUX7Lee0nYQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2e0b3a7ffbeso28408971fa.1 for ; Tue, 07 May 2024 04:44:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715082241; x=1715687041; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=nUVaoXiu44BiAXrCqxjBhtMw9DuZOXrqazpAQ7VM7I8=; b=rjLV4Eihh27EvvRlt1v2V+PO6HLLdk2I3H4hmqsh3qo8rs9QeVkncc6Svrwgy5SC+v E05E8negUf/z3a1gcolHmJoCMVywgl+A0VmuDYC2xhatsiEy38gvZDQflAdEPxVhyMaU wJMGJCE0lDsurwMwOXaYqU3z5iN5gnK9az9BtNMxJZ7l+XWtRwDRmz9QSP5A5P/c4bcz J5W/tYjYxjcUzYMCJCY+iq+Ffxn/YCSRy4QdPVPedoHWeKXu/lbYcP38c6expqaBBXjM KrT++LPxryLjEcKgn6D86Byyi7w0mkcHqnZq+sqkf+yO3AsR/nqQ1VJk+OV0kvK+qA0v PqAg== X-Forwarded-Encrypted: i=1; AJvYcCVJh7dQHToWtbUbu10PrUh1z3HpMP+YI9dPeCEEhTnXArtBBg8zUGbpsbJfvCAByN2qSHZ//ya7G9buvgbZ0bnPxnvIH/+fcVTKIYex X-Gm-Message-State: AOJu0YyZrQSMQd73UrnixpS57fvxRBsdqjPkqamQsXcuqCXkQSl/xKRZ SWLaAnOYNPKIDlD2MrM8Rc1ROT0D5N6rt2SWZUcsLBGYcTJv1ltmW/jdBlmESxoKGXJRqlMol55 zz1SvSkkG5tlOo/UJhQ5Y/Ep4L1xtiz4jAcEtN/sFurvk9wsp0AcjYA3z3DeWYw== X-Received: by 2002:a2e:bc17:0:b0:2e0:ffea:4282 with SMTP id b23-20020a2ebc17000000b002e0ffea4282mr12472816ljf.38.1715082241120; Tue, 07 May 2024 04:44:01 -0700 (PDT) X-Received: by 2002:a2e:bc17:0:b0:2e0:ffea:4282 with SMTP id b23-20020a2ebc17000000b002e0ffea4282mr12472794ljf.38.1715082240635; Tue, 07 May 2024 04:44:00 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id r13-20020a05600c35cd00b0041bf45c0665sm23129210wmq.15.2024.05.07.04.43.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 May 2024 04:44:00 -0700 (PDT) Message-ID: Date: Tue, 7 May 2024 13:43:59 +0200 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 v4 3/4] arm64/mm: Move PTE_PRESENT_INVALID to overlay PTE_NG To: Ryan Roberts , Catalin Marinas , Will Deacon , Joey Gouly , Ard Biesheuvel , Mark Rutland , Anshuman Khandual , Peter Xu , Mike Rapoport , Shivansh Vij Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240503144604.151095-1-ryan.roberts@arm.com> <20240503144604.151095-4-ryan.roberts@arm.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HG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7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240503144604.151095-4-ryan.roberts@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 03.05.24 16:46, Ryan Roberts wrote: > PTE_PRESENT_INVALID was previously occupying bit 59, which when a PTE is > valid can either be IGNORED, PBHA[0] or AttrIndex[3], depending on the > HW configuration. In practice this is currently not a problem because > PTE_PRESENT_INVALID can only be 1 when PTE_VALID=0 and upstream Linux > always requires the bit set to 0 for a valid pte. > > However, if in future Linux wants to use the field (e.g. AttrIndex[3]) > then we could end up with confusion when PTE_PRESENT_INVALID comes along > and corrupts the field - we would ideally want to preserve it even for > an invalid (but present) pte. > > The other problem with bit 59 is that it prevents the offset field of a > swap entry within a swap pte from growing beyond 51 bits. By moving > PTE_PRESENT_INVALID to a low bit we can lay the swap pte out so that the > offset field could grow to 52 bits in future. > > So let's move PTE_PRESENT_INVALID to overlay PTE_NG (bit 11). > > There is no need to persist NG for a present-invalid entry; it is always > set for user mappings and is not used by SW to derive any state from the > pte. PTE_NS was considered instead of PTE_NG, but it is RES0 for > non-secure SW, so there is a chance that future architecture may > allocate the bit and we may therefore need to persist that bit for > present-invalid ptes. > > These are both marginal benefits, but make things a bit tidier in my > opinion. > > Reviewed-by: Catalin Marinas > Signed-off-by: Ryan Roberts Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb