From: "Jan Beulich" Subject: RE: x86 HPET MSI IRQs vs resume from S3 Date: Mon, 14 Feb 2011 08:35:08 +0000 Message-ID: <4D58F74C0200007800031B3B@vpn.id2.novell.com> References: <4D42992E020000780002F1E4@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Gang Wei Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org >>> On 14.02.11 at 02:00, "Wei, Gang" wrote: > Jan Beulich wrote on 2011-01-28: >> Going through hpet_broadcast_init(), I see that hpet_setup_msi_irq() >> gets called during resume, thus causing setup_irq() to be called. I'm >> failing to spot the corresponding release_irq(), and hence I can't see >> how this whole code path is supposed to work during resume (other than >> always falling back to using legacy_hpet_event). Instead I'm wondering >> whether in the resume case only msi_compose_msg()/ >> hpet_msi_write() should be called for each IRQ used rather than the >> whole hpet_broadcast_init(). >=20 > I do think below patch could resolve this issue well. Didn't create a = new=20 > path for hpet broadcast init while resume because there exists many = condition=20 > checks in existing path. Yes, for 4.1 this seems a reasonable fix. Post-4.1 I'd prefer to split the code paths so that failure during resume (which shouldn't happen anyway) would lead to e.g. calling destroy_irq(), and also to get more stuff __init-annotated (with your change here,=20 hpet_assign_irq() in the resume path wouldn't call create_irq() and request_irq() [and shouldn't call destroy_irq() as said above], and the full hpet_fsb_cap_lookup() doesn't look to be necessary in the resume path either). Jan > --- a/xen/arch/x86/hpet.c Fri Feb 11 18:22:37 2011 +0000 > +++ b/xen/arch/x86/hpet.c Tue Feb 15 14:48:54 2011 +0800 > @@ -367,12 +367,20 @@ static int hpet_setup_msi_irq(unsigned i > int ret; > struct msi_msg msg; > struct hpet_event_channel *ch =3D &hpet_events[irq_to_channel(irq)];= > - > - irq_desc[irq].handler =3D &hpet_msi_type; > - ret =3D request_irq(irq, hpet_interrupt_handler, > - 0, "HPET", ch); > - if ( ret < 0 ) > - return ret; > + irq_desc_t *desc =3D irq_to_desc(irq); > + > + if ( desc->handler =3D=3D &no_irq_type ) > + { > + desc->handler =3D &hpet_msi_type; > + ret =3D request_irq(irq, hpet_interrupt_handler, > + 0, "HPET", ch); > + if ( ret < 0 ) > + return ret; > + } > + else if ( desc->handler !=3D &hpet_msi_type ) > + { > + return -EINVAL; > + } > =20 > msi_compose_msg(NULL, irq, &msg); > hpet_msi_write(irq, &msg); >=20 > Jimmy