From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Keir Fraser <keir@xen.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH 1/3] spinlock: use local_irq_disable() instead of local_irq_save() where possible
Date: Fri, 9 Jan 2015 11:02:06 -0500 [thread overview]
Message-ID: <20150109160206.GF2726@l.oracle.com> (raw)
In-Reply-To: <54AEBA9F0200007800052C91@mail.emea.novell.com>
On Thu, Jan 08, 2015 at 04:13:03PM +0000, Jan Beulich wrote:
> ... as generally being a cheaper operation.
I was wondering if it would be possible to change some of the
EFLAGS after when we go in the 'cpu_relax' - and an interrupt
happens, we process it, alter the EFLAGS, then when we are
done, the EFLAGS are different - which the original code would
save when it was done sitting on the cpu_relax() loop.
Actually that sounds bad - we only want to restore the flags
that we had when going in this spin lock. Would make sense
to add an ASSERT to check for flags being different from the
EFLAGS?
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -162,7 +162,7 @@ unsigned long _spin_lock_irqsave(spinloc
> local_irq_restore(flags);
> while ( likely(_raw_spin_is_locked(&lock->raw)) )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> LOCK_PROFILE_GOT;
> preempt_disable();
> @@ -313,7 +313,7 @@ unsigned long _read_lock_irqsave(rwlock_
> local_irq_restore(flags);
> while ( (x = lock->lock) & RW_WRITE_FLAG )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> } while ( cmpxchg(&lock->lock, x, x+1) != x );
> preempt_disable();
> @@ -409,7 +409,7 @@ unsigned long _write_lock_irqsave(rwlock
> local_irq_restore(flags);
> while ( (x = lock->lock) & RW_WRITE_FLAG )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> } while ( cmpxchg(&lock->lock, x, x|RW_WRITE_FLAG) != x );
> while ( x != 0 )
>
>
>
> spinlock: use local_irq_disable() instead of local_irq_save() where possible
>
> ... as generally being a cheaper operation.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -162,7 +162,7 @@ unsigned long _spin_lock_irqsave(spinloc
> local_irq_restore(flags);
> while ( likely(_raw_spin_is_locked(&lock->raw)) )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> LOCK_PROFILE_GOT;
> preempt_disable();
> @@ -313,7 +313,7 @@ unsigned long _read_lock_irqsave(rwlock_
> local_irq_restore(flags);
> while ( (x = lock->lock) & RW_WRITE_FLAG )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> } while ( cmpxchg(&lock->lock, x, x+1) != x );
> preempt_disable();
> @@ -409,7 +409,7 @@ unsigned long _write_lock_irqsave(rwlock
> local_irq_restore(flags);
> while ( (x = lock->lock) & RW_WRITE_FLAG )
> cpu_relax();
> - local_irq_save(flags);
> + local_irq_disable();
> }
> } while ( cmpxchg(&lock->lock, x, x|RW_WRITE_FLAG) != x );
> while ( x != 0 )
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-01-09 16:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 16:00 [PATCH 0/3] XSA-114 follow-ups Jan Beulich
2015-01-08 16:13 ` [PATCH 1/3] spinlock: use local_irq_disable() instead of local_irq_save() where possible Jan Beulich
2015-01-09 16:02 ` Konrad Rzeszutek Wilk [this message]
2015-01-09 16:09 ` Jan Beulich
2015-01-09 16:09 ` Andrew Cooper
2015-01-09 16:27 ` Konrad Rzeszutek Wilk
2015-01-08 16:13 ` [PATCH 2/3] rwlock: allow arch to override read_unlock() atomic Jan Beulich
2015-01-08 16:14 ` [PATCH 3/3] rwlock: allow arch to override write_unlock() atomic Jan Beulich
2015-01-08 16:28 ` [PATCH 0/3] XSA-114 follow-ups Tim Deegan
2015-01-09 10:23 ` Andrew Cooper
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=20150109160206.GF2726@l.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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.