All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
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 v3 00/11] Introduce In Field Scan driver
Date: Tue, 19 Apr 2022 09:38:48 -0700	[thread overview]
Message-ID: <20220419163859.2228874-1-tony.luck@intel.com> (raw)
In-Reply-To: <20220407191347.9681-1-jithu.joseph@intel.com>

Longer description of what this does, and why it is useful in the v2 cover
letter here:
  https://lore.kernel.org/all/20220407191347.9681-1-jithu.joseph@intel.com/

But the TL;DR version is 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.

I'm posting this update because I missed many major issues when I added
my review tag. So I have a moral obligation to fix up the things that
I missed.

Changes since V2:

Dan Williams (offline):
----------------------
1) Provided the clue to split into a tiny driver that enumerates and
   registers the device. Then the IFS driver can attach to that an behave
   much more like a normal driver (original idea from Andy Lutomirski,
   used for pmem/nvdimms)

2 .. many) Lots more pointers, tips, and general good guidance to make both
   the code and commit comments better and easier to understand.

Boris:
-----
1) Add "intel_" prefixes to the two functions moving to wider scope.

Done.

2) Move the declarations from <asm/microcode_intel.h> to <asm/cpu.h>

Done.

3) intel_cpu_signatures_match() is small enough to be "inline".

Done.

Greg:
----
1) Is the firmware already submitted to the linux-firmware project for
   inclusion there?
   If not, where should a user get it from?

The scan files will be distributed by Intel on Github in much the
same way that microcode is distributed today.

2) > +struct ifs_binary ifs_binary;

   Please no static memory.  Use the driver model properly which does not
   want you to do this at all.

   You should not need this at all.  If you do, something is wrong as you
   are tying the lifecycle of the memory to the code, not to the device.

Moved this (and ifs_test) to dynamic allocation using devm_kzalloc()
and attaching the resulting pointer to the device with dev_set_drvdata().

3) > +static ssize_t details_show(struct device *dev,
   > +			    struct device_attribute *attr,
   > +			    char *buf)
   > +{
   > +	int ret;
   > +
   > +	if (down_trylock(&ifs_sem))
   > +		return -EBUSY;

   Why do you care about locking here at all?

   > +
   > +	ret = sysfs_emit(buf, "%#llx\n", ifs_test.scan_details);
   > +	up(&ifs_sem);

   What are you protecting?  The value can change right after the lock is
   released, so who cares?

Removed locking from status and details show() functions. Running a test
is synchronous. So:
  # echo 3 > run_test
  # cat status
  # cat details
will give the results of the core 3 test as expected. It is up to the user
to not do dumb things like reading status/details from another process in
parallel with running tests.

4) > +	if (!ifs_binary.loaded) {
   > +		dev_info(&ifs_pdev->dev, "Load scan binary using driver bind interface\n");

   Do not allow userspace to spam kernel logs for no reason :(

   sysfs files are not "help files" in the kernel.

Spam removed.

5) > +void ifs_sysfs_add(void)
   > +{
   > +	ifs_pdev->dev.groups = plat_ifs_groups;

   Why do you have a single global structure?

All instances of the driver for different tests can use the same files
and functions. They use "struct ifs_data *ifsd = dev_get_drvdata(dev);"
to operate on the correct driver instance.

6) > +KernelVersion:	5.19.0

   No need for ".0"

Removed.

7) > +		For e.g to test cpu5 do echo 5 > /sys/devices/platform/intel_ifs/run_test

   So core numbers are different than cpu numbers here?  How are users
   going to map them?

Added some extra text here to say that tests are per core, but any thread
on the core can be used to run the test. Should I also point people at
/sys/devices/system/cpu/cpu#/topology/thread_siblings_list? It seems
easy for users to get a list of cores with a script like:
$ cores=$(cat /sys/devices/system/cpu/cpu*/topology/thread_siblings_list | sed -e 's/,.*//' | sort -n | uniq)

