Excerpts from Bharata B Rao's message of August 5, 2021 5:24 pm: > Add asynchronous page fault support for pseries guests. > > 1. Setup the guest to handle async-pf > - Issue H_REG_SNS hcall to register the SNS region. > - Setup the subvention interrupt irq. > - Enable async-pf by updating the byte_b9 of VPA for each > CPU. > 2. Check if the page fault is an expropriation notification > (SRR1_PROGTRAP set in SRR1) and if so put the task on > wait queue based on the expropriation correlation number > read from the VPA. > 3. Handle subvention interrupt to wake any waiting tasks. > The wait and wakeup mechanism from x86 async-pf implementation > is being reused here. I don't know too much about the background of this. How much benefit does this give? What situations? Does PowerVM implement it? Do other architectures KVM have something similar? The SRR1 setting for the DSI is in PAPR? In that case it should be okay, it might be good to add a small comment in exceptions-64s.S. [...] > @@ -395,6 +395,11 @@ static int ___do_page_fault(struct pt_regs *regs, unsigned long address, > vm_fault_t fault, major = 0; > bool kprobe_fault = kprobe_page_fault(regs, 11); > > +#ifdef CONFIG_PPC_PSERIES > + if (handle_async_page_fault(regs, address)) > + return 0; > +#endif > + > if (unlikely(debugger_fault_handler(regs) || kprobe_fault)) > return 0; [...] > +int handle_async_page_fault(struct pt_regs *regs, unsigned long addr) > +{ > + struct async_pf_sleep_node n; > + DECLARE_SWAITQUEUE(wait); > + unsigned long exp_corr_nr; > + > + /* Is this Expropriation notification? */ > + if (!(mfspr(SPRN_SRR1) & SRR1_PROGTRAP)) > + return 0; Yep this should be an inline that is guarded by a static key, and then probably have an inline check for SRR1_PROGTRAP. You shouldn't need to mfspr here, but just use regs->msr. > + > + if (unlikely(!user_mode(regs))) > + panic("Host injected async PF in kernel mode\n"); Hmm. Is there anything in the PAPR interface that specifies that the OS can only deal with problem state access faults here? Or is that inherent in the expropriation feature? Thanks, Nick