Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665685

Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon Djtag driver

From Russell King - ARM Linux <linux@armlinux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon Djtag driver
Date 2017-06-14 12:50 +0200
Message-ID <tSe25-459-5@gated-at.bofh.it> (permalink)
References (1 earlier) <tQ8Dw-6E7-15@gated-at.bofh.it> <tQsVA-2Cx-15@gated-at.bofh.it> <tQteW-2JK-3@gated-at.bofh.it> <tQtRD-3bI-3@gated-at.bofh.it> <tSdz4-3TR-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jun 14, 2017 at 11:06:58AM +0100, Will Deacon wrote:
> Apologies, I misunderstood your algorithm (I thought step (a) was on one CPU
> and step (b) was on another). Still, I don't understand the need for the
> timeout. If you instead read back the flag immediately, wouldn't it still
> work? e.g.
> 
> 
> lock:
>   Readl_relaxed flag
>   if (locked)
>     goto lock;
> 
>   Writel_relaxed unique ID to flag
>   Readl flag
>   if (locked by somebody else)
>     goto lock;
> 
> <critical section>
> 
> unlock:
>   Writel unlocked value to flag

I think the delay is to counter this:

	Agent 1			Agent 2
	read flag
	not locked
				read flag
				not locked
	write unique ID
	read back
	not locked by someone else
				write unique ID
				read back
				not locked by someone else

With the delay present, this becomes:

	Agent 1			Agent 2
	read flag
	not locked
				read flag
				not locked
	write unique ID
	delay
				write unique ID
				delay
	read back
	locked by agent 2
				read back
				not locked by someone else

For this to work, the delay has to be guaranteed to be greater than
the maximum duration that any agent takes between the initial read
and the write of its unique ID.  The delay doesn't even have to be
identical between each agent, it just has to satisfy that condition.

The key thing though is that the reads and writes must happen when
the program intends them to, so I don't think the _relaxed variants
should be used here.  If they're buffered, then the delay doesn't
have the desired effect.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Mark Rutland <mark.rutland@arm.com> - 2017-06-08 18:40 +0200
  Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver John Garry <john.garry@huawei.com> - 2017-06-09 16:20 +0200
    Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Will Deacon <will.deacon@arm.com> - 2017-06-09 16:40 +0200
      Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver John Garry <john.garry@huawei.com> - 2017-06-09 17:20 +0200
        Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Will Deacon <will.deacon@arm.com> - 2017-06-14 12:20 +0200
          Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Russell King - ARM Linux <linux@armlinux.org.uk> - 2017-06-14 12:50 +0200
            Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Will Deacon <will.deacon@arm.com> - 2017-06-14 13:10 +0200
          Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Mark Rutland <mark.rutland@arm.com> - 2017-06-14 13:00 +0200
          Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Will Deacon <will.deacon@arm.com> - 2017-06-14 13:10 +0200
            Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver John Garry <john.garry@huawei.com> - 2017-06-14 13:40 +0200
              Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Will Deacon <will.deacon@arm.com> - 2017-06-14 13:50 +0200
                Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver John Garry <john.garry@huawei.com> - 2017-06-14 14:00 +0200
    Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Mark Rutland <mark.rutland@arm.com> - 2017-06-09 17:50 +0200
      Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver John Garry <john.garry@huawei.com> - 2017-06-09 18:10 +0200
        Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Mark Rutland <mark.rutland@arm.com> - 2017-06-09 18:50 +0200
  Re: [PATCH v8 6/9] drivers: perf: hisi: Add support for Hisilicon  Djtag driver Zhangshaokun <zhangshaokun@hisilicon.com> - 2017-06-14 10:20 +0200

csiph-web