8) > +Description:	Version of loaded IFS binary image.

   In what format?

Added "(hexadecimal)". Also added code (and Docs) to print "none" if the load
of the scan file failed.

9) > +Description:	echo "intel_ifs" to reload IFS image.

   Huh?  Why are you using a common sysfs file for this type of attribute?
   Please do not do so, make it "reload" or something like that.

Ok. Added a "reload" file like microcode. (Though using driver bind/unbind
also works).

10) > +Description:	IFS tunable parameter that user can modify before
   > +		the scan run if they wish to override default value.

   And where are those parameters documented?  What are valid values here?

Dropped both the "noirq" and "retry" parameters. I think they now have sane
defaults. If Jithu/Ashok have a good use case, they can send a patch to add
them back.

-Tony


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

Tony Luck (4):
  Documentation: In-Field Scan
  platform/x86/intel/ifs: Create device for Intel IFS (In Field Scan)
  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 ++
 Documentation/x86/ifs.rst                     | 101 ++++++
 Documentation/x86/index.rst                   |   1 +
 MAINTAINERS                                   |   8 +
 arch/x86/include/asm/cpu.h                    |  18 +
 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        |  16 +
 drivers/platform/x86/intel/ifs/Makefile       |   5 +
 drivers/platform/x86/intel/ifs/core.c         |  74 ++++
 drivers/platform/x86/intel/ifs/ifs.h          | 103 ++++++
 .../platform/x86/intel/ifs/intel_ifs_device.c |  50 +++
 drivers/platform/x86/intel/ifs/load.c         | 265 ++++++++++++++
 drivers/platform/x86/intel/ifs/runtest.c      | 333 ++++++++++++++++++
 drivers/platform/x86/intel/ifs/sysfs.c        | 151 ++++++++
 include/trace/events/intel_ifs.h              |  38 ++
 18 files changed, 1243 insertions(+), 52 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-ifs
 create mode 100644 Documentation/x86/ifs.rst
 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/intel_ifs_device.c
 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: b2d229d4ddb17db541098b83524d901257e93845
-- 
2.35.1


  parent reply	other threads:[~2022-04-19 16:39 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 19:13 [PATCH v2 00/10] Introduce In Field Scan driver Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 01/10] x86/microcode/intel: expose collect_cpu_info_early() for IFS Jithu Joseph
