Re: [PATCH] macintosh/ams: linux/platform_device.h is needed

2023-08-29 Thread Christophe Leroy


Le 30/08/2023 à 00:58, Randy Dunlap a écrit :
> ams.h uses struct platform_device, so the header should be used
> to prevent build errors:
> 
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_enable':
> drivers/macintosh/ams/ams-input.c:68:45: error: invalid use of undefined type 
> 'struct platform_device'
> 68 | input->dev.parent = _info.of_dev->dev;
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
> drivers/macintosh/ams/ams-input.c:146:51: error: invalid use of undefined 
> type 'struct platform_device'
>146 | return device_create_file(_info.of_dev->dev, 
> _attr_joystick);
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_exit':
> drivers/macintosh/ams/ams-input.c:151:44: error: invalid use of undefined 
> type 'struct platform_device'
>151 | device_remove_file(_info.of_dev->dev, 
> _attr_joystick);
> drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
> drivers/macintosh/ams/ams-input.c:147:1: error: control reaches end of 
> non-void function [-Werror=return-type]
>147 | }
> 
> Fixes: 233d687d1b78 ("macintosh: Explicitly include correct DT includes")
> Signed-off-by: Randy Dunlap 
> Cc: Rob Herring 
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: Michael Ellerman 
> ---
>   drivers/macintosh/ams/ams.h |1 +
>   1 file changed, 1 insertion(+)
> 
> diff -- a/drivers/macintosh/ams/ams.h b/drivers/macintosh/ams/ams.h
> --- a/drivers/macintosh/ams/ams.h
> +++ b/drivers/macintosh/ams/ams.h
> @@ -6,6 +6,7 @@
>   #include 
>   #include 
>   #include 
> +#include 

You modify ams.h to fix a problem in ams-input.c
Is that correct ?

Shouldn't the include be in ams-input.c instead ?

>   #include 
>   #include 
>   

Christophe


[PATCH] powerpc/configs: Set more PPC debug configs

2023-08-29 Thread Benjamin Gray
Add more config options that wouldn't be done by the generic debug
config in kernel/configs/debug.config

CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG
Adds an initialized check on each (cpu|mmu)_has_feature()

CONFIG_PPC_IRQ_SOFT_MASK_DEBUG
Adds some extra checks around IRQ mask manipulation

CONFIG_PPC_KUAP_DEBUG
Adds some extra KAUP checks around interrupts/context switching

CONFIG_PPC_RFI_SRR_DEBUG
Adds some extra SSR checks around interrupts/syscalls

Signed-off-by: Benjamin Gray 
---
 arch/powerpc/configs/debug.config | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/configs/debug.config 
b/arch/powerpc/configs/debug.config
index a14ae1f20d60..bcc1fcf25e10 100644
--- a/arch/powerpc/configs/debug.config
+++ b/arch/powerpc/configs/debug.config
@@ -1 +1,5 @@
+CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG=y
+CONFIG_PPC_IRQ_SOFT_MASK_DEBUG=y
+CONFIG_PPC_KUAP_DEBUG=y
+CONFIG_PPC_RFI_SRR_DEBUG=y
 CONFIG_SCOM_DEBUGFS=y
-- 
2.41.0



Re: [PATCH] crypto: vmx: Improved AES/XTS performance of 6-way unrolling for ppc.

2023-08-29 Thread Michael Ellerman
Danny Tsen  writes:
> Improve AES/XTS performance of 6-way unrolling for PowerPC up
> to 17% with tcrypt.  This is done by using one instruction,
> vpermxor, to replace xor and vsldoi.
>
> This patch has been tested with the kernel crypto module tcrypt.ko and
> has passed the selftest.  The patch is also tested with
> CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.
>
> Signed-off-by: Danny Tsen 
> ---
>  drivers/crypto/vmx/aesp8-ppc.pl | 141 +---
>  1 file changed, 92 insertions(+), 49 deletions(-)

That's CRYPTOGAMS code, and is so far largely unchanged from the
original. I see you've sent the same change to openssl, but it's not
merged yet. Please document that in the change log, we want to keep the
code in sync as much as possible, and document any divergences.

cheers

> diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
> index 50a0a18f35da..f729589d792e 100644
> --- a/drivers/crypto/vmx/aesp8-ppc.pl
> +++ b/drivers/crypto/vmx/aesp8-ppc.pl
> @@ -132,11 +132,12 @@ rcon:
>  .long0x1b00, 0x1b00, 0x1b00, 0x1b00  ?rev
>  .long0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c  ?rev
>  .long0,0,0,0 ?asis
> +.long0x0f102132, 0x43546576, 0x8798a9ba, 0xcbdcedfe
>  Lconsts:
>   mflrr0
>   bcl 20,31,\$+4
>   mflr$ptr #v "distance between . and rcon
> - addi$ptr,$ptr,-0x48
> + addi$ptr,$ptr,-0x58
>   mtlrr0
>   blr
>   .long   0
> @@ -2495,6 +2496,17 @@ _aesp8_xts_encrypt6x:
>   li  $x70,0x70
>   mtspr   256,r0
>  
> + xxlor   2, 32+$eighty7, 32+$eighty7
> + vsldoi  $eighty7,$tmp,$eighty7,1# 0x010101..87
> + xxlor   1, 32+$eighty7, 32+$eighty7
> +
> + # Load XOR Lconsts.
> + mr  $x70, r6
> + bl  Lconsts
> + lxvw4x  0, $x40, r6 # load XOR contents
> + mr  r6, $x70
> + li  $x70,0x70
> +
>   subi$rounds,$rounds,3   # -4 in total
>  
>   lvx $rndkey0,$x00,$key1 # load key schedule
> @@ -2537,69 +2549,77 @@ Load_xts_enc_key:
>   ?vperm  v31,v31,$twk5,$keyperm
>   lvx v25,$x10,$key_  # pre-load round[2]
>  
> + # Switch to use the following codes with 0x010101..87 to generate tweak.
> + # eighty7 = 0x010101..87
> + # vsrab tmp, tweak, seven   # next tweak value, right shift 
> 7 bits
> + # vand  tmp, tmp, eighty7   # last byte with carry
> + # vaddubm   tweak, tweak, tweak # left shift 1 bit (x2)
> + # xxlor vsx, 0, 0
> + # vpermxor  tweak, tweak, tmp, vsx
> +
>vperm  $in0,$inout,$inptail,$inpperm
>subi   $inp,$inp,31# undo "caller"
>   vxor$twk0,$tweak,$rndkey0
>   vsrab   $tmp,$tweak,$seven  # next tweak value
>   vaddubm $tweak,$tweak,$tweak
> - vsldoi  $tmp,$tmp,$tmp,15
>   vand$tmp,$tmp,$eighty7
>vxor   $out0,$in0,$twk0
> - vxor$tweak,$tweak,$tmp
> + xxlor   32+$in1, 0, 0
> + vpermxor$tweak, $tweak, $tmp, $in1
>  
>lvx_u  $in1,$x10,$inp
>   vxor$twk1,$tweak,$rndkey0
>   vsrab   $tmp,$tweak,$seven  # next tweak value
>   vaddubm $tweak,$tweak,$tweak
> - vsldoi  $tmp,$tmp,$tmp,15
>le?vperm   $in1,$in1,$in1,$leperm
>   vand$tmp,$tmp,$eighty7
>vxor   $out1,$in1,$twk1
> - vxor$tweak,$tweak,$tmp
> + xxlor   32+$in2, 0, 0
> + vpermxor$tweak, $tweak, $tmp, $in2
>  
>lvx_u  $in2,$x20,$inp
>andi.  $taillen,$len,15
>   vxor$twk2,$tweak,$rndkey0
>   vsrab   $tmp,$tweak,$seven  # next tweak value
>   vaddubm $tweak,$tweak,$tweak
> - vsldoi  $tmp,$tmp,$tmp,15
>le?vperm   $in2,$in2,$in2,$leperm
>   vand$tmp,$tmp,$eighty7
>vxor   $out2,$in2,$twk2
> - vxor$tweak,$tweak,$tmp
> + xxlor   32+$in3, 0, 0
> + vpermxor$tweak, $tweak, $tmp, $in3
>  
>lvx_u  $in3,$x30,$inp
>sub$len,$len,$taillen
>   vxor$twk3,$tweak,$rndkey0
>   vsrab   $tmp,$tweak,$seven  # next tweak value
>   vaddubm $tweak,$tweak,$tweak
> - vsldoi  $tmp,$tmp,$tmp,15
>le?vperm   $in3,$in3,$in3,$leperm
>   vand$tmp,$tmp,$eighty7
>vxor   $out3,$in3,$twk3
> - vxor$tweak,$tweak,$tmp
> + xxlor   32+$in4, 0, 0
> + vpermxor$tweak, $tweak, $tmp, $in4
>  
>lvx_u  $in4,$x40,$inp
>subi

Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp

2023-08-29 Thread Jeff Layton
On Wed, 2023-08-30 at 01:19 +0100, Al Viro wrote:
> On Wed, Jul 05, 2023 at 02:58:11PM -0400, Jeff Layton wrote:
> 
> > + * POSIX mandates that the old and new parent directories have their ctime 
> > and
> > + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), 
> > have
> > + * their ctime updated.
> 
> APPLICATION USAGE
> Some implementations mark for update the last file status change timestamp
> of renamed files and some do not. Applications which make use of the
> last file status change timestamp may behave differently with respect
> to renamed files unless they are designed to allow for either behavior.
>
> So for children POSIX permits rather than mandates.  Doesn't really matter;
> Linux behaviour had been to touch ctime on children since way back, if
> not since the very beginning.

Mea culpa. You're quite correct. I'll plan to roll a small patch to
update the comment over this function.

Thanks!
-- 
Jeff Layton 


Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp

2023-08-29 Thread Al Viro
On Wed, Jul 05, 2023 at 02:58:11PM -0400, Jeff Layton wrote:

> + * POSIX mandates that the old and new parent directories have their ctime 
> and
> + * mtime updated, and that inodes of @old_dentry and @new_dentry (if any), 
> have
> + * their ctime updated.

APPLICATION USAGE
Some implementations mark for update the last file status change timestamp
of renamed files and some do not. Applications which make use of the
last file status change timestamp may behave differently with respect
to renamed files unless they are designed to allow for either behavior.

So for children POSIX permits rather than mandates.  Doesn't really matter;
Linux behaviour had been to touch ctime on children since way back, if
not since the very beginning.


Re: [RFC PATCH v2 0/7] Add audio support in v4l2 framework

2023-08-29 Thread Shengjiu Wang
On Fri, Aug 25, 2023 at 10:15 PM Hans Verkuil  wrote:
>
> On 25/08/2023 15:54, Takashi Iwai wrote:
> > On Fri, 25 Aug 2023 05:46:43 +0200,
> > Shengjiu Wang wrote:
> >>
> >> On Fri, Aug 25, 2023 at 4:21 AM Mark Brown  wrote:
> >>>
> >>> On Thu, Aug 24, 2023 at 07:03:09PM +0200, Takashi Iwai wrote:
>  Shengjiu Wang wrote:
> >>>
> > But there are several issues:
> > 1. Need to create sound cards.  ASRC module support multi instances, 
> > then
> > need to create multi sound cards for each instance.
> >>>
>  Hm, why can't it be multiple PCM instances instead?
> >>>
> >>> I'm having a hard time following this one too.
> >>>
> > 2. The ASRC is an entirety but with DPCM we need to separate input port 
> > and
> > output port to playback substream and capture stream. Synchronous 
> > between
> > playback substream and capture substream is a problem.
> > How to start them and stop them at the same time.
> >>>
>  This could be done by enforcing the full duplex and linking the both
>  PCM streams, I suppose.
> >>>
> > So shall we make the decision that we can go to the V4L2 solution?
> >>>
>  Honestly speaking, I don't mind much whether it's implemented in V2L4
>  or not -- at least for the kernel part, we can reorganize / refactor
>  things internally.  But, the biggest remaining question to me is
>  whether this user-space interface is the most suitable one.  Is it
>  well defined, usable and maintained for the audio applications?  Or
>  is it meant to be a stop-gap for a specific use case?
> >>>
> >>> I'm having a really hard time summoning much enthusiasm for using v4l
> >>> here, it feels like this is heading down the same bodge route as DPCM
> >>> but directly as ABI so even harder to fix properly.  That said all the
> >>> ALSA APIs are really intended to be used in real time and this sounds
> >>> like a non real time application?  I don't fully understand what the
> >>> actual use case is here.
> >>
> >> Thanks for your reply.
> >>
> >> This asrc memory to memory (memory ->asrc->memory) case is a non
> >> real time use case.
> >>
> >> User fills the input buffer to the asrc module,  after conversion, then 
> >> asrc
> >> sends back the output buffer to user. So it is not a traditional ALSA 
> >> playback
> >> and capture case. I think it is not good to create sound card for it,  it 
> >> is
> >> not a sound card actually.
> >>
> >> It is a specific use case,  there is no reference in current kernel.
> >> v4l2 memory to memory is the closed implementation,  v4l2 current
> >> support video, image, radio, tuner, touch devices, so it is not
> >> complicated to add support for this specific audio case.
> >>
> >> Maybe you can go through these patches first.  Because we
> >> had implemented the "memory -> asrc ->i2s device-> codec"
> >> use case in ALSA.  Now the "memory->asrc->memory" needs
> >> to reuse the code in asrc driver, so the first 3 patches is for refining
> >> the code to make it can be shared by the "memory->asrc->memory"
> >> driver.
> >>
> >> The main change is in the v4l2 side, A /dev/vl42-audio will be created,
> >> user applications only use the ioctl of v4l2 framework.
> >
> > Ah, now I'm slowly understanding.  So, what you want is to have an
> > interface to perform the batch conversion of a data stream from an
> > input to an output?  And ALSA PCM interface doesn't fit fully for that
> > purpose because the data handling is batched and it's not like a
> > normal PCM streaming?
> >
> > Basically the whole M2M arguments are rather subtle.  Those are
> > implementation details that can be resolved in several different ways
> > in the kernel side.  But the design of the operation is the crucial
> > point.
> >
> > Maybe we can consider implementing a similar feature in ALSA API, too.
> > But it's too far-stretched for now.
> >
> > So, if v4l2 interface provides the requested feature (the batched
> > audio stream conversion), it's OK to ride on it.
>
> The V4L2 M2M interface is simple: you open a video device and then you can
> pass data to the hardware, it processes it and you get the processed data 
> back.
>
> The hardware just processes the data as fast as it can. Each time you open
> the video device a new instance is created, and each instance can pass jobs
> to the hardware.
>
> Currently it is used for video scalers, deinterlacers, colorspace converters 
> and
> codecs, but in the end it is just data in, data out with some job scheduling 
> (fifo)
> towards the hardware. So supporting audio using the same core m2m framework 
> wouldn't
> be a big deal. We'd probably make a /dev/v4l-audio device for that.
>
> It doesn't come for free: it is a new API, so besides adding support for it, 
> it
> also needs to be documented, we would need compliance tests, and very likely I
> would want a new virtual driver for this (vim2m.c would be a good template).
>

Thanks all.

I will try to pass the compliance test.  

Re: Recent Power changes and stack_trace_save_tsk_reliable?

2023-08-29 Thread Michael Ellerman
Joe Lawrence  writes:
> Hi ppc-dev list,
>
> We noticed that our kpatch integration tests started failing on ppc64le
> when targeting the upstream v6.4 kernel, and then confirmed that the
> in-tree livepatching kselftests similarly fail, too.  From the kselftest
> results, it appears that livepatch transitions are no longer completing.

Hi Joe,

Thanks for the report.

I thought I was running the livepatch tests, but looks like somewhere
along the line my kernel .config lost CONFIG_TEST_LIVEPATCH=m, so I have
been running the test but it just skips. :/

I can reproduce the failure, and will see if I can bisect it more
successfully.

cheers


Re: linux-next: manual merge of the net-next tree with the powerpc tree

2023-08-29 Thread Stephen Rothwell
Hi all,

On Fri, 18 Aug 2023 11:17:07 +1000 Stephen Rothwell  
wrote:
>
> Today's linux-next merge of the net-next tree got a conflict in:
> 
>   drivers/net/ethernet/freescale/fs_enet/fs_enet.h
> 
> between commit:
> 
>   60bc069c433f ("powerpc/include: Remove unneeded #include ")
> 
> from the powerpc tree and commit:
> 
>   7a76918371fe ("net: fs_enet: Move struct fs_platform_info into fs_enet.h")
> 
> from the net-next tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/net/ethernet/freescale/fs_enet/fs_enet.h
> index aad96cb2ab4e,d371072fff60..
> --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
> +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
> @@@ -9,8 -10,8 +10,6 @@@
>   #include 
>   #include 
>   
> - #include 
>  -#include 
> --
>   #ifdef CONFIG_CPM1
>   #include 
>   #endif

This is now a conflict between the powerpc tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell


pgpwiOAE1zrjd.pgp
Description: OpenPGP digital signature


[PATCH] macintosh/ams: linux/platform_device.h is needed

2023-08-29 Thread Randy Dunlap
ams.h uses struct platform_device, so the header should be used
to prevent build errors:

