From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fenghua Yu Subject: [PATCH v4 03/17] wlcore: Align reg_ch_conf_pending and tmp_ch_bitmap to unsigned long for better performance Date: Fri, 1 Mar 2019 18:44:57 -0800 Message-ID: <1551494711-213533-4-git-send-email-fenghua.yu@intel.com> References: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> Cc: "linux-kernel" , "x86" , kvm@vger.kernel.org, Fenghua Yu To: "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H Peter Anvin" , "Paolo Bonzini" , "Dave Hansen" , "Ashok Raj" , "Peter Zijlstra" , "Ravi V Shankar" , "Xiaoyao Li " Return-path: In-Reply-To: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org A bit in reg_ch_conf_pending in wl271 and tmp_ch_bitmap is set atomically by set_bit(). set_bit() sets the bit in a single unsigned long location. If the variables are not aligned to unsigned long, set_bit() accesses two cache lines and thus causes slower performance. On x86, this scenario is called split lock and can cause overall performance degradation due to locked BTSL instruction in set_bit() locks bus. To avoid performance degradation, the two variables are aligned to unsigned long. Signed-off-by: Fenghua Yu --- drivers/net/wireless/ti/wlcore/cmd.c | 3 ++- drivers/net/wireless/ti/wlcore/wlcore.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 903968735a74..8d15a6307d44 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -1707,7 +1707,8 @@ int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl) { struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL; int ret = 0, i, b, ch_bit_idx; - u32 tmp_ch_bitmap[2]; + /* Align to unsigned long for better performance in set_bit() */ + u32 tmp_ch_bitmap[2] __aligned(sizeof(unsigned long)); struct wiphy *wiphy = wl->hw->wiphy; struct ieee80211_supported_band *band; bool timeout = false; diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index dd14850b0603..92d878f01fa5 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -321,8 +321,10 @@ struct wl1271 { /* Reg domain last configuration */ u32 reg_ch_conf_last[2] __aligned(8); - /* Reg domain pending configuration */ - u32 reg_ch_conf_pending[2]; + /* Reg domain pending configuration. Aligned to unsigned long for + * better performane in set_bit(). + */ + u32 reg_ch_conf_pending[2] __aligned(sizeof(unsigned long)); /* Pointer that holds DMA-friendly block for the mailbox */ void *mbox; -- 2.7.4