Re: [GIT PULL] drm/arc: Yet another set of minor fixes

2019-11-27 Thread Daniel Vetter
On Wed, Nov 27, 2019 at 2:49 PM Alexey Brodkin
 wrote:
>
> Hi Daniel,
>
> > -Original Message-
> > From: Daniel Vetter 
> > Sent: Wednesday, November 27, 2019 1:07 PM
> > To: Alexey Brodkin 
> > Cc: Daniel Vetter ; David Airlie ; arcml 
> >  > a...@lists.infradead.org>; Eugeniy Paltsev ; 
> > dri-de...@lists.freedesktop.org
> > Subject: Re: [GIT PULL] drm/arc: Yet another set of minor fixes
> >
> > On Wed, Nov 27, 2019 at 07:48:04AM +, Alexey Brodkin wrote:
> > > Hi David, Daniel!
> > >
> > > The following changes since commit 
> > > 8082731830a0b95f7f7a63b78de67de446013c80:
> > >
> > >   drm/vram: remove unused declaration (2019-11-27 07:51:49 +0100)
> > >
> > > are available in the Git repository at:
> > >
> > >   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.11.27
> > >
> > > for you to fetch changes up to b2c68fb15a4c2e27f80353d3067dce30882a0972:
> > >
> > >   DRM: ARC: PGU: add ARGB format to supported format list (2019-11-27 
> > > 10:38:24 +0300)
> > >
> > > 
> > > Clean-up and fixes for FourCC handling in ARC PGU.
> > >
> > > 
> > > Eugeniy Paltsev (4):
> > >   DRM: ARC: PGU: fix framebuffer format switching
> > >   DRM: ARC: PGU: cleanup supported format list code
> > >   DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
> > >   DRM: ARC: PGU: add ARGB format to supported format list
> >
> > Uh, this seems to be based on some random snapshot of drm-misc-next, so
> > contains a _lot_ more than just these 4 patches (compared to drm-next).
>
> Indeed it's based off of today's "drm-misc-next". That's because I still get
> lost when I have to deal with DRM trees which we have a plenty.
>
> I guess there should be a clean explanation of which repo and branch should be
> used for which purpose, right? May I have a reference to it then?

It's the same as for any other subsystem:
- don't base your stuff on top of random other trees
- except when you have a very specific excuse (i.e. functional
conflict with stuff in drm-next or something like that), use a release
tag from Linus' tree as your baseline

And when generating the pull, actually generate the pull against the
target tree/branch (drm-fixes or drm-next), not something else.
-Daniel

>
> > If you want to move arcpgu to drm-misc (which would make tons of sense imo)
>
> Could you please elaborate a bit on this? Given we have a couple a patches if
> at all for each kernel release I'd prefer to escape a need to use yet another
> repo, tools etc as this doesn't simplify anything but instead makes simple
> things much more complex (if done rarely).
>
> > then:
> > - create a MAINTAINER patch to add drm-misc as the git repo for it
> > - request your account for drm-misc, see 
> > https://www.freedesktop.org/wiki/AccountRequests/
> > - and set up the scripts 
> > https://drm.pages.freedesktop.org/maintainer-tools/getting-started.html
>
> Thanks for the pointers
>
> > Or respin this one, but these small pulls have a habit of occasionally
> > getting lost :-/
>
> Well I'd better re-spin this, see below.
>
> The following changes since commit acc61b8929365e63a3e8c8c8913177795aa45594:
>
>   Merge tag 'drm-next-5.5-2019-11-22' of 
> git://people.freedesktop.org/~agd5f/linux into drm-next (2019-11-26 08:40:23 
> +1000)
>
> are available in the Git repository at:
>
>   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.11.27
>
> for you to fetch changes up to 9c2acc26c899aa12ad009dff10a5573ef769a7fd:
>
>   DRM: ARC: PGU: add ARGB format to supported format list (2019-11-27 
> 16:43:39 +0300)
>
> 
> Clean-up and fixes for FourCC handling in ARC PGU.
>
> 
> Eugeniy Paltsev (4):
>   DRM: ARC: PGU: fix framebuffer format switching
>   DRM: ARC: PGU: cleanup supported format list code
>   DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
>   DRM: ARC: PGU: add ARGB format to supported format list
>
>  drivers/gpu/drm/arc/arcpgu_crtc.c | 36 ++--
>  drivers/gpu/drm/arc/arcpgu_regs.h |  2 +-
>  2 files changed, 19 insertions(+), 19 deletions(-)
>
> -Alexey
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


RE: [GIT PULL] drm/arc: Yet another set of minor fixes

2019-11-27 Thread Alexey Brodkin
Hi Daniel,

> -Original Message-
> From: Daniel Vetter 
> Sent: Wednesday, November 27, 2019 1:07 PM
> To: Alexey Brodkin 
> Cc: Daniel Vetter ; David Airlie ; arcml 
>  a...@lists.infradead.org>; Eugeniy Paltsev ; 
> dri-de...@lists.freedesktop.org
> Subject: Re: [GIT PULL] drm/arc: Yet another set of minor fixes
> 
> On Wed, Nov 27, 2019 at 07:48:04AM +, Alexey Brodkin wrote:
> > Hi David, Daniel!
> >
> > The following changes since commit 8082731830a0b95f7f7a63b78de67de446013c80:
> >
> >   drm/vram: remove unused declaration (2019-11-27 07:51:49 +0100)
> >
> > are available in the Git repository at:
> >
> >   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.11.27
> >
> > for you to fetch changes up to b2c68fb15a4c2e27f80353d3067dce30882a0972:
> >
> >   DRM: ARC: PGU: add ARGB format to supported format list (2019-11-27 
> > 10:38:24 +0300)
> >
> > 
> > Clean-up and fixes for FourCC handling in ARC PGU.
> >
> > 
> > Eugeniy Paltsev (4):
> >   DRM: ARC: PGU: fix framebuffer format switching
> >   DRM: ARC: PGU: cleanup supported format list code
> >   DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
> >   DRM: ARC: PGU: add ARGB format to supported format list
> 
> Uh, this seems to be based on some random snapshot of drm-misc-next, so
> contains a _lot_ more than just these 4 patches (compared to drm-next).

Indeed it's based off of today's "drm-misc-next". That's because I still get
lost when I have to deal with DRM trees which we have a plenty.

I guess there should be a clean explanation of which repo and branch should be
used for which purpose, right? May I have a reference to it then?

> If you want to move arcpgu to drm-misc (which would make tons of sense imo)

Could you please elaborate a bit on this? Given we have a couple a patches if
at all for each kernel release I'd prefer to escape a need to use yet another
repo, tools etc as this doesn't simplify anything but instead makes simple
things much more complex (if done rarely).

> then:
> - create a MAINTAINER patch to add drm-misc as the git repo for it
> - request your account for drm-misc, see 
> https://www.freedesktop.org/wiki/AccountRequests/
> - and set up the scripts 
> https://drm.pages.freedesktop.org/maintainer-tools/getting-started.html 

Thanks for the pointers

> Or respin this one, but these small pulls have a habit of occasionally
> getting lost :-/

Well I'd better re-spin this, see below.

The following changes since commit acc61b8929365e63a3e8c8c8913177795aa45594:

  Merge tag 'drm-next-5.5-2019-11-22' of 
git://people.freedesktop.org/~agd5f/linux into drm-next (2019-11-26 08:40:23 
+1000)

are available in the Git repository at:

  g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.11.27

for you to fetch changes up to 9c2acc26c899aa12ad009dff10a5573ef769a7fd:

  DRM: ARC: PGU: add ARGB format to supported format list (2019-11-27 
16:43:39 +0300)


Clean-up and fixes for FourCC handling in ARC PGU.


Eugeniy Paltsev (4):
  DRM: ARC: PGU: fix framebuffer format switching
  DRM: ARC: PGU: cleanup supported format list code
  DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
  DRM: ARC: PGU: add ARGB format to supported format list

 drivers/gpu/drm/arc/arcpgu_crtc.c | 36 ++--
 drivers/gpu/drm/arc/arcpgu_regs.h |  2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)

-Alexey


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [GIT PULL] drm/arc: Yet another set of minor fixes

