Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3904673ybz; Mon, 4 May 2020 11:52:09 -0700 (PDT) X-Google-Smtp-Source: APiQypLcq+b4OWDDR+0JTiO6E5hbDSm+nOUZA7QxKo+In4MZekC7+z8SYxSo/RBci9DBTR9HNTul X-Received: by 2002:a50:d7d3:: with SMTP id m19mr16153728edj.285.1588618329426; Mon, 04 May 2020 11:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588618329; cv=none; d=google.com; s=arc-20160816; b=EYw97QK7bSlJui1ILrStjZoPiMq87z+ZqGM5xuZDn02IES8DtqElunwGnIZHt7yaHh o5Q6zMyWaAVqdeodi8FKOtczfVflr8sbYgCMpHDl9YgC/e1huxn9AwFISw7s89oopeIT be5unbRQH36xR/Guc99LkXjbfcymDeKwa19Hh60Ji2gI1hHvdke7mPIjxMZrCkfDHll6 pAX0d7hSQrzXSlVZALgR/Gosd9q8UIoLJJDZBSbzaIE6t8HrNRoC8LZriR9TTFJIiq3S YAiiX6WyB1NEGG2YUAuKIybqAFRmU3XXIx9cIHndu1bVkLe9jKWYl8gKO5iEDxrKUTYo UmiA== 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=Glau+s6Q6iM76mHi/QXePg8xF2snTXD5otz87ESSu8A=; b=wsDKNN/n66Sii4ewYeyWBG0RQ2QB+inxZRTFkK7G58LeumY/KPACsce3hiS9zKq0gc b5gLbjhjpUiR07yfQk7sjwPrUNBJzli4p/tiaj7TV8hT6/pNKtGTUdaZ/MWE7NgsoQHi RIJdEot530GCaNstuZdcv2UcNWiV5v942vCferTiD+Jep/YWgDkeLSnPtxJQo1E9PafE KVK7luNjyrO7+yPSWfLlu+kh9ALKJiGCHgBpEEDIwOR3hdj6R5UPtIPW+6gPGHqyP12e hcei968LqJXtUr8gyiytHgTnqgfM0oiPcpnjh0stdzPD58AtEL3yj8JUmcs6uhfa48Ao MlJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=F+2NEE8n; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 34si7194519edc.238.2020.05.04.11.51.46; Mon, 04 May 2020 11:52:09 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=F+2NEE8n; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730592AbgEDSd7 (ORCPT + 99 others); Mon, 4 May 2020 14:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729762AbgEDSd7 (ORCPT ); Mon, 4 May 2020 14:33:59 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC82DC061A0E for ; Mon, 4 May 2020 11:33:58 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id b20so3104603ejg.11 for ; Mon, 04 May 2020 11:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Glau+s6Q6iM76mHi/QXePg8xF2snTXD5otz87ESSu8A=; b=F+2NEE8n0+6a2Uxkq3oo+gK/iDs1gXhBaBtJu3It7O83YXrMkKTw/j5R5KqU4cLb1I vlOYdG8d6H2sSQjfFpkieMLY+KM5edr1MbbCXsj+B9wkYlXKMNdfSGw1CJFXf7fx5Q7C nLx7CYq5rjomyrqgHsVmp6vku6f3HeDmYZpPHsh7ka8b5Df1pXeivwm1iUG0Tio8BF4o ZS585n3JOtRJMk45ZcupX+D3R94fYlWZsYjSr5wbogW/u9eqdMEat4pDnASo56oFKvzS 7tnb7wc1b4OhUfvjaDeX366gFmfgoP2fFKltlwAvd8N31RZXbHNtbqksmP+ogCEDB/JL SgwA== 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=Glau+s6Q6iM76mHi/QXePg8xF2snTXD5otz87ESSu8A=; b=pjeQnXMlqFlHksMlBi6DAg+CFtuWeOLT3j6SBPLMQKhTjbhW0BcfyJbXAscCRD0sDV wkc56fxUJxH02mTzy4QHh0ZcIiueBbSSfrCFuVeaAEWatJjEGRbGmSwISIrFHLqsegER 5UlSEz5o6jyQmw65jvA1pU4NB30ebyhX3dAmUf2vsHN6MCUf7QeAQunUdUKpuqrwYPT0 S6qIPoizNVl3BS6h3AlB6IOxgsAlBEjrtyNiiLhXkf5twO05eXotDwhhiNzrMbl7nELa PG463/txh9itNifxA0+ortFadMyJ4+auVvdxOca1pFsCEhRGvgdIuu1tfQXG6M/CeO8O uNJg== X-Gm-Message-State: AGi0Pub0HZPEmNK75tK9ea3JSyRGRfKpf6VjnPTPuqLOiRk5JeSeYz+W 242qAfdAw1nzIxPOlgwuk35WkM87DKTXeiqT631ADA== X-Received: by 2002:a17:907:9e5:: with SMTP id ce5mr15759967ejc.123.1588617237480; Mon, 04 May 2020 11:33:57 -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: Dan Williams Date: Mon, 4 May 2020 11:33:46 -0700 Message-ID: Subject: Re: [PATCH v2 0/2] Replace and improve "mcsafe" with copy_safe() To: David Laight Cc: Linus Torvalds , "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 Sun, May 3, 2020 at 5:57 AM David Laight wrote: > > From: Linus Torvalds > > Sent: 01 May 2020 19:29 > ... > > And as DavidL pointed out - if you ever have "iomem" as a source or > > destination, you need yet another case. Not because they can take > > another kind of fault (although on some platforms you have the machine > > checks for that too), but because they have *very* different > > performance profiles (and the ERMS "rep movsb" sucks baby donkeys > > through a straw). > > > I was actually thinking that the nvdimm accesses need to be treated > much more like (cached) memory mapped io space than normal system > memory. > So treating them the same as "iomem" and then having access functions > that report access failures (which the current readq() doesn't) > might make sense. While I agree that something like copy_mc_iomem_to_{user,kernel} could have users, nvdimm is not one of them. > If you are using memory that 'might fail' for kernel code or data > you really get what you deserve. nvdimms are no less "might fail" than DRAM, recall that some nvdimms are just DRAM with a platform promise that their contents are battery backed. > OTOH system response to PCIe errors is currently rather problematic. > Mostly reads time out and return ~0u. > This can be checked for and, if possibly valid, a second location read. Yes, the ambiguous ~0u return needs careful handling.