From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 1CB4138515E6 for ; Mon, 31 May 2021 14:57:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1CB4138515E6 Received: by mail-qk1-x736.google.com with SMTP id j184so11429592qkd.6 for ; Mon, 31 May 2021 07:57:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+NfTOejQ60t24YvX+aqgXNX1fc0mNWi8b5spzmraEv8=; b=Ktp3Cv0vKdfDl3ZfMd+t9IrQCR8uR40aD7gh4ubdWgdZ16n3dLK1acJZY+tziPmr4W DvnnVGkZfhiAoYdj4cwsiyHO8zUf+VXPFr81DcES1IMw4CTu6ePUjx2XTXE8z7VWBmwA SPmLOSoZJ5jK2u8deL8uCTVuTmYWrcNSP01g2K32PpEQaFn2bUKwPno87mkg5/93CbEH UulK9R242lo+485HYz30gZIYSNTU0ZIdbxSJNVidNNKWKyUPOaVPJtCvuCUChbPEAQyq 39iES+rowZ85TCIcLoHYJgumVcDKljNP5/rTLgg4MZTjW65EZ+dOyKUQnM+049xa6VG5 9zIg== X-Gm-Message-State: AOAM530vfo8VNiRZ7/AHduvuLAk6IZgAvFgaAzNseoFykg9FQJOhaF+F HC4BLdmXoHBd4qmDpxz8x9ULpg== X-Google-Smtp-Source: ABdhPJzn68CXZins/Q/HZv8bhSSRMGR2w3Nbe+grHiTslvV6CKmlr6HDX+kanwGRHvpmdiCx1X+RqQ== X-Received: by 2002:a05:620a:8d6:: with SMTP id z22mr17002813qkz.407.1622473019653; Mon, 31 May 2021 07:56:59 -0700 (PDT) Received: from ?IPv6:2804:7f0:4841:5c9d:d181:e3a7:9333:1f86? ([2804:7f0:4841:5c9d:d181:e3a7:9333:1f86]) by smtp.gmail.com with ESMTPSA id e19sm8548335qtr.45.2021.05.31.07.56.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 May 2021 07:56:59 -0700 (PDT) Subject: Re: [PATCH,v2] [AArch64] MTE corefile support To: Simon Marchi , gdb-patches@sourceware.org Cc: david.spickett@linaro.org, catalin.marinas@arm.com, John Baldwin References: <20210518202047.3492211-1-luis.machado@linaro.org> <20210526140838.3856474-1-luis.machado@linaro.org> <4ae84e2c-f0c4-bcac-1e5d-b9b34d8521db@linaro.org> <87af0c4e-7a26-ecde-dc4e-95f96ec2ccc8@polymtl.ca> From: Luis Machado Message-ID: <860e15d8-ed55-d5de-6d72-1aedd9a84f93@linaro.org> Date: Mon, 31 May 2021 11:56:53 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <87af0c4e-7a26-ecde-dc4e-95f96ec2ccc8@polymtl.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 14:57:01 -0000 On 5/31/21 11:49 AM, Simon Marchi wrote: > On 2021-05-31 10:12 a.m., Luis Machado wrote: >>>> @@ -71,4 +72,18 @@ extern CORE_ADDR aarch64_mte_set_ltag (CORE_ADDR address, CORE_ADDR tag); >>>> It is always possible to get the logical tag. */ >>>> extern CORE_ADDR aarch64_mte_get_ltag (CORE_ADDR address); >>>> +/* MTE-specific NT_MEMTAG header. */ >>>> +struct tag_dump_mte >>>> +{ >>>> + /* Size of the tag granule in bytes. */ >>>> + uint16_t granule_byte_size; >>>> + /* Size of the tag in bits. */ >>>> + uint16_t tag_bit_size; >>>> + /* Reserved field for the future. */ >>>> + uint16_t __unused; >>>> +}; >>> >>> This struct is unused. >>> >> >> I'm inclined to leave that as documentation instead, so it is clear what the header sizes are referring to. > > The thing is that somebody reading the code in the .c seeing the > arbitrary sizeofs will note have a clue to go look at > arch/aarch64-mte-linux.h for explanations. So another option would be > to write it as a comment near the code. Something like: > > /* The header follows the following format: > > struct > { > /* Size of the tag granule in bytes. */ > uint16_t granule_byte_size; > /* Size of the tag in bits. */ > uint16_t tag_bit_size; > /* Reserved field for the future. */ > uint16_t __unused; > }; > */ > > Another option would be to have the structure and refer to its fields in > sizeof: > > store_unsigned_integer (buf, sizeof (tag_dump_mte::granule_byte_size), > byte_order, AARCH64_MTE_GRANULE_SIZE); I think that would work as well. I can change it for the next iteration.