Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp26174iog; Tue, 28 Jun 2022 14:05:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1viaKU8w/xY65QWK8MipFAOsWB4MsH6UhaOmirHVxfZa2+9ddyLcxuemJzi2aDc09sHQfHE X-Received: by 2002:a05:6402:31f6:b0:435:5a08:d5e0 with SMTP id dy22-20020a05640231f600b004355a08d5e0mr25926690edb.308.1656450324029; Tue, 28 Jun 2022 14:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656450324; cv=none; d=google.com; s=arc-20160816; b=ljmoc4DqMiY0IrNUh/YJEh+EykteTrTgC8aMr3bavGC/EmvTGq94+J0yWsJeHbUhcK E0mDEe70K3BSnhJ1lxJls64fbcjs1UxuRmZt5zn2B1jT2MNong+kDUJR4c3VUG7LLGEr NTIvVNWYgh5baYHW1fgY/7g/pIKcpAmp3uU3ykQ3QP7xq+yCNywTYqypLSOtYAf5EujE vAkcXCz3Oz3XZgkSqkzyBFBhkAKnAmXTI664cyFNpJg+V1w0wc98ouAN3+u1FvuxaDdF T6L36PApErZ0T8/V6l/SiEFKvQpQi+G1+o9ICmvZJx71utz910teu4mwNnk4wxnew8nn OeOQ== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=a+A7k5685LQWfMtMlX6WgTCYAFPmZfzIhl7TWHYQHBQ=; b=xI3Hqa0nHxkvoJgGV07KHSpbMJBFjfibtPndA4wL3iSKl+5+n0w8tnfoKo+hZC4jG5 u8To+BXFD+gHLSFsnZoBYRUeFoI8Cnv6p/MgHcTFR79XSySup2DQ7yakMWBdaMddgrer 3UujMJZ7KFw/Q/h8EASNBR/puaQI+cY44uphRIEQe+UrBgdeHg5rghA7e/pDztuKfh0t 0YNOW6xhqLN6imhIT1kGzP9vc6/UTLLtVKw7Qbmpe0u5tnygvG1rCGn5xi2jq+FJMgAQ nK0wlZqEZBaQI4u3ksFuC5tISapv9njSMWs+OKVBa3ggV9o1W+iHAwXCL+fEyedlxhKb VSEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="g/hIDkwQ"; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a0564021e8c00b00437a61a5751si244183edf.571.2022.06.28.14.04.49; Tue, 28 Jun 2022 14:05:24 -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=@intel.com header.s=Intel header.b="g/hIDkwQ"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbiF1VCt (ORCPT + 99 others); Tue, 28 Jun 2022 17:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiF1VCs (ORCPT ); Tue, 28 Jun 2022 17:02:48 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA433393DF; Tue, 28 Jun 2022 14:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656450167; x=1687986167; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=wZ/uTrA3bjyScAuweu7zLmoZX9qpUo9vDnaXIZOrcKs=; b=g/hIDkwQ47/ktR4JtVBeDbfARqwRF65lQARKj80eJ5VAxnH0SgZqp+oZ nvlldvupjNiBnGTKYD6WcePml9afjzxsKMdBQqe39anVH2vB003Ck2CQQ FALbnT0JGXqXmW8tKZzlBJeCxe1MnZqWl9g3Cdb5wFWMindOOaxwSB8O8 tb5g2eAtZulxPZBXMtsI945Tbnn6exfI6447FQB9aztnASKNVYKNLcqIa aR2z0C70TwmlimuFwtCcysTH7SORkaToHefCYln1CEEVU+Cgc4u7Mu59Z GXXhc9Ro0y0Yi6ebauijHAIXtKZ5UcHGC8ayaOnMNByXlYgAC2IiEH5Kw A==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="368160480" X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="368160480" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 14:02:47 -0700 X-IronPort-AV: E=Sophos;i="5.92,229,1650956400"; d="scan'208";a="588004851" Received: from staibmic-mobl1.amr.corp.intel.com (HELO [10.209.67.166]) ([10.209.67.166]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2022 14:02:46 -0700 Message-ID: <6934b82d-db12-8a17-7dea-7bcbd4fe8566@intel.com> Date: Tue, 28 Jun 2022 14:01:40 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v5 0/6] Add hardware prefetch control driver for A64FX and x86 Content-Language: en-US To: Linus Walleij Cc: "tarumizu.kohei@fujitsu.com" , Greg KH , "catalin.marinas@arm.com" , "will@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "rafael@kernel.org" , "lenb@kernel.org" , "mchehab+huawei@kernel.org" , "eugenis@google.com" , "tony.luck@intel.com" , "pcc@google.com" , "peterz@infradead.org" , "marcos@orca.pet" , "marcan@marcan.st" , "nicolas.ferre@microchip.com" , "conor.dooley@microchip.com" , "arnd@arndb.de" , "ast@kernel.org" , "peter.chen@kernel.org" , "kuba@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , Paolo Valente , Andrew Morton References: <20220607120530.2447112-1-tarumizu.kohei@fujitsu.com> <086370dd-281f-5ac6-3a0f-f1b80500c668@intel.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.8 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_MED,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/28/22 13:20, Linus Walleij wrote: > On Tue, Jun 28, 2022 at 5:47 PM Dave Hansen wrote: >> On 6/27/22 02:36, Linus Walleij wrote: >>> The right way to solve this is to make the Linux kernel contain the >>> necessary heuristics to identify which tasks and thus cores need this >>> to improve efficiency and then apply it automatically. >> >> I agree in theory. But, I also want a pony in theory. >> >> Any suggestions for how to do this in the real world? > > Well if the knobs are exposed to userspace, how do people using > these knobs know when to turn them? A profiler? perf? All that > data is available to the kernel too. They run their fortran app. Change the MSRs. Run it again. See if it simulated the nuclear weapon blast any faster or slower. Rinse. Repeat. One thing that is missing from the changelog and cover letter here: On x86, there's a 'wrmsr(1)' tool. That took pokes at Model Specific Registers (MSRs) via the /dev/cpu/X/msr interface. That interface is a very, very thinly-veiled wrapper around the WRMSR (WRite MSR) instruction. In other words, on x86, our current interface allows userspace programs to arbitrarily poke at our most sensitive hardware configuration registers. One of the most common reasons users have reported doing this (we have pr_warn()ings about it) is controlling the prefetch hardware. This interface would take a good chunk of the x86 wrmsr(1) audience and convert them over to a less dangerous interface. That's a win on x86. We don't even *remotely* have line-of-sight for a generic solution for the kernel to figure out a single "best" value for these registers.