Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp910211imb; Fri, 1 Mar 2019 18:55:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyVjVGlqwR6Eu4HYWoyErHfEvUukK7+M9C9kHqkg8VvxMQ58SXSJ82Q/BHKgNLLaAmnjvIT X-Received: by 2002:a17:902:284b:: with SMTP id e69mr8623955plb.11.1551495325407; Fri, 01 Mar 2019 18:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551495325; cv=none; d=google.com; s=arc-20160816; b=ZktNCe+RhYva4AlR6XmPPqIdnMSzjeuexvKIhM48GU79aDw78Bha6n2S7ifV0S+ghx CTuxkCK2xKc8xTenIBpAw+0pk+/dDGv1tiDkrx2t+2uk+5vl/n+082Zxi3VrxZSM4zpC zFUD12xEgc1wdFhkpFQfI/2DTrbuxba5TEnFObi+XUhHhpQRLeqo4qGBrZ7wUGFiC+Dw QE2J0GIc7BVWfjy2pAghDsW3fVJF7I50UP8MLUhsRxAuAqcjRr/JtVOytZfFXJlEjHPu hIM2e51A/kkRKR1F671QvjnRJc7fPsi5GvvaVt0dOKfZwykzVhJBYxvLlOGarAeizs1m S+3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=8AtQFcwStf21TsyqS3QLUuBrYmyVNtf5eccqHCS+U9E=; b=yNkQ2zJvtSQqjINUzjARmpWxSqwXqTcy+9i4+Zp65CMQYJk9tBOhlMv2yDlHfmOFo8 Izdz1+tjIBkLvDVXfFJoUbwYMuH0WgQ5plQdIBrRqhVjPraPpLFxS6Cw2IEQC8wYzZm8 J4PPS1fm32OVO6UvNxBJE8VBqBQGK8XoIa0yCdSZ66CczAdWrY1PKq+aYBopwmuaLbAm q8p72O7GHJFvOHEoE5VowQenaxU8c65OSJA/wecsVNrHqF37h7IolXd/HZ/OCkDba86b 8sYEGDH9HluNeJW9+5Jy1TLb0I/Vz6C+PHwnHWWjFSkIuY24bX7YlddHLb09Db260Ify ehpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t15si20917895pgv.503.2019.03.01.18.55.10; Fri, 01 Mar 2019 18:55:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728310AbfCBCyB (ORCPT + 99 others); Fri, 1 Mar 2019 21:54:01 -0500 Received: from mga09.intel.com ([134.134.136.24]:61571 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbfCBCwa (ORCPT ); Fri, 1 Mar 2019 21:52:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2019 18:52:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,430,1544515200"; d="scan'208";a="148572595" Received: from romley-ivt3.sc.intel.com ([172.25.110.60]) by fmsmga004.fm.intel.com with ESMTP; 01 Mar 2019 18:52:28 -0800 From: 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 " Cc: "linux-kernel" , "x86" , kvm@vger.kernel.org, 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> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> References: <1551494711-213533-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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