On 20.09.23 16:52, Peter Zijlstra wrote:
On Thu, Jun 08, 2023 at 04:03:33PM +0200, Juergen Gross wrote:Instead of stacking alternative and paravirt patching, use the new ALT_FLAG_CALL flag to switch those mixed calls to pure alternative handling. This eliminates the need to be careful regarding the sequence of alternative and paravirt patching. For call depth tracking callthunks_setup() needs to be adapted to patch calls at alternative patching sites instead of paravirt calls. Remove the no longer needed paravirt patching and related code.I think this becomes easier if you first convert the paravirt sites to alternatives, such that .parainstructions is empty, and then in a subsequent patch remove all the paravirt infrastructure that is unused.
Fine with me. Speaking of additional patches: any idea how the related objtool change(s) should look like? I suspect they are needed ...
+#define SAVE_FLAGS ALTERNATIVE_2 "PARA_IRQ_save_fl;", ALT_CALL_INSTR, \ + ALT_CALL_ALWAYS, "pushf; pop %rax;", \ + ALT_NOT(X86_FEATURE_XENPV)I find this more readable when written as: #define SAVE_FLAGS ALTERNATIVE_2 "PARA_IRQ_save_fl;", \ ALT_CALL_INSTR, ALT_CALL_ALWAYS, \ "pushf; pop %rax;", ALT_NOT(X86_FEATURE_XENPV) (and perhaps ALT_NOT_XEN is in order, there's a ton of those)
I like both suggestions.
If you base this on top of the nested alternative patches, another helper might be: #define __PV_ALTERNATIVE(old) __ALTERNATIVE(old, ALT_CALL_INSTR, ALT_CALL_ALWAYS) So that you can then write: #define SAVE_FLAGS __ALTERNATIVE(__PV_ALTERNATIVE("PARA_IRQ_save_fl;"), "pushf; pop %rax;", ALT_NOT_XEN) But perhaps I'm over-cooking things now..
I don't think this is needed for the single instance it is useful for. Juergen
Description: OpenPGP public key
Description: OpenPGP digital signature
_______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization