Skip to content

c_stubs: use 'new' acquire and release runtime functions #6341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

psafont
Copy link
Member

@psafont psafont commented Mar 6, 2025

These functions have a more relevant name than the previous ones, especially with the advent of OCaml 5.0 the runtime lock becomes more important and programmers must be aware of it.

These functions were introduced in OCaml 3.12.

These functions have a more relevant name than the previous ones, especially
with the advent of OCaml 5.0 the runtime lock becomes more important and
programmers must be aware of it.

These functions were introduced in OCaml 3.12.

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Copy link
Contributor

@last-genius last-genius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not introduce any new problems so all good, but might just as well clean things up. I think @edwintorok has a pending PR doing this and more, but it hit some issues in testing, though.

Comment on lines 106 to 107
const char* const hashed =
crypt_r(String_val(key), String_val(setting), &cd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the fault of this (totally correct) commit, but these accesses to OCaml values should be brought out of this section.

@@ -47,7 +47,7 @@ CAMLprim value stub_openfile_direct(value filename, value rw, value perm){
flags |= O_RDONLY;
}
fd = open(filename_c, flags, Int_val(perm));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and above with Bool_val too

@@ -256,9 +256,9 @@ CAMLprim value stub_xenctrlext_physdev_map_pirq(value xch_val,
CAMLparam3(xch_val, domid, irq);
xc_interface *xch = xch_of_val(xch_val);
int pirq = Int_val(irq);
caml_enter_blocking_section();
caml_release_runtime_system();
int retval = xc_physdev_map_pirq(xch, Int_val(domid), pirq, &pirq);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -269,9 +269,9 @@ CAMLprim value stub_xenctrlext_assign_device(value xch_val, value domid,
{
CAMLparam4(xch_val, domid, machine_sbdf, flag);
xc_interface *xch = xch_of_val(xch_val);
caml_enter_blocking_section();
caml_release_runtime_system();
int retval = xc_assign_device(xch, Int_val(domid), Int_val(machine_sbdf), Int_val(flag));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -281,9 +281,9 @@ CAMLprim value stub_xenctrlext_deassign_device(value xch_val, value domid, value
{
CAMLparam3(xch_val, domid, machine_sbdf);
xc_interface *xc = xch_of_val(xch_val);
caml_enter_blocking_section();
caml_release_runtime_system();
int retval = xc_deassign_device(xc, Int_val(domid), Int_val(machine_sbdf));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@@ -299,9 +299,9 @@ CAMLprim value stub_xenctrlext_domain_soft_reset(value xch_val, value domid)
{
CAMLparam2(xch_val, domid);
xc_interface *xc = xch_of_val(xch_val);
caml_enter_blocking_section();
caml_release_runtime_system();
int retval = xc_domain_soft_reset(xc, Int_val(domid));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same and below

@psafont
Copy link
Member Author

psafont commented Mar 6, 2025

a pending PR doing this and more, but it hit some issues in testing, though.

Then I think it's worth leaving the changes to that PR

@psafont psafont added this pull request to the merge queue Mar 6, 2025
Merged via the queue into xapi-project:master with commit 8ca8328 Mar 6, 2025
17 checks passed
@psafont psafont deleted the release-acquire branch March 6, 2025 11:58
@andyhhp
Copy link
Collaborator

andyhhp commented Mar 6, 2025

The Ocaml libraries in upstream Xen look like they need the same treatment. (We're going to need to take the plunge on Ocaml-5-ing them at some point)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants