From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbdF1QPC (ORCPT ); Wed, 28 Jun 2017 12:15:02 -0400 Received: from mga06.intel.com ([134.134.136.31]:23084 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751515AbdF1QOz (ORCPT ); Wed, 28 Jun 2017 12:14:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,276,1496127600"; d="scan'208";a="119894684" Date: Wed, 28 Jun 2017 09:16:34 -0700 From: Jacob Pan To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, LKML , David Woodhouse , "Liu, Yi L" , Lan Tianyu , "Tian, Kevin" , Raj Ashok , Alex Williamson , Jean Delvare , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH 5/9] iommu: Introduce fault notifier API Message-ID: <20170628091634.0e329803@jacob-builder> In-Reply-To: <20170628101603.GH14532@8bytes.org> References: <1498592883-56224-1-git-send-email-jacob.jun.pan@linux.intel.com> <1498592883-56224-6-git-send-email-jacob.jun.pan@linux.intel.com> <20170628101603.GH14532@8bytes.org> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 28 Jun 2017 12:16:03 +0200 Joerg Roedel wrote: > On Tue, Jun 27, 2017 at 12:47:59PM -0700, Jacob Pan wrote: > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > > index d973555..07cfd92 100644 > > --- a/drivers/iommu/iommu.c > > +++ b/drivers/iommu/iommu.c > > @@ -48,6 +48,7 @@ struct iommu_group { > > struct list_head devices; > > struct mutex mutex; > > struct blocking_notifier_head notifier; > > + struct blocking_notifier_head fault_notifier; > > Do you really need a notifier chain here? Will there ever be more than > one callback registered to it? > yes, this notifier chain is shared by all devices under a group. the event contains device info which notifier callbacks can filter. > > +struct iommu_fault_event { > > + struct device *dev; > > Putting a 'struct device *' member in a uapi struct looks > fundamentally wrong. > > my mistake, it was originally (RFC) not in uapi but with the consideration of using vfio to expose it to user space I have moved it to uapi. But you are right, it should be some other forms of device representation used by vfio. VFIO layer has to do the translation and inject that into the guest. In kernel driver users can use struct device to identify the faulting device. > > Joerg > [Jacob Pan]