2022-04-08  8:34   ` Borislav Petkov
2022-04-21 14:56     ` Thomas Gleixner
2022-04-07 19:13 ` [PATCH v2 02/10] Documentation: In-Field Scan Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 03/10] platform/x86/intel/ifs: Add driver for " Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 04/10] platform/x86/intel/ifs: Load IFS Image Jithu Joseph
2022-04-08  5:02   ` Greg KH
2022-04-08  5:04   ` Greg KH
2022-04-07 19:13 ` [PATCH v2 05/10] platform/x86/intel/ifs: Check IFS Image sanity Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 06/10] platform/x86/intel/ifs: Authenticate and copy to secured memory Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 07/10] platform/x86/intel/ifs: Add scan test support Jithu Joseph
2022-04-07 19:13 ` [PATCH v2 08/10] platform/x86/intel/ifs: Add IFS sysfs interface Jithu Joseph
2022-04-08  4:59   ` Greg KH
2022-04-07 19:13 ` [PATCH v2 09/10] platform/x86/intel/ifs: add ABI documentation for IFS Jithu Joseph
2022-04-08  5:02   ` Greg KH
2022-04-07 19:13 ` [PATCH v2 10/10] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Jithu Joseph
2022-04-19 16:38 ` Tony Luck [this message]
2022-04-19 16:38   ` [PATCH v3 01/11] x86/microcode/intel: Expose collect_cpu_info_early() for IFS Tony Luck
2022-04-19 16:38   ` [PATCH v3 02/11] Documentation: In-Field Scan Tony Luck
2022-04-19 16:48     ` Greg KH
2022-04-19 19:45       ` Dan Williams
2022-04-20  7:48         ` Greg KH
2022-04-19 16:38   ` [PATCH v3 03/11] platform/x86/intel/ifs: Create device for Intel IFS (In Field Scan) Tony Luck
2022-04-19 16:47     ` Greg KH
2022-04-19 18:09       ` Dan Williams
2022-04-19 22:28         ` Dan Williams
2022-04-20  7:49           ` Greg KH
2022-04-20  7:48         ` Greg KH
2022-04-20 15:27           ` Luck, Tony
2022-04-20 17:46             ` Greg KH
2022-04-20 17:57               ` Luck, Tony
2022-04-20 18:04                 ` Greg KH
2022-04-20 18:08                   ` Luck, Tony
2022-04-20 19:04                     ` Greg KH
2022-04-19 16:38   ` [PATCH v3 04/11] platform/x86/intel/ifs: Add stub driver for In-Field Scan Tony Luck
2022-04-19 16:38   ` [PATCH v3 05/11] platform/x86/intel/ifs: Read IFS firmware image Tony Luck
2022-04-19 17:14     ` Greg KH
2022-04-19 16:38   ` [PATCH v3 06/11] platform/x86/intel/ifs: Check IFS Image sanity Tony Luck
2022-04-19 17:16     ` Greg KH
2022-04-19 16:38   ` [PATCH v3 07/11] platform/x86/intel/ifs: Authenticate and copy to secured memory Tony Luck
2022-04-19 16:38   ` [PATCH v3 08/11] platform/x86/intel/ifs: Add scan test support Tony Luck
2022-04-19 16:38   ` [PATCH v3 09/11] platform/x86/intel/ifs: Add IFS sysfs interface Tony Luck
2022-04-19 17:20     ` Greg KH
2022-04-19 17:35       ` Luck, Tony
2022-04-19 17:58         ` Greg KH
2022-04-19 18:15           ` Dan Williams
2022-04-19 18:24       ` Dan Williams
2022-04-19 16:38   ` [PATCH v3 10/11] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Tony Luck
2022-04-20 23:38     ` Steven Rostedt
2022-04-21  4:26       ` Luck, Tony
2022-04-21 12:41         ` Steven Rostedt
2022-04-19 16:38   ` [PATCH v3 11/11] platform/x86/intel/ifs: add ABI documentation for IFS Tony Luck
2022-04-22 20:02   ` [PATCH v4 00/10] Introduce In Field Scan driver Tony Luck
2022-04-22 20:02     ` [PATCH v4 01/10] x86/microcode/intel: Expose collect_cpu_info_early() for IFS Tony Luck
2022-04-22 20:02     ` [PATCH v4 02/10] x86/msr-index: Define INTEGRITY_CAPABILITIES MSR Tony Luck
2022-04-22 20:02     ` [PATCH v4 03/10] platform/x86/intel/ifs: Add stub driver for In-Field Scan Tony Luck
2022-04-22 20:02     ` [PATCH v4 04/10] platform/x86/intel/ifs: Read IFS firmware image Tony Luck
2022-04-26 10:45       ` Greg KH
2022-04-26 16:12         ` Luck, Tony
2022-04-26 16:36           ` Greg KH
2022-04-26 18:47             ` Luck, Tony
2022-04-22 20:02     ` [PATCH v4 05/10] platform/x86/intel/ifs: Check IFS Image sanity Tony Luck
2022-04-22 20:02     ` [PATCH v4 06/10] platform/x86/intel/ifs: Authenticate and copy to secured memory Tony Luck
2022-04-22 20:02     ` [PATCH v4 07/10] platform/x86/intel/ifs: Add scan test support Tony Luck
2022-04-22 20:02     ` [PATCH v4 08/10] platform/x86/intel/ifs: Add IFS sysfs interface Tony Luck
2022-04-22 20:02     ` [PATCH v4 09/10] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Tony Luck
2022-04-25 14:52       ` Steven Rostedt
2022-04-25 16:49         ` Luck, Tony
2022-04-26  1:49           ` Steven Rostedt
2022-04-26 23:53             ` Luck, Tony
2022-04-27  2:42               ` Steven Rostedt
2022-04-22 20:02     ` [PATCH v4 10/10] platform/x86/intel/ifs: add ABI documentation for IFS Tony Luck
2022-04-28 15:38     ` [PATCH v5 00/10] Introduce In Field Scan driver Tony Luck
2022-04-28 15:38       ` [PATCH v5 01/10] x86/microcode/intel: Expose collect_cpu_info_early() for IFS Tony Luck
2022-05-03 15:29         ` Borislav Petkov
2022-05-04 10:28         ` Thomas Gleixner
2022-04-28 15:38       ` [PATCH v5 02/10] x86/msr-index: Define INTEGRITY_CAPABILITIES MSR Tony Luck
2022-04-28 15:38       ` [PATCH v5 03/10] platform/x86/intel/ifs: Add stub driver for In-Field Scan Tony Luck
2022-05-04 10:35         ` Thomas Gleixner
2022-05-04 16:24           ` Luck, Tony
2022-05-04 16:28             ` Borislav Petkov
2022-04-28 15:38       ` [PATCH v5 04/10] platform/x86/intel/ifs: Read IFS firmware image Tony Luck
2022-05-04 10:37         ` Thomas Gleixner
2022-05-04 16:49           ` Luck, Tony
2022-04-28 15:38       ` [PATCH v5 05/10] platform/x86/intel/ifs: Check IFS Image sanity Tony Luck
2022-04-28 15:38       ` [PATCH v5 06/10] platform/x86/intel/ifs: Authenticate and copy to secured memory Tony Luck
2022-05-04 10:48         ` Thomas Gleixner
2022-04-28 15:38       ` [PATCH v5 07/10] platform/x86/intel/ifs: Add scan test support Tony Luck
2022-05-04 12:29         ` Thomas Gleixner
2022-05-04 18:52           ` Luck, Tony
2022-05-04 23:15             ` Thomas Gleixner
2022-05-05  8:28               ` Peter Zijlstra
2022-05-05  9:01                 ` Thomas Gleixner
2022-05-05 18:32                   ` Luck, Tony
2022-05-05 20:21                     ` Peter Zijlstra
2022-04-28 15:38       ` [PATCH v5 08/10] platform/x86/intel/ifs: Add IFS sysfs interface Tony Luck
2022-04-28 15:38       ` [PATCH v5 09/10] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Tony Luck
2022-04-28 15:38       ` [PATCH v5 10/10] platform/x86/intel/ifs: add ABI documentation for IFS Tony Luck
2022-04-28 15:58       ` [PATCH v5 00/10] Introduce In Field Scan driver Greg KH
2022-04-28 16:07         ` Luck, Tony
2022-05-02 15:15       ` Hans de Goede
2022-05-02 17:23         ` Luck, Tony
2022-05-03 15:32         ` Borislav Petkov
2022-05-03 16:04           ` Luck, Tony
2022-05-03 16:26             ` Luck, Tony
2022-05-06 14:19           ` Hans de Goede
2022-05-06 15:53             ` Luck, Tony
2022-05-06 18:41               ` Hans de Goede
2022-05-09 17:05                 ` Luck, Tony
2022-05-09 18:12                   ` Hans de Goede
2022-05-06  1:40       ` [PATCH v6 00/11] " Tony Luck
2022-05-06  1:40         ` [PATCH v6 01/11] x86/microcode/intel: Expose collect_cpu_info_early() for IFS Tony Luck
2022-05-06  1:40         ` [PATCH v6 02/11] x86/msr-index: Define INTEGRITY_CAPABILITIES MSR Tony Luck
2022-05-06  8:19           ` Thomas Gleixner
2022-05-06  1:40         ` [PATCH v6 03/11] stop_machine: Add stop_core_cpuslocked() for per-core operations Tony Luck
2022-05-06  8:20           ` Thomas Gleixner
2022-05-06  1:40         ` [PATCH v6 04/11] platform/x86/intel/ifs: Add stub driver for In-Field Scan Tony Luck
2022-05-06  8:23           ` Thomas Gleixner
2022-05-06  1:40         ` [PATCH v6 05/11] platform/x86/intel/ifs: Read IFS firmware image Tony Luck
2022-05-06  1:40         ` [PATCH v6 06/11] platform/x86/intel/ifs: Check IFS Image sanity Tony Luck
2022-05-06  1:40         ` [PATCH v6 07/11] platform/x86/intel/ifs: Authenticate and copy to secured memory Tony Luck
2022-05-06  1:40         ` [PATCH v6 08/11] platform/x86/intel/ifs: Add scan test support Tony Luck
2022-05-06 13:30           ` Thomas Gleixner
2022-05-06 18:49             ` Luck, Tony
2022-05-06 19:06               ` Thomas Gleixner
2022-05-06  1:40         ` [PATCH v6 09/11] platform/x86/intel/ifs: Add IFS sysfs interface Tony Luck
2022-05-06  1:40         ` [PATCH v6 10/11] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Tony Luck
2022-05-06  1:40         ` [PATCH v6 11/11] platform/x86/intel/ifs: add ABI documentation for IFS Tony Luck
2022-05-06 22:53         ` [PATCH v7 00/12] Introduce In Field Scan driver Tony Luck
2022-05-06 22:53           ` [PATCH v7 01/12] x86/microcode/intel: Expose collect_cpu_info_early() for IFS Tony Luck
2022-05-06 22:54           ` [PATCH v7 02/12] x86/msr-index: Define INTEGRITY_CAPABILITIES MSR Tony Luck
2022-05-06 22:54           ` [PATCH v7 03/12] stop_machine: Add stop_core_cpuslocked() for per-core operations Tony Luck
2022-05-06 22:54           ` [PATCH v7 04/12] platform/x86/intel/ifs: Add stub driver for In-Field Scan Tony Luck
2022-05-06 22:54           ` [PATCH v7 05/12] platform/x86/intel/ifs: Read IFS firmware image Tony Luck
2022-05-09 12:11             ` Thomas Gleixner
2022-05-06 22:54           ` [PATCH v7 06/12] platform/x86/intel/ifs: Check IFS Image sanity Tony Luck
2022-05-09 12:11             ` Thomas Gleixner
2022-05-09 16:31             ` Borislav Petkov
2022-05-09 16:51               ` Luck, Tony
2022-05-09 16:56                 ` Borislav Petkov
2022-05-06 22:54           ` [PATCH v7 07/12] platform/x86/intel/ifs: Authenticate and copy to secured memory Tony Luck
2022-05-09 12:11             ` Thomas Gleixner
2022-05-06 22:54           ` [PATCH v7 08/12] platform/x86/intel/ifs: Add scan test support Tony Luck
2022-05-09 12:11             ` Thomas Gleixner
2022-05-06 22:54           ` [PATCH v7 09/12] platform/x86/intel/ifs: Add IFS sysfs interface Tony Luck
2022-05-09 12:12             ` Thomas Gleixner
2022-05-06 22:54           ` [PATCH v7 10/12] trace: platform/x86/intel/ifs: Add trace point to track Intel IFS operations Tony Luck
2022-05-06 22:54           ` [PATCH v7 11/12] platform/x86/intel/ifs: add ABI documentation for IFS Tony Luck
2022-05-06 22:54           ` [PATCH v7 12/12] Documentation: In-Field Scan Tony Luck
2022-05-09 12:16             ` Thomas Gleixner
2022-05-11 15:51           ` [PATCH v7 00/12] Introduce In Field Scan driver Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220419163859.2228874-1-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jithu.joseph@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mingo@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.