qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de,
	ncmike@ncultra.org, qemu-ppc@nongnu.org,
	tyreld@linux.vnet.ibm.com, bharata.rao@gmail.com,
	nfont@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v5 08/16] spapr_events: re-use EPOW event infrastructure for hotplug events
Date: Wed, 25 Feb 2015 11:54:18 +1100	[thread overview]
Message-ID: <20150225005418.GB15695@voom.fritz.box> (raw)
In-Reply-To: <20150224200429.31752.33720@loki>

[-- Attachment #1: Type: text/plain, Size: 3988 bytes --]

On Tue, Feb 24, 2015 at 02:04:29PM -0600, Michael Roth wrote:
> Quoting David Gibson (2015-02-24 00:49:42)
> > On Mon, Feb 16, 2015 at 08:27:44AM -0600, Michael Roth wrote:
> > > From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
[snip]
> > > +    hdr = &pending_epow->hdr;
> > > +    v6hdr = &pending_epow->v6hdr;
> > > +    maina = &pending_epow->maina;
> > > +    mainb = &pending_epow->mainb;
> > > +    epow = &pending_epow->epow;
> > > +
> > > +    hdr->summary = cpu_to_be32(RTAS_LOG_VERSION_6
> > > +                               | RTAS_LOG_SEVERITY_EVENT
> > > +                               | RTAS_LOG_DISPOSITION_NOT_RECOVERED
> > > +                               | RTAS_LOG_OPTIONAL_PART_PRESENT
> > > +                               | RTAS_LOG_TYPE_EPOW);
> > > +    hdr->extended_length = cpu_to_be32(sizeof(*pending_epow)
> > > +                                       - sizeof(pending_epow->hdr));
> > > +
> > > +    spapr_init_v6hdr(v6hdr);
> > > +    spapr_init_maina(maina, 3 /* Main-A, Main-B and EPOW */);
> > >  
> > >      mainb->hdr.section_id = cpu_to_be16(RTAS_LOG_V6_SECTION_ID_MAINB);
> > >      mainb->hdr.section_length = cpu_to_be16(sizeof(*mainb));
> > > @@ -274,7 +356,78 @@ static void spapr_powerdown_req(Notifier *n, void *opaque)
> > >      epow->event_modifier = RTAS_LOG_V6_EPOW_MODIFIER_NORMAL;
> > >      epow->extended_modifier = RTAS_LOG_V6_EPOW_XMODIFIER_PARTITION_SPECIFIC;
> > >  
> > > -    qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->epow_irq));
> > > +    rtas_event_log_queue(RTAS_LOG_TYPE_EPOW, pending_epow);
> > > +
> > > +    qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq));
> > 
> > Shouldn't the irq pulse go into rtas_event_log_queue()?
> 
> It seems maybe it should...
> 
> "If a platform chooses to report multiple event or error sources through a
>  single interrupt, it must ensure that the interrupt remains asserted
>  or is re-asserted until check-exception has been used to process all
>  out-standing errors or events for that interrupt."
> 
> But another alternative would be to have rtas-check-exception re-pulse if there
> are still events present for that particular IRQ. I think I'd prefer this
> approach, since it makes it easier to share the queueing functionality with
> rtas-event-scan (which relies on polling instead of interrupts)

Actually I wasn't thinking that deeply, just looking at the fact that
both callerss to rtas_event_log_queue() pulse the irq immediately
afterwards.

Hrm.  Now I'm a bit confused - the use of qemu_irq_pulse() suggests an
edge/message interrupt, but the reference to "remains asserted"
suggests level interrupt semantics.  I no longer remember enough of
PAPR to know why I used qemu_irq_pulse() in the first place.

