From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot0-x243.google.com (mail-ot0-x243.google.com [IPv6:2607:f8b0:4003:c0f::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 50140203BB531 for ; Tue, 1 May 2018 22:37:48 -0700 (PDT) Received: by mail-ot0-x243.google.com with SMTP id 77-v6so15230289otd.4 for ; Tue, 01 May 2018 22:37:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <152520750404.36522.15462513519590065300.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Tue, 1 May 2018 22:37:47 -0700 Message-ID: Subject: Re: [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter() List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Linus Torvalds Cc: Tony Luck , "linux-nvdimm@lists.01.org" , Peter Zijlstra , the arch/x86 maintainers , Linux Kernel Mailing List , Andy Lutomirski , Ingo Molnar , Borislav Petkov , Al Viro , Thomas Gleixner , Andrew Morton List-ID: On Tue, May 1, 2018 at 9:14 PM, Linus Torvalds wrote: > On Tue, May 1, 2018 at 9:00 PM Dan Williams > wrote: >> > >> > I have some dim memory of "rep movs doesn't work well for pmem", but > does >> > it *seriously* need unrolling to cacheline boundaries? And if it does, > who >> > designed it, and why is anybody using it? >> > > >> I think this is an FAQ from the original submission, in fact some guy >> named "Linus Torvalds" asked [1]: > > Oh, I already mentioned that I remembered that "rep movs" didn't work well. > > But there's a big gap between "just use 'rep movs' and 'do some cacheline > unrollong'". > > Why isn't it just doing a simple word-at-a-time loop and letting the CPU do > the unrolling that it will already do on its own? > > I may have gotten that answered too, but there's no comment in the code > about why it's such a disgusting mess, so I've long since forgotten _why_ > it's such a disgusting mess. > > That loop unrolling _used_ to be "hey, it's simple". > > Now it's "Hey, that's truly disgusting", with the separate fault handling > for every single case in the unrolled loop. > > Just look at the nasty _ASM_EXTABLE_FAULT() uses and those E_cache_x error > labels, and getting the number rof bytes copied right. > > And then ask yourself "what if we didn't unroll that thing 8 times, AND WE > COULD GET RID OF ALL OF THOSE?" > > Maybe you already did ask yourself. But I'm asking because it sure isn't > explained in the code. Ah, sorry. Yeah, I don't see a good reason to keep the unrolling. It would definitely clean up the fault handling, I'll respin. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751148AbeEBFhv (ORCPT ); Wed, 2 May 2018 01:37:51 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:40250 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751115AbeEBFhs (ORCPT ); Wed, 2 May 2018 01:37:48 -0400 X-Google-Smtp-Source: AB8JxZp9MquNPGwQiB41DoGg8fgqen6Iakha9o4ZYOp99aQ8wA2vArqIWBLkAN+Pi/0fq/E1sw9VWUJOjPj2yJWDjqo= MIME-Version: 1.0 In-Reply-To: References: <152520750404.36522.15462513519590065300.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Tue, 1 May 2018 22:37:47 -0700 Message-ID: Subject: Re: [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter() To: Linus Torvalds Cc: "linux-nvdimm@lists.01.org" , Tony Luck , Peter Zijlstra , Borislav Petkov , "the arch/x86 maintainers" , Thomas Gleixner , Andy Lutomirski , Ingo Molnar , Al Viro , Andrew Morton , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 1, 2018 at 9:14 PM, Linus Torvalds wrote: > On Tue, May 1, 2018 at 9:00 PM Dan Williams > wrote: >> > >> > I have some dim memory of "rep movs doesn't work well for pmem", but > does >> > it *seriously* need unrolling to cacheline boundaries? And if it does, > who >> > designed it, and why is anybody using it? >> > > >> I think this is an FAQ from the original submission, in fact some guy >> named "Linus Torvalds" asked [1]: > > Oh, I already mentioned that I remembered that "rep movs" didn't work well. > > But there's a big gap between "just use 'rep movs' and 'do some cacheline > unrollong'". > > Why isn't it just doing a simple word-at-a-time loop and letting the CPU do > the unrolling that it will already do on its own? > > I may have gotten that answered too, but there's no comment in the code > about why it's such a disgusting mess, so I've long since forgotten _why_ > it's such a disgusting mess. > > That loop unrolling _used_ to be "hey, it's simple". > > Now it's "Hey, that's truly disgusting", with the separate fault handling > for every single case in the unrolled loop. > > Just look at the nasty _ASM_EXTABLE_FAULT() uses and those E_cache_x error > labels, and getting the number rof bytes copied right. > > And then ask yourself "what if we didn't unroll that thing 8 times, AND WE > COULD GET RID OF ALL OF THOSE?" > > Maybe you already did ask yourself. But I'm asking because it sure isn't > explained in the code. Ah, sorry. Yeah, I don't see a good reason to keep the unrolling. It would definitely clean up the fault handling, I'll respin.