linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: will@kernel.org, wangkefeng.wang@huawei.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, wuxu.wu@huawei.com,
	Hewenliang <hewenliang4@huawei.com>
Subject: Re: [PATCH] arm64: mm: Use asid2idx() and asid feature macro for cleanup
Date: Mon, 6 Dec 2021 16:23:20 +0000	[thread overview]
Message-ID: <Ya44+GAmeGBFVAad@arm.com> (raw)
In-Reply-To: <4aaabf1b-00c3-3365-e371-9d97dc0c06ab@huawei.com>

On Thu, Oct 28, 2021 at 08:27:23PM +0800, Yunfeng Ye wrote:
> Use asid2idx() and asid feature macro for cleanup.
> 
> No functional change.
> 
> Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
> ---
>  arch/arm64/mm/context.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c
> index cd72576ae2b7..076f14a75bd5 100644
> --- a/arch/arm64/mm/context.c
> +++ b/arch/arm64/mm/context.c
> @@ -50,10 +50,10 @@ static u32 get_cpu_asid_bits(void)
>  		pr_warn("CPU%d: Unknown ASID size (%d); assuming 8-bit\n",
>  					smp_processor_id(),  fld);
>  		fallthrough;
> -	case 0:
> +	case ID_AA64MMFR0_ASID_8:
>  		asid = 8;
>  		break;
> -	case 2:
> +	case ID_AA64MMFR0_ASID_16:
>  		asid = 16;
>  	}

I think this change is fine.

> @@ -162,7 +162,7 @@ static u64 new_context(struct mm_struct *mm)
>  	u64 generation = atomic64_read(&asid_generation);
> 
>  	if (asid != 0) {
> -		u64 newasid = generation | (asid & ~ASID_MASK);
> +		u64 newasid = generation | asid2idx(asid);
> 
>  		/*
>  		 * If our current ASID was active during a rollover, we
> @@ -306,7 +306,7 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm)
>  out_unlock:
>  	raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
> 
> -	asid &= ~ASID_MASK;
> +	asid = asid2idx(asid);

While functionally the code is the same, I don't think this was the
intention of asid2idx(). It's meant to provide an index into asid_map,
while the ASID_MASK lines isolate the asid number and add a new
generation to it.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-12-06 16:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 12:27 [PATCH] arm64: mm: Use asid2idx() and asid feature macro for cleanup Yunfeng Ye
2021-12-06 16:23 ` Catalin Marinas [this message]
2021-12-07  2:21   ` Yunfeng Ye
2021-12-07 10:50     ` Catalin Marinas

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=Ya44+GAmeGBFVAad@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=hewenliang4@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --cc=wuxu.wu@huawei.com \
    --cc=yeyunfeng@huawei.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;
as well as URLs for NNTP newsgroup(s).