2019-11-27 Thread Daniel Vetter
On Wed, Nov 27, 2019 at 07:48:04AM +, Alexey Brodkin wrote:
> Hi David, Daniel!
> 
> The following changes since commit 8082731830a0b95f7f7a63b78de67de446013c80:
> 
>   drm/vram: remove unused declaration (2019-11-27 07:51:49 +0100)
> 
> are available in the Git repository at:
> 
>   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.11.27
> 
> for you to fetch changes up to b2c68fb15a4c2e27f80353d3067dce30882a0972:
> 
>   DRM: ARC: PGU: add ARGB format to supported format list (2019-11-27 
> 10:38:24 +0300)
> 
> 
> Clean-up and fixes for FourCC handling in ARC PGU.
> 
> 
> Eugeniy Paltsev (4):
>   DRM: ARC: PGU: fix framebuffer format switching
>   DRM: ARC: PGU: cleanup supported format list code
>   DRM: ARC: PGU: replace unsupported by HW RGB888 format by XRGB888
>   DRM: ARC: PGU: add ARGB format to supported format list

Uh, this seems to be based on some random snapshot of drm-misc-next, so
contains a _lot_ more than just these 4 patches (compared to drm-next).

If you want to move arcpgu to drm-misc (which would make tons of sense
imo) then:
- create a MAINTAINER patch to add drm-misc as the git repo for it
- request your account for drm-misc, see 
https://www.freedesktop.org/wiki/AccountRequests/
- and set up the scripts 
https://drm.pages.freedesktop.org/maintainer-tools/getting-started.html

Or respin this one, but these small pulls have a habit of occasionally
getting lost :-/

Cheers, Daniel

> 
>  drivers/gpu/drm/arc/arcpgu_crtc.c | 36 ++--
>  drivers/gpu/drm/arc/arcpgu_regs.h |  2 +-
>  2 files changed, 19 insertions(+), 19 deletions(-)
> 
> Thanks,
> Alexey

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


RE: [GIT PULL] drm/arc: Minor improvements

2019-11-27 Thread Alexey Brodkin
Hi all,

As Jose suggested I'm adding "drm-misc" maintainers as that tree
might be a better fit for ARC PGU patches.

-Alexey

