linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Fix some 4-byte vs. 8-byte alignment issues in atomic bit operations
@ 2019-11-25 19:43 Fenghua Yu
  2019-11-25 19:43 ` [PATCH v2 1/4] drivers/net/b44: Change to non-atomic " Fenghua Yu
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Fenghua Yu @ 2019-11-25 19:43 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H Peter Anvin,
	Andy Lutomirski, Peter Zijlstra, David Laight, Ashok Raj,
	Tony Luck, Ravi V Shankar
  Cc: linux-kernel, x86, Fenghua Yu

A split lock is an unaligned atomic operation that spans two cache
lines. The split lock access needs to hold bus lock and will
degrade performance.

Accessing one split lock long can take over one thousand extra cycles
than atomically accessing one unaligned long within one cache line.
And while the split lock access holds the bus lock, any other
memory accesses are not allowed and the overall memory access performance
is degraded.

Because badly performance impact by split lock, this patch series
solve the split lock issues instead of other alignment issues.

These parts are all simple fixes which are a necessary pre-cursor 
before we can enable #AC traps for split lock access. But they 
are also worthwhile performance fixes in their own right. So 
no sense in holding them back while we discuss the merits of 
the rest of the series. 

The alignment issues may be fixed by changing the atomic bit operations
APIs e.g. new set_bit_32() for 4-byte alignment. But the fixes will
be complex because they touch a lot of call sites and architectures.

Change Log:
v2:
- Remove patch 1 and 3 in v1 because they are in the tip tree already.
- Add new patches 2-4 per David Laight's comments:
https://lore.kernel.org/lkml/e7c75de9191847ed98c573f9ad871518@AcuMS.aculab.com/
Running "grep -r --include '*.[ch]' '_bit([^(]*, *([^)]*\*)' ."
returns about 200 results. Most of them don't have split lock issues.

Fenghua Yu (3):
  xen-pcifront: Align address of flags to size of unsigned long
  mtd: rawnand: fsmc: Change to non-atomic bit operations
  x86/mce: Force alignment for atomic bit operations

Peter Zijlstra (1):
  drivers/net/b44: Change to non-atomic bit operations

 arch/x86/include/asm/mce.h          | 3 ++-
 drivers/mtd/nand/raw/fsmc_nand.c    | 4 ++--
 drivers/net/ethernet/broadcom/b44.c | 4 ++--
 include/xen/interface/io/pciif.h    | 7 +++++--
 4 files changed, 11 insertions(+), 7 deletions(-)

-- 
2.19.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-12-04 15:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).