From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932499AbcECGLm (ORCPT ); Tue, 3 May 2016 02:11:42 -0400 Received: from mga11.intel.com ([192.55.52.93]:20439 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932212AbcECGLk (ORCPT ); Tue, 3 May 2016 02:11:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,571,1455004800"; d="scan'208";a="797476881" From: "Tian, Kevin" To: Yongji Xie , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" 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" Subject: RE: [PATCH] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive Thread-Topic: [PATCH] vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive Thread-Index: AQHRoH+tlu5pzc5cg0yFTywClD3ty5+mjWnQ//+rVgCAAInOQA== Date: Tue, 3 May 2016 06:11:20 +0000 Message-ID: References: <1461759740-5072-1-git-send-email-xyjxie@linux.vnet.ibm.com> <00243350-1ccc-75e5-8cd8-a58dfe14637f@linux.vnet.ibm.com> In-Reply-To: <00243350-1ccc-75e5-8cd8-a58dfe14637f@linux.vnet.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTI3Y2Q3ZDItZGFmYS00MTE2LWIzMjctYjdhZDdmNmI0OWMwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlJIMFlmUmlBZmJtc3NENFlYakZ2QlRIa3E2b2tZZjlVVHpaRG5JeG54UjA9In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u436BkXw025050 > 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