[PATCH 1/2] examples: systemtap: Warn users to properly update 'amd-sev-es-vmsa.stp'

Peter Krempa posted 2 patches 1 year, 7 months ago
There is a newer version of this series
[PATCH 1/2] examples: systemtap: Warn users to properly update 'amd-sev-es-vmsa.stp'
Posted by Peter Krempa 1 year, 7 months ago
The script references a very specific line in the kernel source code and
thus may need to be updated to work properly. Add a warning into the
comment and also print it to warn users.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 examples/systemtap/amd-sev-es-vmsa.stp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/examples/systemtap/amd-sev-es-vmsa.stp b/examples/systemtap/amd-sev-es-vmsa.stp
index 551ed739b7..14bfb01c10 100644
--- a/examples/systemtap/amd-sev-es-vmsa.stp
+++ b/examples/systemtap/amd-sev-es-vmsa.stp
@@ -19,6 +19,9 @@
 # A script that captures the VMSA blob for the boot vCPU and
 # first additional vCPU, when a KVM guest is booted with SEV-ES
 #
+# NOTE: This directly references specific structures and places in the
+#       kernel source code. If the code changes this example will break.
+#
 # The captured VMSA will be printed to the console in hex format,
 # and can be converted to the required binary format by feeding
 # it through
@@ -27,6 +30,7 @@
 #

 probe begin {
+  printf("WARNING: Make sure this script is updated according to your kernel source!\n")
   printf("Running\n")
 }

-- 
2.39.2
Re: [PATCH 1/2] examples: systemtap: Warn users to properly update 'amd-sev-es-vmsa.stp'
Posted by Daniel P. Berrangé 1 year, 7 months ago
On Mon, Mar 06, 2023 at 11:21:53AM +0100, Peter Krempa wrote:
> The script references a very specific line in the kernel source code and
> thus may need to be updated to work properly. Add a warning into the
> comment and also print it to warn users.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  examples/systemtap/amd-sev-es-vmsa.stp | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/examples/systemtap/amd-sev-es-vmsa.stp b/examples/systemtap/amd-sev-es-vmsa.stp
> index 551ed739b7..14bfb01c10 100644
> --- a/examples/systemtap/amd-sev-es-vmsa.stp
> +++ b/examples/systemtap/amd-sev-es-vmsa.stp
> @@ -19,6 +19,9 @@
>  # A script that captures the VMSA blob for the boot vCPU and
>  # first additional vCPU, when a KVM guest is booted with SEV-ES
>  #
> +# NOTE: This directly references specific structures and places in the
> +#       kernel source code. If the code changes this example will break.

Replace "If the code changes this example will break" with

 "It is expected that this example will need to be editted
  to match the kenrel you intend to run it against."

>  # The captured VMSA will be printed to the console in hex format,
>  # and can be converted to the required binary format by feeding
>  # it through
> @@ -27,6 +30,7 @@
>  #
> 
>  probe begin {
> +  printf("WARNING: Make sure this script is updated according to your kernel source!\n")

I would expect it to generally fail to compile, so rarely would it
get as far as running this method. For the change you proposed in
the next match I would have expected a compile error.

>    printf("Running\n")
>  }
> 
> -- 
> 2.39.2
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|