Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp107354ybz; Thu, 30 Apr 2020 17:27:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLY7829V7+Q+4dkfa3hpe2/4uYU9qoQwTATxFg6OSS1U/zXSQflAQ2RNHQuCLMfiq6S1IQ/ X-Received: by 2002:a17:906:49d0:: with SMTP id w16mr1010182ejv.364.1588292869789; Thu, 30 Apr 2020 17:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588292869; cv=none; d=google.com; s=arc-20160816; b=P3WHMpHruT9j1NqPqUGGlZ1fkUfF2vU4Q6hlzN+eGQvAE1fcHlASssOolVkul5tCrI XlOlVTUg6d9xRlX4hohGThEmuHH46jKlKHLHHEUUUbrldB/guPrfl7lZ0g413pM7g1sf Vl6JPC/0a4jP/VJjKY8iMu7r0fmlFodCP/53Y1zDpZLFMRCB0dQlSJOEHV0pmPIxvmeE SdK2oR4FR7/omoXZWwvVWfjHQxlNfhKcu3AguawupW5cbV0kNfrH0auhX8bQbrAWWYzN 33mzcxFT4yZMdc/SCNxXVZLe6y/5h0dkjCd8Bk2oZYHjaBK8SLLUKPpBmIuQ+351jbgb YGpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=VDf2N8mBL2qJb74S4ITCK9fAPPmUAgvoerWrh8dXt4o=; b=uj0BwYUdi1B54EYYbuNFn3WHhqocXtOKHWOZyHEABcC1InmbSClOhOrqJZYq03p3U2 Q1PsdxxJUXVGzFyWaUbp52XSUigUqeeG9YYUZ0pp2s5w1OZopfbYu47XPPZ6CoKsoKYY 9d6ghWesmqi7I1WLsYZG/QpQZ0FUOp9Hrzrd0UKc+54Um/Tfp7qfiGJgQPNPqH863W7f lwGXDkc5U3TZSKotl3bCaP8yXVb4lzI2K80GNmZ2lJ0tNJayMYUY/gnk25f09SozR2qG ti98hbBSqpjhOWVsTn0GS7nK64yLXy/qq9zmiyPsOOyR9bdAspxNBjHmNcPEMe9tupAC BgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Mreruorx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si808013edg.77.2020.04.30.17.27.26; Thu, 30 Apr 2020 17:27:49 -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=@linux-foundation.org header.s=google header.b=Mreruorx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727949AbgEAAZJ (ORCPT + 99 others); Thu, 30 Apr 2020 20:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726545AbgEAAZI (ORCPT ); Thu, 30 Apr 2020 20:25:08 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDB8C035495 for ; Thu, 30 Apr 2020 17:25:08 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id u10so2773987lfo.8 for ; Thu, 30 Apr 2020 17:25:08 -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=VDf2N8mBL2qJb74S4ITCK9fAPPmUAgvoerWrh8dXt4o=; b=MreruorxVqBBm3pLqSig9B5BAdyGIXSOxD6BJt2oKVTHUb1/8Whm8gIpcX16l58lSv QPNB29r7LEHIVU4GCCsv3CKa2gCOu0ExTOuE3vO1blHXWjouvTt8wvZBkUIdShaFwHPi GYDLjgWlY3m6y8KprJDmZNXjTI5GXeXGOTUNA= 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=VDf2N8mBL2qJb74S4ITCK9fAPPmUAgvoerWrh8dXt4o=; b=mw1hGCk0Zjsd8NDLxLoONMCqbeGhSB/Qj3DIh23126LaZUinAzRdDDEqPETe5BuoGv P/i5O1D86RsfK6Y5BnHMO5tr8V+HDVX+2iusyoouRnoIHFz0yivGfRvIlNwyMIz8xmAT ++r/9pnVpe6/IskAbwvzajm5KxUcI8LytcUwDKKjS05cygBCCg2jeaOaC5RHgAEw+DLq NM9jDd3BQaPo5J4AnHO402urob7kr8Bn4+Rwx/4bzCyU1QXw3envD9TzBCYO43thMgZS EdrWwEzkwxin/EISQlsVs05UbdieZP/wxZm1guMzMZ6Yfo6kX/T1cGci1jd0ygtqsmH0 dCjQ== X-Gm-Message-State: AGi0PubISiO6Q/ZSSdZuGOvxeCrEq+pHyoCqYZbKZek02//feDiNeJxE 1+mcGA5HBsvoTo4hj3H3xw7VJzwnUi8= X-Received: by 2002:a19:2286:: with SMTP id i128mr781714lfi.109.1588292706924; Thu, 30 Apr 2020 17:25:06 -0700 (PDT) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id o22sm892392ljj.100.2020.04.30.17.25.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Apr 2020 17:25:06 -0700 (PDT) Received: by mail-lf1-f52.google.com with SMTP id l11so2777640lfc.5 for ; Thu, 30 Apr 2020 17:25:06 -0700 (PDT) X-Received: by 2002:ac2:4da1:: with SMTP id h1mr783565lfe.152.1588292705876; Thu, 30 Apr 2020 17:25:05 -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:24:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() To: Dan Williams 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 5:10 PM Linus Torvalds wrote: > > 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". Btw, on naming: the name should be about _why_ it can fault, not about whether it faults. Which hasn't been explained to me. I know why user accesses can fault. I still don't know why these new accesses can fault. I know of the old name (mcs), but the newly suggested name (safe) is the _opposite_ of an explanation of why it faults. Naming - like comments - shouldn't be about what some implementation is, but about the concept. Again, let me use that "copy_to_user()" as an example of this. Yes, it can fault. Notice how the name doesn't say "copy_to_faulting()". That would be WRONG. It can fault _because_ it is user memory, so "copy_to_user()" not only describes what it does, but it also implicitly describes that it can fault. THAT is the kind of explanation I'm looking for. The "memcpy_mcsafe()" at least had _some_ of that in it. It was wrong for all the _other_ reasons (not having a direction, and the hardware just being complete and utter garbage), but at least there was a reason in the name. I am not interested in adding new infrastructure that cannot even be explained. Why would writes ever fault, considering they are posted (and again, "user space" is not a valid reason, we have that case already and have had it since day #1 even if the original naming was the same kind of bad implementation-specific name that "mcsafe" was). If the ONLY reason for the fault is a machine check, then the name should say so, and "copy_mc_to_user()" would be a perfectly fine name (along with copy_to_mc(), copy_from_mc(), and copy_in_mc()). It wasn't clear how "copy_to_mc()" could ever fault. Poisoning after-the-fact? Why would that be preferable to just mapping a dummy page? But even if it cannot fault, I can see that you might want to do it as a special kind of copy to avoid any read-mask-write artifacts (which can definitely happen on other architectures, and I could see a manual memcpy() implementation doing even on x86) Linus