Re: [PATCH 4/6] kernel: add support for TIF_NOTIFY_SIGNAL

Oleg Nesterov
2020-10-08T14:28:00Z

On 10/08, Jens Axboe wrote:
>
> On 10/8/20 7:53 AM, Oleg Nesterov wrote:
> >> --- a/kernel/entry/kvm.c
> >> +++ b/kernel/entry/kvm.c
> >> @@ -8,6 +8,9 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work)
> >> do {
> >> int ret;
> >>
> >> + if (ti_work & _TIF_NOTIFY_SIGNAL)
> >> + tracehook_notify_signal();
> >
> > Can't really comment this change, but to me it would be more safe to
> > simply return -EINTR.
> >
> > Or perhaps even better, treat _TIF_NOTIFY_SIGNAL and _TIF_SIGPENDING
> > equally:
> >
> > - if (ti_work & _TIF_SIGPENDING) {
> > + if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) {
> > kvm_handle_signal_exit(vcpu);
> > return -EINTR;
>
> Not sure I follow your logic here. Why treat it any different than
> NOTIFY_RESUME from this perspective?

Ah, good point, I din't notice that xfer_to_guest_mode_work() handles
TIF_NOTIFY_RESUME.

Thanks, then I think this change is fine.

Oleg.