Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp672375pxu; Wed, 14 Oct 2020 10:40:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR9jIDfCgprLQIt8DKTqrT+ussbllUN+LLmyYfcfSQnk9DBb7rfG2c8I55zogXdtpE6qX5 X-Received: by 2002:a17:906:3bc7:: with SMTP id v7mr121590ejf.245.1602697207681; Wed, 14 Oct 2020 10:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697207; cv=none; d=google.com; s=arc-20160816; b=IULZj9D6iOhh7FrvL0r1OQdFUIgpteXLna4YNZ8xamR+8gVMUjhEhKso/1UM6+dJfV 6hwTME1EhRDq5xFbyH6ybugnN4x+aYy4fzbfra6PSh8NO0EbSypqrz3qkr1KxT3UPtab bqiT1DFA9h6+FS/29BEDkidGGbciX3fGqPR4BDvLCs9uR0FWJO7DYElHX7wE6pHqqcc7 vsrcNk+cflX870my/UDK1tfl7dln1cft6WdD4CwrR1ERo9cATXctj344EZgtLxBWdY6K Qm1T4FYlIxA/MWucsNziCswEg16I1Vzmm0OLDh+9wy3AwH2VKXiZENNVI0QN2QpSqTnn tJog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RIIbg4Z9J+h28/OQNJlxJ76+osth/PAc2WHpdXSL//M=; b=LT+xSObG7hOiLm/npHRMD/v9HlnOgTzIhQXgMFkCGVtMXTidRWbJynYngvanyvrI9Q enJtOkDWAfUAtg0Lb1RzgD6HAOm3DNlWFbYBnkG3fScUADpbDswGlw0G4w0FH4JSssb6 GTyd1IAVXEhhYYp5dv6sX4JLbDzezI/4kPDxomRQunAaMRNRHkPxaHti1J1LOgsk/WwQ KzapoPXM/+7jOvA0uSBfiXwDNU+0HcUUlEtcWBfkyCg/7KnO4ThjZTnw2WZiiYdetCDB 7AGGs3XvbDXjKcoUpR/qTVe0yvNRaH87xjJMuoyspMkuAP7OuDyNZzSPkBQR8kcg1PRN L2rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nTgLQYcN; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si291593ejj.33.2020.10.14.10.39.45; Wed, 14 Oct 2020 10:40:07 -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=@kernel.org header.s=default header.b=nTgLQYcN; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730148AbgJNPpw (ORCPT + 99 others); Wed, 14 Oct 2020 11:45:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:46796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727566AbgJNPpw (ORCPT ); Wed, 14 Oct 2020 11:45:52 -0400 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 38A2E22244 for ; Wed, 14 Oct 2020 15:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602690351; bh=9lOn7d49hdMJPBAKNJlKjJFXwOCSJN+nr4aroBt0z8Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nTgLQYcNgiV4xvOcNFfqLSyoduB9LQwUmo1XmTF09eY04eNM9AZqsq/rx1nPTEgXD 0iuygi538DbVwzDItQUCEkVx9WpDUcIaZ4JnnDqp3LPu5Moe5o9SgIRXCOdoE+kwVc NbH+N+n9MrrXEuLLWikuOiwUuZjfMiIt+mAlH0BI= Received: by mail-wr1-f51.google.com with SMTP id h5so4436003wrv.7 for ; Wed, 14 Oct 2020 08:45:51 -0700 (PDT) X-Gm-Message-State: AOAM5321sordXzRYdMMFm2KTO609cIC+gyzCeReSrtbijQHHA/BJXaEt nqpCVO6n0oXU9aE4X2jCeVLM0V3SsUTyKOQPnzjpJg== X-Received: by 2002:a5d:6744:: with SMTP id l4mr6472625wrw.18.1602690349612; Wed, 14 Oct 2020 08:45:49 -0700 (PDT) MIME-Version: 1.0 References: <20201014083300.19077-1-ankur.a.arora@oracle.com> <20201014083300.19077-6-ankur.a.arora@oracle.com> In-Reply-To: <20201014083300.19077-6-ankur.a.arora@oracle.com> From: Andy Lutomirski Date: Wed, 14 Oct 2020 08:45:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached() To: Ankur Arora Cc: LKML , Linux-MM , "Kirill A. Shutemov" , Michal Hocko , Boris Ostrovsky , Konrad Rzeszutek Wilk , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Arnd Bergmann , Andrew Morton , Ira Weiny , linux-arch Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora wrote: > > Define clear_page_uncached() as an alternative_call() to clear_page_nt() > if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it > doesn't. > > Similarly define clear_page_uncached_flush() which provides an SFENCE > if the CPU sets X86_FEATURE_NT_GOOD. As long as you keep "NT" or "MOVNTI" in the names and keep functions in arch/x86, I think it's reasonable to expect that callers understand that MOVNTI has bizarre memory ordering rules. But once you give something a generic name like "clear_page_uncached" and stick it in generic code, I think the semantics should be more obvious. How about: clear_page_uncached_unordered() or clear_page_uncached_incoherent() and flush_after_clear_page_uncached() After all, a naive reader might expect "uncached" to imply "caches are off and this is coherent with everything". And the results of getting this wrong will be subtle and possibly hard-to-reproduce corruption. --Andy