mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghua.yu@intel.com>
To: "Jürgen Groß" <jgross@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	H Peter Anvin <hpa@zytor.com>, Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	David Laight <David.Laight@ACULAB.COM>,
	Ashok Raj <ashok.raj@intel.com>, Tony Luck <tony.luck@intel.com>,
	Ravi V Shankar <ravi.v.shankar@intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>, x86 <x86@kernel.org>
Subject: Re: [PATCH v2 2/4] xen-pcifront: Align address of flags to size of unsigned long
Date: Mon, 2 Dec 2019 14:29:02 -0800	[thread overview]
Message-ID: <20191202222902.GB220960@romley-ivt3.sc.intel.com> (raw)
In-Reply-To: <e236e8fe-3a81-e17a-2286-228bfde9919a@suse.com>

On Tue, Nov 26, 2019 at 11:02:13AM +0100, Jürgen Groß wrote:
> On 25.11.19 20:43, Fenghua Yu wrote:
> >The address of "flags" is passed to atomic bitops which require the 
> >address is aligned to size of unsigned long.
> >
> >Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> ---
> >  include/xen/interface/io/pciif.h | 7 +++++-- 1 file changed, 5 
> >  insertions(+), 2 deletions(-)
> >
> >diff --git a/include/xen/interface/io/pciif.h 
> >b/include/xen/interface/io/pciif.h index d9922ae36eb5..639d5fb484a3 
> >100644 --- a/include/xen/interface/io/pciif.h +++ 
> >b/include/xen/interface/io/pciif.h @@ -103,8 +103,11 @@ struct 
> >xen_pcie_aer_op {
> >  	uint32_t devfn;
> >  };
> >  struct xen_pci_sharedinfo { - /* flags - XEN_PCIF_* */ - uint32_t 
> >flags; + /* flags - XEN_PCIF_*. Force alignment for atomic bit 
> >operations. */ + union { + uint32_t flags; + unsigned long 
> >flags_alignment; + };
> >  	struct xen_pci_op op; struct xen_pcie_aer_op aer_op;
> >  };
> >
> 
> NAK.
> 
> This is an interface definition for communication between Xen dom0 and 
> guests via shared memory. It can't be changed.
> 
> BTW: you should Cc: the maintainers for the files you are modifying.
> 
> 
> Juergen

After spending more time on the patch, actually I find this patch is not 
needed because there is no split lock issue on the "flags" field:

The bit offsets in all atomic bitops on the "flags" field are always 
constant values. On x86, an atomic bitop is optimized to use a locked byte
instruciton which only operates the byte containing the bit. So the
byte won't across cache line boundaries and there won't be split lock
issue in the atomic bitops

I will remove this patch in the next version of the patch set.

Thanks.

-Fenghua


  parent reply	other threads:[~2019-12-02 22:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-25 19:43 [PATCH v2 0/4] Fix some 4-byte vs. 8-byte alignment issues in atomic bit operations Fenghua Yu
2019-11-25 19:43 ` [PATCH v2 1/4] drivers/net/b44: Change to non-atomic " Fenghua Yu
2019-11-26  9:49   ` David Laight
2019-12-04 15:19     ` Peter Zijlstra
2019-11-25 19:43 ` [PATCH v2 2/4] xen-pcifront: Align address of flags to size of unsigned long Fenghua Yu
2019-11-26  9:53   ` David Laight
2019-11-26 10:02   ` Jürgen Groß
2019-12-02 18:28     ` Luck, Tony
2019-12-02 22:29     ` Fenghua Yu [this message]
2019-11-25 19:43 ` [PATCH v2 3/4] mtd: rawnand: fsmc: Change to non-atomic bit operations Fenghua Yu
2019-12-04 15:28   ` Peter Zijlstra
2019-11-25 19:43 ` [PATCH v2 4/4] x86/mce: Force alignment for atomic " Fenghua Yu
2019-11-26 10:13 ` [PATCH v2 0/4] Fix some 4-byte vs. 8-byte alignment issues in " David Laight

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=20191202222902.GB220960@romley-ivt3.sc.intel.com \
    --to=fenghua.yu@intel.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=ashok.raj@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@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®