From: "Bryan O'Donoghue" <pure.logic@nexus-software.ie>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
"dvhart@infradead.org" <dvhart@infradead.org>,
"Ong, Boon Leong" <boon.leong.ong@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Fwd: [PATCH v7 1/2] x86: Add Isolated Memory Regions for Quark X1000
Date: Fri, 30 Jan 2015 12:57:29 +0000 [thread overview]
Message-ID: <54CB7FB9.3010806@nexus-software.ie> (raw)
In-Reply-To: <54CB7F5F.2070308@nexus-software.ie>
On 30/01/15 12:55, Bryan O'Donoghue wrote:
> Oops.
>
> Hit reply not reply-all
On 30/01/15 12:03, Andy Shevchenko wrote:
>> + return -ENOMEM;
>
> When CONFIG_DEBUGFS=n, you will get error pointer here, which is not
NULL.
>
> So, the proper check is
> if (IS_ERR())
> return PTR_ERR();
> if (!file)
> return -ENOMEM;
Yeah I saw that. Also saw that most other code doesn't bother trapping
those return values - so skipped it.
No issue adding.
>
>> + } else {
>> + reg = i;
>
> Do we go always through all IMRs and choose the last one?
> If no, break is missed here.
Yep - we always choose the last one.
>> + }
>> + }
>> +
>> + /* Error out if we have no free IMR entries. */
>> + if (reg == -1) {
>> + ret = -ENODEV;
>
> -ENOMEM ? Like you said there is no *free* IMR.
OK
>> + * imr_remove_range(0, size, base); delete IMR at index 0 base/size
ignored.
>> + * imr_remove_range(-1, base, size); delete IMR from base to base+size.
>
> (size, base) or (base, size) ?
base, size that's a documentation typo :)
>> +
>> + ret = imr_check_params(base, size);
>> + if (ret == -EINVAL || (ret == -ENOMEM && reg == -1))
>
> reg base size (0 correct, 1 wrong):
>
> 0 0 0 — which should be used? what is the priority?
> 0 x 1 — index
> 0 1 x — index
> 1 0 0 — address
> 1 0 1 — an error
> 1 1 1 — an error
>
> Thus, could it be simpler? Like
> if (reg < 0 && ret) ?
ret will be EINVAL for unaligned base or size
ret will be ENOMEM when reg == -1 and size == 0
I could probably write it like this to make it clearer
(ret == -EINVAL || (reg == -1 && size == 0)
return -EINVAL;
traps unaligned input - for address range tear-down
traps zero sized - for address range tear-down
Allows index based teardown i.e. reg >= 0
> if (ret)
>
>> + pr_warn("debugfs register failed!\n");
>
> Do we actually need this? Or move it to debug level.
It was your suggestion @ a previous review ....
> Here is the mix of kernel levels. What about to align them?
>
> For example I doubt we need to distinguish messages by level:
>
> pr_info();
> vprintk(KERN_INFO fmt, …);
OK fine.
next prev parent reply other threads:[~2015-01-30 12:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 3:05 [PATCH v7 0/2] x86: Add IMR support to Quark/Galileo Bryan O'Donoghue
2015-01-30 3:05 ` [PATCH v7 1/2] x86: Add Isolated Memory Regions for Quark X1000 Bryan O'Donoghue
2015-01-30 7:37 ` Ong, Boon Leong
[not found] ` <CAHp75VfF_ybFLsVpfLGayoSi_shjXsmvsF52o2-L4W0hZ7+HQw@mail.gmail.com>
2015-01-30 12:06 ` Fwd: " Andy Shevchenko
2015-01-30 12:55 ` Bryan O'Donoghue
2015-01-30 12:57 ` Bryan O'Donoghue [this message]
2015-01-30 14:04 ` Andy Shevchenko
2015-01-30 14:13 ` Bryan O'Donoghue
2015-01-30 3:05 ` [PATCH v7 2/2] x86, quark: Add Intel Quark platform support Bryan O'Donoghue
2015-01-30 7:38 ` Ong, Boon Leong
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=54CB7FB9.3010806@nexus-software.ie \
--to=pure.logic@nexus-software.ie \
--cc=andy.shevchenko@gmail.com \
--cc=boon.leong.ong@intel.com \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.