Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3025310rdb; Wed, 15 Nov 2023 19:28:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZy/usgunnE0MQZDln+Mw0BeEIB9nCjL8Xe6MX6FpohK404IFB9+IoOmoNing6WAShZORg X-Received: by 2002:a05:6808:1794:b0:3ae:4cb2:fb43 with SMTP id bg20-20020a056808179400b003ae4cb2fb43mr21103524oib.21.1700105331895; Wed, 15 Nov 2023 19:28:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700105331; cv=none; d=google.com; s=arc-20160816; b=Ustr0yB9s3JRZszH6JkrGIzvJY7m0/mCRkXlSuVmHYIV3h9091Lzxnb+fb2fzbCNe4 LnfygEGItiFpdKUAZMPy6MRm2pMFx16USHr6XcgiwublxbkLhW2PX+oJ6UmxduPk+0Ke P6fis8AVGwRCOAvItrPODg+wXXVwj8J7JLv+4ljAiI8Yw07L/0oyGSstXnPqJVQXtw07 N8EgOvi3HrjVvHsjpg7YfNxx1Bx5pftunerEZYRDNd+eilxXK372NQF/f1NkkpFgSCJw olqF1/d8pvoQYzdKWG3WeqggVeaK2lpnZvZTk+D3Cc59x3PAQONO05WclkCN+XSr+5+8 +deA== 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=Lpw5N7hLJVBmWx1YZh3JJftpK5bs0D0hrTfIHC0Li88=; fh=OWEPqVNoDNCOxjOcFUxeJTl3zCBbx5znrXcPpfE9vKs=; b=l+i2H2U+jq2E5ok/BFTdN58wB8sxCD0y5IpVQsUTRFyxL/v95KhJelFdez0XKhdjCI YxeWvUVxRk/nGhlNjGjuKJMaKscNYuQA3s2n/L2TiDOcdD+VkEeYoetg42ibMuO2V4CN X/e3xKYGjH18mQT47Yfhu3DwRSpldrD2FmDNMK4HdRKGUxoibBakxq2eRP2vX1ajJxDG i9sxHyJHZVqG0lKHvC2ml+HfGLP5x3x34TWYAImyEO+e3cT0zOhmzY30BhvPTSVPorNp UEgbphjME0U89hmEgiCjE+ooDqozAGjsJHgXzP2E8+n8M+7RfngX4P8w3s0PJrq7I2By aDtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=YU9xIEdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a34-20020a634d22000000b0057d7cff25besi10855167pgb.829.2023.11.15.19.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 19:28:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=YU9xIEdl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5FCAC806141D; Wed, 15 Nov 2023 19:27:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235693AbjKPD07 (ORCPT + 99 others); Wed, 15 Nov 2023 22:26:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344863AbjKPD04 (ORCPT ); Wed, 15 Nov 2023 22:26:56 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E7571A4 for ; Wed, 15 Nov 2023 19:26:51 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9d0b4dfd60dso45026966b.1 for ; Wed, 15 Nov 2023 19:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1700105209; x=1700710009; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Lpw5N7hLJVBmWx1YZh3JJftpK5bs0D0hrTfIHC0Li88=; b=YU9xIEdlaoIZq+xWDKVdiwF/2vfnX6Qq3UbjfIcPEtMsWk7FEHBSZFU5DsqZyY1n8X JTE2JRI/erQ747axppsem29Xoj+gizG3UF1RHSEufffC+Fsh3dGeX2s81J2ouujBXpYV K6fSWocNXNCtqCRxw3aLvteh/OpzX9lj+xrfQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700105209; x=1700710009; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lpw5N7hLJVBmWx1YZh3JJftpK5bs0D0hrTfIHC0Li88=; b=Ya6nJl6WJufwWSdDgl4jiMz1xsDSxthXjPFWZNv3N93u4TOk5V7vPmogUTNhhVP8vF TfMx23bGR0D/zL7QcSZlG361xF5wBWEVKtrqFWqEGZ2iN7Q5RPk+sSBTNkzVLFWUKJyb ZB/1OOtXmJ49elzZJTGd9qh5oExrMjKyFCueNhssT+Fm/6PxdvBawjcEtNKrBTlBrznC cVtbkxVMePx1k8lAf/y3X51tBs5fKOWfX46SG0uy3K3X445483/gZDnLl+jaqxKUJwLJ JGsZOdbhlkyXIbZADQ8cprJZgeS0AcEjTZEECspDfLwOV+eob+OqhIhGdiLvP1RxSDzq y6Yg== X-Gm-Message-State: AOJu0YyJJuFugvuXzS+3oS7Nw9TnhQFjPbghRHzv8McX8B29XWxZ6W6R L8ZLouLzOpTmhE+DJCJU4DVhK+cygxx9nwvfkhNdr16z X-Received: by 2002:a17:906:5297:b0:9e2:af56:c375 with SMTP id c23-20020a170906529700b009e2af56c375mr10608506ejm.52.1700105209503; Wed, 15 Nov 2023 19:26:49 -0800 (PST) Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com. [209.85.208.43]) by smtp.gmail.com with ESMTPSA id d7-20020a170906370700b009dd4b2d412fsm7823586ejc.36.2023.11.15.19.26.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Nov 2023 19:26:48 -0800 (PST) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-53db360294fso520949a12.3 for ; Wed, 15 Nov 2023 19:26:47 -0800 (PST) X-Received: by 2002:a05:6402:1111:b0:53d:bc68:633a with SMTP id u17-20020a056402111100b0053dbc68633amr11218507edv.5.1700105207537; Wed, 15 Nov 2023 19:26:47 -0800 (PST) MIME-Version: 1.0 References: <202311061616.cd495695-oliver.sang@intel.com> <3865842.1700061614@warthog.procyon.org.uk> <4097023.1700084620@warthog.procyon.org.uk> <42895.1700089191@warthog.procyon.org.uk> In-Reply-To: <42895.1700089191@warthog.procyon.org.uk> From: Linus Torvalds Date: Wed, 15 Nov 2023 22:26:30 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linus:master] [iov_iter] c9eec08bac: vm-scalability.throughput -16.9% regression To: David Howells Cc: Borislav Petkov , kernel test robot , oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org, Christian Brauner , Alexander Viro , Jens Axboe , Christoph Hellwig , Christian Brauner , Matthew Wilcox , David Laight , ying.huang@intel.com, feng.tang@intel.com, fengwei.yin@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 19:27:17 -0800 (PST) On Wed, 15 Nov 2023 at 18:00, David Howells wrote: > > And using __memcpy() rather than memcpy(): Yeah, that's just sad. It might indeed be that you're running on a Haswell core, and the retpoline overhead just kills that entirely. You could try building the kernel without mitigations (or booting with them off, which isn't quite as good) to verify. > A disassembly of _copy_from_iter() for the latter is attached. Note that the > UBUF/IOVEC still uses "rep movsb" Well, yes and no. User copies do that X86_FEATURE_FSRM alternatives dance, so the code gets generated with "rep movs", but you'll note that there are several 'nops' after it. Some of the nops are because we'll be inserting STAC/CLAC (three bytes each, I think) instructions around user accesses for SMAP-capable CPU's. But some of the nops are because we'll be rewriting that "rep stosb" (two bytes, iirc) as "call rep_stos_alternative" (5 bytes) on CPU's that don't do FSRM like yours. So your CPU won't actually be executing that 'rep stosb' sequence. And yes, the '__x86_return_thunk' overhead can be pretty horrific. It will get rewritten to the appropriate thing by "apply_returns". But like the "rep movs" and the missing STAC/CLAC, you won't see that in the objdump, you only see it in the final binary. Linus