[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/mm: slightly relax TLB-flush-local check again
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Fri, 29 Apr 2022 13:32:08 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PQCU5W/XQD8n875J67ZnsOMiXLk2xOSxnSLeiIlvM8c=; b=AY4GUapjOc6+eiUE1meabYSKsPdYNctGDsr1zW2D1NitO6quRxz3jbJRITSvMxUnVzt9Gxmz/lZliqVwn/kx6srUtLlDPLinbUZzht2ph/vM9cYmqMDb4Xm/yGSLxeE8DTcmETRwhPwsa3G3gUgsF5Rs4FdCzJhsQhhpLBALsVEdf0gURQRqJcl+h5l+YHEd/gkhX/aglv6a6fGblu+872AqE8EiCr69KQX94is0T4Rodt8SRIGGVIbUc/t6PJVSINIESlg6mSZaIcw12qEl12CPIjYprdDikyE/2QmWsc9yyJZyCQ/v+V0HgZz3l/0JnDTwu2rNS0yZYZ6jBBXApw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lMjgqo9j6ct2ng95QjtdKQ26crI4AJNKY9O8iWjIMm76SoK5DZTk4+Yz3MilNY9My6WGOEarukvuXA8xHaIRO5hbaDpjC/AH0Ijwdav4O/KviYsYREkI3KAOzul6QQgCUP7xWFHEzPpMBDIBeBqbEXqm0oASkiFXkjS8JLZhntWZNPC2Xmi6u6SImndw0nu6deIGxCba8lZg5ZJuZh48GIJ0p+3IVRBTc4DQoF4UDpZzJg9HFryxIRQb/nFuPpftStO75xqhKJe4NqIjSybvq2Zo+Rlhe60qXnyMjAqSlglbsSLWnuD/KoYQZFQhg7jXOAx2yCo6yGHmKCfYwIF4sQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxx>
- Delivery-date: Fri, 29 Apr 2022 13:32:22 +0000
- Ironport-data: A9a23:mmXQv6OBAx8EUKPvrR2qlsFynXyQoLVcMsEvi/4bfWQNrUoi0DdVn WcfCz2EOvqKZzeme4x0Od6+8UMFv5eEz4AwHgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFYMpBsJ00o5wbZl2N8w2rBVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Z1 vtkk8eMTSoQF6Ts2+4WEAFiKj17BPgTkFPHCSDXXc276WTjKiKp79AwSUY8MMsf5/p9BnxI+ boAMjcRYxufhuWwhrWmVu1rgcdlJ87uVG8dkig4kXeFUrB7HtaaHPmiCdxwhV/cguhnG/rEa tVfQj1odBnaODVEO0sNCYJ4l+Ct7pX6W2IC9gPK+vZni4TV5BRJ/J7pbfvWRoK1XsRfoUexr Fzg23usV3n2M/Tak1Jp6EmEhOXCgCf6U4I6D6Cj+7hhh1j77nweDlgaWEW2pdG9i1WiQJRPJ koM4C0soKMuskuxQbHVQBmQsHOC+BkGVLJ4H/Mg4QuAzoLf6gCFD2JCSDNdAOHKr+czTD0uk 1OMwdXgAGU2tKXPEC3BsLCJsTm1JC4Za3cYYjMJRhcE5N+lp5wvihXITZBoF6vdYsDJJAwcC gui9EAW74j/R+ZQv0ln1TgrWw6Rm6U=
- Ironport-hdrordr: A9a23:+JDPBaj/CNL4jMOlhxpnTdtdxXBQX4p23DAbv31ZSRFFG/FwyP rCoB1L73XJYWgqM03IwerwQ5VpQRvnhP1ICRF4B8bsYOCUghrTEGgE1/qt/9SAIVyzygc578 tdmsdFebrN5DRB7PoSpTPIa+rIo+P3sZxA592uqUuFJDsCA84P0+46MHfjLqQcfnglOXNNLu v52iMxnUvERZ14VKSGL0hAe9KGi8zAlZrgbxJDLQUg8hOygTSh76O/OwSE3z8FOgk/gosKwC zgqUjU96+ju/a0xlv3zGnI9albn9Pn159qGNGMsM4IMT/h4zzYJriJGofy+Qzdktvfr2rCo+ O85SvI+P4Dsk85S1vF5ScFHTOQiArGpUWSkmNwykGT3PARDAhKd/apw7gpMicxonBQwu2Vms hwrh2knosSAhXakCvn4d/UExlsi0qvuHIn1fUelnpFTOIlGfRsRKEkjQpo+a07bWrHAUEcYZ xTJdCZ4OwTfUKRbnjfsGUqyNuwXm4rFhPDRkQZoMSa3zVfgXg8liIjtYEit2ZF8Ih4R4hP5u zCPKgtnLZSTtUOZaY4AOsaW8O4BmHEXBqJOmOPJlbsEr0BJhv22tTKyaRw4PvvdI0DzZM0lp iEWFREtXQqc0arEsGK1I0jyGG6fI3wNg6duP22J6IJzYEUaICbQRFrEmpe4vdIi89vcfHzSr K0JI9cBePlIC/nBZtJtjeOL6VvFQ==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYW8v8fFOL6ISSr0eHNQGjo+Jqyq0G43KA
- Thread-topic: [PATCH] x86/mm: slightly relax TLB-flush-local check again
On 29/04/2022 14:20, Jan Beulich wrote:
> system_state changes to SYS_STATE_smp_boot before alternative_branches()
> is invoked, yet that function, with CET-SS enabled, needs to invoke
> modify_xen_mappings(). Convert to check for the number of online CPUs,
> just like was done also in 88a037e2cfe1 / fa6dc0879ffd ("page_alloc:
> assert IRQs are enabled in heap alloc/free", both instance of which
> needed reverting for other reasons).
>
> Fixes: 78e072bc3750 ("x86/mm: avoid inadvertently degrading a TLB flush to
> local only")
> Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Only build-tested, as I don't have suitable hardware at hand.
I'll give it a test in just a moment, and while semantically I think
it's probably right, I don't think we want to express the logic like this.
num_online_cpus() is cpumask_weight(&cpu_online_map) behind the scenes
which is obnoxiously expensive for what we want.
For cases where we care just about UP vs SMP-ness, can't we just have an
bool which is re-evaluated each time we take a CPU online/offline? That
should be far lower overhead.
~Andrew
|