> -Original Message-
> From: linux-snps-arc  On Behalf 
> Of Alexey Brodkin
> Sent: Wednesday, November 27, 2019 10:25 AM
> To: Daniel Vetter ; David Airlie 
> Cc: arcml ; Eugeniy Paltsev 
> ; dri-
> de...@lists.freedesktop.org
> Subject: RE: [GIT PULL] drm/arc: Minor improvements
> 
> Hi Daniel, David!
> 
> Any chance for this one to be processed sometime soon?
> It's been quite some time since July when I initially sent
> this pull-request.
> 
> -Alexey
> 
> > -Original Message-
> > From: linux-snps-arc  On Behalf 
> > Of Alexey Brodkin
> > Sent: Wednesday, November 13, 2019 2:30 PM
> > To: Daniel Vetter ; David Airlie 
> > Cc: arcml ; Eugeniy Paltsev 
> > ; dri-
> > de...@lists.freedesktop.org
> > Subject: RE: [GIT PULL] drm/arc: Minor improvements
> >
> > Hi Daniel, David,
> >
> > > -Original Message-
> > > From: linux-snps-arc  On 
> > > Behalf Of Alexey Brodkin
> > > Sent: Thursday, July 18, 2019 12:09 AM
> > > To: Daniel Vetter ; David Airlie 
> > > Cc: arcml ; 
> > > dri-de...@lists.freedesktop.org
> > > Subject: [GIT PULL] drm/arc: Minor improvements
> > >
> > > Hi Dave, Daniel,
> > >
> > > The following changes since commit 
> > > 7aaddd96d5febcf5b24357a326b3038d49a20532:
> > >
> > >   drm/modes: Don't apply cmdline's rotation if it wasn't specified 
> > > (2019-07-16 10:34:38 +0200)
> > >
> > > are available in the Git repository at:
> > >
> > >   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.07.18
> > >
> > > for you to fetch changes up to cee17a71656e9e1b5ffc01767844026550d5f4a9:
> > >
> > >   drm/arcpgu: rework encoder search (2019-07-17 23:36:56 +0300)
> > >
> > > 
> > > This is a pretty simple improvement that allows to find encoder
> > > as the one and only (ARC PGU doesn't support more than one) endpoint
> > > instead of using non-standard "encoder-slave" property.
> > >
> > > 
> > > Eugeniy Paltsev (1):
> > >   drm/arcpgu: rework encoder search
> > >
> > >  drivers/gpu/drm/arc/arcpgu_drv.c | 16 +---
> > >  1 file changed, 13 insertions(+), 3 deletions(-)
> >
> > Any chance for this one to get pulled into your tree(s) sometime soon?
> >
> > -Alexey
> >
> > ___
> > linux-snps-arc mailing list
> > linux-snps-arc@lists.infradead.org
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-
> 2Dsnps-
> >
> 2Darc=DwICAg=DPL6_X_6JkXFx7AXWqB0tg=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I=f3bFSjs3gZI9vC
> > LJW5sa6Kxu43yXUsCXhaUNhtEymmk=eFO6mnw8IJyfrQZYrMEbJ-bryplfw9LvcYBSCEyj5XA=
> 
> ___
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Dsnps-
> 2Darc=DwICAg=DPL6_X_6JkXFx7AXWqB0tg=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I=c8DhCL8_-
> 0iY2tS35o8kpDyvbHZ_Cu762s4qtn2hDVg=sGFaDT7yPIbVcjW49E_rjb6ND82Nrq0kplYjbztlh3A=

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARC: perf: Accommodate big-endian CPU

2019-11-27 Thread Greg Kroah-Hartman
On Wed, Nov 27, 2019 at 11:01:23AM +0300, Alexey Brodkin wrote:
> 8-letter strings representing ARC perf events are stores in two
> 32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.
> 
> And the same order of bytes in the word is used regardless CPU endianness.
> 
> Which means in case of big-endian CPU core we need to swap bytes to get
> the same order as if it was on little-endian CPU.
> 
> Otherwise we're seeing the following error message on boot:
> ->8--
> ARC perf: 8 counters (32 bits), 40 conditions, [overflow IRQ support]
> sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
> Stack Trace:
>   arc_unwind_core+0xd4/0xfc
>   dump_stack+0x64/0x80
>   sysfs_warn_dup+0x46/0x58
>   sysfs_add_file_mode_ns+0xb2/0x168
>   create_files+0x70/0x2a0
> [ cut here ]
> WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 
> perf_event_sysfs_init+0x70/0xa0
> Failed to register pmu: arc_pct, reason -17
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
> Stack Trace:
>   arc_unwind_core+0xd4/0xfc
>   dump_stack+0x64/0x80
>   __warn+0x9c/0xd4
>   warn_slowpath_fmt+0x22/0x2c
>   perf_event_sysfs_init+0x70/0xa0
> ---[ end trace a75fb9a9837bd1ec ]---
> ->8--
> 
> What happens here we're trying to register more than one raw perf event
> with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters
> and encoded into two 32-bit words. In this particular case we deal with 2
> events:
>  * "IJMP" which counts all jump & branch instructions
>  * "IJMPC___" which counts only conditional jumps & branches
> 
> Those strings are split in two 32-bit words this way "IJMP" + "" &
> "IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core
> being big-endian then we read "PMJI" + "" & "PMJI" + "___C".
> 
> And since we interpret read array of ASCII letters as a null-terminated string
> on big-endian CPU we end up with 2 events of the same name "PMJI".
> 
> Signed-off-by: Alexey Brodkin 
> Cc: sta...@vger.kernel.org
> ---
> 
> Greg, Sasha, this is the same patch as
> commit 5effc09c4907 ("ARC: perf: Accommodate big-endian CPU")
> but fine-tuned to be applicable to kernels 4.19 and older.

Thanks, now queued up.

greg k-h

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


RE: [GIT PULL] drm/arc: Minor improvements

2019-11-27 Thread Alexey Brodkin
Hi Daniel, David!

Any chance for this one to be processed sometime soon?
It's been quite some time since July when I initially sent
this pull-request.

-Alexey

> -Original Message-
> From: linux-snps-arc  On Behalf 
> Of Alexey Brodkin
> Sent: Wednesday, November 13, 2019 2:30 PM
> To: Daniel Vetter ; David Airlie 
> Cc: arcml ; Eugeniy Paltsev 
> ; dri-
> de...@lists.freedesktop.org
> Subject: RE: [GIT PULL] drm/arc: Minor improvements
> 
> Hi Daniel, David,
> 
> > -Original Message-
> > From: linux-snps-arc  On Behalf 
> > Of Alexey Brodkin
> > Sent: Thursday, July 18, 2019 12:09 AM
> > To: Daniel Vetter ; David Airlie 
> > Cc: arcml ; 
> > dri-de...@lists.freedesktop.org
> > Subject: [GIT PULL] drm/arc: Minor improvements
> >
> > Hi Dave, Daniel,
> >
> > The following changes since commit 7aaddd96d5febcf5b24357a326b3038d49a20532:
> >
> >   drm/modes: Don't apply cmdline's rotation if it wasn't specified 
> > (2019-07-16 10:34:38 +0200)
> >
> > are available in the Git repository at:
> >
> >   g...@github.com:abrodkin/linux.git tags/arcpgu-updates-2019.07.18
> >
> > for you to fetch changes up to cee17a71656e9e1b5ffc01767844026550d5f4a9:
> >
> >   drm/arcpgu: rework encoder search (2019-07-17 23:36:56 +0300)
> >
> > 
> > This is a pretty simple improvement that allows to find encoder
> > as the one and only (ARC PGU doesn't support more than one) endpoint
> > instead of using non-standard "encoder-slave" property.
> >
> > 
> > Eugeniy Paltsev (1):
> >   drm/arcpgu: rework encoder search
> >
> >  drivers/gpu/drm/arc/arcpgu_drv.c | 16 +---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> Any chance for this one to get pulled into your tree(s) sometime soon?
> 
> -Alexey
> 
> ___
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Dsnps-
> 2Darc=DwICAg=DPL6_X_6JkXFx7AXWqB0tg=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I=f3bFSjs3gZI9vC
> LJW5sa6Kxu43yXUsCXhaUNhtEymmk=eFO6mnw8IJyfrQZYrMEbJ-bryplfw9LvcYBSCEyj5XA=

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


RE: [PATCH] ARC: perf: Accommodate big-endian CPU

2019-11-27 Thread Alexey Brodkin
Hi Greg,

> -Original Message-
> From: linux-snps-arc  On Behalf 
> Of Greg Kroah-Hartman
> Sent: Thursday, November 21, 2019 11:40 PM
> To: Alexey Brodkin 
> Cc: Sasha Levin ; linux-snps-arc@lists.infradead.org; 
> linux-ker...@vger.kernel.org;
> sta...@vger.kernel.org
> Subject: Re: [PATCH] ARC: perf: Accommodate big-endian CPU
> 
> On Tue, Nov 05, 2019 at 07:52:16PM +, Alexey Brodkin wrote:
> > Hi Sasha, Greg,
> >
> > > -Original Message-
> > > From: Sasha Levin 
> > > Sent: Saturday, October 26, 2019 4:11 PM
> > > To: Sasha Levin ; Alexey Brodkin 
> > > ; linux-snps-
> > > a...@lists.infradead.org
> > > Cc: linux-ker...@vger.kernel.org; sta...@vger.kernel.org; 
> > > sta...@vger.kernel.org
> > > Subject: Re: [PATCH] ARC: perf: Accommodate big-endian CPU
> > >
> > > Hi,
> > >
> > > [This is an automated email]
> > >
> > > This commit has been processed because it contains a -stable tag.
> > > The stable tag indicates that it's relevant for the following trees: all
> > >
> > > The bot has tested the following trees: v5.3.7, v4.19.80, v4.14.150, 
> > > v4.9.197, v4.4.197.
> > >
> > > v5.3.7: Build OK!
> > > v4.19.80: Failed to apply! Possible dependencies:
> > > 0e956150fe09f ("ARC: perf: introduce Kernel PMU events support")
> > > 14f81a91ad29a ("ARC: perf: trivial code cleanup")
> > > baf9cc85ba01f ("ARC: perf: move HW events mapping to separate 
> > > function")
> > > v4.14.150: Failed to apply! Possible dependencies:
> > > v4.9.197: Failed to apply! Possible dependencies:
> > > v4.4.197: Failed to apply! Possible dependencies:
> >
> > Indeed the clash is due to
> > commit baf9cc85ba01f ("ARC: perf: move HW events mapping to separate 
> > function") as tmp variable "j"
> was changed on "i". So that's a fixed hunk:
> > >8--
> > diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
> > index 8aec462d90fb..30f66b123541 100644
> > --- a/arch/arc/kernel/perf_event.c
> > +++ b/arch/arc/kernel/perf_event.c
> > @@ -490,8 +490,8 @@ static int arc_pmu_device_probe(struct platform_device 
> > *pdev)
> > /* loop thru all available h/w condition indexes */
> > for (j = 0; j < cc_bcr.c; j++) {
> > write_aux_reg(ARC_REG_CC_INDEX, j);
> > -   cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0);
> > -   cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1);
> > +   cc_name.indiv.word0 = 
> > le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0));
> > +   cc_name.indiv.word1 = 
> > le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1));
> >
> > /* See if it has been mapped to a perf event_id */
> > for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) {
> > >8--
> >
> > Should I send a formal patch with it or it's OK for now?
> 
> We need a "formal" patch that we can apply if you want it applied.

Done, see https://patchwork.ozlabs.org/patch/1201398/ and your inbox.

-Alexey


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARC: perf: Accommodate big-endian CPU

2019-11-27 Thread Alexey Brodkin
8-letter strings representing ARC perf events are stores in two
32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.

And the same order of bytes in the word is used regardless CPU endianness.

Which means in case of big-endian CPU core we need to swap bytes to get
the same order as if it was on little-endian CPU.

Otherwise we're seeing the following error message on boot:
->8--
ARC perf: 8 counters (32 bits), 40 conditions, [overflow IRQ support]
sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
Stack Trace:
  arc_unwind_core+0xd4/0xfc
  dump_stack+0x64/0x80
  sysfs_warn_dup+0x46/0x58
  sysfs_add_file_mode_ns+0xb2/0x168
  create_files+0x70/0x2a0
[ cut here ]
WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 
perf_event_sysfs_init+0x70/0xa0
Failed to register pmu: arc_pct, reason -17
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
Stack Trace:
  arc_unwind_core+0xd4/0xfc
  dump_stack+0x64/0x80
  __warn+0x9c/0xd4
  warn_slowpath_fmt+0x22/0x2c
  perf_event_sysfs_init+0x70/0xa0
---[ end trace a75fb9a9837bd1ec ]---
->8--

What happens here we're trying to register more than one raw perf event
with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters
and encoded into two 32-bit words. In this particular case we deal with 2
events:
 * "IJMP" which counts all jump & branch instructions
 * "IJMPC___" which counts only conditional jumps & branches

Those strings are split in two 32-bit words this way "IJMP" + "" &
"IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core
being big-endian then we read "PMJI" + "" & "PMJI" + "___C".

And since we interpret read array of ASCII letters as a null-terminated string
on big-endian CPU we end up with 2 events of the same name "PMJI".

Signed-off-by: Alexey Brodkin 
Cc: sta...@vger.kernel.org
---

Greg, Sasha, this is the same patch as
commit 5effc09c4907 ("ARC: perf: Accommodate big-endian CPU")
but fine-tuned to be applicable to kernels 4.19 and older.

 arch/arc/kernel/perf_event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 8aec462d90fb..30f66b123541 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -490,8 +490,8 @@ static int arc_pmu_device_probe(struct platform_device 
*pdev)
/* loop thru all available h/w condition indexes */
for (j = 0; j < cc_bcr.c; j++) {
write_aux_reg(ARC_REG_CC_INDEX, j);
-   cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0);
-   cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1);
+   cc_name.indiv.word0 = 
le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME0));
+   cc_name.indiv.word1 = 
le32_to_cpu(read_aux_reg(ARC_REG_CC_NAME1));
 
/* See if it has been mapped to a perf event_id */
for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) {
-- 
2.16.2


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc