From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758208Ab3FMBdO (ORCPT ); Wed, 12 Jun 2013 21:33:14 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:47472 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755972Ab3FMBdN (ORCPT ); Wed, 12 Jun 2013 21:33:13 -0400 X-SecurityPolicyCheck: OK by SHieldMailChecker v1.8.9 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20120718-2 Message-ID: <51B92140.9050407@jp.fujitsu.com> Date: Thu, 13 Jun 2013 10:32:48 +0900 From: HATAYAMA Daisuke User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Michael Holzheu CC: HATAYAMA Daisuke , Heiko Carstens , kexec@lists.infradead.org, Jan Willeke , linux-kernel@vger.kernel.org, Martin Schwidefsky , Vivek Goyal Subject: Re: [PATCH v5 3/5] vmcore: Introduce remap_oldmem_pfn_range() References: <1370624161-2298-1-git-send-email-holzheu@linux.vnet.ibm.com> <1370624161-2298-4-git-send-email-holzheu@linux.vnet.ibm.com> <20130610173739.4d88d4ec@holzheu> <20130612111303.3323f24f@holzheu> In-Reply-To: <20130612111303.3323f24f@holzheu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2013/06/12 18:13), Michael Holzheu wrote: > On Tue, 11 Jun 2013 21:42:15 +0900 > HATAYAMA Daisuke wrote: > >> 2013/6/11 Michael Holzheu : >>> On Mon, 10 Jun 2013 22:40:24 +0900 >>> HATAYAMA Daisuke wrote: >>> >>>> 2013/6/8 Michael Holzheu : > static int mmap_vmcore_fault(struct vm_area_struct *vma, struct'vm_fault *vmf) > { > struct address_space *mapping = vma->vm_private_data; > pgoff_t index = vmf->pgoff; > struct page *page; > loff_t src; > char *buf; > > page = find_or_create_page(mapping, index, GFP_KERNEL); > if (!page) > return VM_FAULT_OOM; > if (!PageUptodate(page)) { > src = index << PAGE_CACHE_SHIFT; > buf = (void *) (page_to_pfn(page) << PAGE_SHIFT); > if (__read_vmcore(buf, PAGE_SIZE, &src, 0) < 0) { > unlock_page(page); > return VM_FAULT_SIGBUS; > } > SetPageUptodate(page); > } > unlock_page(page); > vmf->page = page; > return 0; > } > > Perhaps one open issue remains: > > Can we remove the page from the page cache if __read_vmcore() fails? > Yes, use page_cache_release() after unlocking the page like: if (__read_vmcore(buf, PAGE_SIZE, &src, 0) < 0) { unlock_page(page); + page_cache_release(page); return VM_FAULT_SIGBUS; } BTW, you now keep file->f_mapping in vma->vm_private_data, but the vma already has the file object in its vma->vm_file member. You can get the mapping by vma->vm_file->f_mapping without necessity of vma->vm_private_data. -- Thanks. HATAYAMA, Daisuke From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UmwPx-00057e-Ro for kexec@lists.infradead.org; Thu, 13 Jun 2013 01:33:39 +0000 Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 5B27F3EE0AE for ; Thu, 13 Jun 2013 10:33:08 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 4985245DE51 for ; Thu, 13 Jun 2013 10:33:08 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 2D71A45DE4D for ; Thu, 13 Jun 2013 10:33:08 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 1808F1DB803B for ; Thu, 13 Jun 2013 10:33:08 +0900 (JST) Received: from m1001.s.css.fujitsu.com (m1001.s.css.fujitsu.com [10.240.81.139]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id BDB951DB8040 for ; Thu, 13 Jun 2013 10:33:07 +0900 (JST) Message-ID: <51B92140.9050407@jp.fujitsu.com> Date: Thu, 13 Jun 2013 10:32:48 +0900 From: HATAYAMA Daisuke MIME-Version: 1.0 Subject: Re: [PATCH v5 3/5] vmcore: Introduce remap_oldmem_pfn_range() References: <1370624161-2298-1-git-send-email-holzheu@linux.vnet.ibm.com> <1370624161-2298-4-git-send-email-holzheu@linux.vnet.ibm.com> <20130610173739.4d88d4ec@holzheu> <20130612111303.3323f24f@holzheu> In-Reply-To: <20130612111303.3323f24f@holzheu> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "kexec" Errors-To: kexec-bounces+dwmw2=twosheds.infradead.org@lists.infradead.org To: Michael Holzheu Cc: kexec@lists.infradead.org, Heiko Carstens , linux-kernel@vger.kernel.org, Jan Willeke , HATAYAMA Daisuke , Martin Schwidefsky , Vivek Goyal (2013/06/12 18:13), Michael Holzheu wrote: > On Tue, 11 Jun 2013 21:42:15 +0900 > HATAYAMA Daisuke wrote: > >> 2013/6/11 Michael Holzheu : >>> On Mon, 10 Jun 2013 22:40:24 +0900 >>> HATAYAMA Daisuke wrote: >>> >>>> 2013/6/8 Michael Holzheu : > static int mmap_vmcore_fault(struct vm_area_struct *vma, struct'vm_fault *vmf) > { > struct address_space *mapping = vma->vm_private_data; > pgoff_t index = vmf->pgoff; > struct page *page; > loff_t src; > char *buf; > > page = find_or_create_page(mapping, index, GFP_KERNEL); > if (!page) > return VM_FAULT_OOM; > if (!PageUptodate(page)) { > src = index << PAGE_CACHE_SHIFT; > buf = (void *) (page_to_pfn(page) << PAGE_SHIFT); > if (__read_vmcore(buf, PAGE_SIZE, &src, 0) < 0) { > unlock_page(page); > return VM_FAULT_SIGBUS; > } > SetPageUptodate(page); > } > unlock_page(page); > vmf->page = page; > return 0; > } > > Perhaps one open issue remains: > > Can we remove the page from the page cache if __read_vmcore() fails? > Yes, use page_cache_release() after unlocking the page like: if (__read_vmcore(buf, PAGE_SIZE, &src, 0) < 0) { unlock_page(page); + page_cache_release(page); return VM_FAULT_SIGBUS; } BTW, you now keep file->f_mapping in vma->vm_private_data, but the vma already has the file object in its vma->vm_file member. You can get the mapping by vma->vm_file->f_mapping without necessity of vma->vm_private_data. -- Thanks. HATAYAMA, Daisuke _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec