Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-27 Thread Tomasz Maciej Nowak
W dniu 26.04.2018 o 20:04, Stijn Segers pisze:
> Op di, 24 apr 2018 om 10:18 , schreef Tomasz Maciej Nowak :
>> W dniu 24.04.2018 o 22:00, Stijn Segers pisze:
>> [snip]
>
>   I'm not sure what's going wrong here, I'm on a clean master tree but 
> your first patch does not apply:
>
>   $ git am 1.patch
>   Applying: x86: add amd microcode entries to grub config
>   error: patch failed: 
> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
>   error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
> does not apply
>   error: patch failed: target/linux/x86/image/grub-iso.cfg:10
>   error: target/linux/x86/image/grub-iso.cfg: patch does not apply
>   error: patch failed: target/linux/x86/image/grub.cfg:10
>   error: target/linux/x86/image/grub.cfg: patch does not apply
>   Patch failed at 0001 x86: add amd microcode entries to grub config
>   $ ./scripts/getver.sh
>   r6755-d089a5d773
>

  Hi.

  I did wrongly spell myself out instead of "This series needs to be 
 applied on top of 'intel-microcode: load as early as possible' series." it 
 should be: "This series needs to be applied after 'intel-microcode: load 
 as early as possible' series.". Sorry about it.
>>>
>>>  Nope - turns out I was too quick, my apologies :-(. I merely looked at 
>>> your first mail that actually had a patch for AMD and not at the one 
>>> preceding it (which stated I needed to apply the Intel series first). 
>>> Applied cleanly. How do I check whether it's functional? I grepped dmesg 
>>> for AMD or ucode, but nothing shows. Logread doesn't work at all (but I 
>>> reckon that's unrelated).
>>
>> You should grep -i for "microcode", it should say something like: "microcode 
>> updated early ..." probably on first line in kernel log.
>>
>> Strange thing is that logread doesn't work, but I don't know what's causing 
>> this.
> 
> Hi Thomas,
> 
> I just booted OpenWrt off my USB stick, grepping for microcode returned this:
> 
> [    2.038790] microcode: CPU0: patch_level=0x08001129
> [    2.043782] microcode: CPU1: patch_level=0x08001129
> [    2.114395] microcode: CPU2: patch_level=0x08001129
> [    2.119391] microcode: CPU3: patch_level=0x08001129
> [    2.124390] microcode: CPU4: patch_level=0x08001129
> [    2.129382] microcode: CPU5: patch_level=0x08001129
> [    2.134512] microcode: CPU6: patch_level=0x08001129
> [    2.139498] microcode: CPU7: patch_level=0x08001129
> [    2.144491] microcode: Microcode Update Driver: v2.2.
> 
> Does that help you any? Tested on a Ryzen 1800X.

Maybe Your BIOS already provides updated microcode. See this:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/cpu/microcode/amd.c#n801
for how the message should look like.

Can You show kernel messages when the microcode is not loaded (remove the lines 
in grub config) and kernel messages for the current OpenWrt snapshot with 
arm64-microcode package installed?

> 
> I reckon logread not working might have to do with my using the combined-ext4 
> image, /tmp is kinda broken as well.
> 
> Cheers
> 
> Stijn
>>
>>
>>>
>>>  Dmesg does say full retpoline support has been enabled, but unless I'm 
>>> mistaken that was a compiler feature, not something that could be solved 
>>> with microcode alone>
>>>  Cheers
>>>
>>>  Stijn
>>>
>>>
>>>

>   Second does apply cleanly.
>
>   Cheers
>
>   Stijn
>
>> [snip]
>>
>> -- 
>> TMN
>>
>> ___
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
> 


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-26 Thread Stijn Segers
Op di, 24 apr 2018 om 10:18 , schreef Tomasz Maciej Nowak 
:

W dniu 24.04.2018 o 22:00, Stijn Segers pisze:
[snip]


  I'm not sure what's going wrong here, I'm on a clean master tree 
but your first patch does not apply:


  $ git am 1.patch
  Applying: x86: add amd microcode entries to grub config
  error: patch failed: 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
  error: 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
does not apply

  error: patch failed: target/linux/x86/image/grub-iso.cfg:10
  error: target/linux/x86/image/grub-iso.cfg: patch does not apply
  error: patch failed: target/linux/x86/image/grub.cfg:10
  error: target/linux/x86/image/grub.cfg: patch does not apply
  Patch failed at 0001 x86: add amd microcode entries to grub 
config

  $ ./scripts/getver.sh
  r6755-d089a5d773



 Hi.

 I did wrongly spell myself out instead of "This series needs to be 
applied on top of 'intel-microcode: load as early as possible' 
series." it should be: "This series needs to be applied after 
'intel-microcode: load as early as possible' series.". Sorry about 
it.


 Nope - turns out I was too quick, my apologies :-(. I merely looked 
at your first mail that actually had a patch for AMD and not at the 
one preceding it (which stated I needed to apply the Intel series 
first). Applied cleanly. How do I check whether it's functional? I 
grepped dmesg for AMD or ucode, but nothing shows. Logread doesn't 
work at all (but I reckon that's unrelated).


You should grep -i for "microcode", it should say something like: 
"microcode updated early ..." probably on first line in kernel log.


Strange thing is that logread doesn't work, but I don't know what's 
causing this.


Hi Thomas,

I just booted OpenWrt off my USB stick, grepping for microcode returned 
this:


[2.038790] microcode: CPU0: patch_level=0x08001129
[2.043782] microcode: CPU1: patch_level=0x08001129
[2.114395] microcode: CPU2: patch_level=0x08001129
[2.119391] microcode: CPU3: patch_level=0x08001129
[2.124390] microcode: CPU4: patch_level=0x08001129
[2.129382] microcode: CPU5: patch_level=0x08001129
[2.134512] microcode: CPU6: patch_level=0x08001129
[2.139498] microcode: CPU7: patch_level=0x08001129
[2.144491] microcode: Microcode Update Driver: v2.2.

Does that help you any? Tested on a Ryzen 1800X.

I reckon logread not working might have to do with my using the 
combined-ext4 image, /tmp is kinda broken as well.


Cheers

Stijn





 Dmesg does say full retpoline support has been enabled, but unless 
I'm mistaken that was a compiler feature, not something that could 
be solved with microcode alone>

 Cheers

 Stijn






  Second does apply cleanly.

  Cheers

  Stijn


[snip]

--
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Tomasz Maciej Nowak
W dniu 24.04.2018 o 22:00, Stijn Segers pisze:
[snip]
>>>
>>>  I'm not sure what's going wrong here, I'm on a clean master tree but your 
>>> first patch does not apply:
>>>
>>>  $ git am 1.patch
>>>  Applying: x86: add amd microcode entries to grub config
>>>  error: patch failed: 
>>> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
>>>  error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
>>> does not apply
>>>  error: patch failed: target/linux/x86/image/grub-iso.cfg:10
>>>  error: target/linux/x86/image/grub-iso.cfg: patch does not apply
>>>  error: patch failed: target/linux/x86/image/grub.cfg:10
>>>  error: target/linux/x86/image/grub.cfg: patch does not apply
>>>  Patch failed at 0001 x86: add amd microcode entries to grub config
>>>  $ ./scripts/getver.sh
>>>  r6755-d089a5d773
>>>
>>
>> Hi.
>>
>> I did wrongly spell myself out instead of "This series needs to be applied 
>> on top of 'intel-microcode: load as early as possible' series." it should 
>> be: "This series needs to be applied after 'intel-microcode: load as early 
>> as possible' series.". Sorry about it.
> 
> Nope - turns out I was too quick, my apologies :-(. I merely looked at your 
> first mail that actually had a patch for AMD and not at the one preceding it 
> (which stated I needed to apply the Intel series first). Applied cleanly. How 
> do I check whether it's functional? I grepped dmesg for AMD or ucode, but 
> nothing shows. Logread doesn't work at all (but I reckon that's unrelated).

You should grep -i for "microcode", it should say something like: "microcode 
updated early ..." probably on first line in kernel log.

Strange thing is that logread doesn't work, but I don't know what's causing 
this.

> 
> Dmesg does say full retpoline support has been enabled, but unless I'm 
> mistaken that was a compiler feature, not something that could be solved with 
> microcode alone> 
> Cheers
> 
> Stijn
> 
> 
> 
>>
>>>  Second does apply cleanly.
>>>
>>>  Cheers
>>>
>>>  Stijn
>>>
[snip]

-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Stijn Segers
Op di, 24 apr 2018 om 9:14 , schreef Tomasz Maciej Nowak 
:

W dniu 24.04.2018 o 21:03, Stijn Segers pisze:

 Hi Tomasz,

 Op di, 24 apr 2018 om 2:56 , schreef Tomasz Maciej Nowak 
:
 Create initrd enries for x86 images, that'll load amd microcode as 
early
 as possible. Also remove the preinit script responsible for late 
load of

 microcode.

 Signed-off-by: Tomasz Maciej Nowak 
 ---
  .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 


  target/linux/x86/image/grub-iso.cfg  |  3 +++
  target/linux/x86/image/grub.cfg  |  3 +++
  3 files changed, 6 insertions(+), 12 deletions(-)
  delete mode 100644 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode


 I'm not sure what's going wrong here, I'm on a clean master tree 
but your first patch does not apply:


 $ git am 1.patch
 Applying: x86: add amd microcode entries to grub config
 error: patch failed: 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
 error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: 
patch does not apply

 error: patch failed: target/linux/x86/image/grub-iso.cfg:10
 error: target/linux/x86/image/grub-iso.cfg: patch does not apply
 error: patch failed: target/linux/x86/image/grub.cfg:10
 error: target/linux/x86/image/grub.cfg: patch does not apply
 Patch failed at 0001 x86: add amd microcode entries to grub config
 $ ./scripts/getver.sh
 r6755-d089a5d773



Hi.

I did wrongly spell myself out instead of "This series needs to be 
applied on top of 'intel-microcode: load as early as possible' 
series." it should be: "This series needs to be applied after 
'intel-microcode: load as early as possible' series.". Sorry about it.


Nope - turns out I was too quick, my apologies :-(. I merely looked at 
your first mail that actually had a patch for AMD and not at the one 
preceding it (which stated I needed to apply the Intel series first). 
Applied cleanly. How do I check whether it's functional? I grepped 
dmesg for AMD or ucode, but nothing shows. Logread doesn't work at all 
(but I reckon that's unrelated).


Dmesg does say full retpoline support has been enabled, but unless I'm 
mistaken that was a compiler feature, not something that could be 
solved with microcode alone?


Cheers

Stijn






 Second does apply cleanly.

 Cheers

 Stijn




 diff --git 
a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

 deleted file mode 100644
 index d3a23e24b2..00
 --- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
 +++ /dev/null
 @@ -1,12 +0,0 @@
 -#!/bin/sh
 -# Copyright (C) 2018 OpenWrt.org
 -
 -do_load_x86_ucode() {
 -if grep -q AuthenticAMD /proc/cpuinfo; then
 -if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
 -echo 1 > /sys/devices/system/cpu/microcode/reload
 -fi
 -fi
 -}
 -
 -boot_hook_add preinit_main do_load_x86_ucode
 diff --git a/target/linux/x86/image/grub-iso.cfg 
b/target/linux/x86/image/grub-iso.cfg

 index 30b587bd1c..5a2d67b7b3 100644
 --- a/target/linux/x86/image/grub-iso.cfg
 +++ b/target/linux/x86/image/grub-iso.cfg
 @@ -10,4 +10,7 @@ menuentry "OpenWrt" {
  if [ -e /boot/intel-ucode.img ]; then
  initrd /boot/intel-ucode.img
  fi
 +if [ -e /boot/amd-ucode.img ]; then
 +initrd /boot/amd-ucode.img
 +fi
  }
 diff --git a/target/linux/x86/image/grub.cfg 
b/target/linux/x86/image/grub.cfg

 index dde24b95ce..caf38ec2c4 100644
 --- a/target/linux/x86/image/grub.cfg
 +++ b/target/linux/x86/image/grub.cfg
 @@ -10,6 +10,9 @@ menuentry "OpenWrt" {
  if [ -e /boot/intel-ucode.img ]; then
  initrd /boot/intel-ucode.img
  fi
 +if [ -e /boot/amd-ucode.img ]; then
 +initrd /boot/amd-ucode.img
 +fi
  }
  menuentry "OpenWrt (failsafe)" {
  linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
 --
 2.17.0


 ___
 Lede-dev mailing list
 Lede-dev@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/lede-dev



--
TMN



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Tomasz Maciej Nowak
W dniu 24.04.2018 o 21:03, Stijn Segers pisze:
> Hi Tomasz,
> 
> Op di, 24 apr 2018 om 2:56 , schreef Tomasz Maciej Nowak :
>> Create initrd enries for x86 images, that'll load amd microcode as early
>> as possible. Also remove the preinit script responsible for late load of
>> microcode.
>>
>> Signed-off-by: Tomasz Maciej Nowak 
>> ---
>>  .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 
>>  target/linux/x86/image/grub-iso.cfg  |  3 +++
>>  target/linux/x86/image/grub.cfg  |  3 +++
>>  3 files changed, 6 insertions(+), 12 deletions(-)
>>  delete mode 100644 target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
> 
> I'm not sure what's going wrong here, I'm on a clean master tree but your 
> first patch does not apply:
> 
> $ git am 1.patch
> Applying: x86: add amd microcode entries to grub config
> error: patch failed: 
> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
> error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch does 
> not apply
> error: patch failed: target/linux/x86/image/grub-iso.cfg:10
> error: target/linux/x86/image/grub-iso.cfg: patch does not apply
> error: patch failed: target/linux/x86/image/grub.cfg:10
> error: target/linux/x86/image/grub.cfg: patch does not apply
> Patch failed at 0001 x86: add amd microcode entries to grub config
> $ ./scripts/getver.sh
> r6755-d089a5d773
> 

Hi.

I did wrongly spell myself out instead of "This series needs to be applied on 
top of 'intel-microcode: load as early as possible' series." it should be: 
"This series needs to be applied after 'intel-microcode: load as early as 
possible' series.". Sorry about it.

> Second does apply cleanly.
> 
> Cheers
> 
> Stijn
> 
> 
>>
>> diff --git a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
>> b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
>> deleted file mode 100644
>> index d3a23e24b2..00
>> --- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
>> +++ /dev/null
>> @@ -1,12 +0,0 @@
>> -#!/bin/sh
>> -# Copyright (C) 2018 OpenWrt.org
>> -
>> -do_load_x86_ucode() {
>> -    if grep -q AuthenticAMD /proc/cpuinfo; then
>> -    if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
>> -    echo 1 > /sys/devices/system/cpu/microcode/reload
>> -    fi
>> -    fi
>> -}
>> -
>> -boot_hook_add preinit_main do_load_x86_ucode
>> diff --git a/target/linux/x86/image/grub-iso.cfg 
>> b/target/linux/x86/image/grub-iso.cfg
>> index 30b587bd1c..5a2d67b7b3 100644
>> --- a/target/linux/x86/image/grub-iso.cfg
>> +++ b/target/linux/x86/image/grub-iso.cfg
>> @@ -10,4 +10,7 @@ menuentry "OpenWrt" {
>>  if [ -e /boot/intel-ucode.img ]; then
>>  initrd /boot/intel-ucode.img
>>  fi
>> +    if [ -e /boot/amd-ucode.img ]; then
>> +    initrd /boot/amd-ucode.img
>> +    fi
>>  }
>> diff --git a/target/linux/x86/image/grub.cfg 
>> b/target/linux/x86/image/grub.cfg
>> index dde24b95ce..caf38ec2c4 100644
>> --- a/target/linux/x86/image/grub.cfg
>> +++ b/target/linux/x86/image/grub.cfg
>> @@ -10,6 +10,9 @@ menuentry "OpenWrt" {
>>  if [ -e /boot/intel-ucode.img ]; then
>>  initrd /boot/intel-ucode.img
>>  fi
>> +    if [ -e /boot/amd-ucode.img ]; then
>> +    initrd /boot/amd-ucode.img
>> +    fi
>>  }
>>  menuentry "OpenWrt (failsafe)" {
>>  linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
>> -- 
>> 2.17.0
>>
>>
>> ___
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev
> 
-- 
TMN

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

2018-04-24 Thread Stijn Segers

Hi Tomasz,

Op di, 24 apr 2018 om 2:56 , schreef Tomasz Maciej Nowak 
:
Create initrd enries for x86 images, that'll load amd microcode as 
early
as possible. Also remove the preinit script responsible for late load 
of

microcode.

Signed-off-by: Tomasz Maciej Nowak 
---
 .../x86/base-files/lib/preinit/02_load_x86_ucode | 12 


 target/linux/x86/image/grub-iso.cfg  |  3 +++
 target/linux/x86/image/grub.cfg  |  3 +++
 3 files changed, 6 insertions(+), 12 deletions(-)
 delete mode 100644 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode


I'm not sure what's going wrong here, I'm on a clean master tree but 
your first patch does not apply:


$ git am 1.patch
Applying: x86: add amd microcode entries to grub config
error: patch failed: 
target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: patch 
does not apply

error: patch failed: target/linux/x86/image/grub-iso.cfg:10
error: target/linux/x86/image/grub-iso.cfg: patch does not apply
error: patch failed: target/linux/x86/image/grub.cfg:10
error: target/linux/x86/image/grub.cfg: patch does not apply
Patch failed at 0001 x86: add amd microcode entries to grub config
$ ./scripts/getver.sh
r6755-d089a5d773

Second does apply cleanly.

Cheers

Stijn




diff --git 
a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode

deleted file mode 100644
index d3a23e24b2..00
--- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2018 OpenWrt.org
-
-do_load_x86_ucode() {
-   if grep -q AuthenticAMD /proc/cpuinfo; then
-   if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
-   echo 1 > /sys/devices/system/cpu/microcode/reload
-   fi
-   fi
-}
-
-boot_hook_add preinit_main do_load_x86_ucode
diff --git a/target/linux/x86/image/grub-iso.cfg 
b/target/linux/x86/image/grub-iso.cfg

index 30b587bd1c..5a2d67b7b3 100644
--- a/target/linux/x86/image/grub-iso.cfg
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -10,4 +10,7 @@ menuentry "OpenWrt" {
if [ -e /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
+   if [ -e /boot/amd-ucode.img ]; then
+   initrd /boot/amd-ucode.img
+   fi
 }
diff --git a/target/linux/x86/image/grub.cfg 
b/target/linux/x86/image/grub.cfg

index dde24b95ce..caf38ec2c4 100644
--- a/target/linux/x86/image/grub.cfg
+++ b/target/linux/x86/image/grub.cfg
@@ -10,6 +10,9 @@ menuentry "OpenWrt" {
if [ -e /boot/intel-ucode.img ]; then
initrd /boot/intel-ucode.img
fi
+   if [ -e /boot/amd-ucode.img ]; then
+   initrd /boot/amd-ucode.img
+   fi
 }
 menuentry "OpenWrt (failsafe)" {
linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
--
2.17.0


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev