Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5845158rwd; Sun, 18 Jun 2023 21:03:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7PJwrUbxysG/aRB7zoCosyMLsdqNoCky98hlGrBm/spiGDGA7Wp/ST0b1kMQDWQrVdqyDS X-Received: by 2002:a92:d691:0:b0:341:b14f:971c with SMTP id p17-20020a92d691000000b00341b14f971cmr6660937iln.27.1687147435212; Sun, 18 Jun 2023 21:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687147435; cv=none; d=google.com; s=arc-20160816; b=QJogjqtCEP6MJUFvjtu5pSCqEN7xjZrzt9ZrFBffIG4EJ5b7IelpFvk5tq0zR8jTLO J2Jyv2qrO7LvUksml8O3pYEguUNyuHsWlMGlKZsfLw/baSbeIJtiJbuG1rP34v12TEB0 iOtRyFRDMAIUO1dfewAn4PMTTiKCKfIDJFAYqr1MgHnEvLN+CtEmo2sjFStz3DA4o8MX Bjg/AT1xnekuZth32ehJDEyT6odYn/0bwlau+YXGGBjThWcBPQKnM+IUIFApY+1fhcIf w+jvQUvAzrDpZ8BKQuJFQLVMOY51T26fM+yCxs46RX9yJe1Ms4cZ5EuFCzryN8++pyvh +Uog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=ivKvkwGCkvotfc0fZr6hNN4RRHeyZqwTcj4Dp/7Dgzw=; b=UmycDn8SK5xZ5pwCvYjtMqeP34kLcmMNLdW5XVcZwzCettmSKNi0pHejsvTRyD3Jn0 61iD5Nyy/M7JQ90JFLiH4xchQ5AppoF9i9+zLYRvw1ipF/WHLAVK42Ar4w1YpK7yUE8y I80WbpCnGKYJD90cU/uDyE0TJf21dRlK2udXp9DVVe1a+7mAejS8P2+6ZYvJiX1xpAz/ NtMmLEHWEkw0mozPLIQ+SppVuYR3POAk5G+cwWdPmW9bvCWj7Vex0Fvt5zBZRCGdShlO 6yi/UOTbYqPHqwee1vJQ0fq3qJ7ZEVn6WDqHUhz0htEm4ZsYJISAvCPy6wIw7v+dcFaO EGGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dmLqF+xR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m25-20020a637119000000b00553d5cc2c8bsi288445pgc.508.2023.06.18.21.03.40; Sun, 18 Jun 2023 21:03:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dmLqF+xR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229654AbjFSD0Z (ORCPT + 99 others); Sun, 18 Jun 2023 23:26:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjFSD0Y (ORCPT ); Sun, 18 Jun 2023 23:26:24 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8AF8E62 for ; Sun, 18 Jun 2023 20:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687145135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ivKvkwGCkvotfc0fZr6hNN4RRHeyZqwTcj4Dp/7Dgzw=; b=dmLqF+xRgaoE8IO4xOYS20JX2KopSejT6xrOmBz0drDZnA30nyxt8VAbfQHqyoGyFq8+at UHictc/aH+W2aBFHJsdSj2qEy+eIPxUaMr1e3SirY+ZD8LE5+aUAJTxlWr0BikG2l8cHIQ eloTkhYZYdmRDK0VHT4kN7mGbSBc7W8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-324-3b1LzjG6MRy7lRBMkdskOA-1; Sun, 18 Jun 2023 23:25:31 -0400 X-MC-Unique: 3b1LzjG6MRy7lRBMkdskOA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8238C3C11A09; Mon, 19 Jun 2023 03:25:30 +0000 (UTC) Received: from [10.22.16.51] (unknown [10.22.16.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FC66C1603B; Mon, 19 Jun 2023 03:25:29 +0000 (UTC) Message-ID: Date: Sun, 18 Jun 2023 23:25:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 0/5] x86/speculation: Disable IBRS when idle Content-Language: en-US From: Waiman Long To: Peter Zijlstra , Robin Jarry Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H.Peter Anvin" , Josh Poimboeuf , Pawan Gupta , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, x86@kernel.org, Joe Mario References: <20230616200003.745742-1-longman@redhat.com> <20230617122115.GA1830050@hirez.programming.kicks-ass.net> <55219f3b-992d-ccc3-ba29-7bf33465b5cc@redhat.com> In-Reply-To: <55219f3b-992d-ccc3-ba29-7bf33465b5cc@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 6/18/23 21:18, Waiman Long wrote: > On 6/17/23 08:21, Peter Zijlstra wrote: >> On Fri, Jun 16, 2023 at 10:14:52PM +0200, Robin Jarry wrote: >>> Waiman Long, Jun 16, 2023 at 21:59: >>>> For Intel processors that need to turn on IBRS to protect against >>>> Spectre v2 and Retbleed, the IBRS bit in the SPEC_CTRL MSR affects >>>> the performance of the whole core even if only one thread is turning >>>> it on when running in the kernel. For user space heavy applications, >>>> the performance impact of occasionally turning IBRS on during syscalls >>>> shouldn't be significant. Unfortunately, that is not the case when the >>>> sibling thread is idling in the kernel. In that case, the performance >>>> impact can be significant. >>>> >>>> When DPDK is running on an isolated CPU thread processing network >>>> packets >>>> in user space while its sibling thread is idle. The performance of the >>>> busy DPDK thread with IBRS on and off in the sibling idle thread are: >>>> >>>>                                  IBRS on               IBRS off >>>>                                  ------- -------- >>>>    packets/second:                  7.8M 10.4M >>>>    avg tsc cycles/packet:         282.26 209.86 >>>> >>>> This is a 25% performance degradation. The test system is a Intel Xeon >>>> 4114 CPU @ 2.20GHz. >>>> >>>> This patch series turns off IBRS when in various idle mode to >>>> eliminate >>>> the performance impact of the idling thread on its busy sibling >>>> thread. >>> Hi Longman, >>> >>> thanks a lot for the quick turnaround on this issue. >>> >>> Tested-by: Robin Jarry >> I can't see the patches -- they didn't arrive in my mailbox nor can I >> find them in the archive, in fact this here mail is the only evidence >> they exist at all. > > I got a rebound message from your mail server about incorrect message > format. It is probably caused by some problem in my end. > > >> However, did you all see intel_idle_ibrs() and how that is selected for >> C6 and up? >> >> What exactly isn't working there? > > We were testing on the RHEL9.2 kernel which doesn't have your > intel_idle_ibrs() patch yet. My preliminary testing does indicate your > patch will likely work. I will ask Jerry to test a newer RHEL9.3 > kernel with the intel_idle_ibrs() patch to see if it helps. We may need to extend your current solution to cover more cases. Perhaps adding a module parameter (e.g. idle_no_ibrs) to force the use of intel_idle_ibrs(). BTW, is it really the case that we can't disable IBRS when irq is enabled? The idle thread does not really interact with any user applications. I don't think there is any risk of information leakage even if we disable IBRS with interrupt enabled. Is my assumption incorrect? Thanks, Longman