[PATCH 07/41] staging: r8188eu: remove rtw_set_ie_secondary_ch_offset function

2016-08-24 Thread Ivan Safonov
Driver does not use this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 5 -
 drivers/staging/rtl8188eu/include/ieee80211.h  | 2 --
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 557832f8..13080d1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -166,11 +166,6 @@ inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 
ch_switch_mode,
return rtw_set_ie(buf, WLAN_EID_CHANNEL_SWITCH,  3, ie_data, buf_len);
 }
 
-inline u8 *rtw_set_ie_secondary_ch_offset(u8 *buf, u32 *buf_len, u8 
secondary_ch_offset)
-{
-   return rtw_set_ie(buf, WLAN_EID_SECONDARY_CHANNEL_OFFSET,  1, 
_ch_offset, buf_len);
-}
-
 inline u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,
u8 flags, u16 reason, u16 precedence)
 {
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index ba634df..d957caa 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1098,8 +1098,6 @@ enum secondary_ch_offset {
 };
 u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
 u8 new_ch, u8 ch_switch_cnt);
-u8 *rtw_set_ie_secondary_ch_offset(u8 *buf, u32 *buf_len,
-  u8 secondary_ch_offset);
 u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,
   u8 flags, u16 reason, u16 precedence);
 
-- 
2.7.3



[PATCH 30/41] staging: r8188eu: remove some structure definitions from include/ieee80211.h

2016-08-24 Thread Ivan Safonov
ieee_ibss_seq, rtw_ieee80211_hdr_qos, eapol, ieee80211_rx_stats,
ieee80211_frag_entry, ieee80211_stats, ieee80211_softmac_stats,
ieee80211_security, ieee80211_header_data, ieee80211_info_element_hdr,
ieee80211_info_element, ieee80211_authentication, ieee80211_probe_response,
ieee80211_probe_request, ieee80211_assoc_request_frame,
ieee80211_assoc_response_frame structures are not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/ieee80211.h | 196 --
 1 file changed, 196 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index b57f5d7..37a6f9d 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -291,14 +291,6 @@ struct sta_data {
 /* this is stolen from ipw2200 driver */
 #define IEEE_IBSS_MAC_HASH_SIZE 31
 
-struct ieee_ibss_seq {
-   u8 mac[ETH_ALEN];
-   u16 seq_num;
-   u16 frag_num;
-   unsigned long packet_time;
-   struct list_head list;
-};
-
 struct rtw_ieee80211_hdr {
__le16 frame_ctl;
__le16 duration_id;
@@ -318,17 +310,6 @@ struct rtw_ieee80211_hdr_3addr {
u16 seq_ctl;
 } __packed;
 
-struct rtw_ieee80211_hdr_qos {
-   __le16 frame_ctl;
-   __le16 duration_id;
-   u8 addr1[ETH_ALEN];
-   u8 addr2[ETH_ALEN];
-   u8 addr3[ETH_ALEN];
-   u16 seq_ctl;
-   u8 addr4[ETH_ALEN];
-   u16 qc;
-}  __packed;
-
 struct rtw_ieee80211_hdr_3addr_qos {
__le16 frame_ctl;
__le16 duration_id;
@@ -339,14 +320,6 @@ struct rtw_ieee80211_hdr_3addr_qos {
u16 qc;
 }  __packed;
 
-struct eapol {
-   u8 snap[6];
-   u16 ethertype;
-   u8 version;
-   u8 type;
-   u16 length;
-} __packed;
-
 enum eap_type {
EAP_PACKET = 0,
EAPOL_START,
@@ -552,83 +525,12 @@ struct ieee80211_snap_hdr {
 #define IEEE80211_NUM_CCK_RATES4
 #define IEEE80211_OFDM_SHIFT_MASK_A4
 
-/* NOTE: This data is for statistical purposes; not all hardware provides this
- *   information for frames received.  Not setting these will not cause
- *   any adverse affects. */
-struct ieee80211_rx_stats {
-   /* u32 mac_time[2]; */
-   s8 rssi;
-   u8 signal;
-   u8 noise;
-   u8 received_channel;
-   u16 rate; /* in 100 kbps */
-   /* u8 control; */
-   u8 mask;
-   u8 freq;
-   u16 len;
-};
-
 /* IEEE 802.11 requires that STA supports concurrent reception of at least
  * three fragmented frames. This define can be increased to support more
  * concurrent frames, but it should be noted that each entry can consume about
  * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
 #define IEEE80211_FRAG_CACHE_LEN 4
 
-struct ieee80211_frag_entry {
-   u32 first_frag_time;
-   uint seq;
-   uint last_frag;
-   uint qos;   /* jackson */
-   uint tid;   /* jackson */
-   struct sk_buff *skb;
-   u8 src_addr[ETH_ALEN];
-   u8 dst_addr[ETH_ALEN];
-};
-
-struct ieee80211_stats {
-   uint tx_unicast_frames;
-   uint tx_multicast_frames;
-   uint tx_fragments;
-   uint tx_unicast_octets;
-   uint tx_multicast_octets;
-   uint tx_deferred_transmissions;
-   uint tx_single_retry_frames;
-   uint tx_multiple_retry_frames;
-   uint tx_retry_limit_exceeded;
-   uint tx_discards;
-   uint rx_unicast_frames;
-   uint rx_multicast_frames;
-   uint rx_fragments;
-   uint rx_unicast_octets;
-   uint rx_multicast_octets;
-   uint rx_fcs_errors;
-   uint rx_discards_no_buffer;
-   uint tx_discards_wrong_sa;
-   uint rx_discards_undecryptable;
-   uint rx_message_in_msg_fragments;
-   uint rx_message_in_bad_msg_fragments;
-};
-
-struct ieee80211_softmac_stats {
-   uint rx_ass_ok;
-   uint rx_ass_err;
-   uint rx_probe_rq;
-   uint tx_probe_rs;
-   uint tx_beacons;
-   uint rx_auth_rq;
-   uint rx_auth_rs_ok;
-   uint rx_auth_rs_err;
-   uint tx_auth_rq;
-   uint no_auth_rs;
-   uint no_ass_rs;
-   uint tx_ass_rq;
-   uint rx_ass_rq;
-   uint tx_probe_rq;
-   uint reassoc;
-   uint swtxstop;
-   uint swtxawake;
-};
-
 #define SEC_KEY_1  (1<<0)
 #define SEC_KEY_2  (1<<1)
 #define SEC_KEY_3  (1<<2)
@@ -648,42 +550,6 @@ struct ieee80211_softmac_stats {
 #define WEP_KEYS 4
 #define WEP_KEY_LEN 13
 
-struct ieee80211_security {
-   u16 active_key:2,
-   enabled:1,
-   auth_mode:2,
-   auth_algo:4,
-   unicast_uses_group:1;
-   u8 key_sizes[WEP_KEYS];
-   u8 keys[WEP_KEYS][WEP_KEY_LEN];
-   u8 level;
-   u16 flags;
-} __packed;
-
-/*
-
- 802.11 data frame from AP
-
-  ,---.
-Bytes |  2   |  2   |6|6|6|  2   | 0..2312 |   4  |
-  

[PATCH 24/41] staging: r8188eu: replace HT_caps_element with ieee80211_ht_cap structure

2016-08-24 Thread Ivan Safonov
HT_caps_element is reimplementation of ieee80211_ht_cap.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c  | 10 -
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c   |  6 +++---
 drivers/staging/rtl8188eu/core/rtw_mlme.c| 12 +--
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c| 22 +--
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c   | 27 
 drivers/staging/rtl8188eu/include/rtw_mlme_ext.h |  6 +++---
 6 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index be4d624..3562f11 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -706,12 +706,12 @@ static void update_hw_ht_param(struct adapter *padapter)
 
/* handle A-MPDU parameter field */
/*
-   AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
-   AMPDU_para [4:2]:Min MPDU Start Spacing
+   ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 
3:64k
+   ampdu_params_info [4:2]:Min MPDU Start Spacing
*/
-   max_AMPDU_len = pmlmeinfo->HT_caps.AMPDU_para & 0x03;
+   max_AMPDU_len = pmlmeinfo->HT_caps.ampdu_params_info & 0x03;
 
-   min_MPDU_spacing = (pmlmeinfo->HT_caps.AMPDU_para & 0x1c) >> 2;
+   min_MPDU_spacing = (pmlmeinfo->HT_caps.ampdu_params_info & 0x1c) >> 2;
 
rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 
*)(_MPDU_spacing));
 
@@ -720,7 +720,7 @@ static void update_hw_ht_param(struct adapter *padapter)
/*  */
/*  Config SM Power Save setting */
/*  */
-   pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & 
0x0C) >> 2;
+   pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & 0x0C) >> 
2;
if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC)
DBG_88E("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __func__);
 }
diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index a830752..6ed23f4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -588,8 +588,8 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
/* cur_bwmod is updated by beacon, pmlmeinfo is updated 
by association response */
bw_40MHz = (pmlmeext->cur_bwmode && 
(HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1 : 0;
 
-   short_GI_20 = 
(le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 
0;
-   short_GI_40 = 
(le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 
0;
+   short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) 
& IEEE80211_HT_CAP_SGI_20) ? 1 : 0;
+   short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) 
& IEEE80211_HT_CAP_SGI_40) ? 1 : 0;
 
rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 
*)(_type));
max_rate = rtw_mcs_rate(
@@ -597,7 +597,7 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
bw_40MHz & (pregistrypriv->cbw40_enable),
short_GI_20,
short_GI_40,
-   pmlmeinfo->HT_caps.MCS_rate
+   pmlmeinfo->HT_caps.mcs.rx_mask
);
}
} else {
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 03baaa1..a16d951 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -1971,8 +1971,8 @@ unsigned int rtw_restructure_ht_ie(struct adapter 
*padapter, u8 *in_ie, u8 *out_
rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, 
_recvbuf_sz);
 
/*
-   AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k
-   AMPDU_para [4:2]:Min MPDU Start Spacing
+   ampdu_params_info [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 
3:64k
+   ampdu_params_info [4:2]:Min MPDU Start Spacing
*/
 
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, 
_rx_ampdu_factor);
@@ -2044,7 +2044,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, 
uint ie_len)
 
/* update cur_bwmode & cur_ch_offset */
if ((pregistrypriv->cbw40_enable) &&
-   (le16_to_cpu(pmlmeinfo->HT_caps.HT_caps_info) & BIT(1)) &&
+   (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & BIT(1)) &&
(pmlmeinfo->HT_info.infos[0] & BIT(2))) {
int i;
u8  rf_type;
@@ -2054,9 +2054,9 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, 

[PATCH 10/41] staging: r8188eu: remove dump_ies function

2016-08-24 Thread Ivan Safonov
Driver does not use this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 16 
 drivers/staging/rtl8188eu/include/ieee80211.h  |  1 -
 2 files changed, 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index a54dafa..1df25ff 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -952,22 +952,6 @@ void rtw_macaddr_cfg(u8 *mac_addr)
DBG_88E("rtw_macaddr_cfg MAC Address  = %pM\n", (mac_addr));
 }
 
-void dump_ies(u8 *buf, u32 buf_len)
-{
-   u8 *pos = buf;
-   u8 id, len;
-
-   while (pos - buf <= buf_len) {
-   id = *pos;
-   len = *(pos + 1);
-
-   DBG_88E("%s ID:%u, LEN:%u\n", __func__, id, len);
-   dump_wps_ie(pos, len);
-
-   pos += (2 + len);
-   }
-}
-
 void dump_wps_ie(u8 *ie, u32 ie_len)
 {
u8 *pos = ie;
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 4a8504d..79ae555 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1131,7 +1131,6 @@ u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, 
u16 target_attr_id,
for (ie = (void *)buf; (((u8 *)ie) - ((u8 *)buf) + 1) < buf_len;
\
ie = (void *)(((u8 *)ie) + *(((u8 *)ie)+1) + 2))
 
-void dump_ies(u8 *buf, u32 buf_len);
 void dump_wps_ie(u8 *ie, u32 ie_len);
 
 uint   rtw_get_rateset_len(u8  *rateset);
-- 
2.7.3



[PATCH 16/41] staging: r8188eu: replace rtw_ieee80211_ht_cap with ieee80211_ht_cap type in translate_scan function

2016-08-24 Thread Ivan Safonov
rtw_ieee80211_ht_cap is reimplementation of the ieee80211_ht_cap.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 5672f01..a2b3552 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -132,12 +132,15 @@ static char *translate_scan(struct adapter *padapter,
p = rtw_get_ie(>network.IEs[12], _HT_CAPABILITY_IE_, 
_ielen, pnetwork->network.IELength-12);
 
if (p && ht_ielen > 0) {
-   struct rtw_ieee80211_ht_cap *pht_capie;
+   struct ieee80211_ht_cap *pht_capie;
ht_cap = true;
-   pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2);
-   memcpy(_rate, pht_capie->supp_mcs_set, 2);
-   bw_40MHz = (pht_capie->cap_info_HT_CAP_SUP_WIDTH) ? 1 
: 0;
-   short_GI = 
(pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0;
+   pht_capie = (struct ieee80211_ht_cap *)(p + 2);
+   memcpy(_rate, pht_capie->mcs.rx_mask, 2);
+   bw_40MHz = !!(le16_to_cpu(pht_capie->cap_info) &
+ IEEE80211_HT_CAP_SUP_WIDTH);
+   short_GI = !!(le16_to_cpu(pht_capie->cap_info) &
+ (IEEE80211_HT_CAP_SGI_20 |
+  IEEE80211_HT_CAP_SGI_40));
}
 
/* Add the protocol name */
-- 
2.7.3



Re: [PATCH 1/2] clk: mvebu: set flags in CP110 gate clock

2016-08-24 Thread Marcin Wojtas
HI Andrew,

2016-08-23 16:16 GMT+02:00 Andrew Lunn :
> On Tue, Aug 23, 2016 at 08:26:48AM +0200, Marcin Wojtas wrote:
>> Armada CP110 system controller comprise its own routine responsble
>> for registering gate clocks. Among others 'flags' field in
>> struct clk_init_data was not set, using a random values, which
>> may cause an unpredicted behavior.
>>
>> This patch fixes the problem by setting CLK_IS_BASIC flag for
>> all gated clocks of Armada 7k/8k SoCs family.
>>
>> Fixes: d3da3eaef7f4 ("clk: mvebu: new driver for Armada CP110 system ...")
>>
>> Signed-off-by: Marcin Wojtas 
>> ---
>>  drivers/clk/mvebu/cp110-system-controller.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/clk/mvebu/cp110-system-controller.c 
>> b/drivers/clk/mvebu/cp110-system-controller.c
>> index 7fa42d6..0835e1d 100644
>> --- a/drivers/clk/mvebu/cp110-system-controller.c
>> +++ b/drivers/clk/mvebu/cp110-system-controller.c
>> @@ -144,6 +144,7 @@ static struct clk *cp110_register_gate(const char *name,
>>
>>   init.name = name;
>>   init.ops = _gate_ops;
>> + init.flags = CLK_IS_BASIC;
>>   init.parent_names = _name;
>>   init.num_parents = 1;
>
> Hi Marcin
>
> How about adding a memset for init? That would also help if new fields
> every get added to clk_init_data.
>

Sure, it can be added.

Best regards,
Marcin


[tip:perf/core] perf bench numa: Use NSEC_PER_U?SEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  a8ad8329b91551bbfc3a317f3655dffcd8c18591
Gitweb: http://git.kernel.org/tip/a8ad8329b91551bbfc3a317f3655dffcd8c18591
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 11:55:38 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf bench numa: Use NSEC_PER_U?SEC

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-7vnv15263y50qku76p4w5...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bench/numa.c | 53 +
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index f7f5300..8efe904 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1004,7 +1005,7 @@ static void calc_convergence(double runtime_ns_max, 
double *convergence)
if (strong && process_groups == g->p.nr_proc) {
if (!*convergence) {
*convergence = runtime_ns_max;
-   tprintf(" (%6.1fs converged)\n", *convergence/1e9);
+   tprintf(" (%6.1fs converged)\n", *convergence / 
NSEC_PER_SEC);
if (g->p.measure_convergence) {
g->all_converged = true;
g->stop_work = true;
@@ -1012,7 +1013,7 @@ static void calc_convergence(double runtime_ns_max, 
double *convergence)
}
} else {
if (*convergence) {
-   tprintf(" (%6.1fs de-converged)", runtime_ns_max/1e9);
+   tprintf(" (%6.1fs de-converged)", runtime_ns_max / 
NSEC_PER_SEC);
*convergence = 0;
}
tprintf("\n");
@@ -1022,7 +1023,7 @@ static void calc_convergence(double runtime_ns_max, 
double *convergence)
 static void show_summary(double runtime_ns_max, int l, double *convergence)
 {
tprintf("\r #  %5.1f%%  [%.1f mins]",
-   (double)(l+1)/g->p.nr_loops*100.0, runtime_ns_max/1e9 / 60.0);
+   (double)(l+1)/g->p.nr_loops*100.0, runtime_ns_max / 
NSEC_PER_SEC / 60.0);
 
calc_convergence(runtime_ns_max, convergence);
 
@@ -1179,8 +1180,8 @@ static void *worker_thread(void *__tdata)
 
if (details >= 3) {
timersub(, , );
-   runtime_ns_max = diff.tv_sec * 10;
-   runtime_ns_max += diff.tv_usec * 1000;
+   runtime_ns_max = diff.tv_sec * NSEC_PER_SEC;
+   runtime_ns_max += diff.tv_usec * NSEC_PER_USEC;
 
if (details >= 0) {
printf(" #%2d / %2d: %14.2lf nsecs/op [val: 
%016"PRIx64"]\n",
@@ -1192,23 +1193,23 @@ static void *worker_thread(void *__tdata)
continue;
 
timersub(, , );
-   runtime_ns_max = diff.tv_sec * 10ULL;
-   runtime_ns_max += diff.tv_usec * 1000ULL;
+   runtime_ns_max = diff.tv_sec * NSEC_PER_SEC;
+   runtime_ns_max += diff.tv_usec * NSEC_PER_USEC;
 
show_summary(runtime_ns_max, l, );
}
 
gettimeofday(, NULL);
timersub(, , );
-   td->runtime_ns = diff.tv_sec * 10ULL;
-   td->runtime_ns += diff.tv_usec * 1000ULL;
-   td->speed_gbs = bytes_done / (td->runtime_ns / 1e9) / 1e9;
+   td->runtime_ns = diff.tv_sec * NSEC_PER_SEC;
+   td->runtime_ns += diff.tv_usec * NSEC_PER_USEC;
+   td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9;
 
getrusage(RUSAGE_THREAD, );
-   td->system_time_ns = rusage.ru_stime.tv_sec * 10ULL;
-   td->system_time_ns += rusage.ru_stime.tv_usec * 1000ULL;
-   td->user_time_ns = rusage.ru_utime.tv_sec * 10ULL;
-   td->user_time_ns += rusage.ru_utime.tv_usec * 1000ULL;
+   td->system_time_ns = rusage.ru_stime.tv_sec * NSEC_PER_SEC;
+   td->system_time_ns += rusage.ru_stime.tv_usec * NSEC_PER_USEC;
+   td->user_time_ns = rusage.ru_utime.tv_sec * NSEC_PER_SEC;
+   td->user_time_ns += rusage.ru_utime.tv_usec * NSEC_PER_USEC;
 
free_data(thread_data, g->p.bytes_thread);
 
@@ -1469,7 +1470,7 @@ static int __bench_numa(const char *name)
}
/* Wait for all the threads to start up: */
while (g->nr_tasks_started != g->p.nr_tasks)
-   usleep(1000);
+   usleep(USEC_PER_MSEC);
 
BUG_ON(g->nr_tasks_started != g->p.nr_tasks);
 
@@ -1488,9 +1489,9 @@ static int 

[tip:perf/core] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  bd48c63eb0afc28b29fb342f215cdd77b995c02e
Gitweb: http://git.kernel.org/tip/bd48c63eb0afc28b29fb342f215cdd77b995c02e
Author: Arnaldo Carvalho de Melo 
AuthorDate: Fri, 5 Aug 2016 15:40:30 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros

And remove it from tools/perf/{perf,util}.h, making code that needs
these macros to include linux/time64.h instead, to match how this is
used in the kernel sources.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-e69fc1pvkgt57yvxqt6eu...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/include/linux/time64.h   | 12 
 tools/perf/MANIFEST|  1 +
 tools/perf/builtin-kvm.c   |  1 +
 tools/perf/builtin-script.c|  7 ---
 tools/perf/builtin-stat.c  |  7 ---
 tools/perf/builtin-trace.c |  1 +
 tools/perf/perf.h  |  7 ---
 tools/perf/util/debug.c| 10 --
 tools/perf/util/scripting-engines/trace-event-perl.c   |  5 +++--
 tools/perf/util/scripting-engines/trace-event-python.c |  5 +++--
 tools/perf/util/util.c |  1 +
 tools/perf/util/util.h |  4 
 12 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/tools/include/linux/time64.h b/tools/include/linux/time64.h
new file mode 100644
index 000..df92654
--- /dev/null
+++ b/tools/include/linux/time64.h
@@ -0,0 +1,12 @@
+#ifndef _TOOLS_LINUX_TIME64_H
+#define _TOOLS_LINUX_TIME64_H
+
+#define MSEC_PER_SEC   1000L
+#define USEC_PER_MSEC  1000L
+#define NSEC_PER_USEC  1000L
+#define NSEC_PER_MSEC  100L
+#define USEC_PER_SEC   100L
+#define NSEC_PER_SEC   10L
+#define FSEC_PER_SEC   1000LL
+
+#endif /* _LINUX_TIME64_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ad2534d..f23a5e7 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -77,4 +77,5 @@ tools/include/linux/stringify.h
 tools/include/linux/types.h
 tools/include/linux/err.h
 tools/include/linux/bitmap.h
+tools/include/linux/time64.h
 tools/arch/*/include/uapi/asm/perf_regs.h
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 5e2127e..a0040f7 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -24,6 +24,7 @@
 #include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c859e59..6b3c8b0 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@
 #include "util/thread-stack.h"
 #include 
 #include 
+#include 
 #include "asm/bug.h"
 #include "util/mem-events.h"
 
@@ -464,9 +465,9 @@ static void print_sample_start(struct perf_sample *sample,
 
if (PRINT_FIELD(TIME)) {
nsecs = sample->time;
-   secs = nsecs / NSECS_PER_SEC;
-   nsecs -= secs * NSECS_PER_SEC;
-   usecs = nsecs / NSECS_PER_USEC;
+   secs = nsecs / NSEC_PER_SEC;
+   nsecs -= secs * NSEC_PER_SEC;
+   usecs = nsecs / NSEC_PER_USEC;
if (nanosecs)
printf("%5lu.%09llu: ", secs, nsecs);
else
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3c7452b..e33a66b 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -65,6 +65,7 @@
 #include "util/group.h"
 #include "asm/bug.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -354,7 +355,7 @@ static void process_interval(void)
diff_timespec(, , _time);
 
if (STAT_RECORD) {
-   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + 
rs.tv_nsec, INTERVAL))
+   if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSEC_PER_SEC + 
rs.tv_nsec, INTERVAL))
pr_err("failed to write stat round event\n");
}
 
@@ -2175,8 +2176,8 @@ static int process_stat_round_event(struct perf_tool 
*tool __maybe_unused,
update_stats(_nsecs_stats, stat_round->time);
 
if (stat_config.interval && stat_round->time) {
-   tsh.tv_sec  = stat_round->time / NSECS_PER_SEC;
-   tsh.tv_nsec = stat_round->time % NSECS_PER_SEC;
+   tsh.tv_sec  = stat_round->time / NSEC_PER_SEC;
+   tsh.tv_nsec = stat_round->time % NSEC_PER_SEC;
ts = 
}
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 

[PATCH 12/16 v2] cpuidle: coupled: Convert to hotplug state machine

2016-08-24 Thread Sebastian Andrzej Siewior
Install the callbacks via the state machine.

Cc: "Rafael J. Wysocki" 
Cc: Daniel Lezcano 
Cc: linux...@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior 
---
v1…v2: - refactor the code to drop the out label.
   - make error path in cpuidle_coupled_init() simpler

 drivers/cpuidle/coupled.c  | 75 +++---
 include/linux/cpuhotplug.h |  1 +
 2 files changed, 32 insertions(+), 44 deletions(-)

diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index d5657d50ac40..5ba1a8913421 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -749,65 +749,52 @@ static void cpuidle_coupled_allow_idle(struct 
cpuidle_coupled *coupled)
put_cpu();
 }
 
-/**
- * cpuidle_coupled_cpu_notify - notifier called during hotplug transitions
- * @nb: notifier block
- * @action: hotplug transition
- * @hcpu: target cpu number
- *
- * Called when a cpu is brought on or offline using hotplug.  Updates the
- * coupled cpu set appropriately
- */
-static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
-   unsigned long action, void *hcpu)
+static int coupled_cpu_online(unsigned int cpu)
 {
-   int cpu = (unsigned long)hcpu;
struct cpuidle_device *dev;
 
-   switch (action & ~CPU_TASKS_FROZEN) {
-   case CPU_UP_PREPARE:
-   case CPU_DOWN_PREPARE:
-   case CPU_ONLINE:
-   case CPU_DEAD:
-   case CPU_UP_CANCELED:
-   case CPU_DOWN_FAILED:
-   break;
-   default:
-   return NOTIFY_OK;
-   }
-
mutex_lock(_lock);
 
dev = per_cpu(cpuidle_devices, cpu);
-   if (!dev || !dev->coupled)
-   goto out;
-
-   switch (action & ~CPU_TASKS_FROZEN) {
-   case CPU_UP_PREPARE:
-   case CPU_DOWN_PREPARE:
-   cpuidle_coupled_prevent_idle(dev->coupled);
-   break;
-   case CPU_ONLINE:
-   case CPU_DEAD:
+   if (dev && dev->coupled) {
cpuidle_coupled_update_online_cpus(dev->coupled);
-   /* Fall through */
-   case CPU_UP_CANCELED:
-   case CPU_DOWN_FAILED:
cpuidle_coupled_allow_idle(dev->coupled);
-   break;
}
 
-out:
mutex_unlock(_lock);
-   return NOTIFY_OK;
+   return 0;
 }
 
-static struct notifier_block cpuidle_coupled_cpu_notifier = {
-   .notifier_call = cpuidle_coupled_cpu_notify,
-};
+static int coupled_cpu_up_prepare(unsigned int cpu)
+{
+   struct cpuidle_device *dev;
+
+   mutex_lock(_lock);
+
+   dev = per_cpu(cpuidle_devices, cpu);
+   if (dev && dev->coupled)
+   cpuidle_coupled_prevent_idle(dev->coupled);
+
+   mutex_unlock(_lock);
+   return 0;
+}
 
 static int __init cpuidle_coupled_init(void)
 {
-   return register_cpu_notifier(_coupled_cpu_notifier);
+   int ret;
+
+   ret = cpuhp_setup_state_nocalls(CPUHP_CPUIDLE_COUPLED_PREPARE,
+   "CPUIDLE_COUPLED_PREPARE",
+   coupled_cpu_up_prepare,
+   coupled_cpu_online);
+   if (ret)
+   return ret;
+   ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+   "CPUIDLE_COUPLED_ONLINE",
+   coupled_cpu_online,
+   coupled_cpu_up_prepare);
+   if (ret < 0)
+   cpuhp_remove_state_nocalls(CPUHP_CPUIDLE_COUPLED_PREPARE);
+   return ret;
 }
 core_initcall(cpuidle_coupled_init);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 14b58a9d1450..965acec06d4e 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -30,6 +30,7 @@ enum cpuhp_state {
CPUHP_SLAB_PREPARE,
CPUHP_RCUTREE_PREP,
CPUHP_MD_RAID5_PREPARE,
+   CPUHP_CPUIDLE_COUPLED_PREPARE,
CPUHP_NOTIFY_PREPARE,
CPUHP_TIMERS_DEAD,
CPUHP_BRINGUP_CPU,
-- 
2.9.3



[tip:perf/core] perf hists: Add support for header span

2016-08-24 Thread tip-bot for Jiri Olsa
Commit-ID:  29659ab4e7d02c08d8f2d08db0b0f708bd8b6771
Gitweb: http://git.kernel.org/tip/29659ab4e7d02c08d8f2d08db0b0f708bd8b6771
Author: Jiri Olsa 
AuthorDate: Sun, 7 Aug 2016 17:28:30 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf hists: Add support for header span

Add span argument for header callback function.

The handling of this argument is completely in the hands of the
callback. The only thing the caller ensures is it's zeroed on the
beginning.

Omitting span skipping in hierarchy headers and gtk code.

The c2c code use this to span header lines based on the entries span
configuration.

Signed-off-by: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/1470583710-1649-6-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c  |  3 ++-
 tools/perf/ui/browsers/hists.c | 10 +++---
 tools/perf/ui/gtk/hists.c  |  2 +-
 tools/perf/ui/hist.c   |  3 ++-
 tools/perf/ui/stdio/hist.c | 13 -
 tools/perf/util/hist.h |  2 +-
 tools/perf/util/sort.c |  6 --
 7 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 75da965..9ff0db4 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1034,7 +1034,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, 
struct perf_hpp *hpp,
 
 static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
   struct hists *hists __maybe_unused,
-  int line __maybe_unused)
+  int line __maybe_unused,
+  int *span __maybe_unused)
 {
struct diff_hpp_fmt *dfmt =
container_of(fmt, struct diff_hpp_fmt, fmt);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 4a7aac8..22e48a3 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1514,6 +1514,7 @@ hists_browser__scnprintf_headers(struct hist_browser 
*browser, char *buf,
struct perf_hpp_fmt *fmt;
size_t ret = 0;
int column = 0;
+   int span = 0;
 
if (symbol_conf.use_callchain) {
ret = scnprintf(buf, size, "  ");
@@ -1525,10 +1526,13 @@ hists_browser__scnprintf_headers(struct hist_browser 
*browser, char *buf,
if (perf_hpp__should_skip(fmt, hists)  || column++ < 
browser->b.horiz_scroll)
continue;
 
-   ret = fmt->header(fmt, _hpp, hists, line);
+   ret = fmt->header(fmt, _hpp, hists, line, );
if (advance_hpp_check(_hpp, ret))
break;
 
+   if (span)
+   continue;
+
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
if (advance_hpp_check(_hpp, ret))
break;
@@ -1562,7 +1566,7 @@ static int 
hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
if (column++ < browser->b.horiz_scroll)
continue;
 
-   ret = fmt->header(fmt, _hpp, hists, 0);
+   ret = fmt->header(fmt, _hpp, hists, 0, NULL);
if (advance_hpp_check(_hpp, ret))
break;
 
@@ -1599,7 +1603,7 @@ static int 
hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
}
first_col = false;
 
-   ret = fmt->header(fmt, _hpp, hists, 0);
+   ret = fmt->header(fmt, _hpp, hists, 0, NULL);
dummy_hpp.buf[ret] = '\0';
 
start = trim(dummy_hpp.buf);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 79cb5c4..a4f02de 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, 
struct hists *hists,
strcat(buf, "+");
first_col = false;
 
-   fmt->header(fmt, , hists, 0);
+   fmt->header(fmt, , hists, 0, NULL);
strcat(buf, ltrim(rtrim(hpp.buf)));
}
}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 30457c6..b47fafc 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -230,7 +230,8 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 }
 
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
- struct hists *hists, int line __maybe_unused)
+ struct hists *hists, int line __maybe_unused,
+ int *span __maybe_unused)
 {
int len = 

Re: [PATCH V3] leds: trigger: Introduce an USB port trigger

2016-08-24 Thread Greg KH
On Wed, Aug 24, 2016 at 12:03:29AM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki 
> 
> This commit adds a new trigger responsible for turning on LED when USB
> device gets connected to the specified USB port. This can can useful for
> various home routers that have USB port(s) and a proper LED telling user
> a device is connected.
> 
> The trigger gets its documentation file but basically it just requires
> specifying USB port in a Linux format (e.g. echo 1-1 > new_port).
> 
> During work on this trigger there was a plan to add DT bindings for it,
> but there wasn't an agreement on the format yet. This can be worked on
> later, a sysfs interface is needed anyway for platforms not using DT.
> 
> Signed-off-by: Rafał Miłecki 
> ---
> V2: Trying to add DT support, idea postponed as it will take more time
> to discuss the bindings.
> V3: Fix typos in commit and Documentation (thanks Jacek!)
> Use "ports" sysfs file for adding and removing USB ports (thx Jacek)
> Check if there is USB device connected after adding new USB port
> Fix memory leak or two
> 
> Felipe: I'd like to ask for your Ack before having this patch pushed.
> ---
>  Documentation/leds/ledtrig-usbport.txt |  49 +++
>  drivers/leds/trigger/Kconfig   |   8 ++
>  drivers/leds/trigger/Makefile  |   1 +
>  drivers/leds/trigger/ledtrig-usbport.c | 253 
> +
>  4 files changed, 311 insertions(+)
>  create mode 100644 Documentation/leds/ledtrig-usbport.txt
>  create mode 100644 drivers/leds/trigger/ledtrig-usbport.c

You are adding sysfs files without adding a Documentation/ABI/ entry,
please never do that.

NAK.

greg k-h


[tip:perf/core] perf disassemble: Simplify logic for picking the filename to disassemble

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  3caee094d160b0ef92988099105e9a173a3805b0
Gitweb: http://git.kernel.org/tip/3caee094d160b0ef92988099105e9a173a3805b0
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 9 Aug 2016 15:16:37 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf disassemble: Simplify logic for picking the filename to disassemble

Lots of changes to support kcore, compressed modules, build-id files
left us with some spaguetti code, simplify it a bit, more to come.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-h70p7x451li3f2fhs44vz...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/annotate.c | 41 -
 1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9882bc6..8a99493 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1166,7 +1166,6 @@ int symbol__disassemble(struct symbol *sym, struct map 
*map, size_t privsize)
 {
struct dso *dso = map->dso;
char *filename;
-   bool free_filename = true;
char command[PATH_MAX * 2];
FILE *file;
char symfs_filename[PATH_MAX];
@@ -1183,31 +1182,30 @@ int symbol__disassemble(struct symbol *sym, struct map 
*map, size_t privsize)
goto out;
 
filename = dso__build_id_filename(dso, NULL, 0);
-   if (filename)
+   if (filename) {
symbol__join_symfs(symfs_filename, filename);
-
-   if (filename == NULL) {
+   free(filename);
+   } else {
if (dso->has_build_id)
return ENOMEM;
goto fallback;
-   } else if (dso__is_kcore(dso) ||
-  readlink(symfs_filename, command, sizeof(command)) < 0 ||
-  strstr(command, DSO__NAME_KALLSYMS) ||
-  access(symfs_filename, R_OK)) {
-   free(filename);
+   }
+
+   if (dso__is_kcore(dso) ||
+   readlink(symfs_filename, command, sizeof(command)) < 0 ||
+   strstr(command, DSO__NAME_KALLSYMS) ||
+   access(symfs_filename, R_OK)) {
 fallback:
/*
 * If we don't have build-ids or the build-id file isn't in the
 * cache, or is just a kallsyms file, well, lets hope that this
 * DSO is the same as when 'perf record' ran.
 */
-   filename = (char *)dso->long_name;
-   symbol__join_symfs(symfs_filename, filename);
-   free_filename = false;
+   symbol__join_symfs(symfs_filename, dso->long_name);
}
 
pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 
"\n", __func__,
-filename, sym->name, map->unmap_ip(map, sym->start),
+symfs_filename, sym->name, map->unmap_ip(map, sym->start),
 map->unmap_ip(map, sym->end));
 
pr_debug("annotating [%p] %30s : [%p] %30s\n",
@@ -1222,11 +1220,6 @@ fallback:
delete_extract = true;
strlcpy(symfs_filename, kce.extract_filename,
sizeof(symfs_filename));
-   if (free_filename) {
-   free(filename);
-   free_filename = false;
-   }
-   filename = symfs_filename;
}
} else if (dso__needs_decompress(dso)) {
char tmp[PATH_MAX];
@@ -1235,14 +1228,14 @@ fallback:
bool ret;
 
if (kmod_path__parse_ext(, symfs_filename))
-   goto out_free_filename;
+   goto out;
 
snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XX");
 
fd = mkstemp(tmp);
if (fd < 0) {
free(m.ext);
-   goto out_free_filename;
+   goto out;
}
 
ret = decompress_to_file(m.ext, symfs_filename, fd);
@@ -1254,7 +1247,7 @@ fallback:
close(fd);
 
if (!ret)
-   goto out_free_filename;
+   goto out;
 
strcpy(symfs_filename, tmp);
}
@@ -1270,7 +1263,7 @@ fallback:
 map__rip_2objdump(map, sym->end),
 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
 symbol_conf.annotate_src ? "-S" : "",
-symfs_filename, filename);
+symfs_filename, symfs_filename);
 
