From: Yunfeng Ye <yeyunfeng@huawei.com>
To: Will Deacon <will@kernel.org>
Cc: <catalin.marinas@arm.com>, <will.deacon@arm.com>,
<kstewart@linuxfoundation.org>, <gregkh@linuxfoundation.org>,
<tglx@linutronix.de>, <info@metux.net>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] arm64: armv8_deprecated: Checking return value for memory allocation
Date: Tue, 8 Oct 2019 19:01:23 +0800 [thread overview]
Message-ID: <7b70fec7-e232-0d09-fd51-1fdd205823b8@huawei.com> (raw)
In-Reply-To: <20191008102511.pmkqcpf7spkogarp@willie-the-truck>
On 2019/10/8 18:25, Will Deacon wrote:
> On Tue, Oct 08, 2019 at 10:33:17AM +0800, Yunfeng Ye wrote:
>> On 2019/10/7 23:37, Will Deacon wrote:
>>> On Mon, Oct 07, 2019 at 06:06:35PM +0800, Yunfeng Ye wrote:
>>>> @@ -617,25 +624,47 @@ static int t16_setend_handler(struct pt_regs *regs, u32 instr)
>>>> */
>>>> static int __init armv8_deprecated_init(void)
>>>> {
>>>> - if (IS_ENABLED(CONFIG_SWP_EMULATION))
>>>> - register_insn_emulation(&swp_ops);
>>>> + int ret = 0;
>>>> + int err = 0;
>>>> +
>>>> + if (IS_ENABLED(CONFIG_SWP_EMULATION)) {
>>>> + ret = register_insn_emulation(&swp_ops);
>>>> + if (ret) {
>>>> + pr_err("register insn emulation swp: fail\n");
>>>> + err = ret;
>>>> + }
>>>> + }
>>>
>>> Is there much point in continuing here? May as well just return ret, I
>>> think. I also don't think you need to print anything, since kmalloc
>>> should already have shouted.
>>>
>> The registration of each instruction simulation is independent. I think
>> that one failure does not affect the registration of other instructions.
>
> Dunno, I think that if kmalloc() starts failing then it's time to give up!
>
>> In addition, if return directly, is it need to unregister? Of course,
>> the first instruction registration can be directly returned, If the
>> following instruction registration fails, is it need unregister operation?
>> currently the unregistration of instruction simulation is not be implemented
>> yet.
>
> That's an interesting one -- currently there isn't a way to unregister
> an emulation hook afaict. We could add unregister_insn_emulation() to
> remove the emulation hook from the insn_emulation list and free it, but
> I'm actually now starting to prefer your initial patch after all. The only
> way these failures will happen are either because the system is doomed
> or kmalloc fault injection is being used; so keeping things simple rather
> than add rarely executed complexity is probably best.
>
>> The purpose of printing information is to replace the direct return, which
>> can distinguish which instruction failed to register. There is no need to print
>> information if it returns directly.
>
> What do you expect people to do with that information?
>
> Are you ok with me applying your original patch?
>
I agree, it is simple. thanks.
> Will
>
> .
>
prev parent reply other threads:[~2019-10-08 11:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 10:06 Yunfeng Ye
2019-10-07 15:37 ` Will Deacon
2019-10-08 2:33 ` Yunfeng Ye
2019-10-08 10:25 ` Will Deacon
2019-10-08 11:01 ` Yunfeng Ye [this message]
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=7b70fec7-e232-0d09-fd51-1fdd205823b8@huawei.com \
--to=yeyunfeng@huawei.com \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=info@metux.net \
--cc=kstewart@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®