[PATCH v1] tools/ocaml: fix warnings

2024-03-27 Thread Edwin Török
Do not rely on the string values of the `Failure` exception, but use the `_opt` functions instead. Signed-off-by: Edwin Török --- tools/ocaml/xenstored/config.ml | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/ocaml/xenstored/config.ml b/tools

[PATCH v1 1/2] oxenstored: use Map instead of Hashtbl for quotas

2024-01-31 Thread Edwin Török
, and a better fit for the immutable xenstore tree. Signed-off-by: Edwin Török --- tools/ocaml/xenstored/quota.ml | 65 ++ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/tools/ocaml/xenstored/quota.ml b/tools/ocaml/xenstored/quota.ml index 300d78a50b

[PATCH v1 0/2] reduce oxenstored quota processing overhead under load

2024-01-31 Thread Edwin Török
the speedup, but thought to send out the patch for review early. Edwin Török (2): oxenstored: use Map instead of Hashtbl for quotas oxenstored: make Quota.t pure tools/ocaml/xenstored/quota.ml | 65 ++ tools/ocaml/xenstored/store.ml | 17 + 2 files

[PATCH v1 2/2] oxenstored: make Quota.t pure

2024-01-31 Thread Edwin Török
Now that we no longer have a hashtable inside we can make Quota.t pure, and push the mutable update to its callers. Store.t already had a mutable Quota.t field. No functional change. Signed-off-by: Edwin Török --- tools/ocaml/xenstored/quota.ml | 8 tools/ocaml/xenstored/store.ml

[PATCH v1 1/2] oxenstored: fix build on OCaml 5.x

2024-01-31 Thread Edwin Török
for OCaml <4.03) Signed-off-by: Edwin Török --- tools/configure | 2 +- tools/configure.ac| 2 +- tools/ocaml/xenstored/disk.ml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/configure b/tools/configure index 0135a0059a..5723efaa56 100

[PATCH v1 0/2] tools/ocaml: support OCaml 5.x, drop support for <=4.05

2024-01-31 Thread Edwin Török
/-/pipelines/1158302827 Edwin Török (2): oxenstored: fix build on OCaml 5.x tools/ocaml: bump minimum version to OCaml 4.05 tools/configure | 2 +- tools/configure.ac| 2 +- tools/ocaml/xenstored/disk.ml | 2 +- 3 files changed, 3 insertions(+), 3 deletions

[PATCH v1 2/2] tools/ocaml: bump minimum version to OCaml 4.05

2024-01-31 Thread Edwin Török
-off-by: Edwin Török --- tools/configure| 2 +- tools/configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/configure b/tools/configure index 5723efaa56..3d557234b3 100755 --- a/tools/configure +++ b/tools/configure @@ -6836,7 +6836,7 @@ else

[RFC PATCH 20/22] x86/PMUv5: limit available fixed PMCs and enable support

2023-10-25 Thread Edwin Török
From: Edwin Török AnyThread deprecation means a bit in 0xa edx, which we pass through. (we could also avoid doing the anythread masking, but we need that for version <= 4 support). Fixed Counter enumeration means we need to limit fixed counters if we hide any. Domain separation ne

[RFC PATCH 22/22] x86/AMD: add IRPerf support

2023-10-25 Thread Edwin Török
From: Edwin Török Instruction retired perf counter, enabled by writing to a bit in HWCR. Signed-off-by: Edwin Török --- xen/arch/x86/include/asm/msr-index.h| 1 + xen/arch/x86/msr.c | 7 +++ xen/include/public/arch-x86/cpufeatureset.h | 2 +- 3 files

[RFC PATCH 18/22] x86/PMUv4: disable intercept for PERF_GLOBAL_STATUS

2023-10-25 Thread Edwin Török
From: Edwin Török Now that we have a way to set PERF_GLOBAL_STATUS by writing to PERF_GLOBAL_STATUS_RESET (== PERF_GLOBAL_OVF_CTRL) and PERF_GLOBAL_STATUS_SET we do not need to intercept this MSR anymore. We can save/restore its state when saving/loading vPMU state, and otherwise let the guest

[RFC PATCH 21/22] x86/AMD: fix CPUID for PerfCtr{4,5}

2023-10-25 Thread Edwin Török
From: Edwin Török These are available, but were hidden by CPUID previously. There are IR (all guests), NB and L2I (dom0 only) performance counters too that need to be implemented, add placeholder entries for them. Signed-off-by: Edwin Török --- xen/arch/x86/cpu-policy.c

[RFC PATCH 16/22] x86/PMUv4: support LBR_Frz and CTR_Frz

2023-10-25 Thread Edwin Török
From: Edwin Török The behaviour is changed from Legacy to Streamlined for the LBR and PERFMON freeze bits. See "17.4.7 Freezing LBR and Performance Counters on PMI". Instead of clearing the freeze bits through DEBUGCTL they are now cleared through MSR 0x390 like everything else.

