All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejas Belagod <Tejas.Belagod@arm.com>
To: Szabolcs Nagy <Szabolcs.Nagy@arm.com>, Will Deacon <will@kernel.org>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
	Peter Collingbourne <pcc@google.com>,
	Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: RE: [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis
Date: Fri, 25 Jun 2021 16:21:07 +0000	[thread overview]
Message-ID: <PR3PR08MB56922F4145E8A063B2A5C3DEEA069@PR3PR08MB5692.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20210625141438.GK13058@arm.com>



> -----Original Message-----
> From: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
> Sent: Friday, June 25, 2021 3:15 PM
> To: Will Deacon <will@kernel.org>
> Cc: Catalin Marinas <Catalin.Marinas@arm.com>; Peter Collingbourne
> <pcc@google.com>; Vincenzo Frascino <Vincenzo.Frascino@arm.com>; Evgenii
> Stepanov <eugenis@google.com>; Linux ARM <linux-arm-
> kernel@lists.infradead.org>; Tejas Belagod <Tejas.Belagod@arm.com>
> Subject: Re: [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on
> a per-CPU basis
> 
> The 06/25/2021 13:39, Will Deacon wrote:
> > On Fri, Jun 25, 2021 at 01:01:37PM +0100, Catalin Marinas wrote:
> > > Thanks, that's useful. I guess since the _MTAG_ENABLE tunable is not
> > > ABI, the user app can't rely on what the glibc has configured.
> > > Arguably, since it's driven from outside the application (env), we
> > > could say the same for sysfs, though for the glibc case, the user
> > > app is still be able to override it before the first thread is
> > > created (or per-thread). I assume glibc only issues the prctl() once, not for
> every new thread.
> 
> note: in the end the tunable is like
> 
> GLIBC_TUNABLES=glibc.mem.tagging=3 ./exe
> 
> not _MTAG_ENABLE.
> 
> and yes the setting comes from outside and glibc calls prctl once.
> 
> > > So we can document that the mode requested by the app is an
> > > indication, the system may change it to another value (and back-port
> > > documentation to 5.10). If we get a request from developers to
> > > honour a specific mode, we can add a new PR_MTE_TCF_EXACT bit or
> > > something but it's not essential we do it now.
> > >
> > > So if we allow the kernel to change the user requested mode (via
> > > sysfs), I think we still have two more issues to clarify:
> > >
> > > 1. Do we allow only "upgrade" (for some meaning of this) or sysfs can
> > >    downgrade to a less strict mode. I'd go for upgrade here to a
> > >    stricter check as in Peter's patch.
> > >
> > > 2. Should the sysfs upgrade the PR_MTE_TCF_NONE? _MTAG_ENABLE does
> that,
> > >    so I'd say yes.
> > >
> > > Any other thoughts are welcome.
> >
> > As I mentioned before, I think the sysfs interface should offer:
> >
> > 	"task"	: Honour whatever the task has asked for (default)
> > 	"async" : Force async on this CPU
> > 	"sync"  : Force sync on this CPU
> >
> > I don't think we should upgrade PR_MTE_TCF_NONE unless we also have a
> "none"
> > option in here. I originally suggested that, but in hindsight it feels
> > like a bad idea because a task could SIGILL on migration. So what
> > we're saying is that PR_MTE_TCF_SYNC and PR_MTE_TCF_ASYNC will always
> > enable MTE on success, but the reporting mode is a hint.
> >
> > I don't think upgrade/downgrade makes a lot of sense given that the
> > sysfs controls can be changed at any point in time. It should just be an
> override.
> >
> > This means that we can force async for CPUs where sync mode is
> > horribly slow, whilst honouring the task's request on CPUs which are
> > better implemented.
> 
> i think a user should be able to ask for sync check mode for a process and get an
> error if that's not possible.
> 
> at least this is the semantics that makes sense in glibc. i think it's very confusing
> if somebody explicitly asks for sync checks to debug something but then gets
> useless diagnostics because somebody else tried to second guess their
> performance tradeoff preferences. (if sync check is too slow on a cpu then the
> user can taskset to a cpu that's not slow or just use other debugging method,
> silent override sounds bad.)

Sorry I'm late to the party - just catching up with this thread.

I'm not a kernel/glibc expert so please correct me if I'm wrong here - I see two themes in this discussion - the usage model between user/system of the TCF mode and its implementation.

 From a user's perspective, they should be able to get the TCF mode they asked for and get atleast a warning if that's not possible for whatever reason(performance et al). From a system/kernel's perspective, if the system wants to use MTE, it should be able to provide the most performant(or most strict) TCF mode/per CPU as it sees fit - user's 'task' setting in sysfs/GLIBC's env will override it. Can a user-setting downgrade a system-setting TCF level is another question - probably not, so the user will need to be warned against it. So what happens if a process with TCF_NONE migrates from a CPU with TCF_NONE to TCF_ASYNC - should the kernel control process/CPU migrations according to the TCF setting? Won't this affect performance anyway by increasing contention?

Implementation-wise, the sysfs interface of 'task', 'async', 'sync' seems to make sense to me as it fits in well if we use the above as a guiding principle. 

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

  reply	other threads:[~2021-06-25 16:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 20:38 [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis Peter Collingbourne
2021-06-17 21:58 ` Will Deacon
2021-06-17 22:13   ` Peter Collingbourne
2021-06-18 15:09   ` Catalin Marinas
2021-06-19  0:45     ` Peter Collingbourne
2021-06-21 12:39     ` Will Deacon
2021-06-21 15:18       ` Catalin Marinas
2021-06-21 17:39         ` Will Deacon
2021-06-21 18:50           ` Catalin Marinas
2021-06-22 18:37             ` Peter Collingbourne
2021-06-23  8:55               ` Szabolcs Nagy
2021-06-23 17:15                 ` Peter Collingbourne
2021-06-24 16:52                 ` Catalin Marinas
2021-06-25  9:22                   ` Szabolcs Nagy
2021-06-25 12:01                     ` Catalin Marinas
2021-06-25 12:39                       ` Will Deacon
2021-06-25 13:53                         ` Catalin Marinas
2021-06-28 10:14                           ` Will Deacon
2021-06-28 15:20                             ` Catalin Marinas
2021-06-29 10:46                               ` Will Deacon
2021-06-29 13:58                                 ` Szabolcs Nagy
2021-06-29 14:31                                   ` Tejas Belagod
2021-06-29 15:54                                     ` Catalin Marinas
2021-06-29 19:11                                 ` Peter Collingbourne
2021-06-30 15:19                                   ` Catalin Marinas
2021-06-30 23:39                                     ` Peter Collingbourne
2021-07-07 10:30                                       ` Will Deacon
2021-07-07 12:55                                         ` Catalin Marinas
2021-07-07 14:11                                           ` Will Deacon
2021-06-25 14:14                         ` Szabolcs Nagy
2021-06-25 16:21                           ` Tejas Belagod [this message]
2021-06-28 10:17                           ` Will Deacon
2021-06-28 17:21                             ` Szabolcs Nagy
2021-06-25 16:52                       ` Peter Collingbourne

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=PR3PR08MB56922F4145E8A063B2A5C3DEEA069@PR3PR08MB5692.eurprd08.prod.outlook.com \
    --to=tejas.belagod@arm.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=Vincenzo.Frascino@arm.com \
    --cc=eugenis@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pcc@google.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 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.