From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A3BE01F5AE for ; Thu, 9 Jul 2020 11:47:22 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 96097384404C; Thu, 9 Jul 2020 11:47:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 96097384404C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594295241; bh=C+GqigftoFMb5e4nhs+m6rWS7O4BxGtl33wx74230D4=; h=To:References:Subject:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Oqzy65fKNBiBdgATTpIBD+skuqbOPHHIjlEv3SbzQqBGmKzTKW7bTmd02akIGiquv HHhqfeZwF41mb2SwMeohkP8qyGcqXrB5qlLIWeYSJrvq0X6Nym/YNW5R7qjERi7CJS 03tS35Qmqafdi3HcSqzFiky6Ko/JGu0P1BjfyA+s= Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id 4193A384B0C0 for ; Thu, 9 Jul 2020 11:47:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4193A384B0C0 Received: by mail-qk1-x743.google.com with SMTP id k18so1429880qke.4 for ; Thu, 09 Jul 2020 04:47:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:autocrypt:subject:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=C+GqigftoFMb5e4nhs+m6rWS7O4BxGtl33wx74230D4=; b=h6bNW0JZeQCTRhVyBredJGCAAJqL3L3Jg+gXrFrHByNULCB1xW76hr1w3SecnSgPCm 577gF0FxQuKeGJ8a0mASet6cSR3522WM/Arr3CDeGXBe4ovgDhMr3zA2YAIkH3AJE1Wg yOKB2rFktkZMGvGAfnwq/60OiwPP7KE/z6qWvDfAx+WULnNuH8uoV9WRvMFxq4hTffuX kAl3osm75aXcSkPMPMUT599Ia4lloGKZuT6L1ZsO89CsxZizuh7xdBBsoyk1Y414BnS5 xt5wvPLJJhqj1P3dLSfV3TYUJuvcvzUP+j8BV+tSz5OulmmgcOlM61LtrL2hD8PVo1of io/w== X-Gm-Message-State: AOAM530+yZKwQvsZqGy8R2xfieTp0vKvOLLYf/Jprklfz9K5hMCuuF2a 2GX5hlpKQTOQkOXKSH5MOBqANgprnWk= X-Google-Smtp-Source: ABdhPJwuxzjTD0N3SuiQzB4pH+8Hvlxl/YS3B7ehrkCEYYpb/popBnmrqS8i7/26JEvoQQkZmaSQiw== X-Received: by 2002:a05:620a:410a:: with SMTP id j10mr62810628qko.410.1594295238512; Thu, 09 Jul 2020 04:47:18 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id 18sm3337389qkh.40.2020.07.09.04.47.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jul 2020 04:47:17 -0700 (PDT) To: libc-alpha@sourceware.org References: <25ef7709e4468a35cc42607cfc0f233d4cec3c25.1591201405.git.alistair.francis@wdc.com> Autocrypt: addr=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bxvUZzIJp3spAao7jLsQj1DbD2s5+S1BW09A0mI/1DjB6EhNN+4bDB SJCOv/ReK3tFJXuj/HbyDrOdoMt8aIFbe7YFLEExHpSk+HgN05Lg5TyTro8oW7TSMTk+8a5M kzaH4UGXTTBDP/g5cfL3RFPl79ubXwARAQABiQIfBBgBCAAJBQJXFRpKAhsMAAoJEKqx7BSn lIjvI/8P/jg0jl4Tbvg3B5kT6PxJOXHYu9OoyaHLcay6Cd+ZrOd1VQQCbOcgLFbf4Yr+rE9l mYsY67AUgq2QKmVVbn9pjvGsEaz8UmfDnz5epUhDxC6yRRvY4hreMXZhPZ1pbMa6A0a/WOSt AgFj5V6Z4dXGTM/lNManr0HjXxbUYv2WfbNt3/07Db9T+GZkpUotC6iknsTA4rJi6u2ls0W9 1UIvW4o01vb4nZRCj4rni0g6eWoQCGoVDk/xFfy7ZliR5B+3Z3EWRJcQskip/QAHjbLa3pml xAZ484fVxgeESOoaeC9TiBIp0NfH8akWOI0HpBCiBD5xaCTvR7ujUWMvhsX2n881r/hNlR9g fcE6q00qHSPAEgGr1bnFv74/1vbKtjeXLCcRKk3Ulw0bY1OoDxWQr86T2fZGJ/HIZuVVBf3+ gaYJF92GXFynHnea14nFFuFgOni0Mi1zDxYH/8yGGBXvo14KWd8JOW0NJPaCDFJkdS5hu0VY 7vJwKcyHJGxsCLU+Et0mryX8qZwqibJIzu7kUJQdQDljbRPDFd/xmGUFCQiQAncSilYOcxNU EMVCXPAQTteqkvA+gNqSaK1NM9tY0eQ4iJpo+aoX8HAcn4sZzt2pfUB9vQMTBJ2d4+m/qO6+ cFTAceXmIoFsN8+gFN3i8Is3u12u8xGudcBPvpoy4OoG Subject: Re: [PATCH v2 07/18] RISC-V: nptl: update default pthread-offsets.h Message-ID: Date: Thu, 9 Jul 2020 08:47:15 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 08/07/2020 21:14, Maciej W. Rozycki via Libc-alpha wrote: > On Wed, 3 Jun 2020, Alistair Francis via Libc-alpha wrote: > >> diff --git a/sysdeps/riscv/nptl/pthread-offsets.h b/sysdeps/riscv/nptl/pthread-offsets.h >> index 31f0587bec..a85c752a1f 100644 >> --- a/sysdeps/riscv/nptl/pthread-offsets.h >> +++ b/sysdeps/riscv/nptl/pthread-offsets.h >> @@ -1,3 +1,12 @@ >> -#define __PTHREAD_MUTEX_KIND_OFFSET 16 >> +#if __WORDSIZE == 64 >> +# define __PTHREAD_MUTEX_KIND_OFFSET 16 >> +#else >> +# define __PTHREAD_MUTEX_KIND_OFFSET 12 >> +#endif > > OK, we have: > > typedef union > { > struct __pthread_mutex_s __data; > char __size[__SIZEOF_PTHREAD_MUTEX_T]; > long int __align; > } pthread_mutex_t; > > and then: > > struct __pthread_mutex_s > { > int __lock __LOCK_ALIGNMENT; > unsigned int __count; > int __owner; > #if __WORDSIZE == 64 > unsigned int __nusers; > #endif > int __kind; > #if __WORDSIZE != 64 > unsigned int __nusers; > #endif > > which means the `__nusers' and `__kind' members are swapped between 64-bit > and 32-bit hosts. Which I find kind of weird (what for?), but the offset > of `__kind' changes accordingly and the values are correct. The default __pthread_mutex_s was modeled from how other architectures has done so we use the common ground as default (and avoid having to create even more arch specific struct_mutex.h). I don't exactly why each port has used this specific layout though. > >> -#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 >> + >> +#if __WORDSIZE == 64 >> +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 >> +#else >> +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 >> +#endif > > Likewise (as from 09/18): > > typedef union > { > struct __pthread_rwlock_arch_t __data; > char __size[__SIZEOF_PTHREAD_RWLOCK_T]; > long int __align; > } pthread_rwlock_t; > > and: > > struct __pthread_rwlock_arch_t > { > unsigned int __readers; > unsigned int __writers; > unsigned int __wrphase_futex; > unsigned int __writers_futex; > unsigned int __pad3; > unsigned int __pad4; > #if __riscv_xlen == 64 > int __cur_writer; > int __shared; > unsigned long int __pad1; > unsigned long int __pad2; > unsigned int __flags; > #else > # if __BYTE_ORDER == __BIG_ENDIAN > unsigned char __pad1; > unsigned char __pad2; > unsigned char __shared; > unsigned char __flags; > # else > unsigned char __flags; > unsigned char __shared; > unsigned char __pad1; > unsigned char __pad2; > # endif > int __cur_writer; > #endif > }; > > so here we have 48 for RV64, 24 for RV32/LE, and 27 for RV/BE, meaning > that your change is wrong. Please fix that. This raises a flags because the wrong __PTHREAD_RWLOCK_FLAGS_OFFSET should generate a build failure at pthread_rwlock_init.c. > > Also I think this change makes no sense at this point or indeed on its > own as there's been no RV32 support added to as at > this commit yet, meaning that the offsets would become inconsistent. > Please fold it into 09/18. > > Maciej >