Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754137AbbLKVTU (ORCPT ); Fri, 11 Dec 2015 16:19:20 -0500 Received: from mga03.intel.com ([134.134.136.65]:11150 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752753AbbLKVTS (ORCPT ); Fri, 11 Dec 2015 16:19:18 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,415,1444719600"; d="scan'208";a="839483246" From: "Luck, Tony" To: Andy Lutomirski CC: Ingo Molnar , Borislav Petkov , "Andrew Morton" , Andy Lutomirski , "Williams, Dan J" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , linux-nvdimm , X86 ML Subject: RE: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Thread-Topic: [PATCHV2 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Thread-Index: AQHRNE/aOhVlt+R/OUCiyPbQy9P3LZ7GRdgw Date: Fri, 11 Dec 2015 21:19:17 +0000 Message-ID: <3908561D78D1C84285E8C5FCA982C28F39F82D87@ORSMSX114.amr.corp.intel.com> References: <23b2515da9d06b198044ad83ca0a15ba38c24e6e.1449861203.git.tony.luck@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsIiwiaWQiOiI2ODAwMmFkNi03ZjhlLTQ3ODQtOGY3Mi01MDE3NGJjYTcyMjYiLCJwcm9wcyI6W3sibiI6IkludGVsRGF0YUNsYXNzaWZpY2F0aW9uIiwidmFscyI6W3sidmFsdWUiOiJDVFBfSUMifV19XX0sIlN1YmplY3RMYWJlbHMiOltdLCJUTUNWZXJzaW9uIjoiMTUuNC4xMC4xOSIsIlRydXN0ZWRMYWJlbEhhc2giOiJyYUNjT3VcL0FKQmgwVGZVYURXVkFReXJyK0lqNVpKMWVJdW9wbUdHTVFlOD0ifQ== x-inteldataclassification: CTP_IC x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tBBLJNvX013641 Content-Length: 1219 Lines: 33 > I still don't get the BIT(63) thing. Can you explain it? It will be more obvious when I get around to writing copy_from_user(). Then we will have a function that can take page faults if there are pages that are not present. If the page faults can't be fixed we have a -EFAULT condition. We can also take machine checks if we reads from a location with an uncorrected error. We need to distinguish these two cases because the action we take is different. For the unresolved page fault we already have the ABI that the copy_to/from_user() functions return zero for success, and a non-zero return is the number of not-copied bytes. So for my new case I'm setting bit63 ... this is never going to be set for a failed page fault. copy_from_user() conceptually will look like this: int copy_from_user(void *to, void *from, unsigned long n) { u64 ret = mcsafe_memcpy(to, from, n); if (COPY_HAD_MCHECK(r)) { if (memory_failure(COPY_MCHECK_PADDR(ret) >> PAGE_SIZE, ...)) force_sig(SIGBUS, current); return something; } else return ret; } -Tony ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?