From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>
Cc: <linux-mips@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <dborkman@redhat.com>,
Alexei Starovoitov <ast@plumgrid.com>, <netdev@vger.kernel.org>
Subject: Re: [PATCH 16/17] MIPS: bpf: Use 32 or 64-bit load instruction to load an address to register
Date: Wed, 25 Jun 2014 09:18:48 +0100 [thread overview]
Message-ID: <53AA85E8.5090403@imgtec.com> (raw)
In-Reply-To: <20140623202437.GD2200@pburton-laptop>
On 06/23/2014 09:24 PM, Paul Burton wrote:
> On Mon, Jun 23, 2014 at 10:38:59AM +0100, Markos Chandras wrote:
>> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
>> index 4920e0fd05ee..d8dba7b523a5 100644
>> --- a/arch/mips/net/bpf_jit.c
>> +++ b/arch/mips/net/bpf_jit.c
>> @@ -447,6 +447,17 @@ static inline void emit_wsbh(unsigned int dst, unsigned int src,
>> emit_instr(ctx, wsbh, dst, src);
>> }
>>
>> +/* load address to register */
>> +static inline void emit_load_addr(unsigned int dst, unsigned int src,
>> + int imm, struct jit_ctx *ctx)
>
> (I originally sent this in reply to your internal posting, but assume you
> missed it or it got eaten somewhere along the way.)
>
> The name emit_load_addr & comment "load address to register" makes this
> sound like an equivalent of the "la" pseudo instruction, but it appears
> to really emit a pointer sized load? How about emit_load_ptr or something
> instead, and similarly s/address/pointer/ in the comment?
>
Hi Paul,
I suppose I could do that. I will send a v2
>> +{
>> + /* src contains the base addr of the 32/64-pointer */
>> + if (config_enabled(CONFIG_64BIT))
>> + emit_instr(ctx, ld, dst, imm, src);
>> + else
>> + emit_instr(ctx, lw, dst, imm, src);
>
> Is there some way you could make use of the UASM_i_LW macro (note the
> capitalisation) instead of the if statement here?
>
Not right now. I use config_enabled(CONFIG_64BIT) everywhere in that
file to emit 32-bit or 64-bit instructions. So I will look into
switching to the USAM_i_* macros when i submit the remaining fixes
probably for 3.17.
--
markos
WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org,
"David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <dborkman@redhat.com>,
Alexei Starovoitov <ast@plumgrid.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 16/17] MIPS: bpf: Use 32 or 64-bit load instruction to load an address to register
Date: Wed, 25 Jun 2014 09:18:48 +0100 [thread overview]
Message-ID: <53AA85E8.5090403@imgtec.com> (raw)
Message-ID: <20140625081848.rQ71x8kU7hrqg8rZ-owSqrlXQ2G7AijUcu7ygCyVfew@z> (raw)
In-Reply-To: <20140623202437.GD2200@pburton-laptop>
On 06/23/2014 09:24 PM, Paul Burton wrote:
> On Mon, Jun 23, 2014 at 10:38:59AM +0100, Markos Chandras wrote:
>> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
>> index 4920e0fd05ee..d8dba7b523a5 100644
>> --- a/arch/mips/net/bpf_jit.c
>> +++ b/arch/mips/net/bpf_jit.c
>> @@ -447,6 +447,17 @@ static inline void emit_wsbh(unsigned int dst, unsigned int src,
>> emit_instr(ctx, wsbh, dst, src);
>> }
>>
>> +/* load address to register */
>> +static inline void emit_load_addr(unsigned int dst, unsigned int src,
>> + int imm, struct jit_ctx *ctx)
>
> (I originally sent this in reply to your internal posting, but assume you
> missed it or it got eaten somewhere along the way.)
>
> The name emit_load_addr & comment "load address to register" makes this
> sound like an equivalent of the "la" pseudo instruction, but it appears
> to really emit a pointer sized load? How about emit_load_ptr or something
> instead, and similarly s/address/pointer/ in the comment?
>
Hi Paul,
I suppose I could do that. I will send a v2
>> +{
>> + /* src contains the base addr of the 32/64-pointer */
>> + if (config_enabled(CONFIG_64BIT))
>> + emit_instr(ctx, ld, dst, imm, src);
>> + else
>> + emit_instr(ctx, lw, dst, imm, src);
>
> Is there some way you could make use of the UASM_i_LW macro (note the
> capitalisation) instead of the if statement here?
>
Not right now. I use config_enabled(CONFIG_64BIT) everywhere in that
file to emit 32-bit or 64-bit instructions. So I will look into
switching to the USAM_i_* macros when i submit the remaining fixes
probably for 3.17.
--
markos
next prev parent reply other threads:[~2014-06-25 8:18 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 9:38 [PATCH 00/17] Misc MIPS/BPF fixes for 3.16 Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 01/17] MIPS: uasm: Add s3s1s2 instruction builder Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 02/17] MIPS: uasm: Add slt uasm instruction Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 03/17] MIPS: mm: uasm: Fix lh micro-assembler instruction Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 04/17] MIPS: bpf: Use the LO register to get division's quotient Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 05/17] MIPS: bpf: Return error code if the offset is a negative number Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 22:09 ` Alexei Starovoitov
2014-06-25 8:12 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 06/17] MIPS: bpf: Use 'andi' instead of 'and' for the VLAN cases Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 07/17] MIPS: bpf: Add SEEN_SKB to flags when looking for the PKT_TYPE Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 08/17] MIPS: bpf: Fix branch conditional for BPF_J{GT/GE} cases Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 09/17] MIPS: bpf: Use correct mask for VLAN_TAG case Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 10/17] MIPS: bpf: Fix return values for VLAN_TAG_PRESENT case Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 11/17] MIPS: bpf: Use pr_debug instead of pr_warn for unhandled opcodes Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 12/17] MIPS: bpf: Fix is_range() semantics Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 13/17] MIPS: bpf: Drop update_on_xread and always initialize the X register Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 14/17] MIPS: bpf: Prevent kernel fall over for >=32bit shifts Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:44 ` David Laight
2014-06-23 11:06 ` Markos Chandras
2014-06-23 11:08 ` David Laight
2014-06-23 11:39 ` Markos Chandras
2014-06-25 8:37 ` [PATCH v2 " Markos Chandras
2014-06-25 8:37 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 15/17] MIPS: bpf: Fix PKT_TYPE case for big-endian cores Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 9:38 ` [PATCH 16/17] MIPS: bpf: Use 32 or 64-bit load instruction to load an address to register Markos Chandras
2014-06-23 9:38 ` Markos Chandras
2014-06-23 20:24 ` Paul Burton
2014-06-23 20:24 ` Paul Burton
2014-06-25 8:18 ` Markos Chandras [this message]
2014-06-25 8:18 ` Markos Chandras
2014-06-25 8:39 ` [PATCH v2 " Markos Chandras
2014-06-25 8:39 ` Markos Chandras
2014-06-25 14:28 ` Alexei Starovoitov
2014-06-23 9:39 ` [PATCH 17/17] MIPS: bpf: Fix stack space allocation for BPF memwords on MIPS64 Markos Chandras
2014-06-23 9:39 ` Markos Chandras
2014-06-23 19:49 ` [PATCH 00/17] Misc MIPS/BPF fixes for 3.16 David Miller
2014-06-25 8:12 ` Markos Chandras
2014-06-25 8:12 ` Markos Chandras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53AA85E8.5090403@imgtec.com \
--to=markos.chandras@imgtec.com \
--cc=ast@plumgrid.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=linux-mips@linux-mips.org \
--cc=netdev@vger.kernel.org \
--cc=paul.burton@imgtec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox