Re: [PATCH] aarch64: Add tests that are failing intermittently

2021-08-26 Thread Kinsey Moore

On 8/20/2021 22:06, Chris Johns wrote:

On 21/8/21 2:38 am, Kinsey Moore wrote:

On 8/19/2021 18:03, Chris Johns wrote:

On 20/8/21 4:55 am, Kinsey Moore wrote:

On 8/19/2021 13:32, Gedare Bloom wrote:

On Thu, Aug 19, 2021 at 11:43 AM Kinsey Moore  wrote:

I've seen these failures on my local system, in our CI, and on a build
server that I sometimes
use for development/testing so if it's a configuration issue we're being
pretty consistent about
misconfiguration across some pretty different environments (docker,
bare-metal, VM, different
OSs, different QEMU versions). I've seen enough of the spintrcritical
tests fail sporadically on
QEMU to lump them all into this category. These are also tests that I
have seen behave badly
on ARMv7 QEMU on my local system (which doesn't rule out
misconfiguration, but it's another
data point).


Yes, for example, it may be a matter of qemu process counts spawned by
rtems-test, and the order in which tests get invoked could be a cause
for which ones don't work. I could easily see this happening, since
each test runtime will be fairly consistent, so you'll often see the
same tests running concurrently with each other. But, if you change
the order (e.g., by adding new tests), then we may see a new set of
sporadically failing testcases, will we just add those, or do we need
to re-examine this indetermine set periodically? Who will maintain
this list? That's kind of the root of my concern here.

I understand your concern about maintenance of the failure list and I don't
have a good answer for you. I imagine going forward it would be a combination
of the current stake-holders for a given BSP and anyone who watches the
automated build output from Joel's runs for these kinds of issues.

On the other hand if we don't mark those tests, people will get fatigued
looking at the spurious failures and assume any new ones just fall into the
same category as others. At that point is it even worth running the
automated tests for that platform?


As far as your worry about marking these indeterminate, they're only
being marked as such for
QEMU BSPs. The ZynqMP hardware BSP doesn't have these testing carve-outs
and runs all these tests flawlessly.

Great, this is important.


These failures become much more common when there is otherwise load on
the system and a
lot of them disappear when you limit the tester to a single QEMU
instance at a time.


I'm wondering if we should sacrifice testing speed for
coverage/quality. If throttling rtems-test leads to more reliable test
results, then it may be a better option than basically ignoring a
swath of our testsuite.

That would certainly mitigate some of the failures, but you'd also have to
guarantee nothing else is running on the system which could cause the same
problem. I know at least some of the current automated runs operate on a
shared system which can and does often have other intensive processes
running on it. There are also the tests that are sporadic on QEMU even
without additional load.

What is it in these tests when combined with qemu that causes the tests to fail?
Is there some relation to a real clock, some shared host resource or a bug in
qemu? I am concerned a simulator can vary like this based on the host's load and
it makes me wonder how people use it on machines to host a number VMs.

I experienced very similar results on an ARMv7 BSP (not Zynq) and assumed that 
this
was a known/accepted problem with QEMU when the same issues popped up on
AArch64.

I think we have just ignored issue. I know I have ignored it because of the
rabbit hole it is.


My local system under no other load produces these failures for the
Zynq A9 QEMU
BSP:

     "failed": [
     "spcpucounter01.exe",
     "psxtimes01.exe",
     "sp69.exe",
     "psx12.exe",
     "minimum.exe",
     "dl06.exe",
     "sptimecounter02.exe"
     ],

minimum.exe

We have discussed this test in the past and I think the end result from Joel was
an exit code of 0 meant it had passed but I am not sure the exit code is printed
because it is minimal. Maybe it should be changed to be a `no-run` type test?


and dl06.exe are probably unrelated,

Yeap and that is one I should fix when I can find the time.


but the remainder are in my problem set for AArch64 on QEMU.

OK.


A run of the AArch64 ZynqMP ILP32 BSP produced these failures under the same
conditions with all the test carve-outs removed:

     "failed": [
     "psx12.exe",
     "spcpucounter01.exe",
     "sptimecounter01.exe",
     "sptimecounter02.exe",
     "sp04.exe"
     ],

