From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by sourceware.org (Postfix) with ESMTPS id 5DBF6385DC1B for ; Thu, 16 Apr 2020 02:54:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5DBF6385DC1B Received: by mail-pj1-x1041.google.com with SMTP id a32so718047pje.5 for ; Wed, 15 Apr 2020 19:54:11 -0700 (PDT) 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=iHXjuyBGqDgF1gU2uaXl4i2dlQr54JscY5KiaccGSSWujn7fV5DpQHcRk/8QY0lcMX 9d9LFLqakQm5eiI9gHF3iHxf8lWk76nJJbVCZIEvlxxZ0aaRnx3RvIHdao7Nx+nN5fIM rvtjzV7bT+ZCsX2XZ0c3QxbrkIhVKZtFxStyQCFohNDko9je9ssK7QrH39GWYt3d671N xlH8zZywj81jNLmHvtWqO5e7hmslnyHgAryI3YhVT6Xzoy5OSiJLYTTvYNnjsBRJf7X7 d5L+P68lBF5oiDNuMRlgJhKP4tBiluqDNddWopvQIPjK26WNSCz7imjl/uU2VUNFifG3 bF5Q== X-Gm-Message-State: AGi0PuYhomxLeBBjQaJTEIyVNAvN9GbS4VviVTHYzqZV7nR3VxD4HJZ/ iuFsXgxwN0fXy+O5/xsm1j8= 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) Received: from localhost ([203.18.28.220]) by smtp.gmail.com with ESMTPSA id x76sm14937361pfc.190.2020.04.15.19.54.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 19:54:09 -0700 (PDT) Date: Thu, 16 Apr 2020 12:53:31 +1000 From: Nicholas Piggin Subject: Re: [musl] Powerpc Linux 'scv' system call ABI proposal take 2 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 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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, 16 Apr 2020 02:54:13 -0000 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