From: Xishi Qiu <qiuxishi-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Cc: Chen Gang <gang.chen-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init()
Date: Thu, 14 Nov 2013 19:33:59 +0800 [thread overview]
Message-ID: <5284B527.8030409@huawei.com> (raw)
In-Reply-To: <5284A4CF.5070809-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
On 2013/11/14 18:24, James Hogan wrote:
> On 14/11/13 09:35, Chen Gang wrote:
>> On 11/14/2013 05:18 PM, James Hogan wrote:
>>> On Thursday 14 November 2013 16:11:21 Chen Gang wrote:
>>>> Like another p?d_alloc(), pud_alloc() also may fail, so need check it.
>>>>
>>>> Signed-off-by: Chen Gang <gang.chen-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
>>>
>>> NAK.
>>>
>>> pud_alloc folds to pud_offset on Meta so it cannot fail.
>>>
>>
>> If so, can pmd_alloc() be fail?
>
> No. pmd_alloc folds to pmd_offset so it also cannot fail, and the
> existing !pmd check is dead code. The following would be better.
>
> Cheers
> James
>
>>From 85a386a9c7df666b1f438435be8a89581bc7e8b3 Mon Sep 17 00:00:00 2001
> From: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> Date: Thu, 14 Nov 2013 10:14:37 +0000
> Subject: [PATCH 1/1] metag: dma: remove dead code in dma_alloc_init()
>
> Meta has 2 levels of page table so the pmd folds into the pud which
Hi James,
"Meta has 2 levels of page table", so it use
"#define pud_alloc(mm, pgd, address) (pgd)", right?
and if the arch is x86_64, we should check the pmd and pud, right?
Thanks,
Xishi Qiu
> folds into the pgd. Therefore the !pmd check in dma_alloc_init() is dead
> code since it essentially checks whether:
> (init_mm->pgd + 0x770) == 0
>
> Remove the check.
>
> Reported-by: Chen Gang <gang.chen-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> ---
> arch/metag/kernel/dma.c | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c
> index 8c00dedadc54..78205dbc2b86 100644
> --- a/arch/metag/kernel/dma.c
> +++ b/arch/metag/kernel/dma.c
> @@ -401,11 +401,6 @@ static int __init dma_alloc_init(void)
> pgd = pgd_offset(&init_mm, CONSISTENT_START);
> pud = pud_alloc(&init_mm, pgd, CONSISTENT_START);
> pmd = pmd_alloc(&init_mm, pud, CONSISTENT_START);
> - if (!pmd) {
> - pr_err("%s: no pmd tables\n", __func__);
> - ret = -ENOMEM;
> - break;
> - }
> WARN_ON(!pmd_none(*pmd));
>
> pte = pte_alloc_kernel(pmd, CONSISTENT_START);
--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-11-14 11:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 8:11 [PATCH] arch: metag: kernel: dma.c: check 'pud' whether is NULL in dma_alloc_init() Chen Gang
[not found] ` <528485A9.5050509-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-11-14 9:18 ` James Hogan
2013-11-14 9:35 ` Chen Gang
[not found] ` <52849961.10502-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-11-14 10:24 ` James Hogan
[not found] ` <5284A4CF.5070809-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2013-11-14 11:33 ` Xishi Qiu [this message]
[not found] ` <5284B527.8030409-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14 11:47 ` James Hogan
2013-11-14 11:46 ` Xishi Qiu
[not found] ` <5284B809.6010709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14 11:51 ` James Hogan
[not found] ` <5284B93D.1000707-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2013-11-14 13:35 ` Chen Gang
2013-11-14 9:25 ` Xishi Qiu
2013-11-14 9:25 ` Xishi Qiu
[not found] ` <52849706.3010309-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-14 9:41 ` Chen Gang
2013-11-14 9:41 ` Chen Gang
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=5284B527.8030409@huawei.com \
--to=qiuxishi-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=gang.chen-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org \
--cc=james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
--cc=linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.