pr_debug("Executing: %s\n", command);
 
@@ -1332,11 +1325,9 @@ out_remove_tmp:
 
if 

[tip:perf/core] perf kvm: Use NSEC_PER_USEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  c05a6e14150f81a8cb93d83af55582e05afc05ae
Gitweb: http://git.kernel.org/tip/c05a6e14150f81a8cb93d83af55582e05afc05ae
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 15:10:44 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf kvm: Use NSEC_PER_USEC

Following kernel practices and better documenting units of time.

Cc: Adrian Hunter 
Cc: Alexander Yarygin 
Cc: David Ahern 
Cc: Hemant Kumar 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-5x6p6fmzrogonpbnkkkw4...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-kvm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a0040f7..08fa88f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -363,7 +363,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
if (!skip_event(decode)) {
pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" 
PRIu64 "usec\n",
 sample->time, sample->pid, 
vcpu_record->vcpu_id,
-decode, time_diff/1000);
+decode, time_diff / NSEC_PER_USEC);
}
}
 
@@ -609,15 +609,15 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("%10llu ", (unsigned long long)ecount);
pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100);
pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100);
-   pr_info("%9.2fus ", (double)min / 1e3);
-   pr_info("%9.2fus ", (double)max / 1e3);
-   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3,
+   pr_info("%9.2fus ", (double)min / NSEC_PER_USEC);
+   pr_info("%9.2fus ", (double)max / NSEC_PER_USEC);
+   pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount / 
NSEC_PER_USEC,
kvm_event_rel_stddev(vcpu, event));
pr_info("\n");
}
 
pr_info("\nTotal Samples:%" PRIu64 ", Total events handled 
time:%.2fus.\n\n",
-   kvm->total_count, kvm->total_time / 1e3);
+   kvm->total_count, kvm->total_time / (double)NSEC_PER_USEC);
 
if (kvm->lost_events)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);


[tip:perf/core] perf disassemble: Extract logic to find file to pass to objdump to a separate function

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  05ed3ac9417dac9be9dd63f3cf97416c80bad359
Gitweb: http://git.kernel.org/tip/05ed3ac9417dac9be9dd63f3cf97416c80bad359
Author: Arnaldo Carvalho de Melo 
AuthorDate: Tue, 9 Aug 2016 15:32:53 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf disassemble: Extract logic to find file to pass to objdump to a separate 
function

Disentangling this a bit further, more to come.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-7bjv2xazuyzs0xw01mlwo...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/annotate.c | 54 +++---
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 8a99493..25a9259 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1162,29 +1162,19 @@ int symbol__strerror_disassemble(struct symbol *sym 
__maybe_unused, struct map *
return 0;
 }
 
-int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
+static int dso__disassemble_filename(struct dso *dso, char *filename, size_t 
filename_size)
 {
-   struct dso *dso = map->dso;
-   char *filename;
-   char command[PATH_MAX * 2];
-   FILE *file;
-   char symfs_filename[PATH_MAX];
-   struct kcore_extract kce;
-   bool delete_extract = false;
-   int stdout_fd[2];
-   int lineno = 0;
-   int nline;
-   pid_t pid;
-   int err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
+   char linkname[PATH_MAX];
+   char *build_id_filename;
 
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
!dso__is_kcore(dso))
-   goto out;
+   return SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
 
-   filename = dso__build_id_filename(dso, NULL, 0);
-   if (filename) {
-   symbol__join_symfs(symfs_filename, filename);
-   free(filename);
+   build_id_filename = dso__build_id_filename(dso, NULL, 0);
+   if (build_id_filename) {
+   __symbol__join_symfs(filename, filename_size, 
build_id_filename);
+   free(build_id_filename);
} else {
if (dso->has_build_id)
return ENOMEM;
@@ -1192,18 +1182,38 @@ int symbol__disassemble(struct symbol *sym, struct map 
*map, size_t privsize)
}
 
if (dso__is_kcore(dso) ||
-   readlink(symfs_filename, command, sizeof(command)) < 0 ||
-   strstr(command, DSO__NAME_KALLSYMS) ||
-   access(symfs_filename, R_OK)) {
+   readlink(filename, linkname, sizeof(linkname)) < 0 ||
+   strstr(linkname, DSO__NAME_KALLSYMS) ||
+   access(filename, R_OK)) {
 fallback:
/*
 * If we don't have build-ids or the build-id file isn't in the
 * cache, or is just a kallsyms file, well, lets hope that this
 * DSO is the same as when 'perf record' ran.
 */
-   symbol__join_symfs(symfs_filename, dso->long_name);
+   __symbol__join_symfs(filename, filename_size, dso->long_name);
}
 
+   return 0;
+}
+
+int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
+{
+   struct dso *dso = map->dso;
+   char command[PATH_MAX * 2];
+   FILE *file;
+   char symfs_filename[PATH_MAX];
+   struct kcore_extract kce;
+   bool delete_extract = false;
+   int stdout_fd[2];
+   int lineno = 0;
+   int nline;
+   pid_t pid;
+   int err = dso__disassemble_filename(dso, symfs_filename, 
sizeof(symfs_filename));
+
+   if (err)
+   return err;
+
pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 
"\n", __func__,
 symfs_filename, sym->name, map->unmap_ip(map, sym->start),
 map->unmap_ip(map, sym->end));


[tip:perf/core] perf record: Fix spelling mistake "Finshed" -> "Finished"

2016-08-24 Thread tip-bot for Colin Ian King
Commit-ID:  5e30d55c71de058e4156080fe32d426c22d094cb
Gitweb: http://git.kernel.org/tip/5e30d55c71de058e4156080fe32d426c22d094cb
Author: Colin Ian King 
AuthorDate: Mon, 22 Aug 2016 19:30:08 +0100
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 17:06:40 -0300

perf record: Fix spelling mistake "Finshed" -> "Finished"

Trivial fix to spelling mistake in pr_debug message.

Signed-off-by: Colin King 
Cc: Alexander Shishkin 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20160822183008.26368-1-colin.k...@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a3792e8..03251c7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -96,7 +96,7 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 
*start, u64 *end)
*start = head;
while (true) {
if (evt_head - head >= (unsigned int)size) {
-   pr_debug("Finshed reading backward ring buffer: 
rewind\n");
+   pr_debug("Finished reading backward ring buffer: 
rewind\n");
if (evt_head - head > (unsigned int)size)
evt_head -= pheader->size;
*end = evt_head;
@@ -106,7 +106,7 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 
*start, u64 *end)
pheader = (struct perf_event_header *)(buf + (evt_head & mask));
 
if (pheader->size == 0) {
-   pr_debug("Finshed reading backward ring buffer: get 
start\n");
+   pr_debug("Finished reading backward ring buffer: get 
start\n");
*end = evt_head;
return 0;
}


[PATCH] staging: android: ion: ion_chunk_heap.c fix parenthesis alignment

2016-08-24 Thread Didik Setiawan
Fix checkpatch.pl warning about "Alignment should match open parenthesis".

Signed-off-by: Didik Setiawan 
---
 drivers/staging/android/ion/ion_chunk_heap.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/ion/ion_chunk_heap.c 
b/drivers/staging/android/ion/ion_chunk_heap.c
index 560cf90..a8f6cd8 100644
--- a/drivers/staging/android/ion/ion_chunk_heap.c
+++ b/drivers/staging/android/ion/ion_chunk_heap.c
@@ -34,9 +34,9 @@ struct ion_chunk_heap {
 };
 
 static int ion_chunk_heap_allocate(struct ion_heap *heap,
- struct ion_buffer *buffer,
- unsigned long size, unsigned long align,
- unsigned long flags)
+  struct ion_buffer *buffer,
+  unsigned long size, unsigned long align,
+  unsigned long flags)
 {
struct ion_chunk_heap *chunk_heap =
container_of(heap, struct ion_chunk_heap, heap);
@@ -106,7 +106,7 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer)
 
if (ion_buffer_cached(buffer))
dma_sync_sg_for_device(NULL, table->sgl, table->nents,
-   DMA_BIDIRECTIONAL);
+  DMA_BIDIRECTIONAL);
 
for_each_sg(table->sgl, sg, table->nents, i) {
gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
@@ -161,7 +161,7 @@ struct ion_heap *ion_chunk_heap_create(struct 
ion_platform_heap *heap_data)
chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
pr_debug("%s: base %lu size %zu align %ld\n", __func__,
-   chunk_heap->base, heap_data->size, heap_data->align);
+chunk_heap->base, heap_data->size, heap_data->align);
 
return _heap->heap;
 
-- 
1.9.1




[PATCH] input: pegasus_notetaker - directly include workqueue header

2016-08-24 Thread Martin Kepplinger
According to the kernel's guidelines, let's directly include the
workqueue functions we use.

Signed-off-by: Martin Kepplinger 
---
I don't know if it's worth it, but I should have included this according to
the guidelines :)


 drivers/input/tablet/pegasus_notetaker.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/tablet/pegasus_notetaker.c 
b/drivers/input/tablet/pegasus_notetaker.c
index 949dacc..47de5a8 100644
--- a/drivers/input/tablet/pegasus_notetaker.c
+++ b/drivers/input/tablet/pegasus_notetaker.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* USB HID defines */
 #define USB_REQ_GET_REPORT 0x01
-- 
2.1.4



Company Payment Agent Needed

2016-08-24 Thread Shougang Group of company

Shougang Group of company
45 Huagong Road Xinji City,
Hebei Province China.
webpage: www.shougang.com.cn


This is an official request for Professional/consultants who will stand as
our regional representative to run logistics on behalf of Shougang Group.
We are only looking for individual or company from USA and Canada. You
will be entitle to ten percent (10%) of every payment you receive from our
customers in your region on behalf of the company.

NOTE: You are not require to travel, all communications with our customers
will be through email or phone. All fees, including taxes will be handled
by us.You can apply for this position by filling the information below and
send back to us;

Full Name:
Residencial or office address:
Town:
State:
Zipcode:
Country:
Current Job:
If you own a company, please state the company name:
Prefered Email:
Gender:
Age:
Telephone:

If you have a current job, you can still be part of our business, as
services for us will not bother with your hours of work.

Respectfully,
Mr. Zhu Jimin (Chief Executive Officer)
Shougang Group





[PATCH v2 1/8] hisi_sas: add internal abort main code

2016-08-24 Thread John Garry
Add main code for internal abort functionality.

The internal abort features allows the host controller
to abort commands which are still active in the
controller but have not yet been sent to the slave
device.

Typically a command only spends a relatively
short time in the controller when compared to the
amount of the time after it is sent to the slave
device.
Two modes of internal abort are supported:
- device
- individual command

For device, when the internal abort is issued all
commands in the host for that device are aborted.
For a single command, only that command is aborted
if it is still in the host.

In HW the internal abort command is executed
similar to any other sort of command, like SSP.

Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas.h  |   8 ++
 drivers/scsi/hisi_sas/hisi_sas_main.c | 163 ++
 2 files changed, 171 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 4731d32..8311360 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -56,6 +56,11 @@ enum dev_status {
HISI_SAS_DEV_EH,
 };
 
+enum {
+   HISI_SAS_INT_ABT_CMD = 0,
+   HISI_SAS_INT_ABT_DEV = 1,
+};
+
 enum hisi_sas_dev_type {
HISI_SAS_DEV_TYPE_STP = 0,
HISI_SAS_DEV_TYPE_SSP,
@@ -146,6 +151,9 @@ struct hisi_sas_hw {
struct hisi_sas_slot *slot);
int (*prep_stp)(struct hisi_hba *hisi_hba,
struct hisi_sas_slot *slot);
+   int (*prep_abort)(struct hisi_hba *hisi_hba,
+ struct hisi_sas_slot *slot,
+ int device_id, int abort_flag, int tag_to_abort);
int (*slot_complete)(struct hisi_hba *hisi_hba,
 struct hisi_sas_slot *slot, int abort);
void (*phy_enable)(struct hisi_hba *hisi_hba, int phy_no);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c 
b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 18dd5ea..763c6c5 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -17,6 +17,10 @@
 
 static int hisi_sas_debug_issue_ssp_tmf(struct domain_device *device,
u8 *lun, struct hisi_sas_tmf_task *tmf);
+static int
+hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
+struct domain_device *device,
+int abort_flag, int tag);
 
 static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device)
 {
@@ -116,6 +120,14 @@ static int hisi_sas_task_prep_ata(struct hisi_hba 
*hisi_hba,
return hisi_hba->hw->prep_stp(hisi_hba, slot);
 }
 
+static int hisi_sas_task_prep_abort(struct hisi_hba *hisi_hba,
+   struct hisi_sas_slot *slot,
+   int device_id, int abort_flag, int tag_to_abort)
+{
+   return hisi_hba->hw->prep_abort(hisi_hba, slot,
+   device_id, abort_flag, tag_to_abort);
+}
+
 /*
  * This function will issue an abort TMF regardless of whether the
  * task is in the sdev or not. Then it will do the task complete
@@ -954,6 +966,157 @@ static int hisi_sas_query_task(struct sas_task *task)
return rc;
 }
 
+static int
+hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, u64 device_id,
+ struct sas_task *task, int abort_flag,
+ int task_tag)
+{
+   struct domain_device *device = task->dev;
+   struct hisi_sas_device *sas_dev = device->lldd_dev;
+   struct device *dev = _hba->pdev->dev;
+   struct hisi_sas_port *port;
+   struct hisi_sas_slot *slot;
+   struct hisi_sas_cmd_hdr *cmd_hdr_base;
+   int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx;
+
+   if (!device->port)
+   return -1;
+
+   port = device->port->lldd_port;
+
+   /* simply get a slot and send abort command */
+   rc = hisi_sas_slot_index_alloc(hisi_hba, _idx);
+   if (rc)
+   goto err_out;
+   rc = hisi_hba->hw->get_free_slot(hisi_hba, _queue,
+_queue_slot);
+   if (rc)
+   goto err_out_tag;
+
+   slot = _hba->slot_info[slot_idx];
+   memset(slot, 0, sizeof(struct hisi_sas_slot));
+
+   slot->idx = slot_idx;
+   slot->n_elem = n_elem;
+   slot->dlvry_queue = dlvry_queue;
+   slot->dlvry_queue_slot = dlvry_queue_slot;
+   cmd_hdr_base = hisi_hba->cmd_hdr[dlvry_queue];
+   slot->cmd_hdr = _hdr_base[dlvry_queue_slot];
+   slot->task = task;
+   slot->port = port;
+   task->lldd_task = slot;
+
+   memset(slot->cmd_hdr, 0, sizeof(struct hisi_sas_cmd_hdr));
+
+   rc = hisi_sas_task_prep_abort(hisi_hba, slot, device_id,
+ abort_flag, task_tag);
+   if (rc)
+   goto err_out_tag;
+
+   /* Port structure is static for the HBA, so
+   *  even if the 

[PATCH v2 7/8] hisi_sas: add TMF success check

2016-08-24 Thread John Garry
When a tmf is issued, various response codes can be
returned from the target. For a query tmf the
response may be TMF_RESP_FUNC_COMPLETE or
TMF_RESP_FUNC_SUCC.
Add a condition for TMF_RESP_FUNC_SUCC to
hisi_sas_exec_internal_tmf_task().
This affects query tmf, as the result is success
the returned value was for failure.

Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c 
b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 73f581f..85c73d3 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -744,6 +744,12 @@ static int hisi_sas_exec_internal_tmf_task(struct 
domain_device *device,
}
 
if (task->task_status.resp == SAS_TASK_COMPLETE &&
+   task->task_status.stat == TMF_RESP_FUNC_SUCC) {
+   res = TMF_RESP_FUNC_SUCC;
+   break;
+   }
+
+   if (task->task_status.resp == SAS_TASK_COMPLETE &&
  task->task_status.stat == SAS_DATA_UNDERRUN) {
/* no error, but return the number of bytes of
 * underrun
-- 
1.9.1



[PATCH v2 3/8] hisi_sas: add internal abort to hisi_sas_abort_task()

2016-08-24 Thread John Garry
Execute an internal abort for executing a task abort.
This is for case of the command still being present
in host when abort is executed.

For a SATA internal abort, we set abort for all tasks
associated with the device.

Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c 
b/drivers/scsi/hisi_sas/hisi_sas_main.c
index c4e59cd..280a19d 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -841,18 +841,22 @@ static int hisi_sas_abort_task(struct sas_task *task)
}
}
 
+   hisi_sas_internal_task_abort(hisi_hba, device,
+HISI_SAS_INT_ABT_CMD, tag);
} else if (task->task_proto & SAS_PROTOCOL_SATA ||
task->task_proto & SAS_PROTOCOL_STP) {
if (task->dev->dev_type == SAS_SATA_DEV) {
-   struct hisi_slot_info *slot = task->lldd_task;
-
-   dev_notice(dev, "abort task: hba=%p task=%p slot=%p\n",
-  hisi_hba, task, slot);
-   task->task_state_flags |= SAS_TASK_STATE_ABORTED;
+   hisi_sas_internal_task_abort(hisi_hba, device,
+HISI_SAS_INT_ABT_DEV, 0);
rc = TMF_RESP_FUNC_COMPLETE;
-   goto out;
}
+   } else if (task->task_proto & SAS_PROTOCOL_SMP) {
+   /* SMP */
+   struct hisi_sas_slot *slot = task->lldd_task;
+   u32 tag = slot->idx;
 
+   hisi_sas_internal_task_abort(hisi_hba, device,
+HISI_SAS_INT_ABT_CMD, tag);
}
 
 out:
-- 
1.9.1



Re: [RFC PATCH 0/5] Add CONFIG symbol as module attribute

2016-08-24 Thread Michal Marek
On 2016-08-23 23:32, Luis R. Rodriguez wrote:
> On Fri, Aug 19, 2016 at 11:07:36AM +0200, Michal Marek wrote:
>> On 2016-08-18 19:55, Luis R. Rodriguez wrote:
>>> On Wed, Aug 17, 2016 at 09:26:58PM +0200, Cristina Moraru wrote:
>>>
 This patchset implements dynamic pegging of kconfig symbol
 into driver modinfo section
>>>
>>> First a little bit of motivation here helps, so let me try to
>>> help fill in some gaps. This may help explain what you have
>>> been working on a bit more.
>>>
>>> First, for those that were not Cc'd but curious about this work
>>> so far, you can read the patches here:
>>>
>>> Original cover letter:
>>>
>>> https://lkml.kernel.org/r/1471462023-119645-1-git-send-email-cristina.morar...@gmail.com
>>>
>>> https://marc.info/?l=linux-kernel=147146213519750=2 - patch 1
>>> https://marc.info/?l=linux-kernel=147146209019744=2 - patch 2
>>> https://marc.info/?l=linux-kernel=147146211819747=2 - patch 3
>>> https://marc.info/?l=linux-kernel=147146209119745=2 - patch 4
>>> https://marc.info/?l=linux-kernel=147146209519746=2 - patch 5
>>>
>>> There are a few situations in which you may want to extract a
>>> subset of Kconfig CONFIG_* symbols for a system. At least when
>>> only considering modules:
>>>
>>>  a) When optimizing build requirements for a kernel for a system.
>>> That is you boot into a distro kernel and then want to build
>>> a slim kernel only with sensible kernel configuration options.
>>>
>>>  b) When you are on a distribution kernel but the distribution
>>> kernel provided lacks hardware support for your device, you
>>> may either want to upgrade the full kernel in which case you
>>> want to do a) or -- you may want to just a backports release
>>> which provides just the modules you need, you'd use it on top
>>> of the distribution kernel.
>>
>> c) Having the mapping in sysfs would allow to simplify
>> streamline_config.pl avoid parsing Makefiles in perl.
> 
> Indeed, this was actually a side possible goal here :) only it seems
> we totally forgot about it while addressing the work.
> 
>> Only if the patch did not depend on streamline_config.pl :)
> 
> Indeed, lets get rid of that dependency.
> 
>> One idea would be to generate
>> the Module.ksymb in a similar way we generate the modules.builtin file:
>> Generate an alternate include/config/*.conf with all CONFIG_FOO=m
>> replaced with
>>
>> CONFIG_FOO=m-CONFIG_FOO
>>
>> and in the Makefile, iterate over $(filter m-CONFIG_%, $(.VARIABLES)) to
   should be obj-m-CONFIG_%

>> create the mapping. This would also properly cover cases where we build
>> the $(obj-m) list from another list. It would certainly create other
>> corner cases, but it's worth trying IMO.
> 
> Neat, would that cover lib-m then as well or other targets that would 
> generate 
> modules ?

This would have to be handled as well by the patch. Obviously it's not
going to be as simple as described in a single paragraph of text :).


>> Another thing is that we do not necessarily need to record this
>> information in .modinfo, but we can generate a list in
>> /lib/modules/`uname -r`/ for consumption. It could also include drivers
>> that are builtin in the current configuration.
> 
> Well so one future use would be for instance a 'make udevconfig' which
> in theory should be able then to scrape all possible related needed
> device CONFIG_'s and then give you an optimal kernel configuration.
> It'd be nice to be able to extract this from the kernel and modules
> without needing build sources in /lib/modules/`uname -r`/.

I meant that the file can be installed by modules_install. Like you have
/lib/modules/`uname -r`/modules.builtin with recent kernels and recent
distro packages. But really, it's a minor issue how the information is
presented to userspace.

Michal


Re: [PATCH] nvme: Fix nvme_get/set_features() with a NULL result pointer

2016-08-24 Thread Sagi Grimberg

Looks fine,

Reviewed-by: Sagi Grimberg 


Re: x86/PCI: Scan all functions during probing

2016-08-24 Thread Jan Kiszka
On 2016-08-24 04:39, Thomas Gleixner wrote:
> On Thu, 18 Aug 2016, Bjorn Helgaas wrote:
>> I looked up the spec: PCI (not PCIe) r3.0, sec 3.2.2.3.4, says:
>>
>>   A single-function device may optionally respond to all function
>>   numbers as the same function or may ... respond only to function 0
>>   and not respond to the other function numbers.
>>
>> I'm concerned that a single-function device that responds to all
>> function numbers might break with this patch.
>>
>>   [multi-function devices] are also required to always implement
>>   function 0 in the device.
>>
>> Here's the reason we can advance by 8 in the "Go find them" loop.
>>
>>   If a single function device is detected (i.e., bit 7 in the Header
>>   Type register of function 0 is 0), no more functions for that Device
>>   Number will be checked.  If a multi-function device is detected
>>   (i.e., bit 7 in the Header Type register of function 0 is 1), then
>>   all remaining Function Numbers will be checked.
>>
>> This patch does the opposite of what the first sentence recommends.
> 
> Fair enough. We'll need to find a way to deal with that in jailhouse then.

Wouldn't it also be an option to have this fine-grained scanning only
activated if we detect to run over Jailhouse (which we have to anyway)?
Such code hasn't been proposed for upstream yet, but we will eventually.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux


Re: [PATCH] zd1211rw: fix spelling mistake "firmeware" -> "firmware"

2016-08-24 Thread Julian Calaby
Hi All,

On Tue, Aug 23, 2016 at 4:35 AM, Colin King  wrote:
> From: Colin Ian King 
>
> Trivial fix to spelling mistake in dev_err message.
>
> Signed-off-by: Colin Ian King 

Looks right to me.

Reviewed-by: Julian Calaby 

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/


Re: include/linux/io-mapping.h:130:39: error: implicit declaration of function 'ioremap_wc'

2016-08-24 Thread Linus Walleij
On Tue, Aug 23, 2016 at 10:03 PM, Chris Wilson  wrote:
> On Tue, Aug 16, 2016 at 10:14:57AM +0200, Linus Walleij wrote:
>> On Mon, Aug 15, 2016 at 5:08 PM, kbuild test robot

>> I think I've finally fixed this now by making OF_GPIO depend on !NO_IOMEM.
>
> I've stumbled over this patch

(...)
> Fix this by including  explicitly.
>
> having touched io-mapping.h
>
> The original patch is incorrect as io-mapping.h is not the right header
> for iounmap() - that is #include  (pulling in )
> which is (and was) already present.

You're right, I'll revert this patch.

> So the root cause here is arch/um not supplying enough stubs?

arch/um is explicitly not supporting IOMEM so anyone code
using iomap()/iounmap() have to make sure they do not get
compiled on UM.

> But in the
> meantime, do you mind removing the incorrect include now that you have a
> w/a to keep 0day quiet? :)

OK

Yours,
Linus Walleij


[PATCH 36/41] staging: r8188eu: remove smooth_rssi_data structure

2016-08-24 Thread Ivan Safonov
This structure does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_recv.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index b0373b6..758cd16 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -65,13 +65,6 @@ struct   stainfo_rxcache {
 */
 };
 
