From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 1DC2B3857810 for ; Thu, 19 Nov 2020 20:29:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1DC2B3857810 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AJK23Wx174314; Thu, 19 Nov 2020 15:29:23 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 34wy6sgxk8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Nov 2020 15:29:23 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0AJKLWup002911; Thu, 19 Nov 2020 20:29:22 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma03dal.us.ibm.com with ESMTP id 34w2636361-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Nov 2020 20:29:22 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0AJKTM8k12124856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Nov 2020 20:29:22 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 11AB8AC05F; Thu, 19 Nov 2020 20:29:22 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27E04AC059; Thu, 19 Nov 2020 20:29:21 +0000 (GMT) Received: from [9.160.24.122] (unknown [9.160.24.122]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 19 Nov 2020 20:29:20 +0000 (GMT) Subject: Re: [PATCH 3/4] powerpc: Runtime selection between sc and scv for syscalls To: Florian Weimer , Matheus Castanho via Libc-alpha Cc: tuliom@linux.ibm.com References: <20201118144703.75569-1-msc@linux.ibm.com> <20201118144703.75569-4-msc@linux.ibm.com> <87pn4avgor.fsf@mid.deneb.enyo.de> From: Matheus Castanho Message-ID: <6547146f-7f09-9c11-3bd4-256f44b207f5@linux.ibm.com> Date: Thu, 19 Nov 2020 17:29:19 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <87pn4avgor.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-19_10:2020-11-19, 2020-11-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxlogscore=929 clxscore=1011 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011190134 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: 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: , X-List-Received-Date: Thu, 19 Nov 2020 20:29:28 -0000 On 11/18/20 12:16 PM, Florian Weimer wrote: > * Matheus Castanho via Libc-alpha: > >> +/* Check PPC_FEATURE2_SCV bit from hwcap2 in the TCB and update CR0 >> + * accordingly. First, we check if the thread pointer != 0, so we don't try to >> + * access the TCB before it has been initialized, e.g. inside the dynamic >> + * loader. If it is already initialized, check if scv is available. On both >> + * negative cases, go to JUMPFALSE (label given by the macro's caller). We >> + * save the value we read from the TCB in a non-volatile register so we can >> + * reuse it later when exiting from the syscall in PSEUDO_RET. */ > > This comment style is not GNU (sorry). Oops, fixed. > > I think you can avoid the conditional check and replace it with #if > IS_IN (rtld). Then ld.so will use the old interface unconditionally, > but that should be okay. > That should work for shared libc, but in the static case we may also hit the same problem: trying to access the TLS to read hwcap2 before it has been initialized, but this time in csu/libc-tls.c Is there a way to also check if we are in the static startup code at compile time? If not, I'm afraid I'll have to keep the check for the thread pointer. Thanks, Matheus Castanho