public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] [patch] 2.4.20-021210 misaligned sal error record
Date: Wed, 05 Mar 2003 00:33:33 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590709805967@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805925@msgid-missing>

On Tue, 4 Mar 2003 16:01:20 -0800, 
David Mosberger <davidm@napali.hpl.hp.com> wrote:
>Below is a proposed patch (btw: I think your patch had a bug:
>addr_processor_static_info() didn't skip the cpuid structure).

No bug, I start with ((char *) &(p->processor_static_info)) so gcc has
already factored in the size of cpuid_info.  Your patch removes
cpuid_info from sal_log_processor_info_t so your calculation has to add
sizeof(cpuid_info) back in.

My patch gives accurate kdb backtraces for MCA and INIT monarch so I
know the alignments are correct.  kdb v4.0, work in progress.

>+/* Given a sal_log_processor_info_t pointer, return a pointer to the processor_static_info: */
>+#define SAL_LPI_PSI_INFO(l)								\
>+({	sal_log_processor_info_t *_l = (l);						\
>+	((sal_processor_static_info_t *)						\
>+	 ((char *) _l + ((_l->valid.num_cache_check + _l->valid.num_tlb_check		\
>+			  + _l->valid.num_bus_check + _l->valid.num_reg_file_check	\
>+			  + _l->valid.num_ms_check) * sizeof(sal_log_mod_error_info_t)	\
>+			 + sizeof(struct sal_cpuid_info))));				\
>+})

Linus recommends static inline instead of #define unless there is no
choice.  static inline does type checking, #define does not.

static inline
sal_processor_static_info_t *SAL_LPI_PSI_INFO(sal_log_processor_info_t *l)
{
	sal_processor_static_info_t *s 	(sal_processor_static_info_t *)(
		(char *) l +
		  (l->valid.num_cache_check +
		   l->valid.num_tlb_check +
		   l->valid.num_bus_check +
		   l->valid.num_reg_file_check +
		   l->valid.num_ms_check
		  ) * sizeof(sal_log_mod_error_info_t) +
		sizeof(struct sal_cpuid_info)
	);
	return s;
}

>Could someone test this to verify it works as intended (it does
>compile, but that's as far as I tested it).

Testing with kdb v4.0 now.



  parent reply	other threads:[~2003-03-05  0:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-25  0:24 [Linux-ia64] [patch] 2.4.20-021210 misaligned sal error record Keith Owens
2003-02-25  1:42 ` David Mosberger
2003-02-25  1:53 ` Keith Owens
2003-03-05  0:01 ` David Mosberger
2003-03-05  0:33 ` Keith Owens [this message]
2003-03-05  0:45 ` David Mosberger
2003-04-17 22:47 ` Bjorn Helgaas

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=marc-linux-ia64-105590709805967@msgid-missing \
    --to=kaos@sgi.com \
    --cc=linux-ia64@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox