[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 01/13] xen/arm64: head.S: Introduce enable_{boot,secondary}_cpu_mm


  • To: Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 10 Aug 2023 04:12:06 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m0EkChZIIJCHJ/QHdflQAoITOqAY/DUvdYi0tgRVvgU=; b=Y1VCXfsfJC8ooo0eW3FS6tXX7CEP9qJARAUlqbGuPHcfWmo/rG63Wcsa1DiiW5y7sK9nKU9eVGvUodLMkwiUb51Un/5Lee3z9qKThR1x1WV52XIulTNdCc6ws5KVNP50o5mzq3IjVPxJ40snyFdK+11GRTrPvdK4LxbEwWR1hhks1FB7CahYmMgjQUKr3Mfw68doxZXpHyQvdxqBlEWzIR6UTAp6XJeK1E01x/Z8maft63EySfrQXHXi2ZbWEMB9CEfKk7Euf9f96ONqTfibM5UaNV2y6S4VEO0x7Ted8w6HhRZGUT+SHzulLc4PXJ4vI/TBQtx901D6R/KugsQMBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nHSFJUAbQ8zOTPskVMiaKQii6IPs41CMOt5US17d7vXG3QuwioE7t9obZ5C8K+BBhsZT1QUr0jFdeuOZJqkPwa2WSMBQLR6CMohoLE0Wnon+b+e+UsgZQiJrII+W6U2DdCVMqodmP167RDQhH2aNyjgC4CVYvZkJeTWBGxifWcpULp6d5x+1K3q5TZqzYNMtS/8JuFst8t8+NNpjBrwBusLnc4eoqHqccwlrwAqW7bVbOuJJXPCYxj8X2FabFWzekB4ydsKnjgjd+yN8uP+vglumOFPvFHetyy8AUNoD1OjXvtcMYiu0PMBc1tMbpvMs+MlD0MMVWjlJkUJPSnXOXA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Thu, 10 Aug 2023 04:12:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZxCqBtZIUxf7FmUaIEyO8EPs3TK/h6aMAgAEPoIA=
  • Thread-topic: [PATCH v4 01/13] xen/arm64: head.S: Introduce enable_{boot,secondary}_cpu_mm

Hi Julien,

> On Aug 9, 2023, at 19:59, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Henry,
> 
> Title: NIT: Add () after _mm to stay consistent with the rest.

Yes sure, I will add “()” in v5.

> 
> On 01/08/2023 04:44, Henry Wang wrote:
>> From: Wei Chen <wei.chen@xxxxxxx>
>> 
>> +enable_secondary_cpu_mm:
>> +        mov   x5, lr
>> +
>> +        load_paddr x0, init_ttbr
>> +        ldr   x0, [x0]
>> +
>> +        bl    enable_mmu
>> +        mov   lr, x5
>> +
>> +        /* return to secondary_switched */
> 
> Technically, you will return to the virtual address set in 'lr'. This is 
> 'secondary_switched' today but this could change.
> 
> So it would be better to have a more generic comment like:
> 
> Return to the virtual address requested by the caller.

Sure, and...

> 
>> +        ret
>> +ENDPROC(enable_secondary_cpu_mm)
>> +
>> 
>> +1:
>> +        /*
>> +         * The 1:1 map may clash with other parts of the Xen virtual memory
>> +         * layout. As it is not used anymore, remove it completely to
>> +         * avoid having to worry about replacing existing mapping
>> +         * afterwards. Function will return to primary_switched.
> 
> Same remark here.

…same here.

> 
>> +         */
>> +        b     remove_identity_mapping
>> +
>> +        /*
>> +         * Below is supposed to be unreachable code, as "ret" in
>> +         * remove_identity_mapping will use the return address in LR in 
>> advance.
>> +         */
>> +        b     fail
> 
> Looking at this again, I am not entirely sure how this could reached if 
> remove_identity_mapping use 'ret' and you call it with 'b'. So I would 
> suggest to drop it and move 'mov lr, x5' closer to 'b 
> remove_identity_mapping'. So it is clearer that it will return.

Ok, I’ve addressed this locally and tested the change, Xen and Dom0 boot
fine with the changes that you suggested. Will send v5 soon after fixing
all your comments. Thanks!

Kind regards,
Henry

> 
>> +ENDPROC(enable_boot_cpu_mm)
>> +
>>  /*
>>   * Remove the 1:1 map from the page-tables. It is not easy to keep track
>>   * where the 1:1 map was mapped, so we will look for the top-level entry
> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.