Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1618825pxb; Fri, 22 Jan 2021 23:37:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/AeDB8j/f4aYJCfWKkJkbrbuO5IXtTa/zV6yLuwl5yfN+FMGNImh1xlyk4OVgTcco2Fcc X-Received: by 2002:aa7:cb8f:: with SMTP id r15mr172046edt.130.1611387441723; Fri, 22 Jan 2021 23:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611387441; cv=none; d=google.com; s=arc-20160816; b=eNsyt9KcqMNqsjH3ZR7xgBv7slHKGfblkVhDqMYNlnm5xuxfgVNyVpxX2f6nw5Bby2 g+ItI9zt8RQzhr2WahSX40BpjOTxHFcRwfIUG7bTY7MgyexRCFfL5OuxzhZpwaRQbgX6 oTTTchGkZGhum8cB6aciiYxfAL9nrd4juJnmYj3kBzkirtZldhNliKpjs1NuhAfshm4c f6bSq6a4FSgAvN3eVFd980NTcXX286VKGrtUkWXyBeDClZWI7Efi2h7Q7SJ+GwN/u6Al 1XnenDW7A51MMFFgVzeRuCb2GaOEXwKb3UxHVTq0gFcEumxUW1iJ+Q0w1fqfHt1JgkWS xO5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=2RBXd1IakVK8y25mwMepJOQZDSNwIuUyUokSFaF6KRA=; b=wAbqt0zB4VCwHV4whpxbXX3HbO6f+ms0s3nPyxaDgbf4/98TSOjgxTTyWbcQJlNN+x I+EIi0vtz8yfEuD/+/HXBpQfK2/OcogUrnsm2tuZ/9mVNAtlnfJgErlD6l6HiLQFP6Wy BhZK8qLEev79MmMB+gFKW643GR76R1UJ5EIuvicGRefwWWzTi5EhweAdWY0chOk80T+N uF60GSaYFQo3/PzCRogsb6i+f8ie5034eqAMsFrXoca5i35k2UU/h2c3kv+UP+JtxjJ4 Lk7jBV8lZt9Yw0aa0ShOJaa3U4Rit9VOUYVZFw4uKmFQXbNzCccC0jVCJBit7E/CnYKK Z48A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yh27si3850410ejb.290.2021.01.22.23.36.58; Fri, 22 Jan 2021 23:37:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbhAWHea (ORCPT + 99 others); Sat, 23 Jan 2021 02:34:30 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:55978 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbhAWHeS (ORCPT ); Sat, 23 Jan 2021 02:34:18 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=guoren@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0UMaaSVg_1611387208; Received: from IT-C02Z45M7LVCF.local(mailfrom:guoren@linux.alibaba.com fp:SMTPD_---0UMaaSVg_1611387208) by smtp.aliyun-inc.com(127.0.0.1); Sat, 23 Jan 2021 15:33:28 +0800 Subject: Re: [PATCH] RISC-V: probes: Treat the instruction stream as host-endian To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: Paul Walmsley , aou@eecs.berkeley.edu, penberg@kernel.org, me@packi.ch, mhiramat@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Palmer Dabbelt , kernel test robot References: <20210123033429.2072716-1-palmer@dabbelt.com> From: Guo Ren Message-ID: Date: Sat, 23 Jan 2021 15:33:28 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210123033429.2072716-1-palmer@dabbelt.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by: Guo Ren On 2021/1/23 上午11:34, Palmer Dabbelt wrote: > From: Palmer Dabbelt > > Neither of these are actually correct: the instruction stream is defined > (for versions of the ISA manual newer than 2.2) as a stream of 16-bit > little-endian parcels, which is different than just being little-endian. > In theory we should represent this as a type, but we don't have any > concrete plans for the big endian stuff so it doesn't seem worth the > time -- we've got variants of this all over the place. > > Instead I'm just dropping the unnecessary type conversion, which is a > NOP on LE systems but causes an sparse error as the types are all mixed > up. > > Reported-by: kernel test robot > Signed-off-by: Palmer Dabbelt > --- > arch/riscv/kernel/probes/decode-insn.c | 2 +- > arch/riscv/kernel/probes/kprobes.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/riscv/kernel/probes/decode-insn.c b/arch/riscv/kernel/probes/decode-insn.c > index 0876c304ca77..0ed043acc882 100644 > --- a/arch/riscv/kernel/probes/decode-insn.c > +++ b/arch/riscv/kernel/probes/decode-insn.c > @@ -16,7 +16,7 @@ > enum probe_insn __kprobes > riscv_probe_decode_insn(probe_opcode_t *addr, struct arch_probe_insn *api) > { > - probe_opcode_t insn = le32_to_cpu(*addr); > + probe_opcode_t insn = *addr; > > /* > * Reject instructions list: > diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c > index e60893bd87db..a2ec18662fee 100644 > --- a/arch/riscv/kernel/probes/kprobes.c > +++ b/arch/riscv/kernel/probes/kprobes.c > @@ -57,7 +57,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) > } > > /* copy instruction */ > - p->opcode = le32_to_cpu(*p->addr); > + p->opcode = *p->addr; > > /* decode instruction */ > switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) {