Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp778907lql; Mon, 11 Mar 2024 18:28:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZj3wJKyudbkiyRiXtt51mwlM650pe0ENcsSs6N5PAFYNHnEK2GLJ6X2gDYRCojd1toV1ZmMRSHQrkmZXJkuMormQB27OLsPaMn5fgRw== X-Google-Smtp-Source: AGHT+IHNEjiIr5xXPs25AeEJdwwquSwVqQ7KEtmez1P2Wa0jlxCdC0i47OvzdwZOKoVxDGAtpveb X-Received: by 2002:a17:903:443:b0:1dd:b6c0:1363 with SMTP id iw3-20020a170903044300b001ddb6c01363mr656083plb.69.1710206883791; Mon, 11 Mar 2024 18:28:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710206883; cv=pass; d=google.com; s=arc-20160816; b=zWlTwP3+nzIJUb6WiDMlDl18ucCI9jyt2mX77cXYqlR/P1FHZMan9AVWAuX4Z/01gG 9aBi4juUAvc9Vhz7Kf11l2GU98PORtgjotrI1OrwDK2Mh+9BVF/QVDM2CLJWp7nsC/q3 npJjBTQk6/6+W5UYtS++hjHaGVKglf6M0Ou7u+mH2Y5jtFEfSY2M9UGEtgquk9RLadqE ZUTn0OXfZC1Dn7YSQrZsChsWPA9g0HyXFUmxPAwQAMAixIOzmJ+kM4BV9wTtrVhfXPXr FnWBKoLnKwiAP1Gn0M53jCZEsz1WTdMa7L5U9xXYJFZRG4Bdr6GeV1dVqZq8VwBEJIs7 xAnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=aZNtJKbvwiBbsnZ/2/GhPG+RCGU3s1Hafyp1VbH9Ya0=; fh=f3Tlw7gMw9eqEVh7EZA09S6YeTEDwjzs9D6J1qLkeyg=; b=gO+Azb5qo4FADdjipe3miupyjwLxt6GfRH/yWmlPTXbSUNxtVFWWva3QA80GwIg0N+ /VppAkvBEPqXmNqS4+cgqG/x6NmtrYQ/0KAIo1eFtAtV+pXgMROUHvMk60iEkOarpZQt CqvEq8CV+aZhFZpWYKMxHXuzVJrJOE0evLD/wdEEFLvIgRnrR8A3ZZ9fu0KA1nvhEaYO 8BVR8JeHrA+V0yvB8aqjAqh31Mtx6c/ctFXfE/JZLMnI4PvovShw2ecu0rOVKbpbP1Kj 4JEY0Q4NxuwSKldL+IEPi644A1MZz7vJt41DGjtZp2B/vEyb7ZlEcAhFVHN2wMr6l1ju 0sCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024021201 header.b=CK2gOGzN; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-99722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u14-20020a170902e80e00b001dd96de83b5si3565999plg.111.2024.03.11.18.28.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 18:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024021201 header.b=CK2gOGzN; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-99722-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99722-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 26E5EB21936 for ; Tue, 12 Mar 2024 01:28:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 878AF10E6; Tue, 12 Mar 2024 01:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="CK2gOGzN" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 A045A7E2 for ; Tue, 12 Mar 2024 01:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710206872; cv=none; b=O3ebbxxDK7pcQ2CnZt2RKpWXZtOgPUlcqqWqUNFYiUpEGXfbTEijXVeA5GfGU8Tj0qESClq+ngh8F6ss8n+aA2anLIvQe+QCpGQP1mTPur4vgjbstkbtN8xcg+UphCxy7iWZPNppfVQUJaYquhWhgVB3jjIOfjqVQs5WqDU7IBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710206872; c=relaxed/simple; bh=Ic2cF0xSH/QyhwLS/9FJwMuYD7oaUzcuMX32hHgJqV8=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=ounDp4mwnekfBTdKaqzSwIjrNpNhKwbBY9P/8WubUPUPXiCO2iTG2hRZjvryfUUMsxnzhEOwlQxy367r7sHConHZmUZTi8d6hJMNApyThAZdKn2JOVSlFBO7AfysQ6QQrQCH4z1x2S8bhou5AnDXzkUnMgUNriVrqoTItQ1V/xU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=CK2gOGzN; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [127.0.0.1] ([76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 42C1Q1kc1082275 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 11 Mar 2024 18:26:01 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 42C1Q1kc1082275 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024021201; t=1710206764; bh=aZNtJKbvwiBbsnZ/2/GhPG+RCGU3s1Hafyp1VbH9Ya0=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=CK2gOGzNI4OotmR7tnasLevJ0kZ+6wcq6/2wTmIyK2TxrG/9gmmUaHYyCekJye5GN kKYJhkmkryxZahcZaAFey6gXkSmx+mmuSaVUTCv9U6ehMP2N3YqMzMHXxg8C88vKpP HF86dpb9uLUucVjJJyMxd0soO/vh4jdOJ3ujRTTBxnlkH4iD13Iiv0//fRl/U1uFC/ gVHLG2+THu7W83zCzTJ+0PiTtL42i9q4rL3HvBcLFgOAkkQD/oz2It0a7Qy2N1OXF7 CZv22XqDlWpS43n9HnmNVXHMpqPgWgBY8XfYE3FXxLnAqMPEBsdIuUDAZ+jWczEtbO yEtAMPPmVSKIw== Date: Mon, 11 Mar 2024 18:25:56 -0700 From: "H. Peter Anvin" To: Dave Hansen , Nadav Amit , Andy Lutomirski CC: Pasha Tatashin , Linux Kernel Mailing List , linux-mm , Andrew Morton , the arch/x86 maintainers , Borislav Petkov , Christian Brauner , bristot@redhat.com, Ben Segall , Dave Hansen , dianders@chromium.org, dietmar.eggemann@arm.com, eric.devolder@oracle.com, hca@linux.ibm.com, "hch@infradead.org" , Jacob Pan , Jason Gunthorpe , jpoimboe@kernel.org, Joerg Roedel , juri.lelli@redhat.com, Kent Overstreet , kinseyho@google.com, "Kirill A. Shutemov" , lstoakes@gmail.com, mgorman@suse.de, mic@digikod.net, michael.christie@oracle.com, Ingo Molnar , mjguzik@gmail.com, "Michael S. Tsirkin" , Nicholas Piggin , "Peter Zijlstra (Intel)" , Petr Mladek , Rick P Edgecombe , Steven Rostedt , Suren Baghdasaryan , Thomas Gleixner , Uladzislau Rezki , vincent.guittot@linaro.org, vschneid@redhat.com Subject: Re: [RFC 11/14] x86: add support for Dynamic Kernel Stacks User-Agent: K-9 Mail for Android In-Reply-To: References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> <20240311164638.2015063-12-pasha.tatashin@soleen.com> <3e180c07-53db-4acb-a75c-1a33447d81af@app.fastmail.com> <08EFDEDB-7BBB-4D9C-B7E5-D7370EC609BE@gmail.com> Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On March 11, 2024 5:53:33 PM PDT, Dave Hansen w= rote: >On 3/11/24 16:56, Nadav Amit wrote: >> So you can look on the dirty-bit, which is not being set >> speculatively and save yourself one problem=2E >Define "set speculatively"=2E :) > >> If software on one logical processor writes to a page while software >> on another logical processor concurrently clears the R/W flag in the >> paging-structure entry that maps the page, execution on some >> processors may result in the entry=E2=80=99s dirty flag being set (due = to the >> write on the first logical processor) and the entry=E2=80=99s R/W flag = being >> clear (due to the update to the entry on the second logical >> processor)=2E > >In other words, you'll see both a fault *AND* the dirty bit=2E The write >never retired and the dirty bit is set=2E > >Does that count as being set speculatively? > >That's just the behavior that the SDM explicitly admits to=2E Indeed; both the A and D bits are by design permissive; that is, the hardw= are can set them at any time=2E The only guarantees are: 1=2E The hardware will not set the A bit on a not present late, nor the D = bit on a read only page=2E 2=2E *Provided that the user has invalidated the page entry in the TLB*, h= ardware guarantees the respective bits will be set before a dependent memor= y access is made visible=2E Thus the bits are guaranteed to reflect a stric= t superset of operations performed architecturally=2E