drivers/macintosh/ams/ams-input.c: In function 'ams_input_enable':
drivers/macintosh/ams/ams-input.c:68:45: error: invalid use of undefined type 
'struct platform_device'
   68 | input->dev.parent = _info.of_dev->dev;
drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
drivers/macintosh/ams/ams-input.c:146:51: error: invalid use of undefined type 
'struct platform_device'
  146 | return device_create_file(_info.of_dev->dev, 
_attr_joystick);
drivers/macintosh/ams/ams-input.c: In function 'ams_input_exit':
drivers/macintosh/ams/ams-input.c:151:44: error: invalid use of undefined type 
'struct platform_device'
  151 | device_remove_file(_info.of_dev->dev, _attr_joystick);
drivers/macintosh/ams/ams-input.c: In function 'ams_input_init':
drivers/macintosh/ams/ams-input.c:147:1: error: control reaches end of non-void 
function [-Werror=return-type]
  147 | }

Fixes: 233d687d1b78 ("macintosh: Explicitly include correct DT includes")
Signed-off-by: Randy Dunlap 
Cc: Rob Herring 
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman 
---
 drivers/macintosh/ams/ams.h |1 +
 1 file changed, 1 insertion(+)

diff -- a/drivers/macintosh/ams/ams.h b/drivers/macintosh/ams/ams.h
--- a/drivers/macintosh/ams/ams.h
+++ b/drivers/macintosh/ams/ams.h
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 


Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"

