From: "Tiwei Bie" <tiwei.btw@antgroup.com>
To: anton.ivanov@cambridgegreys.com, linux-um@lists.infradead.org
Cc: richard@nod.at, johannes@sipsolutions.net
Subject: Re: [PATCH v8] um: Enable preemption in UML
Date: Mon, 01 Apr 2024 19:04:42 +0800 [thread overview]
Message-ID: <39038eba-ecd7-4332-b7a0-bfd2c963f5ef@antgroup.com> (raw)
In-Reply-To: <20240328195038.1403093-1-anton.ivanov@cambridgegreys.com>
On 3/29/24 3:50 AM, anton.ivanov@cambridgegreys.com wrote:
[...]
> +
> +void kernel_fpu_begin(void)
> +{
> + preempt_disable();
> +
> + WARN_ON(this_cpu_read(in_kernel_fpu));
> +
> + this_cpu_write(in_kernel_fpu, true);
> +
> +#ifdef CONFIG_64BIT
> + if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVEOPT)))
> + __builtin_ia32_xsaveopt64(¤t_thread_info()->aux_fp_regs, KNOWN_387_FEATURES);
> + else if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVE)))
> + __builtin_ia32_xsave64(¤t_thread_info()->aux_fp_regs, KNOWN_387_FEATURES);
Only need two levels of indentation (i.e. two tabs) here.
> + else
> + __builtin_ia32_fxsave64(¤t_thread_info()->aux_fp_regs);
> +#else
> + if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVEOPT)))
> + __builtin_ia32_xsaveopt(¤t->aux_fp_regs, KNOWN_387_FEATURES);
> + else if (likely(cpu_has(&boot_cpu_data, X86_FEATURE_XSAVE)))
> + __builtin_ia32_xsave(¤t->aux_fp_regs, KNOWN_387_FEATURES);
Ditto.
> + else
> + __builtin_ia32_fxsave(¤t->aux_fp_regs);
> +#endif
> +}
> +EXPORT_SYMBOL_GPL(kernel_fpu_begin);
> +
[...]
>
> @@ -466,6 +475,8 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
>
> address &= PAGE_MASK;
>
> + preempt_disable();
> +
> pgd = pgd_offset(mm, address);
> if (!pgd_present(*pgd))
> goto kill;
> @@ -520,6 +531,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
>
> *pte = pte_mkuptodate(*pte);
>
> + preempt_enable();
> return;
>
> kill:
Preemption isn't enabled in the error path.
Regards,
Tiwei
next prev parent reply other threads:[~2024-04-01 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 19:50 [PATCH v8] um: Enable preemption in UML anton.ivanov
2024-04-01 11:04 ` Tiwei Bie [this message]
2024-04-01 11:06 ` Anton Ivanov
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=39038eba-ecd7-4332-b7a0-bfd2c963f5ef@antgroup.com \
--to=tiwei.btw@antgroup.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--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