[RFC PATCH 14/22] x86/msr: RO MSR_TURBO_RATIO_LIMIT{,1,2}, MSR_TEMPERATURE_TARGET

2023-10-25 Thread Edwin Török
From: Edwin Török Expose MSR_TURBO_RATIO_LIMIT{,1,2} and MSR_TEMPERATURE_TARGET to guest as RO. Although these are not architectural MSRs they are in the same place currently on all supported CPUs. They also have the same meaning, except for 06_55H and 06_5C where they have a different meaning

[RFC PATCH 15/22] x86/VPMU: use macros for max supported VPMU version

2023-10-25 Thread Edwin Török
From: Edwin Török This ensures consistency between the 2 pieces of code that check for VPMU version. No functional change. Signed-off-by: Edwin Török --- xen/arch/x86/cpu/vpmu_intel.c | 20 ++-- xen/arch/x86/include/asm/vpmu.h | 1 + 2 files changed, 7 insertions(+), 14

[RFC PATCH 11/22] x86/PMUv2: freeze support in IA32_DEBUGCTL

2023-10-25 Thread Edwin Török
From: Edwin Török This is not yet exposed by HVM policies, but PMU version 2 requires that if PDCM is supported in CPUID then these 2 bits would work. Signed-off-by: Edwin Török --- xen/arch/x86/hvm/vmx/vmx.c | 4 xen/arch/x86/include/asm/msr-index.h | 4 +++- 2 files changed

[RFC PATCH 02/22] x86/msr: implement MSR_SMI_COUNT for Dom0 on Intel

2023-10-25 Thread Edwin Török
From: Edwin Török Dom0 should always be able to read this MSR: it is useful when investigating performance issues in production. Although the count is Thread scoped, in practice all cores were observed to return the same count (perhaps due to implementation details of SMM), so do not require

[RFC PATCH 19/22] x86/PMUv4: bump max PMU version to 4

2023-10-25 Thread Edwin Török
From: Edwin Török Depends on the other x86/PMUv4 patches: "x86/PMUv4: disable intercept for PERF_GLOBAL_STATUS" "x86/PMUv4: IA32_PERF_GLOBAL_{STATUS_SET, INUSE} support" "x86/PMUv4: support LBR_Frz and CTR_Frz" Signed-off-by: Edwin Török --- xen/arch/x86/inc

[RFC PATCH 12/22] x86/msr-index: define more architectural MSRs

2023-10-25 Thread Edwin Török
From: Edwin Török Add most architectural MSRs, except those behind CPUID features that are not yet implemented, such as TME, SGX. Based on "2.1 Architectural MSRs" of Intel SDM volume 4 Signed-off-by: Edwin Török --- xen/arch/x86/include/asm/msr-index.h | 54 +

[RFC PATCH 05/22] x86/PMUv1: report correct information in 0xa CPUID

2023-10-25 Thread Edwin Török
From: Edwin Török The 0xa CPUID leaf has to report supported number of: - fixed performance counters - general purpose performance counters - architectural predefined events And the PMU version (which was already limited to 3). Type punning is used, which should be safe due to -fno-strict

[RFC PATCH 01/22] x86/msr: MSR_PLATFORM_INFO shouldn't claim that turbo is programmable

2023-10-25 Thread Edwin Török
From: Edwin Török Xen forbids writes to the various turbo control MSRs, however MSR_PLATFORM_INFO claims that these MSRs are writable. Override MSR_PLATFORM_INFO bits to indicate lack of support. See Intel SDM Volume 4, 2.17.6 "MSRs Introduced in the Intel Xeon Scaslable Processor F

[RFC PATCH 07/22] x86/PMUv1: allow topdown slots arch perf event

2023-10-25 Thread Edwin Török
From: Edwin Török This is part of 'Architectural Performance Monitoring Version 1' and implemented on Icelake. Backport: 4.13+ Signed-off-by: Edwin Török --- xen/arch/x86/cpu/vpmu_intel.c | 1 + xen/arch/x86/cpuid.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git

[RFC PATCH 09/22] x86/PMUv1: consistently use 8 perf counters in Dom0

2023-10-25 Thread Edwin Török
From: Edwin Török The code is currently inconsistent: supports 4 on read and 8 on write. Sandy Bridge+ supports 8 of these, and the MSR range is architecturally reserved, so always support 8. Make it a macro to ensure we use the same value everywhere. Although DomUs are now restricted to only

[RFC PATCH 13/22] x86/vpmu: expose PDCM and IA32_PERF_CAPABILITIES when vpmu is enabled

2023-10-25 Thread Edwin Török
From: Edwin Török Marked as exposed by default, but then hidden if vpmu is not available. TODO: the interaction between vpmu and policy might need some changes. Only expose LBR and the full-width MSR capabilities, and not PEBS. Backport: 4.15+ Signed-off-by: Edwin Török --- xen/arch/x86/cpu

[RFC PATCH 17/22] x86/PMUv4: IA32_PERF_GLOBAL_{STATUS_SET, INUSE} support

2023-10-25 Thread Edwin Török
From: Edwin Török Expose thse MSRs to the guest when PMU version is >= 4. Signed-off-by: Edwin Török --- xen/arch/x86/cpu/vpmu_intel.c | 20 +++- xen/arch/x86/hvm/vmx/vmx.c | 5 + xen/arch/x86/pv/emul-priv-op.c | 5 + 3 files changed, 29 insertions(+)

[RFC PATCH 10/22] x86/PMUv2: limit number of fixed perf counters to 3

2023-10-25 Thread Edwin Török
From: Edwin Török There are only 3 architectural fixed function counters defined, however Icelake introduces a 4th. So we'll need to report the number of fixed counter implemented in CPUID correctly for Icelake, define a macro to ensure we are consistent about which counter is last. Note

[RFC PATCH 06/22] x86/PMUv1: limit arch PMCs to 4 for non-Dom0

2023-10-25 Thread Edwin Török
From: Edwin Török Only PERFEVTSEL{0-3} are architectural MSRs and Thread scoped. PERFEVTSEL{4-7} are Core scoped, and we cannot allow using them if more than 1 guest can attempt to modify them: if they program them with different events (quite likely when multiplexing) then one of the VMs would

[RFC PATCH 08/22] x86/PMUv1: define macro for max number of events

2023-10-25 Thread Edwin Török
From: Edwin Török This is needed so we can expose the maximum supported in CPUID, without cpuid.c and vpmu_intel.c going out of sync. The macros defined here take a parameter that controls how the enum values are used: either to generate case statements or to count how many elements we have

[RFC PATCH 04/22] x86/msr-index: add references to vendor manuals

2023-10-25 Thread Edwin Török
From: Edwin Török To more easily lookup the semantics of these MSRs add references to vendor manuals. Signed-off-by: Edwin Török --- xen/arch/x86/include/asm/msr-index.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86

[RFC PATCH 00/22] vPMU bugfixes and support for PMUv5

2023-10-25 Thread Edwin Török
be backported. Edwin Török (22): x86/msr: MSR_PLATFORM_INFO shouldn't claim that turbo is programmable x86/msr: implement MSR_SMI_COUNT for Dom0 on Intel x86/msr: always allow a pinned Dom0 to read any unknown MSR x86/msr-index: add references to vendor manuals x86/PMUv1: report correct

[RFC PATCH 03/22] x86/msr: always allow a pinned Dom0 to read any unknown MSR

2023-10-25 Thread Edwin Török
From: Edwin Török This can be useful if you realize you have to inspect the value of an MSR in production, without having to change into a new Xen first that handles the MSR. E.g. SMI count didn't use to be explicitly allowed in the past (it now is, see a previous commit), but there could

[PATCH] tools/ocaml/Makefile.rules: use correct C flags when compiling OCaml C stubs

