All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>, <arnd@arndb.de>,
	<catalin.marinas@arm.com>, <rostedt@goodmis.org>
Cc: <gregkh@linuxfoundation.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<maz@kernel.org>, <quic_psodagud@quicinc.com>,
	<quic_tsoni@quicinc.com>, <will@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: Re: [PATCHv14 2/9] coresight: etm4x: Use asm-generic IO memory barriers
Date: Fri, 6 May 2022 08:32:31 +0530	[thread overview]
Message-ID: <b44a0e0b-ee86-3b08-0103-3ccee94e3270@quicinc.com> (raw)
In-Reply-To: <483bb401-13e6-8c52-4b5f-f3c635b9ad46@arm.com>

Hi Suzuki,

On 5/6/2022 5:14 AM, Suzuki K Poulose wrote:
> Hi,
>
> On 04/05/2022 12:28, Sai Prakash Ranjan wrote:
>> Per discussion in [1], it was decided to move to using architecture
>> independent/asm-generic IO memory barriers to have just one set of
>> them and deprecate use of arm64 specific IO memory barriers in driver
>> code. So replace current usage of __io_rmb()/__iowmb() in drivers to
>> __io_ar()/__io_bw().
>>
>> [1] https://lore.kernel.org/lkml/CAK8P3a0L2tLeF1Q0+0ijUxhGNaw+Z0fyPC1oW6_ELQfn0=i4iw@mail.gmail.com/
>>
>
> Looking at the dis-assembly it looks like in effect they are slightly
> different for arm64.
>
> i.e., before this patch we had
>
> "dmb osh{ld/st}"
>
> and after the patch we have :
>
> "dsb {ld/st}"
>
> Is this really what we want ? I don't think this is desirable.
>
> Suzuki
>

No, this is not supposed to happen and I do not see how it could happen.
__io_ar() is defined as __iormb() and __io_bw() is __iowmb().

I checked the disassembly in both case with MMIO trace off/on with __etm4_cpu_save()
as below and saw the same number of "dmb"s.

aarch64-linux-gnu-gdb -batch -ex "disassemble/rs __etm4_cpu_save" vmlinux-without-mmio
aarch64-linux-gnu-gdb -batch -ex "disassemble/rs __etm4_cpu_save" vmlinux-with-mmio

Can you tell me how are you validating if I am missing something?

Thanks,
Sai

>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
>> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
>> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 ++++----
>>   drivers/hwtracing/coresight/coresight-etm4x.h      | 8 ++++----
>>   2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> index 7f416a12000e..81c0faf45b28 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> @@ -98,7 +98,7 @@ u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>       }
>>         if (!_relaxed)
>> -        __iormb(res);    /* Imitate the !relaxed I/O helpers */
>> +        __io_ar(res);    /* Imitate the !relaxed I/O helpers */
>>         return res;
>>   }
>> @@ -106,7 +106,7 @@ u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>   void etm4x_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit)
>>   {
>>       if (!_relaxed)
>> -        __iowmb();    /* Imitate the !relaxed I/O helpers */
>> +        __io_bw();    /* Imitate the !relaxed I/O helpers */
>>       if (!_64bit)
>>           val &= GENMASK(31, 0);
>>   @@ -130,7 +130,7 @@ static u64 ete_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>       }
>>         if (!_relaxed)
>> -        __iormb(res);    /* Imitate the !relaxed I/O helpers */
>> +        __io_ar(res);    /* Imitate the !relaxed I/O helpers */
>>         return res;
>>   }
>> @@ -138,7 +138,7 @@ static u64 ete_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>   static void ete_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit)
>>   {
>>       if (!_relaxed)
>> -        __iowmb();    /* Imitate the !relaxed I/O helpers */
>> +        __io_bw();    /* Imitate the !relaxed I/O helpers */
>>       if (!_64bit)
>>           val &= GENMASK(31, 0);
>>   diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
>> index 3c4d69b096ca..f54698731582 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
>> @@ -448,14 +448,14 @@
>>   #define etm4x_read32(csa, offset)                    \
>>       ({                                \
>>           u32 __val = etm4x_relaxed_read32((csa), (offset)); \
>> -        __iormb(__val);                        \
>> +        __io_ar(__val);                        \
>>           __val;                            \
>>        })
>>     #define etm4x_read64(csa, offset)                    \
>>       ({                                \
>>           u64 __val = etm4x_relaxed_read64((csa), (offset)); \
>> -        __iormb(__val);                        \
>> +        __io_ar(__val);                        \
>>           __val;                            \
>>        })
>>   @@ -479,13 +479,13 @@
>>     #define etm4x_write32(csa, val, offset)                    \
>>       do {                                \
>> -        __iowmb();                        \
>> +        __io_bw();                        \
>>           etm4x_relaxed_write32((csa), (val), (offset)); \
>>       } while (0)
>>     #define etm4x_write64(csa, val, offset)                    \
>>       do {                                \
>> -        __iowmb();                        \
>> +        __io_bw();                        \
>>           etm4x_relaxed_write64((csa), (val), (offset)); \
>>       } while (0)
>


WARNING: multiple messages have this Message-ID (diff)
From: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>, <arnd@arndb.de>,
	<catalin.marinas@arm.com>, <rostedt@goodmis.org>
Cc: <gregkh@linuxfoundation.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<maz@kernel.org>, <quic_psodagud@quicinc.com>,
	<quic_tsoni@quicinc.com>, <will@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: Re: [PATCHv14 2/9] coresight: etm4x: Use asm-generic IO memory barriers
Date: Fri, 6 May 2022 08:32:31 +0530	[thread overview]
Message-ID: <b44a0e0b-ee86-3b08-0103-3ccee94e3270@quicinc.com> (raw)
In-Reply-To: <483bb401-13e6-8c52-4b5f-f3c635b9ad46@arm.com>

Hi Suzuki,

On 5/6/2022 5:14 AM, Suzuki K Poulose wrote:
> Hi,
>
> On 04/05/2022 12:28, Sai Prakash Ranjan wrote:
>> Per discussion in [1], it was decided to move to using architecture
>> independent/asm-generic IO memory barriers to have just one set of
>> them and deprecate use of arm64 specific IO memory barriers in driver
>> code. So replace current usage of __io_rmb()/__iowmb() in drivers to
>> __io_ar()/__io_bw().
>>
>> [1] https://lore.kernel.org/lkml/CAK8P3a0L2tLeF1Q0+0ijUxhGNaw+Z0fyPC1oW6_ELQfn0=i4iw@mail.gmail.com/
>>
>
> Looking at the dis-assembly it looks like in effect they are slightly
> different for arm64.
>
> i.e., before this patch we had
>
> "dmb osh{ld/st}"
>
> and after the patch we have :
>
> "dsb {ld/st}"
>
> Is this really what we want ? I don't think this is desirable.
>
> Suzuki
>

No, this is not supposed to happen and I do not see how it could happen.
__io_ar() is defined as __iormb() and __io_bw() is __iowmb().

I checked the disassembly in both case with MMIO trace off/on with __etm4_cpu_save()
as below and saw the same number of "dmb"s.

aarch64-linux-gnu-gdb -batch -ex "disassemble/rs __etm4_cpu_save" vmlinux-without-mmio
aarch64-linux-gnu-gdb -batch -ex "disassemble/rs __etm4_cpu_save" vmlinux-with-mmio

Can you tell me how are you validating if I am missing something?

Thanks,
Sai

>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
>> Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
>> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 ++++----
>>   drivers/hwtracing/coresight/coresight-etm4x.h      | 8 ++++----
>>   2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> index 7f416a12000e..81c0faf45b28 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
>> @@ -98,7 +98,7 @@ u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>       }
>>         if (!_relaxed)
>> -        __iormb(res);    /* Imitate the !relaxed I/O helpers */
>> +        __io_ar(res);    /* Imitate the !relaxed I/O helpers */
>>         return res;
>>   }
>> @@ -106,7 +106,7 @@ u64 etm4x_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>   void etm4x_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit)
>>   {
>>       if (!_relaxed)
>> -        __iowmb();    /* Imitate the !relaxed I/O helpers */
>> +        __io_bw();    /* Imitate the !relaxed I/O helpers */
>>       if (!_64bit)
>>           val &= GENMASK(31, 0);
>>   @@ -130,7 +130,7 @@ static u64 ete_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>       }
>>         if (!_relaxed)
>> -        __iormb(res);    /* Imitate the !relaxed I/O helpers */
>> +        __io_ar(res);    /* Imitate the !relaxed I/O helpers */
>>         return res;
>>   }
>> @@ -138,7 +138,7 @@ static u64 ete_sysreg_read(u32 offset, bool _relaxed, bool _64bit)
>>   static void ete_sysreg_write(u64 val, u32 offset, bool _relaxed, bool _64bit)
>>   {
>>       if (!_relaxed)
>> -        __iowmb();    /* Imitate the !relaxed I/O helpers */
>> +        __io_bw();    /* Imitate the !relaxed I/O helpers */
>>       if (!_64bit)
>>           val &= GENMASK(31, 0);
>>   diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
>> index 3c4d69b096ca..f54698731582 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
>> @@ -448,14 +448,14 @@
>>   #define etm4x_read32(csa, offset)                    \
>>       ({                                \
>>           u32 __val = etm4x_relaxed_read32((csa), (offset)); \
>> -        __iormb(__val);                        \
>> +        __io_ar(__val);                        \
>>           __val;                            \
>>        })
>>     #define etm4x_read64(csa, offset)                    \
>>       ({                                \
>>           u64 __val = etm4x_relaxed_read64((csa), (offset)); \
>> -        __iormb(__val);                        \
>> +        __io_ar(__val);                        \
>>           __val;                            \
>>        })
>>   @@ -479,13 +479,13 @@
>>     #define etm4x_write32(csa, val, offset)                    \
>>       do {                                \
>> -        __iowmb();                        \
>> +        __io_bw();                        \
>>           etm4x_relaxed_write32((csa), (val), (offset)); \
>>       } while (0)
>>     #define etm4x_write64(csa, val, offset)                    \
>>       do {                                \
>> -        __iowmb();                        \
>> +        __io_bw();                        \
>>           etm4x_relaxed_write64((csa), (val), (offset)); \
>>       } while (0)
>


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

  reply	other threads:[~2022-05-06  3:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 11:28 [PATCHv14 0/9] lib/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan
2022-05-04 11:28 ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 1/9] arm64: io: Use asm-generic high level MMIO accessors Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 2/9] coresight: etm4x: Use asm-generic IO memory barriers Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-05 23:44   ` Suzuki K Poulose
2022-05-05 23:44     ` Suzuki K Poulose
2022-05-06  3:02     ` Sai Prakash Ranjan [this message]
2022-05-06  3:02       ` Sai Prakash Ranjan
2022-05-06  9:21       ` Suzuki K Poulose
2022-05-06  9:21         ` Suzuki K Poulose
2022-05-06 13:22         ` Sai Prakash Ranjan
2022-05-06 13:22           ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 3/9] irqchip/tegra: Fix overflow implicit truncation warnings Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 4/9] drm/meson: " Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 5/9] lib: Add register read/write tracing support Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-11  3:51   ` Sai Prakash Ranjan
2022-05-11  3:51     ` Sai Prakash Ranjan
2022-05-17  6:41     ` Sai Prakash Ranjan
2022-05-17  6:41       ` Sai Prakash Ranjan
2022-05-18 14:07   ` Steven Rostedt
2022-05-18 14:07     ` Steven Rostedt
2022-05-18 15:18     ` Sai Prakash Ranjan
2022-05-18 15:18       ` Sai Prakash Ranjan
2022-05-18 16:45       ` Sai Prakash Ranjan
2022-05-18 16:45         ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 6/9] KVM: arm64: Add a flag to disable MMIO trace for nVHE KVM Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 7/9] asm-generic/io: Add logging support for MMIO accessors Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 8/9] serial: qcom_geni_serial: Disable MMIO tracing for geni serial Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 9/9] soc: qcom: geni: Disable MMIO tracing for GENI SE Sai Prakash Ranjan
2022-05-04 11:28   ` Sai Prakash Ranjan
2022-05-04 11:32 ` [PATCHv14 0/9] lib/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan
2022-05-04 11:32   ` Sai Prakash Ranjan

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=b44a0e0b-ee86-3b08-0103-3ccee94e3270@quicinc.com \
    --to=quic_saipraka@quicinc.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=maz@kernel.org \
    --cc=quic_psodagud@quicinc.com \
    --cc=quic_tsoni@quicinc.com \
    --cc=rostedt@goodmis.org \
    --cc=suzuki.poulose@arm.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.