From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 30443 invoked from network); 16 Apr 2020 02:54:26 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 16 Apr 2020 02:54:26 -0000 Received: (qmail 29962 invoked by uid 550); 16 Apr 2020 02:54:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 29944 invoked from network); 16 Apr 2020 02:54:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=lLNbxLPEmJyAwYNKxo9v4vAHZXAgKtB/PX1Pq9OmgM4=; b=vdlW0vB0Kn8o4q2DLFeiSzGBUwfXEHsFwu4Jw2x5girwUMP6n08lSG53RPj3QQSWx+ XSKQ1dyUnTvg8JpD/mVb1hs+iJaWg3PBphY8lUqfr034Im+lLsbN/4BHnxPRTbjWb1Ez MKyERFneOvtek5HdoKA3kUIDmZIxpsDJZeyMKhePmRmOvM6wYgd6l/F9ho7cCX3zga7C Kl+HIRu35Y6X3+Rt7xS20g7QPs40xfVa3WFg2dni0v4j/upGGFNff0zi7X7kIi2eSIfb GaL+ezOhXbymJ4Zjix1kviSCI6gOArWkjEFww67oZtMpaUR816+aUF1c2RLmSYM6FTvx N6aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=lLNbxLPEmJyAwYNKxo9v4vAHZXAgKtB/PX1Pq9OmgM4=; b=lsTbEivyLsWSpNlkUnJbfrA99A6FPNgvvcjHIbLSwazSRHXMGnA5SzB4ymdXG5F+s0 y7R9rwpaDs8iftLa9S9d8kR0ImLd9W4awthzqo5yR7LTbdxWSxfslhSwAAq8492MFTjb cv2lnIlEcBaZjqgx1lmaKwQ5jv8zgjKgBQ20W89ru13MDWXAJI1/ICGshklizCjc8Ru2 a9hrQSrxBmnemBNPebrAJ0l594qIkexd3paXx8uY9eL649cLLc51kEqrcY4c/a8eyhkQ 7lADQHVjGQhgyL7csTxkufAofAhyULAP/cU6qtITVqqHTCVe75rKbBuxbgnsj8SXs6kM a3qQ== X-Gm-Message-State: AGi0PubP/6WIiyytYcIuuvZQ7mrlyuODYqtSVzyRAAX/ADjJdKcuL8NN 3JN9Quyb4HGzHKU3SvrBOwgzIak8 X-Google-Smtp-Source: APiQypLn1XwWmgK/wlfgK8bb63/Y5yL6+2SRpvjsP4Qbspe9So2Bp7TA/W4Rkd4ki/bhyYn9x+R/bQ== X-Received: by 2002:a17:90b:4d04:: with SMTP id mw4mr2490284pjb.180.1587005650426; Wed, 15 Apr 2020 19:54:10 -0700 (PDT) Date: Thu, 16 Apr 2020 12:53:31 +1000 From: Nicholas Piggin To: Rich Felker Cc: libc-alpha@sourceware.org, libc-dev@lists.llvm.org, linuxppc-dev@lists.ozlabs.org, musl@lists.openwall.com, Segher Boessenkool References: <1586931450.ub4c8cq8dj.astroid@bobo.none> <20200415225539.GL11469@brightrain.aerifal.cx> <1586994952.nnxigedbu2.astroid@bobo.none> <20200416004843.GO11469@brightrain.aerifal.cx> <1587002854.f0slo0111r.astroid@bobo.none> <20200416023542.GP11469@brightrain.aerifal.cx> In-Reply-To: <20200416023542.GP11469@brightrain.aerifal.cx> MIME-Version: 1.0 Message-Id: <1587004907.ioxh0bxsln.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] Powerpc Linux 'scv' system call ABI proposal take 2 Excerpts from Rich Felker's message of April 16, 2020 12:35 pm: > On Thu, Apr 16, 2020 at 12:24:16PM +1000, Nicholas Piggin wrote: >> >> > Likewise, it's not useful to have different error return mechanisms >> >> > because the caller just has to branch to support both (or the >> >> > kernel-provided stub just has to emulate one for it; that could wor= k >> >> > if you really want to change the bad existing convention). >> >> >=20 >> >> > Thoughts? >> >>=20 >> >> The existing convention has to change somewhat because of the clobber= s, >> >> so I thought we could change the error return at the same time. I'm >> >> open to not changing it and using CR0[SO], but others liked the idea. >> >> Pro: it matches sc and vsyscall. Con: it's different from other commo= n >> >> archs. Performnce-wise it would really be a wash -- cost of condition= al >> >> branch is not the cmp but the mispredict. >> >=20 >> > If you do the branch on hwcap at each syscall, then you significantly >> > increase code size of every syscall point, likely turning a bunch of >> > trivial functions that didn't need stack frames into ones that do. You >> > also potentially make them need a TOC pointer. Making them all just do >> > an indirect call unconditionally (with pointer in TLS like i386?) is a >> > lot more efficient in code size and at least as good for performance. >>=20 >> I disagree. Doing the long vdso indirect call *necessarily* requires >> touching a new icache line, and even a new TLB entry. Indirect branches >=20 > The increase in number of icache lines from the branch at every > syscall point is far greater than the use of a single extra icache > line shared by all syscalls. That's true, I was thinking of a single function that does the test and=20 calls syscalls, which might be the fair comparison. > Not to mention the dcache line to access > __hwcap or whatever, and the icache lines to setup access TOC-relative > access to it. (Of course you could put a copy of its value in TLS at a > fixed offset, which would somewhat mitigate both.) >=20 >> And finally, the HWCAP test can eventually go away in future. A vdso >> call can not. >=20 > We support nearly arbitrarily old kernels (with limited functionality) > and hardware (with full functionality) and don't intend for that to > change, ever. But indeed glibc might want too eventually drop the > check. Ah, cool. Any build-time flexibility there? We may or may not be getting a new ABI that will use instructions not=20 supported by old processors. https://sourceware.org/legacy-ml/binutils/2019-05/msg00331.html Current ABI continues to work of course and be the default for some=20 time, but building for new one would give some opportunity to drop such support for old procs, at least for glibc. >=20 >> If you really want to select with an indirect branch rather than >> direct conditional, you can do that all within the library. >=20 > OK. It's a little bit more work if that's not the interface the kernel > will give us, but it's no big deal. Okay. Thanks, Nick