linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Baicar, Tyler" <tbaicar@codeaurora.org>
To: Suzuki K Poulose <Suzuki.Poulose@arm.com>,
	marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com,
	linux@armlinux.org.uk, catalin.marinas@arm.com,
	will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org,
	matt@codeblueprint.co.uk, robert.moore@intel.com,
	lv.zheng@intel.com, nkaje@codeaurora.org, zjzhang@codeaurora.org,
	mark.rutland@arm.com, james.morse@arm.com,
	akpm@linux-foundation.org, eun.taik.lee@samsung.com,
	sandeepa.s.prabhu@gmail.com, shijie.huang@arm.com,
	rruigrok@codeaurora.org, paul.gortmaker@windriver.com,
	tomasz.nowicki@linaro.org, fu.wei@linaro.org,
	rostedt@goodmis.org, bristot@redhat.com,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-efi@vger.kernel.org, punit.agrawal@arm.com,
	astone@redhat.com, harba@codeaurora.org, hanjun.guo@linaro.org
Subject: Re: [PATCH V4 01/10] acpi: apei: read ack upon ghes record consumption
Date: Mon, 24 Oct 2016 14:28:09 -0600	[thread overview]
Message-ID: <768254df-7b4a-65a4-81bf-665f63780073@codeaurora.org> (raw)
In-Reply-To: <b4b69d66-ae37-a528-d64c-ee9b3fe7b02c@arm.com>

On 10/24/2016 2:51 AM, Suzuki K Poulose wrote:
> On 21/10/16 18:30, Tyler Baicar wrote:
>> A RAS (Reliability, Availability, Serviceability) controller
>> may be a separate processor running in parallel with OS
>> execution, and may generate error records for consumption by
>> the OS. If the RAS controller produces multiple error records,
>> then they may be overwritten before the OS has consumed them.
>>
>> The Generic Hardware Error Source (GHES) v2 structure
>> introduces the capability for the OS to acknowledge the
>> consumption of the error record generated by the RAS
>> controller. A RAS controller supporting GHESv2 shall wait for
>> the acknowledgment before writing a new error record, thus
>> eliminating the race condition.
>>
>> Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
>> Signed-off-by: Richard Ruigrok <rruigrok@codeaurora.org>
>> Signed-off-by: Tyler Baicar <tbaicar@codeaurora.org>
>> Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
>> ---
>>  drivers/acpi/apei/ghes.c | 42 
>> ++++++++++++++++++++++++++++++++++++++++++
>>  drivers/acpi/apei/hest.c |  7 +++++--
>>  include/acpi/ghes.h      |  5 ++++-
>>  3 files changed, 51 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
>> index 60746ef..7d020b0 100644
>> --- a/drivers/acpi/apei/ghes.c
>> +++ b/drivers/acpi/apei/ghes.c
>> @@ -45,6 +45,7 @@
>>  #include <linux/aer.h>
>>  #include <linux/nmi.h>
>>
>> +#include <acpi/actbl1.h>
>>  #include <acpi/ghes.h>
>>  #include <acpi/apei.h>
>>  #include <asm/tlbflush.h>
>> @@ -79,6 +80,10 @@
>>      ((struct acpi_hest_generic_status *)                \
>>       ((struct ghes_estatus_node *)(estatus_node) + 1))
>>
>> +#define HEST_TYPE_GENERIC_V2(ghes)                \
>> +    ((struct acpi_hest_header *)ghes->generic)->type ==    \
>> +     ACPI_HEST_TYPE_GENERIC_ERROR_V2
>> +
>>  /*
>>   * This driver isn't really modular, however for the time being,
>>   * continuing to use module_param is the easiest way to remain
>> @@ -248,7 +253,15 @@ static struct ghes *ghes_new(struct 
>> acpi_hest_generic *generic)
>>      ghes = kzalloc(sizeof(*ghes), GFP_KERNEL);
>>      if (!ghes)
>>          return ERR_PTR(-ENOMEM);
>> +
>>      ghes->generic = generic;
>> +    if (HEST_TYPE_GENERIC_V2(ghes)) {
>> +        rc = apei_map_generic_address(
>> +            &ghes->generic_v2->read_ack_register);
>> +        if (rc)
>> +            goto err_unmap;
>
> I think should be goto err_free, see more below.
>
>> +    }
>> +
>>      rc = apei_map_generic_address(&generic->error_status_address);
>>      if (rc)
>>          goto err_free;
>> @@ -270,6 +283,9 @@ static struct ghes *ghes_new(struct 
>> acpi_hest_generic *generic)
>>
>>  err_unmap:
>> apei_unmap_generic_address(&generic->error_status_address);
>> +    if (HEST_TYPE_GENERIC_V2(ghes))
>> +        apei_unmap_generic_address(
>> +            &ghes->generic_v2->read_ack_register);
>
> We might end up trying to unmap (error_status_address) which is not 
> mapped
> if we hit the error in mapping read_ack_register. The 
> read_ack_register unmap
> hunk should be moved below to err_free.
>
This needs to be changed, I'll add a separate label for unmapping 
read_ack_register and error_status_address for the case that the 
read_ack_register map succeeds but the error_status_address map fails.

err_unmap_status_addr:
apei_unmap_generic_address(&generic->error_status_address);
err_unmap_read_ack_addr:
         if (HEST_TYPE_GENERIC_V2(ghes))
                 apei_unmap_generic_address(
&ghes->generic_v2->read_ack_register);
err_free:
         kfree(ghes);
         return ERR_PTR(rc);

If mapping read_ack_register fails, goto err_free.
If mapping read_ack_register is successful but mapping 
error_status_address fails, goto err_unmap_read_ack_addr.
And if both mappings succeed but the kmalloc fails, then goto 
err_unmap_status_addr.

>
>>  err_free:
>>      kfree(ghes);
>>      return ERR_PTR(rc);
>> @@ -279,6 +295,9 @@ static void ghes_fini(struct ghes *ghes)
>>  {
>>      kfree(ghes->estatus);
>> apei_unmap_generic_address(&ghes->generic->error_status_address);
>> +    if (HEST_TYPE_GENERIC_V2(ghes))
>> +        apei_unmap_generic_address(
>> +            &ghes->generic_v2->read_ack_register);
>>  }
>>
>>  static inline int ghes_severity(int severity)
>> @@ -648,6 +667,23 @@ static void ghes_estatus_cache_add(
>>      rcu_read_unlock();
>>  }
>>
>
>> +static int ghes_do_read_ack(struct acpi_hest_generic_v2 *generic_v2)
>
> nit: We are actually writing something to the read_ack_register. The 
> names
> read_ack_register (which may be as per standard) and more importantly the
> function name (ghes_do_read_ack) sounds a bit misleading.
It is called "Read Ack Register" in the spec (ACPI 6.1 table 18-344), 
but I agree the function name can be improved.
Maybe ghes_acknowledge_error or ghes_ack_error.

Thanks,
Tyler
>
> Rest looks fine to me.
>
> Suzuki
>

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.

  reply	other threads:[~2016-10-24 20:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 17:30 [PATCH V4 00/10] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 01/10] acpi: apei: read ack upon ghes record consumption Tyler Baicar
2016-10-24  8:51   ` Suzuki K Poulose
2016-10-24 20:28     ` Baicar, Tyler [this message]
2016-10-21 17:30 ` [PATCH V4 02/10] ras: acpi/apei: cper: generic error data entry v3 per ACPI 6.1 Tyler Baicar
2016-10-24  9:50   ` Suzuki K Poulose
2016-10-24 20:33     ` Baicar, Tyler
2016-10-21 17:30 ` [PATCH V4 03/10] efi: parse ARMv8 processor error Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 04/10] arm64: exception: handle Synchronous External Abort Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 05/10] acpi: apei: handle SEA notification type for ARMv8 Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 06/10] acpi: apei: panic OS with fatal error status block Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 07/10] efi: print unrecognized CPER section Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 08/10] ras: acpi / apei: generate trace event for " Tyler Baicar
2016-10-21 17:30 ` [PATCH V4 09/10] trace, ras: add ARM processor error trace event Tyler Baicar
2016-10-21 20:34   ` Steven Rostedt
2016-10-24 17:21     ` Baicar, Tyler
2016-10-21 17:30 ` [PATCH V4 10/10] arm64: KVM: add guest SEA support Tyler Baicar
2016-10-31 10:02   ` Russell King - ARM Linux
2016-10-31 22:36     ` Baicar, Tyler
     [not found]       ` <85443ee1-9981-c7e8-fe88-a3aac48c3e80-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-11-01  9:36         ` Russell King - ARM Linux

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=768254df-7b4a-65a4-81bf-665f63780073@codeaurora.org \
    --to=tbaicar@codeaurora.org \
    --cc=Suzuki.Poulose@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=astone@redhat.com \
    --cc=bristot@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=eun.taik.lee@samsung.com \
    --cc=fu.wei@linaro.org \
    --cc=hanjun.guo@linaro.org \
    --cc=harba@codeaurora.org \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lv.zheng@intel.com \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=nkaje@codeaurora.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=pbonzini@redhat.com \
    --cc=punit.agrawal@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=rkrcmar@redhat.com \
    --cc=robert.moore@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rruigrok@codeaurora.org \
    --cc=sandeepa.s.prabhu@gmail.com \
    --cc=shijie.huang@arm.com \
    --cc=tomasz.nowicki@linaro.org \
    --cc=will.deacon@arm.com \
    --cc=zjzhang@codeaurora.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 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).