From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754562AbcIOQSu (ORCPT ); Thu, 15 Sep 2016 12:18:50 -0400 Received: from mail-co1nam03on0128.outbound.protection.outlook.com ([104.47.40.128]:14430 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752627AbcIOQSf (ORCPT ); Thu, 15 Sep 2016 12:18:35 -0400 From: "Kani, Toshimitsu" To: "pbonzini@redhat.com" , "karahmed@amazon.de" CC: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "bp@suse.de" , "tglx@linutronix.de" , "x86@kernel.org" , "akpm@linux-foundation.org" , "hpa@zytor.com" , "mingo@redhat.com" , "tony.luck@intel.com" , "dvlasenk@redhat.com" , "rkrcmar@redhat.com" Subject: Re: [PATCH] kvm, x86: Properly check whether a pfn is an MMIO or not Thread-Topic: [PATCH] kvm, x86: Properly check whether a pfn is an MMIO or not Thread-Index: AQHRzC7R9qEOiOWLYkalVSzLdnrxqJ/1f0AAgIUTsYCAAAfKgIAAojgA Date: Thu, 15 Sep 2016 16:04:18 +0000 Message-ID: <1473955392.2092.76.camel@hpe.com> References: <1466562866-31524-1-git-send-email-karahmed@amazon.de> <6b30fd96-dc04-13a2-aa8b-7760a85337c6@redhat.com> <85E2C33C-8873-4CC8-8D31-9A85C30F8DB5@amazon.de> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=toshi.kani@hpe.com; x-originating-ip: [15.219.163.9] x-ms-office365-filtering-correlation-id: aa86e54c-9f53-4ff6-c8e4-08d3dd81f2fe x-microsoft-exchange-diagnostics: 1;CS1PR84MB0006;6:8uTtAx918SiQt9dvSH9+mt/P4rUCVOis5usB12xXnlTDMnpsvguNDZuIGf5u645hbpR/E+VheP4VGyLBwJuIZZrf6NtCTtOSc4w6WSEnBEDMGEeR4ifHERoSDhDfOvQkFsTs1ExPHUPGc9xIsdvpywQwUhQ8eCRhODd7h4JU8WSfHlYYoQt3lMNhoMqj0jArlwPC86U+aJNq0xEa2rIkgmlP/uKBITygTtLQsd1S+mb0956khr3grOcHZIhw5MRg/7lYLZLEtJU4BEtB7zpprxqLUgrVh1mNXwszTqLqWDD3SfXoe3aRbmjELU4On00cUzcsBTo4tOXNdgqWdQigkQ==;5:pDVOnS7j7zn+QzdjW1bEpn8bfRAiIN1NxmwLvdEJazYGTGADRQCwi2drbBP9GVpsu0ysGYyCSymdOV4HP0bHm39VGKwIhHIi28cSfMDdOWi0aSmhvwM6ChyGxdbp9LWJwXQMYaK9sXOQR/EnqUhYKw==;24:mPbMhzwITsh+FoLl7RH6FtNQffXbMt/e1UJsVf9Xif0A6CB0xmpyQn+hXJXPNoW6H7qPZFZ04tbdIPy8iGgy5Cb9MiyalBRCI+aoC30tdEQ=;7:LWreYgSPK6fMSQ4Op/MOKJnbbWCnTEi7+Fu31YjnQ+gb/LyotJMBu0x7mfE0Sa8YwRPeCLR0B6juwObO8AA+a2bgXMSkHLlHgxSZLdncIsy92DCn0M9/WuFObVUp9fRk2yM/FGXOIa1HfNIoYEKtTLOXXI5MXUg65FAinwh/mnLLxto3e7FdDTorZ42xW5FnebSvWY4nhwFqB92OSnAFvtSgfznmY2zAYKBZW4fHqCzHg1oJffBrwlZd3Y2/J0Pt x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0006; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:CS1PR84MB0006;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0006; x-forefront-prvs: 0066D63CE6 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(377454003)(377424004)(199003)(24454002)(189002)(2950100001)(5002640100001)(54356999)(50986999)(101416001)(76176999)(86362001)(2900100001)(7416002)(33646002)(77096005)(97736004)(122556002)(103116003)(93886004)(6116002)(5660300001)(4326007)(5001770100001)(3846002)(36756003)(10400500002)(102836003)(81166006)(8936002)(11100500001)(92566002)(3660700001)(81156014)(19580395003)(2501003)(66066001)(2906002)(8676002)(305945005)(105586002)(99286002)(189998001)(68736007)(87936001)(3280700002)(106116001)(19580405001)(106356001)(7736002)(586003)(7846002)(61793002);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR84MB0006;H:CS1PR84MB0005.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Sep 2016 16:04:18.5544 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0006 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 u8FGIu8G007217 On Thu, 2016-09-15 at 08:22 +0200, Paolo Bonzini wrote: > > On 15/09/2016 07:54, Raslan, KarimAllah wrote: > > > > > > > > > > On Jun 22, 2016, at 3:41 PM, Paolo Bonzini > > > wrote: > > > > > > > > > > > > On 22/06/2016 04:34, KarimAllah Ahmed wrote: > > > > > > > > pfn_valid check is not sufficient because it only checks if a > > > > page has a struct page or not, if for example "mem=" was passed > > > > to the kernel some valid pages won't have a struct page. This > > > > means that if guests were assigned valid memory that lies after > > > > the mem= boundary it will be passed uncached to the guest no > > > > matter what the guest caching attributes are for this memory. > > > > > > How can you pass memory after the mem= boundary to the guest? > > > > Does my previous reply answer your question? > > Yes, but I'm not sure it's the right way to do it.  Looking at the > e820 memory map seems pretty hacky. Can you use region_intersects() for this check?  See memremap() as an example using this interface. -Toshi