Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp969796ybk; Fri, 15 May 2020 19:37:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDB0LKRsKfj1baEQdgY4o1wf7hsJjKIrA0JqOk2lpf9DPb0FQsoJJaegEMyvigX/yXuIzk X-Received: by 2002:a17:906:560b:: with SMTP id f11mr5329072ejq.264.1589596648931; Fri, 15 May 2020 19:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589596648; cv=none; d=google.com; s=arc-20160816; b=d0WtE2e6U00Mer8U477NHyhmQGWmMPKwzCToRqOA2rFB+eRsX/eAOCPg9Bsbo1ZXVd dUDkPE6ZASWF637eOxo2hlwl4sX8HP8dYetoROIIWkSzkaaPXvsUteN++MfUvLr4xU7e Ho0qvN66Cc9XflrgfhnXt5uCImDQW6ZuRCCsme1X8i8aHaMMEyGj7qP1ZKC+rBZbTiop d4+QJDzyrDc9Uvka5na/k0IKDvF/TfzJG0FzhYMLlNf1+BISQA9nc9FCENfOoPEn6VUF 39WOoO+QGzC3QqLwy1HZ03orxSwIEq828euaxxEu184h6v7bvNjuocPqCaU6calEntDo A8sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=n6/B7X0c/MJGcAtgpNhnYCDkJASTFIqMvt0ANlimUis=; b=n35DqEVOmta2nf9fSfelkoR4Yeqss9MQOo6RMTs/G0FpFTJMy/6t9zc2ByZCwz2JPn 6vFRdZnDH3OtV6ouLOtu/ZZxTGXpiiR2QHis6CcFnNrnlie35ckLxqjRDeKXc9wl+j++ jvF1RpumV7ZyavGyxU7asy8IgZ79k9rJbiFelEWYk7LknDV0+2sSNx9Mj6Wkftvv5KHd lwDMPc6LMqcHqoDk/yNtWVhZUZXb6kC8zwlD1hN5aeJA/kxs2VD4k6dJ6wnz8TRLwdqC pkR5raoioYSbR/fr3rzuztq+bo+4e+7UNZH+wY9ocZCOnhxWctS1G0tiCO5peWy5l/5N BL8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mt7OFWfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si2339091edv.378.2020.05.15.19.37.05; Fri, 15 May 2020 19:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mt7OFWfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727801AbgEPCf2 (ORCPT + 99 others); Fri, 15 May 2020 22:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726247AbgEPCf1 (ORCPT ); Fri, 15 May 2020 22:35:27 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C4E1C061A0C for ; Fri, 15 May 2020 19:35:26 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id r10so1880037pgv.8 for ; Fri, 15 May 2020 19:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=n6/B7X0c/MJGcAtgpNhnYCDkJASTFIqMvt0ANlimUis=; b=Mt7OFWfTf/gPlx8Zs6Kq8r47RUGofk6FH4o7Be8RH2BpGbAh0z2BY4q8TGJzrtsXpd Nzw1/WWxWQNWSeqgzjVwx+ZHAteqemUPtlrTSEMzeAXT37RKMn4Dv0LX6V8+FJ0xwjBZ ZHX7ZnmQ1nGvb4t5ECZXVMGp7+OeQjldaRzujMNAo/n7gddY417c+guEgegy7esZV6LW n392yRJVq0/u8/7HNucaWwB9N3S3YrV2Qy66l9KPBNN5w0MP2kOU60AXZ1/34Jx2Lxk2 GAHupHWVw9Oq578QtAMXyQfK5nUjTBYXtW8RxeGol8DAI4JGaiGGFB+2Ge3ZgsYbcsfQ DrAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=n6/B7X0c/MJGcAtgpNhnYCDkJASTFIqMvt0ANlimUis=; b=iSVp+KhpM2NaWM4R4zx5dyXKz/rLr2h8qz873RMgibs3oxpJcrzfkom4yqcMUVLp3F 2maTJdYz8jv8X2KtyGZ81jwbXZS8UFyOMaficOPeUh7j0UvQvhvstRcLcNdZPWaQPVim 2QRpD8uL95Fbwo5r5j6s/lp7gucdVJihVrEiENaqceJzWAuPpbmzYjvck3a7BpL+uOfb +jNu8GE2S/25I9EKt5miN0yRGsDhUOg92YMXdE9gGwotmuF5PCOsekQ9iPskgC+Dabob ExBadQZUYDkvp+jrngoIQ/ijBVxbFavbvigdCt2Ez16MfEslipKTG6ldKMOxYwpokvVA e9NQ== X-Gm-Message-State: AOAM532i5gklE1W9xbLd6V39ZJJH7s7UP73Md2/Y3SweoAMgsVZmhGBB WUE1gp84o50EU9fhtDEmBgyh994t X-Received: by 2002:aa7:9148:: with SMTP id 8mr7124000pfi.154.1589596525486; Fri, 15 May 2020 19:35:25 -0700 (PDT) Received: from localhost ([61.68.67.54]) by smtp.gmail.com with ESMTPSA id w69sm3090910pff.168.2020.05.15.19.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2020 19:35:24 -0700 (PDT) Date: Sat, 16 May 2020 12:35:18 +1000 From: Nicholas Piggin Subject: Re: Possibility of conflicting memory types in lazier TLB mode? To: Rik van Riel Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , x86@kernel.org References: <1589523957.s4pf3vd48l.astroid@bobo.none> <3b217554a8a337de544482d20ddf8f2152559cd3.camel@surriel.com> In-Reply-To: <3b217554a8a337de544482d20ddf8f2152559cd3.camel@surriel.com> MIME-Version: 1.0 Message-Id: <1589595735.4zyv4epfsj.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Rik van Riel's message of May 16, 2020 5:24 am: > On Fri, 2020-05-15 at 16:50 +1000, Nicholas Piggin wrote: >>=20 >> But what about if there are (real, not speculative) stores in the >> store=20 >> queue still on the lazy thread from when it was switched, that have >> not=20 >> yet become coherent? The page is freed by another CPU and reallocated >> for something that maps it as nocache. Do you have a coherency >> problem=20 >> there? >>=20 >> Ensuring the store queue is drained when switching to lazy seems like >> it=20 >> would fix it, maybe context switch code does that already or you >> have=20 >> some other trick or reason it's not a problem. Am I way off base >> here? >=20 > On x86, all stores become visible in-order globally. >=20 > I suspect that > means any pending stores in the queue > would become visible to the rest of the system before > the store to the "current" cpu-local variable, as > well as other writes from the context switch code > become visible to the rest of the system. >=20 > Is that too naive a way of preventing the scenario you > describe? >=20 > What am I overlooking? I'm concerned if the physical address gets mapped with different=20 cacheability attributes where that ordering is not enforced by cache=20 coherency "The PAT allows any memory type to be specified in the page tables, and=20 therefore it is possible to have a single physical page mapped to two=20 or more different linear addresses, each with different memory types.=20 Intel does not support this practice because it may lead to undefined=20 operations that can result in a system failure. In particular, a WC=20 page must never be aliased to a cacheable page because WC writes may=20 not check the processor caches." -- Vol. 3A 11-35 Maybe I'm over thinking it, and this would never happen anyway because=20 if anyone were to map a RAM page WC, they might always have to ensure=20 all processor caches are flushed first anyway so perhaps this is just a=20 non-issue? Thanks, Nick