Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2866838iob; Fri, 6 May 2022 12:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHDq18kOcnR3hnC9rdIB5sRnPpONTVgonLUHdEjbYAsR2GKhabhFN/aQ8E+ZPSo8LqogqN X-Received: by 2002:a17:906:9c82:b0:6e1:2c94:1616 with SMTP id fj2-20020a1709069c8200b006e12c941616mr4319250ejc.64.1651863964649; Fri, 06 May 2022 12:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651863964; cv=none; d=google.com; s=arc-20160816; b=AfVSJSSfLFPbsyhcueR/YCUEmdr4b5+6YPspuG9P4+pkC4/Xg273U+Y2sSfQrNTeyz OMfkmf7ublULD3OU+6hfi902c9qIwMuJWA+0fBj9fiIJFwF7TZgivEa8GgDIrX88i5XY AmhE2/XHzp4hFsD082yFqSJ14aThebvcbYzn1j8LSdM6vy593Qkgp/T045cfP1R+lOts GJ0UxYwypjd37OpFpKQxiUks4DvRbuuOJ+appwSIXLaP4Gv4p0iB0GUa6CyBr66Kefx0 XEBgLWS+Rbs1jLjo+nLZLQWyOF19x5p0VeSB9jNSyfyKv07wqw2NQsn8CK4t32CIdYUf mtRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NSU6smJEiIO9h/lxy9NGP2UkX9LkBA5iQ8XWHRjy7YM=; b=FUjuVzcjEW9PwTt7jpEqw3wRZjOS4YP6xqY6It3WDyfvHEGILmohSp1gxx8mdK6kcm u2/9j3qI6zABuuP4klt2DLLbHV68VeIb2V+R7ETVVeSWNDIBBN8vbtpFHuEvstoI/aY/ KPy8APELCrEcDt4aFZruApbuw0uHkj1okUJBvS7VZPmMycbw7XL8Sh2uWxkVnsfmaRap XM2HQii5t0df8CoUFALFH0APr9ZeFtEdsHqAL3MGSWgzifwwZdfXa4OS/lMnSybzbIVX mwNUQJo8bhLqZzU1GYUsMMcZqDMuNWzq5q/O1Sz+3JX9cGdZBvn9vof2SDd4TFR3hejZ YlTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hRJlILKZ; 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 f4-20020aa7d844000000b0041d76d48108si4434788eds.229.2022.05.06.12.05.38; Fri, 06 May 2022 12:06:04 -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=hRJlILKZ; 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 S1387993AbiEFBo2 (ORCPT + 99 others); Thu, 5 May 2022 21:44:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387983AbiEFBo0 (ORCPT ); Thu, 5 May 2022 21:44:26 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E1D457131; Thu, 5 May 2022 18:40:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651801244; x=1683337244; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RLvHL8anf2YkJtlMQuHsQJoDiZbnI5hToTtaX6fMmgM=; b=hRJlILKZJueGB3gryV2JQByW7DQRT/DePilbnfjHBejW7C8/uxxoB+ax TnziYG7bUO8Z2sAqttN9V9bSHsXUs2jdkFHCU7//Egppfech6ERX4CBF6 VdcWqVzeUF3O8W+MnaF8gBU0qCcueQoi6I/qK4+0THxUsVs6HrfMaCLGd QmZ0vmMFw6HLspKnI4oXouGbLZt3ouOLPVA/L8YptMIkesDW+RKZqkLEk t2kVItYtGbLnHwgBnUe63/5I5tRt2OX8V9SIZE6MjhQG2H5ZbFjdMsB06 OHqO0zPpdeEauTVgMrrop55+L804bsDdqxFH8wyc+VsRVcokt9yd4Ckg+ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="293519422" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293519422" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 18:40:44 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="537645006" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 18:40:43 -0700 From: Tony Luck To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, corbet@lwn.net, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, rostedt@goodmis.org, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com Subject: [PATCH v6 00/11] Introduce In Field Scan driver Date: Thu, 5 May 2022 18:40:24 -0700 Message-Id: <20220506014035.1173578-1-tony.luck@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220428153849.295779-1-tony.luck@intel.com> References: <20220428153849.295779-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,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 TL;DR this driver loads scan test files that can check whether silicon in a CPU core is still running correctly. It is expected that these tests would be run several times per day to catch problems as silicon ages. Changes since v5: Added various Reviewed tags. If anyone wants to take one or more back in the light of changes listed below, please speak up. Thomas Gleixner --------------- 03 "So checking for Intel Fam6 ANYMODEL and X86_FEATURE_CORE_CAPABILITIES is sufficient, no?" Longer explanation in earlier e-mail ... but the family/model/stepping check is needed. No change. 04 "Why is ifs_load_firmware() not returning an error to the caller?" In most cases the return isn't useful. But this did prompt a change to make sure "echo 1 > reload" does give an error if the load fails. 05 "The above struct is nicely tabular. Can we have that here too please?" Added s to ifs_data structure to make it equally pretty. 06 "Setting the authenticated indicator _before_ actually doing the authentication is just wrong. It does not matter in this case, but it's still making my eyes bleed." Moved indicator to after success has been checked. 06 "Why has this to be a smp function call? Just because it's conveniant? This is nothing urgent and no hotpath, so this really can use queue_work_on()." Even simpler is schedule_work_on() [since other changes mean that the driver no longer allocates a work queue. 07 "Waiting for a second with preemption disabled? Seriously?" "Plus another half a second with preemption disabled. That's just insane." "That local_irq_disable() solves what?" "Why cpu_hotplug_disable()? Why is cpus_read_lock() not sufficient here?" "Why does this need GFP_NOWAIT?" "I put that into the wishful thinking realm" "The real question is why you try to rendevouz CPUs via work queues." "pseudo-code to use stomp_machine()" PeterZ contributed a neatly tailored for this usage "stop_core_cpuslocked()" function that works beautifully. See part 0003 of this new series. That meant all of the code that triggered the above comments has gone. Tony Luck --------- Noticed unnecessary casts from u8 to u32 in the checksum calculation in load.c. Fixed. Changed the tracepoint to include the CPU number of the core being tested (the tracepoint otherwise just tells you which CPU is executing the driver code and executing "stop_core_cpuslocked()" to do the actual work on the target CPUs. Dropped the msec_to_tsc() function that was used to initialize activate.delay. Just use a #define of 100000 cycles (two orders of magnitude bigger than I saw for the slew between the two threads executing the "stop_core_cpuslocked()" target function ... but not too insane so if the threads do not sync, we give up quickly). Jithu Joseph (7): x86/microcode/intel: Expose collect_cpu_info_early() for IFS platform/x86/intel/ifs: Read IFS firmware image platform/x86/intel/ifs: Check IFS Image sanity platform/x86/intel/ifs: Authenticate and copy to secured memory platform/x86/intel/ifs: Add scan test support platform/x86/intel/ifs: Add IFS sysfs interface platform/x86/intel/ifs: add ABI documentation for IFS Peter Zijlstra (1): stop_machine: Add stop_core_cpuslocked() for per-core operations Tony Luck (3): x86/msr-index: Define INTEGRITY_CAPABILITIES MSR platform/x86/intel/ifs: Add stub driver for In-Field Scan trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations .../ABI/testing/sysfs-platform-intel-ifs | 39 +++ MAINTAINERS | 8 + arch/x86/include/asm/cpu.h | 18 ++ arch/x86/include/asm/msr-index.h | 7 + arch/x86/kernel/cpu/intel.c | 32 +++ arch/x86/kernel/cpu/microcode/intel.c | 59 +--- drivers/platform/x86/intel/Kconfig | 1 + drivers/platform/x86/intel/Makefile | 1 + drivers/platform/x86/intel/ifs/Kconfig | 13 + drivers/platform/x86/intel/ifs/Makefile | 3 + drivers/platform/x86/intel/ifs/core.c | 74 +++++ drivers/platform/x86/intel/ifs/ifs.h | 124 ++++++++ drivers/platform/x86/intel/ifs/load.c | 266 ++++++++++++++++++ drivers/platform/x86/intel/ifs/runtest.c | 255 +++++++++++++++++ drivers/platform/x86/intel/ifs/sysfs.c | 149 ++++++++++ include/linux/stop_machine.h | 16 ++ include/trace/events/intel_ifs.h | 41 +++ kernel/stop_machine.c | 19 ++ 18 files changed, 1073 insertions(+), 52 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-ifs create mode 100644 drivers/platform/x86/intel/ifs/Kconfig create mode 100644 drivers/platform/x86/intel/ifs/Makefile create mode 100644 drivers/platform/x86/intel/ifs/core.c create mode 100644 drivers/platform/x86/intel/ifs/ifs.h create mode 100644 drivers/platform/x86/intel/ifs/load.c create mode 100644 drivers/platform/x86/intel/ifs/runtest.c create mode 100644 drivers/platform/x86/intel/ifs/sysfs.c create mode 100644 include/trace/events/intel_ifs.h base-commit: 672c0c5173427e6b3e2a9bbb7be51ceeec78093a -- 2.35.1