-struct smooth_rssi_data {
-   u32 elements[100];  /* array to store values */
-   u32 index;  /* index to current array to store */
-   u32 total_num;  /* num of valid elements */
-   u32 total_val;  /* sum of valid elements */
-};
-
 struct signal_stat {
u8  update_req; /* used to indicate */
u8  avg_val;/* avg of valid elements */
-- 
2.7.3



[PATCH 04/41] staging: r8188eu: remove secondary_ch_offset_to_hal_ch_offset function

2016-08-24 Thread Ivan Safonov
Driver does not use this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 12 
 drivers/staging/rtl8188eu/include/ieee80211.h  |  1 -
 2 files changed, 13 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index a37d847..641c874 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -166,18 +166,6 @@ inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 
ch_switch_mode,
return rtw_set_ie(buf, WLAN_EID_CHANNEL_SWITCH,  3, ie_data, buf_len);
 }
 
-inline u8 secondary_ch_offset_to_hal_ch_offset(u8 ch_offset)
-{
-   if (ch_offset == SCN)
-   return HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-   else if (ch_offset == SCA)
-   return HAL_PRIME_CHNL_OFFSET_UPPER;
-   else if (ch_offset == SCB)
-   return HAL_PRIME_CHNL_OFFSET_LOWER;
-
-   return HAL_PRIME_CHNL_OFFSET_DONT_CARE;
-}
-
 inline u8 hal_ch_offset_to_secondary_ch_offset(u8 ch_offset)
 {
if (ch_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 8afef17..976bb63 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1096,7 +1096,6 @@ enum secondary_ch_offset {
SCA = 1, /* secondary channel above */
SCB = 3,  /* secondary channel below */
 };
-u8 secondary_ch_offset_to_hal_ch_offset(u8 ch_offset);
 u8 hal_ch_offset_to_secondary_ch_offset(u8 ch_offset);
 u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
 u8 new_ch, u8 ch_switch_cnt);
-- 
2.7.3



[PATCH 28/41] staging: r8188eu: remove dead code from rtw_update_ht_cap function

2016-08-24 Thread Ivan Safonov
This code affect only to local variables that does not used later.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 9eccadc..4b63979 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -2001,8 +2001,6 @@ unsigned int rtw_restructure_ht_ie(struct adapter 
*padapter, u8 *in_ie, u8 *out_
 /* the function is > passive_level (in critical_section) */
 void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len)
 {
-   u8 *p, max_ampdu_sz;
-   int len;
struct mlme_priv*pmlmepriv = >mlmepriv;
struct ht_priv  *phtpriv = >htpriv;
struct registry_priv *pregistrypriv = >registrypriv;
@@ -2027,20 +2025,6 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 
*pie, uint ie_len)
phtpriv->ampdu_enable = true;
}
 
