[Skiboot] [PATCH V2 5/6] Introduces get and put elog routine and reference count field in elog structure

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Fri Jun 10 19:03:55 AEST 2016


On 06/09/2016 07:24 PM, Mukesh Ojha wrote:
> Introduces a reference count variable in the errorlog structure, which is
> to track the number of user of errorlog buffer.
>
> get_elog and put_elog routine to increment/decrement the reference count variable.
> errorlog buffer return to the pool on zero count of reference count.

Also explain why we need this change.

>
> Signed-off-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
>
> ---
> Changes in V2:
>   - Separates it from patch 3/3 from V1.
>
>   core/errorlog.c         | 31 ++++++++++++++++++++++++++++---
>   hw/fsp/fsp-elog-write.c |  1 +
>   include/errorlog.h      |  2 ++
>   3 files changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/core/errorlog.c b/core/errorlog.c
> index c34251b..8ec603c 100644
> --- a/core/errorlog.c
> +++ b/core/errorlog.c
> @@ -39,9 +39,31 @@ static uint32_t sapphire_elog_id = 0xB0000000;
>   /* Pool to allocate elog messages from */
>   static struct pool elog_pool;
>   static struct lock elog_lock = LOCK_UNLOCKED;
> +static struct lock elog_buf_ref_lock = LOCK_UNLOCKED;
>
>   static bool elog_available = false;
>
> +static void put_elog(struct errorlog *elog_buf)
> +{
> +	lock(&elog_buf_ref_lock);
> +	if (!elog_buf->ref_count) {
> +		prerror("put_elog has been called multiple times on reference"
> +				" count zero\n");

I think we can improve error message. Its not with ref_cout 0, not multiple time.

-Vasant



More information about the Skiboot mailing list