-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Marek Marczykowski-Górecki:
> Applied, thanks!
> 
> There is (minor?) problem there - `xl dmesg` buffer size. After long
> system uptime, startup messages will no longer be there, especially
> after multiple sleep/resume cycles. This check is the only one affected,
> as it is the only one using `xl dmesg` output.
> Some solution would be to store `xl dmesg` output somewhere just after
> system startup. In fact it is logged in
> /var/log/xen/console/hypervisor.log, but that file is also rotated.
> 
> Anyway, it shouldn't be a big problem for qubes-hcl-report tool. And
> some workaround would be a check for early startup message in `xl dmesg`
> output, like "Xen version". And issue a warning if not found (suggesting
> retrying after reboot).

That's indeed a subtly bug. Attached patch checks for the "Xen version"
line in "xl dmesg" and warns otherwise.

While at it I also improved the log parsing.

> PS Nice trick with ${HAP^} substitution. Since the script has
> #!/bin/bash it's ok, but please remember to not use such bash-specific
> tricks in #!/bin/sh scripts.

In this case I actually cheked that it's bash. But yes, once you are
used to the bash features one quickly forget to check.
-----BEGIN PGP SIGNATURE-----

iQIsBAEBCgAWBQJXyN+fDxxodzQyQGlwc3Vtai5kZQAKCRDkrMknimRoFvMtD/0a
UKeYUK+TdCu3MW1VMw1JOwrD09MbGC4O3xCQrfZw5RLpdOtUfyfkFzCa235r1V9q
R6+XP1s3NW75jubblnSS/kl1MJj+jkQvuiwciaDkDxf3BJKNqGyeJwjgxCqMjFmN
fsjL4c7lsFD7jEs7Zu2NsdaUKwE8pLf+WH4h8VO5xTPySULKiReSjd3NniEP6uj9
5jRv7NO4u3dXaxY0S7qpMzhlYUk9bESfIPFieaXjmkyTnkBvsRN1JbGSCuE8/JQr
VmG0ZINkv5RbXX+Z28suN4TqUy3cu+rQEfVktphwAf0WD5AamJ7rY0tFR7W+W9H7
ICZY6vRMBU9sm6I4Sca8H3e1nKon+1UtcqblSPNhzXQjma7Fa0k/MzOfoiwU26kt
5g16RI7cokcO99xUT76ffjdR5pPTfeH/bJgton3UrzAvUfUDgp987L6ZMEZXS+Sa
f1SbBx2HgPsDlcNWFh/UVmW6CYU/gwfkV635fg7T9GTuxgN0RxmzhMwiZfYKcd9g
H1l+Mu8a1FRyUA28erH0ah9eLdcORe0ZF9BHNSDd1JWXIqOx+kj+wk4t3bi4GFL+
7aaX23s5KTnouJkKGsvahXNCqbSbl0uTVpGCM2NcTj4whR0+0SNtU2C+RVe9Kekl
5ceO55KidSIDhZ3zu/TtWpdte8bqm2lmjZRdOE2TLw==
=/L+D
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-devel/4bb1028f-4bf9-a41b-04b9-249ff759bb7a%40ipsumj.de.
For more options, visit https://groups.google.com/d/optout.
From 941f0973f5dc46fc4f2973613011c217f2d403e1 Mon Sep 17 00:00:00 2001
From: HW42 <[email protected]>
Date: Fri, 2 Sep 2016 03:17:11 +0200
Subject: [PATCH 1/2] qubes-hcl-report: SLAT detection: improve log parsing

---
 qvm-tools/qubes-hcl-report | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/qvm-tools/qubes-hcl-report b/qvm-tools/qubes-hcl-report
index b484f66..e8cd38e 100755
--- a/qvm-tools/qubes-hcl-report
+++ b/qvm-tools/qubes-hcl-report
@@ -22,6 +22,8 @@ VERSION=2.5
 COPY2VM="dom0"
 SUPPORT_FILES=0
 
+XL_DMESG_PREFIX_REGEX='^(XEN) \(\[[^]]*\] \)\?'
+
 while [ $# -gt 0 ]; do
   case "$1" in
 
@@ -101,7 +103,7 @@ XEN_EXTRA=`cat $TEMP_DIR/xl-info |grep xen_extra |cut -d: -f2 |tr -d ' '`
 QUBES=`cat $TEMP_DIR/qubes-release |cut -d '(' -f2 |cut -d ')' -f1`
 XL_VTX=`cat $TEMP_DIR/xl-info |grep xen_caps | grep hvm`
 XL_VTD=`cat $TEMP_DIR/xl-info |grep virt_caps |grep hvm_directio`
-XL_HAP=`cat $TEMP_DIR/xl-dmesg |grep 'HVM: Hardware Assisted Paging (HAP) detected'`
+XL_HAP=`cat $TEMP_DIR/xl-dmesg |grep "$XL_DMESG_PREFIX_REGEX"'HVM: Hardware Assisted Paging (HAP) detected\( but disabled\)\?$'`
 PCRS=`find /sys/devices/ -name pcrs`
 
 FILENAME="Qubes-HCL-${BRAND//[^[:alnum:]]/_}-${PRODUCT//[^[:alnum:]]/_}-$DATE"
@@ -130,8 +132,13 @@ fi
 
 if [ -n "$XL_HAP" ]; then
     HAP="yes"
+    HAP_VERBOSE="Yes"
+    if [[ "$XL_HAP" =~ "disabled" ]]; then
+        HAP_VERBOSE="Yes (disabled)"
+    fi
 else
     HAP="no"
+    HAP_VERBOSE="No"
 fi
 
 if [[ $PCRS ]]
@@ -159,7 +166,7 @@ echo -e "Net:\n$NET\n"
 echo -e "SCSI:\n$SCSI\n"
 echo -e "HVM:\t\t$VTX"
 echo -e "I/O MMU:\t$VTD"
-echo -e "HAP/SLAT:\t${HAP^}"
+echo -e "HAP/SLAT:\t$HAP_VERBOSE"
 echo -e "TPM:\t\t$TPM"
 echo
 
-- 
2.9.3

From 9fff22740ff4287492d29f731db1aeaf3db543c5 Mon Sep 17 00:00:00 2001
From: HW42 <[email protected]>
Date: Fri, 2 Sep 2016 04:00:34 +0200
Subject: [PATCH 2/2] qubes-hcl-report: check for incomplete 'xl dmesg'

---
 qvm-tools/qubes-hcl-report | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/qvm-tools/qubes-hcl-report b/qvm-tools/qubes-hcl-report
index e8cd38e..9344520 100755
--- a/qvm-tools/qubes-hcl-report
+++ b/qvm-tools/qubes-hcl-report
@@ -78,6 +78,13 @@ sudo dmidecode > $TEMP_DIR/dmidecode
 xl info > $TEMP_DIR/xl-info
 xl dmesg > $TEMP_DIR/xl-dmesg
 
+if cat $TEMP_DIR/xl-dmesg | grep "$XL_DMESG_PREFIX_REGEX"'Xen version ' > /dev/null; then
+    XL_DMESG_INCOMPLETE=no
+else
+    XL_DMESG_INCOMPLETE=yes
+    echo -e 'WARNING: "xl dmesg" is incomplete. Some information are missing. Please reboot and try again.\n'
+fi
+
 
 BRAND=`cat $TEMP_DIR/dmidecode |grep -A9 "System Information" |grep "Manufacturer:" |cut -d ' ' -f2-`
 PRODUCT=`cat $TEMP_DIR/dmidecode |grep -A9 "System Information" |grep "Product Name:" |cut -d ' ' -f3-`
@@ -130,7 +137,10 @@ if [[ $XL_VTD ]]
 
 fi
 
-if [ -n "$XL_HAP" ]; then
+if [ $XL_DMESG_INCOMPLETE = yes ]; then
+    HAP=""
+    HAP_VERBOSE='Unknown ("xl dmesg" incomplete)'
+elif [ -n "$XL_HAP" ]; then
     HAP="yes"
     HAP_VERBOSE="Yes"
     if [[ "$XL_HAP" =~ "disabled" ]]; then
-- 
2.9.3

Attachment: 0001-qubes-hcl-report-SLAT-detection-improve-log-parsing.patch.sig
Description: PGP signature

Attachment: 0002-qubes-hcl-report-check-for-incomplete-xl-dmesg.patch.sig
Description: PGP signature

Reply via email to