From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B76AC433F5 for ; Tue, 19 Oct 2021 11:31:13 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 59A2F61359 for ; Tue, 19 Oct 2021 11:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 59A2F61359 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zDlfbd3/O0Ntfxdh8aEVYY+tPvjjo32fc1EoXWJFNS0=; b=X4QGc8oNMdHU+W /TJvwZca78feNKcYQSRmMsMGqYzndghQGgrhDgzngoGQU4NDUbOb1brz3xofYEaQ8UGSO73kRxqBg 2hLVQUOERti2frWjJAgiW7xmdZxLRXq/kxBR246bYMhGLX2X3QBtMtNnF1Wzruf215jqlmODj9ycD rC+AOe0WtBvh+o12j+bOq3Jq1o640vRLkGTsbx4cPrt4AJZxyYBQpExwJb2S6FVmtGfYi3zohL5AP 7DlvYNWHG3XymM5WeABLRD56PoD6UPAmrFZopnS0ZS04OpKoTvJ7L1OjV7Toopfwo+MpxjTGnnfTi 0GAYSoOLx2llOOLT8PUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcnJk-000yPN-Ve; Tue, 19 Oct 2021 11:30:05 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcnJh-000yOO-Na for linux-arm-kernel@lists.infradead.org; Tue, 19 Oct 2021 11:30:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A32CC61359; Tue, 19 Oct 2021 11:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634643001; bh=EiG0pNigb4IjYftsI5uCXOy2VNLGal7vqyHwJ20XxRY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H47EP9ZkrcmsO8wPcHA2UDey3Qtstz2E0CmfozZL8UnI9mjSLoj7uMCAMM+6g7ycY YQE2lizzt/PQKU8ufujaTmDdiXk6kn1p/AjWGPAFpRAd/4dCMicD9BfaISCz1R/pHO KOwaNyJre/ar7PS5cX65+wXN8t161H05rRh8IehaACTtrqP75fTu/Wrctj/8qbabdx 7I+ZiiXq/VMTnJZD8dwcs0fDxAqHQYLlmYNdS+FchySG3SRhNqBtPB32pgL8mlWm9F gNNu3vs/nFqPqtKShvquZPYrl+egBGhlFdc6+Uzfg61k1/FdPPwL1GWOgN3QDv1VgL gB0a4YOk2YI3g== Date: Tue, 19 Oct 2021 12:29:55 +0100 From: Will Deacon To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, alexandru.elisei@arm.com, andrii@kernel.org, ardb@kernel.org, ast@kernel.org, broonie@kernel.org, catalin.marinas@arm.com, daniel@iogearbox.net, dvyukov@google.com, james.morse@arm.com, jean-philippe@linaro.org, jpoimboe@redhat.com, maz@kernel.org, peterz@infradead.org, robin.murphy@arm.com, suzuki.poulose@arm.com Subject: Re: [PATCH 10/13] arm64: extable: add `type` and `data` fields Message-ID: <20211019112954.GG13251@willie-the-truck> References: <20211013110059.10324-1-mark.rutland@arm.com> <20211013110059.10324-11-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211013110059.10324-11-mark.rutland@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211019_043001_839448_658A7605 X-CRM114-Status: GOOD ( 27.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 13, 2021 at 12:00:56PM +0100, Mark Rutland wrote: > Subsequent patches will add specialized handlers for fixups, in addition > to the simple PC fixup and BPF handlers we have today. In preparation, > this patch adds a new `type` field to struct exception_table_entry, and > uses this to distinguish the fixup and BPF cases. A `data` field is also > added so that subsequent patches can associate data specific to each > exception site (e.g. register numbers). > > Handlers are named ex_handler_*() for consistency, following the exmaple > of x86. At the same time, get_ex_fixup() is split out into a helper so > that it can be used by other ex_handler_*() functions ins subsequent > patches. > > This patch will increase the size of the exception tables, which will be > remedied by subsequent patches removing redundant fixup code. There > should be no functional change as a result of this patch. > > Signed-off-by: Mark Rutland > Cc: Alexei Starovoitov > Cc: Andrii Nakryiko > Cc: Ard Biesheuvel > Cc: Catalin Marinas > Cc: Daniel Borkmann > Cc: James Morse > Cc: Jean-Philippe Brucker > Cc: Robin Murphy > Cc: Will Deacon > --- > arch/arm64/include/asm/asm-extable.h | 32 ++++++++++++++++++++------------ > arch/arm64/include/asm/extable.h | 19 +++++++++++++++---- > arch/arm64/mm/extable.c | 29 +++++++++++++++++++++++++---- > arch/arm64/net/bpf_jit_comp.c | 7 +++++-- > scripts/sorttable.c | 30 ++++++++++++++++++++++++++++++ > 5 files changed, 95 insertions(+), 22 deletions(-) > > diff --git a/arch/arm64/include/asm/asm-extable.h b/arch/arm64/include/asm/asm-extable.h > index 986b4c0d4792..5ee748edaef1 100644 > --- a/arch/arm64/include/asm/asm-extable.h > +++ b/arch/arm64/include/asm/asm-extable.h > @@ -2,13 +2,19 @@ > #ifndef __ASM_ASM_EXTABLE_H > #define __ASM_ASM_EXTABLE_H > > +#define EX_TYPE_NONE 0 > +#define EX_TYPE_FIXUP 1 > +#define EX_TYPE_BPF 2 > + > #ifdef __ASSEMBLY__ > > -#define __ASM_EXTABLE_RAW(insn, fixup) \ > - .pushsection __ex_table, "a"; \ > - .align 3; \ > - .long ((insn) - .); \ > - .long ((fixup) - .); \ > +#define __ASM_EXTABLE_RAW(insn, fixup, type, data) \ > + .pushsection __ex_table, "a"; \ > + .align 2; \ > + .long ((insn) - .); \ > + .long ((fixup) - .); \ > + .short (type); \ > + .short (data); \ Why are you reducing the alignment here? > diff --git a/scripts/sorttable.c b/scripts/sorttable.c > index 6ee4fa882919..ee95bb47a50d 100644 > --- a/scripts/sorttable.c > +++ b/scripts/sorttable.c > @@ -231,6 +231,34 @@ static void sort_relative_table(char *extab_image, int image_size) > } > } > > +static void arm64_sort_relative_table(char *extab_image, int image_size) > +{ > + int i = 0; > + > + while (i < image_size) { > + uint32_t *loc = (uint32_t *)(extab_image + i); > + > + w(r(loc) + i, loc); > + w(r(loc + 1) + i + 4, loc + 1); > + /* Don't touch the fixup type or data */ > + > + i += sizeof(uint32_t) * 3; > + } > + > + qsort(extab_image, image_size / 12, 12, compare_relative_table); > + > + i = 0; > + while (i < image_size) { > + uint32_t *loc = (uint32_t *)(extab_image + i); > + > + w(r(loc) - i, loc); > + w(r(loc + 1) - (i + 4), loc + 1); > + /* Don't touch the fixup type or data */ > + > + i += sizeof(uint32_t) * 3; > + } > +} This is very nearly a direct copy of x86_sort_relative_table() (magic numbers and all). It would be nice to tidy that up, but I couldn't immediately see a good way to do it :( Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel