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

Re: [PATCH v5 09/13] xen/arm: mm: Use generic variable/function names for extendability


  • To: Julien Grall <julien@xxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 24 Aug 2023 11:18:34 +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=2E2YycaUmRjglDnO14BI3Olfi3l6vYkXLEaDHaGO4lw=; b=E7/FDr9PqNxy/we9AD11HLOw8L2TXSevDqPQIdEj2/En00BQEa1mTM2gbThqGec5dIg6U0M+L4EijsLiOJg8hsRFVeVDiruVFXRhpYx1VWAozTF2e6yqjmXvr14Z04dP24Edwa8B2L0l+8wWaA8Er1pgaJkl4lR5O7jWRgsyblFUGuBokRPOITVCp2xz2KLr0NUX4YBJqtoC2pvAEoK+4kh/jd9F1iRPL3RBvq9TOzbW3CLo/KV2r/ZqNxnr6wF0ifKqRjkS9rXBawqiYABehgZQyqQU6HUBnZaF433no2cf9e2TZwgA9eXoNdrFxzrq5wnNdUw23uRew070ZU16pA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qpw5VREKBEfL0tCEMHWBju5pRvHcpNU8ROV1nhil/kyaKre8CXHFskzEeAP2Vf8LA+2qXtGGQlym5F92qk7Dm5IQh7abgmhvaK40JMRUyEUgDShPswz0sosLl2+GdkwOJLp1I18bY3m9+zc/8aqGXZY+ANmWOdTbR02LfftUrhSJLEaUyrnqQoPUPOLRg+c5G9U+g5V4hkIc3WZHuaEFp4RCtonMDc+fjpP1C7KtLb/SMkTuYp2ivFjeVULw+5Tj973kYaQLReCXGYuhA4p1nOW05ZG4VyXkIZl1nLOb1a+UH0oh+1fGyeyqdAqOMnc3i9FSUZ+nJp1hrDj8Rc7anw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 24 Aug 2023 11:19:03 +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: AQHZzmeKSbzvNCb8Y0ecj302axbRZK/1HuGAgAQj9YCAAAlTgIAAEGoA
  • Thread-topic: [PATCH v5 09/13] xen/arm: mm: Use generic variable/function names for extendability

Hi Julienm

> On Aug 24, 2023, at 18:19, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Henry,
> 
> On 24/08/2023 10:46, Henry Wang wrote:
>>> On Aug 22, 2023, at 02:32, Julien Grall <julien@xxxxxxx> wrote:
>>> 
>>> Hi,
>>> 
>>> On 14/08/2023 05:25, Henry Wang wrote:
>>>> From: Penny Zheng <penny.zheng@xxxxxxx>
>>>> As preparation for MPU support, which will use some variables/functions
>>>> for both MMU and MPU system, We rename the affected variable/function
>>>> to more generic names:
>>>> - init_ttbr -> init_mm,
>>> 
>>> You moved init_ttbr to mm/mmu.c. So why does this need to be renamed?
>>> 
>>> And if you really planned to use it for the MPU code. Then init_ttbr should 
>>> not have been moved.
>> You are correct. I think we need to use the “init_mm” for MPU SMP support,
>> so I would not move this variable in v6.
> 
> Your branch mpu_v5 doesn't seem to contain any use. But I would expect that 
> the common is never going to use the variable. Also, at the moment it is 
> 64-bit but I don't see why it would be necessary to be bigger than 32-bit on 
> 32-bit.
> 
> So I think it would be preferable if init_ttbr is move in mm/mmu.c. You
> can then introduce an MPU specific variable.

Sounds good to me.

> 
> In general, only variables that will be used by common code should be defined 
> in common. All the rest should be defined in their specific directory.

Got it :))

> 
>>>> - mmu_init_secondary_cpu() -> mm_init_secondary_cpu()
>>>> - init_secondary_pagetables() -> init_secondary_mm()
>>> 
>>> The original naming were not great but the new one are a lot more confusing 
>>> as they seem to just be a reshuffle of word.
>>> 
>>> mm_init_secondary_cpu() is only setting the WxN bit. For the MMU, I think 
>>> it can be done much earlier. Do you have anything to add in it? If not, 
>>> then I would consider to get rid of it.
>> I’ve got rid of mmu_init_secondary_cpu() function in my local v6 as it is now
>> folded to the assembly code.
>>> 
>>> For init_secondary_mm(), I would renamed it to prepare_secondary_mm().
>> Sure, thanks for the name suggestion.
>>> 
>>>>  -void update_identity_mapping(bool enable)
>>>> +static void update_identity_mapping(bool enable)
>>> 
>>> Why not simply renaming this function to update_mm_mapping()? But...
>>> 
>>>>  {
>>>>      paddr_t id_addr = virt_to_maddr(_start);
>>>>      int rc;
>>>> @@ -120,6 +120,11 @@ void update_identity_mapping(bool enable)
>>>>      BUG_ON(rc);
>>>>  }
>>>>  +void update_mm_mapping(bool enable)
>>> 
>>> ... the new name it quite confusing. What is the mapping it is referring to?
>> So I checked the MPU SMP support code and now I think I understand the reason
>> why update_mm_mapping() was introduced:
>> In the future we eventually need to support SMP for MMU systems, which means
>> we need to call arch_cpu_up() and arch_cpu_up_finish(). These two functions 
>> call
>> update_identity_mapping(). Since we believe "identity mapping" is a MMU 
>> concept,
>> we changed this to generic name "mm mapping” as arch_cpu_up() and
>> arch_cpu_up_finish() is a shared path between MMU and MPU.
> 
> The function is today called "update_identity_mapping()" because this is what 
> the implementation does on arm64. But the goal of this function is to make 
> sure that any mapping necessary for bring-up secondary CPUs are present.
> 
> So if you don't need similar work for the MPU then I would go with...
> 
>> But I think MPU won’t use update_mm_mapping() function at all, so I wonder do
>> you prefer creating an empty stub update_identity_mapping() for MPU? Or use 
>> #ifdef
>> as suggested in your previous email...
> 
> 
> ... #ifdef. I have some preliminary work where the call to 
> update_identity_mapping() may end up to be moved somewhere else as the 
> page-tables would not be shared between pCPU anymore. So the logic will not 
> some rework (see [1]).

Thanks for sharing this info, I will drop the modification to 
update_identity_mapping()
from this patch.

Kind regards,
Henry


> 
> Cheers,
> 
> 
> [1] https://lore.kernel.org/all/20221216114853.8227-21-julien@xxxxxxx/
> 
> -- 
> Julien Grall


 


Rackspace

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