From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by sourceware.org (Postfix) with ESMTPS id BC6E63858D32; Tue, 21 Feb 2023 13:57:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BC6E63858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=xen0n.name Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xen0n.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1676987818; bh=K7wOXvfQ4Oz+8u0hF397iOBva8i/ae9e5GeO4n0jEmA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fh7R4rzQyhGfT/fSwuna6nDlJCa+A7G5q070VU5Ca/wGmYMydLnvOT9FQj/iLH4pD op9hdfiwyfIuZ4h37cBdwGAnB28aDKm1XaDdSgkp465pNumM4qwbQnrjrV+MiMhCdC esZPMo7mTUlICAUDJcReAZso48DPFD5w2qcrf/R4= Received: from [100.100.57.122] (unknown [58.34.185.106]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id AEB106006F; Tue, 21 Feb 2023 21:56:58 +0800 (CST) Message-ID: Date: Tue, 21 Feb 2023 21:56:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] LoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x1000000000. Content-Language: en-US To: Lulu Cheng , Xi Ruoyao , gcc-patches@gcc.gnu.org, pinskia@gcc.gnu.org, richard.sandiford@arm.com Cc: xuchenghua@loongson.cn References: <20230221072001.480858-1-chenglulu@loongson.cn> From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On 2023/2/21 21:03, Lulu Cheng wrote: > > 在 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. > Looking at the comments around the TRY_EMPTY_VM_SPACE definitions, they all indicate that the guessed range should be "likely free" -- that implies "usable". Given the common VM allocation behavior, we want TRY_EMPTY_VM_SPACE to point at a reasonably high place in the VA so it's "likely free". So IMO the point is, will there be any LoongArch HW in the foreseeable future, with less than maybe 40 bits of VA? If the answer is "no" then a TRY_EMPTY_VM_SPACE near the 40-bit VA ceiling would be appropriate. Otherwise you may have to choose a value near or even below a 32-bit VA's upper limit: according to the ISA manual Volume 1, Section 2.1.5, "typical VALEN is in the range of [40, 48]"; also see Section 5.2.3, RDVA can be as large as 8, so the actual VA space could theoretically be as narrow as 40-8=32 bits.