2023-10-25 Thread Edwin Török
From: Edwin Török The code currently uses GCC to compile OCaml C stubs directly, and although in most cases this works, it is not entirely correct. This will fail if the OCaml runtime has been recompiled to use and link with ASAN for example (or other situations where a flag needs to be used

[PATCH] xenstored: do not redirect stderr to /dev/null

2023-10-25 Thread Edwin Török
From: Edwin Török By default stderr gets redirected to /dev/null because oxenstored daemonizes itself. This must be a left-over from pre-systemd days. In ee7815f49f ("tools/oxenstored: Set uncaught exception handler") a workaround was added to log exceptions directly to sysl

[PATCH] xenctrl_stubs.c: fix NULL dereference

2023-07-13 Thread Edwin Török
From: Edwin Török `Tag_cons` is `0` and is meant to be used as the tag argument for `caml_alloc`/`caml_alloc_small` when constructing a non-empty list. The empty list is `Val_emptylist` instead (which is really just `Val_int(0)`). Assigning `0` to a list value like this is equivalent

[PATCH v1 0/2] fix memory leaks reported by GCC -fanalyzer

2023-02-24 Thread Edwin Török
From: Edwin Török Using GCC 12.2.1 with -fanalyzer it has shown some memory leaks: This is how I enabled -fanalyzer (adding it to CFLAGS for toplevel configure didn't seem to work): ``` CFLAGS += $(call cc-option,$(CC),-fanalyzer) ``` Note that there are more errors shown than fixed here

[PATCH v1 1/2] xc_core_arch_map_p2m_tree_rw: fix memory leak

2023-02-24 Thread Edwin Török
From: Edwin Török Prior to bd7a29c3d0 'out' would've always been executed and memory freed, but that commit changed it such that it returns early and leaks. Found using gcc 12.2.1 `-fanalyzer`: ``` xg_core_x86.c: In function ‘xc_core_arch_map_p2m_tree_rw’: xg_core_x86.c:300:5: error: leak

[PATCH v1 2/2] backup_ptes: fix leak on realloc failure

2023-02-24 Thread Edwin Török
From: Edwin Török >From `man 2 realloc`: `If realloc() fails, the original block is left untouched; it is not freed or moved.` Found using GCC -fanalyzer: ``` | 184 | backup->entries = realloc(backup-&g

[PATCH v4 02/11] tools/ocaml/xenstored/Makefile: use ocamldep -sort for linking order

2022-12-16 Thread Edwin Török
was used as a build system this wouldn't be a problem, but we can't use Dune yet due to OSSTest, which is stuck on Debian oldstable. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion in 4.17: Avoids having to put this patch as a prerequisite

[PATCH v4 07/11] fixup! tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free

2022-12-16 Thread Edwin Török
Fix unused value warning. Fixes: 8b3c06a3e5 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free") Signed-off-by: Edwin Török Cc: Andrew Cooper --- Changes: * new patch --- tools/ocaml/libs/xc/xenctrl.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t

[PATCH v4 11/11] tools/ocaml/libs/xb: drop Xs_ring.write

2022-12-16 Thread Edwin Török
it to the ring, so the C stub should implement the read-only string version, and if needed we could use Bytes.unsafe_to_string to be able to send 'bytes'. However that is not necessary as the 'bytes' version is dropped above. Signed-off-by: Edwin Török --- Changes: * new patch --- tools/ocaml/libs/xb

[PATCH v4 10/11] tools/ocaml/xenstored: validate config file before live update

2022-12-16 Thread Edwin Török
that the config file is valid *for the new binary*. For compatibility with running old code during live update recognize --live --help as an equivalent to --config-test. Signed-off-by: Edwin Török --- Changes since v2: * repost of lost patch from 2021: https://patchwork.kernel.org/project/xen-devel

[PATCH v4 03/11] CODING_STYLE(tools/ocaml): add 'make format' and remove tabs

2022-12-16 Thread Edwin Török
change code too much for 4.17. This avoids perpetuating a formatting style that is inconsistent with the rest of Xen, and that makes preparing and submitting patches more difficult (OCaml indentation tools usually only support spaces, not tabs). No functional change. Signed-off-by: Edwin Török

[PATCH v4 05/11] CODING-STYLE(tools/ocaml): add .editorconfig to clarify indentation uses spaces

2022-12-16 Thread Edwin Török
not (want to) use it. It also won't cause re-indentation of existing files when edited, only newly added lines would follow the convention. No functional change. Signed-off-by: Edwin Török Cc: Christian Lindig --- .editorconfig | 20 1 file changed, 20 insertions(+) create mode

[PATCH v4 09/11] tools/ocaml/libs/xb: check for unmapped ring before accessing it

2022-12-16 Thread Edwin Török
to release before destroying the domain. Signed-off-by: Edwin Török --- Changes: * new patch --- tools/ocaml/libs/xb/xs_ring_stubs.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c index

[PATCH v4 00/11] OCaml fixes

2022-12-16 Thread Edwin Török
From: Edwin Török Various OCaml fixes, some of which got Acked already. Note: the Data_abstract_val got Acked but not yet commited because we thought there might be a better way with finalizers/etc. It is not possible to use finalizers here but there is a new followup patch in this series

[PATCH v4 01/11] tools/ocaml/libs/{xb, mmap}: use Data_abstract_val wrapper

2022-12-16 Thread Edwin Török
will add use-after-free detection instead. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion in 4.17: - make code follow best practice for upcoming OCaml 5.0 compiler (already in beta) Changes since v2: - add Acked-by line Changes since v3

[PATCH v4 08/11] tools/ocaml/libs/mmap: mark mmap/munmap as blocking and raise Unix_error on failure

2022-12-16 Thread Edwin Török
These functions can potentially take some time, so allow other OCaml code to proceed meanwhile (if any). Also raise a Unix_error based on `errno` if `mmap` fails, instead of just calling failwith (which would lose the error reason). Signed-off-by: Edwin Török --- Changes since v2: * repost

[PATCH v4 06/11] tools/ocaml: add .clang-format

2022-12-16 Thread Edwin Török
infrequently, so shouldn't cause issues with backporting security fixes (could either backport the reindentation patch too, or use git cherry-pick with `-Xignore-space-change`) Does not yet reformat any code. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Changes

[PATCH v2 4/4] tools/ocaml: add .clang-format

2022-12-02 Thread Edwin Török
infrequently, so shouldn't cause issues with backporting security fixes (could either backport the reindentation patch too, or use git cherry-pick with `-Xignore-space-change`) Does not yet reformat any code. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Changes

[PATCH v2 2/4] tools/ocaml/libs/xc: add binding to xc_evtchn_status

2022-12-02 Thread Edwin Török
the underlying API directly. Signed-off-by: Edwin Török --- Changes since v1: * drop paragraph about where this is used * add comment about max port * use Xeneventchn.virq_t instead of int, add a dependency: xc -> eventchn * initialize struct without memset-ing first * use 2 CAMLreturn, I found an exam

[PATCH v2 1/4] CODING-STYLE: add .editorconfig to clarify indentation uses spaces

2022-12-02 Thread Edwin Török
not (want to) use it. It also won't cause re-indentation of existing files when edited, only newly added lines would follow the convention. No functional change. Signed-off-by: Edwin Török --- .editorconfig | 20 1 file changed, 20 insertions(+) create mode 100644 .editorconfig

[PATCH v2 3/4] tools/ocaml/libs/xc: add hvm_param_get binding

2022-12-02 Thread Edwin Török
be performed on the OCaml side on it. (this is not a new problem with this binding, but worth mentioning given the difference in types) Signed-off-by: Edwin Török --- Changes since v1: * drop accidental extra numbers in variant names * use 'val' instead of 'result' for local var * add binding

[PATCH v2 0/4] OCaml bindings for hvm_param_get and xc_evtchn_status

2022-12-02 Thread Edwin Török
Changes since v1: * dropped stdint.h patch, still being discussed on where to best fix it * addressed review comments (see individual patches' changes section) Edwin Török (4): CODING-STYLE: add .editorconfig to clarify indentation uses spaces tools/ocaml/libs/xc: add binding

[PATCH v1 2/5] tools/ocaml/libs/xc: add binding to xc_evtchn_status

2022-11-30 Thread Edwin Török
event channel port number from what it initially got booted with. The information provided here is similar to 'lstevtchn', but rather than parsing its output it queries the underlying API directly. Signed-off-by: Edwin Török --- tools/ocaml/libs/xc/xenctrl.ml | 14 +++ tools/ocaml/libs/xc

[PATCH v1 0/5] OCaml bindings for hvm_param_get and xc_evtchn_status

2022-11-30 Thread Edwin Török
. It doesn't yet reformat anything with it, just allows someone that submits patches to use it if desired (e.g. on new code). Edwin Török (5): CODING-STYLE: add .editorconfig to clarify indentation uses spaces tools/ocaml/libs/xc: add binding to xc_evtchn_status tools/ocaml/libs/xc: add

[PATCH v1 4/5] tools/ocaml/libs/xb: add missing stdint.h

2022-11-30 Thread Edwin Török
xs_wire.h fails to compile without this, and a slight rearrangement of header includes (e.g. by clang-format) could cause the file to fail to compile. Be more robust and include the needed header file. --- tools/ocaml/libs/xb/xenbus_stubs.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH v1 1/5] CODING-STYLE: add .editorconfig to clarify indentation uses spaces

2022-11-30 Thread Edwin Török
not (want to) use it. It also won't cause re-indentation of existing files when edited, only newly added lines would follow the convention. No functional change. Signed-off-by: Edwin Török --- .editorconfig | 20 1 file changed, 20 insertions(+) create mode 100644 .editorconfig

[PATCH v1 3/5] tools/ocaml/libs/xc: add hvm_param_get binding

2022-11-30 Thread Edwin Török
be performed on the OCaml side on it. (this is not a new problem with this binding, but worth mentioning given the difference in types) Signed-off-by: Edwin Török --- tools/ocaml/libs/xc/xenctrl.ml | 44 tools/ocaml/libs/xc/xenctrl.mli | 45

[PATCH v1 5/5] CODING_STYLE: add .clang-format

2022-11-30 Thread Edwin Török
define. Does not yet reformat any code. No functional change. Signed-off-by: Edwin Török --- tools/ocaml/.clang-format | 9 + 1 file changed, 9 insertions(+) create mode 100644 tools/ocaml/.clang-format diff --git a/tools/ocaml/.clang-format b/tools/ocaml/.clang-format new file mode

[[PATCH for-4.17 v1]] tools/ocaml/xenstored/xenstored.ml: fix incorrect scope

2022-11-10 Thread Edwin Török
otherwise have IO credit. Remove the debug line. Fixes: 42f0581a91 ("tools/oxenstored: Implement live update for socket connections") Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - bugfix for commit already in master Changes since v3: - new in v4 --- tools/ocaml

[PATCH] docs/process/sending-patches.pandoc: add a tip about using --trailer to collect Acked-by tags

2022-11-09 Thread Edwin Török
). Signed-off-by: Edwin Török --- docs/process/sending-patches.pandoc | 6 ++ 1 file changed, 6 insertions(+) diff --git a/docs/process/sending-patches.pandoc b/docs/process/sending-patches.pandoc index 2e74c3b57e..90ac7b6cf1 100644 --- a/docs/process/sending-patches.pandoc +++ b/docs

[PATCH for-4.17 v3 10/15] tools/ocaml/xenstored: keep eventchn FD open across live update

2022-11-08 Thread Edwin Török
handle that case by reopening the evtchn as a fallback. A followup commit will avoid rebind the guest remote port (we cannot rely on the remote port staying the same, e.g. the windows PV drivers change it) Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - fixes live update

[PATCH for-4.17 v3 14/15] tools/ocaml/xenstored/syslog_stubs.c: avoid potential NULL dereference

2022-11-08 Thread Edwin Török
If we are out of memory then strdup may return NULL, and passing NULL to syslog may cause a crash. Avoid this by using `caml_stat_strdup` which will raise an OCaml out of memory exception instead. This then needs to be paired with caml_stat_free. Signed-off-by: Edwin Török --- Reason

[PATCH for-4.17 v3 12/15] tools/ocaml/xenstored: log live update issues at warning level

2022-11-08 Thread Edwin Török
is warning, which means that problems during live update were not logged at all, unless you've changes oxenstored.conf prior to live-update. Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - makes live update issues debuggable (live update can be used to apply security updates to 4.17

[PATCH for-4.17 v3 11/15] tools/ocaml/xenstored: do not rebind event channels after live update

2022-11-08 Thread Edwin Török
See explanation in previous commit. This introduces a new field into the live update stream to retain both ports, and handles the missing value in a backward compatible way. Signed-off-by: Edwin Török --- Reason for inclusion 4.17: - fixes a bug in oxenstored live update, needed to make live

[PATCH for-4.17 v3 15/15] tools/ocaml/libs/xc: fix use of uninitialized memory in shadow_allocation_get

2022-11-08 Thread Edwin Török
bly uninitialized data. It might be desirable to change the x86 path in the hypervisor to return EINVAL, although that would require more testing in case it breaks somethig. But the bindings should be defensive anyway against bugs like this. Signed-off-by: Edwin Török --- Reason for inclusion in 4

[PATCH for-4.17 v3 13/15] tools/ocaml/xenstored: set uncaught exception handler

2022-11-08 Thread Edwin Török
error and oxenstored just disappears you'd want to know why. There has been at least one observed instance of a bug where oxenstored just disappeared inexplicably (it was believed due to an OOM exception). Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - avoids losing crucial

[PATCH for-4.17 v3 09/15] tools/ocaml/xenstored/store.ml: fix build error

2022-11-08 Thread Edwin Török
ecking; yet it is a good idea to use it once before publishing source code. Fixes: db471408edd46 "tools/ocaml/xenstored: Fix quota bypass on domain shutdown" Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - fixes a build error in a previous commit that is already in

[PATCH for-4.17 v3 01/15] tools/ocaml/libs/eventchn: do not leak event channels and OCaml 5.0 compat

2022-11-08 Thread Edwin Török
Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion in 4.17: - Fixes a runtime bug with upcoming OCaml 5.0 (already in beta) Changes since v2: - added Acked-by line - add 4.17 reason --- tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 29 +-- 1 file changed, 27

[PATCH for-4.17 v3 04/15] tools/ocaml/xenstored/Makefile: use ocamldep -sort for linking order

2022-11-08 Thread Edwin Török
was used as a build system this wouldn't be a problem, but we can't use Dune yet due to OSSTest, which is stuck on Debian oldstable. No functional change. Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: Avoids having to put this patch as a prerequisite into a security update. Earlier

[PATCH for-4.17 v3 00/15] OCaml fixes for Xen 4.17

2022-11-08 Thread Edwin Török
is no reason to keep the code as is (initially I thought it uses tabs to follow Xen style, but after reading CODING_STYLE I realized that is not true). It is very easy to verify that the patch changes nothing with `git diff -w`, or `git log -p -1`. Edwin Török (15): tools/ocaml/libs/eventchn: do

[PATCH for-4.17 v3 08/15] tools/ocaml/libs/evtchn: add xenevtchn_fdopen bindings

2022-11-08 Thread Edwin Török
Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - needed for a bugfix in a followup commit Changes since v2: - new in v3 --- tools/ocaml/libs/eventchn/xeneventchn.ml | 6 +++- tools/ocaml/libs/eventchn/xeneventchn.mli | 9 +- tools/ocaml/libs/eventchn

[PATCH for-4.17 v3 03/15] tools/ocaml/libs/{xb, mmap}: use Data_abstract_val wrapper

2022-11-08 Thread Edwin Török
more closely: https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head It also makes it clearer that these modules have been reviewed for compat with OCaml 5.0. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion in 4.17: - make code follow best

[PATCH for-4.17 v3 02/15] tools/ocaml/libs/xc: OCaml 5.0 compatibility

2022-11-08 Thread Edwin Török
Follow the manual to avoid naked pointers: https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head No functional change, except on OCaml 5.0 where it is a bugfix. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Reason for inclusion in 4.17: - bugfix for upcoming OCaml 5.0 compiler

[PATCH for-4.17 v3 05/15] tools/ocaml/Makefile.rules: do not run ocamldep on distclean

2022-11-08 Thread Edwin Török
Fixes: 2f2b76d47c5bcd9 ("tools/ocaml: do not run ocamldep during make clean") Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - addresses review comments received post commit Changes since v2: - add Fixes line - add 4.17 reason --- tools/ocaml/Makefile.rules | 2 +- 1 fi

[PATCH for-4.17 v3 06/15] tools/ocaml/Makefile.rules: hide -include on *clean

2022-11-08 Thread Edwin Török
Fixes: 2f2b76d47c5bcd9 ("tools/ocaml: do not run ocamldep during make clean") Signed-off-by: Edwin Török --- Reason for inclusion in 4.17: - addresses review comments received post commit Changes since v2: - add Fixes line - add 4.17 reason --- tools/ocaml/Makefile.rules | 4 ++

[[PATCH for-4.17 v1]] tools/ocaml/xenstored/store.ml: fix build error

2022-11-03 Thread Edwin Török
ecking; yet it is a good idea to use it once before publishing source code. Fixes: db471408edd46 "tools/ocaml/xenstored: Fix quota bypass on domain shutdown" Signed-off-by: Edwin Török --- tools/ocaml/xenstored/store.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) dif

[PATCH for-4.17 v1 0/2] xenctrl.ml: improve scalability of domain_getinfolist

2022-11-01 Thread Edwin Török
t the mapping from xenstore if not in the cache), but it looks like that improvement is not even needed if this function barely registers on a flamegraph now. P.S.: the mirage test VM is a very old PV version, at some point we'll repeat the test with a Solo5 based PVH one. Edwin Török (2): xen

[PATCH for-4.17 v1 2/2] xenctrl: use larger chunksize in domain_getinfolist

2022-11-01 Thread Edwin Török
of `domain_getinfolist` in a lot of places where info list is used, but that is another optimization. Signed-off-by: Edwin Török Tested-by: Pau Ruiz Safont --- tools/ocaml/libs/xc/xenctrl.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml

[PATCH for-4.17 v1 1/2] xenctrl.ml: make domain_getinfolist tail recursive

2022-11-01 Thread Edwin Török
ead of having pairs of 2 changing direction every time. Signed-off-by: Edwin Török Tested-by: Pau Ruiz Safont --- tools/ocaml/libs/xc/xenctrl.ml | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl

[PATCH for-4.17 v2] tools/ocaml/xenstored: fix live update exception

2022-10-21 Thread Edwin Török
Live Update") Signed-off-by: Edwin Török Acked-by: Christian Lindig Release-acked-by: Henry Wang --- tools/ocaml/xenstored/xenstored.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml index

[PATCH for-4.17] tools/ocaml/xenstored: fix live update exception

2022-10-20 Thread Edwin Török
Live Update") Signed-off-by: Edwin Török --- tools/ocaml/xenstored/xenstored.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml index fc90fcdeb5..3299fe73f7 100644 --- a/tools/ocaml/xenstored/xe

[PATCH v2 1/5] tools/ocaml/Makefile.rules: do not run ocamldep on distclean

2022-09-27 Thread Edwin Török
Signed-off-by: Edwin Török --- tools/ocaml/Makefile.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules index 0d3c6ac839..e0b9de34e4 100644 --- a/tools/ocaml/Makefile.rules +++ b/tools/ocaml/Makefile.rules @@ -44,7

[PATCH v2 2/5] tools/ocaml/Makefile.rules: hide -include on *clean

2022-09-27 Thread Edwin Török
Signed-off-by: Edwin Török --- tools/ocaml/Makefile.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules index e0b9de34e4..39ac260a4d 100644 --- a/tools/ocaml/Makefile.rules +++ b/tools/ocaml/Makefile.rules

[PATCH v2 4/5] tools/ocaml/libs/xc: OCaml 5.0 compatibility

2022-09-27 Thread Edwin Török
Follow the manual to avoid naked pointers: https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head No functional change, except on OCaml 5.0 where it is a bugfix. Signed-off-by: Edwin Török --- tools/ocaml/libs/xc/xenctrl_stubs.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions

[PATCH v2 3/5] tools/ocaml/libs/eventchn: do not leak event channels and OCaml 5.0 compat

2022-09-27 Thread Edwin Török
Signed-off-by: Edwin Török Acked-by: Christian Lindig --- tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 29 +-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c index f889a7a2e4..

[PATCH v2 0/5] tools/ocaml: build/compatibility fixes with OCaml 5.0 for Xen 4.17

2022-09-27 Thread Edwin Török
ers at all, and thus it doesn't have the checker either) It would be good to get this included in Xen 4.17, especially that it changes the internal ABI of xenctrl bindings. Edwin Török (5): tools/ocaml/Makefile.rules: do not run ocamldep on distclean tools/ocaml/Makefile.rules: hide -incl

[PATCH v2 5/5] tools/ocaml/libs/{xb, mmap}: use Data_abstract_val wrapper

2022-09-27 Thread Edwin Török
more closely: https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head It also makes it clearer that these modules have been reviewed for compat with OCaml 5.0. No functional change. Signed-off-by: Edwin Török --- tools/ocaml/libs/mmap/xenmmap_stubs.c | 2 +- tools/ocaml/libs/xb/xs_ring_stubs.c

[RFC PATCH] tools/configure: require OCaml >= 4.06.1 for oxenstored

2022-07-29 Thread Edwin Török
-compilation using Dune. The unikernel itself also uses Solo5 instead of MiniOS, so the OCaml code in stubdom/ is probably stale. Signed-off-by: Edwin Török Cc: Christian Lindig --- tools/configure| 2 +- tools/configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools

[PATCH v1 5/7] tools/ocaml: fix compiler warnings

2022-07-29 Thread Edwin Török
Fix compiler warning about: * unused value * ambiguous documentation comment * non-principal type inference (compiler version dependent) No functional change. Signed-off-by: Edwin Török --- tools/ocaml/xenstored/connection.ml | 2 +- tools/ocaml/xenstored/process.ml| 5 +++-- 2 files

[PATCH v1 4/7] tools/ocaml: Makefile to drive dune

2022-07-29 Thread Edwin Török
including external files. But could be generated by configure? LD_LIBRARY_PATH needs to be set, because even with -Wl,-rpath executables wouldn't be able to run using the just-built libraries, unless we'd also link all the transitive dependencies of libs. No functional change. Signed-off-by: Edwin Török

[PATCH v1 1/7] tools/ocaml/Makefile: do not run ocamldep during make clean

2022-07-29 Thread Edwin Török
Performance counter stats for 'make clean -j8 -s' (5 runs): 2.7325 +- 0.0138 seconds time elapsed ( +- 0.51% ) ``` No functional change. Signed-off-by: Edwin Török --- tools/ocaml/Makefile.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/ocaml/Makefile.rules b/tools

[PATCH v1 3/7] tools/ocaml/*/dune: dune based build system

2022-07-29 Thread Edwin Török
. Using version 2.1 of Dune build language here, because that is the one available in Ubuntu Focal (part of the CI here). No functional change. Signed-off-by: Edwin Török --- tools/.gitignore | 7 + tools/dune | 5 tools/dune-project | 1

[PATCH v1 6/7] tools/ocaml/libs/xb: hide type of Xb.t

2022-07-29 Thread Edwin Török
without breaking code that relies on it. No functional change. Signed-off-by: Edwin Török --- tools/ocaml/libs/xb/xb.ml | 3 +++ tools/ocaml/libs/xb/xb.mli | 9 ++--- tools/ocaml/xenstored/connection.ml | 8 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff

[PATCH v1 2/7] tools/ocaml/*/Makefile: generate paths.ml from configure

2022-07-29 Thread Edwin Török
. No functional change. Signed-off-by: Edwin Török --- tools/configure | 4 +++- tools/configure.ac| 2 ++ tools/ocaml/libs/xs/Makefile | 5 - tools/ocaml/libs/xs/paths.ml.in | 1 + tools/ocaml/xenstored/Makefile| 5 - tools/ocaml/xenstored/paths.ml.in | 4

[PATCH v1 7/7] tools/ocaml/libs/eventchn: do not leak event channels and OCaml 5.0 compat

2022-07-29 Thread Edwin Török
Signed-off-by: Edwin Török --- tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 29 +-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c index f889a7a2e4..c0d57e2954 100644 --- a/t

[PATCH v1 0/7] tools/ocaml code and build cleanups

2022-07-29 Thread Edwin Török
https://github.com/edwintorok/xen/compare/private/edvint/public?expand=1 Edwin Török (7): tools/ocaml/Makefile: do not run ocamldep during make clean tools/ocaml/*/Makefile: generate paths.ml from configure tools/ocaml/*/dune: dune based build system tools/ocaml: Makefile to drive dune

[PATCH v2] x86/msr: fix X2APIC_LAST

2022-07-26 Thread Edwin Török
, an architectural MSR. The new MSR in this range appears to have been introduced in Icelake, so this commit should be backported to Xen versions supporting Icelake. Backport: 4.13+ Signed-off-by: Edwin Török --- Notes: Changed since v1: * include version of Intel SDM where the change occured

[PATCH] x86/msr: fix X2APIC_LAST

2022-07-26 Thread Edwin Török
introduced in Icelake, so this commit should be backported to Xen versions supporting Icelake. Backport: 4.13+ Signed-off-by: Edwin Török --- xen/arch/x86/include/asm/msr-index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch

[PATCH] tools/ocaml/libs/xc: add OCaml stubs to query CPU policy

2021-06-18 Thread Edwin Török
to allow mixing declarations and code to simplify writing the stubs by using variable length arrays on the stack instead of allocating/freeing memory (which would require additional error-handling logic). Signed-off-by: Edwin Török --- tools/ocaml/libs/xc/Makefile| 2 +- tools/ocaml/libs

[PATCH v2 14/17] tools/ocaml: safer Xenmmap interface

2021-05-11 Thread Edwin Török
Xenmmap.mmap_interface is created from multiple places: * via mmap(), which needs to be unmap()-ed * xc_map_foreign_range * xengnttab_map_grant_ref Signed-off-by: Edwin Török --- tools/ocaml/libs/mmap/gnt.ml | 14 -- tools/ocaml/libs/mmap/gnt.mli | 3 ++- tools/ocaml/libs

  1   2   >