From: Johannes Berg <johannes@sipsolutions.net>
To: anton.ivanov@cambridgegreys.com, linux-um@lists.infradead.org
Cc: richard@nod.at
Subject: Re: [PATCH v6] um: Enable preemption in UML
Date: Fri, 22 Sep 2023 13:22:55 +0200 [thread overview]
Message-ID: <389fbd9de31ccdaad52674b7de06312e57f2cd54.camel@sipsolutions.net> (raw)
In-Reply-To: <20230922105609.545573-1-anton.ivanov@cambridgegreys.com>
>
> 4. UML TLB flush is also invoked during a fork. This happens
> with interrupts and preempt disabled which disagrees with the
> standard mm locking via rwsem. The mm lock for this code path
> had to be replaced with an rcu.
For the record, even if I figured out this gets rid of the complaints,
I'm not entirely happy with this - yeah it's safe now, but it still
feels entirely wrong.
But I guess we can also do this and then remove it entirely like the
patch I just posted. Order probably doesn't matter much.
(Note my patch removes the locking completely since it's now invoked by
the kernel even under write mmap lock.)
> diff --git a/arch/um/kernel/fpu.c b/arch/um/kernel/fpu.c
> new file mode 100644
> index 000000000000..4817276b2a26
> --- /dev/null
> +++ b/arch/um/kernel/fpu.c
> +#ifdef CONFIG_64BIT
> + if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVEOPT)))
> + __builtin_ia32_xsaveopt64(¤t->thread.fpu, KNOWN_387_FEATURES);
> + else {
> + if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVE)))
> + __builtin_ia32_xsave64(¤t->thread.fpu, KNOWN_387_FEATURES);
> + else
> + __builtin_ia32_fxsave64(¤t->thread.fpu);
:)
OK, I'll stop mentioning it ;-)
> +EXPORT_SYMBOL_GPL(kernel_fpu_end);
> +
git am complained here about blank line at EOF
> @@ -597,8 +609,13 @@ void force_flush_all(void)
> struct vm_area_struct *vma;
> VMA_ITERATOR(vmi, mm, 0);
>
> - mmap_read_lock(mm);
> + /* We use a RCU lock instead of a mm lock, because
> + * this can be invoked out of critical/atomic sections
> + * and that does not agree with the sleepable semantics
> + * of the standard semaphore based mm lock.
> + */
> + rcu_read_lock();
Yeah I guess ... Seems like a very mechanical description of what's
going on, rather than a description of why this is correct (which
assumes no preempt and no SMP)?
I'd have preferred that, but with the patch I just posted we'll just
kill this entirely so it doesn't matter in the end.
johannes
_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2023-09-22 11:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 10:56 [PATCH v6] um: Enable preemption in UML anton.ivanov
2023-09-22 10:56 ` Anton Ivanov
2023-09-22 11:22 ` Johannes Berg [this message]
2023-09-22 11:55 ` Anton Ivanov
2023-09-22 20:40 ` Richard Weinberger
2023-09-22 11:59 ` Peter Lafreniere
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=389fbd9de31ccdaad52674b7de06312e57f2cd54.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=anton.ivanov@cambridgegreys.com \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox