All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Paul Mackerras <paulus@samba.org>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page
Date: Fri, 31 Jan 2020 13:38:33 -0600	[thread overview]
Message-ID: <20200131193833.GF22482@gate.crashing.org> (raw)
In-Reply-To: <27cef66b-df5b-0baa-abac-5532e58bd055@c-s.fr>

On Fri, Jan 31, 2020 at 05:15:20PM +0100, Christophe Leroy wrote:
> Le 31/01/2020 à 16:51, Segher Boessenkool a écrit :
> >On Fri, Jan 31, 2020 at 03:37:34PM +0000, Christophe Leroy wrote:
> >>When the range is a single page, do a page flush instead.
> >
> >>+	start &= PAGE_MASK;
> >>+	end = (end - 1) | ~PAGE_MASK;
> >>  	if (!Hash) {
> >>-		_tlbia();
> >>+		if (end - start == PAGE_SIZE)
> >>+			_tlbie(start);
> >>+		else
> >>+			_tlbia();
> >>  		return;
> >>  	}
> >
> >For just one page, you get  end - start == 0  actually?
> 
> Oops, good catch.
> 
> Indeed you don't get PAGE_SIZE but (PAGE_SIZE - 1) for just one page.

You have all low bits masked off in both start and end, so you get zero.
You could make the condion read "if (start == end)?

Maybe a nicer way to describe what you do is "if start and end are on the
same memory page, flush that page."


Segher

WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page
Date: Fri, 31 Jan 2020 13:38:33 -0600	[thread overview]
Message-ID: <20200131193833.GF22482@gate.crashing.org> (raw)
In-Reply-To: <27cef66b-df5b-0baa-abac-5532e58bd055@c-s.fr>

On Fri, Jan 31, 2020 at 05:15:20PM +0100, Christophe Leroy wrote:
> Le 31/01/2020 à 16:51, Segher Boessenkool a écrit :
> >On Fri, Jan 31, 2020 at 03:37:34PM +0000, Christophe Leroy wrote:
> >>When the range is a single page, do a page flush instead.
> >
> >>+	start &= PAGE_MASK;
> >>+	end = (end - 1) | ~PAGE_MASK;
> >>  	if (!Hash) {
> >>-		_tlbia();
> >>+		if (end - start == PAGE_SIZE)
> >>+			_tlbie(start);
> >>+		else
> >>+			_tlbia();
> >>  		return;
> >>  	}
> >
> >For just one page, you get  end - start == 0  actually?
> 
> Oops, good catch.
> 
> Indeed you don't get PAGE_SIZE but (PAGE_SIZE - 1) for just one page.

You have all low bits masked off in both start and end, so you get zero.
You could make the condion read "if (start == end)?

Maybe a nicer way to describe what you do is "if start and end are on the
same memory page, flush that page."


Segher

  reply	other threads:[~2020-01-31 19:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 15:37 [PATCH] powerpc/32s: Don't flush all TLBs when flushing one page Christophe Leroy
2020-01-31 15:37 ` Christophe Leroy
2020-01-31 15:51 ` Segher Boessenkool
2020-01-31 15:51   ` Segher Boessenkool
2020-01-31 16:15   ` Christophe Leroy
2020-01-31 16:15     ` Christophe Leroy
2020-01-31 19:38     ` Segher Boessenkool [this message]
2020-01-31 19:38       ` Segher Boessenkool
2020-02-01  7:27       ` Christophe Leroy
2020-02-01  7:27         ` Christophe Leroy
2020-02-01 14:06         ` Segher Boessenkool
2020-02-01 14:06           ` Segher Boessenkool
2020-02-01 14:53           ` Christophe Leroy
2020-02-01 14:53             ` Christophe Leroy
2020-02-01 16:17             ` Segher Boessenkool
2020-02-01 16:17               ` Segher Boessenkool

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=20200131193833.GF22482@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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.