From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 238B93858D20 for ; Tue, 11 Apr 2023 13:54:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 238B93858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x335.google.com with SMTP id cg19-20020a056830631300b0069f922cd5ceso3850075otb.12 for ; Tue, 11 Apr 2023 06:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681221294; x=1683813294; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=W5EB/7CBwzpUz5UWKkQ/OG81sM+1LzxMzfCoeetltRM=; b=g80jFDFmuBSgAgB9LgWSDqsNQeSxomW7ZJPRKveAd6QqDd2OktHn2bldJIvfP/zbpk 4tbCzRb25ASlDqHLc3HniAIIXscMRmh4urKNJOSQ1PMI4Wx+EEYxn1g3uUX33zwKfAKa Q7Ois/TrYHms6K8GA4MQrp9cpBDPOh4k7lBgaxAl0svadmMGLTCu/YGMeDM+u7x8cAxF MAUqmyMqoF5ykfevsQD30/Zo+d9aiyBU1OwBXXXR6s6qvL6mqolZwHN5ODD+iTWNmeAn pd0dEP8azCuNuoSczcEX0hAx43IUP6EuGooIC3U1ZDbv74BgIvWSDxYECn3txOdd4phq dM6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681221294; x=1683813294; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W5EB/7CBwzpUz5UWKkQ/OG81sM+1LzxMzfCoeetltRM=; b=Eqff1U3Rw6Z/sVoT4JvG8I/k4Hlc8tX+kzGPrAcFkaMDMIy3guNnXnMVkESF6vWz1C c4MolhlkRTEzr9LZAdn5IR748C9H4OPVIqgB/p1WpPTK1RMpJ+aaXKyKew6TtT2/gUV7 ye8brlnhwdMSTiK/RXMVj8khvJwZNPBGly/uVZaiIwVcK47Za//VR8LmggxIstMqc0gh FcdCA16tQayQllYss092RV0ebcyDSkbvVX2oaIO7b1hYyNC3Pbfvjob7QHBAu6vxH3dn 1CLKUfDlF2tNbOfTNHpcmyzoHimSpkfs7w/BcNjWGZ8bXRL14DdsiN8lV/cehKW47IDt hfFg== X-Gm-Message-State: AAQBX9ccNRWm3ug2J3HgVBLvj/kS25iDVes94/5r6G36L3CYOnoBETqt +yWQikUIS2KtH8STi6L6cT2d+4myk/myPTvD2SIm9A== X-Google-Smtp-Source: AKy350Y1v1KPDwRyM1iQtfN8NytrI75SVG/pG0sVK/Wqem/MhjN7mulybn0TvNa5vjY+H2XkYzapUw== X-Received: by 2002:a9d:6743:0:b0:6a3:e348:61df with SMTP id w3-20020a9d6743000000b006a3e34861dfmr1370581otm.5.1681221294406; Tue, 11 Apr 2023 06:54:54 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:55a1:1474:97d8:bf65:d9d0? ([2804:1b3:a7c2:55a1:1474:97d8:bf65:d9d0]) by smtp.gmail.com with ESMTPSA id k22-20020a056830151600b0068bd922a244sm5459383otp.20.2023.04.11.06.54.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Apr 2023 06:54:53 -0700 (PDT) Message-ID: Date: Tue, 11 Apr 2023 10:54:51 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v5 22/22] loongarch: Fix Race conditions in pthread cancellation [BZ#12683] Content-Language: en-US To: Xi Ruoyao , caiyinyu , libc-alpha@sourceware.org References: <20230410195907.4123869-1-adhemerval.zanella@linaro.org> <20230410204614.4129551-1-adhemerval.zanella@linaro.org> <20230410204614.4129551-14-adhemerval.zanella@linaro.org> <2618ef1ef31911d4d9ab8e4945878595f2df2a07.camel@xry111.site> <85036382-d75c-87ce-5a5c-f016d976d0cd@loongson.cn> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,BODY_8BITS,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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/04/23 09:55, Xi Ruoyao wrote: > On Tue, 2023-04-11 at 20:00 +0800, caiyinyu wrote: >> >> 在 2023/4/11 下午2:19, Xi Ruoyao 写道: >>> On Mon, 2023-04-10 at 17:46 -0300, Adhemerval Zanella via Libc-alpha >>> wrote: >>> >>> /* snip */ >>> >>>> +1: >>>> +       addi.d  $r3,$r3,-16 >>>> +       cfi_def_cfa_offset (16) >>>> +       st.d    $r1,$r3,8 >>>> +       cfi_offset (1, -8) >>>> +       bl      __syscall_do_cancel >>> Can we simply use "b __syscall_do_cancel" for 1: like AArch64? >> >> In LoongArch, the "b" instruction is equivalent to the "b" instruction >> in AArch64, and similarly, >> >> the "bl" instruction in LoongArch is equivalent to the "bl" >> instruction >> in AArch64. >> >>>> + >>>> +END (__syscall_cancel_arch) > > I've rewritten the syscall_cancel.S file as follow to exploit the tail > call and improve readability. It passed nptl/tst-cancel31: > > #include > #include > > ENTRY (__syscall_cancel_arch) > > .global __syscall_cancel_arch_start > __syscall_cancel_arch_start: > > /* if (*cancelhandling & CANCELED_BITMASK) > __syscall_do_cancel() */ > ld.w t0, a0, 0 > andi t0, t0, TCB_CANCELED_BITMASK > bnez t0, 1f > > /* Issue a 6 argument syscall. */ > move t1, a1 > move a0, a2 > move a1, a3 > move a2, a4 > move a3, a5 > move a4, a6 > move a5, a7 > move a7, t1 > syscall 0 > > .global __syscall_cancel_arch_end > __syscall_cancel_arch_end: > jr ra > 1: > b __syscall_do_cancel > > END (__syscall_cancel_arch) > Thanks, I have merged it locally. I will update my sourceware branch with this change.