2023-08-29 Thread Nicolas Schier
On Tue, Aug 29, 2023 at 11:57:19PM +0900 Masahiro Yamada wrote:
> On Tue, Aug 29, 2023 at 3:55 PM Nicolas Schier  wrote:
> >
> > On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote:
> > > Masahiro Yamada  writes:
> > > > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook  wrote:
> > > >>
> > > >> Hi,
> > > >>
> > > >> This is my series to show *.config targets in the "help" target so 
> > > >> these
> > > >> various topics can be more easily discoverd.
> > > >>
> > > >> v2:
> > > >>  - split .fragment from .config to hide "internal" fragments
> > > >
> > > > Please do not do this churn.
> > >
> > > That was my idea :}
> > >
> > > > Like Randy, I did not get "why" part quiet well,
> > > > but if you are eager about this,
> > > > you can show help message only when the following
> > > > ("# Help:" prefix for example) is found in the first line.
> > > >
> > > > # Help: blah blah
> > > > # other comment
> > >
> > > I did think of that, but wasn't sure how to do it in make.
> >
> > Something like this should do it:
> >
> > @grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call 
> > configfiles,*.config))), $(firstword $(call configfiles,$(f | \
> >  while read loc dummy helptext; do \
> > tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \
> > [ "$${line}" = "1" ] && \
> >   printf "  %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \
> >  done
> >
> > but this neither beautiful nor elegant it likes to be improved.
> >
> > Kind regards,
> > Nicolas
> 
> 
> 
> 
> The attached patch will work too.
> 
> I dropped the "in the first line" restriction
> because SPDX might be placed in the first line
> of config fragments.
> 
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

> diff --git a/Makefile b/Makefile
> index e21bf66af6fd..23cd62a5ff05 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1552,7 +1552,6 @@ help:
>   @echo  '  mrproper- Remove all generated files + config + 
> various backup files'
>   @echo  '  distclean   - mrproper + remove editor backup and patch 
> files'
>   @echo  ''
> - @echo  'Configuration targets:'
>   @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
>   @echo  ''
>   @echo  'Other generic targets:'
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index fdc2e3abd615..c4b2a8a19fc8 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -335,9 +335,5 @@ define archhelp
>echo  '  bzdisk/fdimage*/hdimage/isoimage also accept:'
>echo  '  FDARGS="..."  arguments for the booted kernel'
>echo  '  FDINITRD=file initrd for the booted kernel'
> -  echo  ''
> -  echo  '  kvm_guest.config  - Enable Kconfig items for running this kernel 
> as a KVM guest'
> -  echo  '  xen.config- Enable Kconfig items for running this 
> kernel as a Xen guest'
> -  echo  '  x86_debug.config  - Enable tip tree debugging options for testing'
>  
>  endef
> diff --git a/kernel/configs/kvm_guest.config b/kernel/configs/kvm_guest.config
> index 208481d91090..d0877063d925 100644
> --- a/kernel/configs/kvm_guest.config
> +++ b/kernel/configs/kvm_guest.config
> @@ -1,3 +1,4 @@
> +# Help: Bootable as a KVM guest
>  CONFIG_NET=y
>  CONFIG_NET_CORE=y
>  CONFIG_NETDEVICES=y
> diff --git a/kernel/configs/x86_debug.config b/kernel/configs/x86_debug.config
> index 6fac5b405334..35f48671b8d5 100644
> --- a/kernel/configs/x86_debug.config
> +++ b/kernel/configs/x86_debug.config
> @@ -1,3 +1,4 @@
> +# Help: Debugging options for tip tree testing
>  CONFIG_X86_DEBUG_FPU=y
>  CONFIG_LOCK_STAT=y
>  CONFIG_DEBUG_VM=y
> diff --git a/kernel/configs/xen.config b/kernel/configs/xen.config
> index 436f806aa1ed..6878b9a49be8 100644
> --- a/kernel/configs/xen.config
> +++ b/kernel/configs/xen.config
> @@ -1,3 +1,5 @@
> +# Help: Bootable as a Xen guest
> +#
>  # global stuff - these enable us to allow some
>  # of the not so generic stuff below for xen
>  CONFIG_PARAVIRT=y
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index af1c96198f49..e72c5ee659a9 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -93,11 +93,13 @@ endif
>  %_defconfig: $(obj)/conf
>   $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
>  
> -configfiles=$(wildcard $(srctree)/kernel/configs/$@ 
> $(srctree)/arch/$(SRCARCH)/configs/$@)
> +configfiles = $(wildcard $(srctree)/kernel/configs/$(1) 
> $(srctree)/arch/$(SRCARCH)/configs/$(1))
> +all-config-fragments = $(call configfiles,*)
> +config-fragments = $(call configfiles,$@)
>  
>  %.config: $(obj)/conf
> - $(if $(call configfiles),, $(error No configuration exists for this 
> target on this architecture))
> - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m 
> .config $(configfiles)
> + $(if $(config-fragments),, $(error $@ fragment does not exists on this 
> architecture))
> + $(Q)$(CONFIG_SHELL) 

Re: [PATCH] perf test: Skip perf bench breakpoint run if no breakpoints available

2023-08-29 Thread Ian Rogers
On Wed, Aug 23, 2023 at 4:00 AM Naveen N Rao  wrote:
>
> Hi Kajol,
>
> On Wed Aug 23, 2023 at 1:21 PM IST, Kajol Jain wrote:
> > Based on commit 7d54a4acd8c1 ("perf test: Skip watchpoint
> > tests if no watchpoints available"), hardware breakpoints
> > are not available for power9 platform and because of that
> > perf bench breakpoint run fails on power9 platform.
> > Add code to check for the return value of perf_event_open()
> > in breakpoint run and skip the perf bench breakpoint run,
> > if hardware breakpoints are not available.
> >
> > Result on power9 system before patch changes:
> > [command]# perf bench breakpoint thread
> > perf_event_open: No such device
> >
> > Result on power9 system after patch changes:
> > [command]# ./perf bench breakpoint thread
> > Skipping perf bench breakpoint thread: No hardware support
> >
> > Reported-by: Disha Goel 
> > Signed-off-by: Kajol Jain 
> > ---
> >  tools/perf/bench/breakpoint.c | 24 +---
> >  1 file changed, 21 insertions(+), 3 deletions(-)
>
> Thanks for fixing this to not report an error. A minor nit below, but
> otherwise:
> Acked-by: Naveen N Rao 
>
> >
> > diff --git a/tools/perf/bench/breakpoint.c b/tools/perf/bench/breakpoint.c
> > index 41385f89ffc7..dfd18f5db97d 100644
> > --- a/tools/perf/bench/breakpoint.c
> > +++ b/tools/perf/bench/breakpoint.c
> > @@ -47,6 +47,7 @@ struct breakpoint {
> >  static int breakpoint_setup(void *addr)
> >  {
> >   struct perf_event_attr attr = { .size = 0, };
> > + int fd;
> >
> >   attr.type = PERF_TYPE_BREAKPOINT;
> >   attr.size = sizeof(attr);
> > @@ -56,7 +57,12 @@ static int breakpoint_setup(void *addr)
> >   attr.bp_addr = (unsigned long)addr;
> >   attr.bp_type = HW_BREAKPOINT_RW;
> >   attr.bp_len = HW_BREAKPOINT_LEN_1;
> > - return syscall(SYS_perf_event_open, , 0, -1, -1, 0);
> > + fd = syscall(SYS_perf_event_open, , 0, -1, -1, 0);
> > +
> > + if (fd < 0)
> > + fd = -errno;
> > +
> > + return fd;
> >  }
> >
> >  static void *passive_thread(void *arg)
> > @@ -122,8 +128,14 @@ int bench_breakpoint_thread(int argc, const char 
> > **argv)
> >
> >   for (i = 0; i < thread_params.nbreakpoints; i++) {
> >   breakpoints[i].fd = breakpoint_setup([i].watched);
> > - if (breakpoints[i].fd == -1)
> > +
> > + if (breakpoints[i].fd < 0) {
> > + if (breakpoints[i].fd == -ENODEV) {
> > + printf("Skipping perf bench breakpoint 
> > thread: No hardware support\n");
> > + return 0;
>
> Should we instead do 'exit(0)' here to stop further benchmarks? Perhaps:
>   err(EXIT_SUCCESS, "Skipping perf bench breakpoint thread: No hardware 
> support");
>
> EXIT_SUCCESS looks weird, but should help document that this is not an
> error.

In tools/perf/tests/tests.h is:

enum {
   TEST_OK   =  0,
   TEST_FAIL = -1,
   TEST_SKIP = -2,
};

So I think the EXIT_SUCCESS/0 should really be TEST_OK, but I think it
would clearer if these cases were TEST_SKIP.

Thanks,
Ian

> > + }
> >   exit((perror("perf_event_open"), EXIT_FAILURE));
> > + }
> >   }
> >   gettimeofday(, NULL);
> >   for (i = 0; i < thread_params.nparallel; i++) {
> > @@ -196,8 +208,14 @@ int bench_breakpoint_enable(int argc, const char 
> > **argv)
> >   exit(EXIT_FAILURE);
> >   }
> >   fd = breakpoint_setup();
> > - if (fd == -1)
> > +
> > + if (fd < 0) {
> > + if (fd == -ENODEV) {
> > + printf("Skipping perf bench breakpoint enable: No 
> > hardware support\n");
> > + return 0;
>
> Here too.
>
> - Naveen
>
> > + }
> >   exit((perror("perf_event_open"), EXIT_FAILURE));
> > + }
> >   nthreads = enable_params.npassive + enable_params.nactive;
> >   threads = calloc(nthreads, sizeof(threads[0]));
> >   if (!threads)
>


[PATCH] crypto: vmx: Improved AES/XTS performance of 6-way unrolling for ppc.

2023-08-29 Thread Danny Tsen
Improve AES/XTS performance of 6-way unrolling for PowerPC up
to 17% with tcrypt.  This is done by using one instruction,
vpermxor, to replace xor and vsldoi.

This patch has been tested with the kernel crypto module tcrypt.ko and
has passed the selftest.  The patch is also tested with
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS enabled.

Signed-off-by: Danny Tsen 
---
 drivers/crypto/vmx/aesp8-ppc.pl | 141 +---
 1 file changed, 92 insertions(+), 49 deletions(-)

diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl
index 50a0a18f35da..f729589d792e 100644
--- a/drivers/crypto/vmx/aesp8-ppc.pl
+++ b/drivers/crypto/vmx/aesp8-ppc.pl
@@ -132,11 +132,12 @@ rcon:
 .long  0x1b00, 0x1b00, 0x1b00, 0x1b00  ?rev
 .long  0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c, 0x0d0e0f0c  ?rev
 .long  0,0,0,0 ?asis
+.long  0x0f102132, 0x43546576, 0x8798a9ba, 0xcbdcedfe
 Lconsts:
mflrr0
bcl 20,31,\$+4
mflr$ptr #v "distance between . and rcon
-   addi$ptr,$ptr,-0x48
+   addi$ptr,$ptr,-0x58
mtlrr0
blr
.long   0
@@ -2495,6 +2496,17 @@ _aesp8_xts_encrypt6x:
li  $x70,0x70
mtspr   256,r0
 
+   xxlor   2, 32+$eighty7, 32+$eighty7
+   vsldoi  $eighty7,$tmp,$eighty7,1# 0x010101..87
+   xxlor   1, 32+$eighty7, 32+$eighty7
+
+   # Load XOR Lconsts.
+   mr  $x70, r6
+   bl  Lconsts
+   lxvw4x  0, $x40, r6 # load XOR contents
+   mr  r6, $x70
+   li  $x70,0x70
+
subi$rounds,$rounds,3   # -4 in total
 
lvx $rndkey0,$x00,$key1 # load key schedule
@@ -2537,69 +2549,77 @@ Load_xts_enc_key:
?vperm  v31,v31,$twk5,$keyperm
lvx v25,$x10,$key_  # pre-load round[2]
 
+   # Switch to use the following codes with 0x010101..87 to generate tweak.
+   # eighty7 = 0x010101..87
+   # vsrab tmp, tweak, seven   # next tweak value, right shift 
7 bits
+   # vand  tmp, tmp, eighty7   # last byte with carry
+   # vaddubm   tweak, tweak, tweak # left shift 1 bit (x2)
+   # xxlor vsx, 0, 0
+   # vpermxor  tweak, tweak, tmp, vsx
+
 vperm  $in0,$inout,$inptail,$inpperm
 subi   $inp,$inp,31# undo "caller"
vxor$twk0,$tweak,$rndkey0
vsrab   $tmp,$tweak,$seven  # next tweak value
vaddubm $tweak,$tweak,$tweak
-   vsldoi  $tmp,$tmp,$tmp,15
vand$tmp,$tmp,$eighty7
 vxor   $out0,$in0,$twk0
-   vxor$tweak,$tweak,$tmp
+   xxlor   32+$in1, 0, 0
+   vpermxor$tweak, $tweak, $tmp, $in1
 
 lvx_u  $in1,$x10,$inp
vxor$twk1,$tweak,$rndkey0
vsrab   $tmp,$tweak,$seven  # next tweak value
vaddubm $tweak,$tweak,$tweak
-   vsldoi  $tmp,$tmp,$tmp,15
 le?vperm   $in1,$in1,$in1,$leperm
vand$tmp,$tmp,$eighty7
 vxor   $out1,$in1,$twk1
-   vxor$tweak,$tweak,$tmp
+   xxlor   32+$in2, 0, 0
+   vpermxor$tweak, $tweak, $tmp, $in2
 
 lvx_u  $in2,$x20,$inp
 andi.  $taillen,$len,15
vxor$twk2,$tweak,$rndkey0
vsrab   $tmp,$tweak,$seven  # next tweak value
vaddubm $tweak,$tweak,$tweak
-   vsldoi  $tmp,$tmp,$tmp,15
 le?vperm   $in2,$in2,$in2,$leperm
vand$tmp,$tmp,$eighty7
 vxor   $out2,$in2,$twk2
-   vxor$tweak,$tweak,$tmp
+   xxlor   32+$in3, 0, 0
+   vpermxor$tweak, $tweak, $tmp, $in3
 
 lvx_u  $in3,$x30,$inp
 sub$len,$len,$taillen
vxor$twk3,$tweak,$rndkey0
vsrab   $tmp,$tweak,$seven  # next tweak value
vaddubm $tweak,$tweak,$tweak
-   vsldoi  $tmp,$tmp,$tmp,15
 le?vperm   $in3,$in3,$in3,$leperm
vand$tmp,$tmp,$eighty7
 vxor   $out3,$in3,$twk3
-   vxor$tweak,$tweak,$tmp
+   xxlor   32+$in4, 0, 0
+   vpermxor$tweak, $tweak, $tmp, $in4
 
 lvx_u  $in4,$x40,$inp
 subi   $len,$len,0x60
vxor$twk4,$tweak,$rndkey0
vsrab   $tmp,$tweak,$seven  # next tweak value
vaddubm $tweak,$tweak,$tweak
-   vsldoi  $tmp,$tmp,$tmp,15
 le?vperm   $in4,$in4,$in4,$leperm
vand$tmp,$tmp,$eighty7
 vxor   $out4,$in4,$twk4
-   vxor

Recent Power changes and stack_trace_save_tsk_reliable?

2023-08-29 Thread Joe Lawrence
Hi ppc-dev list,

We noticed that our kpatch integration tests started failing on ppc64le
when targeting the upstream v6.4 kernel, and then confirmed that the
in-tree livepatching kselftests similarly fail, too.  From the kselftest
results, it appears that livepatch transitions are no longer completing.

Looking at the commit logs for v6.4, there looks to be some churn in the
powerpc stack layout code -- I am suspicious that "reliable" stack
unwinding may be left untested/broken after those changes.  AFAICT, the
livepatching subsystem is the only user of this interface in
kernel/livepatch/transition.c :: klp_check_stack()'s call to
stack_trace_save_tsk_reliable().  As such, the livepatching kselftests
are probably the only way to test reliable unwinding.

Unfortunately, git bisect isn't cooperating (we keep falling into a long
span of non-bootable commits, despite efforts to `git bisect skip` over
them), so we don't have an offending commit or patchset to point to.

A few other details:

- Test machine is a Power 9 9009-42A (IBM Power System S924)
- Reproducable with v6.4, v6.5
- Minimal repro:
-- Build with CONFIG_TEST_LIVEPATCH=m
-- Run tools/testing/selftests/livepatch/test-livepatch.sh

If this has already been report or fixed, please send any pointers to
threads / commits.  If not, I can provide any other info to help
reproduce.

Thanks,

--
Joe



Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"

2023-08-29 Thread Masahiro Yamada
On Tue, Aug 29, 2023 at 3:55 PM Nicolas Schier  wrote:
>
> On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote:
> > Masahiro Yamada  writes:
> > > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook  wrote:
> > >>
> > >> Hi,
> > >>
> > >> This is my series to show *.config targets in the "help" target so these
> > >> various topics can be more easily discoverd.
> > >>
> > >> v2:
> > >>  - split .fragment from .config to hide "internal" fragments
> > >
> > > Please do not do this churn.
> >
> > That was my idea :}
> >
> > > Like Randy, I did not get "why" part quiet well,
> > > but if you are eager about this,
> > > you can show help message only when the following
> > > ("# Help:" prefix for example) is found in the first line.
> > >
> > > # Help: blah blah
> > > # other comment
> >
> > I did think of that, but wasn't sure how to do it in make.
>
> Something like this should do it:
>
> @grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call 
> configfiles,*.config))), $(firstword $(call configfiles,$(f | \
>  while read loc dummy helptext; do \
> tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \
> [ "$${line}" = "1" ] && \
>   printf "  %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \
>  done
>
> but this neither beautiful nor elegant it likes to be improved.
>
> Kind regards,
> Nicolas




The attached patch will work too.

I dropped the "in the first line" restriction
because SPDX might be placed in the first line
of config fragments.



-- 
Best Regards
Masahiro Yamada
diff --git a/Makefile b/Makefile
index e21bf66af6fd..23cd62a5ff05 100644
--- a/Makefile
+++ b/Makefile
@@ -1552,7 +1552,6 @@ help:
 	@echo  '  mrproper	  - Remove all generated files + config + various backup files'
 	@echo  '  distclean	  - mrproper + remove editor backup and patch files'
 	@echo  ''
-	@echo  'Configuration targets:'
 	@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
 	@echo  ''
 	@echo  'Other generic targets:'
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index fdc2e3abd615..c4b2a8a19fc8 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -335,9 +335,5 @@ define archhelp
   echo  '			  bzdisk/fdimage*/hdimage/isoimage also accept:'
   echo  '			  FDARGS="..."  arguments for the booted kernel'
   echo  '			  FDINITRD=file initrd for the booted kernel'
-  echo  ''
-  echo  '  kvm_guest.config	- Enable Kconfig items for running this kernel as a KVM guest'
-  echo  '  xen.config		- Enable Kconfig items for running this kernel as a Xen guest'
-  echo  '  x86_debug.config	- Enable tip tree debugging options for testing'
 
 endef
diff --git a/kernel/configs/kvm_guest.config b/kernel/configs/kvm_guest.config
index 208481d91090..d0877063d925 100644
--- a/kernel/configs/kvm_guest.config
+++ b/kernel/configs/kvm_guest.config
@@ -1,3 +1,4 @@
+# Help: Bootable as a KVM guest
 CONFIG_NET=y
 CONFIG_NET_CORE=y
 CONFIG_NETDEVICES=y
diff --git a/kernel/configs/x86_debug.config b/kernel/configs/x86_debug.config
index 6fac5b405334..35f48671b8d5 100644
--- a/kernel/configs/x86_debug.config
+++ b/kernel/configs/x86_debug.config
@@ -1,3 +1,4 @@
+# Help: Debugging options for tip tree testing
 CONFIG_X86_DEBUG_FPU=y
 CONFIG_LOCK_STAT=y
 CONFIG_DEBUG_VM=y
diff --git a/kernel/configs/xen.config b/kernel/configs/xen.config
index 436f806aa1ed..6878b9a49be8 100644
--- a/kernel/configs/xen.config
+++ b/kernel/configs/xen.config
@@ -1,3 +1,5 @@
+# Help: Bootable as a Xen guest
+#
 # global stuff - these enable us to allow some
 # of the not so generic stuff below for xen
 CONFIG_PARAVIRT=y
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index af1c96198f49..e72c5ee659a9 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -93,11 +93,13 @@ endif
 %_defconfig: $(obj)/conf
 	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
 
-configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
+configfiles = $(wildcard $(srctree)/kernel/configs/$(1) $(srctree)/arch/$(SRCARCH)/configs/$(1))
+all-config-fragments = $(call configfiles,*)
+config-fragments = $(call configfiles,$@)
 
 %.config: $(obj)/conf
-	$(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
-	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles)
+	$(if $(config-fragments),, $(error $@ fragment does not exists on this architecture))
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(config-fragments)
 	$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 
 PHONY += tinyconfig
@@ -115,6 +117,7 @@ clean-files += tests/.cache
 
 # Help text used by make help
 help:
+	@echo  'Configuration targets:'
 	@echo  '  config	  - Update current config utilising a line-oriented program'
 	@echo  '  nconfig - Update current config utilising a ncurses menu based program'
 	@echo  '  menuconfig	  - Update current config 

Re: [PATCH] kbuild: single-quote the format string of printf

2023-08-29 Thread Nicolas Schier
On Tue 29 Aug 2023 20:35:31 GMT, Masahiro Yamada wrote:
> Use single-quotes to avoid escape sequences (\\n).
> 
> Signed-off-by: Masahiro Yamada 
> ---

Is this really necessary?  Testing w/ GNU Make 4.3, bash 5.2.15 or
dash 0.5.12-6 and a stupid Makefile snippet I cannot see any difference 
between these three:

print:
@printf "hello med single-backslash and double quotes\n"
@printf 'hello med single-backslash and single quotes\n'
@printf "hello med double-backslash and double quotes\\n"

Only double-backslash+n in single-quotes does not work, for obvious 
reasons.

Is this some compatibility to older make versions or other shells?

Iff it is, we should have several cases that are actually broken right 
now:

$ git grep -Hrne 'printf.*".*\\n' '**/Makefile*' '**/Kbuild*' 
arch/mips/Makefile:480:   printf "  %-24s - Build generic kernel for $(call 
describe_generic_defconfig,$(cfg))\n" $(cfg);)
arch/mips/Makefile:486:   printf "  %-24s - Build $($(cfg)-y)\n" $(cfg);)
samples/bpf/Makefile:238:HDR_PROBE := $(shell printf "$(pound)include 
\n struct list_head { int a; }; int main() { return 0; }" | \
samples/hid/Makefile:76:HDR_PROBE := $(shell printf "$(pound)include 
\n struct list_head { int a; }; int main() { return 0; }" | \
scripts/Makefile.compiler:41:   printf "%b\n" "$(1)" | $(CC) -Werror 
$(CLANG_FLAGS) $(KBUILD_AFLAGS) -c -x assembler-with-cpp -o "$$TMP" -,$(2),$(3))
scripts/Makefile.lib:437:printf "%08x\n" $$dec_size |   
\
scripts/Makefile.modfinal:43:   printf "Skipping BTF generation for %s 
due to unavailability of vmlinux\n" $@ 1>&2; \
scripts/Makefile.modfinal:45:   printf "Skipping BTF generation for %s 
because it's a Rust module\n" $@ 1>&2; \
security/tomoyo/Makefile:11:printf '\t"";\n';) \
tools/testing/selftests/Makefile:263:   [ ! -d $(INSTALL_PATH)/$$TARGET 
] && printf "Skipping non-existent dir: $$TARGET\n" && continue; \
tools/testing/selftests/Makefile:264:   printf "Emit Tests for 
$$TARGET\n"; \
tools/testing/selftests/nolibc/Makefile:136: if (s+f > 0) printf(" 
See all results in %s\n", ARGV[1]); else print; }' \
tools/testing/selftests/nolibc/Makefile:155: if (s+f > 0) printf(" 
See all results in %s\n", ARGV[1]); else print; }' \
tools/testing/selftests/nolibc/Makefile:163: if (s+f > 0) printf(" 
See all results in %s\n", ARGV[1]); else print; }' \
tools/testing/selftests/wireguard/qemu/Makefile:335:printf 
'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n'
 >> $(KERNEL_BUILD_PATH)/minimal.config

I assume, that changing '\\n' occurrences in all Makefiles to '\n' 
should be enough; but only a cosmetic change.  Or did I miss some
point?

Kind regards,
Nicolas


> 
>  Makefile  | 8 
>  arch/powerpc/Makefile | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 87a9eef3fb4b..d09600f7a036 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1643,12 +1643,12 @@ help:
>   @echo  ''
>   @$(if $(boards), \
>   $(foreach b, $(boards), \
> - printf "  %-27s - Build for %s\\n" $(b) $(subst 
> _defconfig,,$(b));) \
> + printf '  %-27s - Build for %s\n' $(b) $(subst 
> _defconfig,,$(b));) \
>   echo '')
>   @$(if $(board-dirs), \
>   $(foreach b, $(board-dirs), \
> - printf "  %-16s - Show %s-specific targets\\n" help-$(b) $(b);) 
> \
> - printf "  %-16s - Show all of the above\\n" help-boards; \
> + printf '  %-16s - Show %s-specific targets\n' help-$(b) $(b);) \
> + printf '  %-16s - Show all of the above\n' help-boards; \
>   echo '')
>  
>   @echo  '  make V=n   [targets] 1: verbose build'
> @@ -1684,7 +1684,7 @@ $(help-board-dirs): help-%:
>   @echo  'Architecture specific targets ($(SRCARCH) $*):'
>   @$(if $(boards-per-dir), \
>   $(foreach b, $(boards-per-dir), \
> - printf "  %-24s - Build for %s\\n" $*/$(b) $(subst 
> _defconfig,,$(b));) \
> + printf '  %-24s - Build for %s\n' $*/$(b) $(subst 
> _defconfig,,$(b));) \
>   echo '')
>  
>  
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index dac7ca153886..f49ac05eae20 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -353,7 +353,7 @@ define archhelp
>echo '  (minus the .dts extension).'
>echo
>$(foreach cfg,$(generated_configs),
> -printf "  %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));)
> +printf '  %-27s - Build for %s\n' $(cfg) $(subst _defconfig,,$(cfg));)
>  endef
>  
>  PHONY += install
> -- 
> 2.39.2


signature.asc
Description: PGP signature


Re: crypto: powerpc/chacha20,poly1305-p10 - Add dependency on VSX

2023-08-29 Thread Michael Ellerman
Herbert Xu  writes:
> On Fri, Aug 25, 2023 at 07:44:32PM +0800, kernel test robot wrote:
>>
>> All errors (new ones prefixed by >>):
>> 
>>In file included from arch/powerpc/crypto/poly1305-p10-glue.c:19:
>
> ...
>
>> ae3a197e3d0bfe3 David Howells2012-03-28  75  
>> ae3a197e3d0bfe3 David Howells2012-03-28  76  #ifdef CONFIG_VSX
>> d1e1cf2e38def30 Anton Blanchard  2015-10-29  77  extern void 
>> enable_kernel_vsx(void);
>> ae3a197e3d0bfe3 David Howells2012-03-28  78  extern void 
>> flush_vsx_to_thread(struct task_struct *);
>> 3eb5d5888dc68c9 Anton Blanchard  2015-10-29  79  static inline void 
>> disable_kernel_vsx(void)
>> 3eb5d5888dc68c9 Anton Blanchard  2015-10-29  80  {
>> 3eb5d5888dc68c9 Anton Blanchard  2015-10-29  81  
>> msr_check_and_clear(MSR_FP|MSR_VEC|MSR_VSX);
>> 3eb5d5888dc68c9 Anton Blanchard  2015-10-29  82  }
>> bd73758803c2eed Christophe Leroy 2021-03-09  83  #else
>> bd73758803c2eed Christophe Leroy 2021-03-09  84  static inline void 
>> enable_kernel_vsx(void)
>> bd73758803c2eed Christophe Leroy 2021-03-09  85  {
>> bd73758803c2eed Christophe Leroy 2021-03-09 @86  BUILD_BUG();
>> bd73758803c2eed Christophe Leroy 2021-03-09  87  }
>> bd73758803c2eed Christophe Leroy 2021-03-09  88  
>
> ---8<---
> Add dependency on VSX as otherwise the build will fail without
> it.
>
> Fixes: 161fca7e3e90 ("crypto: powerpc - Add chacha20/poly1305-p10 to Kconfig 
> and Makefile")
> Reported-by: kernel test robot 
> Closes: 
> https://lore.kernel.org/oe-kbuild-all/202308251906.syawej6g-...@intel.com/
> Signed-off-by: Herbert Xu 

Acked-by: Michael Ellerman  (powerpc)

cheers

> diff --git a/arch/powerpc/crypto/Kconfig b/arch/powerpc/crypto/Kconfig
> index f25024afdda5..7a66d7c0e6a2 100644
> --- a/arch/powerpc/crypto/Kconfig
> +++ b/arch/powerpc/crypto/Kconfig
> @@ -113,7 +113,7 @@ config CRYPTO_AES_GCM_P10
>  
>  config CRYPTO_CHACHA20_P10
>   tristate "Ciphers: ChaCha20, XChacha20, XChacha12 (P10 or later)"
> - depends on PPC64 && CPU_LITTLE_ENDIAN
> + depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
>   select CRYPTO_SKCIPHER
>   select CRYPTO_LIB_CHACHA_GENERIC
>   select CRYPTO_ARCH_HAVE_LIB_CHACHA
> @@ -127,7 +127,7 @@ config CRYPTO_CHACHA20_P10
>  
>  config CRYPTO_POLY1305_P10
>   tristate "Hash functions: Poly1305 (P10 or later)"
> - depends on PPC64 && CPU_LITTLE_ENDIAN
> + depends on PPC64 && CPU_LITTLE_ENDIAN && VSX
>   select CRYPTO_HASH
>   select CRYPTO_LIB_POLY1305_GENERIC
>   help
> -- 
> Email: Herbert Xu 
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH] kbuild: single-quote the format string of printf

