Re: [kvm-unit-tests PATCH v2 3/3] lib: s390x: better smp interrupt checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/27/22 12:53, Claudio Imbrenda wrote:
On Mon, 27 Jun 2022 11:28:18 +0200
Janosch Frank <frankja@xxxxxxxxxxxxx> wrote:

On 6/24/22 16:45, Claudio Imbrenda wrote:
Use per-CPU flags and callbacks for Program and Extern interrupts,
instead of global variables.

This allows for more accurate error handling; a CPU waiting for an
interrupt will not have it "stolen" by a different CPU that was not
supposed to wait for one, and now two CPUs can wait for interrupts at
the same time.

This will significantly improve error reporting and debugging when
things go wrong.

Both program interrupts and extern interrupts are now CPU-bound, even
though some extern interrupts are floating (notably, the SCLP
interrupt). In those cases, the testcases should mask interrupts and/or
expect them appropriately according to need.

Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
---
   lib/s390x/asm/arch_def.h | 17 +++++++++++-
   lib/s390x/smp.h          |  8 +-----
   lib/s390x/interrupt.c    | 57 +++++++++++++++++++++++++++++-----------
   lib/s390x/smp.c          | 11 ++++++++
   4 files changed, 70 insertions(+), 23 deletions(-)
[...]
+struct lowcore *smp_get_lowcore(uint16_t idx)
+{
+	if (THIS_CPU->idx == idx)
+		return &lowcore;
+
+	check_idx(idx);
+	return cpus[idx].lowcore;
+}

This function is unused.

not currently, but it's useful to have in lib

should I split this into a separate patch?


+
   int smp_sigp(uint16_t idx, uint8_t order, unsigned long parm, uint32_t *status)
   {
   	check_idx(idx);
@@ -253,6 +262,7 @@ static int smp_cpu_setup_nolock(uint16_t idx, struct psw psw)
/* Copy all exception psws. */
   	memcpy(lc, cpus[0].lowcore, 512);
+	lc->this_cpu = cpus + idx;

Why not:
lc->this_cpu = &cpus[idx];

it's equivalent, do you have a reason for changing it?

It's more explicit.



/* Setup stack */
   	cpus[idx].stack = (uint64_t *)alloc_pages(2);
@@ -325,6 +335,7 @@ void smp_setup(void)
   	for (i = 0; i < num; i++) {
   		cpus[i].addr = entry[i].address;
   		cpus[i].active = false;
+		cpus[i].idx = i;
   		/*
   		 * Fill in the boot CPU. If the boot CPU is not at index 0,
   		 * swap it with the one at index 0. This guarantees that the






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux