mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Joel Stanley <joel@jms.id.au>
Cc: linuxppc-dev@ozlabs.org, Michael Neuling <mikey@neuling.org>,
	peterz@infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	npiggin@gmail.com, Oliver O'Halloran <oohall@gmail.com>,
	Anton Blanchard <anton@samba.org>,
	Paul Mackerras <paulus@samba.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 07/11] powerpc/64s: Add support for RFI flush of L1-D cache
Date: Wed, 10 Jan 2018 03:05:11 +1100	[thread overview]
Message-ID: <87efmzkog8.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <CACPK8XfOyB8t+d9ALr38=akc9BKuxeA-b4jU5FqYPGPzGX4qjw@mail.gmail.com>

Joel Stanley <joel@jms.id.au> writes:

> On Mon, Jan 8, 2018 at 8:54 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> On some CPUs we can prevent the Meltdown vulnerability by flushing the
>> L1-D cache on exit from kernel to user mode, and from hypervisor to
>> guest.
>
> Super minor nitpicks below. Don't let this hold up your work.
>
>> --- a/arch/powerpc/kernel/exceptions-64s.S
>> +++ b/arch/powerpc/kernel/exceptions-64s.S
>> @@ -1449,6 +1449,88 @@ masked_##_H##interrupt:                                  \
>>         b       .;                                      \
>>         MASKED_DEC_HANDLER(_H)
>>
>> +TRAMP_REAL_BEGIN(rfi_flush_fallback)
>> +       SET_SCRATCH0(r13);
>> +       GET_PACA(r13);
>> +       std     r9,PACA_EXRFI+EX_R9(r13)
>> +       std     r10,PACA_EXRFI+EX_R10(r13)
>> +       std     r11,PACA_EXRFI+EX_R11(r13)
>> +       std     r12,PACA_EXRFI+EX_R12(r13)
>> +       std     r8,PACA_EXRFI+EX_R13(r13)
>> +       mfctr   r9
>> +       ld      r10,PACA_RFI_FLUSH_FALLBACK_AREA(r13)
>> +       ld      r11,PACA_L1D_FLUSH_SETS(r13)
>> +       ld      r12,PACA_L1D_FLUSH_CONGRUENCE(r13)
>> +       /*
>> +        * The load adresses are at staggered offsets within cachelines,
>> +        * which suits some pipelines better (on others it should not
>> +        * hurt.
>
> Nit: missing ) on the last line.

Thanks.

>> --- a/arch/powerpc/lib/feature-fixups.c
>> +++ b/arch/powerpc/lib/feature-fixups.c
>> @@ -116,6 +116,47 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
>>         }
>>  }
>>
>> +#ifdef CONFIG_PPC_BOOK3S_64
>> +void do_rfi_flush_fixups(enum l1d_flush_type types)
>> +{
>> +       unsigned int instrs[3], *dest;
>> +       long *start, *end;
>> +       int i;
>> +
>> +       start = PTRRELOC(&__start___rfi_flush_fixup),
>> +       end = PTRRELOC(&__stop___rfi_flush_fixup);
>> +
>> +       instrs[0] = 0x60000000; /* nop */
>> +       instrs[1] = 0x60000000; /* nop */
>> +       instrs[2] = 0x60000000; /* nop */
>> +
>> +       if (types & L1D_FLUSH_FALLBACK)
>
> This looked a bit confusing on first read. Do we ever get
> L1D_FLUSH_FALLBACK and the other types? If not, could it be made
> clearer?
>
>   if ( types & L1D_FLUSH_FALLBACK)
>       /* stuff */
>   else
>     /* other types */

Yeah that would make more sense.

I'm going to merge it as-is because that's whats been tested, and given
the time of day I'm likely to break it if I try and refactor it. So we
can clean it up once it's merged.

cheers

  reply	other threads:[~2018-01-09 16:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 16:54 [PATCH 01/11] powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper Michael Ellerman
2018-01-08 16:54 ` [PATCH 02/11] powerpc/64: Add macros for annotating the destination of rfid/hrfid Michael Ellerman
2018-01-08 16:54 ` [PATCH 03/11] powerpc/64s: Simple RFI macro conversions Michael Ellerman
2018-01-08 17:09   ` Peter Zijlstra
2018-01-08 21:01     ` Paul Mackerras
2018-01-08 22:04       ` Michael Ellerman
2018-01-08 16:54 ` [PATCH 04/11] powerpc/64: Convert the syscall exit path to use RFI_TO_USER/KERNEL Michael Ellerman
2018-01-08 16:54 ` [PATCH 05/11] powerpc/64: Convert fast_exception_return " Michael Ellerman
2018-01-08 16:54 ` [PATCH 06/11] powerpc/64s: Convert slb_miss_common " Michael Ellerman
2018-01-08 16:54 ` [PATCH 07/11] powerpc/64s: Add support for RFI flush of L1-D cache Michael Ellerman
2018-01-09  7:02   ` Joel Stanley
2018-01-09 16:05     ` Michael Ellerman [this message]
2018-01-25  9:10   ` Christian Zigotzky
2018-01-30  2:11     ` Michael Ellerman
2018-01-08 16:54 ` [PATCH 08/11] powerpc/64s: Support disabling RFI flush with no_rfi_flush and nopti Michael Ellerman
2018-01-08 16:54 ` [PATCH 09/11] powerpc/64s: Allow control of RFI flush via sysfs Michael Ellerman
2018-01-08 17:20   ` Thomas Gleixner
2018-01-08 22:09     ` Michael Ellerman
2018-01-09  6:06       ` Jon Masters
2018-01-09  8:05         ` Greg KH
2018-01-09  8:11           ` Jon Masters
2018-01-09  8:03   ` Greg KH
2018-01-08 16:54 ` [PATCH 10/11] powerpc/pseries: Query hypervisor for RFI flush settings Michael Ellerman
2018-01-08 16:54 ` [PATCH 11/11] powerpc/powernv: Check device-tree " Michael Ellerman
2018-01-08 21:57   ` Tyrel Datwyler
2018-01-11  2:25 ` [01/11] powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper Michael Ellerman

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=87efmzkog8.fsf@concordia.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=anton@samba.org \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=npiggin@gmail.com \
    --cc=oohall@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®