-
-   /* check Max Rx A-MPDU Size */
-   len = 0;
-   p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fixed_ie), 
_HT_CAPABILITY_IE_, , ie_len-sizeof(struct ndis_802_11_fixed_ie));
-   if (p && len > 0) {
-   struct ieee80211_ht_cap *ht_cap =
-   (struct ieee80211_ht_cap *)(p + 2);
-
-   max_ampdu_sz = ht_cap->ampdu_params_info & 
IEEE80211_HT_CAP_AMPDU_FACTOR;
-   max_ampdu_sz = 1 << (max_ampdu_sz+3); /*  max_ampdu_sz 
(kbytes); */
-   }
-   len = 0;
-   p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fixed_ie), 
_HT_ADD_INFO_IE_, , ie_len-sizeof(struct ndis_802_11_fixed_ie));
-
/* update cur_bwmode & cur_ch_offset */
if ((pregistrypriv->cbw40_enable) &&
(le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & BIT(1)) &&
-- 
2.7.3



[PATCH 25/41] staging: r8188eu: remove HT_caps_element structure

2016-08-24 Thread Ivan Safonov
This type does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/wifi.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/wifi.h 
b/drivers/staging/rtl8188eu/include/wifi.h
index 28e1dde..9e08e68 100644
--- a/drivers/staging/rtl8188eu/include/wifi.h
+++ b/drivers/staging/rtl8188eu/include/wifi.h
@@ -522,15 +522,6 @@ struct ieee80211_ht_addt_info {
unsigned char   basic_set[16];
 } __packed;
 
-struct HT_caps_element {
-   __le16  HT_caps_info;
-   unsigned char   AMPDU_para;
-   unsigned char   MCS_rate[16];
-   unsigned short  HT_ext_caps;
-   unsigned intBeamforming_caps;
-   unsigned char   ASEL_caps;
-} __packed;
-
 struct HT_info_element {
unsigned char   primary_channel;
unsigned char   infos[5];
-- 
2.7.3



Re: [PATCH v2] x86/tsc: Set X86_FEATURE_TSC_RELIABLE to skip refined calibration

2016-08-24 Thread Thomas Gleixner
On Tue, 16 Aug 2016, Bin Gao wrote:
> On some newer Intel x86 processors/SoCs the TSC frequency can be directly
> calculated by factors read from specific MSR registers or from a cpuid
> leaf (0x15). TSC frequency calculated by native msr/cpuid is absolutely
> accurate so we should always skip calibrating TSC aginst another clock,
> e.g. PIT, HPET, etc. So we want to skip the refined calibration by setting
> the X86_FEATURE_TSC_RELIABLE flag. Existing code setting the flag by
> set_cpu_cap() doesn't work as the flag is cleared later in identify_cpu().
> A cpu caps flag is not cleared only if it's set by setup_force_cpu_cap().
> This patch converted set_cpu_cap() to setup_force_cpu_cap() to ensure
> refined calibration is skipped.
> 
> We had a test on Intel CherryTrail platform: the 24 hours time drift is
> 3.6 seconds if refined calibration was not skipped while the drift is less
> than 0.6 second when refined calibration was skipped.
> 
> Correctly setting the X86_FEATURE_TSC_RELIABLE flag also guarantees TSC is
> not monitored by timekeeping watchdog because on most of these system TSC
> is the only reliable clocksource. HPET, for instance, works but may not
> be reliable. So kernel may report a physically reliable TSC is not reliable
> just because a physically not reliable HPET is acting as timekeeping
> watchdog.

What about non SoC systems where the MSR is available, but we still see that
cross socket TSC wreckage? This change will prevent the watchdog from
detecting that.

Thanks,

tglx


Re: [PATCH v6 0/8] power: add power sequence library

2016-08-24 Thread Peter Chen
On Tue, Aug 23, 2016 at 04:02:48PM +0530, Vaibhav Hiremath wrote:
> 
> 
> On Monday 15 August 2016 02:43 PM, Peter Chen wrote:
> >Hi all,
> >
> >This is a follow-up for my last power sequence framework patch set [1].
> >According to Rob Herring and Ulf Hansson's comments[2], I use a generic
> >power sequence library for parsing the power sequence elements on DT,
> >and implement generic power sequence on library. The host driver
> >can allocate power sequence instance, and calls pwrseq APIs accordingly.
> >
> >In future, if there are special power sequence requirements, the special
> >power sequence library can be created.
> >
> >This patch set is tested on i.mx6 sabresx evk using a dts change, I use
> >two hot-plug devices to simulate this use case, the related binding
> >change is updated at patch [1/6], The udoo board changes were tested
> >using my last power sequence patch set.[3]
> >
> >Except for hard-wired MMC and USB devices, I find the USB ULPI PHY also
> >need to power on itself before it can be found by ULPI bus.
> >
> >[1] http://www.spinics.net/lists/linux-usb/msg142755.html
> >[2] http://www.spinics.net/lists/linux-usb/msg143106.html
> >[3] http://www.spinics.net/lists/linux-usb/msg142815.html
> (Please ignore my response on V2)
> 
> Sorry being so late in the discussion...
> 
> If I am not missing anything, then I am afraid to say that the
> generic library
> implementation in this patch series is not going to solve many of
> the custom
> requirement of power on, off, etc...
> I know you mentioned about adding another library when we come
> across such platforms, but should we not keep provision (or easy
> hooks/path)
> to enable that ?
> 
> Let me bring in the use case I am dealing with,
> 
> 
>   Host
>|
>V
>USB port
> 
>|
>V
>   USB HUB device (May need custom on/off seq)
>|
>V
>   =
>  | |
>  V V
>  Device-1   Device-2
> (Needs special power   (Needs special power
>  on/off sequence.   on/off sequence.
>  Also may need custom   Also, may need custom
>  sequence for   sequence for
>  suspend/resume)suspend/resume)
> 
> 
> Note: Both Devices are connected to HUB via HSIC and may differ
>   in terms of functionality, features they support.
> 
> In the above case, both Device-1 and Device-2, need separate
> power on/off sequence. So generic library currently we have in this
> patch series is not going to satisfy the need here.
> 
> I looked at all 6 revisions of this patch-series, went through the
> review comments, and looked at MMC power sequence code;
> what I can say here is, we need something similar to
> MMC power sequence here, where every device can have its own
> power sequence (if needed).
> 
> I know Rob is not in favor of creating platform device for
> this, and I understand his comment.
> If not platform device, but atleast we need mechanism to
> connect each device back to its of_node and its respective
> driver/library fns. For example, the Devices may support different
> boot modes, and platform driver needs to make sure that
> the right sequence is followed for booting.
> 
> Peter, My apologies for taking you back again on this series.
> I am OK, if you wish to address this in incremental addition,
> but my point is, we know that the current generic way is not
> enough for us, so I think we should try to fix it in initial phase only.
> 

Rob, it seems generic power sequence can't cover all cases.
Without information from DT, we can't know which power sequence
for which device.

-- 

Best Regards,
Peter Chen


Re: perf: WARNING: kernel/events/core.c:4893 perf_mmap_close

2016-08-24 Thread Will Deacon
Hi Alex,

On Tue, Aug 23, 2016 at 08:08:23PM +0300, Alexander Shishkin wrote:
> Will Deacon  writes:
> > On Fri, Aug 12, 2016 at 08:54:49PM +0300, Alexander Shishkin wrote:
> >> Yes, I tracked to a race between unmapping and set_output, trying to
> >> come up with a good fix now.
> >
> > Did you get anywhere with this? I think I just hit the same issue with
> > the intel-pt driver on my broadwell laptop with -rc3+PREEMPT (dump
> > below) and I'm more than happy to test a fix.
> 
> Yes, I posted a patchset [1] this morning that should fix this; if this
> is PT, 3/3 should suffice.

Unfortunately, I still see the same issue with those three patches applied,
so perhaps it's not quite the same as the problem reported by Vince.

A little bit of digging suggests that the preempt count isn't balanced
across the call to perf_pmu_output_stop from perf_mmap_close. Further
digging revealed the unbalanced get_cpu_ptr in __perf_pmu_output_stop.
Fix below!

I also noticed that we go to some effort to return an error code from
__perf_pmu_output_stop, but it's completly ignored by the cpu_function_call
machinery :(

> What's "pt-poker", btw? :)

A very boring application I wrote that just opens a pt event with config=0,
mmaps the AUX buffer and then spins waiting for the data that never comes.
The issue above occurs when I ctrl+c the application under a preemptible
kernel.

Will

--->8

>From 0d59936e07aa9b00f2a5640661bd1153f66914dc Mon Sep 17 00:00:00 2001
From: Will Deacon 
Date: Wed, 24 Aug 2016 10:07:14 +0100
Subject: [PATCH] perf/core: Use this_cpu_ptr when stopping AUX events

When tearing down an aux buf for an event via perf_mmap_close,
__perf_event_output_stop is called on the event's CPU to ensure that
trace generation is halted before the process of unmapping and
freeing the buffer pages begins.

The callback is performed via cpu_function_call, which ensures that it
runs with interrupts disabled and is therefore not preemptible.
Unfortunately, the current code grabs the per-cpu context pointer using
get_cpu_ptr, which unnecessarily disables preemption and doesn't pair
the call with put_cpu_ptr, leading to a preempt_count() imbalance and
a BUG when freeing the aux buffer later on:

[   92.159611] [ cut here ]
[   92.159617] WARNING: CPU: 1 PID: 2249 at kernel/events/ring_buffer.c:539 
__rb_free_aux+0x10c/0x120
[   92.159618] Modules linked in:
[   92.159620] CPU: 1 PID: 2249 Comm: spe-poker Tainted: GW   
4.8.0-rc3 #2
[   92.159621] Hardware name: Dell Inc. XPS 13 9343/0F5KF3, BIOS A07 11/11/2015
[   92.159622]   88020f91fad8 813379dd 

[   92.159624]   88020f91fb18 81059ff6 
021b0f91fb98
[   92.159625]  8802100fe300 88020de1da80 88020de1d800 
8802100b8228
[   92.159627] Call Trace:
[   92.159630]  [] dump_stack+0x4f/0x72
[   92.159632]  [] __warn+0xc6/0xe0
[   92.159633]  [] warn_slowpath_null+0x18/0x20
[   92.159634]  [] __rb_free_aux+0x10c/0x120
[   92.159636]  [] rb_free_aux+0x13/0x20
[   92.159637]  [] perf_mmap_close+0x29e/0x2f0
[   92.159638]  [] ? perf_iterate_ctx+0xe0/0xe0
[   92.159640]  [] remove_vma+0x25/0x60
[   92.159641]  [] exit_mmap+0x106/0x140
[   92.159643]  [] mmput+0x1c/0xd0
[   92.159644]  [] do_exit+0x253/0xbf0
[   92.159645]  [] do_group_exit+0x3e/0xb0
[   92.159647]  [] get_signal+0x249/0x640
[   92.159648]  [] do_signal+0x23/0x640
[   92.159651]  [] ? _raw_write_unlock_irq+0x12/0x30
[   92.159652]  [] ? _raw_spin_unlock_irq+0x9/0x10
[   92.159653]  [] ? __schedule+0x2c6/0x710
[   92.159655]  [] exit_to_usermode_loop+0x74/0x90
[   92.159656]  [] prepare_exit_to_usermode+0x26/0x30
[   92.159658]  [] retint_user+0x8/0x10
[   92.159659] ---[ end trace 926e713af6f1575e ]---

This patch uses this_cpu_ptr instead of get_cpu_ptr, since preemption is
already disabled by the caller.

Fixes: 95ff4ca26c49 ("perf/core: Free AUX pages in unmap path")
Cc: Alexander Shishkin 
Cc: Peter Zijlstra 
Signed-off-by: Will Deacon 
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 5650f5317e0c..3cfabdf7b942 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6166,7 +6166,7 @@ static int __perf_pmu_output_stop(void *info)
 {
struct perf_event *event = info;
struct pmu *pmu = event->pmu;
-   struct perf_cpu_context *cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
+   struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
struct remote_output ro = {
.rb = event->rb,
};
-- 
2.5.0



[PATCH] memory: omap-gpmc: Fix build with CONFIG_OMAP_GPMC disabled

2016-08-24 Thread Roger Quadros
Fix the following build failure if omap-gpmc.h is
used with CONFIG_OMAP_GPMC disabled.

./include/linux/omap-gpmc.h:32:1: error: unknown type name ‘gpmc_nand_ops’

Signed-off-by: Roger Quadros 
---
 include/linux/omap-gpmc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/omap-gpmc.h b/include/linux/omap-gpmc.h
index 9e9d79e..35d0fd7 100644
--- a/include/linux/omap-gpmc.h
+++ b/include/linux/omap-gpmc.h
@@ -29,8 +29,8 @@ struct gpmc_nand_regs;
 struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs *regs,
 int cs);
 #else
-static inline gpmc_nand_ops *gpmc_omap_get_nand_ops(struct gpmc_nand_regs 
*regs,
-   int cs)
+static inline struct gpmc_nand_ops *gpmc_omap_get_nand_ops(struct 
gpmc_nand_regs *regs,
+  int cs)
 {
return NULL;
 }
-- 
2.7.4



[tip:perf/core] perf tools tui: Display multiple header lines

2016-08-24 Thread tip-bot for Jiri Olsa
Commit-ID:  69705b35859195b5640861fff91cc936d1baf4eb
Gitweb: http://git.kernel.org/tip/69705b35859195b5640861fff91cc936d1baf4eb
Author: Jiri Olsa 
AuthorDate: Sun, 7 Aug 2016 17:28:28 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf tools tui: Display multiple header lines

Display multiple header lines in TUI browser, if it's configured within
struct perf_hpp_list::nr_header_lines.

Signed-off-by: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/1470583710-1649-4-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browsers/hists.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 303ed62..4a7aac8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1502,7 +1502,9 @@ static int advance_hpp_check(struct perf_hpp *hpp, int 
inc)
return hpp->size <= 0;
 }
 
-static int hists_browser__scnprintf_headers(struct hist_browser *browser, char 
*buf, size_t size)
+static int
+hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
+size_t size, int line)
 {
struct hists *hists = browser->hists;
struct perf_hpp dummy_hpp = {
@@ -1523,7 +1525,7 @@ static int hists_browser__scnprintf_headers(struct 
hist_browser *browser, char *
if (perf_hpp__should_skip(fmt, hists)  || column++ < 
browser->b.horiz_scroll)
continue;
 
-   ret = fmt->header(fmt, _hpp, hists, 0);
+   ret = fmt->header(fmt, _hpp, hists, line);
if (advance_hpp_check(_hpp, ret))
break;
 
@@ -1628,14 +1630,21 @@ static void hists_browser__hierarchy_headers(struct 
hist_browser *browser)
 
 static void hists_browser__headers(struct hist_browser *browser)
 {
-   char headers[1024];
+   struct hists *hists = browser->hists;
+   struct perf_hpp_list *hpp_list = hists->hpp_list;
 
-   hists_browser__scnprintf_headers(browser, headers,
-sizeof(headers));
+   int line;
 
-   ui_browser__gotorc(>b, 0, 0);
-   ui_browser__set_color(>b, HE_COLORSET_ROOT);
-   ui_browser__write_nstring(>b, headers, browser->b.width + 1);
+   for (line = 0; line < hpp_list->nr_header_lines; line++) {
+   char headers[1024];
+
+   hists_browser__scnprintf_headers(browser, headers,
+sizeof(headers), line);
+
+   ui_browser__gotorc(>b, line, 0);
+   ui_browser__set_color(>b, HE_COLORSET_ROOT);
+   ui_browser__write_nstring(>b, headers, 
browser->b.width + 1);
+   }
 }
 
 static void hist_browser__show_headers(struct hist_browser *browser)


[tip:perf/core] perf tools stdio: Display multiple header lines

2016-08-24 Thread tip-bot for Jiri Olsa
Commit-ID:  f3705b062eafc2867eb0e9ee3502bd59564f103c
Gitweb: http://git.kernel.org/tip/f3705b062eafc2867eb0e9ee3502bd59564f103c
Author: Jiri Olsa 
AuthorDate: Sun, 7 Aug 2016 17:28:29 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf tools stdio: Display multiple header lines

Display multiple header lines in stdio output , if it's configured
within struct perf_hpp_list::nr_header_lines.

Signed-off-by: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/stdio/hist.c | 34 +-
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 91b8e10..9b807cb 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -639,13 +639,10 @@ hists__fprintf_hierarchy_headers(struct hists *hists,
return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp);
 }
 
-static int
-hists__fprintf_standard_headers(struct hists *hists,
-   struct perf_hpp *hpp,
-   FILE *fp)
+static void fprintf_line(struct hists *hists, struct perf_hpp *hpp,
+int line, FILE *fp)
 {
struct perf_hpp_fmt *fmt;
-   unsigned int width;
const char *sep = symbol_conf.field_sep;
bool first = true;
 
@@ -658,14 +655,33 @@ hists__fprintf_standard_headers(struct hists *hists,
else
first = false;
 
-   fmt->header(fmt, hpp, hists, 0);
+   fmt->header(fmt, hpp, hists, line);
fprintf(fp, "%s", hpp->buf);
}
+}
 
-   fprintf(fp, "\n");
+static int
+hists__fprintf_standard_headers(struct hists *hists,
+   struct perf_hpp *hpp,
+   FILE *fp)
+{
+   struct perf_hpp_list *hpp_list = hists->hpp_list;
+   struct perf_hpp_fmt *fmt;
+   unsigned int width;
+   const char *sep = symbol_conf.field_sep;
+   bool first = true;
+   int line;
+
+   for (line = 0; line < hpp_list->nr_header_lines; line++) {
+   /* first # is displayed one level up */
+   if (line)
+   fprintf(fp, "# ");
+   fprintf_line(hists, hpp, line, fp);
+   fprintf(fp, "\n");
+   }
 
if (sep)
-   return 1;
+   return hpp_list->nr_header_lines;
 
first = true;
 
@@ -689,7 +705,7 @@ hists__fprintf_standard_headers(struct hists *hists,
 
fprintf(fp, "\n");
fprintf(fp, "#\n");
-   return 3;
+   return hpp_list->nr_header_lines + 2;
 }
 
 static int hists__fprintf_headers(struct hists *hists, FILE *fp)


Re: perf: fuzzer crashes immediately on AMD system

2016-08-24 Thread Ingo Molnar

* Vince Weaver  wrote:

> On Tue, 23 Aug 2016, Peter Zijlstra wrote:
> 
> > On Mon, Aug 22, 2016 at 10:54:32PM -0400, Vince Weaver wrote:
> > > > > > > 
> > > > > > >   perf stat -a -e amd_nb/config=0x37,config1=0x20/ /bin/ls
> > > > amd_uncore_find_online_sibling()
> > > > function is broken. 
> > > 
> > > and that's the problem.  uncore_find_online_sibling() does all kinds of 
> > > wrong things including sticking active uncore structures in 
> > > uncore->free_when_cpu_online
> > > 
> > > Then uncore_online() comes along and frees those structures.
> > > 
> > > Then some other part of the kernel comes and re-uses the free'd data.
> > > 
> > > Then when we try to start an event, all of the fields are invalid because 
> > > the uncore pointer is pointing to re-used data.
> > > 
> > > I don't have a patch because I am not 100% clear on what 
> > > uncore_find_online_sibling() is doing in the first place.
> > 
> > Thanks for doing all that, I'll see if I can make sense of it.
> 
> I should have provided more detail, was just tired after chasing the bug 
> for so long.  I mostly found things by sprinkling printks everywhere.
> Comenting out the call to kfree() in uncore_online() makes the code stop 
> crashing (but perhaps causes a memory leak?)

If there's no progress finding the root cause I'd be happy to exchange a crash 
for 
a leak ...

> In any case it's odd the problem didn't show up earlier, but maybe the 
> recent changes to CPU hotplugging in that file exposed the issue.

Yeah, we had lots of changes to CPU hotplugging recently.

Thanks,

Ingo


Re: [PATCH] arm64: kprobe: Always clear pstate.D in breakpoint exception handler

2016-08-24 Thread Pratyush Anand
Hi Sandeepa,

On 24/08/2016:03:09:16 PM, Sandeepa Prabhu wrote:
> On Mon, Aug 22, 2016 at 12:16 PM, Pratyush Anand  wrote:
> 
> > Whenever we are hitting a kprobe from a none-kprobe debug exception
> > handler, we hit an infinite occurrences of "Unexpected kernel single-step
> > exception at EL1"
> >
> > PSTATE.D is debug exception mask bit. It is set whenever we enter into an
> > exception mode. When it is set then Watchpoint, Breakpoint, and Software
> > Step exceptions are masked. However, software Breakpoint Instruction
> > exceptions can never be masked. Therefore, if we ever execute a BRK
> > instruction, irrespective of D-bit setting, we will be receiving a
> > corresponding  breakpoint exception.
> > For example:
> > - We are executing kprobe pre/post handler, and kprobe has been inserted in
> >   one of the instruction of a function called by handler. So, it executes
> >   BRK instruction and we land into the case of KPROBE_REENTER. (This case
> > is
> >   already handled by current code)
> > - We are executing uprobe handler or any other BRK handler such as in
> >   WARN_ON (BRK BUG_BRK_IMM), and we trace that path using kprobe.So, we
> >   enter into kprobe breakpoint handler,from another BRK handler.(This case
> >   is not being handled currently)
> > In all such cases kprobe breakpoint exception will be raised when we were
> > already in debug exception mode.
> > SPSR's D bit (bit 9) shows the value of PSTATE.D immediately before the
> > exception was taken.So, in above example cases we would find it set in
> > kprobe breakpoint handler.
> > Single step exception will always be followed by a kprobe breakpoint
> > exception.However, it will only be raised gracefully if we clear D bit
> > while returning from breakpoint exception. If D bit is set then, it results
> > into undefined exception and when it's handler enables dbg then single step
> > exception is generated, however it will never be handled(because address
> > does not match and therefore treated as unexpected).
> > This patch clears D-flag unconditionally in setup_singlestep, so that we
> > can always get single step exception correctly after returning from
> > breakpoint exception.
> > Additionally, it also removes D-flag set statement for KPROBE_REENTER
> > return path, because debug exception for KPROBE_REENTER will always take
> > place in a debug exception state. So, D-flag will already be set in this
> > case.
> >
> > Signed-off-by: Pratyush Anand 
> > ---
> >  arch/arm64/kernel/probes/kprobes.c | 29 +
> >  1 file changed, 13 insertions(+), 16 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/probes/kprobes.c
> > b/arch/arm64/kernel/probes/kprobes.c
> > index e51f4ad97525..6e13361b9c01 100644
> > --- a/arch/arm64/kernel/probes/kprobes.c
> > +++ b/arch/arm64/kernel/probes/kprobes.c
> > @@ -166,13 +166,18 @@ static void __kprobes set_current_kprobe(struct
> > kprobe *p)
> >  }
> >
> >  /*
> > - * The D-flag (Debug mask) is set (masked) upon debug exception entry.
> > - * Kprobes needs to clear (unmask) D-flag -ONLY- in case of recursive
> > - * probe i.e. when probe hit from kprobe handler context upon
> > - * executing the pre/post handlers. In this case we return with
> > - * D-flag clear so that single-stepping can be carried-out.
> > - *
> > - * Leave D-flag set in all other cases.
> > + * When PSTATE.D is set (masked), then software step exceptions can not be
> > + * generated.
> > + * SPSR's D bit shows the value of PSTATE.D immediately before the
> > + * exception was taken. PSTATE.D is set while entering into any exception
> > + * mode, however software clears it for any normal (none-debug-exception)
> > + * mode in the exception entry. Therefore, when we are entering into
> > kprobe
> > + * breakpoint handler from any normal mode then SPSR.D bit is already
> > + * cleared, however it is set when we are entering from any debug
> > exception
> > + * mode.
> > + * Since we always need to generate single step exception after a kprobe
> > + * breakpoint exception therefore we need to clear it unconditionally,
> > when
> > + * we become sure that the current breakpoint exception is for kprobe.
> >   */
> >  static void __kprobes
> >  spsr_set_debug_flag(struct pt_regs *regs, int mask)
> > @@ -245,10 +250,7 @@ static void __kprobes setup_singlestep(struct kprobe
> > *p,
> >
> > set_ss_context(kcb, slot);  /* mark pending ss */
> >
> > -   if (kcb->kprobe_status == KPROBE_REENTER)
> > -   spsr_set_debug_flag(regs, 0);
> > -   else
> > -   WARN_ON(regs->pstate & PSR_D_BIT);
> > +   spsr_set_debug_flag(regs, 0);
> >
> > /* IRQs and single stepping do not mix well. */
> > kprobes_save_local_irqflag(kcb, regs);
> > @@ -333,8 +335,6 @@ int __kprobes kprobe_fault_handler(struct pt_regs
> > *regs, unsigned int fsr)
> > 

Re: [PACTH v2 0/3] Implement /proc//totmaps

2016-08-24 Thread Marcin Jabrzyk



On 23/08/16 00:44, Sonny Rao wrote:

On Mon, Aug 22, 2016 at 12:54 AM, Michal Hocko  wrote:

On Fri 19-08-16 10:57:48, Sonny Rao wrote:

On Fri, Aug 19, 2016 at 12:59 AM, Michal Hocko  wrote:

On Thu 18-08-16 23:43:39, Sonny Rao wrote:

On Thu, Aug 18, 2016 at 11:01 AM, Michal Hocko  wrote:

On Thu 18-08-16 10:47:57, Sonny Rao wrote:

On Thu, Aug 18, 2016 at 12:44 AM, Michal Hocko  wrote:

On Wed 17-08-16 11:57:56, Sonny Rao wrote:

[...]

2) User space OOM handling -- we'd rather do a more graceful shutdown
than let the kernel's OOM killer activate and need to gather this
information and we'd like to be able to get this information to make
the decision much faster than 400ms


Global OOM handling in userspace is really dubious if you ask me. I
understand you want something better than SIGKILL and in fact this is
already possible with memory cgroup controller (btw. memcg will give
you a cheap access to rss, amount of shared, swapped out memory as
well). Anyway if you are getting close to the OOM your system will most
probably be really busy and chances are that also reading your new file
will take much more time. I am also not quite sure how is pss useful for
oom decisions.


I mentioned it before, but based on experience RSS just isn't good
enough -- there's too much sharing going on in our use case to make
the correct decision based on RSS.  If RSS were good enough, simply
put, this patch wouldn't exist.


But that doesn't answer my question, I am afraid. So how exactly do you
use pss for oom decisions?


We use PSS to calculate the memory used by a process among all the
processes in the system, in the case of Chrome this tells us how much
each renderer process (which is roughly tied to a particular "tab" in
Chrome) is using and how much it has swapped out, so we know what the
worst offenders are -- I'm not sure what's unclear about that?


So let me ask more specifically. How can you make any decision based on
the pss when you do not know _what_ is the shared resource. In other
words if you select a task to terminate based on the pss then you have to
kill others who share the same resource otherwise you do not release
that shared resource. Not to mention that such a shared resource might
be on tmpfs/shmem and it won't get released even after all processes
which map it are gone.


Ok I see why you're confused now, sorry.

In our case that we do know what is being shared in general because
the sharing is mostly between those processes that we're looking at
and not other random processes or tmpfs, so PSS gives us useful data
in the context of these processes which are sharing the data
especially for monitoring between the set of these renderer processes.


OK, I see and agree that pss might be useful when you _know_ what is
shared. But this sounds quite specific to a particular workload. How
many users are in a similar situation? In other words, if we present
a single number without the context, how much useful it will be in
general? Is it possible that presenting such a number could be even
misleading for somebody who doesn't have an idea which resources are
shared? These are all questions which should be answered before we
actually add this number (be it a new/existing proc file or a syscall).
I still believe that the number without wider context is just not all
that useful.



I see the specific point about  PSS -- because you need to know what
is being shared or otherwise use it in a whole system context, but I
still think the whole system context is a valid and generally useful
thing.  But what about the private_clean and private_dirty?  Surely
those are more generally useful for calculating a lower bound on
process memory usage without additional knowledge?

At the end of the day all of these metrics are approximations, and it
comes down to how far off the various approximations are and what
trade offs we are willing to make.
RSS is the cheapest but the most coarse.

PSS (with the correct context) and Private data plus swap are much
better but also more expensive due to the PT walk.
As far as I know, to get anything but RSS we have to go through smaps
or use memcg.  Swap seems to be available in /proc//status.

I looked at the "shared" value in /proc//statm but it doesn't
seem to correlate well with the shared value in smaps -- not sure why?

It might be useful to show the magnitude of difference of using RSS vs
PSS/Private in the case of the Chrome renderer processes.  On the
system I was looking at there were about 40 of these processes, but I
picked a few to give an idea:

localhost ~ # cat /proc/21550/totmaps
Rss:   98972 kB
Pss:   54717 kB
Shared_Clean:  19020 kB
Shared_Dirty:  26352 kB
Private_Clean: 0 kB
Private_Dirty: 53600 kB
Referenced:92184 kB
Anonymous: 46524 kB
AnonHugePages: 24576 kB
Swap:  13148 kB


RSS is 80% higher than PSS and 

Re: [PATCH] ARM: imx: add cpuidle support for i.mx6ul

2016-08-24 Thread Russell King - ARM Linux
On Wed, Aug 24, 2016 at 12:04:50PM +0200, Lucas Stach wrote:
> Am Mittwoch, den 24.08.2016, 09:53 + schrieb Yongcai Huang:
> > 
> > 
> > Best Regards!
> > Anson Huang
> > 
> > 
> > 
> > > -Original Message-
> > > From: Lucas Stach [mailto:l.st...@pengutronix.de]
> > > Sent: 2016-08-24 5:09 PM
> > > To: Yongcai Huang 
> > > Cc: linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org; 
> > > Fabio
> > > Estevam ; shawn...@kernel.org;
> > > li...@armlinux.org.uk; ker...@pengutronix.de
> > > Subject: Re: [PATCH] ARM: imx: add cpuidle support for i.mx6ul
> > > 
> > > Am Donnerstag, den 25.08.2016, 00:13 +0800 schrieb Anson Huang:
> > > > This patch enables cpuidle driver for i.MX6UL, it reuses i.MX6SX's
> > > > cpuidle driver, 3 levels of cpuidle
> > > > supported:
> > > >
> > > > 1. ARM WFI;
> > > > 2. SOC in WAIT mode;
> > > > 3. SOC in WAIT mode + ARM power off.
> > > >
> > > > As i.MX6UL has cortex-A7 CORE with an internal L2 cache, so need to
> > > > add L2 cache type check to decide if to flush L2 when entering idle
> > > > with ARM power off, this is different from i.MX6SX which has PL310
> > > > external
> > > > L2 cache.
> > > >
> > > > Signed-off-by: Anson Huang 
> > > > ---
> > > >  arch/arm/mach-imx/cpuidle-imx6sx.c | 10 ++
> > > >  arch/arm/mach-imx/mach-imx6ul.c|  3 +++
> > > >  2 files changed, 13 insertions(+)
> > > >
> > > > diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > > b/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > > index 41cdce6..b4fcc8ae 100644
> > > > --- a/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > > +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
> > > > @@ -9,14 +9,21 @@
> > > >  #include 
> > > >  #include 
> > > >  #include 
> > > > +#include 
> > > > +#include 
> > > >  #include 
> > > >  #include 
> > > >
> > > >  #include "common.h"
> > > >  #include "cpuidle.h"
> > > >
> > > > +static bool pl310_available;
> > > > +
> > > >  static int imx6sx_idle_finish(unsigned long val)  {
> > > > +   /* check if need to flush internal L2 cache */
> > > > +   if (!pl310_available)
> > > > +   flush_cache_all();
> > > 
> > > I think this is only necessary when entering the deepest idle state with 
> > > the
> > > ARM core powered off, right? It's a serious overhead for the shallow idle 
> > > states.
> > > 
> > > Also flush_cache_all() only flushes architected/inner caches, so it 
> > > should do the
> > > right thing for this use-case even if the outer PL310 cache is present. 
> > > There is
> > > no need to make this conditional.
> > > 
> > 
> > Sorry, my mutt is NOT working now, so I just reply you using outlook, will 
> > work on my mutt later.
> > 
> > Yes, the imx6sx_idle_finish is only called when entering deepest idle with 
> > ARM powered off.
> > 
> Okay, makes sense.
> 
> > The common cpu_suspend framework already takes care of L1 cache, for 
> > i.MX6SX which is with a 
> > PL310 external L2 cache, as L2 cache memory is NOT powered down, so we no 
> > need to flush it.
> > 
> As far as I can see flush_cache_all() only flushes architected caches.
> The PL310 is NOT an architected, but an outer cache, so it will not be
> touched by flush_cache_all() even if it is present. So the condition to
> only do this when the PL310 isn't present isn't needed.

Look again.  The patch is only calling flush_cache_all() if the L2C-310
is _not_ present.  So, the question about flush_cache_all() touching
the L2C-310 is irrelevant.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


Re: [PATCH 0/8] ftrace/x86: function_graph stack dump fixes

2016-08-24 Thread Ingo Molnar

* Steven Rostedt  wrote:

> On Fri, 19 Aug 2016 06:52:54 -0500
> Josh Poimboeuf  wrote:
> 
> > Some stack dump fixes related to function_graph tracing.
> > 
> > Josh Poimboeuf (8):
> >   ftrace: remove CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST from config
> >   ftrace: only allocate the ret_stack 'fp' field when needed
> >   ftrace: add return address pointer to ftrace_ret_stack
> >   ftrace: add ftrace_graph_ret_addr() stack unwinding helpers
> >   x86/dumpstack/ftrace: convert dump_trace() callbacks to use
> > ftrace_graph_ret_addr()
> >   ftrace/x86: implement HAVE_FUNCTION_GRAPH_RET_ADDR_PTR
> >   x86/dumpstack/ftrace: mark function graph handler function as
> > unreliable
> >   x86/dumpstack/ftrace: don't print unreliable addresses in
> > print_context_stack_bp()
> 
> For the series..
> 
> Acked-by: Steven Rostedt 
> 
> Ingo,
> 
> If you want, please take it through tip.

Thanks Steve!

Ingo


[PATCH] nvme: Fix nvme_get/set_features() with a NULL result pointer

2016-08-24 Thread Andy Lutomirski
nvme_set_features() callers seem to expect that passing NULL as the
result pointer is acceptable.  Teach nvme_set_features() not to try to
write to the NULL address.

For symmetry, make the same change to nvme_get_features(), despite the
fact that all current callers pass a valid result pointer.

I assume that this bug hasn't been reported in practice because
the callers that pass NULL are all in the SCSI translation layer
and no one uses the relevant operations.

Cc: sta...@vger.kernel.org
Signed-off-by: Andy Lutomirski 
---
 drivers/nvme/host/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 7ff2e820bbf4..ebae74f6da9c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -608,7 +608,7 @@ int nvme_get_features(struct nvme_ctrl *dev, unsigned fid, 
unsigned nsid,
 
ret = __nvme_submit_sync_cmd(dev->admin_q, , , NULL, 0, 0,
NVME_QID_ANY, 0, 0);
-   if (ret >= 0)
+   if (ret >= 0 && result)
*result = le32_to_cpu(cqe.result);
return ret;
 }
@@ -628,7 +628,7 @@ int nvme_set_features(struct nvme_ctrl *dev, unsigned fid, 
unsigned dword11,
 
ret = __nvme_submit_sync_cmd(dev->admin_q, , , NULL, 0, 0,
NVME_QID_ANY, 0, 0);
-   if (ret >= 0)
+   if (ret >= 0 && result)
*result = le32_to_cpu(cqe.result);
return ret;
 }
-- 
2.7.4



[PATCH 3/3] net: fs_enet: make rx_copybreak value configurable

2016-08-24 Thread Christophe Leroy
Measurement shows that on a MPC8xx running at 132MHz, the optimal
limit is 112:
* 114 bytes packets are processed in 147 TB ticks with higher copybreak
* 114 bytes packets are processed in 148 TB ticks with lower copybreak
* 128 bytes packets are processed in 154 TB ticks with higher copybreak
* 128 bytes packets are processed in 148 TB ticks with lower copybreak
* 238 bytes packets are processed in 172 TB ticks with higher copybreak
* 238 bytes packets are processed in 148 TB ticks with lower copybreak

However it might be different on other processors
and/or frequencies. So it is useful to make it configurable.

Signed-off-by: Christophe Leroy 
---
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 8 +---
 include/linux/fs_enet_pd.h| 1 -
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c 
b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index addcae6..b59bbf8 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -60,6 +60,10 @@ module_param(fs_enet_debug, int, 0);
 MODULE_PARM_DESC(fs_enet_debug,
 "Freescale bitmapped debugging message enable value");
 
+static int rx_copybreak = 240;
+module_param(rx_copybreak, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(rx_copybreak, "Receive copy threshold");
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void fs_enet_netpoll(struct net_device *dev);
 #endif
@@ -84,7 +88,6 @@ static int fs_enet_napi(struct napi_struct *napi, int budget)
 {
struct fs_enet_private *fep = container_of(napi, struct 
fs_enet_private, napi);
struct net_device *dev = fep->ndev;
-   const struct fs_platform_info *fpi = fep->fpi;
cbd_t __iomem *bdp;
struct sk_buff *skb, *skbn;
int received = 0;
@@ -232,7 +235,7 @@ static int fs_enet_napi(struct napi_struct *napi, int 
budget)
pkt_len = CBDR_DATLEN(bdp) - 4; /* remove CRC */
fep->stats.rx_bytes += pkt_len + 4;
 
-   if (pkt_len <= fpi->rx_copybreak) {
+   if (pkt_len <= rx_copybreak) {
/* +2 to make IP header L1 cache aligned */
skbn = netdev_alloc_skb(dev, pkt_len + 2);
if (skbn != NULL) {
@@ -905,7 +908,6 @@ static int fs_enet_probe(struct platform_device *ofdev)
 
fpi->rx_ring = 32;
fpi->tx_ring = 64;
-   fpi->rx_copybreak = 240;
fpi->napi_weight = 17;
fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) {
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 77d783f..376600e 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -138,7 +138,6 @@ struct fs_platform_info {
 
int rx_ring, tx_ring;   /* number of buffers on rx */
__u8 macaddr[ETH_ALEN]; /* mac address */
-   int rx_copybreak;   /* limit we copy small frames  */
int napi_weight;/* NAPI weight */
 
int use_rmii;   /* use RMII mode   */
-- 
2.1.0



[PATCH v2 5/8] hisi_sas: add v2 hw slot complete internal abort support

2016-08-24 Thread John Garry
Add code in slot_complete_v2_hw() to deal with the
slots which have completed due to internal abort.

The status codes have the following meaning:
- STAT_IO_ABORTED: the IO has been aborted due to
internal abort, whether by device or individual
abort command
- STAT_IO_COMPLETE: internal abort command has
completed successfully for device or individual
abort command
- STAT_IO_NO_DEVICE: internal abort command has
completed for device but cannot find any IO
- STAT_IO_NOT_VALID: internal abort command has
completed for single command but could not
find the command

Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index fec1675..bf9b693 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -227,6 +227,13 @@
 #define CMPLT_HDR_RSPNS_XFRD_MSK   (0x1 << CMPLT_HDR_RSPNS_XFRD_OFF)
 #define CMPLT_HDR_ERX_OFF  12
 #define CMPLT_HDR_ERX_MSK  (0x1 << CMPLT_HDR_ERX_OFF)
+#define CMPLT_HDR_ABORT_STAT_OFF   13
+#define CMPLT_HDR_ABORT_STAT_MSK   (0x7 << CMPLT_HDR_ABORT_STAT_OFF)
+/* abort_stat */
+#define STAT_IO_NOT_VALID  0x1
+#define STAT_IO_NO_DEVICE  0x2
+#define STAT_IO_COMPLETE   0x3
+#define STAT_IO_ABORTED0x4
 /* dw1 */
 #define CMPLT_HDR_IPTT_OFF 0
 #define CMPLT_HDR_IPTT_MSK (0x << CMPLT_HDR_IPTT_OFF)
@@ -1569,6 +1576,30 @@ slot_complete_v2_hw(struct hisi_hba *hisi_hba, struct 
hisi_sas_slot *slot,
goto out;
}
 
+   /* Use SAS+TMF status codes */
+   switch ((complete_hdr->dw0 & CMPLT_HDR_ABORT_STAT_MSK)
+   >> CMPLT_HDR_ABORT_STAT_OFF) {
+   case STAT_IO_ABORTED:
+   /* this io has been aborted by abort command */
+   ts->stat = SAS_ABORTED_TASK;
+   goto out;
+   case STAT_IO_COMPLETE:
+   /* internal abort command complete */
+   ts->stat = TMF_RESP_FUNC_COMPLETE;
+   goto out;
+   case STAT_IO_NO_DEVICE:
+   ts->stat = TMF_RESP_FUNC_COMPLETE;
+   goto out;
+   case STAT_IO_NOT_VALID:
+   /* abort single io, controller don't find
+* the io need to abort
+*/
+   ts->stat = TMF_RESP_FUNC_FAILED;
+   goto out;
+   default:
+   break;
+   }
+
if ((complete_hdr->dw0 & CMPLT_HDR_ERX_MSK) &&
(!(complete_hdr->dw0 & CMPLT_HDR_RSPNS_XFRD_MSK))) {
 
-- 
1.9.1



[PATCH v2 1/3] tracing: Deference pointers without RCU checks

2016-08-24 Thread Binoy Jayan
From: Daniel Wagner 

The tracepoint can't be used in code section where we are in the
middle of a state transition.

For example if we place a tracepoint inside start/stop_critical_section(),
lockdep complains with

[0.035589] WARNING: CPU: 0 PID: 3 at kernel/locking/lockdep.c:3560 \
check_flags.part.36+0x1bc/0x210() [0.036000] \
DEBUG_LOCKS_WARN_ON(current->softirqs_enabled) [0.036000] Kernel panic - 
not \
syncing: panic_on_warn set ... [0.036000]
[0.036000] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.0.0-rc7+ #460
[0.036000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS \
1.7.5-20140709_153950- 04/01/2014 [0.036000]  81f2463a 
88007c93bb98 \
81afb317 0001 [0.036000]  81f212b3 
88007c93bc18 \
81af7bc2 88007c93bbb8 [0.036000]  0008 
88007c93bc28 \
88007c93bbc8 0093bbd8 [0.036000] Call Trace:
[0.036000]  [] dump_stack+0x4f/0x7b
[0.036000]  [] panic+0xc0/0x1e9
[0.036000]  [] ? _raw_spin_unlock_irqrestore+0x38/0x80
[0.036000]  [] warn_slowpath_common+0xc0/0xc0
[0.036000]  [] ? __local_bh_enable+0x36/0x70
[0.036000]  [] warn_slowpath_fmt+0x46/0x50
[0.036000]  [] check_flags.part.36+0x1bc/0x210
[0.036000]  [] lock_is_held+0x78/0x90
[0.036000]  [] ? __local_bh_enable+0x36/0x70
[0.036000]  [] ? __do_softirq+0x3db/0x500
[0.036000]  [] trace_preempt_on+0x255/0x260
[0.036000]  [] preempt_count_sub+0xab/0xf0
[0.036000]  [] __local_bh_enable+0x36/0x70
[0.036000]  [] __do_softirq+0x3db/0x500
[0.036000]  [] run_ksoftirqd+0x1f/0x60
[0.036000]  [] smpboot_thread_fn+0x193/0x2a0
[0.036000]  [] ? SyS_setgroups+0x150/0x150
[0.036000]  [] kthread+0xf2/0x110
[0.036000]  [] ? wait_for_completion+0xc3/0x120
[0.036000]  [] ? preempt_count_sub+0xab/0xf0
[0.036000]  [] ? kthread_create_on_node+0x240/0x240
[0.036000]  [] ret_from_fork+0x58/0x90
[0.036000]  [] ? kthread_create_on_node+0x240/0x240
[0.036000] ---[ end Kernel panic - not syncing: panic_on_warn set ...

PeterZ was so kind to explain it to me what is happening:

"__local_bh_enable() tests if this is the last SOFTIRQ_OFFSET, if so it
tells lockdep softirqs are enabled with trace_softirqs_on() after that
we go an actually modify the preempt_count with preempt_count_sub().
Then in preempt_count_sub() you call into trace_preempt_on() if this
was the last preempt_count increment but you do that _before_ you
actually change the preempt_count with __preempt_count_sub() at this
point lockdep and preempt_count think the world differs and *boom*"

So the simplest way to avoid this is by disabling the consistency
checks.

We also need to take care of the iterating in trace_events_trigger.c
to avoid a splatter in conjunction with the hist trigger.

Signed-off-by: Daniel Wagner 
---
 include/linux/rculist.h | 36 
 include/linux/tracepoint.h  |  4 ++--
 kernel/trace/trace_events_trigger.c |  6 +++---
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 8beb98d..bee836b 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -279,6 +279,24 @@ static inline void list_splice_tail_init_rcu(struct 
list_head *list,
container_of(lockless_dereference(ptr), type, member)
 
 /**
+ * list_entry_rcu_notrace - get the struct for this entry (for tracing)
+ * @ptr:the  list_head pointer.
+ * @type:   the type of the struct this is embedded in.
+ * @member: the name of the list_head within the struct.
+ *
+ * This primitive may safely run concurrently with the _rcu list-mutation
+ * primitives such as list_add_rcu() as long as it's guarded by 
rcu_read_lock().
+ *
+ * This is the same as list_entry_rcu() except that it does
+ * not do any RCU debugging or tracing.
+ */
+#define list_entry_rcu_notrace(ptr, type, member) \
+({ \
+   typeof(*ptr) __rcu *__ptr = (typeof(*ptr) __rcu __force *)ptr; \
+   container_of((typeof(ptr))rcu_dereference_raw_notrace(__ptr), type, 
member); \
+})
+
+/**
  * Where are list_empty_rcu() and list_first_entry_rcu()?
  *
  * Implementing those functions following their counterparts list_empty() and
@@ -391,6 +409,24 @@ static inline void list_splice_tail_init_rcu(struct 
list_head *list,
 pos = list_entry_lockless(pos->member.next, typeof(*pos), member))
 
 /**
+ * list_for_each_entry_rcu_notrace -   iterate over rcu list of given 
type (for tracing)
+ * @pos:   the type * to use as a loop cursor.
+ * @head:  the head for your list.
+ * @member:the name of the list_head within the struct.
+ *
+ * This list-traversal primitive may safely run concurrently with
+ * the _rcu list-mutation primitives such as list_add_rcu()
+ * as long as the traversal is guarded by rcu_read_lock().
+ *
+ * 

[PATCH v2 2/3] tracing: Add trace_irqsoff tracepoints

2016-08-24 Thread Binoy Jayan
This work is based on work by Daniel Wagner. A few tracepoints are added
at the end of the critical section. With the hist trigger in place, the
hist trigger plots may be generated, with per-cpu breakdown of events
captured. It is based on linux kernel's event infrastructure.

The following filter(s) may be used

'hist:key=latency.log2:val=hitcount:sort=latency'
'hist:key=cpu,latency:val=hitcount:sort=latency if cpu==1'
'hist:key=common_pid.execname'

This captures only the latencies introduced by disabled irqs and
preemption. Additional per process data has to be captured to calculate
the effective latencies introduced for individual processes.

Initial work - latency.patch

[1] 
https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit/?h=v3.14-rt-rebase=56d50cc34943bbba12b8c5942ee1ae3b29f73acb

Signed-off-by: Binoy Jayan 
---
 include/trace/events/latency.h | 43 ++
 kernel/trace/trace_irqsoff.c   | 42 -
 2 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/latency.h

diff --git a/include/trace/events/latency.h b/include/trace/events/latency.h
new file mode 100644
index 000..77896c7
--- /dev/null
+++ b/include/trace/events/latency.h
@@ -0,0 +1,43 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM latency
+
+#if !defined(_TRACE_HIST_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_HIST_H
+
+#include 
+
+DECLARE_EVENT_CLASS(latency_template,
+   TP_PROTO(int cpu, cycles_t latency),
+
+   TP_ARGS(cpu, latency),
+
+   TP_STRUCT__entry(
+   __field(int,cpu)
+   __field(cycles_t,   latency)
+   ),
+
+   TP_fast_assign(
+   __entry->cpu= cpu;
+   __entry->latency= latency;
+   ),
+
+   TP_printk("cpu=%d, latency=%lu", __entry->cpu,
+   (unsigned long) __entry->latency)
+);
+
+DEFINE_EVENT(latency_template, latency_irqs,
+   TP_PROTO(int cpu, cycles_t latency),
+   TP_ARGS(cpu, latency));
+
+DEFINE_EVENT(latency_template, latency_preempt,
+   TP_PROTO(int cpu, cycles_t latency),
+   TP_ARGS(cpu, latency));
+
+DEFINE_EVENT(latency_template, latency_critical_timings,
+   TP_PROTO(int cpu, cycles_t latency),
+   TP_ARGS(cpu, latency));
+
+#endif /* _TRACE_HIST_H */
+
+/* This part must be outside protection */
+#include 
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 03cdff8..3fcf446 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -13,14 +13,22 @@
 #include 
 #include 
 #include 
+#include 
+
+#include 
 
 #include "trace.h"
 
+#define CREATE_TRACE_POINTS
+#include 
+
 static struct trace_array  *irqsoff_trace __read_mostly;
 static int tracer_enabled __read_mostly;
 
 static DEFINE_PER_CPU(int, tracing_cpu);
-
+static DEFINE_PER_CPU(cycle_t __maybe_unused, ts_irqs);
+static DEFINE_PER_CPU(cycle_t __maybe_unused, ts_preempt);
+static DEFINE_PER_CPU(cycle_t __maybe_unused, ts_critical_timings);
 static DEFINE_RAW_SPINLOCK(max_trace_lock);
 
 enum {
@@ -419,9 +427,17 @@ stop_critical_timing(unsigned long ip, unsigned long 
parent_ip)
atomic_dec(>disabled);
 }
 
+static inline cycle_t get_delta(cycle_t __percpu *ts)
+{
+   return (cycle_t) trace_clock_local() - this_cpu_read(*ts);
+}
 /* start and stop critical timings used to for stoppage (in idle) */
 void start_critical_timings(void)
 {
+   if (trace_latency_critical_timings_enabled())
+   this_cpu_write(ts_critical_timings,
+   (cycle_t) trace_clock_local());
+
if (preempt_trace() || irq_trace())
start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
 }
@@ -431,6 +447,13 @@ void stop_critical_timings(void)
 {
if (preempt_trace() || irq_trace())
stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
+
+   if (trace_latency_critical_timings_enabled()) {
+   trace_latency_critical_timings(
+   raw_smp_processor_id(),
+   get_delta(_critical_timings));
+   }
+
 }
 EXPORT_SYMBOL_GPL(stop_critical_timings);
 
@@ -438,6 +461,10 @@ EXPORT_SYMBOL_GPL(stop_critical_timings);
 #ifdef CONFIG_PROVE_LOCKING
 void time_hardirqs_on(unsigned long a0, unsigned long a1)
 {
+   if (trace_latency_irqs_enabled()) {
+   trace_latency_irqs(raw_smp_processor_id(),
+   get_delta(_irqs));
+   }
if (!preempt_trace() && irq_trace())
stop_critical_timing(a0, a1);
 }
@@ -446,6 +473,10 @@ void time_hardirqs_off(unsigned long a0, unsigned long a1)
 {
if (!preempt_trace() && irq_trace())
start_critical_timing(a0, a1);
+
+   if (trace_latency_irqs_enabled()) {
+this_cpu_write(ts_irqs, (cycle_t) 

[PATCH v2 0/3] *** Latency histograms - IRQSOFF,PREEMPTOFF ***

2016-08-24 Thread Binoy Jayan
Hi,

Thank you Steven and Daniel for reviewing v1 and providing suggestions.
These set of patches [v2] capture latency events caused by interrupts and
premption disabled in kernel. The patches are based on the hist trigger
feature developed by Tom Zanussi.

Git-commit: 7ef224d1d0e3a1ade02d02c01ce1dcffb736d2c3

As mentioned by Daniel, there is also a good write up in the following 
blog by Brendan Gregg:
http://www.brendangregg.com/blog/2016-06-08/linux-hist-triggers.html

The perf interface for the same have not been developed yet.
Related efforts: https://patchwork.kernel.org/patch/8439401

hwlat_detector tracer:
https://lkml.org/lkml/2016/8/4/348
https://lkml.org/lkml/2016/8/4/346

The patch series also contains histogram triggers for missed
hrtimer offsets.

Dependencies:
CONFIG_IRQSOFF_TRACER
CONFIG_PREEMPT_TRACER
CONFIG_PROVE_LOCKING
CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG

Usage of triggers to generate histograms:

mount -t debugfs nodev /sys/kernel/debug
echo 'hist:key=latency.log2:val=hitcount:sort=latency' > 
/sys/kernel/debug/tracing/events/latency/latency_irqs/trigger
echo 'hist:key=common_pid.execname' > 
/sys/kernel/debug/tracing/events/latency/latency_hrtimer_interrupt/trigger

CPU specific breakdown of events:

echo 'hist:key=cpu,latency:val=hitcount:sort=latency' > 
/sys/kernel/debug/tracing/events/latency/latency_preempt/trigger
echo 'hist:key=cpu,latency:val=hitcount:sort=latency if cpu==1' > 
/sys/kernel/debug/tracing/events/latency/latency_preempt/trigger

Histogram output:
cat /sys/kernel/debug/tracing/events/latency/latency_irqs/hist
cat /sys/kernel/debug/tracing/events/latency/latency_preempt/hist
cat /sys/kernel/debug/tracing/events/latency/latency_critical_timings/hist
cat /sys/kernel/debug/tracing/events/latency/latency_hrtimer_interrupt/hist

Disable a trigger:
echo '!hist:key=latency.log2' > 
/sys/kernel/debug/tracing/events/latency/latency_irqs/trigger

Changes from v1 as per comments from Steven/Daniel
  - Use single tracepoint for irq/preempt/critical timings by introducing
a trace type field to differentiate trace type in the same tracepoint.
A suspicious RCU usage error was introduced, while using the trigger
command by mentioning the trace type as a key along with cpu.
I couldn't figure out why. Also, this type of arrangement may also 
be substandard performance vice.
  - Using a more accurate fast local clock instead of a global ftrace clock.

TODO:
1. perf interface. Not sure if this is needed
2. Latency histograms - process wakeup latency
  - Suggestion from Daniel to not introduce tracepoints in scheduler's hotpaths
  - Alternative to attach kprobes to functions which falls in critical paths
and find diff of timestamps using event trigger commands.

For example:

echo "p:myprobe1 start_critical_timings" > 
/sys/kernel/debug/tracing/kprobe_events
echo "p:myprobe2 stop_critical_timings" >>  
/sys/kernel/debug/tracing/kprobe_events
cat /sys/kernel/debug/tracing/kprobe_events
echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe1/enable
echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe2/enable
cat /sys/kernel/debug/tracing/kprobe_events

And somehow save the timestamps for 'myprobe1' and 'myprobe2' in
'event_hist_trigger()'. This seems not feasible now as the histogram
data is saved as a 'sum' only for the conditions met in the key definition.
This makes it impossible to save timestamps for individual events.

kernel/trace/trace_events_hist.c +840: hist_trigger_elt_update()

Mhiramat and Steve, suggested an alternative to keep this timestamp is
to create a new ftrace map, store the timestamp with context "key" on the
named map upon event start. Then, at the event end trigger the histogram,
pick timestamp from the map by using context "key" and calculate the
difference. Basically this needs is a "map" which can be accessed from both
the events, .i.e that is the "global variable".

Binoy

Binoy Jayan (2):
  tracing: Add trace_irqsoff tracepoints
  tracing: Histogram for missed timer offsets

Daniel Wagner (1):
  tracing: Deference pointers without RCU checks

 include/linux/hrtimer.h |  3 ++
 include/linux/rculist.h | 36 ++
 include/linux/tracepoint.h  |  4 +-
 include/trace/events/latency.h  | 74 +
 kernel/time/hrtimer.c   | 39 +++
 kernel/trace/trace_events_trigger.c |  6 +--
 kernel/trace/trace_irqsoff.c| 42 -
 7 files changed, 198 insertions(+), 6 deletions(-)
 create mode 100644 include/trace/events/latency.h

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 3/3] tracing: Histogram for missed timer offsets

2016-08-24 Thread Binoy Jayan
Latencies of missed timer offsets. Generate a histogram of missed
timer offsets in microseconds. This will be a based along with irq
and preemption latencies to calculate the effective process wakeup
latencies.

The following filter(s) may be used

'hist:key=common_pid.execname'
'hist:key=common_pid.execname,cpu:val=toffset,hitcount'

Signed-off-by: Binoy Jayan 
---
 include/linux/hrtimer.h|  3 +++
 include/trace/events/latency.h | 31 +++
 kernel/time/hrtimer.c  | 39 +++
 3 files changed, 73 insertions(+)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5e00f80..e09de14 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -104,6 +104,9 @@ struct hrtimer {
struct hrtimer_clock_base   *base;
u8  state;
u8  is_rel;
+#if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER)
+   ktime_t praecox;
+#endif
 #ifdef CONFIG_TIMER_STATS
int start_pid;
void*start_site;
diff --git a/include/trace/events/latency.h b/include/trace/events/latency.h
index 77896c7..24cf009 100644
--- a/include/trace/events/latency.h
+++ b/include/trace/events/latency.h
@@ -37,6 +37,37 @@ DEFINE_EVENT(latency_template, latency_critical_timings,
TP_PROTO(int cpu, cycles_t latency),
TP_ARGS(cpu, latency));
 
+TRACE_EVENT(latency_hrtimer_interrupt,
+
+   TP_PROTO(int cpu, long long toffset, struct task_struct *curr,
+   struct task_struct *task),
+
+   TP_ARGS(cpu, toffset, curr, task),
+
+   TP_STRUCT__entry(
+   __field(int,cpu)
+   __field(long long,  toffset)
+   __array(char,   ccomm,  TASK_COMM_LEN)
+   __field(int,cprio)
+   __array(char,   tcomm,  TASK_COMM_LEN)
+   __field(int,tprio)
+   ),
+
+   TP_fast_assign(
+   __entry->cpu = cpu;
+   __entry->toffset = toffset;
+   memcpy(__entry->ccomm, curr->comm, TASK_COMM_LEN);
+   __entry->cprio  = curr->prio;
+   memcpy(__entry->tcomm, task != NULL ? task->comm : "",
+   task != NULL ? TASK_COMM_LEN : 7);
+   __entry->tprio  = task != NULL ? task->prio : -1;
+   ),
+
+   TP_printk("cpu=%d toffset=%lld curr=%s[%d] thread=%s[%d]",
+   __entry->cpu, __entry->toffset, __entry->ccomm,
+   __entry->cprio, __entry->tcomm, __entry->tprio)
+);
+
 #endif /* _TRACE_HIST_H */
 
 /* This part must be outside protection */
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 9ba7c82..1a96e34 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -53,9 +53,12 @@
 #include 
 
 #include 
+#include 
 
 #include "tick-internal.h"
 
+static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer);
+
 /*
  * The timer bases:
  *
@@ -960,6 +963,38 @@ static inline ktime_t hrtimer_update_lowres(struct hrtimer 
*timer, ktime_t tim,
return tim;
 }
 
+static inline void trace_latency_mark_ts(struct hrtimer *timer,
+struct hrtimer_clock_base *new_base,
+ktime_t tim)
+{
+#if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER)
+   if (trace_latency_hrtimer_interrupt_enabled()) {
+   ktime_t now = new_base->get_time();
+
+   if (ktime_to_ns(tim) < ktime_to_ns(now))
+   timer->praecox = now;
+   else
+   timer->praecox = ktime_set(0, 0);
+   }
+#endif
+}
+
+static inline void trace_missed_hrtimer(struct hrtimer *timer, ktime_t basenow)
+{
+#if defined(CONFIG_PREEMPT_TRACER) || defined(CONFIG_IRQSOFF_TRACER)
+   if (trace_latency_hrtimer_interrupt_enabled())
+   trace_latency_hrtimer_interrupt(raw_smp_processor_id(),
+   ktime_to_ns(ktime_sub(ktime_to_ns(timer->praecox) ?
+   timer->praecox : hrtimer_get_expires(timer),
+   basenow)),
+   current,
+   timer->function == hrtimer_wakeup ?
+   container_of(timer, struct hrtimer_sleeper,
+   timer)->task : NULL);
+#endif
+
+}
+
 /**
  * hrtimer_start_range_ns - (re)start an hrtimer on the current CPU
  * @timer: the timer to be added
@@ -992,6 +1027,8 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t 
tim,
 
timer_stats_hrtimer_set_start_info(timer);
 
+   trace_latency_mark_ts(timer, new_base, tim);
+
leftmost = enqueue_hrtimer(timer, new_base);
if (!leftmost)
goto unlock;
@@ 

[PATCH v3] pwm: sun4i: fix a possible NULL dereference

2016-08-24 Thread LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later.

For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.

Testing the return value of of_device_get_match_data is also necessary
for avoiding a second NULL deref on pwm->data.

Reported-by: coverity (CID 1324139)
Signed-off-by: LABBE Corentin 
---
Changes since v2:
 - Add a test on pwm->data for avoiding a second NULL deref.
Changes since v1:
 - Use of_device_get_match_data()

 drivers/pwm/pwm-sun4i.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 03a99a5..fb76c55 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -309,9 +309,6 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
struct resource *res;
u32 val;
int i, ret;
-   const struct of_device_id *match;
-
-   match = of_match_device(sun4i_pwm_dt_ids, >dev);
 
pwm = devm_kzalloc(>dev, sizeof(*pwm), GFP_KERNEL);
if (!pwm)
@@ -326,7 +323,9 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
if (IS_ERR(pwm->clk))
return PTR_ERR(pwm->clk);
 
-   pwm->data = match->data;
+   pwm->data = of_device_get_match_data(>dev);
+   if (!pwm->data)
+   return -EINVAL;
pwm->chip.dev = >dev;
pwm->chip.ops = _pwm_ops;
pwm->chip.base = -1;
-- 
2.7.3



[PATCH 22/41] staging: r8188eu: remove HT_cap member of HT_caps_element structure

2016-08-24 Thread Ivan Safonov
This member used only once and can be replaced
with address of HT_caps_element.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 3 ++-
 drivers/staging/rtl8188eu/include/wifi.h   | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index 548db72..c07e4cb 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -716,6 +716,7 @@ void HT_caps_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
struct mlme_priv*pmlmepriv = >mlmepriv;
struct ht_priv  *phtpriv = >htpriv;
+   u8 *HT_cap = (u8 *)(>HT_caps.u.HT_cap_element);
 
if (pIE == NULL)
return;
@@ -728,7 +729,7 @@ void HT_caps_handler(struct adapter *padapter, struct 
ndis_802_11_var_ie *pIE)
for (i = 0; i < (pIE->Length); i++) {
if (i != 2) {
/*  Got the endian issue here. */
-   pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]);
+   HT_cap[i] &= (pIE->data[i]);
} else {
/* modify from  fw by Thomas 2010/11/17 */
if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 
0x3) > (pIE->data[i] & 0x3))
diff --git a/drivers/staging/rtl8188eu/include/wifi.h 
b/drivers/staging/rtl8188eu/include/wifi.h
index e049eed..27276fe 100644
--- a/drivers/staging/rtl8188eu/include/wifi.h
+++ b/drivers/staging/rtl8188eu/include/wifi.h
@@ -532,7 +532,6 @@ struct HT_caps_element {
unsigned intBeamforming_caps;
unsigned char   ASEL_caps;
} HT_cap_element;
-   unsigned char HT_cap[26];
} u;
 } __packed;
 
-- 
2.7.3



Re: [PATCH] ARM: imx: add cpuidle support for i.mx6ul

2016-08-24 Thread Lucas Stach
Am Donnerstag, den 25.08.2016, 00:13 +0800 schrieb Anson Huang:
> This patch enables cpuidle driver for i.MX6UL, it
> reuses i.MX6SX's cpuidle driver, 3 levels of cpuidle
> supported:
> 
> 1. ARM WFI;
> 2. SOC in WAIT mode;
> 3. SOC in WAIT mode + ARM power off.
> 
> As i.MX6UL has cortex-A7 CORE with an internal L2
> cache, so need to add L2 cache type check to decide
> if to flush L2 when entering idle with ARM power off,
> this is different from i.MX6SX which has PL310 external
> L2 cache.
> 
> Signed-off-by: Anson Huang 
> ---
>  arch/arm/mach-imx/cpuidle-imx6sx.c | 10 ++
>  arch/arm/mach-imx/mach-imx6ul.c|  3 +++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c 
> b/arch/arm/mach-imx/cpuidle-imx6sx.c
> index 41cdce6..b4fcc8ae 100644
> --- a/arch/arm/mach-imx/cpuidle-imx6sx.c
> +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c
> @@ -9,14 +9,21 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  
>  #include "common.h"
>  #include "cpuidle.h"
>  
> +static bool pl310_available;
> +
>  static int imx6sx_idle_finish(unsigned long val)
>  {
> + /* check if need to flush internal L2 cache */
> + if (!pl310_available)
> + flush_cache_all();

I think this is only necessary when entering the deepest idle state with
the ARM core powered off, right? It's a serious overhead for the shallow
idle states.

Also flush_cache_all() only flushes architected/inner caches, so it
should do the right thing for this use-case even if the outer PL310
cache is present. There is no need to make this conditional.

Regards,
Lucas
 
>   cpu_do_idle();
>  
>   return 0;
> @@ -101,5 +108,8 @@ int __init imx6sx_cpuidle_init(void)
>   imx_gpc_set_arm_power_up_timing(2, 1);
>   imx_gpc_set_arm_power_down_timing(1, 1);
>  
> + if (of_find_compatible_node(NULL, NULL, "arm,pl310-cache"))
> + pl310_available = true;
> +
>   return cpuidle_register(_cpuidle_driver, NULL);
>  }
> diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c
> index c2cd61c..9c5e8f3 100644
> --- a/arch/arm/mach-imx/mach-imx6ul.c
> +++ b/arch/arm/mach-imx/mach-imx6ul.c
> @@ -16,6 +16,7 @@
>  #include 
>  
>  #include "common.h"
> +#include "cpuidle.h"
>  
>  static void __init imx6ul_enet_clk_init(void)
>  {
> @@ -80,6 +81,8 @@ static void __init imx6ul_init_irq(void)
>  
>  static void __init imx6ul_init_late(void)
>  {
> + imx6sx_cpuidle_init();
> +
>   if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) {
>   imx6_pm_opp_init();
>   platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);




[PATCH 10/16 v2] cpuidle: pseries: Convert to hotplug state machine

2016-08-24 Thread Sebastian Andrzej Siewior
Install the callbacks via the state machine.

v1…v2: Use only CPUHP_CPUIDLE_DEAD (requested by Daniel Lezcano)

Cc: "Rafael J. Wysocki" 
Cc: Daniel Lezcano 
Cc: linux...@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/cpuidle/cpuidle-pseries.c | 53 ++-
 include/linux/cpuhotplug.h|  1 +
 2 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-pseries.c 
b/drivers/cpuidle/cpuidle-pseries.c
index 07135e009d8b..abbce8f96d93 100644
--- a/drivers/cpuidle/cpuidle-pseries.c
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -171,39 +171,29 @@ static struct cpuidle_state shared_states[] = {
.enter = _cede_loop },
 };
 
-static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
-   unsigned long action, void *hcpu)
+static int pseries_cpuidle_cpu_online(unsigned int cpu)
 {
-   int hotcpu = (unsigned long)hcpu;
-   struct cpuidle_device *dev =
-   per_cpu(cpuidle_devices, hotcpu);
+   struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
 
if (dev && cpuidle_get_driver()) {
-   switch (action) {
-   case CPU_ONLINE:
-   case CPU_ONLINE_FROZEN:
-   cpuidle_pause_and_lock();
-   cpuidle_enable_device(dev);
-   cpuidle_resume_and_unlock();
-   break;
-
-   case CPU_DEAD:
-   case CPU_DEAD_FROZEN:
-   cpuidle_pause_and_lock();
-   cpuidle_disable_device(dev);
-   cpuidle_resume_and_unlock();
-   break;
-
-   default:
-   return NOTIFY_DONE;
-   }
+   cpuidle_pause_and_lock();
+   cpuidle_enable_device(dev);
+   cpuidle_resume_and_unlock();
}
-   return NOTIFY_OK;
+   return 0;
 }
 
-static struct notifier_block setup_hotplug_notifier = {
-   .notifier_call = pseries_cpuidle_add_cpu_notifier,
-};
+static int pseries_cpuidle_cpu_dead(unsigned int cpu)
+{
+   struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu);
+
+   if (dev && cpuidle_get_driver()) {
+   cpuidle_pause_and_lock();
+   cpuidle_disable_device(dev);
+   cpuidle_resume_and_unlock();
+   }
+   return 0;
+}
 
 /*
  * pseries_cpuidle_driver_init()
@@ -273,7 +263,14 @@ static int __init pseries_processor_idle_init(void)
return retval;
}
 
-   register_cpu_notifier(_hotplug_notifier);
+   retval = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+  "CPUIDLE_PSERIES_ONLINE",
+  pseries_cpuidle_cpu_online, NULL);
+   WARN_ON(retval < 0);
+   retval = cpuhp_setup_state_nocalls(CPUHP_CPUIDLE_DEAD,
+  "CPUIDLE_PSERIES_DEAD", NULL,
+  pseries_cpuidle_cpu_dead);
+   WARN_ON(retval < 0);
printk(KERN_DEBUG "pseries_idle_driver registered\n");
return 0;
 }
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 5811954809af..14b58a9d1450 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -19,6 +19,7 @@ enum cpuhp_state {
CPUHP_MM_WRITEBACK_DEAD,
CPUHP_SOFTIRQ_DEAD,
CPUHP_NET_MVNETA_DEAD,
+   CPUHP_CPUIDLE_DEAD,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
-- 
2.9.3



Re: [GIT PULL 00/35] perf/core improvements and fixes

2016-08-24 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo,
> 
>   Please consider pulling, I first merged tip/perf/urgent into a
> tip/perf/core and rebased the patches I had in acme/perf/core.
> 
> - Arnaldo
> 
> Build stats at the end of this message.
> 
> The following changes since commit ce90c12d2453aa6be743719bb0a5d4040b92700f:
> 
>   Merge branch 'perf/urgent' into perf/core, to pick up fixes before merging 
> new changes (2016-08-23 15:35:47 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
> tags/perf-core-for-mingo-20160823
> 
> for you to fetch changes up to 5e30d55c71de058e4156080fe32d426c22d094cb:
> 
>   perf record: Fix spelling mistake "Finshed" -> "Finished" (2016-08-23 
> 17:06:40 -0300)
> 
> 
> perf/core improvements and fixes:
> 
> User visible:
> 
> . Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
>   for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo 
> Carvalho de Melo)
> 
> - Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' 
> (Masami Hiramatsu)
> 
> Infrastructure:
> 
> - Skip running the feature tests for 'make install-doc' (Rui Teng)
> 
> - Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
>   to use in all of tools/ (Arnaldo Carvalho de Melo)
> 
> - Break down symbol__disassemble() into multiple functions, to ease
>   future work on better reporting the errors that may take place in
>   the various steps it performs (possibly decompressing kernel module
>   files, getting build-id keyed files, calling objdump, parsing its
>   output, etc) (Arnaldo Carvalho de Melo)
> 
> - Typo fixes in various places (Colin Ian King)
> 
> - Remove superfluous NULL check in the TUI code (Colin Ian King)
> 
> - Allow displaying multiple header lines in the TUI browser, prep
>   work for the 'perf c2c' browser (Jiri Olsa)
> 
> - Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)
> 
> - Use __weak definition from linux/compiler.h (Rui Teng)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> 
> Arnaldo Carvalho de Melo (16):
>   tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
>   perf bench numa: Use NSEC_PER_U?SEC
>   perf sched: Use linux/time64.h
>   perf timechart: Use NSEC_PER_U?SEC
>   perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
>   perf stat: Use *SEC_PER_*SEC macros
>   perf bench mem: Use USEC_PER_SEC
>   perf bench sched-messaging: Use USEC_PER_MSEC
>   perf record: Use USEC_PER_MSEC
>   perf kvm: Use NSEC_PER_USEC
>   perf bench futex: Use NSEC_PER_USEC
>   perf top: Use MSEC_PER_SEC
>   perf disassemble: Move check for kallsyms + !kcore
>   perf disassemble: Simplify logic for picking the filename to disassemble
>   perf disassemble: Extract logic to find file to pass to objdump to a 
> separate function
>   perf report: Allow configuring the default sort order in ~/.perfconfig
> 
> Colin Ian King (5):
>   perf hists browser: Remove superfluous null check on map
>   perf tools: Fix typo: "ehough" -> "enough"
>   perf test bpf: Fix typo: "ehough" -> "enough"
>   perf bpf: Fix typo: "ehough" -> "enough"
>   perf record: Fix spelling mistake "Finshed" -> "Finished"
> 
> Jiri Olsa (5):
>   perf hists: Introduce nr_header_lines into struct perf_hpp_list
>   perf hists: Add line argument into perf_hpp_fmt's header callback
>   perf tools tui: Display multiple header lines
>   perf tools stdio: Display multiple header lines
>   perf hists: Add support for header span
> 
> Masami Hiramatsu (6):
>   ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
>   ftrace: probe: Add README entries for k/uprobe-events
>   perf probe: Add supported for type casting by the running kernel
>   perf probe: Support hexadecimal casting
>   perf probe: Use hexadecimal type by default if possible
>   ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
> 
> Mathieu Poirier (1):
>   tools: Copy coresight-pmu.h header file needed by perf tools
> 
> Rui Teng (2):
>   perf tools: Use __weak definition from linux/compiler.h
>   perf tools: Skip running the feature tests for 'make install-doc'
> 
>  Documentation/trace/kprobetrace.txt|  9 ++-
>  Documentation/trace/uprobetracer.txt   |  9 ++-
>  kernel/trace/trace.c   | 24 ++
>  kernel/trace/trace_kprobe.c|  4 +
>  kernel/trace/trace_probe.c | 30 
>  kernel/trace/trace_probe.h | 11 ++-
>  kernel/trace/trace_uprobe.c|  4 +
>  tools/include/linux/coresight-pmu.h| 39 

[PATCH v2] staging: android: ion: ion.c fix parenthesis alignment

2016-08-24 Thread Didik Setiawan
Fix checkpatch.pl warning about "Alignment should match open parenthesis".

Signed-off-by: Didik Setiawan 
---
 drivers/staging/android/ion/ion.c | 47 +++
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 88dd17e..9ee8229 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -174,10 +174,10 @@ static void ion_buffer_add(struct ion_device *dev,
 
 /* this function should only be called while dev->lock is held */
 static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
-struct ion_device *dev,
-unsigned long len,
-unsigned long align,
-unsigned long flags)
+   struct ion_device *dev,
+   unsigned long len,
+   unsigned long align,
+   unsigned long flags)
 {
struct ion_buffer *buffer;
struct sg_table *table;
@@ -331,7 +331,7 @@ static void ion_buffer_remove_from_handle(struct ion_buffer 
*buffer)
 }
 
 static struct ion_handle *ion_handle_create(struct ion_client *client,
-struct ion_buffer *buffer)
+   struct ion_buffer *buffer)
 {
struct ion_handle *handle;
 
@@ -421,7 +421,7 @@ static struct ion_handle *ion_handle_lookup(struct 
ion_client *client,
 }
 
 static struct ion_handle *ion_handle_get_by_id_nolock(struct ion_client 
*client,
-   int id)
+ int id)
 {
struct ion_handle *handle;
 
@@ -581,7 +581,7 @@ static void *ion_buffer_kmap_get(struct ion_buffer *buffer)
}
vaddr = buffer->heap->ops->map_kernel(buffer->heap, buffer);
if (WARN_ONCE(vaddr == NULL,
-   "heap->ops->map_kernel should return ERR_PTR on error"))
+ "heap->ops->map_kernel should return ERR_PTR on error"))
return ERR_PTR(-EINVAL);
if (IS_ERR(vaddr))
return vaddr;
@@ -750,14 +750,14 @@ static const struct file_operations debug_client_fops = {
 };
 
 static int ion_get_client_serial(const struct rb_root *root,
-   const unsigned char *name)
+const unsigned char *name)
 {
int serial = -1;
struct rb_node *node;
 
for (node = rb_first(root); node; node = rb_next(node)) {
struct ion_client *client = rb_entry(node, struct ion_client,
-   node);
+node);
 
if (strcmp(client->name, name))
continue;
@@ -832,14 +832,14 @@ struct ion_client *ion_client_create(struct ion_device 
*dev,
rb_insert_color(>node, >clients);
 
client->debug_root = debugfs_create_file(client->display_name, 0664,
-   dev->clients_debug_root,
-   client, _client_fops);
+dev->clients_debug_root,
+client, _client_fops);
if (!client->debug_root) {
char buf[256], *path;
 
path = dentry_path(dev->clients_debug_root, buf, 256);
pr_err("Failed to create client debugfs at %s/%s\n",
-   path, client->display_name);
+  path, client->display_name);
}
 
up_write(>lock);
@@ -907,7 +907,7 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment 
*attachment,
 }
 
 void ion_pages_sync_for_device(struct device *dev, struct page *page,
-   size_t size, enum dma_data_direction dir)
+  size_t size, enum dma_data_direction dir)
 {
struct scatterlist sg;
 
@@ -947,7 +947,7 @@ static void ion_buffer_sync_for_device(struct ion_buffer 
*buffer,
 
if (ion_buffer_page_is_dirty(page))
ion_pages_sync_for_device(dev, ion_buffer_page(page),
-   PAGE_SIZE, dir);
+ PAGE_SIZE, dir);
 
ion_buffer_page_clean(buffer->pages + i);
}
@@ -1025,7 +1025,7 @@ static int ion_mmap(struct dma_buf *dmabuf, struct 
vm_area_struct *vma)
 