Because of my experience with the aforementioned ARMv7 BSP and the lack of
failures on hardware, I chose not to weed out the root cause of the failures 
under
QEMU.

Sure. It however leaves the underlying problem about the reasons these fail with
QEMU and so we caught either way.


This patch is documentation of our observations across 

Re: [PATCH v1 1/1] gpiolib/grgpio: Add support for newer grgpio features

2021-08-26 Thread Daniel Hellstrom

Hi Jan,

I haven't tested the code, but it seems to be that the ordinary case 
when GPIO[N] is connected to Interrupt[N] will not work? The fixup makes 
GPIO[N] pin be associated with interrupt[0] (which is not available) 
and  GPIO[1] with Interrupt[1] and so one which is the case with 
U699/UT700/GR712RC. I believe it is the bus-driver's role to initialize 
the device structure to indicate the device's all interrupts (the first 
interrupt in the ambapp_bus case), and the driver's role to select which 
interrupt of the available. I'm worrying that leaving "info.irq = -1" 
will disable all interrupts from that GPIO core?


Kind Regards,
Daniel

  


On 2021-08-25 10:13, jan.som...@dlr.de wrote:

Does anyone have any objections to this?

See also https://lists.rtems.org/pipermail/devel/2021-July/068086.html for the 
cover letter.

Best regards,

 Jan


-Original Message-
From: Sommer, Jan
Sent: Thursday, July 1, 2021 5:44 PM
To: devel@rtems.org
Cc: softw...@gaisler.com; Sommer, Jan 
Subject: [PATCH v1 1/1] gpiolib/grgpio: Add support for newer grgpio
features

- Use proper typedef for isr (avoid warning in user application)
- Use set input enable register together with pin direction
- Support irqgen == 1 mode if present in capabilities register
---
  bsps/include/grlib/gpiolib.h  |  7 +--
  bsps/include/grlib/grlib.h|  4 +++-
  bsps/shared/grlib/drvmgr/ambapp_bus.c |  5 +
  bsps/shared/grlib/gpio/gpiolib.c  |  2 +-
  bsps/shared/grlib/gpio/grgpio.c   | 22 --
  5 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/bsps/include/grlib/gpiolib.h b/bsps/include/grlib/gpiolib.h index
f82d4fa2c2..37ac140862 100644
--- a/bsps/include/grlib/gpiolib.h
+++ b/bsps/include/grlib/gpiolib.h
@@ -28,6 +28,9 @@ struct gpiolib_config {  #define GPIOLIB_IRQ_POL_LOW
0  #define GPIOLIB_IRQ_POL_HIGH 1

+/* Interrupt Service Routine (ISR) */
+typedef void (*gpiolib_isr)(void *arg);
+
  /* Libarary initialize function must be called befor any other */  extern int
gpiolib_initialize(void);

@@ -54,7 +57,7 @@ extern int gpiolib_irq_disable(void *handle);  extern int
gpiolib_irq_mask(void *handle);  extern int gpiolib_irq_unmask(void
*handle);  extern int gpiolib_irq_force(void *handle); -extern int
gpiolib_irq_register(void *handle, void *func, void *arg);
+extern int gpiolib_irq_register(void *handle, gpiolib_isr func, void
+*arg);

  /*** Driver Interface ***/

@@ -66,7 +69,7 @@ struct gpiolib_drv_ops {
int (*config)(void *handle, struct gpiolib_config *cfg);
int (*get)(void *handle, int *val);
int (*irq_opts)(void *handle, unsigned int options);
-   int (*irq_register)(void *handle, void *func, void *arg);
+   int (*irq_register)(void *handle, gpiolib_isr func, void
*arg);
int (*open)(void *handle);
int (*set)(void *handle, int dir, int outval);
int (*show)(void *handle);
diff --git a/bsps/include/grlib/grlib.h b/bsps/include/grlib/grlib.h index
49d807..4aa3e9df4a 100644
--- a/bsps/include/grlib/grlib.h
+++ b/bsps/include/grlib/grlib.h
@@ -17,6 +17,7 @@
  #define __GRLIB_H__

  #include 
+#include 

  #ifdef __cplusplus
  extern "C" {
@@ -125,6 +126,7 @@ struct grgpio_regs {
volatile unsigned int iedge;   /* 0x14 Interrupt edge register */
volatile unsigned int bypass;  /* 0x18 Bypass register */
volatile unsigned int cap; /* 0x1C Capability register */
+#define GRGPIO_CAP_IRQGEN(reg) BSP_FLD32GET(reg, 8, 12)
volatile unsigned int irqmap[4];   /* 0x20 - 0x2C Interrupt map registers */
volatile unsigned int res_30;  /* 0x30 Reserved */
volatile unsigned int res_34;  /* 0x34 Reserved */
@@ -132,7 +134,7 @@ struct grgpio_regs {
volatile unsigned int res_3C;  /* 0x3C Reserved */
volatile unsigned int iavail;  /* 0x40 Interrupt available register */
volatile unsigned int iflag;   /* 0x44 Interrupt flag register */
-  volatile unsigned int res_48;  /* 0x48 Reserved */
+  volatile unsigned int input_en;/* 0x48 Input enable (if present) */
volatile unsigned int pulse;   /* 0x4C Pulse register */
volatile unsigned int res_50;  /* 0x50 Reserved */
volatile unsigned int output_or;   /* 0x54 I/O port output register, 
logical-OR
*/
diff --git a/bsps/shared/grlib/drvmgr/ambapp_bus.c
b/bsps/shared/grlib/drvmgr/ambapp_bus.c
index 3c38fc16e0..0aed29224c 100644
--- a/bsps/shared/grlib/drvmgr/ambapp_bus.c
+++ b/bsps/shared/grlib/drvmgr/ambapp_bus.c
@@ -521,11 +521,8 @@ static int ambapp_dev_fixup(struct drvmgr_dev
*dev, struct amba_dev_info *pnp)
for(core = 0; core < subcores; core++)
drvmgr_dev_register(devs_to_register[core]);
return 1;
-   } else if ( (pnp->info.device == GAISLER_GPIO) &&
-   (pnp->info.vendor == VENDOR_GAISLER) ) {
-   

[PATCH v2 rtems-tools 2/2] misc: Add rtems-style command

2021-08-26 Thread Ida Delphine
This is the code for the rtems-style tool which checks for style differences 
and produces a report as well as reformats a given file or directory.

Signed-off-by: Ida Delphine 
---
 misc/rtems-style|  16 +
 misc/tools/style.py | 153 
 2 files changed, 169 insertions(+)
 create mode 100644 misc/rtems-style
 create mode 100644 misc/tools/style.py

diff --git a/misc/rtems-style b/misc/rtems-style
new file mode 100644
index 000..5a3e0e8
--- /dev/null
+++ b/misc/rtems-style
@@ -0,0 +1,16 @@
+#! /usr/bin/env python
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+import misc.tools.style
+misc.tools.style.run()
+except ImportError:
+print("Incorrect RTEMS Tools installation", file = sys.stderr)
+sys.exit(1)
\ No newline at end of file
diff --git a/misc/tools/style.py b/misc/tools/style.py
new file mode 100644
index 000..fbd575e
--- /dev/null
+++ b/misc/tools/style.py
@@ -0,0 +1,153 @@
+import argparse
+import os
+import sys
+import re
+
+from rtemstoolkit import execute
+from rtemstoolkit import git
+
+
+def get_command():
+from rtemstoolkit import check
+
+for version in ['', '8', '9', '10', '11']:
+if check.check_exe(None, 'clang-format' + version):
+command = 'clang-format' + version
+return command
+print("Clang-format not found in your system")
+sys.exit(1)
+
+
+def arguments():
+parser = argparse.ArgumentParser(description="Tool for code formatting and 
style checking \
+for RTEMS")
+parser.add_argument("-c", "--check", dest="check", help="Check for style 
differences and \
+report the number of issues if found", action="store_true")
+parser.add_argument("-r", "--reformat", dest="reformat", help="Reformat 
the file/directory \
+with any style differences found", action="store_true")
+parser.add_argument("-p", "--path", dest="path", help="The path to be 
checked for style issues \
+or reformatted")
+parser.add_argument("-i", "--ignore", dest="ignore", help="Ignore files to 
be checked or \
+reformatted", nargs='*')
+parser.add_argument("-v", "--verbose", dest="verbose", help="A more 
detailed outline of the \
+style issues", action='store_true')
+return [parser.parse_args(), parser.print_usage()]
+
+
+def get_diff(path, ignore_file):
+diff = ""
+ex = execute.capture_execution()
+
+def clang_to_git_diff(clang_output, path):
+import os
+import tempfile
+
+fd, tmp_path = tempfile.mkstemp()
+try:
+with os.fdopen(fd, 'w') as tmp:
+
+tmp.write(clang_output)
+repo = git.repo(".")
+return repo.diff(['--no-index', path, tmp_path])
+
+finally:
+os.remove(tmp_path)
+
+if os.path.isfile(path) == True:
+cmd = get_command() + " --style=file " + path
+output_clang = ex.command(command=cmd, shell=True)
+output_clang = output_clang[2]
+diff = clang_to_git_diff(output_clang, path)
+else:
+onlyfiles = [f for f in os.listdir(path)]
+for file in onlyfiles:
+ig_match = False
+if ignore_file is not None:
+for f in ignore_file:
+if file == f:
+ig_match = True
+if ig_match == True:
+continue
+
+file = os.path.join(path, file)
+
+if file.endswith('.c') or file.endswith('.h'):
+cmd = get_command() + " --style=file " + file
+output_clang = ex.command(command=cmd, shell=True)
+output_clang = output_clang[2]
+diff += clang_to_git_diff(output_clang, os.path.join(path, 
file))
+return diff
+
+
+def color_text(string, col, style=1):
+return "\033[" + str(style) + ";" + str(col) + ";" + str(col) + "m" + 
string + "\033[0;0m"
+
+
+def handle_errors(path, output, verbose=False,):
+if len(output) < 1:
+print("Everything is clean - No style issues")
+else:
+print(color_text("Checking for style differences...", 34, style=3))
+
+out = output.split('\n')
+files = []
+num_diff = 0
+for line in out:
+
+if line.startswith("---"):
+file = str(re.sub('^---\s[ab]', '', line))
+files.append(file)
+
+elif line.startswith('+'):
+num_diff += 1
+if verbose == True:
+print(color_text(line, 34))
+continue
+if verbose == True:
+print(line)
+
+print(color_text("\nFiles affected:", 33))
+
+for 

[PATCH v2 rtems-tools 0/2] Command for code reformatting and style checking

2021-08-26 Thread Ida Delphine
The rtems-style command helps to check for style issues or reformat code given 
a file
or directory. There are 5 flags:
* -c, --check : Checks for style issues
* -r, --reformat : Reformats the code
* -p, --path : Path to file or dir to be checked or reformatted
* -i, --ignore : Files to be ignored when checking or reformatting
* -v, --verbose : Produces a more detailed output.

Ida Delphine (2):
  rt: Add diff method to git.py
  misc: Add rtems-style command

 misc/rtems-style|  16 +
 misc/tools/style.py | 153 
 rtemstoolkit/git.py |   5 ++
 3 files changed, 174 insertions(+)
 create mode 100644 misc/rtems-style
 create mode 100644 misc/tools/style.py

-- 
2.25.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 rtems-tools 1/2] rt: Add diff method to git.py

2021-08-26 Thread Ida Delphine
Signed-off-by: Ida Delphine 
---
 rtemstoolkit/git.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/rtemstoolkit/git.py b/rtemstoolkit/git.py
index f65300b..b544a9b 100644
--- a/rtemstoolkit/git.py
+++ b/rtemstoolkit/git.py
@@ -119,6 +119,10 @@ class repo:
 args = [args]
 ec, output = self._run(['clean'] + args, check = True)
 
+def diff(self, args = []):
+ec, output = self._run(['diff'] + args)
+return output
+
 def status(self):
 _status = {}
 if path.exists(self.path):
@@ -229,3 +233,4 @@ if __name__ == '__main__':
 print('remotes:', g.remotes())
 print('email:', g.email())
 print('head:', g.head())
+print('diff:', g.diff())
-- 
2.25.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel