From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shannon Zhao Subject: Re: xen/arm: Crash when allocating memory for ACPI table (Was Re: Design doc of adding ACPI support for arm64 on Xen - version 2) Date: Fri, 14 Aug 2015 22:35:41 +0800 Message-ID: <55CDFCBD.608@linaro.org> References: <55C413D5.7000709@huawei.com> <55CAF41C.1090208@huawei.com> <55CB0DC0.4020304@citrix.com> <55CDF5A3.8050201@linaro.org> <55CDF87C.40103@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55CDF87C.40103@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall , Shannon Zhao , xen-devel , Jan Beulich , Stefano Stabellini , Ian Campbell , Parth Dixit , Christoffer Dall Cc: Hangaohuai , "Huangpeng (Peter)" List-Id: xen-devel@lists.xenproject.org Hi Julien, On 2015/8/14 22:17, Julien Grall wrote: > (Renaming the subject) > > Hi Shannon, > > On 14/08/15 15:05, Shannon Zhao wrote: >> >> >> On 2015/8/12 17:11, Julien Grall wrote: >>> On 12/08/2015 08:22, Shannon Zhao wrote: >>>> Hi, >>> >>> Hi Shannon, >>> >>> It's not part of the design discussion and we are avoiding to mix >>> discussion. Can you please create another thread (or at least renaming >>> the subject)? >>> >>>> I'm working on re-spinning this patchset while encountering a werid >>>> problem about xzalloc_bytes. >>>> >>>> Since I need to copy some ACPI tables, I need to allocate some memory >>>> for it. So there are a few places calling xzalloc_bytes. And it fails at >>>> the fifth one. The log is shown as following: >>> >>> Do you copy data in the newly allocated memory between 2 xzalloc_bytes? >>> >> >> No, I just use xzalloc_bytes to allocate some place and copy ACPI to the >> allocated place, modify the content, then call >> raw_copy_to_guest_flush_dcache to copy the modified tables to guest memory. > > Can you provide the code and show which call is crashing? > Oh, sorry. The code is not on hand as it stays at my working computer. From previous debug, it fails at the xzalloc_bytes. Because I add two printk before and after the xzalloc_bytes, only the before one shows. The code calling route is like below: acpi_create_fadt(); acpi_create_gtdt(); acpi_create_madt(); acpi_create_stao(); acpi_create_xsdt(); acpi_map_rsdp(); acpi_map_rest_table(); acpi_create_est(); acpi_create_mmap(); ... Within everyone of these functions, it will call xzalloc_bytes to allocate memory and call raw_copy_to_guest_flush_dcache to copy the modified tables to guest memory. And this failure happened at acpi_create_xsdt(). If I add xzalloc_bytes(1000) before acpi_create_xsdt() like below: acpi_create_fadt(); acpi_create_gtdt(); acpi_create_madt(); acpi_create_stao(); xzalloc_bytes(1000); acpi_create_xsdt(); acpi_map_rsdp(); acpi_map_rest_table(); acpi_create_est(); acpi_create_mmap(); ... The failure will not happen at acpi_create_xsdt() but at acpi_create_mmap(). -- Shannon