2023-08-29 Thread Masahiro Yamada
Use single-quotes to avoid escape sequences (\\n).

Signed-off-by: Masahiro Yamada 
---

 Makefile  | 8 
 arch/powerpc/Makefile | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 87a9eef3fb4b..d09600f7a036 100644
--- a/Makefile
+++ b/Makefile
@@ -1643,12 +1643,12 @@ help:
@echo  ''
@$(if $(boards), \
$(foreach b, $(boards), \
-   printf "  %-27s - Build for %s\\n" $(b) $(subst 
_defconfig,,$(b));) \
+   printf '  %-27s - Build for %s\n' $(b) $(subst 
_defconfig,,$(b));) \
echo '')
@$(if $(board-dirs), \
$(foreach b, $(board-dirs), \
-   printf "  %-16s - Show %s-specific targets\\n" help-$(b) $(b);) 
\
-   printf "  %-16s - Show all of the above\\n" help-boards; \
+   printf '  %-16s - Show %s-specific targets\n' help-$(b) $(b);) \
+   printf '  %-16s - Show all of the above\n' help-boards; \
echo '')
 
@echo  '  make V=n   [targets] 1: verbose build'
@@ -1684,7 +1684,7 @@ $(help-board-dirs): help-%:
@echo  'Architecture specific targets ($(SRCARCH) $*):'
@$(if $(boards-per-dir), \
$(foreach b, $(boards-per-dir), \
-   printf "  %-24s - Build for %s\\n" $*/$(b) $(subst 
_defconfig,,$(b));) \
+   printf '  %-24s - Build for %s\n' $*/$(b) $(subst 
_defconfig,,$(b));) \
echo '')
 
 
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index dac7ca153886..f49ac05eae20 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -353,7 +353,7 @@ define archhelp
   echo '  (minus the .dts extension).'
   echo
   $(foreach cfg,$(generated_configs),
-printf "  %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));)
+printf '  %-27s - Build for %s\n' $(cfg) $(subst _defconfig,,$(cfg));)
 endef
 
 PHONY += install
-- 
2.39.2



Re: [RFC v2 1/2] powerpc/cpuidle: cpuidle wakeup latency based on IPI and timer events

2023-08-29 Thread Srikar Dronamraju
* Aboorva Devarajan  [2023-08-28 11:45:29]:

> From: Pratik R. Sampat 
> 
> Introduce a mechanism to fire directed IPIs from a source CPU to a
> specified target CPU and measure the time incurred on waking up the
> target CPU in response.
> 
> Also, introduce a mechanism to queue a hrtimer on a specified CPU and
> subsequently measure the time taken to wakeup the CPU.
> 
> Define a simple debugfs interface that allows for adjusting the
> settings to trigger IPI and timer events on a designated CPU, and to
> observe the resulting cpuidle wakeup latencies.
> 
> Signed-off-by: Pratik R. Sampat 
> Signed-off-by: Aboorva Devarajan 
> Reviewed-by: Shrikanth Hegde 
> ---
>  arch/powerpc/Kconfig.debug |  10 ++
>  arch/powerpc/kernel/Makefile   |   1 +
>  arch/powerpc/kernel/test_cpuidle_latency.c | 156 +
>  3 files changed, 167 insertions(+)
>  create mode 100644 arch/powerpc/kernel/test_cpuidle_latency.c
> 
> diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> index 2a54fadbeaf5..e175fc3028ac 100644
> --- a/arch/powerpc/Kconfig.debug
> +++ b/arch/powerpc/Kconfig.debug
> @@ -391,3 +391,13 @@ config KASAN_SHADOW_OFFSET
>   default 0xe000 if PPC32
>   default 0xa80e if PPC_BOOK3S_64
>   default 0xa8001c00 if PPC_BOOK3E_64
> +
> +config CPUIDLE_LATENCY_SELFTEST
> + tristate "Cpuidle latency selftests"
> + depends on CPU_IDLE
> + help
> +   Provides a kernel module that run tests using the IPI and
> +   timers to measure cpuidle latency.
> +
> +   Say M if you want these self tests to build as a module.
> +   Say N if you are unsure.
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index 2919433be355..3205ecbd9d8f 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -87,6 +87,7 @@ obj-$(CONFIG_PPC_WATCHDOG)  += watchdog.o
>  obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
>  obj-$(CONFIG_PPC_DAWR)   += dawr.o
>  obj-$(CONFIG_PPC_BOOK3S_64)  += cpu_setup_ppc970.o cpu_setup_pa6t.o
> +obj-$(CONFIG_CPUIDLE_LATENCY_SELFTEST)  += test_cpuidle_latency.o

This line is now introduced in between CONFIG_PPC_BOOK3S_64 objects.
May be its better this was added such that CONFIG_PPC_BOOK3S_64 objects
are all together.

>  obj-$(CONFIG_PPC_BOOK3S_64)  += cpu_setup_power.o
>  obj-$(CONFIG_PPC_BOOK3S_64)  += mce.o mce_power.o
>  obj-$(CONFIG_PPC_BOOK3E_64)  += exceptions-64e.o idle_64e.o
> diff --git a/arch/powerpc/kernel/test_cpuidle_latency.c 
> b/arch/powerpc/kernel/test_cpuidle_latency.c
> new file mode 100644
> index ..3c3c119389c1
> --- /dev/null
> +++ b/arch/powerpc/kernel/test_cpuidle_latency.c
> @@ -0,0 +1,156 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Module-based API test facility for cpuidle latency using IPIs and timers
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +/*
> + * IPI based wakeup latencies
> + * Measure time taken for a CPU to wakeup on a IPI sent from another CPU
> + * The latency measured also includes the latency of sending the IPI
> + */
> +struct latency {
> + unsigned int src_cpu;
> + unsigned int dest_cpu;
> + ktime_t time_start;
> + ktime_t time_end;
> + u64 latency_ns;
> +} ipi_wakeup;
> +
> +static void measure_latency(void *info)
> +{
> + struct latency *v;
> + ktime_t time_diff;
> +
> + v = (struct latency *)info;

NIT: The above line could have been part of the declaration itself.

> + v->time_end = ktime_get();
> + time_diff = ktime_sub(v->time_end, v->time_start);
> + v->latency_ns = ktime_to_ns(time_diff);
> +}
> +
> +void run_smp_call_function_test(unsigned int cpu)
> +{
> + ipi_wakeup.src_cpu = smp_processor_id();
> + ipi_wakeup.dest_cpu = cpu;
> + ipi_wakeup.time_start = ktime_get();
> + smp_call_function_single(cpu, measure_latency, _wakeup, 1);
> +}
> +
> +/*
> + * Timer based wakeup latencies
> + * Measure time taken for a CPU to wakeup on a timer being armed and fired
> + */
> +struct timer_data {
> + unsigned int src_cpu;
> + u64 timeout;
> + ktime_t time_start;
> + ktime_t time_end;
> + struct hrtimer timer;
> + u64 timeout_diff_ns;
> +} timer_wakeup;
> +
> +static enum hrtimer_restart hrtimer_callback(struct hrtimer *hrtimer)
> +{
> + struct timer_data *w;
> + ktime_t time_diff;
> +
> + w = container_of(hrtimer, struct timer_data, timer);
> + w->time_end = ktime_get();
> +
> + time_diff = ktime_sub(w->time_end, w->time_start);
> + time_diff = ktime_sub(time_diff, ns_to_ktime(w->timeout));
> + w->timeout_diff_ns = ktime_to_ns(time_diff);
> + return HRTIMER_NORESTART;
> +}
> +
> +static void run_timer_test(unsigned int ns)
> +{
> + hrtimer_init(_wakeup.timer, CLOCK_MONOTONIC,
> +  HRTIMER_MODE_REL);

No need to break the above line.

> + timer_wakeup.timer.function = hrtimer_callback;
> + 

[PATCH] kbuild: dummy-tools: -mprofile-kernel is not limited to little endian

2023-08-29 Thread Michal Suchanek
Fixes: aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big endian ELFv2 
kernels")
Signed-off-by: Michal Suchanek 
---
 scripts/dummy-tools/gcc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc
index 1db1889f6d81..ebb34d016e5f 100755
--- a/scripts/dummy-tools/gcc
+++ b/scripts/dummy-tools/gcc
@@ -85,7 +85,7 @@ if arg_contain -S "$@"; then
fi
 
# For arch/powerpc/tools/gcc-check-mprofile-kernel.sh
-   if arg_contain -m64 "$@" && arg_contain -mlittle-endian "$@" &&
+   if arg_contain -m64 "$@" &&
arg_contain -mprofile-kernel "$@"; then
if ! test -t 0 && ! grep -q notrace; then
echo "_mcount"
-- 
2.41.0



Re: [PATCH 0/3] Fix preemption errors in watchpoints

2023-08-29 Thread Benjamin Gray

On 29/8/23 4:34 pm, Benjamin Gray wrote:

When enabling debug config options relating to preemption, several bugs
appear in the kernel log. With this series applied, the breakpoint code
no longer prints bugs when running the powerpc/ptrace selftests.

Benjamin Gray (3):
   powerpc/watchpoints: Disable preemption in thread_change_pc()
   powerpc/watchpoint: Disable pagefaults when getting user instruction
   powerpc/watchpoints: Annotate atomic context in more places

  arch/powerpc/kernel/hw_breakpoint.c | 16 +++-
  arch/powerpc/kernel/hw_breakpoint_constraints.c |  7 ++-
  2 files changed, 21 insertions(+), 2 deletions(-)

--
2.41.0


The particular config is below, used by appending to a 
ppc64le_guest_defconfig. Not all options are relevant. Tested on a 
Power8 and Power10 machine (1 and 2 watchpoints).


CONFIG_LOCALVERSION="-watchpoint-sleep"
CONFIG_GENERIC_IRQ_DEBUGFS=y
CONFIG_PREEMPT=y
CONFIG_PRINTK_INDEX=y
CONFIG_CGROUP_DEBUG=y
CONFIG_PPC_KUAP_DEBUG=y
CONFIG_SCOM_DEBUGFS=y
CONFIG_UDBG_RTAS_CONSOLE=y
CONFIG_RELOCATABLE_TEST=y
CONFIG_PM_DEBUG=y
CONFIG_PM_ADVANCED_DEBUG=y
CONFIG_STATIC_KEYS_SELFTEST=y
CONFIG_MODULE_DEBUG=y
CONFIG_MODULE_STATS=y
CONFIG_MODULE_DEBUG_AUTOLOAD_DUPS_TRACE=y
CONFIG_CMA_DEBUGFS=y
CONFIG_CMA_SYSFS=y
CONFIG_PERCPU_STATS=y
CONFIG_USERFAULTFD=y
CONFIG_VALIDATE_FS_PARSER=y
CONFIG_EXT4_DEBUG=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_DYNAMIC_DEBUG=y
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
CONFIG_DEBUG_INFO_SPLIT=y
CONFIG_GDB_SCRIPTS=y
CONFIG_READABLE_ASM=y
CONFIG_NET_DEV_REFCNT_TRACKER=y
CONFIG_NET_NS_REFCNT_TRACKER=y
CONFIG_DEBUG_NET=y
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_SLUB_DEBUG_ON=y
CONFIG_PTDUMP_DEBUGFS=y
CONFIG_DEBUG_KMEMLEAK=y
CONFIG_PER_VMA_LOCK_STATS=y
CONFIG_DEBUG_OBJECTS=y
CONFIG_DEBUG_OBJECTS_SELFTEST=y
CONFIG_DEBUG_OBJECTS_FREE=y
CONFIG_DEBUG_OBJECTS_TIMERS=y
CONFIG_DEBUG_OBJECTS_WORK=y
CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
CONFIG_SHRINKER_DEBUG=y
CONFIG_SCHED_STACK_END_CHECK=y
CONFIG_DEBUG_VM=y
CONFIG_DEBUG_VM_MAPLE_TREE=y
CONFIG_DEBUG_VM_RB=y
CONFIG_DEBUG_VM_PGFLAGS=y
CONFIG_DEBUG_VM_PGTABLE=y
CONFIG_DEBUG_VIRTUAL=y
CONFIG_DEBUG_PER_CPU_MAPS=y
CONFIG_DEBUG_SHIRQ=y
CONFIG_WQ_WATCHDOG=y
CONFIG_DEBUG_TIMEKEEPING=y
CONFIG_DEBUG_PREEMPT=y
CONFIG_PROVE_LOCKING=y
CONFIG_LOCK_STAT=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
CONFIG_CSD_LOCK_WAIT_DEBUG=y
CONFIG_DEBUG_IRQFLAGS=y
CONFIG_WARN_ALL_UNSEEDED_RANDOM=y
CONFIG_DEBUG_NOTIFIERS=y
CONFIG_DEBUG_CREDENTIALS=y
CONFIG_RCU_CPU_STALL_CPUTIME=y
CONFIG_RCU_EQS_DEBUG=y
CONFIG_DEBUG_WQ_FORCE_RR_CPU=y
CONFIG_CPU_HOTPLUG_STATE_CONTROL=y
CONFIG_LATENCYTOP=y
CONFIG_PPC_IRQ_SOFT_MASK_DEBUG=y
CONFIG_PPC_RFI_SRR_DEBUG=y



[PATCH 3/3] powerpc/watchpoints: Annotate atomic context in more places

2023-08-29 Thread Benjamin Gray
It can be easy to miss that the notifier mechanism invokes the callbacks
in an atomic context, so add some comments to that effect on the two
handlers we register here.

Signed-off-by: Benjamin Gray 
---
 arch/powerpc/kernel/hw_breakpoint.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c 
b/arch/powerpc/kernel/hw_breakpoint.c
index 2854376870cf..a1318ce18d0e 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -368,6 +368,11 @@ static void handle_p10dd1_spurious_exception(struct 
perf_event **bp,
}
 }
 
+/*
+ * Handle a DABR or DAWR exception.
+ *
+ * Called in atomic context.
+ */
 int hw_breakpoint_handler(struct die_args *args)
 {
bool err = false;
@@ -495,6 +500,8 @@ NOKPROBE_SYMBOL(hw_breakpoint_handler);
 
 /*
  * Handle single-step exceptions following a DABR hit.
+ *
+ * Called in atomic context.
  */
 static int single_step_dabr_instruction(struct die_args *args)
 {
@@ -546,6 +553,8 @@ NOKPROBE_SYMBOL(single_step_dabr_instruction);
 
 /*
  * Handle debug exception notifications.
+ *
+ * Called in atomic context.
  */
 int hw_breakpoint_exceptions_notify(
struct notifier_block *unused, unsigned long val, void *data)
-- 
2.41.0



[PATCH 0/3] Fix preemption errors in watchpoints

2023-08-29 Thread Benjamin Gray
When enabling debug config options relating to preemption, several bugs
appear in the kernel log. With this series applied, the breakpoint code
no longer prints bugs when running the powerpc/ptrace selftests.

Benjamin Gray (3):
  powerpc/watchpoints: Disable preemption in thread_change_pc()
  powerpc/watchpoint: Disable pagefaults when getting user instruction
  powerpc/watchpoints: Annotate atomic context in more places

 arch/powerpc/kernel/hw_breakpoint.c | 16 +++-
 arch/powerpc/kernel/hw_breakpoint_constraints.c |  7 ++-
 2 files changed, 21 insertions(+), 2 deletions(-)

--
2.41.0


[PATCH 2/3] powerpc/watchpoint: Disable pagefaults when getting user instruction

2023-08-29 Thread Benjamin Gray
This is called in an atomic context, so is not allowed to sleep if a
user page needs to be faulted in and has nowhere it can be deferred to.
The pagefault_disabled() function is documented as preventing user
access methods from sleeping.

In practice the page will be mapped in nearly always because we are
reading the instruction that just triggered the watchpoint trap.

Signed-off-by: Benjamin Gray 
---
 arch/powerpc/kernel/hw_breakpoint_constraints.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint_constraints.c 
b/arch/powerpc/kernel/hw_breakpoint_constraints.c
index a74623025f3a..9e51801c4915 100644
--- a/arch/powerpc/kernel/hw_breakpoint_constraints.c
+++ b/arch/powerpc/kernel/hw_breakpoint_constraints.c
@@ -131,8 +131,13 @@ void wp_get_instr_detail(struct pt_regs *regs, ppc_inst_t 
*instr,
 int *type, int *size, unsigned long *ea)
 {
struct instruction_op op;
+   int err;
 
-   if (__get_user_instr(*instr, (void __user *)regs->nip))
+   pagefault_disable();
+   err = __get_user_instr(*instr, (void __user *)regs->nip);
+   pagefault_enable();
+
+   if (err)
return;
 
analyse_instr(, regs, *instr);
-- 
2.41.0



[PATCH 1/3] powerpc/watchpoints: Disable preemption in thread_change_pc()

2023-08-29 Thread Benjamin Gray
thread_change_pc() uses CPU local data, so must be protected from
swapping CPUs while it is reading the breakpoint struct.

The error is more noticeable after 1e60f3564bad ("powerpc/watchpoints:
Track perf single step directly on the breakpoint"), which added an
unconditional __this_cpu_read() call in thread_change_pc(). However the
existing __this_cpu_read() that runs if a breakpoint does need to be
re-inserted has the same issue.

Signed-off-by: Benjamin Gray 

---

There's probably a more idiomatic way to express this. We technically
don't need to disable preemption for the entire function: we should only
need to disable preemption within each loop iteration while handling the
pointer we are working with. Each iteration itself is independent.
---
 arch/powerpc/kernel/hw_breakpoint.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/hw_breakpoint.c 
b/arch/powerpc/kernel/hw_breakpoint.c
index b8513dc3e53a..2854376870cf 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -230,13 +230,15 @@ void thread_change_pc(struct task_struct *tsk, struct 
pt_regs *regs)
struct arch_hw_breakpoint *info;
int i;
 
+   preempt_disable();
+
for (i = 0; i < nr_wp_slots(); i++) {
struct perf_event *bp = __this_cpu_read(bp_per_reg[i]);
 
if (unlikely(bp && counter_arch_bp(bp)->perf_single_step))
goto reset;
}
-   return;
+   goto out;
 
 reset:
regs_set_return_msr(regs, regs->msr & ~MSR_SE);
@@ -245,6 +247,9 @@ void thread_change_pc(struct task_struct *tsk, struct 
pt_regs *regs)
__set_breakpoint(i, info);
info->perf_single_step = false;
}
+
+out:
+   preempt_enable();
 }
 
 static bool is_larx_stcx_instr(int type)
-- 
2.41.0



Re: [PATCH v2 0/2] kbuild: Show Kconfig fragments in "help"

2023-08-29 Thread Nicolas Schier
On Mon 28 Aug 2023 16:17:07 GMT, Michael Ellerman wrote:
> Masahiro Yamada  writes:
> > On Sat, Aug 26, 2023 at 4:55 AM Kees Cook  wrote:
> >>
> >> Hi,
> >>
> >> This is my series to show *.config targets in the "help" target so these
> >> various topics can be more easily discoverd.
> >>
> >> v2:
> >>  - split .fragment from .config to hide "internal" fragments
> >
> > Please do not do this churn.
> 
> That was my idea :}
> 
> > Like Randy, I did not get "why" part quiet well,
> > but if you are eager about this,
> > you can show help message only when the following
> > ("# Help:" prefix for example) is found in the first line.
> >
> > # Help: blah blah
> > # other comment
> 
> I did think of that, but wasn't sure how to do it in make.

Something like this should do it:

@grep -Hnm1 -e '^# Help:' $(foreach f, $(sort $(notdir $(call 
configfiles,*.config))), $(firstword $(call configfiles,$(f | \
 while read loc dummy helptext; do \
tmp="$${loc%:#}"; file="$${tmp%:*}"; line="$${tmp##*:}"; \
[ "$${line}" = "1" ] && \
  printf "  %-25s - %s\\n" "$${file##*/}" "$${helptext}"; \
 done

but this neither beautiful nor elegant it likes to be improved.

Kind regards,
Nicolas


signature.asc
Description: PGP signature