Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp42201pxk; Tue, 22 Sep 2020 18:02:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz76wiS8mPu9+XGjszok1BRHFwoIfxFxij8EVDT4G4MAAV7Y9zGCS+fJpu2oBdOJRmd5DjU X-Received: by 2002:a50:fc0b:: with SMTP id i11mr6913125edr.164.1600822928042; Tue, 22 Sep 2020 18:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600822928; cv=none; d=google.com; s=arc-20160816; b=DrdQNSJeOx9J2b6i7bW/Q72HIqPtOXn/O7PS9I5E5MeN3Cjaq70v/WMbHLlJlxPOjW PuX9Mgbs8KxjJsnuAXkXBpokB0hui8FZsomy6aIoeFEf4VyY3PhZCFa0fGg93d2afJTK nbhVGPob/t1in2tNFvbyY8A3jub9/3DwrKiMdkmzqF6UDnCs9neYyHDRh/XK0wCMgeLA QhMhYjiLUuEeZaSsDpWTRwow5rt4Z8NO3VVG+qBJc2WFMu5n2NB1dJnD0v7J/KyoaffJ 3W8KDbkpdcsE2wxFdOK0k6OFOgZeHDhiL4UNLGCNa9Zua45o4C5bK1/kawl8x9HOPg6+ //2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mVimv4F4pEyqaeD0LO4zdEDOLVsHvqmHuDl7JJ50ulQ=; b=sX8LllrJrdBoFzf4XH5fzk0e4mHSRH2x/MSDnWEve+/Dv504MFcLCFf3fnhgv/yWzX 5+jQtge9F9uBjQ5R+WbOVc0h6kFIe0K6MPsVIG1zUhl9csWU34UegOPWci8JXhhUq4nD KJySG6+PXqhWuzrKBKaxFUHczqJUmurl+AbIBs0+Ipe8qhcbk/3iVirebVcJBwRRsgqW sxt0WAHQKUIKay+MZrV5SottbfEI952SmymcOklr7CWIU75zB5sZHmzBb8KHRMmA+W6u ySbIpHcd5mViCqru88jJ5hU7g7lFKfONAcA0fMj7tYcF1jIACT5jlZR3Qg5NychI0++x benw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=egeCKs17; 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 l23si11857767ejn.7.2020.09.22.18.01.44; Tue, 22 Sep 2020 18:02:08 -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=egeCKs17; 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 S1727093AbgIWA04 (ORCPT + 99 others); Tue, 22 Sep 2020 20:26:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbgIWA0z (ORCPT ); Tue, 22 Sep 2020 20:26:55 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E535C0613D0 for ; Tue, 22 Sep 2020 17:26:55 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id e23so25350963eja.3 for ; Tue, 22 Sep 2020 17:26:55 -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=mVimv4F4pEyqaeD0LO4zdEDOLVsHvqmHuDl7JJ50ulQ=; b=egeCKs17gt8CwPK7u6srOHG8/XtUaR57acvx0TxFQN4OgfTewTTwNVhJ3xelSuchN5 dH/v0TdAhVjm1OyK8YI/T1+nqHAvQGirk70/PXrjkrdJstF0zEVxO5EnN1TxNqfCZaIs sVFUFHg41vJCFF8sHTLjyTKmBQc6j+DXLyARf1yKv3ipC/84wjQsbZkM+FPiwArDH8cJ bKSG7LvIosF6KjiHPL5OTU7DIEfS5cCFKMjLfJ3X4RvlJz61N2TQQVaxEsdJ9C8UZ2Ss 6EcJmIO8EzYqFXjqs1VH/T6FFOBJAM/zJ/HxZwB4JnNx4mM4AmtxRYYLWa/cjUZee6+T Cwfg== 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=mVimv4F4pEyqaeD0LO4zdEDOLVsHvqmHuDl7JJ50ulQ=; b=Ixow5R7cHolasalfT6sYPd61uwt0FV2YfHQNr+Hcum7KBEwO2o9MmITbbvnf9A8sUP IIY7CpNTIVMICrODOVEh4Lb5eZjNySWQcp23f6ZDRdMCfAPFB3+JeCfbI8LHdGlI8vb7 pCJck6+ddkCqkrCDzSd8wCZVmTicXKNdBHZAbEcFsHGUWkRDZCyKoaiDDdXOJkvvFDrf mfnXx6VTpbhq/EMG/jsUbmdX0B9qhYCIe7+vB3qor8+vH1Dm34sYtHc9xy/vF/hCbnj4 6VOF/1AJGx7+OSJw/DywYPLvzulgAuoO/52Ok+kGSOrTJ85iNo/wcCpGf+cXrdrjBPKp vXvg== X-Gm-Message-State: AOAM530Cmth/wHjcUT+ypYIyRu78v4OdOvdOc3cxJTLFRq71fpXpe8hg kt07eyntt6S+ej62XsfkJNzm8unV6hrvFc+8gAk2+g== X-Received: by 2002:a17:906:2354:: with SMTP id m20mr7460553eja.341.1600820812915; Tue, 22 Sep 2020 17:26:52 -0700 (PDT) MIME-Version: 1.0 References: <159630256804.3143511.8894023468833792004.stgit@dwillia2-desk3.amr.corp.intel.com> <20200803094257.GA23458@shao2-debian> <20200806133452.GA2077191@gmail.com> <20200806153500.GC2131635@gmail.com> In-Reply-To: <20200806153500.GC2131635@gmail.com> From: Dan Williams Date: Tue, 22 Sep 2020 17:26:41 -0700 Message-ID: Subject: Re: [x86/copy_mc] a0ac629ebe: fio.read_iops -43.3% regression To: Ingo Molnar Cc: kernel test robot , Thomas Gleixner , Ingo Molnar , Vishal L Verma , X86 ML , stable , Borislav Petkov , Vivek Goyal , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Linus Torvalds , Tony Luck , Erwin Tsaur , linux-nvdimm , Linux Kernel Mailing List , 0day robot , lkp@lists.01.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 6, 2020 at 8:35 AM Ingo Molnar wrote: > > > * Dan Williams wrote: > > > On Thu, Aug 6, 2020 at 6:35 AM Ingo Molnar wrote: > > > > > > > > > * kernel test robot wrote: > > > > > > > Greeting, > > > > > > > > FYI, we noticed a -43.3% regression of fio.read_iops due to commit: > > > > > > > > > > > > commit: a0ac629ebe7b3d248cb93807782a00d9142fdb98 ("x86/copy_mc: Introduce copy_mc_generic()") > > > > url: https://github.com/0day-ci/linux/commits/Dan-Williams/Renovate-memcpy_mcsafe-with-copy_mc_to_-user-kernel/20200802-014046 > > > > > > > > > > > > in testcase: fio-basic > > > > on test machine: 96 threads Intel(R) Xeon(R) Gold 6252 CPU @ 2.10GHz with 256G memory > > > > with following parameters: > > > > > > So this performance regression, if it isn't a spurious result, looks > > > concerning. Is this expected? > > > > This is not expected and I think delays these patches until I'm back > > from leave in a few weeks. I know that we might lose some inlining > > effect due to replacing native memcpy, but I did not expect it would > > have an impact like this. In my testing I was seeing a performance > > improvement from replacing the careful / open-coded copy with rep; > > mov;, which increases the surprise of this result. > > It would be nice to double check this on the kernel-test-robot side as > well, to make sure it's not a false positive. Circling back to this, I found the bug. This incremental patch nearly doubles the iops in the case when copy_mc_fragile() is enabled because it was turning around and redoing the copy with copy_mc_generic(). So this would have been a regression for existing systems that indicate that "carefu/fragilel" copying can avoid some PCC=1 machine checks. My performance checkout was comparing copy_mc_fragile() and copy_mc_generic() in isolation. Refreshed patches inbound. diff --git a/arch/x86/lib/copy_mc.c b/arch/x86/lib/copy_mc.c index 9e6fac1ab72e..afac844c8f45 100644 --- a/arch/x86/lib/copy_mc.c +++ b/arch/x86/lib/copy_mc.c @@ -58,7 +58,8 @@ copy_mc_to_user(void *to, const void *from, unsigned len) __uaccess_begin(); if (static_branch_unlikely(©_mc_fragile_key)) ret = copy_mc_fragile(to, from, len); - ret = copy_mc_generic(to, from, len); + else + ret = copy_mc_generic(to, from, len); __uaccess_end(); return ret; }