if (!buffer->heap->ops->map_user) {
pr_err("%s: this heap does not define a method for mapping to 
userspace\n",
-   __func__);
+  __func__);
return -EINVAL;
   

Re: [PATCH v3 0/2] AM335x-ICE: Add support for rotary switch

2016-08-24 Thread Vignesh R
Hi,

On Wednesday 24 August 2016 02:05 PM, Daniel Mack wrote:
> Hi,
> 
> On 08/24/2016 09:58 AM, Vignesh R wrote:
>> This series adds support for rotary-switch on AM335x-ICE that is
>> connected to TI PCA9536 I2C GPIO expander.
>> First patch adds new generic driver to read status of group of GPIO
>> lines and report the value as an input event. The second patch adds DT
>> entries for the same.
>>
>> v2: https://lkml.org/lkml/2016/8/23/111
>> v1: https://lkml.org/lkml/2016/8/12/7
> 
> Is there a reason why the rotary-encoder driver cannot handle this?
> Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
> as input") added support for that mode AFAIU.
> 

Rotary encoder driver handles incremental encoders only and does not
support absolute encoders. The rotary switch on am335x-ice is different
from the incremental encoders in the
sense that GPIO line status directly reflect the position(number)
pointed by the dial of the encoder. So, there is no need to count steps
or know the direction of rotation as it does not matter.

I did try to enhance rotary-encoder driver to support absolute
encoder[1] but the comment there was to write new driver that simply
translates gpio-encoded value into ABS* event. Indeed, the new driver
looks more simple and can handle more such hardwares.

[1] https://lkml.org/lkml/2016/5/19/98


-- 
Regards
Vignesh


[tip:perf/core] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  16633ccff091dacb2138b95e8911a1892983c6fd
Gitweb: http://git.kernel.org/tip/16633ccff091dacb2138b95e8911a1892983c6fd
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 14:51:30 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC

Following kernel practices.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-wgfu1h1pnw8lc919o2tan...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bench/sched-pipe.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 1dc2d13..2243f01 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -153,24 +154,24 @@ int bench_sched_pipe(int argc, const char **argv, const 
char *prefix __maybe_unu
printf("# Executed %d pipe operations between two %s\n\n",
loops, threaded ? "threads" : "processes");
 
-   result_usec = diff.tv_sec * 100;
+   result_usec = diff.tv_sec * USEC_PER_SEC;
result_usec += diff.tv_usec;
 
printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
   diff.tv_sec,
-  (unsigned long) (diff.tv_usec/1000));
+  (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 
printf(" %14lf usecs/op\n",
   (double)result_usec / (double)loops);
printf(" %14d ops/sec\n",
   (int)((double)loops /
-((double)result_usec / (double)100)));
+((double)result_usec / (double)USEC_PER_SEC)));
break;
 
case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n",
   diff.tv_sec,
-  (unsigned long) (diff.tv_usec / 1000));
+  (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
 
default:


[tip:perf/core] perf timechart: Use NSEC_PER_U?SEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  af4b2c972a5fc9358486d946d15f32510534ccbf
Gitweb: http://git.kernel.org/tip/af4b2c972a5fc9358486d946d15f32510534ccbf
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 12:45:58 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf timechart: Use NSEC_PER_U?SEC

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter 
Cc: Arjan van de Ven 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Stanislav Fomichev 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-5l1md8lsdhfnrlsqyejzo...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-timechart.c | 13 +++--
 tools/perf/util/svghelper.c| 11 ++-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 733a554..e7eaa29 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -24,6 +24,7 @@
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include 
+#include 
 #include "util/symbol.h"
 #include "util/callchain.h"
 #include "util/strlist.h"
@@ -1288,9 +1289,9 @@ static void draw_process_bars(struct timechart *tchart)
if (c->comm) {
char comm[256];
if (c->total_time > 50) /* 5 seconds */
-   sprintf(comm, "%s:%i (%2.2fs)", 
c->comm, p->pid, c->total_time / 10.0);
+   sprintf(comm, "%s:%i (%2.2fs)", 
c->comm, p->pid, c->total_time / (double)NSEC_PER_SEC);
else
-   sprintf(comm, "%s:%i (%3.1fms)", 
c->comm, p->pid, c->total_time / 100.0);
+   sprintf(comm, "%s:%i (%3.1fms)", 
c->comm, p->pid, c->total_time / (double)NSEC_PER_MSEC);
 
svg_text(Y, c->start_time, comm);
}
@@ -1637,7 +1638,7 @@ static int __cmd_timechart(struct timechart *tchart, 
const char *output_name)
write_svg_file(tchart, output_name);
 
pr_info("Written %2.1f seconds of trace to %s.\n",
-   (tchart->last_time - tchart->first_time) / 10.0, 
output_name);
+   (tchart->last_time - tchart->first_time) / 
(double)NSEC_PER_SEC, output_name);
 out_delete:
perf_session__delete(session);
return ret;
@@ -1901,10 +1902,10 @@ parse_time(const struct option *opt, const char *arg, 
int __maybe_unused unset)
if (sscanf(arg, "%" PRIu64 "%cs", value, ) > 0) {
switch (unit) {
case 'm':
-   *value *= 100;
+   *value *= NSEC_PER_MSEC;
break;
case 'u':
-   *value *= 1000;
+   *value *= NSEC_PER_USEC;
break;
case 'n':
break;
@@ -1928,7 +1929,7 @@ int cmd_timechart(int argc, const char **argv,
.ordered_events  = true,
},
.proc_num = 15,
-   .min_time = 100,
+   .min_time = NSEC_PER_MSEC,
.merge_dist = 1000,
};
const char *output_name = "output.svg";
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index eec6c11..1cbada2 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "perf.h"
 #include "svghelper.h"
@@ -274,14 +275,14 @@ static char *time_to_string(u64 duration)
 
text[0] = 0;
 
-   if (duration < 1000) /* less than 1 usec */
+   if (duration < NSEC_PER_USEC) /* less than 1 usec */
return text;
 
-   if (duration < 1000 * 1000) { /* less than 1 msec */
-   sprintf(text, "%.1f us", duration / 1000.0);
+   if (duration < NSEC_PER_MSEC) { /* less than 1 msec */
+   sprintf(text, "%.1f us", duration / (double)NSEC_PER_USEC);
return text;
}
-   sprintf(text, "%.1f ms", duration / 1000.0 / 1000);
+   sprintf(text, "%.1f ms", duration / (double)NSEC_PER_MSEC);
 
return text;
 }
@@ -297,7 +298,7 @@ void svg_waiting(int Yslot, int cpu, u64 start, u64 end, 
const char *backtrace)
 
style = "waiting";
 
-   if (end-start > 10 * 100) /* 10 msec */
+   if (end-start > 10 * NSEC_PER_MSEC) /* 10 msec */
style = "WAITING";
 
text = time_to_string(end-start);


[tip:perf/core] perf bench mem: Use USEC_PER_SEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  f2b91be731a6c1aff9333c1ce3fece7a311f1e0d
Gitweb: http://git.kernel.org/tip/f2b91be731a6c1aff9333c1ce3fece7a311f1e0d
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 14:59:21 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf bench mem: Use USEC_PER_SEC

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-xdtmguafva17wp023sxoj...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bench/mem-functions.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 2b54d0f..c684910 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define K 1024
 
@@ -89,7 +90,7 @@ static u64 get_cycles(void)
 
 static double timeval2double(struct timeval *ts)
 {
-   return (double)ts->tv_sec + (double)ts->tv_usec / (double)100;
+   return (double)ts->tv_sec + (double)ts->tv_usec / (double)USEC_PER_SEC;
 }
 
 #define print_bps(x) do {  \


[tip:perf/core] perf stat: Use *SEC_PER_*SEC macros

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  310ebb93676d2106b4c2e68bbf1b2811461bb9f3
Gitweb: http://git.kernel.org/tip/310ebb93676d2106b4c2e68bbf1b2811461bb9f3
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 14:57:04 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf stat: Use *SEC_PER_*SEC macros

To match how this is done in the kernel.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-gym6yshewpdegt153u8v2...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-stat.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e33a66b..90882b1 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -173,7 +173,7 @@ static inline void diff_timespec(struct timespec *r, struct 
timespec *a,
 {
r->tv_sec = a->tv_sec - b->tv_sec;
if (a->tv_nsec < b->tv_nsec) {
-   r->tv_nsec = a->tv_nsec + 10L - b->tv_nsec;
+   r->tv_nsec = a->tv_nsec + NSEC_PER_SEC - b->tv_nsec;
r->tv_sec--;
} else {
r->tv_nsec = a->tv_nsec - b->tv_nsec ;
@@ -365,7 +365,7 @@ static void process_interval(void)
 static void enable_counters(void)
 {
if (initial_delay)
-   usleep(initial_delay * 1000);
+   usleep(initial_delay * USEC_PER_MSEC);
 
/*
 * We need to enable counters only if:
@@ -542,8 +542,8 @@ static int __run_perf_stat(int argc, const char **argv)
bool is_pipe = STAT_RECORD ? perf_stat.file.is_pipe : false;
 
if (interval) {
-   ts.tv_sec  = interval / 1000;
-   ts.tv_nsec = (interval % 1000) * 100;
+   ts.tv_sec  = interval / USEC_PER_MSEC;
+   ts.tv_nsec = (interval % USEC_PER_MSEC) * NSEC_PER_MSEC;
} else {
ts.tv_sec  = 1;
ts.tv_nsec = 0;
@@ -972,7 +972,7 @@ static void print_metric_header(void *ctx, const char 
*color __maybe_unused,
 static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
 {
FILE *output = stat_config.output;
-   double msecs = avg / 1e6;
+   double msecs = avg / NSEC_PER_MSEC;
const char *fmt_v, *fmt_n;
char name[25];
 
@@ -1461,7 +1461,7 @@ static void print_footer(void)
if (!null_run)
fprintf(output, "\n");
fprintf(output, " %17.9f seconds time elapsed",
-   avg_stats(_nsecs_stats)/1e9);
+   avg_stats(_nsecs_stats) / NSEC_PER_SEC);
if (run_count > 1) {
fprintf(output, "");
print_noise_pct(stddev_stats(_nsecs_stats),


[tip:perf/core] perf bench sched-messaging: Use USEC_PER_MSEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  af15e67e8f8572072167bfb193ceabff04f4b21e
Gitweb: http://git.kernel.org/tip/af15e67e8f8572072167bfb193ceabff04f4b21e
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 15:04:23 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf bench sched-messaging: Use USEC_PER_MSEC

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-xhyoyxejvorrgmwjx9k3j...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/bench/sched-messaging.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/sched-messaging.c 
b/tools/perf/bench/sched-messaging.c
index bfaf950..6a111e7 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DATASIZE 100
 
@@ -312,11 +313,11 @@ int bench_sched_messaging(int argc, const char **argv,
   thread_mode ? "threads" : "processes");
printf(" %14s: %lu.%03lu [sec]\n", "Total time",
   diff.tv_sec,
-  (unsigned long) (diff.tv_usec/1000));
+  (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n", diff.tv_sec,
-  (unsigned long) (diff.tv_usec/1000));
+  (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break;
default:
/* reaching here is something disaster */


[tip:perf/core] perf record: Use USEC_PER_MSEC

2016-08-24 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  0693e680d32e5c7415666ccfcff57ad4cd976294
Gitweb: http://git.kernel.org/tip/0693e680d32e5c7415666ccfcff57ad4cd976294
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 8 Aug 2016 15:05:46 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf record: Use USEC_PER_MSEC

Instead of a naked 1000.

Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-7v6be7jhvstbkvk3rsytj...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6355902..a3792e8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -42,7 +42,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 struct record {
struct perf_tooltool;
@@ -954,7 +954,7 @@ static int __cmd_record(struct record *rec, int argc, const 
char **argv)
}
 
if (opts->initial_delay) {
-   usleep(opts->initial_delay * 1000);
+   usleep(opts->initial_delay * USEC_PER_MSEC);
perf_evlist__enable(rec->evlist);
}
 


Re: [PATCH v3 2/4] arm64: dts: rockchip: add the saradc for rk3399

2016-08-24 Thread Heiko Stübner
Am Mittwoch, 27. Juli 2016, 22:24:05 schrieb Caesar Wang:
> This patch adds saradc needed information on rk3399 SoCs.
> 
> Signed-off-by: Caesar Wang 
> Reviewed-by: Douglas Anderson 

applied to my dts64 branch for 4.9

Thanks
Heiko


Re: [PATCH] [media] m2m-deinterlace: Fix error print during probe

2016-08-24 Thread Sakari Ailus
Hi, Peter!

On Tue, Aug 23, 2016 at 04:39:39PM +0300, Peter Ujfalusi wrote:
> v4l2_err() can not be used for printing error for missing interleaved
> support in DMA as this point the pcdev->v4l2_dev is not valid.
> 
> Signed-off-by: Peter Ujfalusi 
> ---
>  drivers/media/platform/m2m-deinterlace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/m2m-deinterlace.c 
> b/drivers/media/platform/m2m-deinterlace.c
> index 0fcb5c78031d..5a5dec348f4d 100644
> --- a/drivers/media/platform/m2m-deinterlace.c
> +++ b/drivers/media/platform/m2m-deinterlace.c
> @@ -1016,7 +1016,7 @@ static int deinterlace_probe(struct platform_device 
> *pdev)
>   return -ENODEV;
>  
>   if (!dma_has_cap(DMA_INTERLEAVE, pcdev->dma_chan->device->cap_mask)) {
> - v4l2_err(>v4l2_dev, "DMA does not support INTERLEAVE\n");
> + dev_err(>dev, "DMA does not support INTERLEAVE\n");
>   goto rel_dma;
>   }
>  

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk


[PATCH] fanotify: fix race between fanotify_release() and fanotify_get_response()

2016-08-24 Thread Miklos Szeredi
List corruption was reported with a fanotify stress test.

The bug turned out to be due to fsnotify_remove_event() being called on an
event on the fanotify_data.access_list and protected by
fanotify_data.access_lock instead of notification_mutex.  This resulted in
list_del_init() being run concurrently on the same list entry.

This was introduced by commit 09e5f14e57c7 ("fanotify: on group destroy
allow all waiters to bypass permission check") which made
fanotify_get_response() flush out events when bypass_perm was set.  The
flush doesn't normally happen, since the wake_up() is called after the
access_list was cleaned in fsnotify_release().  But the two are not
synchronized, the fanotify_get_response() could still be processing a
previous wakeup by the time bypass_perm is true.  This was seen in the
crashdumps in the report.

This bug can be solved multiple ways, maybe the simplest is moving the
bypass_perm setting after the list has been processed.

In theory there's also a memory ordering problem here.  atomic_inc() in
itself doesn't imply a memory barrier, and spin_unlock() is a semi
permeable barrier, so we need an explicit memory barrier so that the
condition is precieved after the list is cleared.

Similarly we need barriers for the case when event->response is set
(i.e. non zero): fsnotify_destroy_event() might destroy the event while
it's still on the access_list, since nothing guarantees that the storing
the response value in event->response will be preceived after the list
manipulation.  So add the necessary barriers there as well.

PS not sure why bypass_perm is an atomic_t, it could just as well be a
boolean flag.

PPS all this subtlety could be removed if the waitq was per-event, which
would also allow better performance.

Signed-off-by: Miklos Szeredi 
Fixes: 09e5f14e57c7 ("fanotify: on group destroy allow all waiters to bypass 
permission check")
Cc:  #v2.6.37+
Cc: Jan Kara 
Cc: Lino Sanfilippo 
Cc: Eric Paris 
---
 fs/notify/fanotify/fanotify.c  |  5 +
 fs/notify/fanotify/fanotify_user.c | 25 +
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index d2f97ecca6a5..0d0cabd946e0 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -70,6 +70,11 @@ static int fanotify_get_response(struct fsnotify_group 
*group,
wait_event(group->fanotify_data.access_waitq, event->response ||
atomic_read(>fanotify_data.bypass_perm));
 
+   /*
+* Pairs with smp_wmb() before storing event->response.  This makes sure
+* that the list_del_init() done on the event is preceived after this.
+*/
+   smp_rmb();
if (!event->response) { /* bypass_perm set */
/*
 * Event was canceled because group is being destroyed. Remove
diff --git a/fs/notify/fanotify/fanotify_user.c 
b/fs/notify/fanotify/fanotify_user.c
index 8e8e6bcd1d43..af57e75772a0 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -193,6 +193,10 @@ static int process_access_response(struct fsnotify_group 
*group,
if (!event)
return -ENOENT;
 
+   /*
+* Make sure the dequeue is preceived before the store of "response"
+*/
+   smp_wmb();
event->response = response;
wake_up(>fanotify_data.access_waitq);
 
@@ -305,6 +309,11 @@ static ssize_t fanotify_read(struct file *file, char 
__user *buf,
} else {
 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
if (ret < 0) {
+   /*
+* Make sure the dequeue is preceived before
+* the store of "response"
+*/
+   smp_wmb();
FANOTIFY_PE(kevent)->response = FAN_DENY;
wake_up(>fanotify_data.access_waitq);
break;
@@ -365,26 +374,34 @@ static int fanotify_release(struct inode *ignored, struct 
file *file)
 * enter or leave access_list by now.
 */
spin_lock(>fanotify_data.access_lock);
-
-   atomic_inc(>fanotify_data.bypass_perm);
-
list_for_each_entry_safe(event, next, >fanotify_data.access_list,
 fae.fse.list) {
pr_debug("%s: found group=%p event=%p\n", __func__, group,
 event);
 
list_del_init(>fae.fse.list);
+   /*
+* Make sure the dequeue is preceived before the store of
+* "response"
+*/
+   smp_wmb();
event->response = FAN_ALLOW;
}
spin_unlock(>fanotify_data.access_lock);
 

Re: [PATCH] fb: udl: fix build without CONFIG_FB_DEFERRED_IO

2016-08-24 Thread Daniel Vetter
On Wed, Aug 24, 2016 at 12:02 PM, Arnd Bergmann  wrote:
> On Wednesday, August 24, 2016 11:01:17 AM CEST Daniel Vetter wrote:
>> On Wed, Aug 24, 2016 at 10:27 AM, Arnd Bergmann  wrote:
>> > A cleanup in v4.8 dropped several dependencies, but caused the udl driver
>> > to fail building when CONFIG_FB_DEFERRED_IO is not set:
>> >
>> > drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_open':
>> > drivers/gpu/drm/udl/udl_fb.c:206:23: error: 'struct fb_info' has no member 
>> > named 'fbdefio'
>> >   if (fb_defio && (info->fbdefio == NULL)) {
>> >^~
>> >
>> > This adds an #ifdef check around the code that fails. We know this
>> > is safe because it always checks info->fbdefio for being non-NULL,
>> > and that member is not defined here.
>> >
>> > Signed-off-by: Arnd Bergmann 
>> > Fixes: c0f0c177b5a9 ("drm/udl: make fbdev support really optional")
>>
>> There's a pile more needed, which is why I just ended up stuffing them
>> all into linux-next for 4.9. Is your patch still needed on that? If we
>> really want this fixed in 4.8 I guess I can assemble a cherry-pick
>> list.
>
> Ok, got it. I think your 0c756134cf76 ("drm: Protect fb_defio in
> drivers with CONFIG_KMS_FBDEV_EMULATION") is actually sufficient
> for the build break, it's almost the same as my patch anyway.

Dave, can you please cherry-pick that one from -next to -fixes?

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


Re: [PATCH v3 0/5] dts patches for qcom tsens support

2016-08-24 Thread Paolo Pisati
On Wed, Aug 17, 2016 at 02:33:40PM -0500, Andy Gross wrote:
> On Wed, Aug 17, 2016 at 10:48:43AM +0530, Rajendra Nayak wrote:
> > Hey Andy,
> > 
> > This is a respin of v2 with some minor fixes pointed out by Rob.
> > Please pull these in for 4.9
> > 
> > Thanks,
> > Rajendra
> 
> I pulled these in.

Did you try to read the content of the qfprom from userspace?

$ uname -a
Linux dragon410c 4.8.0-rc1+ #6 SMP PREEMPT Wed Aug 24 11:11:02 CEST 2016 aarch64
aarch64 aarch64 GNU/Linux
$ lsmod 
Module  Size  Used by
nvmem_qfprom   16384  0
nvmem_core 24576  1 nvmem_qfprom
$ ls -la /sys/bus/nvmem/devices/
 
total 0
drwxr-xr-x 2 root root 0 Aug 24 10:17 .
drwxr-xr-x 4 root root 0 Aug 24 10:15 ..
lrwxrwxrwx 1 root root 0 Aug 24 10:17 qfprom0 ->
../../../devices/platform/soc/5c000.qfprom/qfprom0
$ cat /sys/bus/nvmem/devices/qfprom0/nvmem 

[spontaneous reboot]

This using agross's for-next tree as of today ("54ba896 Merge branch
'arm64-defconfig-for-4.9' into all-for-4.8") and defconfig.
-- 
bye,
p.


Re: [RFC PATCH 6/7] arm64: KVM: Handle trappable TLB instructions

2016-08-24 Thread Punit Agrawal
Will Deacon  writes:

> Hi Punit,
>
> On Tue, Aug 16, 2016 at 11:45:11AM +0100, Punit Agrawal wrote:
>> The ARMv8 architecture allows trapping of TLB maintenane instructions
>> from EL0/EL1 to higher exception levels. On encountering a trappable TLB
>> instruction in a guest, an exception is taken to EL2.
>> 
>> Add functionality to handle emulating the TLB instructions.
>> 
>> Signed-off-by: Punit Agrawal 
>> Cc: Christoffer Dall 
>> Cc: Marc Zyngier 
>
> [...]
>
>> +void __hyp_text
>> +__kvm_emulate_tlb_invalidate(struct kvm *kvm, u32 sys_op, u64 regval)
>> +{
>> +kvm = kern_hyp_va(kvm);
>> +
>> +/*
>> + * Switch to the guest before performing any TLB operations to
>> + * target the appropriate VMID
>> + */
>> +__switch_to_guest_regime(kvm);
>> +
>> +/*
>> + *  TLB maintenance operations broadcast to inner-shareable
>> + *  domain when HCR_FB is set (default for KVM).
>> + */
>> +switch (sys_op) {
>> +case TLBIALL:
>> +case TLBIALLIS:
>> +case ITLBIALL:
>> +case DTLBIALL:
>> +case TLBI_VMALLE1:
>> +case TLBI_VMALLE1IS:
>> +__tlbi(vmalle1is);
>> +break;
>> +case TLBIMVA:
>> +case TLBIMVAIS:
>> +case ITLBIMVA:
>> +case DTLBIMVA:
>> +case TLBI_VAE1:
>> +case TLBI_VAE1IS:
>> +__tlbi(vae1is, regval);
>
> I'm pretty nervous about this. Although you've switched in the guest stage-2
> page table before the TLB maintenance, we're still running on a host stage-1
> and it's not clear to me that the stage-1 context is completely ignored for
> the purposes of a stage-1 TLBI executed at EL2.
>
> For example, if TCR_EL1.TBI0 is set in the guest but cleared in the host,
> my reading of the architecture is that it will be treated as zero when
> we perform this invalidation operation. I worry that we have similar
> problems with the granule size, where bits become RES0 in the TLBI VA
> ops.

Some control bits seem to be explicitly called out to not affect TLB
maintenance operations[0] but I hadn't considered the ones you highlight.

[0] ARMv8 ARM DDI 0487A.j D4.7, Pg D4-1814

>
> Finally, we should probably be masking out the RES0 bits in the TLBI
> ops, just in case some future extension to the architecture defines them
> in such a way where they have different meanings when executed at EL2
> or EL1.

Although, the RES0 bits for TLBI VA ops are currently ignored, I agree
that masking them out based on granule size protects against future
incompatible changes.

>
> The easiest thing to do is just TLBI VMALLE1IS for all trapped operations,
> but you might want to see how that performs.

That sounds reasonable for correctness. But I suspect we'll have to do
more to claw back some performance. Let me run a few tests and come back
on this.

Thanks for having a look.

Punit

>
> Will
> ___
> kvmarm mailing list
> kvm...@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm


Re: [PATCH V3] leds: trigger: Introduce an USB port trigger

2016-08-24 Thread Matthias Brugger



On 24/08/16 00:03, Rafał Miłecki wrote:

From: Rafał Miłecki 

This commit adds a new trigger responsible for turning on LED when USB
device gets connected to the specified USB port. This can can useful for
various home routers that have USB port(s) and a proper LED telling user
a device is connected.

The trigger gets its documentation file but basically it just requires
specifying USB port in a Linux format (e.g. echo 1-1 > new_port).

During work on this trigger there was a plan to add DT bindings for it,
but there wasn't an agreement on the format yet. This can be worked on
later, a sysfs interface is needed anyway for platforms not using DT.

Signed-off-by: Rafał Miłecki 
---
V2: Trying to add DT support, idea postponed as it will take more time
to discuss the bindings.
V3: Fix typos in commit and Documentation (thanks Jacek!)
Use "ports" sysfs file for adding and removing USB ports (thx Jacek)
Check if there is USB device connected after adding new USB port
Fix memory leak or two

Felipe: I'd like to ask for your Ack before having this patch pushed.
---
 Documentation/leds/ledtrig-usbport.txt |  49 +++
 drivers/leds/trigger/Kconfig   |   8 ++
 drivers/leds/trigger/Makefile  |   1 +
 drivers/leds/trigger/ledtrig-usbport.c | 253 +
 4 files changed, 311 insertions(+)
 create mode 100644 Documentation/leds/ledtrig-usbport.txt
 create mode 100644 drivers/leds/trigger/ledtrig-usbport.c

diff --git a/Documentation/leds/ledtrig-usbport.txt 
b/Documentation/leds/ledtrig-usbport.txt
new file mode 100644
index 000..fa42227
--- /dev/null
+++ b/Documentation/leds/ledtrig-usbport.txt
@@ -0,0 +1,49 @@
+USB port LED trigger
+
+
+This LED trigger can be used for signalling to the user a presence of USB 
device
+in a given port. It simply turns on LED when device appears and turns it off
+when it disappears.
+
+It requires specifying a list of USB ports that should be observed. Used format
+matches Linux kernel format and consists of a root hub number and a hub port
+separated by a dash (e.g. 3-1).
+
+It is also possible to handle devices with internal hubs (that are always
+connected to the root hub). User can simply specify internal hub ports then
+(e.g. 1-1.1, 1-1.2, etc.).
+
+Please note that this trigger allows assigning multiple USB ports to a single
+LED. This can be useful in two cases:
+
+1) Device with single USB LED and few physical ports
+
+In such a case LED will be turned on as long as there is at least one connected
+USB device.
+
+2) Device with a physical port handled by few controllers
+
+Some devices have e.g. one controller per PHY standard. E.g. USB 3.0 physical
+port may be handled by ohci-platform, ehci-platform and xhci-hcd. If there is
+only one LED user will most likely want to assign ports from all 3 hubs.
+
+
+This trigger can be activated from user space on led class devices as shown
+below:
+
+  echo usbport > trigger
+
+This adds the following sysfs attributes to the LED:
+
+  ports - Reading it lists all USB ports assigned to the trigger. Writing USB
+ port number to it will make this driver start observing it. It's also
+ possible to remove USB port from observable list by writing it with a
+ "-" prefix.
+
+Example use-case:
+
+  echo usbport > trigger
+  echo 4-1 > ports
+  echo 2-1 > ports
+  echo -4-1 > ports
+  cat ports
diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig
index 3f9ddb9..bdd6fd2 100644
--- a/drivers/leds/trigger/Kconfig
+++ b/drivers/leds/trigger/Kconfig
@@ -126,4 +126,12 @@ config LEDS_TRIGGER_PANIC
  a different trigger.
  If unsure, say Y.

+config LEDS_TRIGGER_USBPORT
+   tristate "USB port LED trigger"
+   depends on LEDS_TRIGGERS && USB
+   help
+ This allows LEDs to be controlled by USB events. Enabling this option
+ allows specifying list of USB ports that should turn on LED when some
+ USB device gets connected.
+
 endif # LEDS_TRIGGERS
diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile
index a72c43c..56e1741 100644
--- a/drivers/leds/trigger/Makefile
+++ b/drivers/leds/trigger/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
 obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT)   += ledtrig-transient.o
 obj-$(CONFIG_LEDS_TRIGGER_CAMERA)  += ledtrig-camera.o
 obj-$(CONFIG_LEDS_TRIGGER_PANIC)   += ledtrig-panic.o
+obj-$(CONFIG_LEDS_TRIGGER_USBPORT) += ledtrig-usbport.o
diff --git a/drivers/leds/trigger/ledtrig-usbport.c 
b/drivers/leds/trigger/ledtrig-usbport.c
new file mode 100644
index 000..7f5237c
--- /dev/null
+++ b/drivers/leds/trigger/ledtrig-usbport.c
@@ -0,0 +1,253 @@
+/*
+ * USB port LED trigger
+ *
+ * Copyright (C) 2016 Rafał Miłecki 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the 

Re: [PATCH 0/6] Some Tegra I2C Updates

2016-08-24 Thread Jon Hunter
Hi Wolfram,

On 11/08/16 11:16, Jon Hunter wrote:
> Add runtime-pm and pinctrl support for Tegra I2C driver.
> 
> The first 4 patches are trivial clean-up/simplification changes.
> 
> Jon Hunter (6):
>   i2c: tegra: Add missing new line characters
>   i2c: tegra: Remove non device-tree support
>   i2c: tegra: Use device name for adapter name
>   i2c: tegra: Simplify I2C resume
>   i2c: tegra: Add runtime power-management support
>   i2c: tegra: Add pinctrl support
> 
>  drivers/i2c/busses/i2c-tegra.c | 97 
> +++---
>  1 file changed, 63 insertions(+), 34 deletions(-)

Any comments or can these be queued?

Cheers
Jon

-- 
nvpublic


Re: [REGRESSION] Select hang with zero sized UDP packets

2016-08-24 Thread Dan Akunis
When select wakes up on a UDP socket, user is expecting to get data. Getting 
0 from recvfrom() or whatever read function she uses, is a wrong attitude.

I agree with David.

The unit test that expects select to wake up is wrong and should be changed.

-Original Message- 
From: David Miller

Sent: Tuesday, August 23, 2016 9:25 PM
To: labb...@redhat.com
Cc: kuz...@ms2.inr.ac.ru ; jmor...@namei.org ; yoshf...@linux-ipv6.org ; 
ka...@trash.net ; samanthaku...@google.com ; will...@google.com ; 
net...@vger.kernel.org ; linux-kernel@vger.kernel.org

Subject: Re: [REGRESSION] Select hang with zero sized UDP packets

From: Laura Abbott 
Date: Tue, 23 Aug 2016 10:53:26 -0700


Fedora received a report[1] of a unit test failing on Ruby when using
the
4.7 kernel. This was a test to send a zero sized UDP packet. With the
4.7 kernel, the test now timing out on a select instead of completing.
The reduced ruby test is

  def test_udp_recvfrom_nonblock
u1 = UDPSocket.new
u2 = UDPSocket.new
u1.bind("127.0.0.1", 0)
u2.send("", 0, u1.getsockname)
IO.select [u1]  # test gets stuck here
  ensure
u1.close if u1
u2.close if u2
  end


Well, if there is no data, should select really wake up?

I think it's valid not to. 



Re: [PATCH v3 3/3] serial: 8250_dw: add ACPI support for uart on Hisilicon Hip05 soc

2016-08-24 Thread Kefeng Wang


On 2016/8/22 22:05, Heikki Krogerus wrote:
> Hi,
> 
> On Mon, Aug 22, 2016 at 02:24:14PM +0300, Andy Shevchenko wrote:
>> On Fri, 2016-07-15 at 19:01 +0800, Kefeng Wang wrote:
>>> Use built-in device properties to set device parameters for the
>>> existing device probed by acpi.
>>
>> acpi -> ACPI
>>
>>>
>>> Add ACPI identifier for UART on Hisilicon Hip05 soc, be careful
>>
>> soc -> SoC
>>
>>> that it is not 16550 compatibal, so we need set "reg-io-width"
>>
>> compatibal -> compatible

Will fix.

>>
>>> and "reg-shift" by _DSD method in DSDT.
>>>
>>> Signed-off-by: Kefeng Wang 
>>> ---
>>>  drivers/tty/serial/8250/8250_dw.c | 23 +--
>>>  1 file changed, 17 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/tty/serial/8250/8250_dw.c
>>> b/drivers/tty/serial/8250/8250_dw.c
>>> index d6934310..5ab9cfe 100644
>>> --- a/drivers/tty/serial/8250/8250_dw.c
>>> +++ b/drivers/tty/serial/8250/8250_dw.c
>>> @@ -297,12 +297,6 @@ static void dw8250_quirks(struct uart_port *p,
>>> struct dw8250_data *data)
>>> p->serial_in = dw8250_serial_in32be;
>>> p->serial_out = dw8250_serial_out32be;
>>> }
>>> -   } else if (has_acpi_companion(p->dev)) {
>>> -   p->iotype = UPIO_MEM32;
>>> -   p->regshift = 2;
>>> -   p->serial_in = dw8250_serial_in32;
>>> -   /* So far none of there implement the Busy
>>> Functionality */
>>> -   data->uart_16550_compatible = true;
>>> }
>>>  
>>> /* Platforms with iDMA */
>>> @@ -352,6 +346,19 @@ static void dw8250_setup_port(struct uart_port
>>> *p)
>>> up->capabilities |= UART_CAP_AFE;
>>>  }
>>>  
>>> +static struct property_entry dw8250_properties[] = {
>>> +   PROPERTY_ENTRY_U32("reg-io-width", 4),
>>> +   PROPERTY_ENTRY_U32("reg-shift", 2),
>>> +   PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
>>> +   { },
>>> +};
>>> +
>>> +/* non 16550 compatible id list*/
>>
>> non 16550 -> Non-16550
>> Space before */
>>
>>> +static const struct acpi_device_id non_16550_ids[] = {
>>> +   { "HISI0031", 0 },
>>> +   { },
>>> +};
>>> +
>>>  static int dw8250_probe(struct platform_device *pdev)
>>>  {
>>> struct uart_8250_port uart = {};
>>> @@ -395,6 +402,9 @@ static int dw8250_probe(struct platform_device
>>> *pdev)
>>> if (!data)
>>> return -ENOMEM;
>>>  
>>> +   if (has_acpi_companion(dev) &&
>>> !acpi_match_device(non_16550_ids, dev))
>>
>>
>>> +   platform_device_add_properties(pdev,
>>> dw8250_properties);
>>
>> What if we probe device which has already properties assigned?
>>
>> Heikki, are you good with such trick?
> 
> No this is not the way to do this. As we talked, we need to add the
> properties in the mfd drivers when they exist and not in the driver
> itself. Only if there is no mfd driver that creates the actual
> platform device for dw8250 and when also the ACPI tables don't provide
> the properties, we identify the board in dw8250_quirks and handle it
> separately. Right now there is only one such board.
> 
> I'll prepare the patches for that right now. This series can then be
> made on top of those.
> 

OK, will base on your patchset.

Thanks Andy and Heikki for your comments.

Kefeng


> 
> Thanks,
> 



[PATCH] serial: 8250_dw: Check the data->pclk when get apb_pclk

2016-08-24 Thread Kefeng Wang
It should check the data->pclk, not data->clk when get apb_pclk.

Fixes: c8ed99d4f6a8("serial: 8250_dw: Add support for deferred probing")
Signed-off-by: Kefeng Wang 
---
 drivers/tty/serial/8250/8250_dw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c 
b/drivers/tty/serial/8250/8250_dw.c
index e199696..b022f5a 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -462,7 +462,7 @@ static int dw8250_probe(struct platform_device *pdev)
}
 
data->pclk = devm_clk_get(>dev, "apb_pclk");
-   if (IS_ERR(data->clk) && PTR_ERR(data->clk) == -EPROBE_DEFER) {
+   if (IS_ERR(data->pclk) && PTR_ERR(data->pclk) == -EPROBE_DEFER) {
err = -EPROBE_DEFER;
goto err_clk;
}
-- 
2.6.0.GIT



Re: [PATCH 3/3] clk: keystone: Add sci-clk driver support

2016-08-24 Thread Stephen Boyd
On 08/19, Nishanth Menon wrote:
>  THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER
>  M:   Hans Verkuil 
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index e2d9bd760c84..d1724999be78 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -179,6 +179,19 @@ config COMMON_CLK_NXP
>   ---help---
> Support for clock providers on NXP platforms.
>  
> +if COMMON_CLK_KEYSTONE

Why not depends on COMMON_CLK_KEYSTONE? Or make the tristate have
an if COMMON_CLK_KEYSTONE after it? So far an if  hasn't
happened in this file. And is anything inside
drivers/clk/keystone used by this driver? Maybe this if statement
can just be dropped entirely and then the keystone/Makefile
updated?

> +
> +config TI_SCI_CLK
> + tristate "TI System Control Interface clock drivers"
> + depends on TI_SCI_PROTOCOL || COMPILE_TEST
> + default y

default TI_SCI_PROTOCOL?

> + help
> +   This adds the clock driver support over TI System Control Interface.
> +   If you wish to use clock resources from the PMMC firmware, say Y.
> +   Otherwise, say N.
> +
> +endif # COMMON_CLK_KEYSTONE
> +
>  config COMMON_CLK_PALMAS
>   tristate "Clock driver for TI Palmas devices"
>   depends on MFD_PALMAS
> diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
> new file mode 100644
> index ..6c43e097e6d6
> --- /dev/null
> +++ b/drivers/clk/keystone/sci-clk.c
> @@ -0,0 +1,539 @@
> +/*
> + * SCI Clock driver for keystone based devices
> + *
> + * Copyright (C) 2015-2016 Texas Instruments Incorporated - 
> http://www.ti.com/
> + *   Tero Kristo 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include 

Is this include used?

> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define SCI_CLK_SSC_ENABLE   BIT(0)
> +#define SCI_CLK_ALLOW_FREQ_CHANGEBIT(1)
> +#define SCI_CLK_INPUT_TERMINATIONBIT(2)
> +
> +/**
> + * struct sci_clk_provider - TI SCI clock provider representation
> + * @sci:Handle to the System Control Interface protocol handler
> + * @ops:Pointer to the SCI ops to be used by the clocks
> + * @dev:Device pointer for the clock provider
> + * @clocks: List of all registered clocks
> + * @lock:   Mutex for locking access to the @clocks list
> + */
> +struct sci_clk_provider {
> + const struct ti_sci_handle *sci;
> + const struct ti_sci_clk_ops *ops;
> + struct device *dev;
> + struct list_head clocks;
> + struct mutex lock; /* Protects access to the @clocks list */
> +};
> +
> +/**
> + * struct sci_clk - TI SCI clock representation
> + * @hw:   Hardware clock cookie for common clock framework
> + * @dev_id:   Device index
> + * @clk_id:   Clock index
> + * @node: Clocks list link
> + * @provider: Master clock provider
> + * @flags:Flags for the clock
> + */
> +struct sci_clk {
> + struct clk_hw hw;
> + u16 dev_id;
> + u8 clk_id;
> + struct list_head node;
> + struct sci_clk_provider *provider;
> + u8 flags;
> +};
> +
> +#define to_sci_clk(_hw) container_of(_hw, struct sci_clk, hw)
> +
> +/**
> + * sci_clk_prepare - Prepare (enable) a TI SCI clock
> + * @hw: clock to prepare
> + *
> + * Prepares a clock to be actively used. Returns the SCI protocol status.
> + */
> +static int sci_clk_prepare(struct clk_hw *hw)
> +{
> + struct sci_clk *clk = to_sci_clk(hw);
> + bool enable_ssc = clk->flags & SCI_CLK_SSC_ENABLE;
> + bool allow_freq_change = clk->flags & SCI_CLK_ALLOW_FREQ_CHANGE;
> + bool input_termination = clk->flags & SCI_CLK_INPUT_TERMINATION;
> +
> + return clk->provider->ops->get_clock(clk->provider->sci, clk->dev_id,
> +  clk->clk_id, enable_ssc,
> +  allow_freq_change,
> +  input_termination);
> +}
> +
> +/**
> + * sci_clk_unprepare - Un-prepares (disables) a TI SCI clock
> + * @hw: clock to unprepare
> + *
> + * Un-prepares a clock from active state.
> + */
> +static void sci_clk_unprepare(struct clk_hw *hw)
> +{
> + struct sci_clk *clk = to_sci_clk(hw);
> + int ret;
> +
> + ret = clk->provider->ops->put_clock(clk->provider->sci, clk->dev_id,
> + clk->clk_id);
> + if (ret)
> + dev_err(clk->provider->dev,
> + "unprepare failed for dev=%d, clk=%d, ret=%d\n",
> +  

Re: x86/PCI: Scan all functions during probing

2016-08-24 Thread Thomas Gleixner
On Thu, 18 Aug 2016, Bjorn Helgaas wrote:
> I looked up the spec: PCI (not PCIe) r3.0, sec 3.2.2.3.4, says:
> 
>   A single-function device may optionally respond to all function
>   numbers as the same function or may ... respond only to function 0
>   and not respond to the other function numbers.
> 
> I'm concerned that a single-function device that responds to all
> function numbers might break with this patch.
> 
>   [multi-function devices] are also required to always implement
>   function 0 in the device.
> 
> Here's the reason we can advance by 8 in the "Go find them" loop.
> 
>   If a single function device is detected (i.e., bit 7 in the Header
>   Type register of function 0 is 0), no more functions for that Device
>   Number will be checked.  If a multi-function device is detected
>   (i.e., bit 7 in the Header Type register of function 0 is 1), then
>   all remaining Function Numbers will be checked.
> 
> This patch does the opposite of what the first sentence recommends.

Fair enough. We'll need to find a way to deal with that in jailhouse then.

Thanks,

tglx


Re: [PATCH] mm: memcontrol: avoid unused function warning

2016-08-24 Thread Michal Hocko
On Wed 24-08-16 10:22:43, Arnd Bergmann wrote:
> A bugfix in v4.8-rc2 introduced a harmless warning when CONFIG_MEMCG_SWAP
> is disabled but CONFIG_MEMCG is enabled:
> 
> mm/memcontrol.c:4085:27: error: 'mem_cgroup_id_get_online' defined but not 
> used [-Werror=unused-function]
>  static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
> 
> This adds an extra #ifdef that matches the one around the caller to
> avoid the warning.

Thanks for fixing that! Could you please move the function to the same
ifdef section as its users please.

> Signed-off-by: Arnd Bergmann 
> Fixes: 1f47b61fb407 ("mm: memcontrol: fix swap counter leak on swapout from 
> offline cgroup")

Anyway
Acked-by: Michal Hocko 
> ---
>  mm/memcontrol.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 2ff0289ad061..e8d787163b65 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4082,6 +4082,7 @@ static void mem_cgroup_id_get_many(struct mem_cgroup 
> *memcg, unsigned int n)
>   atomic_add(n, >id.ref);
>  }
>  
> +#ifdef CONFIG_MEMCG_SWAP
>  static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
>  {
>   while (!atomic_inc_not_zero(>id.ref)) {
> @@ -4099,6 +4100,7 @@ static struct mem_cgroup 
> *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
>   }
>   return memcg;
>  }
> +#endif
>  
>  static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
>  {
> -- 
> 2.9.0
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majord...@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: mailto:"d...@kvack.org;> em...@kvack.org 

-- 
Michal Hocko
SUSE Labs


Re: [PATCH] fb: udl: fix build without CONFIG_FB_DEFERRED_IO

2016-08-24 Thread Daniel Vetter
On Wed, Aug 24, 2016 at 10:27 AM, Arnd Bergmann  wrote:
> A cleanup in v4.8 dropped several dependencies, but caused the udl driver
> to fail building when CONFIG_FB_DEFERRED_IO is not set:
>
> drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_open':
> drivers/gpu/drm/udl/udl_fb.c:206:23: error: 'struct fb_info' has no member 
> named 'fbdefio'
>   if (fb_defio && (info->fbdefio == NULL)) {
>^~
>
> This adds an #ifdef check around the code that fails. We know this
> is safe because it always checks info->fbdefio for being non-NULL,
> and that member is not defined here.
>
> Signed-off-by: Arnd Bergmann 
> Fixes: c0f0c177b5a9 ("drm/udl: make fbdev support really optional")

There's a pile more needed, which is why I just ended up stuffing them
all into linux-next for 4.9. Is your patch still needed on that? If we
really want this fixed in 4.8 I guess I can assemble a cherry-pick
list.
-Daniel

> ---
>  drivers/gpu/drm/udl/udl_fb.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
> index d5df555aeba0..fec47733e57e 100644
> --- a/drivers/gpu/drm/udl/udl_fb.c
> +++ b/drivers/gpu/drm/udl/udl_fb.c
> @@ -24,11 +24,14 @@
>
>  #define DL_DEFIO_WRITE_DELAY(HZ/20) /* fb_deferred_io.delay in jiffies */
>
> -static int fb_defio = 0;  /* Optionally enable experimental fb_defio mmap 
> support */
>  static int fb_bpp = 16;
>
>  module_param(fb_bpp, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
> +
> +#ifdef CONFIG_FB_DEFERRED_IO
> +static int fb_defio = 0;  /* Optionally enable experimental fb_defio mmap 
> support */
>  module_param(fb_defio, int, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
> +#endif
>
>  struct udl_fbdev {
> struct drm_fb_helper helper;
> @@ -203,6 +206,7 @@ static int udl_fb_open(struct fb_info *info, int user)
>
> ufbdev->fb_count++;
>
> +#ifdef CONFIG_FB_DEFERRED_IO
> if (fb_defio && (info->fbdefio == NULL)) {
> /* enable defio at last moment if not disabled by client */
>
> @@ -218,6 +222,7 @@ static int udl_fb_open(struct fb_info *info, int user)
> info->fbdefio = fbdefio;
> fb_deferred_io_init(info);
> }
> +#endif
>
> pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n",
>   info->node, user, info, ufbdev->fb_count);
> @@ -235,12 +240,14 @@ static int udl_fb_release(struct fb_info *info, int 
> user)
>
> ufbdev->fb_count--;
>
> +#ifdef CONFIG_FB_DEFERRED_IO
> if ((ufbdev->fb_count == 0) && (info->fbdefio)) {
> fb_deferred_io_cleanup(info);
> kfree(info->fbdefio);
> info->fbdefio = NULL;
> info->fbops->fb_mmap = udl_fb_mmap;
> }
> +#endif
>
> pr_warn("released /dev/fb%d user=%d count=%d\n",
> info->node, user, ufbdev->fb_count);
> --
> 2.9.0
>



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


Re: [PATCH v3 0/2] AM335x-ICE: Add support for rotary switch

2016-08-24 Thread Daniel Mack
Hi,

On 08/24/2016 09:58 AM, Vignesh R wrote:
> This series adds support for rotary-switch on AM335x-ICE that is
> connected to TI PCA9536 I2C GPIO expander.
> First patch adds new generic driver to read status of group of GPIO
> lines and report the value as an input event. The second patch adds DT
> entries for the same.
> 
> v2: https://lkml.org/lkml/2016/8/23/111
> v1: https://lkml.org/lkml/2016/8/12/7

Is there a reason why the rotary-encoder driver cannot handle this?
Commit 7dde4e74744 ("Input: rotary-encoder - support more than 2 gpios
as input") added support for that mode AFAIU.

I copied the author of that patch to have a look.


Thanks,
Daniel


[tip:perf/core] perf hists: Introduce nr_header_lines into struct perf_hpp_list

2016-08-24 Thread tip-bot for Jiri Olsa
Commit-ID:  f8e6710de859e1ac3a5df294bddeca19f60cec9a
Gitweb: http://git.kernel.org/tip/f8e6710de859e1ac3a5df294bddeca19f60cec9a
Author: Jiri Olsa 
AuthorDate: Sun, 7 Aug 2016 17:28:26 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf hists: Introduce nr_header_lines into struct perf_hpp_list

Currently we support just single line headers, this is first step to
allow more.

Store the number of header lines in perf_hpp_list, which encompasses all
the display/sort entries and is thus suitable to hold this value.

Signed-off-by: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/1470583710-1649-2-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/ui/browsers/hists.c | 15 ---
 tools/perf/ui/hist.c   |  1 +
 tools/perf/util/hist.h |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 13d4143..95f7cf1 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
 static void hist_browser__update_rows(struct hist_browser *hb)
 {
struct ui_browser *browser = >b;
-   u16 header_offset = hb->show_headers ? 1 : 0, index_row;
+   struct hists *hists = hb->hists;
+   struct perf_hpp_list *hpp_list = hists->hpp_list;
+   u16 header_offset, index_row;
 
+   header_offset = hb->show_headers ? hpp_list->nr_header_lines : 0;
browser->rows = browser->height - header_offset;
/*
 * Verify if we were at the last line and that line isn't
@@ -99,8 +102,11 @@ static void hist_browser__refresh_dimensions(struct 
ui_browser *browser)
 
 static void hist_browser__gotorc(struct hist_browser *browser, int row, int 
column)
 {
-   u16 header_offset = browser->show_headers ? 1 : 0;
+   struct hists *hists = browser->hists;
+   struct perf_hpp_list *hpp_list = hists->hpp_list;
+   u16 header_offset;
 
+   header_offset = browser->show_headers ? hpp_list->nr_header_lines : 0;
ui_browser__gotorc(>b, row + header_offset, column);
 }
 
@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct 
ui_browser *browser)
u16 header_offset = 0;
struct rb_node *nd;
struct hist_browser *hb = container_of(browser, struct hist_browser, b);
+   struct hists *hists = hb->hists;
 
if (hb->show_headers) {
+   struct perf_hpp_list *hpp_list = hists->hpp_list;
+
hist_browser__show_headers(hb);
-   header_offset = 1;
+   header_offset = hpp_list->nr_header_lines;
}
 
ui_browser__hists_init_top(browser);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 4274969..be7a17f 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 struct perf_hpp_list perf_hpp_list = {
.fields = LIST_HEAD_INIT(perf_hpp_list.fields),
.sorts  = LIST_HEAD_INIT(perf_hpp_list.sorts),
+   .nr_header_lines = 1,
 };
 
 #undef HPP__COLOR_PRINT_FNS
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 0a1edf1..8cc5d33 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -259,6 +259,7 @@ struct perf_hpp_list {
struct list_head fields;
struct list_head sorts;
 
+   int nr_header_lines;
int need_collapse;
int parent;
int sym;


[tip:perf/core] perf hists: Add line argument into perf_hpp_fmt's header callback

2016-08-24 Thread tip-bot for Jiri Olsa
Commit-ID:  74bb43f29ec80bc998804fa7399930d86c4bae67
Gitweb: http://git.kernel.org/tip/74bb43f29ec80bc998804fa7399930d86c4bae67
Author: Jiri Olsa 
AuthorDate: Sun, 7 Aug 2016 17:28:27 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 15:37:33 -0300

perf hists: Add line argument into perf_hpp_fmt's header callback

Adding line argument into perf_hpp_fmt's header callback to be able to
request specific header line.

Signed-off-by: Jiri Olsa 
Cc: David Ahern 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/1470583710-1649-3-git-send-email-jo...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-diff.c  | 3 ++-
 tools/perf/ui/browsers/hists.c | 6 +++---
 tools/perf/ui/gtk/hists.c  | 2 +-
 tools/perf/ui/hist.c   | 2 +-
 tools/perf/ui/stdio/hist.c | 6 +++---
 tools/perf/util/hist.h | 2 +-
 tools/perf/util/sort.c | 5 +++--
 7 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 21ee753..75da965 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1033,7 +1033,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, 
struct perf_hpp *hpp,
 }
 
 static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-  struct hists *hists __maybe_unused)
+  struct hists *hists __maybe_unused,
+  int line __maybe_unused)
 {
struct diff_hpp_fmt *dfmt =
container_of(fmt, struct diff_hpp_fmt, fmt);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 95f7cf1..303ed62 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1523,7 +1523,7 @@ static int hists_browser__scnprintf_headers(struct 
hist_browser *browser, char *
if (perf_hpp__should_skip(fmt, hists)  || column++ < 
browser->b.horiz_scroll)
continue;
 
-   ret = fmt->header(fmt, _hpp, hists);
+   ret = fmt->header(fmt, _hpp, hists, 0);
if (advance_hpp_check(_hpp, ret))
break;
 
@@ -1560,7 +1560,7 @@ static int 
hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
if (column++ < browser->b.horiz_scroll)
continue;
 
-   ret = fmt->header(fmt, _hpp, hists);
+   ret = fmt->header(fmt, _hpp, hists, 0);
if (advance_hpp_check(_hpp, ret))
break;
 
@@ -1597,7 +1597,7 @@ static int 
hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
}
first_col = false;
 
-   ret = fmt->header(fmt, _hpp, hists);
+   ret = fmt->header(fmt, _hpp, hists, 0);
dummy_hpp.buf[ret] = '\0';
 
start = trim(dummy_hpp.buf);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index c5f3677..79cb5c4 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, 
struct hists *hists,
strcat(buf, "+");
first_col = false;
 
-   fmt->header(fmt, , hists);
+   fmt->header(fmt, , hists, 0);
strcat(buf, ltrim(rtrim(hpp.buf)));
}
}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index be7a17f..30457c6 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -230,7 +230,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 }
 
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
- struct hists *hists)
+ struct hists *hists, int line __maybe_unused)
 {
int len = hpp__width_fn(fmt, hpp, hists);
return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index f04a631..91b8e10 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, 
struct perf_hpp *hpp,
struct perf_hpp_list_node, list);
 
perf_hpp_list__for_each_format(_node->hpp, fmt) {
-   fmt->header(fmt, hpp, hists);
+   fmt->header(fmt, hpp, hists, 0);
fprintf(fp, "%s%s", hpp->buf, sep ?: "  ");
}
 
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, 
struct perf_hpp *hpp,
header_width += fprintf(fp, "+");
first_col = false;
 
-

[tip:perf/core] perf probe: Support hexadecimal casting

2016-08-24 Thread tip-bot for Masami Hiramatsu
Commit-ID:  925437872525ee229736a9a8bdf804fc98f75b44
Gitweb: http://git.kernel.org/tip/925437872525ee229736a9a8bdf804fc98f75b44
Author: Masami Hiramatsu 
AuthorDate: Thu, 18 Aug 2016 17:58:47 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 17:06:37 -0300

perf probe: Support hexadecimal casting

Support hexadecimal unsigned integer casting by 'x'.  This allows user
to explicitly specify the output format of the probe arguments as
hexadecimal.

Signed-off-by: Masami Hiramatsu 
Cc: Alexander Shishkin 
Cc: Hemant Kumar 
Cc: Naohiro Aota 
Cc: Peter Zijlstra 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: 
http://lkml.kernel.org/r/147151072679.12957.4458656416765710753.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-probe.txt |  4 ++--
 tools/perf/util/probe-finder.c  | 17 ++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Documentation/perf-probe.txt 
b/tools/perf/Documentation/perf-probe.txt
index aa33325..d217617 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -176,13 +176,13 @@ Each probe argument follows below syntax.
 
 'NAME' specifies the name of this argument (optional). You can use the name of 
local variable, local data structure member (e.g. var->field, var.field2), 
local array with fixed index (e.g. array[1], var->array[0], var->pointer[2]), 
or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name 
of this argument will be set as the last member name if you specify a local 
data structure member (e.g. field2 for 'var->field1.field2'.)
 '$vars' and '$params' special arguments are also available for NAME, '$vars' 
is expanded to the local variables (including function parameters) which can 
access at given probe point. '$params' is expanded to only the function 
parameters.
-'TYPE' casts the type of this argument (optional). If omitted, perf probe 
automatically set the type based on debuginfo. Currently, basic types 
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x8/x16/x32/x64), 
signedness casting (u/s), "string" and bitfield are supported. (see TYPES for 
detail)
+'TYPE' casts the type of this argument (optional). If omitted, perf probe 
automatically set the type based on debuginfo. Currently, basic types 
(u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x/x8/x16/x32/x64), 
signedness casting (u/s), "string" and bitfield are supported. (see TYPES for 
detail)
 
 On x86 systems %REG is always the short form of the register: for example %AX. 
%RAX or %EAX is not valid.
 
 TYPES
 -
-Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers 
(x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are 
signed and unsigned respectively, and 'x' means that is shown in hexadecimal 
format. Traced arguments are shown in decimal (signed) or hex (unsigned). You 
can also use 's' or 'u' to specify only signedness and leave its size 
auto-detected by perf probe.
+Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers 
(x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are 
signed and unsigned respectively, and 'x' means that is shown in hexadecimal 
format. Traced arguments are shown in decimal (signed) or hex (unsigned). You 
can also use 's' or 'u' to specify only signedness and leave its size 
auto-detected by perf probe. Moreover, you can use 'x' to explicitly specify to 
be shown in hexadecimal (the size is also auto-detected).
 String type is a special type, which fetches a "null-terminated" string from 
kernel space. This means it will fail and store NULL if the string container 
has been paged out. You can specify 'string' type only for the local variable 
or structure member which is an array of or a pointer to 'char' or 'unsigned 
char' type.
 Bitfield is another special type, which takes 3 parameters, bit-width, 
bit-offset, and container-size (usually 32). The syntax is;
 
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 24dbe23..f18cd6b 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -298,13 +298,13 @@ static int convert_variable_type(Dwarf_Die *vr_die,
char sbuf[STRERR_BUFSIZE];
int bsize, boffs, total;
int ret;
-   char sign;
+   char prefix;
 
/* TODO: check all types */
-   if (cast && strcmp(cast, "string") != 0 &&
+   if (cast && strcmp(cast, "string") != 0 && strcmp(cast, "x") != 0 &&
strcmp(cast, "s") != 0 && strcmp(cast, "u") != 0) {
/* Non string type is OK */
-   /* and respect signedness cast */
+   /* and respect 

[tip:perf/core] perf probe: Add supported for type casting by the running kernel

2016-08-24 Thread tip-bot for Masami Hiramatsu
Commit-ID:  180b20616ce57e93eb692170c793be94c456b1e2
Gitweb: http://git.kernel.org/tip/180b20616ce57e93eb692170c793be94c456b1e2
Author: Masami Hiramatsu 
AuthorDate: Thu, 18 Aug 2016 17:58:31 +0900
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 23 Aug 2016 17:03:31 -0300

perf probe: Add supported for type casting by the running kernel

Add a checking routine what types are supported by the running kernel by
finding the pattern in /tracing/README.

Signed-off-by: Masami Hiramatsu 
Cc: Alexander Shishkin 
Cc: Hemant Kumar 
Cc: Naohiro Aota 
Cc: Peter Zijlstra 
Cc: Steven Rostedt 
Cc: Wang Nan 
Link: 
http://lkml.kernel.org/r/147151071172.12957.3340095690753291085.stgit@devbox
[ 'enum probe_type' has no negative entries, so ends up as 'unsigned', remove 
'< 0'
   test to fix the build on at least centos:5, debian:7 & ubuntu:12.04.5 ]
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/probe-file.c   | 57 ++
 tools/perf/util/probe-file.h   | 10 
 tools/perf/util/probe-finder.c |  1 +
 3 files changed, 68 insertions(+)

diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 9c3b9ed..697ef66 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -877,3 +877,60 @@ int probe_cache__show_all_caches(struct strfilter *filter)
 
return 0;
 }
+
+static struct {
+   const char *pattern;
+   boolavail;
+   boolchecked;
+} probe_type_table[] = {
+#define DEFINE_TYPE(idx, pat, def_avail)   \
+   [idx] = {.pattern = pat, .avail = (def_avail)}
+   DEFINE_TYPE(PROBE_TYPE_U, "* u8/16/32/64,*", true),
+   DEFINE_TYPE(PROBE_TYPE_S, "* s8/16/32/64,*", true),
+   DEFINE_TYPE(PROBE_TYPE_X, "* x8/16/32/64,*", false),
+   DEFINE_TYPE(PROBE_TYPE_STRING, "* string,*", true),
+   DEFINE_TYPE(PROBE_TYPE_BITFIELD,
+   "* b@/", true),
+};
+
+bool probe_type_is_available(enum probe_type type)
+{
+   FILE *fp;
+   char *buf = NULL;
+   size_t len = 0;
+   bool target_line = false;
+   bool ret = probe_type_table[type].avail;
+
+   if (type >= PROBE_TYPE_END)
+   return false;
+   /* We don't have to check the type which supported by default */
+   if (ret || probe_type_table[type].checked)
+   return ret;
+
+   if (asprintf(, "%s/README", tracing_path) < 0)
+   return ret;
+
+   fp = fopen(buf, "r");
+   if (!fp)
+   goto end;
+
+   zfree();
+   while (getline(, , fp) > 0 && !ret) {
+   if (!target_line) {
+   target_line = !!strstr(buf, " type: ");
+   if (!target_line)
+   continue;
+   } else if (strstr(buf, "\t  ") != buf)
+   break;
+   ret = strglobmatch(buf, probe_type_table[type].pattern);
+   }
+   /* Cache the result */
+   probe_type_table[type].checked = true;
+   probe_type_table[type].avail = ret;
+
+   fclose(fp);
+end:
+   free(buf);
+
+   return ret;
+}
diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h
index 9577b5c..eba44c3 100644
--- a/tools/perf/util/probe-file.h
+++ b/tools/perf/util/probe-file.h
@@ -19,6 +19,15 @@ struct probe_cache {
struct list_head entries;
 };
 
+enum probe_type {
+   PROBE_TYPE_U = 0,
+   PROBE_TYPE_S,
+   PROBE_TYPE_X,
+   PROBE_TYPE_STRING,
+   PROBE_TYPE_BITFIELD,
+   PROBE_TYPE_END,
+};
+
 #define PF_FL_UPROBE   1
 #define PF_FL_RW   2
 #define for_each_probe_cache_entry(entry, pcache) \
@@ -54,6 +63,7 @@ struct probe_cache_entry *probe_cache__find(struct 
probe_cache *pcache,
 struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
const char *group, const char *event);
 int probe_cache__show_all_caches(struct strfilter *filter);
+bool probe_type_is_available(enum probe_type type);
 #else  /* ! HAVE_LIBELF_SUPPORT */
 static inline struct probe_cache *probe_cache__new(const char *tgt 
__maybe_unused)
 {
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5c290c6..24dbe23 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -39,6 +39,7 @@
 #include "util.h"
 #include "symbol.h"
 #include "probe-finder.h"
+#include "probe-file.h"
 
 /* Kprobe tracer basic type is up to u64 */
 #define MAX_BASIC_TYPE_BITS64


Re: [PATCH V3] leds: trigger: Introduce an USB port trigger

2016-08-24 Thread Rafał Miłecki
On 24 August 2016 at 11:21, Greg KH  wrote:
> On Wed, Aug 24, 2016 at 12:03:29AM +0200, Rafał Miłecki wrote:
>> From: Rafał Miłecki 
>>
>> This commit adds a new trigger responsible for turning on LED when USB
>> device gets connected to the specified USB port. This can can useful for
>> various home routers that have USB port(s) and a proper LED telling user
>> a device is connected.
>>
>> The trigger gets its documentation file but basically it just requires
>> specifying USB port in a Linux format (e.g. echo 1-1 > new_port).
>>
>> During work on this trigger there was a plan to add DT bindings for it,
>> but there wasn't an agreement on the format yet. This can be worked on
>> later, a sysfs interface is needed anyway for platforms not using DT.
>>
>> Signed-off-by: Rafał Miłecki 
>> ---
>> V2: Trying to add DT support, idea postponed as it will take more time
>> to discuss the bindings.
>> V3: Fix typos in commit and Documentation (thanks Jacek!)
>> Use "ports" sysfs file for adding and removing USB ports (thx Jacek)
>> Check if there is USB device connected after adding new USB port
>> Fix memory leak or two
>>
>> Felipe: I'd like to ask for your Ack before having this patch pushed.
>> ---
>>  Documentation/leds/ledtrig-usbport.txt |  49 +++
>>  drivers/leds/trigger/Kconfig   |   8 ++
>>  drivers/leds/trigger/Makefile  |   1 +
>>  drivers/leds/trigger/ledtrig-usbport.c | 253 
>> +
>>  4 files changed, 311 insertions(+)
>>  create mode 100644 Documentation/leds/ledtrig-usbport.txt
>>  create mode 100644 drivers/leds/trigger/ledtrig-usbport.c
>
> You are adding sysfs files without adding a Documentation/ABI/ entry,
> please never do that.

This is the way all LED triggers are documented, I just blindly
assumed it's OK. Could you be a bit more helpful and help me to
understand further steps? Should I drop
Documentation/leds/ledtrig-usbport.txt and add proper entry in
Documentation/ABI/testing? Or should I keep both files? What about
current sysfs of other triggers? Should they be moved/documented in
ABI?

-- 
Rafał


Re: [RFC v4 16/22] clockevents: use ->min_delta_ticks_adjusted to program minimum delta

2016-08-24 Thread Nicolai Stange
>  static int clockevents_program_min_delta(struct clock_event_device *dev)
>  {
> - unsigned long long clc;
> - int64_t delta;
> -
> - delta = dev->min_delta_ns;
> -
>   if (clockevent_state_shutdown(dev))
>   return 0;
>  
>   dev->retries++;
> - clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
> - return dev->set_next_event((unsigned long) clc, dev);
> + return dev->set_next_event(dev->min_delta_ticks_incr, dev);
>  }
>  
>  #endif /* CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST */

FYI, the kernel build test robot reported a build failure with
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=n. It shoud read as
dev->min_delta_ticks_adjusted here. In order to avoid unnecessary
traffic, I'll only fix this up in a v5 if you give the whole thing a go.




Re: [RFC][PATCH 1/3] locking/mutex: Rework mutex::owner

2016-08-24 Thread Will Deacon
On Tue, Aug 23, 2016 at 02:46:18PM +0200, Peter Zijlstra wrote:
> There's a number of iffy in mutex because mutex::count and
> mutex::owner are two different fields; this too is the reason
> MUTEX_SPIN_ON_OWNER and DEBUG_MUTEX are mutually exclusive.
> 
> Cure this by folding them into a single atomic_long_t field.
> 
> This nessecairly kills all the architecture specific mutex code.
> 
> Signed-off-by: Peter Zijlstra (Intel) 

[...]

>  void __sched mutex_unlock(struct mutex *lock)
>  {
> - /*
> -  * The unlocking fastpath is the 0->1 transition from 'locked'
> -  * into 'unlocked' state:
> -  */
> -#ifndef CONFIG_DEBUG_MUTEXES
> - /*
> -  * When debugging is enabled we must not clear the owner before time,
> -  * the slow path will always be taken, and that clears the owner field
> -  * after verifying that it was indeed current.
> -  */
> - mutex_clear_owner(lock);
> + unsigned long owner;
> +
> +#ifdef CONFIG_DEBUG_MUTEXES
> + DEBUG_LOCKS_WARN_ON(__mutex_owner(lock) != current);
>  #endif
> - __mutex_fastpath_unlock(>count, __mutex_unlock_slowpath);
> -}
>  
> + owner = atomic_long_read(>owner);
> + for (;;) {
> + unsigned long old;
> +
> + old = atomic_long_cmpxchg_release(>owner, owner, owner & 
> 0x03);
> + if (old == owner)
> + break;
> +
> + owner = old;
> + }

Can you rewrite this using atomic_long_fetch_and_release?

Will


Re: [PATCH] fb: udl: fix build without CONFIG_FB_DEFERRED_IO

2016-08-24 Thread Arnd Bergmann
On Wednesday, August 24, 2016 11:01:17 AM CEST Daniel Vetter wrote:
> On Wed, Aug 24, 2016 at 10:27 AM, Arnd Bergmann  wrote:
> > A cleanup in v4.8 dropped several dependencies, but caused the udl driver
> > to fail building when CONFIG_FB_DEFERRED_IO is not set:
> >
> > drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_open':
> > drivers/gpu/drm/udl/udl_fb.c:206:23: error: 'struct fb_info' has no member 
> > named 'fbdefio'
> >   if (fb_defio && (info->fbdefio == NULL)) {
> >^~
> >
> > This adds an #ifdef check around the code that fails. We know this
> > is safe because it always checks info->fbdefio for being non-NULL,
> > and that member is not defined here.
> >
> > Signed-off-by: Arnd Bergmann 
> > Fixes: c0f0c177b5a9 ("drm/udl: make fbdev support really optional")
> 
> There's a pile more needed, which is why I just ended up stuffing them
> all into linux-next for 4.9. Is your patch still needed on that? If we
> really want this fixed in 4.8 I guess I can assemble a cherry-pick
> list.

Ok, got it. I think your 0c756134cf76 ("drm: Protect fb_defio in
drivers with CONFIG_KMS_FBDEV_EMULATION") is actually sufficient
for the build break, it's almost the same as my patch anyway.

Alternatively, reverting c0f0c177b5a9 ("drm/udl: make fbdev
support really optional") for v4.8 would work too.

Arnd


Re: [PATCH] vfio/pci: Fix typos in comments

2016-08-24 Thread Wei, Jiangang
ping...
On Wed, 2016-08-17 at 14:37 +0800, Wei Jiangang wrote:
> Signed-off-by: Wei Jiangang 
> ---
>  drivers/vfio/pci/vfio_pci_config.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_config.c 
> b/drivers/vfio/pci/vfio_pci_config.c
> index 688691d9058d..c4f235452d81 100644
> --- a/drivers/vfio/pci/vfio_pci_config.c
> +++ b/drivers/vfio/pci/vfio_pci_config.c
> @@ -70,7 +70,7 @@ static const u8 pci_cap_length[PCI_CAP_ID_MAX + 1] = {
>  
>  /*
>   * Lengths of PCIe/PCI-X Extended Config Capabilities
> - *   0: Removed or masked from the user visible capabilty list
> + *   0: Removed or masked from the user visible capability list
>   *   FF: Variable length
>   */
>  static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = {
> @@ -355,7 +355,7 @@ static int alloc_perm_bits(struct perm_bits *perm, int 
> size)
>* ignore whether a read/write exceeds the defined capability
>* structure.  We can do this because:
>*  - Standard config space is already dword aligned
> -  *  - Capabilities are all dword alinged (bits 0:1 of next reserved)
> +  *  - Capabilities are all dword aligned (bits 0:1 of next reserved)
>*  - Express capabilities defined as dword aligned
>*/
>   size = round_up(size, 4);
> @@ -1516,10 +1516,10 @@ static int vfio_ecap_init(struct vfio_pci_device 
> *vdev)
>   * space which tracks reads and writes to bits that we emulate for
>   * the user.  Initial values filled from device.
>   *
> - * Using shared stuct perm_bits between all vfio-pci devices saves
> + * Using shared struct perm_bits between all vfio-pci devices saves
>   * us from allocating cfg_size buffers for virt and write for every
>   * device.  We could remove vconfig and allocate individual buffers
> - * for each area requring emulated bits, but the array of pointers
> + * for each area requiring emulated bits, but the array of pointers
>   * would be comparable in size (at least for standard config space).
>   */
>  int vfio_config_init(struct vfio_pci_device *vdev)





Re: [PATCH v4 0/4] i2c: designware: improve performance for transfers

2016-08-24 Thread Jarkko Nikula

On 08/24/2016 01:18 AM, Lucas De Marchi wrote:

Diff from v3:

- Fix over 80chars in one place

- Move check for adapter being able to dynamically update TAR to be done
  on probe time rather than init as requested by Jarkko

For the previous version, Christian had added:

Tested-by: Christian Ruppert 
on TB101 with Linux-4.7

And Jarkko added his Acked-by: Jarkko Nikula 
on patches 1 and 3 (now 4).


Acked-by: Jarkko Nikula 


Re: [PATCH v2 1/2] kexec: Introduce "/sys/kernel/kexec_crash_low_size"

2016-08-24 Thread Xunlei Pang
On 2016/08/24 at 16:20, Dave Young wrote:
> On 08/23/16 at 06:11pm, Yinghai Lu wrote:
>> On Wed, Aug 17, 2016 at 1:20 AM, Dave Young  wrote:
>>> On 08/17/16 at 09:50am, Xunlei Pang wrote:
 "/sys/kernel/kexec_crash_size" only handles crashk_res, it
 is fine in most cases, but sometimes we have crashk_low_res.
 For example, when "crashkernel=size[KMG],high" combined with
 "crashkernel=size[KMG],low" is used for 64-bit x86.

 Like crashk_res, we introduce the corresponding sysfs file
 "/sys/kernel/kexec_crash_low_size" for crashk_low_res.

 So, the exact total reserved memory is the sum of the two.

 crashk_low_res can also be shrunk via this new interface,
 and users should be aware of what they are doing.
>> ...
 @@ -218,6 +238,7 @@ static struct attribute * kernel_attrs[] = {
  #ifdef CONFIG_KEXEC_CORE
   _loaded_attr.attr,
   _crash_loaded_attr.attr,
 + _crash_low_size_attr.attr,
   _crash_size_attr.attr,
   _attr.attr,
  #endif
>> would be better if you can use attribute_group .is_visible to control 
>> showing of
>> crash_low_size only when the crash_base is above 4G.
> I have same feeling that it looks odd to show low in sysfs in case no
> crashkernel=,high being used. Even if crashkernel=,high is used only in
> x86 the resource crashk_low is in common code. What do you think to move
> it to x86?

If want to put some restriction on it, I'd prefer to move crashk_low to arch 
x86, to make
it x86-specific.

We can show the interface unconditionally. If it isn't used, its size is 0, it 
doesn't matter.

Regards,
Xunlei

>
> Thanks
> Dave
>
>> Thanks
>>
>> Yinghai
>>
>> ___
>> kexec mailing list
>> ke...@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec



[PATCH v2] mm: memcontrol: avoid unused function warning

2016-08-24 Thread Arnd Bergmann
A bugfix in v4.8-rc2 introduced a harmless warning when CONFIG_MEMCG_SWAP
is disabled but CONFIG_MEMCG is enabled:

mm/memcontrol.c:4085:27: error: 'mem_cgroup_id_get_online' defined but not used 
[-Werror=unused-function]
 static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)

This moves the function inside of the #ifdef block that hides the
calling function, to avoid the warning.

Signed-off-by: Arnd Bergmann 
Fixes: 1f47b61fb407 ("mm: memcontrol: fix swap counter leak on swapout from 
offline cgroup")
Acked-by: Michal Hocko 
Acked-by: Vladimir Davydov 
---
 mm/memcontrol.c | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

This is the alternative to the original patch, as suggested by Michal Hocko.
Andrew, please pick whichever version you like better.

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2ff0289ad061..9a6a51a7c416 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4082,24 +4082,6 @@ static void mem_cgroup_id_get_many(struct mem_cgroup 
*memcg, unsigned int n)
atomic_add(n, >id.ref);
 }
 
-static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
-{
-   while (!atomic_inc_not_zero(>id.ref)) {
-   /*
-* The root cgroup cannot be destroyed, so it's refcount must
-* always be >= 1.
-*/
-   if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
-   VM_BUG_ON(1);
-   break;
-   }
-   memcg = parent_mem_cgroup(memcg);
-   if (!memcg)
-   memcg = root_mem_cgroup;
-   }
-   return memcg;
-}
-
 static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
 {
if (atomic_sub_and_test(n, >id.ref)) {
@@ -5821,6 +5803,24 @@ static int __init mem_cgroup_init(void)
 subsys_initcall(mem_cgroup_init);
 
 #ifdef CONFIG_MEMCG_SWAP
+static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
+{
+   while (!atomic_inc_not_zero(>id.ref)) {
+   /*
+* The root cgroup cannot be destroyed, so it's refcount must
+* always be >= 1.
+*/
+   if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
+   VM_BUG_ON(1);
+   break;
+   }
+   memcg = parent_mem_cgroup(memcg);
+   if (!memcg)
+   memcg = root_mem_cgroup;
+   }
+   return memcg;
+}
+
 /**
  * mem_cgroup_swapout - transfer a memsw charge to swap
  * @page: page whose memsw charge to transfer
-- 
2.9.0



Re: [ANNOUNCE] git-series: track changes to a patch series over time

2016-08-24 Thread Jakub Narębski
W dniu 11.08.2016 o 00:07, Josh Triplett pisze:
> On August 9, 2016 11:37:31 PM HST, Richard Ipsum
>  wrote:
>> On Thu, Aug 04, 2016 at 12:40:58PM -1000, Josh Triplett wrote:
[...]

>>> If you use a format-patch diff that includes the headers and
>>> commit message, you could also support commenting on those in the
>>> same way. Does the notedb format support commenting on those?
>> 
>> Comments in notedb are just a git note keyed on the sha of the 
>> commit being commented on, I'm not certain what advantage a 
>> format-patch diff provides in this case?
> 
> I meant for opening in an editor to write email-reply-style comments.
> The review tool and review storage format should allow commenting on
> commit messages, not just diffs.

There is also cover letter and interdiff, and one would want to
be able to comment also on those.

So how notedb solve problem of in-diff comments, in-commit comments,
post-commit comments, whole series cover letter and cover-letter
comments, interdiff and interdiff message / comments?


Nb. GitHub Pull Requests include only some of those, compared to
the mailing list / Usenet news interface.
 
>> I've been closely following the 'patch submission process' thread, 
>> and given the discussion there I'm having doubts over the value of
>> comments in git-candidate vs the mailing list. It seems to me that 
>> git-candidate has many of the disadvantages of Github/Gitlab when
>> it comes to comments, for example, there is no threading.
> 
> That's not inherent, though. You could allow commenting on a comment
> easily enough. (Of course, at some point you've recreated email-style
> in-reply-to headers...)

I wonder if we could use 'parent' header of a commit message for this,
or equivalent...
 
>> Also the system would be less open than the mailing list, since, as
>> it stands currently you would require push access to the
>> repository to comment on anything.
> 
> You'd need a federation mechanism.

...which is as easy to set up and use as mailing list, for sending
patches, applying patches, and patch review.  And/or provide 
bi-directional interface to the mailing list (I think Debian 
infrastructure tries to be (inter)operable by email).

There are various federated technologies (like pump.io), the
problem might be their popularity.

>> It may be worth reflecting that one reason some organizations have
>> switched away from mailing list reviews to Github/Gitlab is that 
>> they provide patch tracking, where the mailing list provides none, 
>> so patches there can be 'lost'. So instead of trying to
>> reimplement an entire Gerrit/Github/Gitlab UI on the commandline, I
>> wonder whether it would be sufficient to add the minimum
>> functionality necessary to provide git with native patch tracking,
>> and leave comments for the mailing list. Of course this is exactly
>> what git-series seems to do, so in some sense I may be advocating
>> dropping my own work in favour of improving git-series.
> 
> I think the two serve different (though related) functions. I'd love
> to be able to use a text editor and command-line tool to produce and
> submit comments to systems like Gerrit or GitHub.

I think there are command-line tools that allow to submit comments
to GitHub.

-- 
Jakub Narębski


[PATCH 26/41] staging: r8188eu: remove unused members of ht_priv structure

2016-08-24 Thread Ivan Safonov
tx_amsdu_enable and tx_amdsu_maxlen are not used in driver code.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_ht.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_ht.h 
b/drivers/staging/rtl8188eu/include/rtw_ht.h
index 7beb0b1..2b03b11 100644
--- a/drivers/staging/rtl8188eu/include/rtw_ht.h
+++ b/drivers/staging/rtl8188eu/include/rtw_ht.h
@@ -21,8 +21,6 @@
 struct ht_priv {
u32 ht_option;
u32 ampdu_enable;/* for enable Tx A-MPDU */
-   u32 tx_amsdu_enable;/* for enable Tx A-MSDU */
-   u32 tx_amdsu_maxlen; /*  1: 8k, 0:4k ; default:8k, for tx */
u32 rx_ampdu_maxlen; /* for rx reordering ctrl win_sz,
  * updated when join_callback. */
u8  bwmode;/*  */
-- 
2.7.3



[PATCH 18/41] staging: r8188eu: remove dead code from rtw_get_cur_max_rate function

2016-08-24 Thread Ivan Safonov
Values assugned to pht_capie and mcs_rate variables,
but variables does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index f85a6ab..62b2f71 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -14,7 +14,6 @@
  
**/
 #define _RTW_IOCTL_SET_C_
 
-
 #include 
 #include 
 #include 
@@ -570,10 +569,8 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
struct registry_priv *pregistrypriv = >registrypriv;
struct mlme_priv*pmlmepriv = >mlmepriv;
struct wlan_bssid_ex  *pcur_bss = >cur_network.network;
-   struct rtw_ieee80211_ht_cap *pht_capie;
u8  rf_type = 0;
u8  bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
-   u16 mcs_rate = 0;
u32 ht_ielen = 0;
 
if (adapter->registrypriv.mp_mode == 1) {
@@ -588,10 +585,6 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
if (pmlmeext->cur_wireless_mode & (WIRELESS_11_24N|WIRELESS_11_5N)) {
p = rtw_get_ie(_bss->IEs[12], _HT_CAPABILITY_IE_, 
_ielen, pcur_bss->IELength-12);
if (p && ht_ielen > 0) {
-   pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2);
-
-   memcpy(_rate, pht_capie->supp_mcs_set, 2);
-
/* cur_bwmod is updated by beacon, pmlmeinfo is updated 
by association response */
bw_40MHz = (pmlmeext->cur_bwmode && 
(HT_INFO_HT_PARAM_REC_TRANS_CHNL_WIDTH & pmlmeinfo->HT_info.infos[0])) ? 1 : 0;
 
-- 
2.7.3



Re: [PATCH][RFC] printk: make pr_cont buffer per-cpu

2016-08-24 Thread Petr Mladek
On Wed 2016-08-24 10:14:20, Sergey Senozhatsky wrote:
> Hello,
> 
> On (08/23/16 13:47), Petr Mladek wrote:
> [..]
> > >   if (!(lflags & LOG_NEWLINE)) {
> > > + if (!this_cpu_read(cont_printing)) {
> > > + if (system_state == SYSTEM_RUNNING) {
> > > + this_cpu_write(cont_printing, true);
> > > + preempt_disable();
> > > + }
> > > + }
> > 
> > I am afraid that this is not acceptable. It means that printk() will have
> > an unexpected side effect. The missing "\n" at the end of a printed
> > string would disable preemption. See below for more.
> 
> missing '\n' must WARN about "sched while atomic" eventually, so it
> shouldn't go unnoticed or stay hidden.

Well, it will still force people to rebuilt a test kernel because they
forget to use '\n" and the test kernel is unusable.

IMHO, the connection between '\n' and preemption is not
intuitive and hard to spot. We should do our best to avoid it.


> > I think that cont lines should be a corner case. There should be only
> > a limited use of them. We should not make too complicated things to
> > support them. Also printk() must not get harder to use because of them.
> > I still see a messed output rather as a cosmetic problem in compare with
> > possible possible deadlocks or hung tasks.
> 
> oh, I would love it if pr_cont() was never used in SMP. but this is not
> the case, unfortunately. and, ironically, where pr_cont really matters
> is debugging -- for instance, look at arch/x86/kernel/dumpstack_{32,64}.c
> show_regs() or show_stack_log_lvl()

Sure but how big is the problem in the daily life? I have never heard
colleagues complaining about messed cont lines. It is rare and it
is always possible to restore it. Checking BUG/WARN messages is
a rather hard detective work anyway.

The most painful situation would be if backtraces from different
CPUs are mixed. But there will be problem even with mixed lines.
Fortunately, this usually happens when printing backtraces from
all CPUs in NMI and the output is serialized.


> well, I do understand what you mean and agree with it, but I'm
> afraid pr_cont() kinda matters after all and people *probably*
> expect it to be SMP safe (I'm not entirely sure whether all of
> those pr_cont() calls were put there with the idea that the
> output can be messed up and quite hard to read).

This was even worse before the cont lines buffer.

Sigh, I do not feel experienced enough to decide about this.
I wonder if this is rather theoretical problem or if there
are many real complains about it.

I feel that we might be trapped by a perfectionism. Perfect output
would be great. But it must not make printk() hard to use
in the daily life.

Best Regards,
Petr


[PATCH 01/41] staging: r8188eu: remove rtw_ies_remove_ie function

2016-08-24 Thread Ivan Safonov
Driver does not use this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 47 --
 drivers/staging/rtl8188eu/include/ieee80211.h  |  2 --
 2 files changed, 49 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 0b0d78f..b8ba90a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -280,53 +280,6 @@ u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, 
u8 oui_len, u8 *ie, u
return target_ie;
 }
 
-/**
- * rtw_ies_remove_ie - Find matching IEs and remove
- * @ies: Address of IEs to search
- * @ies_len: Pointer of length of ies, will update to new length
- * @offset: The offset to start scarch
- * @eid: Element ID to match
- * @oui: OUI to match
- * @oui_len: OUI length
- *
- * Returns: _SUCCESS: ies is updated, _FAIL: not updated
- */
-int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 
oui_len)
-{
-   int ret = _FAIL;
-   u8 *target_ie;
-   u32 target_ielen;
-   u8 *start;
-   uint search_len;
-
-   if (!ies || !ies_len || *ies_len <= offset)
-   goto exit;
-
-   start = ies + offset;
-   search_len = *ies_len - offset;
-
-   while (1) {
-   target_ie = rtw_get_ie_ex(start, search_len, eid, oui, oui_len, 
NULL, _ielen);
-   if (target_ie && target_ielen) {
-   u8 buf[MAX_IE_SZ] = {0};
-   u8 *remain_ies = target_ie + target_ielen;
-   uint remain_len = search_len - (remain_ies - start);
-
-   memcpy(buf, remain_ies, remain_len);
-   memcpy(target_ie, buf, remain_len);
-   *ies_len = *ies_len - target_ielen;
-   ret = _SUCCESS;
-
-   start = target_ie;
-   search_len = remain_len;
-   } else {
-   break;
-   }
-   }
-exit:
-   return ret;
-}
-
 void rtw_set_supported_rate(u8 *SupportedRates, uint mode)
 {
 
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index d8284c8..a62077b 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1108,8 +1108,6 @@ u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, 
u8 ttl,
 u8 *rtw_get_ie(u8 *pbuf, int index, int *len, int limit);
 u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui,
  u8 oui_len, u8 *ie, uint *ielen);
-int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset,
- u8 eid, u8 *oui, u8 oui_len);
 
 void rtw_set_supported_rate(u8 *SupportedRates, uint mode);
 
-- 
2.7.3



[PATCH 08/41] staging: r8188eu: remove rtw_set_ie_mesh_ch_switch_parm function

2016-08-24 Thread Ivan Safonov
Driver does not use this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 13 -
 drivers/staging/rtl8188eu/include/ieee80211.h  |  2 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 13080d1..25226b2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -166,19 +166,6 @@ inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 
ch_switch_mode,
return rtw_set_ie(buf, WLAN_EID_CHANNEL_SWITCH,  3, ie_data, buf_len);
 }
 
-inline u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,
-   u8 flags, u16 reason, u16 precedence)
-{
-   u8 ie_data[6];
-
-   ie_data[0] = ttl;
-   ie_data[1] = flags;
-   *(u16 *)(ie_data + 2) = cpu_to_le16(reason);
-   *(u16 *)(ie_data + 4) = cpu_to_le16(precedence);
-
-   return rtw_set_ie(buf, 0x118,  6, ie_data, buf_len);
-}
-
 /*
 index: the information element id index, limit is the limit for search
 -*/
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index d957caa..cd0f9b3 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1098,8 +1098,6 @@ enum secondary_ch_offset {
 };
 u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
 u8 new_ch, u8 ch_switch_cnt);
-u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl,
-  u8 flags, u16 reason, u16 precedence);
 
 u8 *rtw_get_ie(u8 *pbuf, int index, int *len, int limit);
 
-- 
2.7.3



[PATCH 41/41] staging: r8188eu: remove some structures definitions from rtw_ioctl.h

2016-08-24 Thread Ivan Safonov
oid_funs_node and oid_obj_priv structures are not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtw_ioctl.h | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_ioctl.h 
b/drivers/staging/rtl8188eu/include/rtw_ioctl.h
index 3a652df..a6b1c85 100644
--- a/drivers/staging/rtl8188eu/include/rtw_ioctl.h
+++ b/drivers/staging/rtl8188eu/include/rtw_ioctl.h
@@ -69,15 +69,6 @@ enum oid_type {
SET_OID
 };
 
-struct oid_funs_node {
-   unsigned int oid_start; /* the starting number for OID */
-   unsigned int oid_end; /* the ending number for OID */
-   struct oid_obj_priv *node_array;
-   unsigned int array_sz; /* the size of node_array */
-   int query_counter; /* count the number of query hits for this segment */
-   int set_counter; /* count the number of set hits for this segment */
-};
-
 struct oid_par_priv {
void*adapter_context;
NDIS_OIDoid;
@@ -89,12 +80,6 @@ struct oid_par_priv {
u32 dbg;
 };
 
-struct oid_obj_priv {
-   unsigned char   dbg; /*  0: without OID debug message
- *  1: with OID debug message */
-   int (*oidfuns)(struct oid_par_priv *poid_par_priv);
-};
-
 #if defined(_RTW_MP_IOCTL_C_)
 static int oid_null_function(struct oid_par_priv *poid_par_priv) {
return NDIS_STATUS_SUCCESS;
-- 
2.7.3



[PATCH 31/41] staging: r8188eu: remove some structure definitions from Hal8188EPhyCfg.h

2016-08-24 Thread Ivan Safonov
ant_sel_ofdm and ant_sel_cck structures are not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h 
b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
index 8990748..0976a76 100644
--- a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
+++ b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
@@ -158,24 +158,6 @@ struct bb_reg_def {
 * Path A and B */
 };
 
-struct ant_sel_ofdm {
-   u32 r_tx_antenna:4;
-   u32 r_ant_l:4;
-   u32 r_ant_non_ht:4;
-   u32 r_ant_ht1:4;
-   u32 r_ant_ht2:4;
-   u32 r_ant_ht_s1:4;
-   u32 r_ant_non_ht_s1:4;
-   u32 OFDM_TXSC:2;
-   u32 reserved:2;
-};
-
-struct ant_sel_cck {
-   u8 r_cckrx_enable_2:2;
-   u8 r_cckrx_enable:2;
-   u8 r_ccktx_enable:4;
-};
-
 /*--Define structure*/
 
 
-- 
2.7.3



[PATCH] mtd: nand: Allow MTD_NAND_OMAP2 to be usable on Keystone devices

2016-08-24 Thread Roger Quadros
Some Keystone devices (e.g. K2G) include a OMAP NAND IP.
Allow the NAND driver to be usable for both
Keystone and OMAP devices.

Signed-off-by: Roger Quadros 
---
 drivers/mtd/nand/Kconfig | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 21ff580..e6260df 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -88,11 +88,11 @@ config MTD_NAND_AMS_DELTA
  Support for NAND flash on Amstrad E3 (Delta).
 
 config MTD_NAND_OMAP2
-   tristate "NAND Flash device on OMAP2, OMAP3 and OMAP4"
-   depends on ARCH_OMAP2PLUS
+   tristate "NAND Flash device on OMAP2, OMAP3, OMAP4 and Keystone"
+   depends on (ARCH_OMAP2PLUS || ARCH_KEYSTONE)
help
-  Support for NAND flash on Texas Instruments OMAP2, OMAP3 and OMAP4
- platforms.
+  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
+ and Keystone platforms.
 
 config MTD_NAND_OMAP_BCH
depends on MTD_NAND_OMAP2
-- 
2.7.4



[PATCH 32/41] staging: r8188eu: remove include/HalHWImg8188E_FW.h

2016-08-24 Thread Ivan Safonov
This file does not included to other sources.

Signed-off-by: Ivan Safonov 
---
 .../staging/rtl8188eu/include/HalHWImg8188E_FW.h   | 29 --
 1 file changed, 29 deletions(-)
 delete mode 100644 drivers/staging/rtl8188eu/include/HalHWImg8188E_FW.h

diff --git a/drivers/staging/rtl8188eu/include/HalHWImg8188E_FW.h 
b/drivers/staging/rtl8188eu/include/HalHWImg8188E_FW.h
deleted file mode 100644
index dbb5524..000
--- a/drivers/staging/rtl8188eu/include/HalHWImg8188E_FW.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of version 2 of the GNU General Public License as
-* published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-* more details.
-*
-**/
-
-#ifndef __INC_FW_8188E_HW_IMG_H
-#define __INC_FW_8188E_HW_IMG_H
-
-
-/**
-*   FW_AP.TXT
-**/
-/**
-*   FW_WoWLAN.TXT
-**/
-#define ArrayLength_8188E_FW_WoWLAN 15764
-extern const u8 Array_8188E_FW_WoWLAN[ArrayLength_8188E_FW_WoWLAN];
-
-#endif
-- 
2.7.3



[PATCH v2 4/8] hisi_sas: add prep_abort_v2_hw()

2016-08-24 Thread John Garry
Add function to prepare the an internal abort
for v2 hw.

Signed-off-by: John Garry 
---
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c 
b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index f965604..fec1675 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -174,6 +174,10 @@
 /* HW dma structures */
 /* Delivery queue header */
 /* dw0 */
+#define CMD_HDR_ABORT_FLAG_OFF 0
+#define CMD_HDR_ABORT_FLAG_MSK (0x3 << CMD_HDR_ABORT_FLAG_OFF)
+#define CMD_HDR_ABORT_DEVICE_TYPE_OFF  2
+#define CMD_HDR_ABORT_DEVICE_TYPE_MSK  (0x1 << CMD_HDR_ABORT_DEVICE_TYPE_OFF)
 #define CMD_HDR_RESP_REPORT_OFF5
 #define CMD_HDR_RESP_REPORT_MSK(0x1 << CMD_HDR_RESP_REPORT_OFF)
 #define CMD_HDR_TLR_CTRL_OFF   6
@@ -214,6 +218,8 @@
 #define CMD_HDR_DIF_SGL_LEN_MSK(0x << 
CMD_HDR_DIF_SGL_LEN_OFF)
 #define CMD_HDR_DATA_SGL_LEN_OFF   16
 #define CMD_HDR_DATA_SGL_LEN_MSK   (0x << CMD_HDR_DATA_SGL_LEN_OFF)
+#define CMD_HDR_ABORT_IPTT_OFF 16
+#define CMD_HDR_ABORT_IPTT_MSK (0x << CMD_HDR_ABORT_IPTT_OFF)
 
 /* Completion header */
 /* dw0 */
@@ -1775,6 +1781,32 @@ static int prep_ata_v2_hw(struct hisi_hba *hisi_hba,
return 0;
 }
 
+static int prep_abort_v2_hw(struct hisi_hba *hisi_hba,
+   struct hisi_sas_slot *slot,
+   int device_id, int abort_flag, int tag_to_abort)
+{
+   struct sas_task *task = slot->task;
+   struct domain_device *dev = task->dev;
+   struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
+   struct hisi_sas_port *port = slot->port;
+
+   /* dw0 */
+   hdr->dw0 = cpu_to_le32((5 << CMD_HDR_CMD_OFF) | /*abort*/
+  (port->id << CMD_HDR_PORT_OFF) |
+  ((dev_is_sata(dev) ? 1:0) <<
+   CMD_HDR_ABORT_DEVICE_TYPE_OFF) |
+  (abort_flag << CMD_HDR_ABORT_FLAG_OFF));
+
+   /* dw1 */
+   hdr->dw1 = cpu_to_le32(device_id << CMD_HDR_DEV_ID_OFF);
+
+   /* dw7 */
+   hdr->dw7 = cpu_to_le32(tag_to_abort << CMD_HDR_ABORT_IPTT_OFF);
+   hdr->transfer_tags = cpu_to_le32(slot->idx);
+
+   return 0;
+}
+
 static int phy_up_v2_hw(int phy_no, struct hisi_hba *hisi_hba)
 {
int i, res = 0;
@@ -2239,6 +2271,7 @@ static const struct hisi_sas_hw hisi_sas_v2_hw = {
.prep_smp = prep_smp_v2_hw,
.prep_ssp = prep_ssp_v2_hw,
.prep_stp = prep_ata_v2_hw,
+   .prep_abort = prep_abort_v2_hw,
.get_free_slot = get_free_slot_v2_hw,
.start_delivery = start_delivery_v2_hw,
.slot_complete = slot_complete_v2_hw,
-- 
1.9.1



  1   2   3   4   5   6   7   8   9   10   >