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 B3DA03856DC8 for ; Wed, 12 Oct 2022 02:52:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B3DA03856DC8 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 [10.20.4.52] (unknown [10.20.4.52]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxX+DsK0Zjl4IrAA--.26556S2; Wed, 12 Oct 2022 10:52:28 +0800 (CST) Subject: Re: [PATCH v2] LoongArch: Libvtv add loongarch support. To: Caroline Tice Cc: GCC Patches , mliska@suse.cz, David Malcolm , qijingwen , xuchenghua@loongson.cn, i@xen0n.name References: <20220927074928.804896-1-chenglulu@loongson.cn> From: Lulu Cheng Message-ID: <7a6d077c-7a3b-1660-ba20-a24804e10b30@loongson.cn> Date: Wed, 12 Oct 2022 10:52:28 +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: multipart/alternative; boundary="------------8CAF539933B931AC2A1F46FC" Content-Language: en-US X-CM-TRANSID:AQAAf8DxX+DsK0Zjl4IrAA--.26556S2 X-Coremail-Antispam: 1UD129KBjvJXoW7uw48Kw4kZFW8WF1UJry7Wrg_yoW8Gr4fpF 4Igr9FvrWDJw4xJ3yxtw47W3yYvrWUJa1UG3s8JrW8Crn8Cas2gr12qrZY9F10qr4rury8 tr1Ig39xuw48ZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvF14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21lYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0E x4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwACjI8F5V A0II8E6IAqYI8I648v4I1l7480Y4vEI4kI2Ix0rVAqx4xJMxk0xIA0c2IEe2xFo4CEbIxv r21lc2xSY4AK6svPMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I 0E5I8CrVAFwI0_JrI_JrWlx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWU AVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcV CY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvj fUwYFCUUUUU X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,HTML_MESSAGE,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_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: This is a multi-part message in MIME format. --------------8CAF539933B931AC2A1F46FC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 在 2022/10/12 上午4:57, Caroline Tice 写道: > I think that if VTV_PAGE_SIZE is not set to the actual size being used > by the system,  it could result in some unexpected failures.  I > believe the right thing to do in this case, since the size may vary, > is to get the actual size being used by the system and use that in the > definition of VTV_PAGE_SIZE.  So in include/vtv-permission.h you > would have something like: > > +#elif defined(__loongarch_lp64) > +#define VTV_PAGE_SIZE sysconf(_SC_PAGE_SIZE) > > Then you would have the accurate, correct size for the current system, > and there would be no need to update the > check in vtv_malloc.cc at all.     /* Page-aligned symbol to mark beginning of .vtable_map_vars section.  */     char _vtable_map_vars_start []     __attribute__ ((__visibility__ ("protected"), used, aligned(VTV_PAGE_SIZE),             section(".vtable_map_vars")))       = { }; The above code is in the libgcc/vtv_start.c file. Alignment (aligned (alignment) ) must be an integer constant power of 2. So setting VTV_PAGE_SIZE as a variable is not advisable. As xiruoyao notes, the default value for the LoongArch Linux kernel configuration is 16KB. So let's set VTV_PAGE_SIZE to 16KB first and I will indicate in the submission information that only 16KB pages are supported. --------------8CAF539933B931AC2A1F46FC--