public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Pierre Morel <pmorel@linux.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	david@redhat.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v5 04/10] s390x: interrupt registration
Date: Fri, 24 Apr 2020 12:49:19 +0200	[thread overview]
Message-ID: <20200424124919.6c243286.cohuck@redhat.com> (raw)
In-Reply-To: <b5c02122-68a7-31e7-11e4-5f05403feb08@linux.ibm.com>

On Fri, 24 Apr 2020 12:44:16 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:

> On 2020-04-24 10:27, Janosch Frank wrote:
> > On 2/20/20 1:00 PM, Pierre Morel wrote:  
> >> Let's make it possible to add and remove a custom io interrupt handler,
> >> that can be used instead of the normal one.
> >>
> >> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> >> Reviewed-by: Thomas Huth <thuth@redhat.com>
> >> Reviewed-by: David Hildenbrand <david@redhat.com>
> >> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> >> ---
> >>   lib/s390x/interrupt.c | 22 +++++++++++++++++++++-
> >>   lib/s390x/interrupt.h |  7 +++++++
> >>   2 files changed, 28 insertions(+), 1 deletion(-)
> >>   create mode 100644 lib/s390x/interrupt.h
> >>

> >> +static void (*io_int_func)(void);
> >> +
> >>   void handle_io_int(void)
> >>   {
> >> +	if (*io_int_func)
> >> +		return (*io_int_func)();
> >>   	report_abort("Unexpected io interrupt: on cpu %d at %#lx",
> >>   		     stap(), lc->io_old_psw.addr);
> >>   }
> >>   
> >> +int register_io_int_func(void (*f)(void))
> >> +{
> >> +	if (io_int_func)
> >> +		return -1;
> >> +	io_int_func = f;
> >> +	return 0;
> >> +}
> >> +
> >> +int unregister_io_int_func(void (*f)(void))
> >> +{
> >> +	if (io_int_func != f)
> >> +		return -1;
> >> +	io_int_func = NULL;
> >> +	return 0;
> >> +}  
> > 
> > I'm currently working on something similar for PGMs and I see no
> > additional value in two functions for this. Unregistering can be done by
> > doing register_io_int_func(NULL)
> > 
> > This should be enough:
> > 
> > int register_io_int_func(void (*f)(void))
> > {
> > 	io_int_func = f;
> > }

You can even make this void :)

> >   
> There are several ways to do this and I really don't mind how it is done.
> Since it has been reviewed by, I would like to have the others reviewers 
> opinion.

One version might make it easier to catch programming errors, while the
other one is more compact. I don't really have a preference on this,
either is fine with me.

  reply	other threads:[~2020-04-24 10:49 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 12:00 [kvm-unit-tests PATCH v5 00/10] s390x: Testing the Channel Subsystem I/O Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 01/10] s390x: saving regs for interrupts Pierre Morel
2020-04-22  7:47   ` Janosch Frank
2020-04-22  9:09     ` Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 02/10] s390x: Use PSW bits definitions in cstart Pierre Morel
2020-04-21 16:16   ` David Hildenbrand
2020-04-22  5:53     ` Pierre Morel
2020-04-22  7:35   ` Janosch Frank
2020-04-22  7:44     ` David Hildenbrand
2020-04-22  8:59       ` Pierre Morel
2020-04-22  9:07         ` David Hildenbrand
2020-04-22  9:09           ` Pierre Morel
2020-04-22  9:06     ` Pierre Morel
2020-04-22  9:13       ` Janosch Frank
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 03/10] s390x: cr0: adding AFP-register control bit Pierre Morel
2020-04-21 16:15   ` David Hildenbrand
2020-04-22  5:54     ` Pierre Morel
2020-04-22  7:39   ` Janosch Frank
2020-04-22  9:11     ` Pierre Morel
2020-04-22  7:59   ` Cornelia Huck
2020-04-22  9:12     ` Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 04/10] s390x: interrupt registration Pierre Morel
2020-04-24  8:27   ` Janosch Frank
2020-04-24 10:44     ` Pierre Morel
2020-04-24 10:49       ` Cornelia Huck [this message]
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 05/10] s390x: export the clock get_clock_ms() utility Pierre Morel
2020-04-22  8:05   ` Cornelia Huck
2020-04-22  9:12     ` Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 06/10] s390x: Library resources for CSS tests Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 07/10] s390x: css: stsch, enumeration test Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 08/10] s390x: css: msch, enable test Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 09/10] s390x: css: ssch/tsch with sense and interrupt Pierre Morel
2020-02-20 12:00 ` [kvm-unit-tests PATCH v5 10/10] s390x: css: ping pong Pierre Morel
2020-04-21 16:13 ` [kvm-unit-tests PATCH v5 00/10] s390x: Testing the Channel Subsystem I/O Pierre Morel
2020-04-21 16:18   ` David Hildenbrand
2020-04-22  7:43     ` Janosch Frank
2020-04-22  9:17       ` Pierre Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424124919.6c243286.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox