From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412AbcECHgI (ORCPT ); Tue, 3 May 2016 03:36:08 -0400 Received: from e28smtp07.in.ibm.com ([125.16.236.7]:38666 "EHLO e28smtp07.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751016AbcECHgE (ORCPT ); Tue, 3 May 2016 03:36:04 -0400 X-IBM-Helo: d28dlp02.in.ibm.com X-IBM-MailFrom: xyjxie@linux.vnet.ibm.com X-IBM-RcptTo: kvm@vger.kernel.org;linux-doc@vger.kernel.org;linux-kernel@vger.kernel.org;linux-pci@vger.kernel.org Subject: Re: [PATCH] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive To: "Tian, Kevin" , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" References: <1461759740-5072-1-git-send-email-xyjxie@linux.vnet.ibm.com> <00243350-1ccc-75e5-8cd8-a58dfe14637f@linux.vnet.ibm.com> Cc: "alex.williamson@redhat.com" , "bhelgaas@google.com" , "aik@ozlabs.ru" , "benh@kernel.crashing.org" , "paulus@samba.org" , "mpe@ellerman.id.au" , "corbet@lwn.net" , "warrier@linux.vnet.ibm.com" , "zhong@linux.vnet.ibm.com" , "nikunj@linux.vnet.ibm.com" , "gwshan@linux.vnet.ibm.com" From: Yongji Xie Message-ID: Date: Tue, 3 May 2016 15:36:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16050307-0025-0000-0000-00000BD7DCA0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/3 14:11, Tian, Kevin wrote: >> From: Yongji Xie [mailto:xyjxie@linux.vnet.ibm.com] >> Sent: Tuesday, May 03, 2016 1:52 PM >> >>>> + >>>> + if (!(res->start & ~PAGE_MASK)) { >>>> + /* >>>> + * Add shadow resource for sub-page bar whose mmio >>>> + * page is exclusive in case that hot-add device's >>>> + * bar is assigned into the mem hole. >>>> + */ >>>> + shadow_res = kzalloc(sizeof(*shadow_res), GFP_KERNEL); >>>> + shadow_res->resource.start = res->end + 1; >>>> + shadow_res->resource.end = res->start + PAGE_SIZE - 1; >>> What about res->start not page aligned so you end up still having >>> a portion before res->start not exclusively reserved? >> Do you mean add a 'dummy' resource to reserve the portion >> before res->start if res->start not page aligned? >> >> But would it happen that there is a mem hole in the portion >> before res->start? The resource should have been assigned >> into the hole at the beginning. >> > Just a quick thought. Another device might occupy that range > before initializing this device, and then 'another device' is hot > removed later... > > Thanks > Kevin That's a good point! I will add support for this case in v2. Thanks, Yongji