From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 8C27B3855C0D; Tue, 21 Feb 2023 13:03:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C27B3855C0D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.20.4.52]) by gateway (Coremail) with SMTP id _____8AxJEwHwfRj7ygDAA--.1041S3; Tue, 21 Feb 2023 21:03:04 +0800 (CST) Received: from [10.20.4.52] (unknown [10.20.4.52]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxHuQHwfRjPMM3AA--.3S2; Tue, 21 Feb 2023 21:03:03 +0800 (CST) Subject: Re: [PATCH] LoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x1000000000. To: Xi Ruoyao , gcc-patches@gcc.gnu.org, pinskia@gcc.gnu.org, richard.sandiford@arm.com Cc: i@xen0n.name, xuchenghua@loongson.cn References: <20230221072001.480858-1-chenglulu@loongson.cn> From: Lulu Cheng Message-ID: Date: Tue, 21 Feb 2023 21:03:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8AxHuQHwfRjPMM3AA--.3S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tr48KryDAw47JF1rKr18AFb_yoW8CF43pF 1rt3WrKFWkJrZ5Aw4Dt3ZIkFyUJws0ya4UWw1UGFyru345Gr1jvF1qgr4Y9a9rXr4kAw4f XF1kCF42vay5C3DanT9S1TB71UUUUUJqnTZGkaVYY2UrU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_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 在 2023/2/21 下午3:41, Xi Ruoyao 写道: > On Tue, 2023-02-21 at 15:20 +0800, Lulu Cheng wrote: >> Like la264 only has 40 effective bits of virtual address space. > I'm OK with the change. But the VA length is configurable building the > kernel. Is there any specific reason LA264 has to use the 40-bit > configuration, or should we reword the commit message like "for > supporting the configuration with less page table level or smaller page > size"? I consulted with my colleagues who are working on the kernel, it looks like this: The la264 chip desgn is physically 40-bit virtual address. User mode and kernel mode each account for half: User mode :    0x0-0x7f ffff ffff Kernel mode:  0xffff ff80 0000 0000 -0xffff ffff ffff ffff The high bit is the sign extension of bit39. > >> When TRY_EMPTY_VM_SPACE is set to 0x8000000000, it just exceeds >> the range of 40-bit virtual address, causing the mmap mapping >> to fail, thus causing the pch function to fail. To be compatible >> with this situation set the macro to 0x1000000000. >> >> gcc/ChangeLog: >> >>         * config/host-linux.cc (TRY_EMPTY_VM_SPACE): Modify the value >> of >>         the macro to 0x1000000000. >> --- >>  gcc/config/host-linux.cc | 2 +- >>  1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/config/host-linux.cc b/gcc/config/host-linux.cc >> index a891651a7b6..d1aa7ab28ca 100644 >> --- a/gcc/config/host-linux.cc >> +++ b/gcc/config/host-linux.cc >> @@ -99,7 +99,7 @@ >>  #elif defined(__riscv) && defined (__LP64__) >>  # define TRY_EMPTY_VM_SPACE    0x1000000000 >>  #elif defined(__loongarch__) && defined(__LP64__) >> -# define TRY_EMPTY_VM_SPACE    0x8000000000 >> +# define TRY_EMPTY_VM_SPACE    0x1000000000 >>  #else >>  # define TRY_EMPTY_VM_SPACE    0 >>  #endif