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=-0.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A89EAC4724C for ; Fri, 1 May 2020 00:17:00 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 26032208CA for ; Fri, 1 May 2020 00:16:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="ai0nRHdn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26032208CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F35691120134F; Thu, 30 Apr 2020 17:15:45 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::543; helo=mail-ed1-x543.google.com; envelope-from=torvalds@linuxfoundation.org; receiver= Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D80D8111BB865 for ; Thu, 30 Apr 2020 17:15:42 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id w2so6061781edx.4 for ; Thu, 30 Apr 2020 17:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IoAo79puf2fO2mxYjsnwa0bT+GJNCk2Wz2oE7jO1rZ0=; b=ai0nRHdnq5PKYZRE4Z2psZB8iAlRJQyyqODMZ0nZ/DvoxHUsUwQzU8YQzu1X4Wx3LB JBOdF8w1/Rq47Fp1oFb/63W9FrWFZJqfsOg0ikYPduy2VqtDflbRRqwIgmsAZQVQN8mO q9iAMISU0a7Og9lwvy9aWj32014T1C4JkTWFw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IoAo79puf2fO2mxYjsnwa0bT+GJNCk2Wz2oE7jO1rZ0=; b=Prgml9PwgZAvZNoaz/D6brsm0vjUQG8qeSWLc8f5bSasaZfucShq0uHdfRu2d5dww1 29bCSGJ1EZkhc1vnmDJ223llwHHGKBbjQMC784reXc08VIEuC8ou4mk0QNWldlKkZ0T0 iGn7KtZvaHIyzINb2382gx3KUGNu9jgC1RDdDHRnG7+jmT8FhAZ6nhMmXMdGyk+SiJhs wZaDL/w5U50Sxw3/iwNtOv7dwMyI/m3KNQt3YiQiWSK+XbYkpPI6Dy2GA3CxrR5fjUy5 sRPAILd/y7yfUvbkoBclkf/JWdegx4b8NJ4AM5/fVOd0snlumTBtrZl0Mg82n4a7LK7Z z4tQ== X-Gm-Message-State: AGi0PuYw6jhlzF6RFdJzjvlJ4j54gy5ZfUPHE5JL7IBiTiJuESueGKuP LMKs7iYsfI7BnTfKpFQ8fUtugklSV5U= X-Google-Smtp-Source: APiQypIy5MjUmqGiSJCte+SGQBcUnuCE7YVVS+v8+6D3iCw42r6ucvK4IzLfOy6tQjeAt4kNP9m+4g== X-Received: by 2002:a50:eb8e:: with SMTP id y14mr1461425edr.270.1588292214003; Thu, 30 Apr 2020 17:16:54 -0700 (PDT) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com. [209.85.208.44]) by smtp.gmail.com with ESMTPSA id p4sm66220edm.68.2020.04.30.17.16.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 17:16:53 -0700 (PDT) Received: by mail-ed1-f44.google.com with SMTP id t12so6074764edw.3 for ; Thu, 30 Apr 2020 17:16:53 -0700 (PDT) X-Received: by 2002:a2e:3017:: with SMTP id w23mr887763ljw.150.1588291831360; Thu, 30 Apr 2020 17:10:31 -0700 (PDT) MIME-Version: 1.0 References: <158823509800.2094061.9683997333958344535.stgit@dwillia2-desk3.amr.corp.intel.com> <20200430192258.GA24749@agluck-desk2.amr.corp.intel.com> In-Reply-To: From: Linus Torvalds Date: Thu, 30 Apr 2020 17:10:15 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() To: Dan Williams Message-ID-Hash: 5CSTKEXSINLSX6G4NDUW464ZPO4QMBTD X-Message-ID-Hash: 5CSTKEXSINLSX6G4NDUW464ZPO4QMBTD X-MailFrom: torvalds@linuxfoundation.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: "Luck, Tony" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Borislav Petkov , stable , the arch/x86 maintainers , "H. Peter Anvin" , Paul Mackerras , Benjamin Herrenschmidt , Erwin Tsaur , Michael Ellerman , Arnaldo Carvalho de Melo , linux-nvdimm , Linux Kernel Mailing List X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Apr 30, 2020 at 4:52 PM Dan Williams wrote: > > You had me until here. Up to this point I was grokking that Andy's > "_fallible" suggestion does help explain better than "_safe", because > the copy is doing extra safety checks. copy_to_user() and > copy_to_user_fallible() mean *something* where copy_to_user_safe() > does not. It's a horrible word, btw. The word doesn't actually mean what Andy means it to mean. "fallible" means "can make mistakes", not "can fault". So "fallible" is a horrible name. But anyway, I don't hate something like "copy_to_user_fallible()" conceptually. The naming needs to be fixed, in that "user" can always take a fault, so it's the _source_ that can fault, not the "user" part. It was the "copy_safe()" model that I find unacceptable, that uses _one_ name for what is at the very least *four* different operations: - copy from faulting memory to user - copy from faulting memory to kernel - copy from kernel to faulting memory - copy within faulting memory No way can you do that with one single function. A kernel address and a user address may literally have the exact same bit representation. So the user vs kernel distinction _has_ to be in the name. The "kernel vs faulting" doesn't necessarily have to be there from an implementation standpoint, but it *should* be there, because - it might affect implemmentation - but even if it DOESN'T affect implementation, it should be separate just from the standpoint of being self-documenting code. > However you lose me on this "broken nvdimm semantics" contention. > There is nothing nvdimm-hardware specific about the copy_safe() > implementation, zero, nada, nothing new to the error model that DRAM > did not also inflict on the Linux implementation. Ok, so good. Let's kill this all, and just use memcpy(), and copy_to_user(). Just make sure that the nvdimm code doesn't use invalid kernel addresses or other broken poisoning. Problem solved. You can't have it both ways. Either memcpy just works, or it doesn't. So which way is it? Linus _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org