On Fri, 21 Mar 2014 10:26:35 +0100
Christian Borntraeger <borntrae...@de.ibm.com> wrote:

> On 17/03/14 19:11, Cornelia Huck wrote:
> > Add a new interface to register/deregister sources of adapter interrupts
> > identified by an unique id via the flic. Adapters may also be maskable
> > and carry a list of pinned pages.
> > 
> > These adapters will be used by irq routing later.
> > 
> > Signed-off-by: Cornelia Huck <cornelia.h...@de.ibm.com>
> 
> [...]
> 
> > +static int kvm_s390_adapter_map(struct kvm *kvm, unsigned int id, __u64 
> > addr)
> > +{
> > +   struct s390_io_adapter *adapter = get_io_adapter(kvm, id);
> > +   struct s390_map_info *map;
> > +   int ret;
> > +
> > +   if (!adapter || !addr)
> > +           return -EINVAL;
> > +
> > +   map = kzalloc(sizeof(*map), GFP_KERNEL);
> > +   if (!map) {
> > +           ret = -ENOMEM;
> > +           goto out;
> > +   }
> > +   INIT_LIST_HEAD(&map->list);
> > +   map->addr = addr;
> > +   ret = get_user_pages_fast(addr, 1, 1, &map->page);
> > +   if (ret < 0)
> > +           goto out;
> > +   BUG_ON(ret != 1);
> > +   down_write(&adapter->maps_lock);
> > +   list_add_tail(&map->list, &adapter->maps);
> > +   up_write(&adapter->maps_lock);
> > +   ret = 0;
> 
> Can you limit the amount of pinned pages to something sane, e.g. 1MB?
> As far as I can see, QEMU will fall back to non-irqfd if the mapping fails.

I'll introduce a counter for that.

> 
> Otherwise looks good.
> 
> Acked-by: Christian Borntraeger <borntrae...@de.ibm.com>
> 


Reply via email to