Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp531354rwb; Mon, 26 Sep 2022 02:20:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AMuvkxIUZUKWXPFimVQWIYyS4YL2w20fUVcv4NGy6tjwylM+6HeGsDvdNSGyhsWZshlh6 X-Received: by 2002:a17:903:41c6:b0:178:348e:f760 with SMTP id u6-20020a17090341c600b00178348ef760mr21259464ple.123.1664184039541; Mon, 26 Sep 2022 02:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664184039; cv=none; d=google.com; s=arc-20160816; b=yb3iAg2B0DVA9BYWxPcmq319b1YxmJapiFiUduP44r1+c2V6pBGQe5RtgSn0jZPrE3 Vm7YV2bv+r7hHevvY51u1f/EAzzp3lZ8DZyVDI8ffU5Kuy0UAw9hVejEKNL8aduHCt2S NjCNBT0RxDS5OAVopakLgQBIJ7yZFZFxrwYnxOPTH14gohzj3ATcM8oELhvyLxk37llK sB13acL/v3y+bO/2BSOIp7DN0g4edwPLS8uCycRXU3F4I2u5fNcYoM5Q1AgPUYTuetyY FJdEfjXcoJOZy/fDVkbgYHfdR8QcqQReCFW4/PRPXHuk63S1Lwa4m8dMnyeCjxQVALrF dz4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=AiT/VAaZyZ1WdprloJvG7PWXeZjlL8QTVjEAi+Retr0=; b=l4Vd8p6o7tYfI2gEuFBTkoi0O5wawTLzKDFQ8EPnxje1XtfvJx2Ik/F/+cPPQDizaU ktOkI53yw/HTTgh8n7FGE/3Eu00OOOPwWJtVav8F02lhiZnVFBw7O7Ez5x31LV5KakpU MBiIX4Q2EZUcVs+4f8Ji+Fj63gmmwH2tNy2Z1dCR3M3W3IM9T3Jy9jN0aEl2yCF+X4dQ aT+T56+Mp86WVVyrE7OEi5FZbHoxbxuxvZgk97pqYWreX4J91vcGxdeDtfVQN6meZIBw 6bHJ5Lj+Lea6FP3cMZvI/f8GbykLGX/+szEQ91NZN0Y6l76ze5I4YPlYAqch9JPADa2Q ur1Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on1-20020a17090b1d0100b002005df50fb5si12905150pjb.131.2022.09.26.02.20.28; Mon, 26 Sep 2022 02:20:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234255AbiIZIUI convert rfc822-to-8bit (ORCPT + 99 others); Mon, 26 Sep 2022 04:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233893AbiIZITy (ORCPT ); Mon, 26 Sep 2022 04:19:54 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F7551208D for ; Mon, 26 Sep 2022 01:19:49 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-405-Qb3Og9akNIqbdq-vx1UKdQ-1; Mon, 26 Sep 2022 09:19:46 +0100 X-MC-Unique: Qb3Og9akNIqbdq-vx1UKdQ-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Mon, 26 Sep 2022 09:19:40 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.040; Mon, 26 Sep 2022 09:19:40 +0100 From: David Laight To: 'K Prateek Nayak' , "linux-kernel@vger.kernel.org" CC: "rafael@kernel.org" , "lenb@kernel.org" , "linux-acpi@vger.kernel.org" , "linux-pm@vger.kernel.org" , "dave.hansen@linux.intel.com" , "bp@alien8.de" , "tglx@linutronix.de" , "andi@lisas.de" , "puwen@hygon.cn" , "mario.limonciello@amd.com" , "peterz@infradead.org" , "rui.zhang@intel.com" , "gpiccoli@igalia.com" , "daniel.lezcano@linaro.org" , "ananth.narayan@amd.com" , "gautham.shenoy@amd.com" , Calvin Ong , "Rafael J . Wysocki" , "stable@vger.kernel.org" Subject: RE: [PATCH v2] x86,acpi: Limit "Dummy wait" workaround to older AMD and Intel processors Thread-Topic: [PATCH v2] x86,acpi: Limit "Dummy wait" workaround to older AMD and Intel processors Thread-Index: AQHYz2KQHQ0Aty345ECS39s1ZZ3yPa3xXk7w Date: Mon, 26 Sep 2022 08:19:40 +0000 Message-ID: <93705b7dab2f4d6db7f4631648daf16f@AcuMS.aculab.com> References: <20220923153801.9167-1-kprateek.nayak@amd.com> In-Reply-To: <20220923153801.9167-1-kprateek.nayak@amd.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 From: K Prateek Nayak > Sent: 23 September 2022 16:38 .... > > This workaround is very painful on modern systems with a large number of > cores. The "inl()" can take thousands of cycles. Sampling certain > workloads with IBS on AMD Zen3 system shows that a significant amount of > time is spent in the dummy op, which incorrectly gets accounted as > C-State residency. A large C-State residency value can prime the cpuidle > governor to recommend a deeper C-State during the subsequent idle > instances, starting a vicious cycle, leading to performance degradation > on workloads that rapidly switch between busy and idle phases. > (For the extent of the performance degradation refer link [2]) Isn't that a horrid bug itself? Sounds like it affects any code that is doing pio reads of hardware buffers. While they are slow they are necessary. IIRC any PCIe read into an Altera fpga takes about 128 cycles of the 125MHz clock. The Intel cpu I've checked will only execute one concurrent PCIe read for each cpu core - so the cpu soon stalls for thousands of clocks. > The dummy wait is unnecessary on processors based on the Zen > microarchitecture (AMD family 17h+ and HYGON). Skip it to prevent > polluting the C-state residency information. Among the pre-family 17h > AMD processors, there has been at least one report of an AMD Athlon on a > VIA chipset (circa 2006) where this this problem was seen (see [3] for > report by Andreas Mohr). > > Modern Intel processors use MWAIT based C-States in the intel_idle driver > and are not impacted by this code path. For older Intel processors that > use the acpi_idle driver, a workaround was suggested by Dave Hansen and > Rafael J. Wysocki to regard all Intel chipsets using the IOPORT based > C-state management as being affected by this problem (see [4] for > workaround proposed). Can you use a surrogate (maybe AVX support?) to exclude large groups on modern cpu? Another possibility is that is the io address doesn't really matter are there any locations that have moved on-die and are now executed much faster than the ISA bus speed of older systems? Or do all the 'originally ISA' peripherals still run at ISA speeds? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)