From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98708C433E7 for ; Wed, 14 Oct 2020 19:58:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3AA58206DC for ; Wed, 14 Oct 2020 19:58:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="dZ4P2/EN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728616AbgJNT62 (ORCPT ); Wed, 14 Oct 2020 15:58:28 -0400 Received: from mail.skyhub.de ([5.9.137.197]:57504 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgJNT61 (ORCPT ); Wed, 14 Oct 2020 15:58:27 -0400 Received: from zn.tnic (p200300ec2f0c4400a8a63b86eef17592.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:4400:a8a6:3b86:eef1:7592]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 7DFFB1EC0493; Wed, 14 Oct 2020 21:58:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1602705506; 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:in-reply-to:in-reply-to: references:references; bh=uVK0IVgQlEoTLJbQHod8IqvQSLETuGNRNz6XABf3VLk=; b=dZ4P2/ENBkzVR3E/jykivRdYFeSM0709RXOdeXsygIC/ruApxwjwwpAWUzsPzZSJZhIjNS GP7PCo1zI76n/GfLb4/0Hxtw/LYFXH/rk2j/4DIQDCf2Whxo1qupCW5EGY9cuPx/lHxkVw VO9yU79WqRRJVimHtXFamo/IqyNJbn4= Date: Wed, 14 Oct 2020 21:58:23 +0200 From: Borislav Petkov To: Andy Lutomirski Cc: Ankur Arora , LKML , Linux-MM , "Kirill A. Shutemov" , Michal Hocko , Boris Ostrovsky , Konrad Rzeszutek Wilk , Thomas Gleixner , Ingo Molnar , X86 ML , "H. Peter Anvin" , Arnd Bergmann , Andrew Morton , Ira Weiny , linux-arch Subject: Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached() Message-ID: <20201014195823.GC18196@zn.tnic> References: <20201014083300.19077-1-ankur.a.arora@oracle.com> <20201014083300.19077-6-ankur.a.arora@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 08:45:37AM -0700, Andy Lutomirski wrote: > 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. Why does it have to be a separate call? Why isn't it behind the clear_page() alternative machinery so that the proper function is selected at boot? IOW, why does a user of clear_page functionality need to know at all about an "uncached" variant? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette