Re: [PATCH v3] LoongArch: Add support to clone a time namespace

From: Tiezhu Yang
Date: Wed May 31 2023 - 06:02:19 EST




On 05/31/2023 04:34 PM, Youling Tang wrote:
Hi, Tiezhu

On 05/31/2023 03:56 PM, Tiezhu Yang wrote:

...

It can also be changed as follows,

enum vvar_pages {
VVAR_GENERIC_PAGE_OFFSET,
VVAR_TIMENS_PAGE_OFFSET,
VVAR_LOONGARCH_PAGES_START,
VVAR_LOONGARCH_PAGES_END = VVAR_LOONGARCH_PAGES_START +
LOONGARCH_VDSO_DATA_PAGES - 1,
VVAR_NR_PAGES,
};

#define VVAR_SIZE (VVAR_NR_PAGES << PAGE_SHIFT)

Which do you think is better?

Thanks, it seems more simple to define VVAR_SIZE and works well
as expected. Let us wait for more review comments before respin.

I will send v4 with the following changes based on the current
patch in the next week.

$ git diff
diff --git a/arch/loongarch/include/asm/vdso/vdso.h b/arch/loongarch/include/asm/vdso/vdso.h
index fa6049ef635e..7e9bceb8c009 100644
--- a/arch/loongarch/include/asm/vdso/vdso.h
+++ b/arch/loongarch/include/asm/vdso/vdso.h
@@ -33,15 +33,17 @@ struct loongarch_vdso_data {
*/
#define LOONGARCH_VDSO_DATA_SIZE PAGE_ALIGN(sizeof(struct loongarch_vdso_data))
#define LOONGARCH_VDSO_DATA_PAGES (LOONGARCH_VDSO_DATA_SIZE >> PAGE_SHIFT)
-#define VVAR_SIZE (VVAR_LOONGARCH_PAGES_START * PAGE_SIZE + LOONGARCH_VDSO_DATA_SIZE)

enum vvar_pages {
VVAR_GENERIC_PAGE_OFFSET,
VVAR_TIMENS_PAGE_OFFSET,
VVAR_LOONGARCH_PAGES_START,
VVAR_LOONGARCH_PAGES_END = VVAR_LOONGARCH_PAGES_START + LOONGARCH_VDSO_DATA_PAGES - 1,
+ VVAR_NR_PAGES,
};

+#define VVAR_SIZE (VVAR_NR_PAGES << PAGE_SHIFT)
+
static inline unsigned long get_vdso_base(void)
{
unsigned long addr;

Thanks,
Tiezhu