[snip]
> > > -        cpu_physical_memory_write(buf, pending_epow, len);
> > > -        g_free(pending_epow);
> > > -        pending_epow = NULL;
> > > -        rtas_st(rets, 0, RTAS_OUT_SUCCESS);
> > > -    } else {
> > > -        rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);
> > > +    switch (event->log_type) {
> > > +        case RTAS_LOG_TYPE_EPOW:
> > > +            event_len = sizeof(struct epow_log_full);
> > > +            break;
> > > +        case RTAS_LOG_TYPE_HOTPLUG:
> > > +            event_len = sizeof(struct hp_log_full);
> > > +            break;
> > > +        default:
> > > +            goto out_no_events;
> > 
> > Doesn't one of the headers include size information you could use
> > here, avoiding the switch?
> 
> Looks like hdr->extended_length + sizeof(hdr) should do the
> trick. Nice!

Excellent. A switch on the same selector at multiple levels of the
same callstack always seems to be a warning sign of layering
violations.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-02-25  1:15 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 14:27 [Qemu-devel] [PATCH resend v5 00/16] spapr: add support for pci hotplug Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 01/16] docs: add sPAPR hotplug/dynamic-reconfiguration documentation Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 02/16] spapr_drc: initial implementation of sPAPRDRConnector device Michael Roth
2015-02-23  6:05   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 03/16] spapr_rtas: add get/set-power-level RTAS interfaces Michael Roth
2015-02-24  6:29   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 04/16] spapr_rtas: add set-indicator RTAS interface Michael Roth
2015-02-24  6:32   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 05/16] spapr_rtas: add get-sensor-state " Michael Roth
2015-02-24  6:33   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 06/16] spapr: add rtas_st_buffer_direct() helper Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 07/16] spapr_rtas: add ibm, configure-connector RTAS interface Michael Roth
2015-02-24  6:40   ` David Gibson
2015-02-24 20:43     ` Michael Roth
2015-02-25  0:48       ` David Gibson
2015-02-26 22:21         ` Michael Roth
2015-02-27  5:31           ` David Gibson
2015-02-27 17:37             ` Michael Roth
2015-03-02  6:25               ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 08/16] spapr_events: re-use EPOW event infrastructure for hotplug events Michael Roth
2015-02-24  6:49   ` David Gibson
2015-02-24 20:04     ` Michael Roth
2015-02-25  0:54       ` David Gibson [this message]
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 09/16] spapr_events: event-scan RTAS interface Michael Roth
2015-02-24  9:11   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 10/16] spapr_drc: add spapr_drc_populate_dt() Michael Roth
2015-02-24  9:26   ` David Gibson
2015-02-24 19:21     ` Michael Roth
2015-02-26 15:56   ` Nathan Fontenot
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 11/16] spapr_pci: add dynamic-reconfiguration option for spapr-pci-host-bridge Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 12/16] spapr_pci: create DRConnectors for each PCI slot during PHB realize Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 13/16] spapr_pci: populate DRC dt entries for PHBs Michael Roth
2015-02-24  9:29   ` David Gibson
2015-02-24 18:52     ` Michael Roth
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 14/16] pci: make pci_bar useable outside pci.c Michael Roth
2015-02-24 10:20   ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 15/16] spapr_pci: enable basic hotplug operations Michael Roth
2015-02-25  3:11   ` David Gibson
2015-02-25  5:17     ` Michael Roth
2015-02-25  6:40       ` Michael Roth
2015-02-26 20:06         ` Michael Roth
2015-02-27  5:14           ` David Gibson
2015-02-26  3:49       ` David Gibson
2015-02-16 14:27 ` [Qemu-devel] [PATCH v5 16/16] spapr_pci: emit hotplug add/remove events during hotplug Michael Roth
2015-02-25  3:18   ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2015-02-16 14:10 [Qemu-devel] [PATCH v5 00/16] spapr: add support for pci hotplug Michael Roth
2015-02-16 14:10 ` [Qemu-devel] [PATCH v5 08/16] spapr_events: re-use EPOW event infrastructure for hotplug events Michael Roth

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=20150225005418.GB15695@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=bharata.rao@gmail.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=ncmike@ncultra.org \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=tyreld@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).