mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Orsila <shdl@zakalwe.fi>
To: David Altobelli <david.altobelli@hp.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HP iLO driver
Date: Thu, 12 Jun 2008 22:04:05 +0300	[thread overview]
Message-ID: <20080612190405.GR31039@zakalwe.fi> (raw)
In-Reply-To: <20080612182308.GA1091@ldl.fc.hp.com>

On Thu, Jun 12, 2008 at 12:23:08PM -0600, David Altobelli wrote:
> +struct fifo {
> +    u64 nrents;	/* user requested number of fifo entries */
> +    u64 imask;  /* mask to extract valid fifo index */
> +    u64 merge;	/*  O/C bits to merge in during enqueue operation */
> +    u64 reset;	/* set to non-zero when the target device resets */
> +    u8  pad_0[ILO_CACHE_SZ - (sizeof(u64) * 4)];
> +
> +    u64 head;
> +    u8  pad_1[ILO_CACHE_SZ - (sizeof(u64))];
> +
> +    u64 tail;
> +    u8  pad_2[ILO_CACHE_SZ - (sizeof(u64))];
> +
> +    volatile u64 fifobar[1];
> +};

Why do you need a volatile? What you probably want is atomic ops. 
Spinlocks will create memory barriers implicitly.

> +static int fifo_enqueue(struct ilo_hwinfo *hw, char *fifobar, int entry)
> +{
> +	struct fifo *Q = FIFOBARTOHANDLE(fifobar);
> +	int ret = 0;
> +
> +	spin_lock(&hw->fifo_lock);
> +	if (!(Q->fifobar[(Q->tail + 1) & Q->imask] & ENTRY_MASK_O)) {
> +		Q->fifobar[Q->tail & Q->imask] |=
> +			((entry & ENTRY_MASK_NOSTATE) | Q->merge);
> +		Q->tail += 1;
> +		ret = 1;
> +	}
> +	spin_unlock(&hw->fifo_lock);
> +
> +	return ret;
> +}

Is writing to Q->fifobar (u64 *) endian-safe?

-- 
Heikki Orsila
heikki.orsila@iki.fi
http://www.iki.fi/shd

  parent reply	other threads:[~2008-06-12 19:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-12 18:23 David Altobelli
2008-06-12 18:34 ` 2.6.26-rc5: CFI: Found no ck804xrom @ffc00000 device at location zero John Stoffel
2008-06-12 20:25   ` Jean Delvare
2008-06-13  2:51     ` John Stoffel
2008-06-13 19:39     ` John Stoffel
2008-06-12 18:37 ` [PATCH] HP iLO driver H. Peter Anvin
2008-06-12 19:37   ` Altobelli, David
2008-06-12 21:05     ` H. Peter Anvin
2008-06-13  8:30       ` Michael Tokarev
2008-06-13 13:54         ` Altobelli, David
2008-06-12 20:13   ` Marcel Holtmann
2008-06-12 21:06     ` H. Peter Anvin
2008-06-12 19:04 ` Heikki Orsila [this message]
2008-06-12 20:16   ` Altobelli, David
2008-06-16 14:07 David Altobelli
2008-07-01  6:01 ` Andrew Morton
2008-07-01 21:01   ` Altobelli, David

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=20080612190405.GR31039@zakalwe.fi \
    --to=shdl@zakalwe.fi \
    --cc=david.altobelli@hp.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®