From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: Allow host IRQ sharing for assigned PCI 2.3 devices Date: Mon, 09 Jan 2012 23:26:06 +0100 Message-ID: <4F0B697E.2030301@web.de> References: <4F0AF394.6000205@siemens.com> <1326138346.1605.61.camel@bling.home> <4F0B5B49.2040305@web.de> <1326146754.1605.77.camel@bling.home> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA5FEE889FFFF1598A734251E" Cc: Avi Kivity , Marcelo Tosatti , kvm , "Michael S. Tsirkin" , Jesse Barnes To: Alex Williamson Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:59525 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755874Ab2AIW0T (ORCPT ); Mon, 9 Jan 2012 17:26:19 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate01.web.de (Postfix) with ESMTP id 835441A8813D2 for ; Mon, 9 Jan 2012 23:26:07 +0100 (CET) In-Reply-To: <1326146754.1605.77.camel@bling.home> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA5FEE889FFFF1598A734251E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2012-01-09 23:05, Alex Williamson wrote: > On Mon, 2012-01-09 at 22:25 +0100, Jan Kiszka wrote: >> On 2012-01-09 20:45, Alex Williamson wrote: >>> On Mon, 2012-01-09 at 15:03 +0100, Jan Kiszka wrote: >>>> +static int kvm_vm_ioctl_set_pci_irq_mask(struct kvm *kvm, >>>> + struct kvm_assigned_pci_dev *assigned_dev) >>>> +{ >>>> + int r =3D 0; >>>> + struct kvm_assigned_dev_kernel *match; >>>> + >>>> + mutex_lock(&kvm->lock); >>>> + >>>> + match =3D kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, >>>> + assigned_dev->assigned_dev_id); >>>> + if (!match) { >>>> + r =3D -ENODEV; >>>> + goto out; >>>> + } >>>> + >>>> + mutex_lock(&match->intx_mask_lock); >>>> + >>>> + match->flags &=3D ~KVM_DEV_ASSIGN_MASK_INTX; >>>> + match->flags |=3D assigned_dev->flags & KVM_DEV_ASSIGN_MASK_INTX; >>>> + >>>> + if (match->irq_requested_type & KVM_DEV_IRQ_GUEST_INTX) { >>>> + if (assigned_dev->flags & KVM_DEV_ASSIGN_MASK_INTX) { >>>> + kvm_set_irq(match->kvm, match->irq_source_id, >>>> + match->guest_irq, 0); >>>> + /* >>>> + * Masking at hardware-level is performed on demand, >>>> + * i.e. when an IRQ actually arrives at the host. >>>> + */ >>> >>> Is there any harm in doing this synchronous to the ioctl? We're on a= >>> slow path here anyway since the mask is likely drive by a config spac= e >>> write. >> >> Not sure, maybe locking. What would be the advantage of doing it >> synchronously? >=20 > It would just be a closer match to hardware. I'm wondering (FUD) if > there could be a case where a driver does some sensitive operations on > the device that could be interfered with if the device generates that > one last interrupt to actually disable interrupts instead of them being= > disabled after setting config space. It's probably a long shot, but > doesn't seem too difficult to switch to synchronous disabling. Thanks,= Need to check again - but there could be a good reason here as well. Like for kvm_assigned_dev_raise_guest_irq: it handles different guest IRQ types while its callers have different host IRQ types. So it has its purpose. Jan --------------enigA5FEE889FFFF1598A734251E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEUEARECAAYFAk8LaX4ACgkQitSsb3rl5xRQ5wCffAWle7ltdU/MTCj/dUsjMhFS wnEAljG4N8v+6ksXF5+Ff9lwhcu25is= =0IUO -----END PGP SIGNATURE----- --------------enigA5FEE889FFFF1598A734251E--