Re: [PATCH v3] ARM: DTS: imx53: Add support for imx53 HSC/DDC boards from K+P
On Tue, Jun 12, 2018 at 03:32:08PM +0200, Lukasz Majewski wrote: > This commit provides support for HSC and DDC boards from > Kieback&Peter GmbH vendor. > > Signed-off-by: Lukasz Majewski > Reviewed-by: Fabio Estevam "ARM: dts: ..." for prefix. I fixed it up and applied the patch. Shawn
Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to allocate agent number (fwd)
On Sun, 17 Jun 2018, jackm wrote: > On Sat, 16 Jun 2018 18:04:41 +0200 (CEST) > Julia Lawall wrote: > > > ib_mad_client_id is declared as u32, so it will not be < 0 (line 382). > > > > julia > > > Julia, your are correct. > However, I was under the impression that this patch set was abandoned > in favor of the one submitted by Matthew Wilcox! (Convert IB/mad to use > an IDR for agent IDs) No idea. I just get the kbuild reports, and this was one that I didn't get to in a timely manner. So it's probably fine to ignore it. julia > > Hans, Matthew? > > -Jack > > -- Forwarded message -- > > Date: Fri, 8 Jun 2018 08:49:57 +0800 > > From: kbuild test robot > > To: kbu...@01.org > > Cc: Julia Lawall > > Subject: Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to > > allocate agent number > > > > Hi Hans, > > > > Thank you for the patch! Perhaps something to improve: > > > > [auto build test WARNING on linus/master] > > [also build test WARNING on v4.17] > > [if your patch is applied to the wrong git tree, please drop us a > > note to help improve the system] > > > > url: > > https://github.com/0day-ci/linux/commits/Hans-Westgaard-Ry/IB-mad-Use-ID-allocator-routines-to-allocate-agent-number/20180608-022348 > > :: > > branch date: 6 hours ago :: commit date: 6 hours ago > > > > >> drivers/infiniband/core/mad.c:382:5-21: WARNING: Unsigned > > >> expression compared with zero: ib_mad_client_id < 0 > > > > # > > https://github.com/0day-ci/linux/commit/74b1ba09003c9d132878734bf44f32a62bad31db > > git remote add linux-review https://github.com/0day-ci/linux git > > remote update linux-review git checkout > > 74b1ba09003c9d132878734bf44f32a62bad31db vim +382 > > drivers/infiniband/core/mad.c > > > > 2527e681 Sean Hefty2006-07-20 190 > > ^1da177e Linus Torvalds2005-04-16 191 /* > > ^1da177e Linus Torvalds2005-04-16 192 * ib_register_mad_agent > > - Register to send/receive MADs ^1da177e Linus Torvalds > > 2005-04-16 193 */ ^1da177e Linus Torvalds2005-04-16 194 > > struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, > > ^1da177e Linus Torvalds2005-04-16 195 > >u8 port_num, ^1da177e > > Linus Torvalds2005-04-16 196 > >enum ib_qp_type qp_type, > > ^1da177e Linus Torvalds2005-04-16 197 > >struct ib_mad_reg_req > > *mad_reg_req, ^1da177e Linus Torvalds2005-04-16 198 > >u8 rmpp_version, ^1da177e > > Linus Torvalds2005-04-16 199 > >ib_mad_send_handler > > send_handler, ^1da177e Linus Torvalds2005-04-16 200 > >ib_mad_recv_handler > > recv_handler, 0f29b46d Ira Weiny 2014-08-08 201 > >void *context, 0f29b46d > > Ira Weiny 2014-08-08 202 > >u32 registration_flags) > > ^1da177e Linus Torvalds2005-04-16 203 { ^1da177e Linus > > Torvalds2005-04-16 204 struct ib_mad_port_private > > *port_priv; ^1da177e Linus Torvalds2005-04-16 205 > > struct ib_mad_agent *ret = ERR_PTR(-EINVAL); ^1da177e Linus > > Torvalds2005-04-16 206 struct ib_mad_agent_private > > *mad_agent_priv; ^1da177e Linus Torvalds2005-04-16 207 > > struct ib_mad_reg_req *reg_req = NULL; ^1da177e Linus Torvalds > > 2005-04-16 208 struct ib_mad_mgmt_class_table *class; > > ^1da177e Linus Torvalds2005-04-16 209 struct > > ib_mad_mgmt_vendor_class_table *vendor; ^1da177e Linus Torvalds > > 2005-04-16 210 struct ib_mad_mgmt_vendor_class > > *vendor_class; ^1da177e Linus Torvalds2005-04-16 211 > > struct ib_mad_mgmt_method_table *method; ^1da177e Linus Torvalds > > 2005-04-16 212 int ret2, qpn; ^1da177e Linus Torvalds > > 2005-04-16 213 unsigned long flags; ^1da177e Linus > > Torvalds2005-04-16 214 u8 mgmt_class, vclass; 74b1ba09 > > Hans Westgaard Ry 2018-06-07 215 u32 ib_mad_client_id; > > ^1da177e Linus Torvalds2005-04-16 216 /* Validate > > parameters */ ^1da177e Linus Torvalds2005-04-16 217qpn > > = get_spl_qp_index(qp_type); 9ad13a42 Ira Weiny 2014-08-08 > > 218 if (qpn == -1) { 9ad13a42 Ira Weiny 2014-08-08 > > 219 dev_notice(&device->dev, 9ad13a42 Ira > > Weiny 2014-08-08 220 > > "ib_register_mad_agent: invalid QP Type %d\n", 9ad13a42 Ira > > Weiny 2014-08-08 221 qp_type); > > ^1da177e Linus Torvalds2005-04-16 222 goto > > error1; 9ad13a42 Ira Weiny 2014-08-08 223 } > > ^1da177e Linus Torvalds2005-04-16 224 9ad13a42 Ira Weiny > > 2014-08-08 225 if (rmpp_version && rmpp_version != > > IB_MGMT_RMPP_VERSION) { 9ad13a42 Ira Weiny 2014-08-08 226 > > dev_notice(
Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to allocate agent number (fwd)
On Sat, 16 Jun 2018 18:04:41 +0200 (CEST) Julia Lawall wrote: > ib_mad_client_id is declared as u32, so it will not be < 0 (line 382). > > julia > Julia, your are correct. However, I was under the impression that this patch set was abandoned in favor of the one submitted by Matthew Wilcox! (Convert IB/mad to use an IDR for agent IDs) Hans, Matthew? -Jack > -- Forwarded message -- > Date: Fri, 8 Jun 2018 08:49:57 +0800 > From: kbuild test robot > To: kbu...@01.org > Cc: Julia Lawall > Subject: Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to > allocate agent number > > Hi Hans, > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on linus/master] > [also build test WARNING on v4.17] > [if your patch is applied to the wrong git tree, please drop us a > note to help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Hans-Westgaard-Ry/IB-mad-Use-ID-allocator-routines-to-allocate-agent-number/20180608-022348 > :: > branch date: 6 hours ago :: commit date: 6 hours ago > > >> drivers/infiniband/core/mad.c:382:5-21: WARNING: Unsigned > >> expression compared with zero: ib_mad_client_id < 0 > > # > https://github.com/0day-ci/linux/commit/74b1ba09003c9d132878734bf44f32a62bad31db > git remote add linux-review https://github.com/0day-ci/linux git > remote update linux-review git checkout > 74b1ba09003c9d132878734bf44f32a62bad31db vim +382 > drivers/infiniband/core/mad.c > > 2527e681 Sean Hefty2006-07-20 190 > ^1da177e Linus Torvalds2005-04-16 191 /* > ^1da177e Linus Torvalds2005-04-16 192 * ib_register_mad_agent > - Register to send/receive MADs ^1da177e Linus Torvalds > 2005-04-16 193 */ ^1da177e Linus Torvalds2005-04-16 194 > struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, > ^1da177e Linus Torvalds2005-04-16 195 > u8 port_num, ^1da177e > Linus Torvalds2005-04-16 196 > enum ib_qp_type qp_type, > ^1da177e Linus Torvalds2005-04-16 197 > struct ib_mad_reg_req > *mad_reg_req, ^1da177e Linus Torvalds2005-04-16 198 > u8 rmpp_version, ^1da177e > Linus Torvalds2005-04-16 199 > ib_mad_send_handler > send_handler, ^1da177e Linus Torvalds2005-04-16 200 > ib_mad_recv_handler > recv_handler, 0f29b46d Ira Weiny 2014-08-08 201 > void *context, 0f29b46d > Ira Weiny 2014-08-08 202 > u32 registration_flags) > ^1da177e Linus Torvalds2005-04-16 203 { ^1da177e Linus > Torvalds2005-04-16 204 struct ib_mad_port_private > *port_priv; ^1da177e Linus Torvalds2005-04-16 205 > struct ib_mad_agent *ret = ERR_PTR(-EINVAL); ^1da177e Linus > Torvalds2005-04-16 206 struct ib_mad_agent_private > *mad_agent_priv; ^1da177e Linus Torvalds2005-04-16 207 > struct ib_mad_reg_req *reg_req = NULL; ^1da177e Linus Torvalds > 2005-04-16 208 struct ib_mad_mgmt_class_table *class; > ^1da177e Linus Torvalds2005-04-16 209struct > ib_mad_mgmt_vendor_class_table *vendor; ^1da177e Linus Torvalds > 2005-04-16 210 struct ib_mad_mgmt_vendor_class > *vendor_class; ^1da177e Linus Torvalds2005-04-16 211 > struct ib_mad_mgmt_method_table *method; ^1da177e Linus Torvalds > 2005-04-16 212 int ret2, qpn; ^1da177e Linus Torvalds > 2005-04-16 213 unsigned long flags; ^1da177e Linus > Torvalds2005-04-16 214 u8 mgmt_class, vclass; 74b1ba09 > Hans Westgaard Ry 2018-06-07 215 u32 ib_mad_client_id; > ^1da177e Linus Torvalds2005-04-16 216/* Validate > parameters */ ^1da177e Linus Torvalds2005-04-16 217 qpn > = get_spl_qp_index(qp_type); 9ad13a42 Ira Weiny 2014-08-08 > 218 if (qpn == -1) { 9ad13a42 Ira Weiny 2014-08-08 > 219 dev_notice(&device->dev, 9ad13a42 Ira > Weiny 2014-08-08 220 > "ib_register_mad_agent: invalid QP Type %d\n", 9ad13a42 Ira > Weiny 2014-08-08 221qp_type); > ^1da177e Linus Torvalds2005-04-16 222goto > error1; 9ad13a42 Ira Weiny 2014-08-08 223} > ^1da177e Linus Torvalds2005-04-16 224 9ad13a42 Ira Weiny > 2014-08-08 225 if (rmpp_version && rmpp_version != > IB_MGMT_RMPP_VERSION) { 9ad13a42 Ira Weiny 2014-08-08 226 > dev_notice(&device->dev, 9ad13a42 Ira Weiny > 2014-08-08 227 "ib_register_mad_agent: > invalid RMPP Version %u\n", 9ad13a42 Ira Weiny 2014-08-08 > 228 rmpp_version); fa619a77 Hal > Rosenstock2005-07-27 229 goto error1; 9ad13a42 > Ira Weiny 2014-08-08 230 } ^1da177e Linus > Torvalds2005-04-16 231 ^1da177e
Re: [PATCH v2] proc: Simplify and fix proc by removing the kernel mount
Hi Eric, Thanks a lot for looking into this problem. On Sat, Jun 16, 2018 at 7:55 PM Eric W. Biederman wrote: > > > Today there are three users of proc_mnt. > - The legacy sysctl system call implementation. > - The uml mconsole driver. > - The process cleanup function proc_flush_task. > > The first two are slow path and essentially unused. I expect soon we > will be able to remove the legacy sysctl system call entirely. To > keep them working for now a new wrapper file_open_proc_is added to > mount and unmount proc around file_open_root. Which nicely removes > the need for a always mounted proc instance for these cases. > > Handling proc_flush_task which is regularly used requires a little more > work. First I optimize proc_flush_task to do nothing where there is > evidence that there are no entries in proc, by looking at pid->count. > Then I carefully update proc_fill_super and proc_kill_sb to maintain a > ns->proc_super pointer to the super block for proc. This allows > proc_flush_task to find the appropriate instance of proc via rcu. > > Once the appropriate instance of proc is found in proc_flush_task > atomic_inc_not_zero is used to increase the s_active count ensuring > proc_kill_sb will not be called, until the superblock is deactivated. > This makes it safe to inspect the instance of proc and invalidate any > dentries that mention the exiting task. > > The two extra atomics operations in exit are not my favorite but given > that exit is already almost completely serialized with the task lock I > do not expect this change will be measurable. > > The benefit for all of this change is that one of the most error prone > and tricky parts of the pid namespace implementation, maintaining > kernel mounts of proc is removed. > > In addition removing the unnecessary complexity of the kernel mount > fixes a regression that caused the proc mount options to be ignored. > Now that the initial mount of proc comes from userspace, those mount > options are again honored. This fixes Android's usage of the proc > hidepid option. > > Reported-by: Alistair Strachan > Cc: sta...@vger.kernel.org > Fixes: e94591d0d90c ("proc: Convert proc_mount to use mount_ns.") > Signed-off-by: "Eric W. Biederman" > --- > > Alistair if you can test and confirm this fixes your issue I will add > your tested by and send the fix to Linus. I tested v2 with both UML and qemu-system-x86_64 / ARCH=x86_64 against 4.18-rc1, 4.14 and 4.9 and I couldn't break it. The hidepid problem is resolved, and the mount flags can now only be specified on the first userspace mount for that pid namespace. Tested-by: Alistair Strachan > Since my earlier posting I have spot tested this. Fixed a few bugs that > showed up and verified my changes work. So I think this is ready to go > unless someone looks at this and in testing or code review spots a bug. Agreed! > Eric > > arch/um/drivers/mconsole_kern.c | 4 ++-- > fs/proc/base.c | 36 ++--- > fs/proc/inode.c | 5 - > fs/proc/root.c | 28 ++--- > include/linux/pid_namespace.h | 3 +-- > include/linux/proc_ns.h | 7 ++- > kernel/pid.c| 8 > kernel/pid_namespace.c | 7 --- > kernel/sysctl_binary.c | 5 ++--- > 9 files changed, 51 insertions(+), 52 deletions(-) > > diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c > index d5f9a2d1da1b..36af0e02d56b 100644 > --- a/arch/um/drivers/mconsole_kern.c > +++ b/arch/um/drivers/mconsole_kern.c > @@ -27,6 +27,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -124,7 +125,6 @@ void mconsole_log(struct mc_request *req) > > void mconsole_proc(struct mc_request *req) > { > - struct vfsmount *mnt = task_active_pid_ns(current)->proc_mnt; > char *buf; > int len; > struct file *file; > @@ -135,7 +135,7 @@ void mconsole_proc(struct mc_request *req) > ptr += strlen("proc"); > ptr = skip_spaces(ptr); > > - file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY, 0); > + file = file_open_proc(ptr, O_RDONLY, 0); > if (IS_ERR(file)) { > mconsole_reply(req, "Failed to open file", 1, 0); > printk(KERN_ERR "open /proc/%s: %ld\n", ptr, PTR_ERR(file)); > diff --git a/fs/proc/base.c b/fs/proc/base.c > index 1b2ede6abcdf..cd7b68a64ed1 100644 > --- a/fs/proc/base.c > +++ b/fs/proc/base.c > @@ -3052,7 +3052,7 @@ static const struct inode_operations > proc_tgid_base_inode_operations = { > .permission = proc_pid_permission, > }; > > -static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) > +static void proc_flush_task_root(struct dentry *proc_root, pid_t pid, pid_t > tgid) > { > struct dentry *dentry, *leader, *dir; > char buf[10 + 1]; > @@ -3061,7 +3061,7 @@ static void proc_flush_task_mnt(st
Re: [PATCH] hwtracing: intel_th: Change return type to vm_fault_t
On Wed, May 2, 2018 at 7:32 PM, Souptick Joarder wrote: > On 02-May-2018 7:28 PM, "Alexander Shishkin" > wrote: >> >> On Wed, May 02, 2018 at 11:14:48AM +0530, Souptick Joarder wrote: >> > Any comment for this patch ? >> >> Looks good, I'm queuing this one for the next merge window. >> This patch is not merged in 4.18-rc-1.
[PATCH 05/11] staging: rtl8723bs: Remove empty else-if conditional.
This else-if conditional block does nothing; remove it. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 5d44aee44eb1..6ae646ec3d06 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1751,9 +1751,6 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, else if (band_type == BAND_ON_5G) channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, channel); - else if (band_type == BAND_ON_BOTH) { - /* BAND_ON_BOTH don't care temporarily */ - } if (idx_band == -1 || idx_regulation == -1 || idx_bandwidth == -1 || idx_rate_sctn == -1 || idx_channel == -1) { -- 2.17.1
[PATCH 02/11] staging: rtl8723bs: Rename PHY_GetTxPowerLimit().
Rename camel-case 'PHY_GetTxPowerLimit()' to 'phy_get_tx_pwr_lmt()'. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +++--- drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c| 2 +- drivers/staging/rtl8723bs/include/hal_com_phycfg.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 5f727a7c16fd..4ab624f5ece0 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1612,9 +1612,9 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } -s8 PHY_GetTxPowerLimit(struct adapter *Adapter, u32 RegPwrTblSel, - enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, - u8 RfPath, u8 DataRate, u8 Channel) +s8 phy_get_tx_pwr_lmt(struct adapter *Adapter, u32 RegPwrTblSel, + enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, + u8 RfPath, u8 DataRate, u8 Channel) { s16 band= -1; s16 regulation = -1; diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c index 50428f688859..78a4828ecb65 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c @@ -688,7 +688,7 @@ u8 PHY_GetTxPowerIndex_8723B( txPower = (s8) PHY_GetTxPowerIndexBase(padapter, RFPath, Rate, BandWidth, Channel, &bIn24G); powerDiffByRate = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, ODM_RF_PATH_A, RF_1TX, Rate); - limit = PHY_GetTxPowerLimit( + limit = phy_get_tx_pwr_lmt( padapter, padapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), diff --git a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h index c5184315f82f..f841546584a7 100644 --- a/drivers/staging/rtl8723bs/include/hal_com_phycfg.h +++ b/drivers/staging/rtl8723bs/include/hal_com_phycfg.h @@ -177,7 +177,7 @@ u8 Channel, bool*bIn24G ); -s8 PHY_GetTxPowerLimit (struct adapter *adapter, u32 RegPwrTblSel, +s8 phy_get_tx_pwr_lmt (struct adapter *adapter, u32 RegPwrTblSel, enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, u8 RfPath, u8 DataRate, -- 2.17.1
[PATCH 01/11] staging: rtl8723bs: Clean up whitespace in 'PHY_GetTxPowerLimit()'.
Wrap lines longer than 80 characters where possible, delete double newlines, and fix alignment per the kernel coding style guidelines. Signed-off-by: Quytelda Kahja --- .../staging/rtl8723bs/hal/hal_com_phycfg.c| 110 ++ 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 3922d0308a81..5f727a7c16fd 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1612,46 +1612,45 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } -s8 PHY_GetTxPowerLimit( - struct adapter *Adapter, - u32 RegPwrTblSel, - enum BAND_TYPE Band, - enum CHANNEL_WIDTH Bandwidth, - u8 RfPath, - u8 DataRate, - u8 Channel -) +s8 PHY_GetTxPowerLimit(struct adapter *Adapter, u32 RegPwrTblSel, + enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, + u8 RfPath, u8 DataRate, u8 Channel) { - struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - s16 band = -1, regulation = -1, bandwidth = -1, rateSection = -1, channel = -1; + s16 band= -1; + s16 regulation = -1; + s16 bandwidth = -1; + s16 rateSection = -1; + s16 channel = -1; s8 powerLimit = MAX_POWER_INDEX; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - if ((Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory != 1) || - Adapter->registrypriv.RegEnableTxPowerLimit == 0) + if (((Adapter->registrypriv.RegEnableTxPowerLimit == 2) && +(pHalData->EEPROMRegulatory != 1)) || + (Adapter->registrypriv.RegEnableTxPowerLimit == 0)) return MAX_POWER_INDEX; switch (Adapter->registrypriv.RegPwrTblSel) { case 1: - regulation = TXPWR_LMT_ETSI; - break; + regulation = TXPWR_LMT_ETSI; + break; case 2: - regulation = TXPWR_LMT_MKK; - break; + regulation = TXPWR_LMT_MKK; + break; case 3: - regulation = TXPWR_LMT_FCC; - break; - + regulation = TXPWR_LMT_FCC; + break; case 4: - regulation = TXPWR_LMT_WW; - break; - + regulation = TXPWR_LMT_WW; + break; default: - regulation = (Band == BAND_ON_2_4G) ? pHalData->Regulation2_4G : pHalData->Regulation5G; - break; + regulation = (Band == BAND_ON_2_4G) ? + pHalData->Regulation2_4G : + pHalData->Regulation5G; + break; } - /* DBG_871X("pMgntInfo->RegPwrTblSel %d, final regulation %d\n", Adapter->registrypriv.RegPwrTblSel, regulation); */ - + /* DBG_871X("pMgntInfo->RegPwrTblSel %d, final regulation %d\n", */ + /* Adapter->registrypriv.RegPwrTblSel, regulation); */ if (Band == BAND_ON_2_4G) band = 0; @@ -1730,8 +1729,8 @@ s8 PHY_GetTxPowerLimit( break; } - if (Band == BAND_ON_5G && rateSection == 0) - DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate); + if (Band == BAND_ON_5G && rateSection == 0) +DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate); /* workaround for wrong index combination to obtain tx power limit, */ /* OFDM only exists in BW 20M */ @@ -1745,22 +1744,26 @@ s8 PHY_GetTxPowerLimit( /* workaround for wrong indxe combination to obtain tx power limit, */ /* HT on 80M will reference to HT on 40M */ - if ((rateSection == 2 || rateSection == 3) && Band == BAND_ON_5G && bandwidth == 2) { + if ((rateSection == 2 || rateSection == 3) && + Band == BAND_ON_5G && bandwidth == 2) { bandwidth = 1; } if (Band == BAND_ON_2_4G) - channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_2_4G, Channel); + channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_2_4G, + Channel); else if (Band == BAND_ON_5G) - channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, Channel); + channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, + Channel); else if (Band == BAND_ON_BOTH) { /* BAND_ON_BOTH don't care temporarily */ } if (band == -1 || regulation == -1 || bandwidth == -1 || -rateSection == -1 || channel == -1) { + rateSection == -1 || cha
[PATCH 07/11] staging: rtl8723bs: Move bandwidth index lookup to new function.
Factoring out the conditional lookup of bandwidth index into the power limit table into it's own function simplifies the logic of 'phy_get_tx_pwr_lmt()'. Signed-off-by: Quytelda Kahja --- .../staging/rtl8723bs/hal/hal_com_phycfg.c| 26 --- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 4b5219481b33..6d8a07ac7bb3 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1612,6 +1612,22 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } +static s16 get_bandwidth_idx(const enum CHANNEL_WIDTH bandwidth) +{ + switch (bandwidth) { + case CHANNEL_WIDTH_20: + return 0; + case CHANNEL_WIDTH_40: + return 1; + case CHANNEL_WIDTH_80: + return 2; + case CHANNEL_WIDTH_160: + return 3; + default: + return -1; + } +} + static s16 get_rate_sctn_idx(const u8 rate) { switch (rate) { @@ -1703,15 +1719,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, else if (band_type == BAND_ON_5G) idx_band = 1; - if (bandwidth == CHANNEL_WIDTH_20) - idx_bandwidth = 0; - else if (bandwidth == CHANNEL_WIDTH_40) - idx_bandwidth = 1; - else if (bandwidth == CHANNEL_WIDTH_80) - idx_bandwidth = 2; - else if (bandwidth == CHANNEL_WIDTH_160) - idx_bandwidth = 3; - + idx_bandwidth = get_bandwidth_idx(bandwidth); idx_rate_sctn = get_rate_sctn_idx(data_rate); if (band_type == BAND_ON_5G && idx_rate_sctn == 0) -- 2.17.1
[PATCH 06/11] staging: rtl8723bs: Move rate section index lookup to new function.
The rate section lookup is a large switch statement in the middle of 'phy_get_tx_pwr_lmt()'; refactor this statement into it's own function for increased readability. Signed-off-by: Quytelda Kahja --- .../staging/rtl8723bs/hal/hal_com_phycfg.c| 109 -- 1 file changed, 47 insertions(+), 62 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 6ae646ec3d06..4b5219481b33 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1612,6 +1612,52 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } +static s16 get_rate_sctn_idx(const u8 rate) +{ + switch (rate) { + case MGN_1M: case MGN_2M: case MGN_5_5M: case MGN_11M: + return 0; + case MGN_6M: case MGN_9M: case MGN_12M: case MGN_18M: + case MGN_24M: case MGN_36M: case MGN_48M: case MGN_54M: + return 1; + case MGN_MCS0: case MGN_MCS1: case MGN_MCS2: case MGN_MCS3: + case MGN_MCS4: case MGN_MCS5: case MGN_MCS6: case MGN_MCS7: + return 2; + case MGN_MCS8: case MGN_MCS9: case MGN_MCS10: case MGN_MCS11: + case MGN_MCS12: case MGN_MCS13: case MGN_MCS14: case MGN_MCS15: + return 3; + case MGN_MCS16: case MGN_MCS17: case MGN_MCS18: case MGN_MCS19: + case MGN_MCS20: case MGN_MCS21: case MGN_MCS22: case MGN_MCS23: + return 4; + case MGN_MCS24: case MGN_MCS25: case MGN_MCS26: case MGN_MCS27: + case MGN_MCS28: case MGN_MCS29: case MGN_MCS30: case MGN_MCS31: + return 5; + case MGN_VHT1SS_MCS0: case MGN_VHT1SS_MCS1: case MGN_VHT1SS_MCS2: + case MGN_VHT1SS_MCS3: case MGN_VHT1SS_MCS4: case MGN_VHT1SS_MCS5: + case MGN_VHT1SS_MCS6: case MGN_VHT1SS_MCS7: case MGN_VHT1SS_MCS8: + case MGN_VHT1SS_MCS9: + return 6; + case MGN_VHT2SS_MCS0: case MGN_VHT2SS_MCS1: case MGN_VHT2SS_MCS2: + case MGN_VHT2SS_MCS3: case MGN_VHT2SS_MCS4: case MGN_VHT2SS_MCS5: + case MGN_VHT2SS_MCS6: case MGN_VHT2SS_MCS7: case MGN_VHT2SS_MCS8: + case MGN_VHT2SS_MCS9: + return 7; + case MGN_VHT3SS_MCS0: case MGN_VHT3SS_MCS1: case MGN_VHT3SS_MCS2: + case MGN_VHT3SS_MCS3: case MGN_VHT3SS_MCS4: case MGN_VHT3SS_MCS5: + case MGN_VHT3SS_MCS6: case MGN_VHT3SS_MCS7: case MGN_VHT3SS_MCS8: + case MGN_VHT3SS_MCS9: + return 8; + case MGN_VHT4SS_MCS0: case MGN_VHT4SS_MCS1: case MGN_VHT4SS_MCS2: + case MGN_VHT4SS_MCS3: case MGN_VHT4SS_MCS4: case MGN_VHT4SS_MCS5: + case MGN_VHT4SS_MCS6: case MGN_VHT4SS_MCS7: case MGN_VHT4SS_MCS8: + case MGN_VHT4SS_MCS9: + return 9; + default: + DBG_871X("Wrong rate 0x%x\n", rate); + return -1; + } +} + s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, enum BAND_TYPE band_type, enum CHANNEL_WIDTH bandwidth, u8 rf_path, u8 data_rate, u8 channel) @@ -1666,68 +1712,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, else if (bandwidth == CHANNEL_WIDTH_160) idx_bandwidth = 3; - switch (data_rate) { - case MGN_1M: case MGN_2M: case MGN_5_5M: case MGN_11M: - idx_rate_sctn = 0; - break; - - case MGN_6M: case MGN_9M: case MGN_12M: case MGN_18M: - case MGN_24M: case MGN_36M: case MGN_48M: case MGN_54M: - idx_rate_sctn = 1; - break; - - case MGN_MCS0: case MGN_MCS1: case MGN_MCS2: case MGN_MCS3: - case MGN_MCS4: case MGN_MCS5: case MGN_MCS6: case MGN_MCS7: - idx_rate_sctn = 2; - break; - - case MGN_MCS8: case MGN_MCS9: case MGN_MCS10: case MGN_MCS11: - case MGN_MCS12: case MGN_MCS13: case MGN_MCS14: case MGN_MCS15: - idx_rate_sctn = 3; - break; - - case MGN_MCS16: case MGN_MCS17: case MGN_MCS18: case MGN_MCS19: - case MGN_MCS20: case MGN_MCS21: case MGN_MCS22: case MGN_MCS23: - idx_rate_sctn = 4; - break; - - case MGN_MCS24: case MGN_MCS25: case MGN_MCS26: case MGN_MCS27: - case MGN_MCS28: case MGN_MCS29: case MGN_MCS30: case MGN_MCS31: - idx_rate_sctn = 5; - break; - - case MGN_VHT1SS_MCS0: case MGN_VHT1SS_MCS1: case MGN_VHT1SS_MCS2: - case MGN_VHT1SS_MCS3: case MGN_VHT1SS_MCS4: case MGN_VHT1SS_MCS5: - case MGN_VHT1SS_MCS6: case MGN_VHT1SS_MCS7: case MGN_VHT1SS_MCS8: - case MGN_VHT1SS_MCS9: - idx_rate_sctn = 6; - break; - - case MGN_VHT2SS_MCS0: case MGN_VHT2SS_MCS1: case MGN_VHT2SS_MCS2: - case MGN_VHT2SS_MCS3: case MGN_VHT2SS_MCS4: case MGN_VHT2SS_MCS5: - case MGN_VHT2SS_MCS6: case MGN_VHT2SS_MCS7: case MGN_VHT2SS_MCS8: - case MGN_VHT2SS
[PATCH 04/11] staging: rtl8723bs: Combine if statements with equivalent body.
Two if statements that carry out the same operation can be combined with a logical OR. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 7e27d7ff29fa..5d44aee44eb1 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1734,12 +1734,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, /* workaround for wrong index combination to obtain tx power limit, */ /* OFDM only exists in BW 20M */ - if (idx_rate_sctn == 1) - idx_bandwidth = 0; - - /* workaround for wrong index combination to obtain tx power limit, */ /* CCK table will only be given in BW 20M */ - if (idx_rate_sctn == 0) + if (idx_rate_sctn == 0 || idx_rate_sctn == 1) idx_bandwidth = 0; /* workaround for wrong indxe combination to obtain tx power limit, */ -- 2.17.1
[PATCH 08/11] staging: rtl8723bs: Fix spelling mistake in comment.
Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 6d8a07ac7bb3..dd097df86fa3 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1731,7 +1731,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, if (idx_rate_sctn == 0 || idx_rate_sctn == 1) idx_bandwidth = 0; - /* workaround for wrong indxe combination to obtain tx power limit, */ + /* workaround for wrong index combination to obtain tx power limit, */ /* HT on 80M will reference to HT on 40M */ if ((idx_rate_sctn == 2 || idx_rate_sctn == 3) && band_type == BAND_ON_5G && idx_bandwidth == 2) { -- 2.17.1
[PATCH 11/11] staging: rtl8723bs: Add missing curly braces on else statement.
Fix 'braces {} should be used on all arms of this statement' coding style problem in 'phy_get_tx_pwr_lmt()'. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 0e49f0973c12..0d2c61b67d0e 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1780,8 +1780,9 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, [idx_rate_sctn] [idx_channel] [rf_path]; - } else + } else { DBG_871X("No power limit table of the specified band\n"); + } /* combine 5G VHT & HT rate */ /* 5G 20M and 40M HT and VHT can cross reference */ -- 2.17.1
[PATCH 03/11] staging: rtl8723bs: Fix camel-case names in phy_get_tx_pwr_lmt().
Change camel-case names to snake-case names; to avoid variable name conflicts, rename table index variables to idx_*. Signed-off-by: Quytelda Kahja --- .../staging/rtl8723bs/hal/hal_com_phycfg.c| 200 +- 1 file changed, 105 insertions(+), 95 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 4ab624f5ece0..7e27d7ff29fa 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1612,211 +1612,221 @@ static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) return channelIndex; } -s8 phy_get_tx_pwr_lmt(struct adapter *Adapter, u32 RegPwrTblSel, - enum BAND_TYPE Band, enum CHANNEL_WIDTH Bandwidth, - u8 RfPath, u8 DataRate, u8 Channel) +s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, + enum BAND_TYPE band_type, enum CHANNEL_WIDTH bandwidth, + u8 rf_path, u8 data_rate, u8 channel) { - s16 band= -1; - s16 regulation = -1; - s16 bandwidth = -1; - s16 rateSection = -1; - s16 channel = -1; - s8 powerLimit = MAX_POWER_INDEX; - struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); - - if (((Adapter->registrypriv.RegEnableTxPowerLimit == 2) && -(pHalData->EEPROMRegulatory != 1)) || - (Adapter->registrypriv.RegEnableTxPowerLimit == 0)) + s16 idx_band = -1; + s16 idx_regulation = -1; + s16 idx_bandwidth = -1; + s16 idx_rate_sctn = -1; + s16 idx_channel= -1; + s8 pwr_lmt = MAX_POWER_INDEX; + struct hal_com_data *hal_data = GET_HAL_DATA(adapter); + + if (((adapter->registrypriv.RegEnableTxPowerLimit == 2) && +(hal_data->EEPROMRegulatory != 1)) || + (adapter->registrypriv.RegEnableTxPowerLimit == 0)) return MAX_POWER_INDEX; - switch (Adapter->registrypriv.RegPwrTblSel) { + switch (adapter->registrypriv.RegPwrTblSel) { case 1: - regulation = TXPWR_LMT_ETSI; + idx_regulation = TXPWR_LMT_ETSI; break; case 2: - regulation = TXPWR_LMT_MKK; + idx_regulation = TXPWR_LMT_MKK; break; case 3: - regulation = TXPWR_LMT_FCC; + idx_regulation = TXPWR_LMT_FCC; break; case 4: - regulation = TXPWR_LMT_WW; + idx_regulation = TXPWR_LMT_WW; break; default: - regulation = (Band == BAND_ON_2_4G) ? - pHalData->Regulation2_4G : - pHalData->Regulation5G; + idx_regulation = (band_type == BAND_ON_2_4G) ? + hal_data->Regulation2_4G : + hal_data->Regulation5G; break; } /* DBG_871X("pMgntInfo->RegPwrTblSel %d, final regulation %d\n", */ - /* Adapter->registrypriv.RegPwrTblSel, regulation); */ - - if (Band == BAND_ON_2_4G) - band = 0; - else if (Band == BAND_ON_5G) - band = 1; - - if (Bandwidth == CHANNEL_WIDTH_20) - bandwidth = 0; - else if (Bandwidth == CHANNEL_WIDTH_40) - bandwidth = 1; - else if (Bandwidth == CHANNEL_WIDTH_80) - bandwidth = 2; - else if (Bandwidth == CHANNEL_WIDTH_160) - bandwidth = 3; - - switch (DataRate) { + /* adapter->registrypriv.RegPwrTblSel, idx_regulation); */ + + if (band_type == BAND_ON_2_4G) + idx_band = 0; + else if (band_type == BAND_ON_5G) + idx_band = 1; + + if (bandwidth == CHANNEL_WIDTH_20) + idx_bandwidth = 0; + else if (bandwidth == CHANNEL_WIDTH_40) + idx_bandwidth = 1; + else if (bandwidth == CHANNEL_WIDTH_80) + idx_bandwidth = 2; + else if (bandwidth == CHANNEL_WIDTH_160) + idx_bandwidth = 3; + + switch (data_rate) { case MGN_1M: case MGN_2M: case MGN_5_5M: case MGN_11M: - rateSection = 0; + idx_rate_sctn = 0; break; case MGN_6M: case MGN_9M: case MGN_12M: case MGN_18M: case MGN_24M: case MGN_36M: case MGN_48M: case MGN_54M: - rateSection = 1; + idx_rate_sctn = 1; break; case MGN_MCS0: case MGN_MCS1: case MGN_MCS2: case MGN_MCS3: case MGN_MCS4: case MGN_MCS5: case MGN_MCS6: case MGN_MCS7: - rateSection = 2; + idx_rate_sctn = 2; break; case MGN_MCS8: case MGN_MCS9: case MGN_MCS10: case MGN_MCS11: case MGN_MCS12: case MGN_MCS13: case MGN_MCS14: case MGN_MCS15: - rateSection = 3; + idx_rate_sct
[PATCH 09/11] staging: rtl8723bs: Merge conditionals with similar bodies.
Two conditionals that set 'channel' based on 'band_type' in 'phy_get_tx_pwr_lmt()' can be simplified into one single-line conditional. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index dd097df86fa3..9e6dc238c028 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1738,12 +1738,8 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, idx_bandwidth = 1; } - if (band_type == BAND_ON_2_4G) - channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_2_4G, - channel); - else if (band_type == BAND_ON_5G) - channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, - channel); + if (band_type == BAND_ON_2_4G || band_type == BAND_ON_5G) + channel = phy_GetChannelIndexOfTxPowerLimit(band_type, channel); if (idx_band == -1 || idx_regulation == -1 || idx_bandwidth == -1 || idx_rate_sctn == -1 || idx_channel == -1) { -- 2.17.1
[PATCH 10/11] staging: rtl8723bs: Merge workaround conditionals into single else-if.
The if conditionals used to work around wrong TX power limit indices can be condensed into a single if/else-if statement for more concise expression. Signed-off-by: Quytelda Kahja --- drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c index 9e6dc238c028..0e49f0973c12 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c @@ -1728,15 +1728,12 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel, /* workaround for wrong index combination to obtain tx power limit, */ /* OFDM only exists in BW 20M */ /* CCK table will only be given in BW 20M */ + /* HT on 80M will reference to HT on 40M */ if (idx_rate_sctn == 0 || idx_rate_sctn == 1) idx_bandwidth = 0; - - /* workaround for wrong index combination to obtain tx power limit, */ - /* HT on 80M will reference to HT on 40M */ - if ((idx_rate_sctn == 2 || idx_rate_sctn == 3) && - band_type == BAND_ON_5G && idx_bandwidth == 2) { + else if ((idx_rate_sctn == 2 || idx_rate_sctn == 3) && +(band_type == BAND_ON_5G) && (idx_bandwidth == 2)) idx_bandwidth = 1; - } if (band_type == BAND_ON_2_4G || band_type == BAND_ON_5G) channel = phy_GetChannelIndexOfTxPowerLimit(band_type, channel); -- 2.17.1
v4.18-rc1: Build and qemu test results
Build results: total: 134 pass: 113 fail: 21 Failed builds: arm:allmodconfig c6x:dsk6455_defconfig c6x:evmc6457_defconfig c6x:evmc6678_defconfig h8300:allnoconfig h8300:edosk2674_defconfig h8300:h8300h-sim_defconfig h8300:h8s-sim_defconfig i386:allyesconfig i386:allmodconfig ia64:defconfig ia64:allnoconfig mips:defconfig mips:allnoconfig mips:defconfig nds32:defconfig nds32:allnoconfig s390:allmodconfig sparc32:allmodconfig unicore32:defconfig unicore32:allnoconfig Qemu test results: total: 150 pass: 146 fail: 4 Failed tests: mips:malta_defconfig:nosmp mips:malta_defconfig:smp mips64:malta_defconfig:nosmp mips64:malta_defconfig:smp Build errors as well as the qemu test failures are mostly due to some last minute changes around memblock_virt_alloc_try_nid_raw() and similar functions (also seen in next-20180615, but not in next-20180614). There are also a few other errors which have accumulated during the commit window. Interestingly, almost all build errors started to be seen in -next only _after_ the commit window opened. Go figure. Details are available at http://kerneltests.org/builders/. Guenter
Re: [PATCH] PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
Hi Enric, This issue will happen on the position to use find_devfreq_governor() as following: - devfreq_add_governora() and governor_store() If device driver with module type after loaded want to change the scaling governor, new governor might be not yet loaded. So, devfreq bettero to consider this case in the find_devfreq_governor(). 2018-06-15 19:04 GMT+09:00 Enric Balletbo i Serra : > When the devfreq driver and the governor driver are built as modules, > the call to devfreq_add_device() fails because the governor driver is > not loaded at the time the devfreq driver loads. The devfreq driver has > a build dependency on the governor but also should have a runtime > dependency. We need to make sure that the governor driver is loaded > before the devfreq driver. > > This patch fixes this bug in devfreq_add_device(). First tries to find > the governor, and then, if was not found, it requests the module and > tries again. > > Fixes: 1b5c1be2c88e (PM / devfreq: map devfreq drivers to governor using name) > Signed-off-by: Enric Balletbo i Serra > --- > > drivers/devfreq/devfreq.c | 36 +++- > 1 file changed, 31 insertions(+), 5 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index fe2af6aa88fc..1d917f043e30 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -11,6 +11,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -648,10 +649,35 @@ struct devfreq *devfreq_add_device(struct device *dev, > > governor = find_devfreq_governor(devfreq->governor_name); > if (IS_ERR(governor)) { > - dev_err(dev, "%s: Unable to find governor for the device\n", > - __func__); > - err = PTR_ERR(governor); > - goto err_init; > + list_del(&devfreq->node); > + mutex_unlock(&devfreq_list_lock); > + > + /* > +* If the governor is not found, then request the module and > +* try again. This can happen when both drivers (the governor > +* driver and the driver that calls devfreq_add_device) are > +* built as modules. > +*/ > + if (!strncmp(devfreq->governor_name, > +DEVFREQ_GOV_SIMPLE_ONDEMAND, DEVFREQ_NAME_LEN)) > + err = request_module("governor_%s", "simpleondemand"); > + else > + err = request_module("governor_%s", > +devfreq->governor_name); > + if (err) > + goto err_unregister; > + > + mutex_lock(&devfreq_list_lock); > + list_add(&devfreq->node, &devfreq_list); > + > + governor = find_devfreq_governor(devfreq->governor_name); > + if (IS_ERR(governor)) { > + dev_err(dev, > + "%s: Unable to find governor for the > device\n", > + __func__); > + err = PTR_ERR(governor); > + goto err_init; > + } > } > > devfreq->governor = governor; > @@ -669,7 +695,7 @@ struct devfreq *devfreq_add_device(struct device *dev, > err_init: > list_del(&devfreq->node); > mutex_unlock(&devfreq_list_lock); > - > +err_unregister: > device_unregister(&devfreq->dev); > err_dev: > if (devfreq) > -- > 2.17.1 > -- Best Regards, Chanwoo Choi Samsung Electronics
Re: XArray -next inclusion request
Hi Willy, On Sat, 16 Jun 2018 19:15:22 -0700 Matthew Wilcox wrote: > > Please add > > git://git.infradead.org/users/willy/linux-dax.git xarray > > to linux-next. It is based on -rc1. You will find some conflicts > against Dan's current patches to DAX; these are all resolved correctly > in the xarray-20180615 branch which is based on next-20180615. Added from tomorrow. > In a masterstroke of timing, I'm going to be on a plane to Tokyo on > Monday. If this causes any problems, please just ignore the request > for now and we'll resolve it when I'm available to fix problems. No worries, I will check your other branch and if things are still to difficult, you will get an email and I will just drop it for a few days. Thanks for adding your subsystem tree as a participant of linux-next. As you may know, this is not a judgement of your code. The purpose of linux-next is for integration testing and to lower the impact of conflicts between subsystems in the next merge window. You will need to ensure that the patches/commits in your tree/series have been: * submitted under GPL v2 (or later) and include the Contributor's Signed-off-by, * posted to the relevant mailing list, * reviewed by you (or another maintainer of your subsystem tree), * successfully unit tested, and * destined for the current or next Linux merge window. Basically, this should be just what you would send to Linus (or ask him to fetch). It is allowed to be rebased if you deem it necessary. -- Cheers, Stephen Rothwell s...@canb.auug.org.au pgpSNlPuEOjhc.pgp Description: OpenPGP digital signature
Re: [PATCH] devfreq: rk3399_dmc: Fix duplicated opp table on reload.
Hi Enric, 2018-06-16 0:12 GMT+09:00 Enric Balletbo i Serra : > The opp table is not removed when the driver is unloaded neither when > there is an error within probe, so if the driver is reloaded the opp > core shows the following warning: > > rk3399-dmc-freq dmc: _opp_add: duplicate OPPs detected. Existing: freq: >2, volt: 90, enabled: 1. New: freq: 2, >volt: 90, enabled: 1 > rk3399-dmc-freq dmc: _opp_add: duplicate OPPs detected. Existing: freq: >4, volt: 90, enabled: 1. New: freq: 4, >volt: 90, enabled: 1 > rk3399-dmc-freq dmc: _opp_add: duplicate OPPs detected. Existing: freq: >66600, volt: 90, enabled: 1. New: freq: 66600, >volt: 90, enabled: 1 > rk3399-dmc-freq dmc: _opp_add: duplicate OPPs detected. Existing: freq: >8, volt: 90, enabled: 1. New: freq: 8, >volt: 90, enabled: 1 > rk3399-dmc-freq dmc: _opp_add: duplicate OPPs detected. Existing: freq: >92800, volt: 90, enabled: 1. New: freq: 92800, >volt: 90, enabled: 1 > > This patch fixes the error path in the probe function and adds a .remove > function to properly cleanup the opp table on unloading. > > Fixes: 5a893e31a636c (PM / devfreq: rockchip: add devfreq driver for rk3399 > dmc) > Signed-off-by: Enric Balletbo i Serra > --- > > drivers/devfreq/rk3399_dmc.c | 31 +++ > 1 file changed, 27 insertions(+), 4 deletions(-) > > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > index d5c03e5abe13..e795ad2b3f6b 100644 > --- a/drivers/devfreq/rk3399_dmc.c > +++ b/drivers/devfreq/rk3399_dmc.c > @@ -375,8 +375,10 @@ static int rk3399_dmcfreq_probe(struct platform_device > *pdev) > data->rate = clk_get_rate(data->dmc_clk); > > opp = devfreq_recommended_opp(dev, &data->rate, 0); > - if (IS_ERR(opp)) > - return PTR_ERR(opp); > + if (IS_ERR(opp)) { > + ret = PTR_ERR(opp); > + goto err_free_opp; > + } > > data->rate = dev_pm_opp_get_freq(opp); > data->volt = dev_pm_opp_get_voltage(opp); > @@ -388,13 +390,33 @@ static int rk3399_dmcfreq_probe(struct platform_device > *pdev) >&rk3399_devfreq_dmc_profile, >DEVFREQ_GOV_SIMPLE_ONDEMAND, >&data->ondemand_data); > - if (IS_ERR(data->devfreq)) > - return PTR_ERR(data->devfreq); > + if (IS_ERR(data->devfreq)) { > + ret = PTR_ERR(data->devfreq); > + goto err_free_opp; > + } > + > devm_devfreq_register_opp_notifier(dev, data->devfreq); > > data->dev = dev; > platform_set_drvdata(pdev, data); > > + return 0; It looks strange. Because rk3399_dmcfreq_probe() already include 'return 0' when success. What is the base commit of this patch? [snip] Anyway, if probe fail, device driver have to remove registered OPP table. Looks good to me. Reviewed-by: Chanwoo Choi -- Best Regards, Chanwoo Choi Samsung Electronics
[PATCH v2] proc: Simplify and fix proc by removing the kernel mount
Today there are three users of proc_mnt. - The legacy sysctl system call implementation. - The uml mconsole driver. - The process cleanup function proc_flush_task. The first two are slow path and essentially unused. I expect soon we will be able to remove the legacy sysctl system call entirely. To keep them working for now a new wrapper file_open_proc_is added to mount and unmount proc around file_open_root. Which nicely removes the need for a always mounted proc instance for these cases. Handling proc_flush_task which is regularly used requires a little more work. First I optimize proc_flush_task to do nothing where there is evidence that there are no entries in proc, by looking at pid->count. Then I carefully update proc_fill_super and proc_kill_sb to maintain a ns->proc_super pointer to the super block for proc. This allows proc_flush_task to find the appropriate instance of proc via rcu. Once the appropriate instance of proc is found in proc_flush_task atomic_inc_not_zero is used to increase the s_active count ensuring proc_kill_sb will not be called, until the superblock is deactivated. This makes it safe to inspect the instance of proc and invalidate any dentries that mention the exiting task. The two extra atomics operations in exit are not my favorite but given that exit is already almost completely serialized with the task lock I do not expect this change will be measurable. The benefit for all of this change is that one of the most error prone and tricky parts of the pid namespace implementation, maintaining kernel mounts of proc is removed. In addition removing the unnecessary complexity of the kernel mount fixes a regression that caused the proc mount options to be ignored. Now that the initial mount of proc comes from userspace, those mount options are again honored. This fixes Android's usage of the proc hidepid option. Reported-by: Alistair Strachan Cc: sta...@vger.kernel.org Fixes: e94591d0d90c ("proc: Convert proc_mount to use mount_ns.") Signed-off-by: "Eric W. Biederman" --- Alistair if you can test and confirm this fixes your issue I will add your tested by and send the fix to Linus. Since my earlier posting I have spot tested this. Fixed a few bugs that showed up and verified my changes work. So I think this is ready to go unless someone looks at this and in testing or code review spots a bug. Eric arch/um/drivers/mconsole_kern.c | 4 ++-- fs/proc/base.c | 36 ++--- fs/proc/inode.c | 5 - fs/proc/root.c | 28 ++--- include/linux/pid_namespace.h | 3 +-- include/linux/proc_ns.h | 7 ++- kernel/pid.c| 8 kernel/pid_namespace.c | 7 --- kernel/sysctl_binary.c | 5 ++--- 9 files changed, 51 insertions(+), 52 deletions(-) diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index d5f9a2d1da1b..36af0e02d56b 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -124,7 +125,6 @@ void mconsole_log(struct mc_request *req) void mconsole_proc(struct mc_request *req) { - struct vfsmount *mnt = task_active_pid_ns(current)->proc_mnt; char *buf; int len; struct file *file; @@ -135,7 +135,7 @@ void mconsole_proc(struct mc_request *req) ptr += strlen("proc"); ptr = skip_spaces(ptr); - file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY, 0); + file = file_open_proc(ptr, O_RDONLY, 0); if (IS_ERR(file)) { mconsole_reply(req, "Failed to open file", 1, 0); printk(KERN_ERR "open /proc/%s: %ld\n", ptr, PTR_ERR(file)); diff --git a/fs/proc/base.c b/fs/proc/base.c index 1b2ede6abcdf..cd7b68a64ed1 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3052,7 +3052,7 @@ static const struct inode_operations proc_tgid_base_inode_operations = { .permission = proc_pid_permission, }; -static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) +static void proc_flush_task_root(struct dentry *proc_root, pid_t pid, pid_t tgid) { struct dentry *dentry, *leader, *dir; char buf[10 + 1]; @@ -3061,7 +3061,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) name.name = buf; name.len = snprintf(buf, sizeof(buf), "%u", pid); /* no ->d_hash() rejects on procfs */ - dentry = d_hash_and_lookup(mnt->mnt_root, &name); + dentry = d_hash_and_lookup(proc_root, &name); if (dentry) { d_invalidate(dentry); dput(dentry); @@ -3072,7 +3072,7 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid) name.name = buf; name.len = snprintf(buf, sizeof(buf), "%u", tgid); - leader = d_hash_and_lookup(mnt->mn
linux-next: stats (Was: Linux 4.18-rc1)
Hi all, As usual, the executive friendly graph is at http://neuling.org/linux-next-size.html :-) (No merge commits counted, next-20180604 was the first linux-next after the merge window opened.) Commits in v4.18-rc1 (relative to v4.17): 11594 Commits in next-20180604: 10962 Commits with the same SHA1:10324 Commits with the same patch_id: 168 (1) Commits with the same subject line: 38 (1) (1) not counting those in the lines above. So commits in -rc1 that were in next-20180604: 10530 90% Some breakdown of the list of extra commits (relative to next-20180604) in -rc1: Top ten first word of commit summary: 61 f2fs 54 perf 54 net 53 drm 30 xfs 23 ib 22 netfilter 22 kvm 19 rdma 18 treewide Top ten authors: 38 a...@redhat.com 37 yuch...@huawei.com 28 keesc...@chromium.org 26 mchehab+sams...@kernel.org 21 chuck.le...@oracle.com 20 a...@arndb.de 16 rost...@goodmis.org 15 darrick.w...@oracle.com 14 trond.mykleb...@hammerspace.com 14 fred.isa...@gmail.com Top ten commiters: 146 da...@davemloft.net 67 jaeg...@kernel.org 54 a...@redhat.com 47 alexander.deuc...@amd.com 40 trond.mykleb...@hammerspace.com 39 t...@linutronix.de 38 torva...@linux-foundation.org 38 keesc...@chromium.org 34 mchehab+sams...@kernel.org 31 idryo...@gmail.com There are also 432 commits in next-20180604 that didn't make it into v4.18-rc1. Top ten first word of commit summary: 82 rcu 46 ovl 36 mm 24 arm 22 coresight 18 nds32 18 leaking_addresses 12 vfs 12 revert 10 drm Top ten authors: 90 paul...@linux.vnet.ibm.com 39 mszer...@redhat.com 28 vgo...@redhat.com 21 a...@linux-foundation.org 18 m...@tobin.cc 16 dan.j.willi...@intel.com 13 g...@fb.com 12 greent...@andestech.com 11 suzuki.poul...@arm.com 11 o...@lixom.net Some of Andrew's patches are fixes for other patches in his tree (and have been merged into those). Top ten commiters: 104 paul...@linux.vnet.ibm.com 87 s...@canb.auug.org.au 67 mszer...@redhat.com 23 mathieu.poir...@linaro.org 18 m...@tobin.cc 18 greent...@andestech.com 14 maxime.rip...@bootlin.com 11 o...@lixom.net 11 dan.j.willi...@intel.com 7 p.za...@pengutronix.de Those commits by me are from the quilt series (mainly Andrew's mmotm tree). -- Cheers, Stephen Rothwell pgprxp3FO_Tkm.pgp Description: OpenPGP digital signature
XArray -next inclusion request
Hi Stephen, Please add git://git.infradead.org/users/willy/linux-dax.git xarray to linux-next. It is based on -rc1. You will find some conflicts against Dan's current patches to DAX; these are all resolved correctly in the xarray-20180615 branch which is based on next-20180615. In a masterstroke of timing, I'm going to be on a plane to Tokyo on Monday. If this causes any problems, please just ignore the request for now and we'll resolve it when I'm available to fix problems.
[PATCH v14 32/74] page cache: Convert delete_batch to XArray
Rename the function from page_cache_tree_delete_batch to just page_cache_delete_batch. Signed-off-by: Matthew Wilcox --- mm/filemap.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 4204d9df003b..025077bc82be 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -272,7 +272,7 @@ void delete_from_page_cache(struct page *page) EXPORT_SYMBOL(delete_from_page_cache); /* - * page_cache_tree_delete_batch - delete several pages from page cache + * page_cache_delete_batch - delete several pages from page cache * @mapping: the mapping to which pages belong * @pvec: pagevec with pages to delete * @@ -285,23 +285,18 @@ EXPORT_SYMBOL(delete_from_page_cache); * * The function expects the i_pages lock to be held. */ -static void -page_cache_tree_delete_batch(struct address_space *mapping, +static void page_cache_delete_batch(struct address_space *mapping, struct pagevec *pvec) { - struct radix_tree_iter iter; - void **slot; + XA_STATE(xas, &mapping->i_pages, pvec->pages[0]->index); int total_pages = 0; int i = 0, tail_pages = 0; struct page *page; - pgoff_t start; - start = pvec->pages[0]->index; - radix_tree_for_each_slot(slot, &mapping->i_pages, &iter, start) { + mapping_set_update(&xas, mapping); + xas_for_each(&xas, page, ULONG_MAX) { if (i >= pagevec_count(pvec) && !tail_pages) break; - page = radix_tree_deref_slot_protected(slot, - &mapping->i_pages.xa_lock); if (xa_is_value(page)) continue; if (!tail_pages) { @@ -310,8 +305,11 @@ page_cache_tree_delete_batch(struct address_space *mapping, * have our pages locked so they are protected from * being removed. */ - if (page != pvec->pages[i]) + if (page != pvec->pages[i]) { + VM_BUG_ON_PAGE(page->index > + pvec->pages[i]->index, page); continue; + } WARN_ON_ONCE(!PageLocked(page)); if (PageTransHuge(page) && !PageHuge(page)) tail_pages = HPAGE_PMD_NR - 1; @@ -322,11 +320,11 @@ page_cache_tree_delete_batch(struct address_space *mapping, */ i++; } else { + VM_BUG_ON_PAGE(page->index + HPAGE_PMD_NR - tail_pages + != pvec->pages[i]->index, page); tail_pages--; } - radix_tree_clear_tags(&mapping->i_pages, iter.node, slot); - __radix_tree_replace(&mapping->i_pages, iter.node, slot, NULL, - workingset_lookup_update(mapping)); + xas_store(&xas, NULL); total_pages++; } mapping->nrpages -= total_pages; @@ -347,7 +345,7 @@ void delete_from_page_cache_batch(struct address_space *mapping, unaccount_page_cache_page(mapping, pvec->pages[i]); } - page_cache_tree_delete_batch(mapping, pvec); + page_cache_delete_batch(mapping, pvec); xa_unlock_irqrestore(&mapping->i_pages, flags); for (i = 0; i < pagevec_count(pvec); i++) -- 2.17.1
[PATCH] linux/device.h: fix kernel-doc notation warning
From: Randy Dunlap Fix kernel-doc build warning (missing " *" at beginning of line): ../include/linux/device.h:93: warning: bad line: this bus. Fixes: 07397df29e57c ("dma-mapping: move dma configuration to bus infrastructure") Signed-off-by: Randy Dunlap Cc: Nipun Gupta Cc: Christoph Hellwig --- include/linux/device.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- lnx-418-rc1.orig/include/linux/device.h +++ lnx-418-rc1/include/linux/device.h @@ -90,7 +90,7 @@ extern void bus_remove_file(struct bus_t * @num_vf:Called to find out how many virtual functions a device on this * bus supports. * @dma_configure: Called to setup DMA configuration on a device on - this bus. + * this bus. * @pm:Power management operations of this bus, callback the specific * device driver's pm-ops. * @iommu_ops: IOMMU specific operations for this bus, used to attach IOMMU
[PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*()
From: John Hubbard This fixes a few problems that come up when using devices (NICs, GPUs, for example) that want to have direct access to a chunk of system (CPU) memory, so that they can DMA to/from that memory. Problems [1] come up if that memory is backed by persistence storage; for example, an ext4 file system. I've been working on several customer bugs that are hitting this, and this patchset fixes those bugs. The bugs happen via: 1) get_user_pages() on some ext4-backed pages 2) device does DMA for a while to/from those pages a) Somewhere in here, some of the pages get disconnected from the file system, via try_to_unmap() and eventually drop_buffers() 3) device is all done, device driver calls set_page_dirty_lock(), then put_page() And then at some point, we see a this BUG(): kernel BUG at /build/linux-fQ94TU/linux-4.4.0/fs/ext4/inode.c:1899! backtrace: ext4_writepage __writepage write_cache_pages ext4_writepages do_writepages __writeback_single_inode writeback_sb_inodes __writeback_inodes_wb wb_writeback wb_workfn process_one_work worker_thread kthread ret_from_fork ...which is due to the file system asserting that there are still buffer heads attached: ({ \ BUG_ON(!PagePrivate(page)); \ ((struct buffer_head *)page_private(page)); \ }) How to fix this: Introduce a new page flag: PG_dma_pinned, and set this flag on all pages that are returned by the get_user_pages*() family of functions. Leave it set nearly forever: until the page is freed. Then, check this flag before attempting to unmap pages. This will cause a very early return from try_to_unmap_one(), and will avoid doing things such as, notably, removing page buffers via drop_buffers(). This uses a new struct page flag, but only on 64-bit systems. Obviously, this is heavy-handed, but given the long, broken history of get_user_pages in combination with file-backed memory, and given the problems with alternative designs, it's a reasonable fix for now: small, simple, and easy to revert if and when a more comprehensive design solution is chosen. Some alternatives, and why they were not taken: 1. It would be better, if possible, to clear PG_dma_pinned, once all get_user_pages callers returned the page (via something more specific than put_page), but that would significantly change the usage for get_user_pages callers. That's too intrusive for such a widely used and old API, so let's leave it alone. Also, such a design would require a new counter that would be associated with each page. There's no room in struct page, so it would require separate tracking, which is not acceptable for general page management. 2. There are other more complicated approaches[2], but these depend on trying to solve very specific call paths that, in the end, are just downstream effects of the root cause. And so these did not actually fix the customer bugs that I was working on. References: [1] https://lwn.net/Articles/753027/ : "The trouble with get_user_pages()" [2] https://marc.info/?l=linux-mm&m=<20180521143830.ga25...@bombadil.infradead.org> (Matthew Wilcox listed two ideas here) Signed-off-by: John Hubbard --- include/linux/page-flags.h | 9 + include/trace/events/mmflags.h | 9 - mm/gup.c | 11 +-- mm/rmap.c | 2 ++ 4 files changed, 28 insertions(+), 3 deletions(-) Signed-off-by: John Hubbard --- include/linux/page-flags.h | 9 + include/trace/events/mmflags.h | 9 - mm/gup.c | 11 +-- mm/page_alloc.c| 1 + mm/rmap.c | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 901943e4754b..ad65a2af069a 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -100,6 +100,9 @@ enum pageflags { #if defined(CONFIG_IDLE_PAGE_TRACKING) && defined(CONFIG_64BIT) PG_young, PG_idle, +#endif +#if defined(CONFIG_64BIT) + PG_dma_pinned, #endif __NR_PAGEFLAGS, @@ -381,6 +384,12 @@ TESTCLEARFLAG(Young, young, PF_ANY) PAGEFLAG(Idle, idle, PF_ANY) #endif +#if defined(CONFIG_64BIT) +PAGEFLAG(DmaPinned, dma_pinned, PF_ANY) +#else +PAGEFLAG_FALSE(DmaPinned) +#endif + /* * On an anonymous page mapped into a user virtual memory area, * page->mapping points to its anon_vma, not to a struct address_space; diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index a81cffb76d89..f62fd150b0d4 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -79,6 +79,12 @@ #define IF_HAVE_PG_IDLE(flag,string) #endif +#if defined(CONFIG_64BIT)
[PATCH 1/2] consolidate get_user_pages error handling
From: John Hubbard In preparation for a subsequent patch, consolidate the error handling for __get_user_pages(). This provides a single location (the "out:" label) for operating on the collected set of pages that are about to be returned. As long as we are already touching every use of the "ret" variable, fix its name: "ret" --> "err". This also gets rid of two shadowed variable declarations, as tiny beneficial a side effect. Signed-off-by: John Hubbard --- mm/gup.c | 37 ++--- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index b70d7ba7cc13..73f0b3316fa7 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -660,6 +660,7 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct **vmas, int *nonblocking) { long i = 0; + int err = 0; unsigned int page_mask; struct vm_area_struct *vma = NULL; @@ -685,18 +686,19 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, if (!vma || start >= vma->vm_end) { vma = find_extend_vma(mm, start); if (!vma && in_gate_area(mm, start)) { - int ret; - ret = get_gate_page(mm, start & PAGE_MASK, + err = get_gate_page(mm, start & PAGE_MASK, gup_flags, &vma, pages ? &pages[i] : NULL); - if (ret) - return i ? : ret; + if (err) + goto out; page_mask = 0; goto next_page; } - if (!vma || check_vma_flags(vma, gup_flags)) - return i ? : -EFAULT; + if (!vma || check_vma_flags(vma, gup_flags)) { + err = -EFAULT; + goto out; + } if (is_vm_hugetlb_page(vma)) { i = follow_hugetlb_page(mm, vma, pages, vmas, &start, &nr_pages, i, @@ -709,23 +711,25 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, * If we have a pending SIGKILL, don't keep faulting pages and * potentially allocating memory. */ - if (unlikely(fatal_signal_pending(current))) - return i ? i : -ERESTARTSYS; + if (unlikely(fatal_signal_pending(current))) { + err = -ERESTARTSYS; + goto out; + } cond_resched(); page = follow_page_mask(vma, start, foll_flags, &page_mask); if (!page) { - int ret; - ret = faultin_page(tsk, vma, start, &foll_flags, + err = faultin_page(tsk, vma, start, &foll_flags, nonblocking); - switch (ret) { + switch (err) { case 0: goto retry; case -EFAULT: case -ENOMEM: case -EHWPOISON: - return i ? i : ret; + goto out; case -EBUSY: - return i; + err = 0; + goto out; case -ENOENT: goto next_page; } @@ -737,7 +741,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, */ goto next_page; } else if (IS_ERR(page)) { - return i ? i : PTR_ERR(page); + err = PTR_ERR(page); + goto out; } if (pages) { pages[i] = page; @@ -757,7 +762,9 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, start += page_increm * PAGE_SIZE; nr_pages -= page_increm; } while (nr_pages); - return i; + +out: + return i ? i : err; } static bool vma_permits_fault(struct vm_area_struct *vma, -- 2.17.1
[PATCH 0/2] mm: gup: don't unmap or drop filesystem buffers
From: John Hubbard Hi, I'm including people who have been talking about this. This is in one sense a medium-term work around, because there is a plan to talk about more extensive fixes at the upcoming Linux Plumbers Conference. I am seeing several customer bugs, though, and I really want to fix those sooner. I've come up with what I claim is a simple, robust fix, but...I'm presuming to burn a struct page flag, and limit it to 64-bit arches, in order to get there. Given that the problem is old (Jason Gunthorpe noted that RDMA has been living with this problem since 2005), I think it's worth it. Leaving the new page flag set "nearly forever" is not great, but on the other hand, once the page is actually freed, the flag does get cleared. It seems like an acceptable tradeoff, given that we only get one bit (and are lucky to even have that). As hinted at in the longer writeup in patch #2, I really don't like the various other approaches in which we try to hook into the (many!) downstream symptoms and try to deduce that we're in this situation. It's more appropriate to say, "these pages shall not be unmapped, nor buffers removed ("do not disturb"), because they have been, well, pinned by the get_user_pages call. I believe that this is what the original intention might have been, and in any case, that's certainly how a lot of device driver writers have interpreted get_user_pages memory over the last decade. John Hubbard (2): consolidate get_user_pages error handling mm: set PG_dma_pinned on get_user_pages*() include/linux/page-flags.h | 9 +++ include/trace/events/mmflags.h | 9 ++- mm/gup.c | 48 ++ mm/page_alloc.c| 1 + mm/rmap.c | 2 ++ 5 files changed, 51 insertions(+), 18 deletions(-) -- 2.17.1
Re: [RFC PATCH 5/5] fsi/scom: Major overhaul
On Sun, 2018-06-17 at 11:17 +1000, Benjamin Herrenschmidt wrote: > > We have everything that cronus needs and more than pdbg needs afaik :-) > > That said, cronus does a bunch of other stupid things that I'm still > trying to figure out how to fix. > > We might need to create a /dev/cfam rather than going through that > magic sysfs "raw" file, and I wouldn't mind using a single IDA so that > all the devices below a given FSI slace (cfam itself, sbefifo, occ, > ...) have the same "number". Also while we're at reworking how all this is exposed to our broken userspace, I wouldn't mind putting all these dev entries under a directory, if I can figure out how to do that (I haven't really looked yet). /dev/fsi/{cfamN,sbefifoN,occN, ...} and possibly similar by-id and by- path that other subsystems use, so we have something more deterministic than the "random number" crap we do now. We can always keep hacks to do symlinks in our kernel tree until we have converted all our userspace users. We currently control the only userspace users of this, so now is a good time to cleanup how we expose things. This won't always be the case. Cheers, Ben.
Re: [RFC PATCH 5/5] fsi/scom: Major overhaul
On Sat, 2018-06-16 at 14:34 +0930, Joel Stanley wrote: > On 12 June 2018 at 14:49, Benjamin Herrenschmidt > wrote: > > This was too hard to split ... this adds a number of features > > to the SCOM user interface: > > > > - Support for indirect SCOMs > > > > - read()/write() interface now handle errors and retries > > > > - New ioctl() "raw" interface for use by debuggers > > > > Signed-off-by: Benjamin Herrenschmidt > > Looks okay to me. I will put it in the openbmc tree with Eddie's ack > for more testing. > > I got a warning from the 0day infra, I made comments below. > > We should get Alistair review the ioctl interface to ensure we have > everything that pdbg might need. We have everything that cronus needs and more than pdbg needs afaik :-) That said, cronus does a bunch of other stupid things that I'm still trying to figure out how to fix. We might need to create a /dev/cfam rather than going through that magic sysfs "raw" file, and I wouldn't mind using a single IDA so that all the devices below a given FSI slace (cfam itself, sbefifo, occ, ...) have the same "number". > > > +++ b/include/uapi/linux/fsi.h > > @@ -0,0 +1,56 @@ > > +#ifndef _UAPI_LINUX_FSI_H > > +#define _UAPI_LINUX_FSI_H > > + > > +#include > > This needs to include for the __u64 etc types. > > We should also put a licence in the header. Probably: > > /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ Yup. Cheers, Ben. > > Cheers, > > Joel > > > + > > +/* > > + * /dev/scom "raw" ioctl interface > > + * > > + * The driver supports a high level "read/write" interface which > > + * handles retries and converts the status to Linux error codes, > > + * however low level tools an debugger need to access the "raw" > > + * HW status information and interpret it themselves, so this > > + * ioctl interface is also provided for their use case. > > + */ > > + > > +/* Structure for SCOM read/write */ > > +struct scom_access { > > + __u64 addr; /* SCOM address, supports indirect */ > > + __u64 data; /* SCOM data (in for write, out for read) */ > > + __u64 mask; /* Data mask for writes */ > > + __u32 intf_errors;/* Interface error flags */ > > +#define SCOM_INTF_ERR_PARITY 0x0001 /* Parity error */ > > +#define SCOM_INTF_ERR_PROTECTION 0x0002 /* Blocked by secure > > boot */ > > +#define SCOM_INTF_ERR_ABORT0x0004 /* PIB reset during > > access */ > > +#define SCOM_INTF_ERR_UNKNOWN 0x8000 /* Unknown error */ > > + /* > > +* Note: Any other bit set in intf_errors need to be considered as > > an > > +* error. Future implementations may define new error conditions. > > The > > +* pib_status below is only valid if intf_errors is 0. > > +*/ > > + __u8pib_status; /* 3-bit PIB status */ > > +#define SCOM_PIB_SUCCESS 0 /* Access successful */ > > +#define SCOM_PIB_BLOCKED 1 /* PIB blocked, pls retry */ > > +#define SCOM_PIB_OFFLINE 2 /* Chiplet offline */ > > +#define SCOM_PIB_PARTIAL 3 /* Partial good */ > > +#define SCOM_PIB_BAD_ADDR 4 /* Invalid address */ > > +#define SCOM_PIB_CLK_ERR 5 /* Clock error */ > > +#define SCOM_PIB_PARITY_ERR6 /* Parity error on the PIB bus */ > > +#define SCOM_PIB_TIMEOUT 7 /* Bus timeout */ > > + __u8pad; > > +}; > > + > > +/* Flags for SCOM check */ > > +#define SCOM_CHECK_SUPPORTED 0x0001 /* Interface supported */ > > +#define SCOM_CHECK_PROTECTED 0x0002 /* Interface blocked by > > secure boot */ > > + > > +/* Flags for SCOM reset */ > > +#define SCOM_RESET_INTF0x0001 /* Reset interface > > */ > > +#define SCOM_RESET_PIB 0x0002 /* Reset PIB */ > > + > > +#define FSI_SCOM_CHECK _IOR('s', 0x00, __u32) > > +#define FSI_SCOM_READ _IOWR('s', 0x01, struct scom_access) > > +#define FSI_SCOM_WRITE _IOWR('s', 0x02, struct scom_access) > > +#define FSI_SCOM_RESET _IOW('s', 0x03, __u32) > > + > > +#endif /* _UAPI_LINUX_FSI_H */ > > -- > > 2.17.0 > >
Re: [PATCH v4 1/9] Makefile: Prepare for using macros for inline asm
2018-06-14 5:36 GMT+09:00 Sam Ravnborg : >> >> > +macros: $(obj)/macros.s >> > + @: >> >> If you add a phony target, it should be added to 'PHONY'. > > Or this part: >> +archmacros: >> + $(Q)$(MAKE) $(build)=arch/x86/kernel macros > > could be modified to specify the exact filename so this indirection is not > needed. Yes, it could work. Actually, two styles co-exist in arch/x86/Makefile. (archprepare vs archscripts) -- Best Regards Masahiro Yamada
Re: [PATCH v4 1/9] Makefile: Prepare for using macros for inline asm
Hi. 2018-06-14 7:19 GMT+09:00 Nadav Amit : >> >> >> I have not fully understood this series yet. >> >> I do not have enough skill in x86 architecture, >> but just some comments from the build system point of view. >> >> >> >> I guess this will probably break the parallel building. >> >> Kbuild can build 'prepare' and 'scripts' simultaneously. >> >> >> I locally modified the following line: >> >> >> diff --git a/Makefile b/Makefile >> index 2dea909440..6ad484a 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -1030,7 +1030,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; >> # Error messages still appears in the original language >> >> PHONY += $(vmlinux-dirs) >> -$(vmlinux-dirs): prepare scripts >> +$(vmlinux-dirs): scripts prepare >>$(Q)$(MAKE) $(build)=$@ need-builtin=1 >> >> define filechk_kernel.release >> >> >> >> masahiro@grover:~/workspace/linux-kbuild$ make defconfig >> HOSTCC scripts/basic/fixdep >> HOSTCC scripts/kconfig/conf.o >> YACCscripts/kconfig/zconf.tab.c >> LEX scripts/kconfig/zconf.lex.c >> HOSTCC scripts/kconfig/zconf.tab.o >> HOSTLD scripts/kconfig/conf >> *** Default configuration is based on 'x86_64_defconfig' >> # >> # configuration written to .config >> # >> masahiro@grover:~/workspace/linux-kbuild$ make all >> scripts/kconfig/conf --syncconfig Kconfig >> WRAParch/x86/include/generated/uapi/asm/bpf_perf_event.h >> WRAParch/x86/include/generated/uapi/asm/poll.h >> WRAParch/x86/include/generated/asm/dma-contiguous.h >> WRAParch/x86/include/generated/asm/early_ioremap.h >> WRAParch/x86/include/generated/asm/mcs_spinlock.h >> WRAParch/x86/include/generated/asm/mm-arch-hooks.h >> CC scripts/mod/empty.o >> Assembler messages: >> Error: can't open arch/x86/kernel/macros.s for reading: No such file >> or directory >> make[2]: *** [scripts/Makefile.build:318: scripts/mod/empty.o] Error 1 >> make[1]: *** [scripts/Makefile.build:558: scripts/mod] Error 2 >> make: *** [Makefile:1050: scripts] Error 2 > > You are right. I tried to filter out the use of the switch (exported as > ASM_MACRO_FLAGS) for empty.o. Any suggestions on how to do it properly? You can do like this: diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 42c5d50..a5b4af4 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -4,6 +4,8 @@ OBJECT_FILES_NON_STANDARD := y hostprogs-y:= modpost mk_elfconfig always := $(hostprogs-y) empty.o +CFLAGS_REMOVE_empty.o := $(ASM_MACRO_FLAGS) + modpost-objs := modpost.o file2alias.o sumversion.o devicetable-offsets-file := devicetable-offsets.h modpost is an exceptional hostprogam - it depends on target compiler, which makes the build order complicated. I want to compile under scripts/ only with $(HOSTCC). I am planning to change modpost target-independent by detecting 32/64 bit, little/big-endianness run-time. Then, empty.c will go away. In the meanwhile, CFLAGS_REMOVE_ will do as a workaround. -- Best Regards Masahiro Yamada
[RFC PATCH] x86/arch_prctl: Add ARCH_SET_XCR0 to mask XCR0 per-thread
From: Keno Fischer The rr (http://rr-project.org/) debugger provides user space record-and-replay functionality by carefully controlling the process environment in order to ensure completely deterministic execution of recorded traces. The recently added ARCH_SET_CPUID arch_prctl allows rr to move traces across (Intel) machines, by allowing cpuid invocations to be reliably recorded and replayed. This works very well, with one catch: It is currently not possible to replay a recording from a machine supporting a smaller set of XCR0 state components on one supporting a larger set. This is because the value of XCR0 is obersevable in userspace (either by explicit xgetbv or by looking at the result of xsave) and since glibc does oberseve this value, replay divergence is almost immediate. I also suspect that people intrested in process (or container) live-migration may eventually care about this if a migration happens in between a userspace xsave and a corresponding xrstor. We encounter this problem quite frequently since most of our users are using pre-Skylake systems (and thus don't support the AVX512 state components), while we recently upgraded our main development machines to Skylake. This patch attempts to provide a way disable XCR0 state components on a per-thread basis, such that rr may use this feature to emulate the recording machine's XCR0 for the replayed process. We do this by providing a new ARCH_SET_XCR0 arch_prctl that takes as its argument the desired XCR0 value. The system call fails if: - XSAVE is not available - The user attempts to enable a state component that would not regularly be enabled by the kernel. - The value of XCR0 is illegal (in the sense that setting it would cause a fault). - Any state component being disabled is not in its initial state. The last restriction is debatable, but it seemed sensible to me, since it means the kernel need not be in the business of trying to maintain the disabled state components when the ordinary xsave/xrestor will no longer save/restore them. The patch does not currently provide a corresponding ARCH_GET_XCR0, since the `xgetbv` instruction fulfills this purpose. However, we may want to provide this for consistency. It may also be useful (and perhaps more useful) to provide a mechanism to obtain the kernel's XCR0 (i.e. the upper bound on which bits are allowed to be set through this interface). On the kernel side, this value is stored as a mask, rather than a value to set. The thought behind this was to be defensive about new state components being added but forgetting to update the validity check in the arch_prctl. However, getting this wrong in either direction is probably bad (e.g. if Intel added an AVX1024 extension that always required AVX512, then this would be the wrong way to be defensive about it), so I'd appreciate some advice on which would be preferred. Please take this patch as an RFC that I hope is sufficient to enable discussion about this feature, rather than a complete patch. In particular, this patch is missing: - Cleanup - A selftest exercising all the corner cases - There's code sharing opportunities with KVM (which has to provide similar functionality for virtual machines modifying XCR0), which I did not take advantage of in this patch to keep the changes local. A full patch would probably involve some refactoring there. There is one remaining TODO in the code, which has to do with the xcomp_bv xsave header. The `xrstors` instructions requires that no bits in this headers field be set that are not active in XCR0. However, this unfortunately means that changing the value of XCR0 can change the layout of the compacted xsave area, which so far the kernel does not do anywhere else (except for some handling in the KVM context). For my use case, it would be sufficient to simply disallow any value of XCR0 with "holes" in it, that would change the layout to anything other than a strict prefix, but I would appreciate hearing any alternative solutions you may have. Please also let me know if I missed a fundamental way in which this causes a problem. I realize that this is a very sensitive part of the kernel code. Since this patch changes XCR0, any xsave/xrestor or any use of XCR0-enabled features in kernel space, not guarded by kernel_fpu_begin() (which I modified for this patch set), would cause a problem. I don't have a sufficiently wide view of the kernel to know if there are any such uses, so please let me know if I missed something. Signed-off-by: Keno Fischer --- arch/x86/include/asm/fpu/xstate.h | 1 + arch/x86/include/asm/processor.h | 2 + arch/x86/include/asm/thread_info.h | 5 +- arch/x86/include/uapi/asm/prctl.h | 2 + arch/x86/kernel/fpu/core.c | 10 ++- arch/x86/kernel/fpu/xstate.c | 3 +- arch/x86/kernel/process.c | 125 - arch/x86/kernel/process_64.c | 16 ++--- 8 files changed, 152 insertions(+), 12 deletions(
Re: [PATCH] extcon: Release locking when sending the notification of connector state
Hi, 2018-06-14 20:33 GMT+09:00 H. Nikolaus Schaller : > >> Am 14.06.2018 um 12:39 schrieb H. Nikolaus Schaller : >> >> Hi Roger and Chanwoo, >> >>> Am 14.06.2018 um 12:18 schrieb Chanwoo Choi : >>> >>> + H. Nikolaus Schaller >>> >>> On 2018년 06월 14일 13:14, Chanwoo Choi wrote: Previously, extcon used the spinlock before calling the notifier_call_chain to prevent the scheduled out of task and to prevent the notification delay. When spinlock is locked for sending the notification, deadlock issue occured on the side of extcon consumer device. To fix this issue, extcon consumer device should always use the work. it is always not reasonable to use work. To fix this issue on extcon consumer device, release locking when sending the notification of connector state. Fixes: ab11af049f88 ("extcon: Add the synchronization extcon APIs to support the notification") Cc: sta...@vger.kernel.org Cc: Roger Quadros Cc: Kishon Vijay Abraham I Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 8bff5fd18185..f75b08a45d4e 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -433,8 +433,8 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) return index; spin_lock_irqsave(&edev->lock, flags); - state = !!(edev->state & BIT(index)); + spin_unlock_irqrestore(&edev->lock, flags); /* * Call functions in a raw notifier chain for the specific one @@ -448,6 +448,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) */ raw_notifier_call_chain(&edev->nh_all, state, edev); + spin_lock_irqsave(&edev->lock, flags); /* This could be in interrupt handler */ prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); if (!prop_buf) { >> >> I have tested on the Pyra handheld prototype and now it works. Plugging in >> an OTG cable >> enables/disables OTG power as expected and there are no kernel oops any more. > > I did take some minutes to check and it now also works again on the OMAP5EVM. > > BR, > Nikolaus Applied it. -- Best Regards, Chanwoo Choi Samsung Electronics
[PATCH 2/2] kbuild: do not update config for 'make kernelrelease'
'make kernelrelease' depends on CONFIG_LOCALVERSION(_AUTO), but for the same reason as install targets, we do not want to update the configuration just for printing the kernelrelease string. This is likely to happen if you forget to pass CROSS_COMPILE when running 'make kernelrelease' in the source tree configured for cross-compilation. Signed-off-by: Masahiro Yamada --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f934a81..f4fecda 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,8 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg -no-sync-config-targets := $(no-dot-config-targets) install %install +no-sync-config-targets := $(no-dot-config-targets) install %install \ + kernelrelease config-targets := 0 mixed-targets := 0 -- 2.7.4
[PATCH 1/2] kbuild: do not update config when running install targets
"make syncconfig" is automatically invoked when any of the following happens: - .config is updated - any of Kconfig files is updated - any of environment variables referenced in Kconfig is changed Then, it updates configuration files such as include/config/auto.conf include/generated/autoconf.h, etc. Even install targets (install, modules_install, etc.) are no exception. However, they should never ever modify the source tree. Install targets are often run with root privileges. Once those configuration files are owned by root, "make mrproper" would end up with permission error. Install targets should just copy things blindly. They should not care whether the configuration is up-to-date or not. This makes more sense because we are interested in the configuration that was used in the previous kernel building. This issue has existed since before, but rarely happened. I expect more chance where people are hit by this; with the new Kconfig syntax extension, the .config now contains the compiler information. If you cross-compile the kernel with CROSS_COMPILE, but forget to pass it for "make install", you meet "any of environment variables referenced in Kconfig is changed" because $(CC) is referenced in Kconfig. Another scenario is the compiler upgrade before the installation. To solve this, we can make the configuration read-only when running install targets. We already do this for external modules. Install targets need the configuration. "make modules_install" refer to some config options such as CONFIG_MODULES. "make dtbs_install" also needs CONFIG_ARCH_* to decide which dtb files to install. But, do not update it. Now, Make targets are categorized into 3 groups: [1] Do not need the kernel configuration at all help, coccicheck, headers_install etc. [2] Need the latest kernel configuration If new config options are added, Kconfig will show prompt to ask user's selection. Build targets such as vmlinux, in-kernel modules are the cases. [3] Need the kernel configuration, but do not want to update it Install targets except headers_install, and external modules are the cases. Signed-off-by: Masahiro Yamada --- Makefile | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8a26b59..f934a81 100644 --- a/Makefile +++ b/Makefile @@ -225,10 +225,12 @@ no-dot-config-targets := $(clean-targets) \ cscope gtags TAGS tags help% %docs check% coccicheck \ $(version_h) headers_% archheaders archscripts \ kernelversion %src-pkg +no-sync-config-targets := $(no-dot-config-targets) install %install -config-targets := 0 -mixed-targets := 0 -dot-config := 1 +config-targets := 0 +mixed-targets := 0 +dot-config := 1 +may-sync-config := 1 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) @@ -236,6 +238,16 @@ ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) endif endif +ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),) + may-sync-config := 0 + endif +endif + +ifneq ($(KBUILD_EXTMOD),) + may-sync-config := 0 +endif + ifeq ($(KBUILD_EXTMOD),) ifneq ($(filter config %config,$(MAKECMDGOALS)),) config-targets := 1 @@ -611,7 +623,7 @@ ARCH_CFLAGS := include arch/$(SRCARCH)/Makefile ifeq ($(dot-config),1) -ifeq ($(KBUILD_EXTMOD),) +ifeq ($(may-sync-config),1) # Read in dependencies to all Kconfig* files, make sure to run syncconfig if # changes are detected. This should be included after arch/$(SRCARCH)/Makefile # because some architectures define CROSS_COMPILE there. @@ -639,7 +651,7 @@ include/config/auto.conf: echo >&2 ; \ /bin/false) -endif # KBUILD_EXTMOD +endif # may-sync-config else # Dummy target needed, because used as prerequisite -- 2.7.4
Linux 4.18-rc1
You may think it's still Saturday for me, and that I should give you one more day of merge window to send in some last-minute pull requests, but I know better. I'm in Japan, and it's Sunday here. Plus I hope to spend much of this Sunday on a boat (assuming the swells allow it), so I'm closing the merge window early morning rather than in the afternoon. So here we are - no more merge window, so please don't even try to send me updates any more. Just fixes, please. This release looks fairly regular - both in size and in behavior. We actually have managed to shrink things a bit more this release too, as people have clearly gotten excited about the whole "let's remove old unused code". It's not nearly as noticeable as it was for 4.17, but rc1 has actually caused a bit of shrinkage: 12356 files changed, 505769 insertions(+), 612979 deletions(-) where one component of that is the removal of Lustre. The removal of Lustre may not be all that notable, because it does look like a lot of the development has been happening out of tree, which may be why it never really ended up working as well as people hoped in the staging tree. Greg clearly got pretty frustrated about it, so now it's gone. But there's a few other drivers that are gone too, sometimes because the hardware was never actually released to a wider public. You can go see the details in the git history. Anyway, the real work is obviously all the fixes and new features, and there's a lot of that too. Much too much to have an exhaustive shortlog, so as usual for my merge window close emails, what's appended is just my "merge shortlog", mentioning the trees that I've pulled, without any of the details from the individual commits. And as always, the credited person on the list below is the maintainer I've pulled from, which is not necessarily at all the same as the developer that write the code. We had 1500+ developers attributed as authors in this merge window, and the below lists 91 maintainers, so just think about that for a while. Anyway, go out and test, Linus --- Al Viro (11): dcache updates rmdir update procfs updates misc vfs updates dcache lookup cleanups aio updates proc_fill_cache regression fix aio iopriority support aio fixes compat updates AFS updates Alex Williamson (1): VFIO updates Alexandre Belloni (1): RTC updates Andrew Morton (2): updates more updates Arnd Bergmann (1): inode timestamps conversion to timespec64 Bartlomiej Zolnierkiewicz (1): fbdev updates Benson Leung (1): chrome platform updates Bjorn Andersson (3): hwspinlock updates remoteproc updates rpmsg updates Bjorn Helgaas (2): PCI updates more PCI updates Bob Peterson (1): gfs2 updates Boris Brezillon (1): MTD updates Borislav Petkov (1): EDAC updates Bruce Fields (1): nfsd updates Catalin Marinas (1): arm64 updates Christoph Hellwig (1): dma-mapping updates Corey Minyard (1): IPMI updates Dan Williams (1): libnvdimm updates Darren Hart (1): x86 platform driver updates Darrick Wong (2): xfs updates more xfs updates Dave Airlie (3): drm updates drm msm updates and misc fixes amd drm fixes David Miller (5): networking updates IDE updates sparc updates networking fixes networking fixes David Sterba (3): affs fix btrfs updates btrfs fixes David Teigland (1): dlm updates Dmitry Torokhov (1): input updates Eric Biederman (2): userns updates siginfo updates Geert Uytterhoeven (1): m68k updates Greg KH (5): USB and PHY updates char/misc driver updates driver core updates tty/serial updates staging/IIO updates Greg Ungerer (1): m68knommu updates Guenter Roeck (1): hwmon updates Herbert Xu (1): crypto updates Ilya Dryomov (1): ceph updates Ingo Molnar (12): RCU updates EFI updates locking updates perf tooling fixes perf updates scheduler updates x86 boot updates x86 asm updates x86 build updates x86 cleanups x86 debug updates x86 dax updates Jacek Anaszewski (1): LED updates Jaegeuk Kim (1): f2fs updates James Bottomley (2): SCSI updates SCSI fixes James Hogan (1): MIPS updates James Morris (4): security system updates integrity updates TPM updates smack update Jan Kara (2): udf updates fsnotify updates Jason Gunthorpe (1): rdma updates Jassi Brar (1): mailbox updates Jeff Layton (1): fasync fix Jens Axboe (5): block updates block fixes block fixes block flush handling fix block fixes Jessica Yu (1): module updates Jiri Kosina (2): livepatching fixlet HID updates Joerg Roedel (1): IOMMU updates John Johansen (1): AppArmor updates Jon Mason (1): NTB updates Jonathan Corbet (1): documentation updates Josh Poimboeuf (1): faddr2line
Re: [PATCH] staging: rtl8192u: fix line over 80 characters
On Sat, 2018-06-16 at 15:22 -0400, valdis.kletni...@vt.edu wrote: > On Sat, 16 Jun 2018 15:00:31 +0900, Hyunil Kim said: > > *fix checkpatch.pl warnings: > > WARNING: line over 80 characters > > + if (((ieee->wpa_ie[0] == 0xdd) && > > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || > > + ((ieee->wpa_ie[0] == 0x30) && > > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 > > Ouch. The && and || at ends of line mean a lot of parenthesis counting to > figure out which goes with which. Use additional indentation to help > understanding. > > + if (((ieee->wpa_ie[0] == 0xdd) && > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || > + ((ieee->wpa_ie[0] == 0x30) && > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 > > Or perhaps > > + if (((ieee->wpa_ie[0] == 0xdd) && > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) > + || ((ieee->wpa_ie[0] == 0x30) && > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 Or perhaps refactor to something like: --- drivers/staging/rtl8192u/r8192U_core.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 8b17400f6c13..593ecc0ae1ae 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2039,20 +2039,18 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) (strcmp(crypt->ops->name, "WEP") == 0)); /* simply judge */ - if (encrypt && (wpa_ie_len == 0)) { - /* wep encryption, no N mode setting */ + /* wep encryption, no N mode setting */ + if (encrypt && wpa_ie_len == 0) return false; - } else if ((wpa_ie_len != 0)) { - /* parse pairwise key type */ - if (((ieee->wpa_ie[0] == 0xdd) && (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || ((ieee->wpa_ie[0] == 0x30) && (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 - return true; - else - return false; - } else { + + if (wpa_ie_len == 0) return true; - } - return true; + /* parse pairwise key type */ + return (ieee->wpa_ie[0] == 0xdd && + !memcmp(&ieee->wpa_ie[14], ccmp_ie, 4)) || + (ieee->wpa_ie[0] == 0x30 && + !memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)); } static bool GetHalfNmodeSupportByAPs819xUsb(struct net_device *dev)
Re: [PATCH v2] staging: rtl8712: Adjust if statements to reduce indentation level
On Sat, 2018-06-16 at 15:03 +0900, Joonhwan Kim wrote: > Merge two condition of if statements in > r8712_surveydone_event_callback() Are you sure you are not changing the logic here? I think it'd be nicer to refactor the code instead. Something like: --- drivers/staging/rtl8712/rtl871x_mlme.c | 73 +- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index ac547ddd72d1..d711305b33e1 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -552,6 +552,19 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) spin_unlock_irqrestore(&pmlmepriv->lock2, flags); } +static bool r8712_under_linking_then_join(struct mlme_priv *pmlmepriv) +{ + set_fwstate(pmlmepriv, _FW_UNDER_LINKING); + + if (r8712_select_and_join_from_scan(pmlmepriv) != _SUCCESS) + return false; + + mod_timer(&pmlmepriv->assoc_timer, + jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT)); + + return true; +} + void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) { unsigned long irqL; @@ -565,45 +578,31 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); } - if (pmlmepriv->to_join) { - if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { - if (!check_fwstate(pmlmepriv, _FW_LINKED)) { - set_fwstate(pmlmepriv, _FW_UNDER_LINKING); + if (!pmlmepriv->to_join) + goto exit; + + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { + if (check_fwstate(pmlmepriv, _FW_LINKED) || + r8712_under_linking_then_join(pmlmepriv)) + goto exit; + + pmlmepriv->fw_state ^= _FW_UNDER_SURVEY; + memcpy(&adapter->registrypriv.dev_network.Ssid, + &pmlmepriv->assoc_ssid, + sizeof(struct ndis_802_11_ssid)); + r8712_update_registrypriv_dev_network(adapter); + r8712_generate_random_ibss(adapter->registrypriv.dev_network.MacAddress); + pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE; + pmlmepriv->to_join = false; + } else { + pmlmepriv->to_join = false; + if (r8712_under_linking_then_join(pmlmepriv)) + goto exit; - if (r8712_select_and_join_from_scan(pmlmepriv) - == _SUCCESS) { - mod_timer(&pmlmepriv->assoc_timer, jiffies + - msecs_to_jiffies(MAX_JOIN_TIMEOUT)); - } else { - struct wlan_bssid_ex *pdev_network = - &(adapter->registrypriv.dev_network); - u8 *pibss = -adapter->registrypriv. - dev_network.MacAddress; - pmlmepriv->fw_state ^= _FW_UNDER_SURVEY; - memcpy(&pdev_network->Ssid, - &pmlmepriv->assoc_ssid, - sizeof(struct -ndis_802_11_ssid)); - r8712_update_registrypriv_dev_network - (adapter); - r8712_generate_random_ibss(pibss); - pmlmepriv->fw_state = -WIFI_ADHOC_MASTER_STATE; - pmlmepriv->to_join = false; - } - } - } else { - pmlmepriv->to_join = false; - set_fwstate(pmlmepriv, _FW_UNDER_LINKING); - if (r8712_select_and_join_from_scan(pmlmepriv) == - _SUCCESS) - mod_timer(&pmlmepriv->assoc_timer, jiffies + - msecs_to_jiffies(MAX_JOIN_TIMEOUT)); - else - _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - } + _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); } + +exit: spin_unlock_irqrestore(&pmlmepriv->lock, irqL); }
Re: [PATCH 01/11] staging: lustre: simplify use of interval-tree.
On Sat, Jun 16 2018, James Simmons wrote: >> Lustre has a private interval-tree implementation. This >> implementation (inexplicably) refuses to insert an interval if an >> identical interval already exists. It is OK with all sorts of >> overlapping intervals, but identical intervals are rejected. > > I talked to Oleg about this since this changes the behavior. He is worried > about having identical items that would end up being merged. If we can > guarantee by some other means there are no identical nodes, we are > probably fine with the interval tree code allowing this. Oleg can explain > better than me in this case. I don't think this is a change in behaviour. In the driver/staging client code, interval tree is being used in two places and both of them have clumsy work-arounds for the fact that they cannot insert duplicates in the interval tree. The patch just cleans his up. However if I have missed something, please provide details. What "identical items" might get merged? > >> Both users of interval-tree in lustre would be simpler if this was not >> the case. They need to store all intervals, even if some are >> identical. >> >> llite/range_lock.c add a rl_next_lock list_head to each lock. >> If it cannot insert a new lock because the range is in use, it >> attached the new lock to the existing lock using rl_next_lock. >> This requires extra code to iterate over the rl_next_lock lists when >> iterating over locks, and to update the list when deleting a lock from >> the tree. >> >> ldlm_extend allocates a separate ldlm_interval which as a list of >> ldlm_locks which share the same interval. This is linked together >> by over-loading the l_sl_policy which, for non-extent locks, is used >> for linking together locks with the same policy. >> This doesn't only require extra code, but also an extra memory >> allocation. >> >> This patch removes all that complexity. >> - interval_insert() now never fails. > > Its not really a failure. What it does is if it finds a already existing > node with the range requested it returns the already existing node > pointer. If not it just creates a new node and returns NULL. Sometimes > identical request can happen. A good example of this is with HSM request > on the MDS server. In that case sometimes we get identical progress > reports which we want to filter out so not add the same data. This example is server-side code which is not a focus at present. Having a quick look, it looks like it would be easy enough to do a lookup first and then only insert if the lookup failed. I think this is a much nicer approach than never allowing duplicates in the interval tree. Thanks, NeilBrown signature.asc Description: PGP signature
[PATCH] firmware: Update Kconfig help text for Google firmware
The help text for GOOGLE_FIRMWARE states that it should only be enabled when building a kernel for Google's own servers. However, it is now also a dependency for various Chromebook firmware drivers. Update the help text to reflect this double duty. Add the qualifier "server" to the help text for GOOGLE_SMI, which doesn't appear to be useful on Chromebooks. Fixes: d384d6f43d1e ("firmware: google memconsole: Add coreboot support") Signed-off-by: Ben Hutchings --- drivers/firmware/google/Kconfig | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/google/Kconfig b/drivers/firmware/google/Kconfig index f16b381a569c..6fda2c5c69e4 100644 --- a/drivers/firmware/google/Kconfig +++ b/drivers/firmware/google/Kconfig @@ -2,9 +2,8 @@ menuconfig GOOGLE_FIRMWARE bool "Google Firmware Drivers" default n help - These firmware drivers are used by Google's servers. They are - only useful if you are working directly on one of their - proprietary servers. If in doubt, say "N". + These firmware drivers are used by Google servers and + Chromebooks. If in doubt, say "N". if GOOGLE_FIRMWARE @@ -14,8 +13,8 @@ config GOOGLE_SMI select EFI_VARS help Say Y here if you want to enable SMI callbacks for Google - platforms. This provides an interface for writing to and - clearing the EFI event log and reading and writing NVRAM + server platforms. This provides an interface for writing to + and clearing the EFI event log and reading and writing NVRAM variables. config GOOGLE_COREBOOT_TABLE signature.asc Description: Digital signature
Re: wmi: usercopy: Kernel memory overwrite attempt detected to spans multiple pages (offset 0, size 4104)
On Sun, 2018-06-17 at 00:01 +0300, Mihai Donțu wrote: > While trying to adjust the keyboard backlight mode, I hit this BUG: > > Jun 16 22:16:07 mdontu-l kernel: usercopy: Kernel memory overwrite attempt > detected to spans multiple pages (offset 0, size 4104)! > Jun 16 22:16:07 mdontu-l kernel: [ cut here ] > Jun 16 22:16:07 mdontu-l kernel: kernel BUG at mm/usercopy.c:100! > Jun 16 22:16:07 mdontu-l kernel: invalid opcode: [#1] PREEMPT SMP PTI > Jun 16 22:16:07 mdontu-l kernel: Modules linked in: vboxpci(O) vboxnetadp(O) > vboxnetflt(O) vboxdrv(O) > Jun 16 22:16:07 mdontu-l kernel: CPU: 1 PID: 11726 Comm: smbios-keyboard > Tainted: G OT 4.17.1-gentoo #1 > Jun 16 22:16:07 mdontu-l kernel: Hardware name: Dell Inc. Latitude > E7440/07F3F4, BIOS A25 02/01/2018 > Jun 16 22:16:07 mdontu-l kernel: RIP: 0010:usercopy_abort+0x74/0x76 > Jun 16 22:16:07 mdontu-l kernel: RSP: 0018:9235021b7d98 EFLAGS: 00010246 > Jun 16 22:16:07 mdontu-l kernel: RAX: 0061 RBX: 8be94b0d8000 > RCX: > Jun 16 22:16:07 mdontu-l kernel: RDX: RSI: 8be95ea95538 > RDI: 8be95ea95538 > Jun 16 22:16:07 mdontu-l kernel: RBP: 1008 R08: 000ecdbf > R09: 03ce > Jun 16 22:16:07 mdontu-l kernel: R10: R11: 9384378d > R12: > Jun 16 22:16:07 mdontu-l kernel: R13: 8be94b0d9008 R14: > R15: 8be94e04d350 > Jun 16 22:16:07 mdontu-l kernel: FS: 7715b596f540() > GS:8be95ea8() knlGS: > Jun 16 22:16:07 mdontu-l kernel: CS: 0010 DS: ES: CR0: > 80050033 > Jun 16 22:16:07 mdontu-l kernel: CR2: 7715b28bc350 CR3: 000390ee0001 > CR4: 001606e0 > Jun 16 22:16:07 mdontu-l kernel: Call Trace: > Jun 16 22:16:07 mdontu-l kernel: __check_object_size.cold.2+0x16/0x7d > Jun 16 22:16:07 mdontu-l kernel: wmi_ioctl+0x85/0x190 > Jun 16 22:16:07 mdontu-l kernel: do_vfs_ioctl+0xa8/0x680 > Jun 16 22:16:07 mdontu-l kernel: ksys_ioctl+0x60/0x90 > Jun 16 22:16:07 mdontu-l kernel: __x64_sys_ioctl+0x16/0x20 > Jun 16 22:16:07 mdontu-l kernel: do_syscall_64+0x6f/0x500 > Jun 16 22:16:07 mdontu-l kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9 > Jun 16 22:16:07 mdontu-l kernel: RIP: 0033:0x7715b461dbd7 > Jun 16 22:16:07 mdontu-l kernel: RSP: 002b:7ffec2afb618 EFLAGS: 0246 > ORIG_RAX: 0010 > Jun 16 22:16:07 mdontu-l kernel: RAX: ffda RBX: 56c3a5638bc0 > RCX: 7715b461dbd7 > Jun 16 22:16:07 mdontu-l kernel: RDX: 56c3a5638bc0 RSI: c0345700 > RDI: 0003 > Jun 16 22:16:07 mdontu-l kernel: RBP: 1008 R08: 56c3a5638bc0 > R09: > Jun 16 22:16:07 mdontu-l kernel: R10: R11: 0246 > R12: 7715b2ac9580 > Jun 16 22:16:07 mdontu-l kernel: R13: 56c3a56323e0 R14: fffb > R15: 0003 > Jun 16 22:16:07 mdontu-l kernel: Code: 48 0f 45 c6 48 c7 c2 e1 65 b8 92 48 c7 > c6 5b 85 b7 92 51 48 0f 45 f2 48 89 f9 41 52 48 89 c2 48 c7 c7 c8 66 b8 92 e8 > fd fc ea ff <0f> 0b 49 89 e8 31 c9 44 89 e2 31 f6 48 c7 c7 1c 66 b8 92 e8 74 > Jun 16 22:16:07 mdontu-l kernel: RIP: usercopy_abort+0x74/0x76 RSP: > 9235021b7d98 > Jun 16 22:16:07 mdontu-l kernel: ---[ end trace d1b2e9ad540f2091 ]--- > > I couldn't pinpoint the exact user copy call that triggers it: > > (gdb) list *wmi_ioctl+0x85/0x190 > 0x81be9470 is in wmi_ioctl (drivers/platform/x86/wmi.c:816). > 811&wblock->req_buf_size, > 812sizeof(wblock->req_buf_size)); > 813 } > 814 > 815 static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned > long arg) > 816 { > 817 struct wmi_ioctl_buffer __user *input = > 818 (struct wmi_ioctl_buffer __user *) arg; > 819 struct wmi_block *wblock = filp->private_data; > 820 struct wmi_ioctl_buffer *buf = NULL; > > I have attached my kernel config. I eventually sprinkled some printk-s and got this: 855 if (copy_from_user(buf, input, wblock->req_buf_size)) { 856 dev_dbg(&wblock->dev.dev, "Copy %llu from user failed\n", 857 wblock->req_buf_size); 858 ret = -EFAULT; 859 goto out_ioctl; 860 } Regards, -- Mihai Donțu
x86_64: movdqu rarely stores bad data (movdqu works fine). Kernel bug, fried CPU or glibc bug?
TL;DR: on master string/test-memmove glibc test fails on my machine and I don't know why. Other tests work fine. $ elf/ld.so --inhibit-cache --library-path . string/test-memmove simple_memmove __memmove_ssse3_rep __memmove_ssse3 __memmove_sse2_unaligned__memmove_ia32 string/test-memmove: Wrong result in function __memmove_sse2_unaligned dst "0x7084" src "0x7000" offset "43297733" https://sourceware.org/git/?p=glibc.git;a=blob;f=string/test-memmove.c;h=64e3651ba40604e47ddf6d633f4d0aea4644f60a;hb=HEAD Long story: I've trimmed __memmove_sse2_unaligned implementation down to test-memmove-xmm-unaligned.c (attached). It's supposed to show failed memmove attempts when those happen: $ gcc -ggdb3 -O2 -m32 test-memmove-xmm-unaligned.c -o test-memmove-xmm-unaligned -Wall && ./test-memmove-xmm-unaligned Bad result in memmove(dst=0xe7d44110, src=0xe7d44010, len=134217728): offset= 3786689; expected=0039C7C1( 3786689) actual=0039C7C3( 3786691) bit_mismatch=0002; iteration=1 Bad result in memmove(dst=0xe7d44110, src=0xe7d44010, len=134217728): offset= 3786689; expected=0039C7C1( 3786689) actual=0039C7C3( 3786691) bit_mismatch=0002; iteration=3 Bad result in memmove(dst=0xe7d44110, src=0xe7d44010, len=134217728): offset= 5448641; expected=005323C1( 5448641) actual=005323C3( 5448643) bit_mismatch=0002; iteration=5 Bad result in memmove(dst=0xe7d44110, src=0xe7d44010, len=134217728): offset=29022145; expected=01BAD7C1(29022145) actual=01BAD7C3(29022147) bit_mismatch=0002; iteration=9 $ gcc -ggdb3 -O2 -m64 test-memmove-xmm-unaligned.c -o test-memmove-xmm-unaligned -Wall && ./test-memmove-xmm-unaligned Bad result in memmove(dst=0x7fa4658bf110, src=0x7fa4658bf010, len=134217728): offset=25257857; expected=01816781(25257857) actual=01816783(25257859) bit_mismatch=0002; iteration=43 Bad result in memmove(dst=0x7fa4658bf110, src=0x7fa4658bf010, len=134217728): offset=28109697; expected=01ACEB81(28109697) actual=01ACEB83(28109699) bit_mismatch=0002; iteration=112 Bad result in memmove(dst=0x7fa4658bf110, src=0x7fa4658bf010, len=134217728): offset=18257633; expected=011696E1(18257633) actual=011696E3(18257635) bit_mismatch=0002; iteration=363 Bad result in memmove(dst=0x7fa4658bf110, src=0x7fa4658bf010, len=134217728): offset=26981249; expected=019BB381(26981249) actual=019BB383(26981251) bit_mismatch=0002; iteration=437 Note it is a single-bit corruption happening occasionally (not on every iteration). -m32 is way more error prone that -m64. Test example roughly implements these 2 loops: This fails: sfence loop { movdqu [src++],%xmm0 movntdq %xmm0,[dst++] } sfence This works: sfence loop { movdqu [src++],%xmm0 movdqu %xmm0,[dst++] } sfence Failures happen only on sandybridge CPU: Intel(R) Core(TM) i7-2700K CPU @ 3.50GHz kernel is 4.17.0-11928-g2837461dbe6f. Problem is not reproducible instantly after reboot. Machine has to be heavily loaded to start corrupting memory. A few hours of memtest86+ does not reveal any memory failures. I wonder if anyone else can reproduce this failure or should I start looking for a new CPU. From the above it looks like as if movntdq does not play well with XMM context save/restore and there is an 'mfence' missing somewhere in interrupt handling. If there is no obvious problems with glibc's memove() or my small test what can I do to rule-out/pin-down hardware or kernel problem? Thanks! -- Sergei /* Test as: $ gcc -ggdb3 -O2 -m32 test-memmove-xmm-unaligned.c -o test-memmove-xmm-unaligned -Wall && ./test-memmove-xmm-unaligned Error example: Bad result in memmove(dst=0xd7cf5094, src=0xd7cf5010, len=268435456): offset= 8031729; expected=007A8DF1( 8031729) actual=007A8DF3( 8031731) bit_mismatch=0002; iteration=2 Bad result in memmove(dst=0xd7cf5094, src=0xd7cf5010, len=268435456): offset=43626993; expected=0299B1F1(43626993) actual=0299B1F3(43626995) bit_mismatch=0002; iteration=3 Bad result in memmove(dst=0xd7cf5094, src=0xd7cf5010, len=268435456): offset=25404913; expected=0183A5F1(25404913) actual=0183A5F3(25404915) bit_mismatch=0002; iteration=4 ... */ #include /* memmove */ #include /* exit */ #include /* fprintf */ #include /* mlock() */ #include /* movdqu, sfence, movntdq */ typedef unsigned int u32; static void memmove_si128u (__m128i_u * dest, __m128i_u const *src, size_t items) __attribute__((noinline)); static void memmove_si128u (__m128i_u * dest, __m128i_u const *src, size_t items) { // emulate behaviour of optimised block for __memmove_sse2_unaligned: // sfence // loop(backwards) { // 8x movdqu mem->%xmm{N} // 8x movntdq %xmm{N}->mem // } // source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S;h=9aa17de99c9c3415a9b5ac28fd9f1eb4457f916d;hb=HEAD#l244 // ASSUME: if ((unintptr_t)dest > (unintptr_t)src) { d
Re: [PATCH 3.16 000/410] 3.16.57-rc1 review
On Fri, 2018-06-08 at 07:14 -0700, Guenter Roeck wrote: > On Thu, Jun 07, 2018 at 03:05:20PM +0100, Ben Hutchings wrote: > > This is the start of the stable review cycle for the 3.16.57 release. > > There are 410 patches in this series, which will be posted as responses > > to this one. If anyone has any issues with these being applied, please > > let me know. > > > > Responses should be made by Thu Jun 14 18:00:00 UTC 2018. > > Anything received after that time might be too late. > > > > Build results: > total: 138 pass: 136 fail: 2 > Failed builds: > i386:tools/perf > x86_64:tools/perf > Qemu test results: > total: 116 pass: 116 fail: 0 > > tools/perf builds are new, so it is probably not entirely surprising > that they fail. > > Deetails are available at http://kerneltests.org/builders/. Thanks for testing. I see you've now made the tools/perf builds work for 3.16, so thanks for that as well. Ben. -- Ben Hutchings The generation of random numbers is too important to be left to chance. - Robert Coveyou signature.asc Description: This is a digitally signed message part
Re: [PATCH 3.16 183/410] mm: pin address_space before dereferencing it while isolating an LRU page
On Sun, 2018-06-10 at 11:06 -0700, Hugh Dickins wrote: > On Thu, 7 Jun 2018, Ben Hutchings wrote: > > > 3.16.57-rc1 review patch. If anyone has any objections, please let me know. > > Not an objection as such, but if you're including this one, > please be sure to add 145e1a71e090575c74969e3daa8136d1e5b99fc8 > "mm: fix the NULL mapping case in __isolate_lru_page()" Added, thanks. Ben. > Thanks, > Hugh > > > > > -- > > > > From: Mel Gorman > > > > commit 69d763fc6d3aee787a3e8c8c35092b4f4960fa5d upstream. > > > > Minchan Kim asked the following question -- what locks protects > > address_space destroying when race happens between inode trauncation and > > __isolate_lru_page? Jan Kara clarified by describing the race as follows > > > > CPU1CPU2 > > > > truncate(inode) __isolate_lru_page() > > ... > > truncate_inode_page(mapping, page); > > delete_from_page_cache(page) > > spin_lock_irqsave(&mapping->tree_lock, flags); > > __delete_from_page_cache(page, NULL) > > page_cache_tree_delete(..) > > ... mapping = > > page_mapping(page); > > page->mapping = NULL; > > ... > > spin_unlock_irqrestore(&mapping->tree_lock, flags); > > page_cache_free_page(mapping, page) > > put_page(page) > > if (put_page_testzero(page)) -> false > > - inode now has no pages and can be freed including embedded address_space > > > > if (mapping && > > !mapping->a_ops->migratepage) > > - we've dereferenced mapping which is potentially already free. > > > > The race is theoretically possible but unlikely. Before the > > delete_from_page_cache, truncate_cleanup_page is called so the page is > > likely to be !PageDirty or PageWriteback which gets skipped by the only > > caller that checks the mappping in __isolate_lru_page. Even if the race > > occurs, a substantial amount of work has to happen during a tiny window > > with no preemption but it could potentially be done using a virtual > > machine to artifically slow one CPU or halt it during the critical > > window. > > > > This patch should eliminate the race with truncation by try-locking the > > page before derefencing mapping and aborting if the lock was not > > acquired. There was a suggestion from Huang Ying to use RCU as a > > side-effect to prevent mapping being freed. However, I do not like the > > solution as it's an unconventional means of preserving a mapping and > > it's not a context where rcu_read_lock is obviously protecting rcu data. > > > > Link: > > http://lkml.kernel.org/r/20180104102512.2qos3h5vqzeis...@techsingularity.net > > Fixes: c82449352854 ("mm: compaction: make isolate_lru_page() filter-aware > > again") > > Signed-off-by: Mel Gorman > > Acked-by: Minchan Kim > > Cc: "Huang, Ying" > > Cc: Jan Kara > > Signed-off-by: Andrew Morton > > Signed-off-by: Linus Torvalds > > [bwh: Backported to 3.16: adjust context] > > Signed-off-by: Ben Hutchings > > --- > > mm/vmscan.c | 14 -- > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > --- a/mm/vmscan.c > > +++ b/mm/vmscan.c > > @@ -1206,6 +1206,7 @@ int __isolate_lru_page(struct page *page > > > > if (PageDirty(page)) { > > struct address_space *mapping; > > + bool migrate_dirty; > > > > /* ISOLATE_CLEAN means only clean pages */ > > if (mode & ISOLATE_CLEAN) > > @@ -1214,10 +1215,19 @@ int __isolate_lru_page(struct page *page > > /* > >* Only pages without mappings or that have a > >* ->migratepage callback are possible to migrate > > - * without blocking > > + * without blocking. However, we can be racing with > > + * truncation so it's necessary to lock the page > > + * to stabilise the mapping as truncation holds > > + * the page lock until after the page is removed > > + * from the page cache. > >*/ > > + if (!trylock_page(page)) > > + return ret; > > + > > mapping = page_mapping(page); > > - if (mapping && !mapping->a_ops->migratepage) > > + migrate_dirty = mapping && > > mapping->a_ops->migratepage; > > + unlock_page(page); > > + if (!migrate_dirty) > > return ret; > > } > > } > > > > -- Ben Hutchings The generation of random numbers is too important to be left to chance. - Robert Coveyou signature.asc Description: This
Re: [PATCH 3.16 012/410] scsi: libsas: direct call probe and destruct
On Fri, 2018-06-08 at 09:32 +0800, Jason Yan wrote: > On 2018/6/8 2:18, Ben Hutchings wrote: > > On Thu, 2018-06-07 at 17:32 +0100, John Garry wrote: > > > On 07/06/2018 15:05, Ben Hutchings wrote: > > > > 3.16.57-rc1 review patch. If anyone has any objections, please let me > > > > know. > > > > > > > > -- > > > > > > > > > > Hi Ben, > > > > > > I noticed that you are looking to backport this patch to 3.16 > > > > > > I am wondering why you are taking this libsas patch (and a couple other > > > libsas patches) in isolation, when these patches were part of a series > > > to fix libsas hotplug issues? I'm not sure if cherry-picking certain > > > patches is ok. > > > > > > Maybe Jason (cc'ed) can comment further. > > > > This one apparently fixed a security issue (CVE-2017-18232), though I'm > > certainly not convinced it's a particularly serious one. > > > > But please send objections to the list, not just privately. > > > > Hi Ben, > > This patch is in the series below. I recommend to backport them > together. If you really want to do this, I'm happy to help you to > backport them. > > 1689c9367bfa scsi: libsas: notify event PORTE_BROADCAST_RCVD in > sas_enable_revalidation() > 0558f33c06bb scsi: libsas: direct call probe and destruct > 517e5153d242 scsi: libsas: use flush_workqueue to process disco events > synchronously > 93bdbd06b164 scsi: libsas: Use new workqueue to run sas event and disco > event > 8eea9dd84e45 scsi: libsas: make the event threshold configurable > f12486e06ae8 scsi: libsas: shut down the PHY if events reached the threshold > 1c393b970e0f scsi: libsas: Use dynamic alloced work to avoid sas event lost Thank you. I'll drop this single patch for now. I'll leave it you and the other libsas developers to decide if it is sensible to backport this series to 3.16 (and other stable branches). Ben. > > Ben. > > > > > Thanks, > > > John > > > > > > > From: Jason Yan > > > > > > > > commit 0558f33c06bb910e2879e355192227a8e8f0219d upstream. > > > > > > > > In commit 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery > > > > competing with ata error handling") introduced disco mutex to prevent > > > > rediscovery competing with ata error handling and put the whole > > > > revalidation in the mutex. But the rphy add/remove needs to wait for the > > > > error handling which also grabs the disco mutex. This may leads to dead > > > > lock.So the probe and destruct event were introduce to do the rphy > > > > add/remove asynchronously and out of the lock. > > > > > > > > The asynchronously processed workers makes the whole discovery process > > > > not atomic, the other events may interrupt the process. For example, > > > > if a loss of signal event inserted before the probe event, the > > > > sas_deform_port() is called and the port will be deleted. > > > > > > > > And sas_port_delete() may run before the destruct event, but the > > > > port-x:x is the top parent of end device or expander. This leads to > > > > a kernel WARNING such as: > > > > > > > > [ 82.042979] sysfs group 'power' not found for kobject 'phy-1:0:22' > > > > [ 82.042983] [ cut here ] > > > > [ 82.042986] WARNING: CPU: 54 PID: 1714 at fs/sysfs/group.c:237 > > > > sysfs_remove_group+0x94/0xa0 > > > > [ 82.043059] Call trace: > > > > [ 82.043082] [] sysfs_remove_group+0x94/0xa0 > > > > [ 82.043085] [] dpm_sysfs_remove+0x60/0x70 > > > > [ 82.043086] [] device_del+0x138/0x308 > > > > [ 82.043089] [] sas_phy_delete+0x38/0x60 > > > > [ 82.043091] [] do_sas_phy_delete+0x6c/0x80 > > > > [ 82.043093] [] device_for_each_child+0x58/0xa0 > > > > [ 82.043095] [] sas_remove_children+0x40/0x50 > > > > [ 82.043100] [] sas_destruct_devices+0x64/0xa0 > > > > [ 82.043102] [] process_one_work+0x1fc/0x4b0 > > > > [ 82.043104] [] worker_thread+0x50/0x490 > > > > [ 82.043105] [] kthread+0xfc/0x128 > > > > [ 82.043107] [] ret_from_fork+0x10/0x50 > > > > > > > > Make probe and destruct a direct call in the disco and revalidate > > > > function, > > > > but put them outside the lock. The whole discovery or revalidate won't > > > > be interrupted by other events. And the DISCE_PROBE and DISCE_DESTRUCT > > > > event are deleted as a result of the direct call. > > > > > > > > Introduce a new list to destruct the sas_port and put the port delete > > > > after > > > > the destruct. This makes sure the right order of destroying the sysfs > > > > kobject and fix the warning above. > > > > > > > > In sas_ex_revalidate_domain() have a loop to find all broadcasted > > > > device, and sometimes we have a chance to find the same expander twice. > > > > Because the sas_port will be deleted at the end of the whole revalidate > > > > process, sas_port with the same name cannot be added before this. > > > > Otherwise the sysfs will complain of creating duplicate filename. Since > > > > the LLDD will send broadcast for every device change, we can only > > > > proce
wmi: usercopy: Kernel memory overwrite attempt detected to spans multiple pages (offset 0, size 4104)
Hi, While trying to adjust the keyboard backlight mode, I hit this BUG: Jun 16 22:16:07 mdontu-l kernel: usercopy: Kernel memory overwrite attempt detected to spans multiple pages (offset 0, size 4104)! Jun 16 22:16:07 mdontu-l kernel: [ cut here ] Jun 16 22:16:07 mdontu-l kernel: kernel BUG at mm/usercopy.c:100! Jun 16 22:16:07 mdontu-l kernel: invalid opcode: [#1] PREEMPT SMP PTI Jun 16 22:16:07 mdontu-l kernel: Modules linked in: vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) Jun 16 22:16:07 mdontu-l kernel: CPU: 1 PID: 11726 Comm: smbios-keyboard Tainted: G OT 4.17.1-gentoo #1 Jun 16 22:16:07 mdontu-l kernel: Hardware name: Dell Inc. Latitude E7440/07F3F4, BIOS A25 02/01/2018 Jun 16 22:16:07 mdontu-l kernel: RIP: 0010:usercopy_abort+0x74/0x76 Jun 16 22:16:07 mdontu-l kernel: RSP: 0018:9235021b7d98 EFLAGS: 00010246 Jun 16 22:16:07 mdontu-l kernel: RAX: 0061 RBX: 8be94b0d8000 RCX: Jun 16 22:16:07 mdontu-l kernel: RDX: RSI: 8be95ea95538 RDI: 8be95ea95538 Jun 16 22:16:07 mdontu-l kernel: RBP: 1008 R08: 000ecdbf R09: 03ce Jun 16 22:16:07 mdontu-l kernel: R10: R11: 9384378d R12: Jun 16 22:16:07 mdontu-l kernel: R13: 8be94b0d9008 R14: R15: 8be94e04d350 Jun 16 22:16:07 mdontu-l kernel: FS: 7715b596f540() GS:8be95ea8() knlGS: Jun 16 22:16:07 mdontu-l kernel: CS: 0010 DS: ES: CR0: 80050033 Jun 16 22:16:07 mdontu-l kernel: CR2: 7715b28bc350 CR3: 000390ee0001 CR4: 001606e0 Jun 16 22:16:07 mdontu-l kernel: Call Trace: Jun 16 22:16:07 mdontu-l kernel: __check_object_size.cold.2+0x16/0x7d Jun 16 22:16:07 mdontu-l kernel: wmi_ioctl+0x85/0x190 Jun 16 22:16:07 mdontu-l kernel: do_vfs_ioctl+0xa8/0x680 Jun 16 22:16:07 mdontu-l kernel: ksys_ioctl+0x60/0x90 Jun 16 22:16:07 mdontu-l kernel: __x64_sys_ioctl+0x16/0x20 Jun 16 22:16:07 mdontu-l kernel: do_syscall_64+0x6f/0x500 Jun 16 22:16:07 mdontu-l kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9 Jun 16 22:16:07 mdontu-l kernel: RIP: 0033:0x7715b461dbd7 Jun 16 22:16:07 mdontu-l kernel: RSP: 002b:7ffec2afb618 EFLAGS: 0246 ORIG_RAX: 0010 Jun 16 22:16:07 mdontu-l kernel: RAX: ffda RBX: 56c3a5638bc0 RCX: 7715b461dbd7 Jun 16 22:16:07 mdontu-l kernel: RDX: 56c3a5638bc0 RSI: c0345700 RDI: 0003 Jun 16 22:16:07 mdontu-l kernel: RBP: 1008 R08: 56c3a5638bc0 R09: Jun 16 22:16:07 mdontu-l kernel: R10: R11: 0246 R12: 7715b2ac9580 Jun 16 22:16:07 mdontu-l kernel: R13: 56c3a56323e0 R14: fffb R15: 0003 Jun 16 22:16:07 mdontu-l kernel: Code: 48 0f 45 c6 48 c7 c2 e1 65 b8 92 48 c7 c6 5b 85 b7 92 51 48 0f 45 f2 48 89 f9 41 52 48 89 c2 48 c7 c7 c8 66 b8 92 e8 fd fc ea ff <0f> 0b 49 89 e8 31 c9 44 89 e2 31 f6 48 c7 c7 1c 66 b8 92 e8 74 Jun 16 22:16:07 mdontu-l kernel: RIP: usercopy_abort+0x74/0x76 RSP: 9235021b7d98 Jun 16 22:16:07 mdontu-l kernel: ---[ end trace d1b2e9ad540f2091 ]--- I couldn't pinpoint the exact user copy call that triggers it: (gdb) list *wmi_ioctl+0x85/0x190 0x81be9470 is in wmi_ioctl (drivers/platform/x86/wmi.c:816). 811&wblock->req_buf_size, 812sizeof(wblock->req_buf_size)); 813 } 814 815 static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 816 { 817 struct wmi_ioctl_buffer __user *input = 818 (struct wmi_ioctl_buffer __user *) arg; 819 struct wmi_block *wblock = filp->private_data; 820 struct wmi_ioctl_buffer *buf = NULL; I have attached my kernel config. Regards, -- Mihai Donțu config-4.17.1-gentoo.gz Description: application/gzip
Re: [PATCH 2/4] MIPS: Add syscall detection for restartable sequences
- On Jun 15, 2018, at 2:43 PM, Paul Burton paul.bur...@mips.com wrote: > Hi Mathieu, > > On Fri, Jun 15, 2018 at 01:41:25PM -0400, Mathieu Desnoyers wrote: >> > diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S >> > index 38a302919e6b..d7de8adcfcc8 100644 >> > --- a/arch/mips/kernel/entry.S >> > +++ b/arch/mips/kernel/entry.S >> > @@ -79,6 +79,10 @@ FEXPORT(ret_from_fork) >> >jal schedule_tail # a0 = struct task_struct *prev >> > >> > FEXPORT(syscall_exit) >> > +#ifdef CONFIG_DEBUG_RSEQ >> > + movea0, sp >> > + jal rseq_syscall >> > +#endif >> >local_irq_disable # make sure need_resched and >> ># signals dont change between >> ># sampling and return >> > @@ -141,6 +145,10 @@ work_notifysig: # deal >> > with pending signals and >> >j resume_userspace_check >> > >> > FEXPORT(syscall_exit_partial) >> > +#ifdef CONFIG_DEBUG_RSEQ >> > + movea0, sp >> > + jal rseq_syscall >> > +#endif >> >local_irq_disable # make sure need_resched doesn't >> ># change between and return >> >LONG_L a2, TI_FLAGS($28) # current->work >> >> Just to double-check: you did test with CONFIG_DEBUG_RSEQ=y, right ? > > Yes, I did. Although I only ran the selftests, which I don't believe > would actually trigger the SIGSEGV condition. Yeah, I typically hand-craft a critical section that generate a system call in order to trigger this. It's hackish however, and only triggers the SIGSEGV on kernels with CONFIG_DEBUG_RSEQ=y. > > Side-note: maybe it'd be useful to have a test that does intentionally > perform a syscall within a restartable sequence & checks that it > actually receives a SIGSEGV?. We'd have to craft asm code for each architecture issuing a system call in a rseq c.s. to test this. And we'd need to make this test only runs on a kernel with CONFIG_DEBUG_RSEQ=y. I'm not convinced yet it's worth the effort to cleanly integrate this in selftests, but I'm very open to the idea. > >> Are there any live registers that need to be saved before calling >> rseq_syscall ? > > No - we just need gp/$28 & sp/$29, and the calling convention means > rseq_syscall() should return with those unmodified. Everything else that > we or userland care about is about to be loaded from the stack anyway. Sounds good! Thanks, Mathieu > > Thanks, > Paul -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Re: [PATCH 0/4] MIPS: Restartable sequences (rseq) support
- On Jun 14, 2018, at 7:52 PM, Paul Burton paul.bur...@mips.com wrote: > This series implements MIPS support for restartable sequences, hooks up > the rseq syscall & implements MIPS support in the rseq selftests. > > Applies atop Linus' master as of 2837461dbe6f ("Merge tag 'scsi-fixes' > of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi"). > For the entire series: Reviewed-by: Mathieu Desnoyers Unless you ask otherwise, I will expect this patchset to be picked up through the MIPS maintainer tree. Thanks! Mathieu > Thanks, >Paul > > Paul Burton (4): > MIPS: Add support for restartable sequences > MIPS: Add syscall detection for restartable sequences > MIPS: Wire up the restartable sequences (rseq) syscall > rseq/selftests: Implement MIPS support > > arch/mips/Kconfig | 1 + > arch/mips/include/uapi/asm/unistd.h | 15 +- > arch/mips/kernel/entry.S | 8 + > arch/mips/kernel/scall32-o32.S| 1 + > arch/mips/kernel/scall64-64.S | 1 + > arch/mips/kernel/scall64-n32.S| 1 + > arch/mips/kernel/scall64-o32.S| 1 + > arch/mips/kernel/signal.c | 3 + > tools/testing/selftests/rseq/param_test.c | 24 + > tools/testing/selftests/rseq/rseq-mips.h | 725 ++ > tools/testing/selftests/rseq/rseq.h | 2 + > 11 files changed, 776 insertions(+), 6 deletions(-) > create mode 100644 tools/testing/selftests/rseq/rseq-mips.h > > -- > 2.17.1 -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
[RFC PATCH for 4.18] rseq: cleanup: no need to abort rseq c.s. in child on fork
Considering that we explicitly forbid system calls in rseq critical sections, it is not valid to issue a fork or clone system call within a rseq critical section, so rseq_fork() is not required to restart an active rseq c.s. in the child process. Signed-off-by: Mathieu Desnoyers Cc: Thomas Gleixner Cc: Joel Fernandes Cc: Peter Zijlstra Cc: Catalin Marinas Cc: Dave Watson Cc: Will Deacon Cc: Shuah Khan Cc: Andi Kleen Cc: linux-kselft...@vger.kernel.org Cc: "H . Peter Anvin" Cc: Chris Lameter Cc: Russell King Cc: Michael Kerrisk Cc: "Paul E . McKenney" Cc: Paul Turner Cc: Boqun Feng Cc: Josh Triplett Cc: Steven Rostedt Cc: Ben Maurer Cc: linux-...@vger.kernel.org Cc: Andy Lutomirski Cc: Andrew Morton Cc: Linus Torvalds --- include/linux/sched.h | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 87bf02d93a27..c1882643d455 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1831,9 +1831,7 @@ static inline void rseq_migrate(struct task_struct *t) /* * If parent process has a registered restartable sequences area, the - * child inherits. Only applies when forking a process, not a thread. In - * case a parent fork() in the middle of a restartable sequence, set the - * resume notifier to force the child to retry. + * child inherits. Only applies when forking a process, not a thread. */ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) { @@ -1847,7 +1845,6 @@ static inline void rseq_fork(struct task_struct *t, unsigned long clone_flags) t->rseq_len = current->rseq_len; t->rseq_sig = current->rseq_sig; t->rseq_event_mask = current->rseq_event_mask; - rseq_preempt(t); } } -- 2.11.0
[RFC PATCH man-pages] Add rseq manpage
Signed-off-by: Mathieu Desnoyers CC: "Paul E. McKenney" CC: Peter Zijlstra CC: Paul Turner CC: Thomas Gleixner CC: Andrew Hunter CC: Andy Lutomirski CC: Andi Kleen CC: Dave Watson CC: Chris Lameter CC: Ingo Molnar CC: "H. Peter Anvin" CC: Ben Maurer CC: Steven Rostedt CC: Josh Triplett CC: Linus Torvalds CC: Andrew Morton CC: Russell King CC: Catalin Marinas CC: Will Deacon CC: Michael Kerrisk CC: Boqun Feng CC: linux-...@vger.kernel.org --- man2/rseq.2 | 271 1 file changed, 271 insertions(+) create mode 100644 man2/rseq.2 diff --git a/man2/rseq.2 b/man2/rseq.2 new file mode 100644 index 0..ab2519f82 --- /dev/null +++ b/man2/rseq.2 @@ -0,0 +1,271 @@ +.\" Copyright 2015-2017 Mathieu Desnoyers +.\" +.\" %%%LICENSE_START(VERBATIM) +.\" Permission is granted to make and distribute verbatim copies of this +.\" manual provided the copyright notice and this permission notice are +.\" preserved on all copies. +.\" +.\" Permission is granted to copy and distribute modified versions of this +.\" manual under the conditions for verbatim copying, provided that the +.\" entire resulting derived work is distributed under the terms of a +.\" permission notice identical to this one. +.\" +.\" Since the Linux kernel and libraries are constantly changing, this +.\" manual page may be incorrect or out-of-date. The author(s) assume no +.\" responsibility for errors or omissions, or for damages resulting from +.\" the use of the information contained herein. The author(s) may not +.\" have taken the same level of care in the production of this manual, +.\" which is licensed free of charge, as they might when working +.\" professionally. +.\" +.\" Formatted or processed versions of this manual, if unaccompanied by +.\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END +.\" +.TH RSEQ 2 2018-06-16 "Linux" "Linux Programmer's Manual" +.SH NAME +rseq \- Restartable sequences and cpu number cache +.SH SYNOPSIS +.nf +.B #include +.sp +.BI "int rseq(struct rseq * " rseq ", uint32_t " rseq_len ", int " flags ", uint32_t " sig "); +.sp +.SH DESCRIPTION +The +.BR rseq () +ABI accelerates user-space operations on per-cpu data by defining a +shared data structure ABI between each user-space thread and the kernel. + +It allows user-space to perform update operations on per-cpu data +without requiring heavy-weight atomic operations. + +The term CPU used in this documentation refers to a hardware execution +context. + +Restartable sequences are atomic with respect to preemption (making it +atomic with respect to other threads running on the same CPU), as well +as signal delivery (user-space execution contexts nested over the same +thread). + +It is suited for update operations on per-cpu data. + +It can be used on data structures shared between threads within a +process, and on data structures shared between threads across different +processes. + +.PP +Some examples of operations that can be accelerated or improved +by this ABI: +.IP \[bu] 2 +Memory allocator per-cpu free-lists, +.IP \[bu] 2 +Querying the current CPU number, +.IP \[bu] 2 +Incrementing per-CPU counters, +.IP \[bu] 2 +Modifying data protected by per-CPU spinlocks, +.IP \[bu] 2 +Inserting/removing elements in per-CPU linked-lists, +.IP \[bu] 2 +Writing/reading per-CPU ring buffers content. +.IP \[bu] 2 +Accurately reading performance monitoring unit counters +with respect to thread migration. + +.PP +Restartable sequences must not perform system calls. Doing so may result +in termination of the process by a segmentation fault. + +.PP +The +.I rseq +argument is a pointer to the thread-local rseq structure to be shared +between kernel and user-space. + +.PP +The layout of +.B struct rseq +is as follows: +.TP +.B Structure alignment +This structure is aligned on multiples of 32 bytes. +.TP +.B Structure size +This structure is extensible. Its size is passed as parameter to the +rseq system call. +.TP +.B Fields + +.TP +.in +4n +.I cpu_id_start +Optimistic cache of the CPU number on which the current thread is +running. Its value is guaranteed to always be a possible CPU number, +even when rseq is not initialized. The value it contains should always +be confirmed by reading the cpu_id field. +.in +.TP +.in +4n +.I cpu_id +Cache of the CPU number on which the current thread is running. +-1 if uninitialized. +.in +.TP +.in +4n +.I rseq_cs +The rseq_cs field is a pointer to a struct rseq_cs. Is is NULL when no +rseq assembly block critical section is active for the current thread. +Setting it to point to a critical section descriptor (struct rseq_cs) +marks the beginning of the critical section. +.in +.TP +.in +4n +.I flags +Flags indicating the restart behavior for the current thread. This is +mainly used for debugging purposes. Can be either: +.IP \[bu] +RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT +.IP \[bu] +RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL +.IP \[bu] +R
[RFC PATCH for 4.18 1/2] rseq/selftests: run_param_test.sh should be executable
The executable bit of the run_param_test.sh script got lost in the merge. Signed-off-by: Mathieu Desnoyers Cc: Thomas Gleixner Cc: Joel Fernandes Cc: Peter Zijlstra Cc: Catalin Marinas Cc: Dave Watson Cc: Will Deacon Cc: Shuah Khan Cc: Andi Kleen Cc: linux-kselft...@vger.kernel.org Cc: "H . Peter Anvin" Cc: Chris Lameter Cc: Russell King Cc: Andrew Hunter Cc: Michael Kerrisk Cc: "Paul E . McKenney" Cc: Paul Turner Cc: Boqun Feng Cc: Josh Triplett Cc: Steven Rostedt Cc: Ben Maurer Cc: linux-...@vger.kernel.org Cc: Andy Lutomirski Cc: Andrew Morton Cc: Linus Torvalds --- tools/testing/selftests/rseq/run_param_test.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/testing/selftests/rseq/run_param_test.sh diff --git a/tools/testing/selftests/rseq/run_param_test.sh b/tools/testing/selftests/rseq/run_param_test.sh old mode 100644 new mode 100755 -- 2.11.0
[RFC PATCH for 4.18 2/2] rseq/selftests: arm: align struct rseq_cs on 32 bytes
uapi/linux/rseq.h aligns struct rseq_cs on 32 bytes. Satisfy this alignment requirement in its definition within the rseq-arm.h inline assembly. Signed-off-by: Mathieu Desnoyers Cc: Thomas Gleixner Cc: Joel Fernandes Cc: Peter Zijlstra Cc: Catalin Marinas Cc: Dave Watson Cc: Will Deacon Cc: Shuah Khan Cc: Andi Kleen Cc: linux-kselft...@vger.kernel.org Cc: "H . Peter Anvin" Cc: Chris Lameter Cc: Russell King Cc: Andrew Hunter Cc: Michael Kerrisk Cc: "Paul E . McKenney" Cc: Paul Turner Cc: Boqun Feng Cc: Josh Triplett Cc: Steven Rostedt Cc: Ben Maurer Cc: linux-...@vger.kernel.org Cc: Andy Lutomirski Cc: Andrew Morton Cc: Linus Torvalds --- tools/testing/selftests/rseq/rseq-arm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/rseq/rseq-arm.h b/tools/testing/selftests/rseq/rseq-arm.h index 3b055f9aeaab..3cea19877227 100644 --- a/tools/testing/selftests/rseq/rseq-arm.h +++ b/tools/testing/selftests/rseq/rseq-arm.h @@ -57,6 +57,7 @@ do { \ #define __RSEQ_ASM_DEFINE_ABORT(table_label, label, teardown, \ abort_label, version, flags,\ start_ip, post_commit_offset, abort_ip) \ + ".balign 32\n\t"\ __rseq_str(table_label) ":\n\t" \ ".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \ ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \ -- 2.11.0
[RFC PATCH for 4.18 0/2] Restartable Sequences selftests fixes
Those are trivial restartable sequences selftest fixes for 4.18. The executable flag of run_param_test.sh got lost in the merge of the rseq patchset. On ARM, align the struct rseq_cs definition in the inline asm to match the alignment of that structure in the uapi headers. Thanks, Mathieu Mathieu Desnoyers (2): rseq/selftests: run_param_test.sh should be executable rseq/selftests: arm: align struct rseq_cs on 32 bytes tools/testing/selftests/rseq/rseq-arm.h| 1 + tools/testing/selftests/rseq/run_param_test.sh | 0 2 files changed, 1 insertion(+) mode change 100644 => 100755 tools/testing/selftests/rseq/run_param_test.sh -- 2.11.0
Re: [PATCH RFC 0/2] regulator: pfuze100: add pfuze3001 support
Hi Fabio, > Fabio Estevam hat am 16. Juni 2018 um 20:40 geschrieben: > > > Hi Stefan, > > On Fri, Jun 15, 2018 at 8:44 AM, Stefan Wahren wrote: > > This patch series adds support for the NXP PMIC PF3001. This > > based mostly on the patches by Robin Gong and Mauro Salvini from > > here [1]. > > > > [1] - https://community.nxp.com/docs/DOC-331899 > > > > Stefan Wahren (2): > > dt-bindings: pfuze100: add pfuze3001 support > > regulator: pfuze100: add pfuze3001 support > > This series looks good. > > Any particular reason for marking it as RFC? since most of the changes based on Robin's and Mauro's work. > > Thanks
Re: [PATCH] staging: rtl8192u: fix line over 80 characters
On Sat, 16 Jun 2018 15:00:31 +0900, Hyunil Kim said: > *fix checkpatch.pl warnings: > WARNING: line over 80 characters > + if (((ieee->wpa_ie[0] == 0xdd) && > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || > + ((ieee->wpa_ie[0] == 0x30) && > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 Ouch. The && and || at ends of line mean a lot of parenthesis counting to figure out which goes with which. Use additional indentation to help understanding. + if (((ieee->wpa_ie[0] == 0xdd) && + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || + ((ieee->wpa_ie[0] == 0x30) && + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 Or perhaps + if (((ieee->wpa_ie[0] == 0xdd) && + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) +|| ((ieee->wpa_ie[0] == 0x30) && + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4 pgpxUh_FNECk5.pgp Description: PGP signature
Re: [PATCH v4 0/8] Introduce the for_each_set_clump macro
On Wed, May 16, 2018 at 11:08:28PM +0300, Andy Shevchenko wrote: >On Wed, May 16, 2018 at 5:03 PM, Linus Walleij >wrote: >> On Tue, May 15, 2018 at 6:22 PM, William Breathitt Gray >> wrote: >> >>> For example, suppose you would like to iterate over a 16-bit integer 4 >>> bits at a time, skipping over 4-bit groups with no set bit, where >>> represents the current 4-bit group: >>> >>> Example:1011 1110 >>> First loop: 1011 1110 >>> Second loop:1011 >>> Third loop: 1110 >>> >>> Each iteration of the loop returns the next 4-bit group that has at >>> least one set bit. >>> >>> The for_each_set_clump macro has six parameters: >>> >>> * clump: set to current clump index for the iteration >>> * index: set to current bitmap word index for the iteration >>> * offset: bits offset of the found clump in the bitmap word >>> * bits: bitmap to search within >>> * size: bitmap size in number of clumps >>> * clump_size: clump size in number of bits >>> >>> The clump_size argument can be an arbitrary number of bits and is not >>> required to be a multiple of 2. >> >> I must say I'm impressed. Very nice arithmetics going on there. >> >> If I can get some ACK for the bitops patch I'd be happy to merge >> it all through the GPIO tree. The users are pretty clear cut. > >Give me also some time to go through proposed API, I think it might >have needed more alignment with existing find_* and for_* helpers. Hi Andy, Are there any additional changes you would like me to make before this patchset is merged through the GPIO tree? William Breathitt Gray > >> BTW: if I could, I would pull out Donald Knuth's "The Art of Computer >> Programming vol 4A" chapter 7.1.3 "Bitwise Tricks and Techniques" >> to see what he has to say about the subject, but I don't have >> that book as it turns out. > >I can also add the Standford collection of bit algos here: > >https://graphics.stanford.edu/~seander/bithacks.html > >-- >With Best Regards, >Andy Shevchenko
Re: [PATCH RFC 0/2] regulator: pfuze100: add pfuze3001 support
Hi Stefan, On Fri, Jun 15, 2018 at 8:44 AM, Stefan Wahren wrote: > This patch series adds support for the NXP PMIC PF3001. This > based mostly on the patches by Robin Gong and Mauro Salvini from > here [1]. > > [1] - https://community.nxp.com/docs/DOC-331899 > > Stefan Wahren (2): > dt-bindings: pfuze100: add pfuze3001 support > regulator: pfuze100: add pfuze3001 support This series looks good. Any particular reason for marking it as RFC? Thanks
Re: [PATCH v2 2/2] iio: adc: Add Spreadtrum SC27XX PMICs ADC support
On Fri, 15 Jun 2018 15:03:36 +0800 Baolin Wang wrote: > From: Freeman Liu > > The Spreadtrum SC27XX PMICs ADC controller contains 32 channels, > which is used to sample voltages with 12 bits conversion. > > Signed-off-by: Freeman Liu > Signed-off-by: Baolin Wang Hi, There are some race conditions around the probe and remove. More care is needed when we have a mixture of managed and unmanaged cleanup like here. I'm not understanding the way you have exposed a simple _raw and _scale attributes with what looks to be different scaling to that applied in _processed. As I say below, we should not have both of those interface options anyway. The ABI is that (X_raw + X_offset)*X_scale = X_processed. (with defaults of X_scale = 1 and X_offset = 0). Please rename to avoid using wild cards in the name. That's gone wrong so many times in the past you wouldn't believe it! Hmm Awkward though if the MFD is already upstream. Ah well, I guess for consistency we should follow that and groan when it goes wrong. > --- > Changes since v1: > - Add const for static structures definition. > - Change SC27XX_ADC_TO_VOLTAGE macro to be one function. > - Move channel scale accessing into mutex protection. > - Fix some typos. > --- > drivers/iio/adc/Kconfig | 10 + > drivers/iio/adc/Makefile |1 + > drivers/iio/adc/sc27xx_adc.c | 547 > ++ > 3 files changed, 558 insertions(+) > create mode 100644 drivers/iio/adc/sc27xx_adc.c > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index 9da7907..985b73e 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -621,6 +621,16 @@ config ROCKCHIP_SARADC > To compile this driver as a module, choose M here: the > module will be called rockchip_saradc. > > +config SC27XX_ADC > + tristate "Spreadtrum SC27xx series PMICs ADC" > + depends on MFD_SC27XX_PMIC || COMPILE_TEST > + help > + Say yes here to build support for the integrated ADC inside the > + Spreadtrum SC27xx series PMICs. > + > + This driver can also be built as a module. If so, the module > + will be called sc27xx_adc. > + > config SPEAR_ADC > tristate "ST SPEAr ADC" > depends on PLAT_SPEAR || COMPILE_TEST > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile > index 28a9423..03db7b5 100644 > --- a/drivers/iio/adc/Makefile > +++ b/drivers/iio/adc/Makefile > @@ -59,6 +59,7 @@ obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o > obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o > obj-$(CONFIG_RCAR_GYRO_ADC) += rcar-gyroadc.o > obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o > +obj-$(CONFIG_SC27XX_ADC) += sc27xx_adc.o > obj-$(CONFIG_SPEAR_ADC) += spear_adc.o > obj-$(CONFIG_STX104) += stx104.o > obj-$(CONFIG_SUN4I_GPADC) += sun4i-gpadc-iio.o > diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c > new file mode 100644 > index 000..52e5b74 > --- /dev/null > +++ b/drivers/iio/adc/sc27xx_adc.c In general (i.e. when we notice in time) we don't allow wild cards in names. Far too many times we did this in the past and ended up with later parts that fitted the name, but could not be supported by the driver. The convention is to name everything after the first part supported. So here, sc2731. (I relaxed my thoughts on this later having seen the mfd has this naming - so there are no ideal options left..) > @@ -0,0 +1,547 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2018 Spreadtrum Communications Inc. > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* PMIC global registers definition */ > +#define SC27XX_MODULE_EN 0xc08 Please avoid wild cards. This goes wrong an awful lot of the time when a company comes out with an incompatible part that fits in the existing wild cards. > +#define SC27XX_MODULE_ADC_EN BIT(5) > +#define SC27XX_ARM_CLK_EN0xc10 > +#define SC27XX_CLK_ADC_ENBIT(5) > +#define SC27XX_CLK_ADC_CLK_ENBIT(6) > + > +/* ADC controller registers definition */ > +#define SC27XX_ADC_CTL 0x0 > +#define SC27XX_ADC_CH_CFG0x4 > +#define SC27XX_ADC_DATA 0x4c > +#define SC27XX_ADC_INT_EN0x50 > +#define SC27XX_ADC_INT_CLR 0x54 > +#define SC27XX_ADC_INT_STS 0x58 > +#define SC27XX_ADC_INT_RAW 0x5c > + > +/* Bits and mask definition for SC27XX_ADC_CTL register */ > +#define SC27XX_ADC_ENBIT(0) > +#define SC27XX_ADC_CHN_RUN BIT(1) > +#define SC27XX_ADC_12BIT_MODEBIT(2) > +#define SC27XX_ADC_RUN_NUM_MASK GENMASK(7, 4) > +#define SC27XX_ADC_RUN_NUM_SHIFT 4 > + > +/* Bits and mask definition for SC27XX_ADC_CH_CFG register */ > +#define SC27XX_ADC_CHN_ID_MASK GENMASK(4, 0) > +#define SC27XX_ADC_SCALE_MASK
Re: [PATCH] staging:iio:accel:adis16203: sign extend function rather code duplication
On Tue, 12 Jun 2018 18:48:38 +0200 Karim Eshapa wrote: > Use sign_extend32 kernel function instead of code duplication. > This function is also safe for 16 bits. > > Signed-off-by: Karim Eshapa Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/staging/iio/accel/adis16203.c | 6 +- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16203.c > b/drivers/staging/iio/accel/adis16203.c > index b3e4571340ab..5cc96c8086b5 100644 > --- a/drivers/staging/iio/accel/adis16203.c > +++ b/drivers/staging/iio/accel/adis16203.c > @@ -168,7 +168,6 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, > { > struct adis *st = iio_priv(indio_dev); > int ret; > - int bits; > u8 addr; > s16 val16; > > @@ -202,14 +201,11 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, > *val = 25000 / -470 - 1278; /* 25 C = 1278 */ > return IIO_VAL_INT; > case IIO_CHAN_INFO_CALIBBIAS: > - bits = 14; > addr = adis16203_addresses[chan->scan_index]; > ret = adis_read_reg_16(st, addr, &val16); > if (ret) > return ret; > - val16 &= (1 << bits) - 1; > - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > - *val = val16; > + *val = sign_extend32(val16, 13); > return IIO_VAL_INT; > default: > return -EINVAL;
Re: [PATCH v2] staging:iio:accel:adis16240: sign extend function avoiding code duplication
On Tue, 12 Jun 2018 18:21:53 +0200 Karim Eshapa wrote: > Use sign_extend32 kernel function instead of code duplication, > Safe also for 16 bit. and remove declaration of bits variable not needed. > > Signed-off-by: Karim Eshapa Please consider how a patch is applied and resend as a v3 which can actually be applied. Test it (by applying it yourself) to make sure you have everything correct... Jonathan > > >On Tue, 2018-06-12 at 01:38 +0200, Karim Eshapa wrote: > >> Use sign_extend32 kernel function instead of code duplication. > >> Safe also for 16 bit. > > > >Perhaps remove the bits declaration and assignments > >and just use 9 directly. > > > >> diff --git a/drivers/staging/iio/accel/adis16240.c > >> b/drivers/staging/iio/accel/adis16240.c > > > >> @@ -292,9 +292,7 @@ static int adis16240_read_raw(struct iio_dev > >> *indio_dev, > >> ret = adis_read_reg_16(st, addr, &val16); > >> if (ret) > >> return ret; > >> - val16 &= (1 << bits) - 1; > >> - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > >> - *val = val16; > >> + *val = sign_extend32(val16, bits - 1); > >> return IIO_VAL_INT; > >> case IIO_CHAN_INFO_PEAK: > >> bits = 10; > >> @@ -302,9 +300,7 @@ static int adis16240_read_raw(struct iio_dev > >> *indio_dev, > >> ret = adis_read_reg_16(st, addr, &val16); > >> if (ret) > >> return ret; > >> - val16 &= (1 << bits) - 1; > >> - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > >> - *val = val16; > >> + *val = sign_extend32(val16, bits - 1); > >> return IIO_VAL_INT; > >> } > >> return -EINVAL; > --- > drivers/staging/iio/accel/adis16240.c | 11 ++- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/staging/iio/accel/adis16240.c > b/drivers/staging/iio/accel/adis16240.c > index fff6d99089cc..24e525f1ef25 100644 > --- a/drivers/staging/iio/accel/adis16240.c > +++ b/drivers/staging/iio/accel/adis16240.c > @@ -250,7 +250,6 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, > { > struct adis *st = iio_priv(indio_dev); > int ret; > - int bits; > u8 addr; > s16 val16; > > @@ -287,24 +286,18 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, > *val = 25000 / 244 - 0x133; /* 25 C = 0x133 */ > return IIO_VAL_INT; > case IIO_CHAN_INFO_CALIBBIAS: > - bits = 10; > addr = adis16240_addresses[chan->scan_index][0]; > ret = adis_read_reg_16(st, addr, &val16); > if (ret) > return ret; > - val16 &= (1 << bits) - 1; > - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > - *val = val16; > + *val = sign_extend32(val16, 9); > return IIO_VAL_INT; > case IIO_CHAN_INFO_PEAK: > - bits = 10; > addr = adis16240_addresses[chan->scan_index][1]; > ret = adis_read_reg_16(st, addr, &val16); > if (ret) > return ret; > - val16 &= (1 << bits) - 1; > - val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); > - *val = val16; > + *val = sign_extend32(val16, 9); > return IIO_VAL_INT; > } > return -EINVAL;
Re: [RFC PATCH] iio: adc: at91-sama5d2_adc: add support for oversampling resolution
On Mon, 11 Jun 2018 09:52:34 +0300 Eugen Hristev wrote: > This is implements oversampling support for the SAMA5D2 ADC > device. > Enabling oversampling : OSR can improve resolution from 12 bits to > 13 or 14 bits. > To not modify the scan element of the buffer , from 12 bits to 13 or 14, > I have added the extra bit(s) as MICRO values to the INT value from the > conversion. > Special care was required for the triggered buffer scenario (+ DMA). > > Signed-off-by: Eugen Hristev > --- > Hello Jonathan, > > I marked this patch as RFC because I am not confident in the best way to > handle > this oversampling support. > > I modified the return value of the channels to use IIO_VALUE_INT_PLUS_MICRO > instead of IIO_VALUE_INT, so I can add an extra bit or two bits in there to > the > INT value (0/50 or 0/25/50/750) . > You know of a better way to add this support? > Looks like the iio channel spec cannot be modified at > runtime. Would be best if the real bits in the channel spec would be changed > to > 13 or 14, but then, the buffer would be confused, as the buffer spec is now > le:u12/16>>0 so how can I change that to reflect oversampling, or, > IIO_VALUE_INT_PLUS_MICRO ? > And I am not sure how to handle this w.r.t ABI and userspace changes. Hmm. Yes, that rigidity in buffer formatting is sometimes a pain. One day we should look at relaxing it. I did look at it a long time ago but it looked really fiddly to actually do. > > At this moment I added the micro values just to the software trigger readings, > and triggered buffer + DMA does not provide the extra bits, but, I need > to shift all values with 2 bits to the right . The code is rather ugly > right now, but I can change it to look prettier if this is the proper way > to do it. So if we were doing this from scratch (i.e. new driver) then it would be easy. you'd do the opposite - report it as a 14bit channel at all times and shift it left (0 fill) if not supplying 14bits due to lower oversampling ratios. Now the risk is some userspace code isn't actually reading the description but is assuming the buffer entry is 12 bits. I would hope that no one is doing that (as generic code would be checking correctly) so perhaps we can get away with making that change? That would mean also adjusting the scale value and sticking to integer output in sysfs (appropriately scaled when only 12 bits etc actually there). Given what you have here is an ABI change anyway, I'd just go for it and declare it to always be 14bits. It would be valid if you want to not rescale the sysfs values at all, but instead adjust the 'scale' as the oversampling changes - either is valid under the ABI. Btw nicely designed hw doing overscaling does the shift for you (i.e. it's the least sig bits that are just 0 when no oversampling). Makes the SW easy and means you've already gotten the placement right before you get to implementing oversampling. > > Thanks for all the feedback, > Eugen > > > drivers/iio/adc/at91-sama5d2_adc.c | 198 > - > 1 file changed, 172 insertions(+), 26 deletions(-) > > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c > b/drivers/iio/adc/at91-sama5d2_adc.c > index 58c4c2b..f1a89b7 100644 > --- a/drivers/iio/adc/at91-sama5d2_adc.c > +++ b/drivers/iio/adc/at91-sama5d2_adc.c > @@ -130,6 +130,15 @@ > #define AT91_SAMA5D2_OVER0x3c > /* Extended Mode Register */ > #define AT91_SAMA5D2_EMR 0x40 > +/* Extended Mode Register - Oversampling rate */ > +#define AT91_SAMA5D2_EMR_OSR(V) ((V) << 16) > +#define AT91_SAMA5D2_EMR_OSR_MASKGENMASK(17, 16) > +#define AT91_SAMA5D2_EMR_OSR_0SAMPLES0 > +#define AT91_SAMA5D2_EMR_OSR_4SAMPLES1 > +#define AT91_SAMA5D2_EMR_OSR_16SAMPLES 2 > + > +/* Extended Mode Register - Averaging on single trigger event */ > +#define AT91_SAMA5D2_EMR_ASTE(V) ((V) << 20) > /* Compare Window Register */ > #define AT91_SAMA5D2_CWR 0x44 > /* Channel Gain Register */ > @@ -248,6 +257,14 @@ > #define AT91_HWFIFO_MAX_SIZE_STR "128" > #define AT91_HWFIFO_MAX_SIZE 128 > > +/* Possible values for oversampling ratio, and the string equivalent */ > +#define AT91_OSR_0SAMPLES0 > +#define AT91_OSR_0SAMPLES_STR"0" > +#define AT91_OSR_4SAMPLES4 > +#define AT91_OSR_4SAMPLES_STR"4" > +#define AT91_OSR_16SAMPLES 16 > +#define AT91_OSR_16SAMPLES_STR "16" > + > #define AT91_SAMA5D2_CHAN_SINGLE(num, addr) \ > { \ > .type = IIO_VOLTAGE,\ > @@ -261,7 +278,8 @@ > }, \ > .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ > .info_mask_shared_by_type = BIT(IIO_CHAN_INF
[PATCH v3] sysfs: Fix internal_create_group() for named group updates
There are a couple of problems with named group updates in the code today: * sysfs_update_group() will always fail for a named group, because internal_create_group() will try to create a new sysfs directory unconditionally, which will ofcourse fail with -EEXIST. * We can leak the kernfs_node for grp->name if some one tries to: - rename a group (change grp->name), or - update a named group, to an unnamed group It appears that the whole purpose of sysfs_update_group() was to allow changing the permissions or visibility of attributes and not the names. So make it clear in the comments, and allow it to update an existing named group. Signed-off-by: Rajat Jain --- v2: Use pr_warn() instead of WARN() v3: drop the extra reference taken by kernfs_find_and_get() fs/sysfs/group.c | 29 ++--- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 4802ec0e1e3a..38240410f831 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -119,12 +119,22 @@ static int internal_create_group(struct kobject *kobj, int update, return -EINVAL; } if (grp->name) { - kn = kernfs_create_dir(kobj->sd, grp->name, - S_IRWXU | S_IRUGO | S_IXUGO, kobj); - if (IS_ERR(kn)) { - if (PTR_ERR(kn) == -EEXIST) - sysfs_warn_dup(kobj->sd, grp->name); - return PTR_ERR(kn); + if (update) { + kn = kernfs_find_and_get(kobj->sd, grp->name); + if (!kn) { + pr_warn("Can't update unknown attr grp name: %s/%s\n", + kobj->name, grp->name); + return -EINVAL; + } + } else { + kn = kernfs_create_dir(kobj->sd, grp->name, + S_IRWXU | S_IRUGO | S_IXUGO, + kobj); + if (IS_ERR(kn)) { + if (PTR_ERR(kn) == -EEXIST) + sysfs_warn_dup(kobj->sd, grp->name); + return PTR_ERR(kn); + } } } else kn = kobj->sd; @@ -135,6 +145,10 @@ static int internal_create_group(struct kobject *kobj, int update, kernfs_remove(kn); } kernfs_put(kn); + + if (grp->name && update) + kernfs_put(kn); + return error; } @@ -199,7 +213,8 @@ EXPORT_SYMBOL_GPL(sysfs_create_groups); * of the attribute files being created already exist. Furthermore, * if the visibility of the files has changed through the is_visible() * callback, it will update the permissions and add or remove the - * relevant files. + * relevant files. Changing a group's name (subdirectory name under + * kobj's directory in sysfs) is not allowed. * * The primary use for this function is to call it after making a change * that affects group visibility. -- 2.18.0.rc1.244.gcf134e6275-goog
Re: [PATCH v2 2/2] dt-bindings: iio: dac: Add docs for AD5758 DAC
On Mon, 11 Jun 2018 10:42:35 +0200 Linus Walleij wrote: > On Thu, Jun 7, 2018 at 3:11 PM, Stefan Popa wrote: > > > + - adi,slew: Array of slewrate settings should contain 3 fields: > > + 1: Should be either 0 or 1 in order to enable or disable slewrate. > > We have a standard binding in pin control for "slew-rate". > > It doesn't have a unit today though. > > > + 2: Slew rate clock: > > + Valid values for the slew rate update frequency [Hz]: > > + * 24 > > + * 20 > > + * 15 > > + * 128000 > > + * 64000 > > + * 32000 > > + * 16000 > > + * 8000 > > + * 4000 > > + * 2000 > > + * 1000 > > + * 512 > > + * 256 > > + * 128 > > + * 64 > > + * 16 > > + 3: Slew rate step: > > + Defines by how much the output value changes at each update. > > + Valid values for the step size LSBs: > > + * 4 > > + * 12 > > + * 64 > > + * 120 > > + * 256 > > + * 500 > > + * 1820 > > + * 2048 > > This is pretty idiomatic and just encodes the configuration fields from the > hardware into the device tree. > > The normal slew rate unit is Volts per microsecond. > > I get the feeling that we could define that simply, and then calculate > the slew rate clock and step using that to find the best match for > a certain slew rate. > > Yours, > Linus Walleij Agreed. A single value would be nice if possible. J
[PATCH] tools/perf: fix a clang 7.0 compilation error
Arnaldo reported the perf build failure with latest llvm/clang compiler (7.0). $ make LIBCLANGLLVM=1 -C tools/perf/ CC /tmp/tmp.t53Qo38zci/tests/kmod-path.o util/c++/clang.cpp: In function ‘std::unique_ptr > perf::getBPFObjectFromModule(llvm::Module*)’: util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’ TargetMachine::CGFT_ObjectFile)) { ^ In file included from util/c++/clang.cpp:25:0: /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile( llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*) virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, ^~~ /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate expects 6 arguments, 3 provided mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1 make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2 make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 make[5]: *** Waiting for unfinished jobs CC /tmp/tmp.t53Qo38zci/tests/thread-map.o The function addPassesToEmitFile signature changed in llvm 7.0 and such a change caused the failure. This patch fixed the issue with using proper function signatures under different compiler versions. Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Yonghong Song --- tools/perf/util/c++/clang.cpp | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index bf31cea..8951250 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp @@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module) raw_svector_ostream ostream(*Buffer); legacy::PassManager PM; - if (TargetMachine->addPassesToEmitFile(PM, ostream, - TargetMachine::CGFT_ObjectFile)) { + bool NotAdded; +#if CLANG_VERSION_MAJOR < 7 + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, + TargetMachine::CGFT_ObjectFile); +#else + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr, + TargetMachine::CGFT_ObjectFile); +#endif + if (NotAdded) { llvm::errs() << "TargetMachine can't emit a file of this type\n"; return std::unique_ptr>(nullptr);; } -- 2.9.5
Re: perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
On 6/16/18 5:26 AM, Arnaldo Carvalho de Melo wrote: Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building perf with clang embedded I noticed this, will investigate, posting here to document the regression, maybe this is something you came across in other scenario: $ make LIBCLANGLLVM=1 -C tools/perf/ CC /tmp/tmp.t53Qo38zci/tests/kmod-path.o util/c++/clang.cpp: In function ‘std::unique_ptr > perf::getBPFObjectFromModule(llvm::Module*)’: util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’ TargetMachine::CGFT_ObjectFile)) { ^ In file included from util/c++/clang.cpp:25:0: /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*) virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, ^~~ /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate expects 6 arguments, 3 provided mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1 make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2 make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 make[5]: *** Waiting for unfinished jobs CC /tmp/tmp.t53Qo38zci/tests/thread-map.o There is an interface change in llvm 7.0 (trunk) for function llvm::TargetMachine::addPassesToEmitFile. The following patch should fix the problem. -bash-4.2$ git diff diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index bf31cea..11dee58 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp @@ -146,8 +146,15 @@ getBPFObjectFromModule(llvm::Module *Module) raw_svector_ostream ostream(*Buffer); legacy::PassManager PM; - if (TargetMachine->addPassesToEmitFile(PM, ostream, - TargetMachine::CGFT_ObjectFile)) { + bool NotAdded; +#if CLANG_VERSION_MAJOR < 7 + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, + TargetMachine::CGFT_ObjectFile); +#else + NotAdded = TargetMachine->addPassesToEmitFile(PM, ostream, nullptr, + TargetMachine::CGFT_ObjectFile); +#endif + if (!NotAdded) { llvm::errs() << "TargetMachine can't emit a file of this type\n"; return std::unique_ptr>(nullptr);; } -bash-4.2$ Will submit a formal patch soon. - Arnaldo
Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to allocate agent number (fwd)
ib_mad_client_id is declared as u32, so it will not be < 0 (line 382). julia -- Forwarded message -- Date: Fri, 8 Jun 2018 08:49:57 +0800 From: kbuild test robot To: kbu...@01.org Cc: Julia Lawall Subject: Re: [PATCH v3 2/2] IB/mad: Use ID allocator routines to allocate agent number Hi Hans, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v4.17] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Hans-Westgaard-Ry/IB-mad-Use-ID-allocator-routines-to-allocate-agent-number/20180608-022348 :: branch date: 6 hours ago :: commit date: 6 hours ago >> drivers/infiniband/core/mad.c:382:5-21: WARNING: Unsigned expression >> compared with zero: ib_mad_client_id < 0 # https://github.com/0day-ci/linux/commit/74b1ba09003c9d132878734bf44f32a62bad31db git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 74b1ba09003c9d132878734bf44f32a62bad31db vim +382 drivers/infiniband/core/mad.c 2527e681 Sean Hefty2006-07-20 190 ^1da177e Linus Torvalds2005-04-16 191 /* ^1da177e Linus Torvalds2005-04-16 192 * ib_register_mad_agent - Register to send/receive MADs ^1da177e Linus Torvalds2005-04-16 193 */ ^1da177e Linus Torvalds2005-04-16 194 struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, ^1da177e Linus Torvalds2005-04-16 195 u8 port_num, ^1da177e Linus Torvalds2005-04-16 196 enum ib_qp_type qp_type, ^1da177e Linus Torvalds2005-04-16 197 struct ib_mad_reg_req *mad_reg_req, ^1da177e Linus Torvalds2005-04-16 198 u8 rmpp_version, ^1da177e Linus Torvalds2005-04-16 199 ib_mad_send_handler send_handler, ^1da177e Linus Torvalds2005-04-16 200 ib_mad_recv_handler recv_handler, 0f29b46d Ira Weiny 2014-08-08 201 void *context, 0f29b46d Ira Weiny 2014-08-08 202 u32 registration_flags) ^1da177e Linus Torvalds2005-04-16 203 { ^1da177e Linus Torvalds2005-04-16 204 struct ib_mad_port_private *port_priv; ^1da177e Linus Torvalds2005-04-16 205 struct ib_mad_agent *ret = ERR_PTR(-EINVAL); ^1da177e Linus Torvalds2005-04-16 206 struct ib_mad_agent_private *mad_agent_priv; ^1da177e Linus Torvalds2005-04-16 207 struct ib_mad_reg_req *reg_req = NULL; ^1da177e Linus Torvalds2005-04-16 208 struct ib_mad_mgmt_class_table *class; ^1da177e Linus Torvalds2005-04-16 209 struct ib_mad_mgmt_vendor_class_table *vendor; ^1da177e Linus Torvalds2005-04-16 210 struct ib_mad_mgmt_vendor_class *vendor_class; ^1da177e Linus Torvalds2005-04-16 211 struct ib_mad_mgmt_method_table *method; ^1da177e Linus Torvalds2005-04-16 212 int ret2, qpn; ^1da177e Linus Torvalds2005-04-16 213 unsigned long flags; ^1da177e Linus Torvalds2005-04-16 214 u8 mgmt_class, vclass; 74b1ba09 Hans Westgaard Ry 2018-06-07 215 u32 ib_mad_client_id; ^1da177e Linus Torvalds2005-04-16 216 /* Validate parameters */ ^1da177e Linus Torvalds2005-04-16 217 qpn = get_spl_qp_index(qp_type); 9ad13a42 Ira Weiny 2014-08-08 218 if (qpn == -1) { 9ad13a42 Ira Weiny 2014-08-08 219 dev_notice(&device->dev, 9ad13a42 Ira Weiny 2014-08-08 220 "ib_register_mad_agent: invalid QP Type %d\n", 9ad13a42 Ira Weiny 2014-08-08 221 qp_type); ^1da177e Linus Torvalds2005-04-16 222 goto error1; 9ad13a42 Ira Weiny 2014-08-08 223 } ^1da177e Linus Torvalds2005-04-16 224 9ad13a42 Ira Weiny 2014-08-08 225 if (rmpp_version && rmpp_version != IB_MGMT_RMPP_VERSION) { 9ad13a42 Ira Weiny 2014-08-08 226 dev_notice(&device->dev, 9ad13a42 Ira Weiny 2014-08-08 227 "ib_register_mad_agent: invalid RMPP Version %u\n", 9ad13a42 Ira Weiny 2014-08-08 228 rmpp_version); fa619a77 Hal Rosenstock2005-07-27 229 goto error1; 9ad13a42 Ira Weiny 2014-08-08 230 } ^1da177e Linus Torvalds2005-04-16 231 ^1da177e Linus Torvalds2005-04-16 232 /* Validate MAD registration request if supplied */ ^1da177e Linus Torvalds2005-04-16 233 if (mad_reg_req) { 9ad13a42 Ira Weiny 2014-08-08 234 if (mad_reg_req->mgmt_class_version >= MAX_MGMT_VERSION) { 9ad13a42 Ira Weiny 2014-08-08 235 dev_notice(&dev
Re: ACPI support in common clock framework
On Fri, Jun 15, 2018 at 7:43 PM, Stephen Boyd wrote: > Quoting Rafael J. Wysocki (2018-06-13 01:27:39) >> On Wed, Jun 13, 2018 at 10:13 AM, Andy Shevchenko >> wrote: >> > +Cc: Rafael, ACPI ML >> > >> > On Wed, Jun 13, 2018 at 7:14 AM, Srinath Mannam >> > wrote: >> >> Hi Michael, Stephen, >> >> >> >> We are adding ACPI support in our Linux based platform. >> >> At present our clock hierarchy using common clock framework through DTS. >> >> Now we required ACPI support in common clock framework to upgrade our >> >> platform. >> >> >> >> For example, clk_get API called in many drivers to get clock device is >> >> tightly coupled with DT framework. >> >> >> >> Please let us know, if anybody in Open Source community have plans to >> >> add ACPI support for common clock framework. >> >> There are no plans for doing that AFAICS. >> >> Moreover, it generally would not be consistent with ACPI power >> management defined by the specification. > > This matches my understanding. > >> >> >> If not please suggest us alternative method to use common clock >> >> framework in ACPI use case. >> >> The problem with using the clock framework on systems with ACPI is >> that, in general, the clock manipulation is expected to be carried out >> by ACPI power management and therefore it is "owned" by AML. >> Currently, there are no defined methods for synchronizing the AML's >> use of clocks for power management with what the OS may do with them >> directly. >> >> In theory, that can be worked around to some extent by representing >> clocks as power resources in ASL (even though the provider information >> would be missing then) and manipulating those power resources directly >> from the OS. I'm not aware of anyone doing that successfully, >> however. >> >> For simple power management it should be sufficient to let drivers >> rely on the ACPI PM domain which should happen automatically in the >> majority of cases anyway. >> > > Is this for clk_enable/disable? What about clk_set_rate() or > clk_set_phase()? Is ACPI's AML taking care of that? That's for clk_enable/disable AFAICS. AML doesn't manage device performance states at all.
[PATCH v5] staging: rtl8192u: add error handling for usb_alloc_urb
When usb_alloc_urb fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling usb_alloc_urb, and fixes memory leaks in error paths. Signed-off-by: Zhouyang Jia --- v1->v2: - Fix memory leak. v2->v3: - Release memory in error path. v3->v4: - Use kcalloc instead of kmalloc_array. v4->v5: - Free priv->rx_urb[i]->transfer_buffer and priv->oldaddr. --- drivers/staging/rtl8192u/r8192U_core.c | 34 -- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 7a0dbc0..9413f29 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1639,8 +1639,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) static short rtl8192_usb_initendpoints(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); + int i; - priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), + priv->rx_urb = kcalloc(MAX_RX_URB + 1, sizeof(struct urb *), GFP_KERNEL); if (!priv->rx_urb) return -ENOMEM; @@ -1649,12 +1650,12 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) for (i = 0; i < (MAX_RX_URB + 1); i++) { priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); if (!priv->rx_urb[i]) - return -ENOMEM; + goto out_release_urb; priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL); if (!priv->rx_urb[i]->transfer_buffer) - return -ENOMEM; + goto out_release_urb; priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE; } @@ -1666,9 +1667,13 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) void *oldaddr, *newaddr; priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); + if (!priv->rx_urb[16]) + goto out_release_urb; + priv->oldaddr = kmalloc(16, GFP_KERNEL); if (!priv->oldaddr) - return -ENOMEM; + goto out_release_urb; + oldaddr = priv->oldaddr; align = ((long)oldaddr) & 3; if (align) { @@ -1686,17 +1691,26 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) priv->pp_rxskb = kcalloc(MAX_RX_URB, sizeof(struct sk_buff *), GFP_KERNEL); if (!priv->pp_rxskb) { - kfree(priv->rx_urb); - - priv->pp_rxskb = NULL; - priv->rx_urb = NULL; - DMESGE("Endpoint Alloc Failure"); - return -ENOMEM; + goto out_release_oldaddr; } netdev_dbg(dev, "End of initendpoints\n"); return 0; + +out_release_oldaddr: + kfree(priv->oldaddr); + +out_release_urb: + for (i = 0; i < (MAX_RX_URB + 1); i++) { + if (priv->rx_urb[i]) { + kfree(priv->rx_urb[i]->transfer_buffer); + kfree(priv->rx_urb[i]); + } + } + kfree(priv->rx_urb); + priv->rx_urb = NULL; + return -ENOMEM; } #ifdef THOMAS_BEACON -- 2.7.4
[PATCH] freevxfs: Do not inline vxfs_put_page()
vxfs_put_page() is not implemented in a header file, but in a normal c file and used in multiple functions in different c files. Remove the inline attribute as it does not make sense here and causes a link error when LTO is activated. Signed-off-by: Hauke Mehrtens --- fs/freevxfs/vxfs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c index e806694d4145..8e213cce586f 100644 --- a/fs/freevxfs/vxfs_subr.c +++ b/fs/freevxfs/vxfs_subr.c @@ -46,7 +46,7 @@ const struct address_space_operations vxfs_aops = { .bmap = vxfs_bmap, }; -inline void +void vxfs_put_page(struct page *pp) { kunmap(pp); -- 2.11.0
v4.14.21+: ATOMIC_SLEEP splat bisected to 9428088c90b6 ("drm/qxl: reapply cursor after resetting primary")
Greetings, Running a kernel with ATOMIC_SLEEP enabled in one of my VMs, I met the splat below. I tracked it back to 4.14-stable, and bisected it there. [ 35.748479] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 37.302172] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 43.719223] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 45.284748] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 47.544198] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 49.024251] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 50.222626] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 67.521590] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 864.956846] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 866.478807] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 2245.113210] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 2308.323698] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 2325.967740] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 3355.291413] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 3367.545378] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 3395.581055] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 3405.144002] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 35.748479] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:239 [ 35.750518] in_atomic(): 1, irqs_disabled(): 0, pid: 2482, name: X [ 35.752119] CPU: 0 PID: 2482 Comm: X Kdump: loaded Tainted: GE 4.17.0.g4c5e8fc-default #846 [ 35.754276] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 [ 35.756381] Call Trace: [ 35.756921] dump_stack+0x85/0xcb [ 35.757415] ___might_sleep+0xd8/0x130 [ 35.757818] mutex_lock+0x1c/0x40 [ 35.758202] qxl_surface_evict+0x23/0x60 [qxl] [ 35.758756] qxl_gem_object_free+0x27/0x40 [qxl] [ 35.759247] qxl_bo_unref+0x1d/0x30 [qxl] [ 35.759721] qxl_cursor_atomic_update+0x251/0x2a0 [qxl] [ 35.760314] drm_atomic_helper_commit_planes+0xdf/0x220 [drm_kms_helper] [ 35.761065] drm_atomic_helper_commit_tail+0x26/0x60 [drm_kms_helper] [ 35.761722] commit_tail+0x5f/0x70 [drm_kms_helper] [ 35.762160] drm_atomic_helper_commit+0xfc/0x110 [drm_kms_helper] [ 35.762712] drm_atomic_helper_update_plane+0xf0/0x110 [drm_kms_helper] [ 35.763277] __setplane_internal+0x196/0x240 [drm] [ 35.763698] drm_mode_cursor_universal+0xec/0x1d0 [drm] [ 35.764143] drm_mode_cursor_common+0x16a/0x1d0 [drm] [ 35.764570] ? drm_mode_cursor_ioctl+0x50/0x50 [drm] [ 35.765011] drm_ioctl_kernel+0x81/0xd0 [drm] [ 35.765425] drm_ioctl+0x2a8/0x350 [drm] [ 35.765795] ? drm_mode_cursor_ioctl+0x50/0x50 [drm] [ 35.766256] do_vfs_ioctl+0x91/0x6a0 [ 35.766770] ? __do_page_fault+0x27e/0x4f0 [ 35.767116] ksys_ioctl+0x70/0x80 [ 35.767397] __x64_sys_ioctl+0x16/0x20 [ 35.767732] do_syscall_64+0x60/0x180 [ 35.768042] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 35.768470] RIP: 0033:0x7fe99fc0a477 [ 35.768783] Code: b3 66 90 48 8b 05 21 4a 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d f1 49 2c 00 f7 d8 64 89 01 48 [ 35.770453] RSP: 002b:7fff8dcc3ca8 EFLAGS: 3246 ORIG_RAX: 0010 [ 35.771092] RAX: ffda RBX: 5594217685e0 RCX: 7fe99fc0a477 [ 35.771690] RDX: 7fff8dcc3ce0 RSI: c02464bb RDI: 0018 [ 35.772298] RBP: 7fff8dcc3ce0 R08: 0040 R09: 0004 [ 35.773105] R10: 0040 R11: 3246 R12: c02464bb [ 35.773758] R13: 0018 R14: 0040 R15: 7fff8dcc3db4 git bisect start # good: [569dbb88e80deb68974ef6fdd6a13edb9d686261] Linux 4.13 git bisect good 569dbb88e80deb68974ef6fdd6a13edb9d686261 # bad: [cda6fd4d9382205bb792255cd56a91062d404bc0] Linux 4.14.50 git bisect bad cda6fd4d9382205bb792255cd56a91062d404bc0 # good: [fbd01410e89a66f346ba1b3c0161e1198449b746] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net git bisect good fbd01410e89a66f346ba1b3c0161e1198449b746 # good: [e4b57c4bc11bfaa2588557b52ad5abd65fb9390e] sparc64: mmu_context: Add missing include files git bisect good e4b57c4bc11bfaa2588557b52ad5abd65fb9390e # bad: [703fca31ac31ed81455a8642a6988cbca47f0f07] tpm: st33zp24: fix potential buffer overruns caused by bit glitches on the
Re: [PATCH v7 3/6] DTS: gta04: add uart2 child node for w2sg0004 GPS receiver
Hi Pavel, > Am 14.06.2018 um 21:44 schrieb Pavel Machek : > > On Thu 2018-05-03 11:35:48, H. Nikolaus Schaller wrote: >> GTA04 has a W2SG0004 module connected to UART2 of the OMAP3 >> processor. A GPIO can pulse the on/off toggle switch. >> >> Note that there is no WAKEUP output from the W2SG0004, >> hence we can't use the generic SirfStar binding. >> >> The VSIM regulator is used to power on/off the LNA of an >> external active GPS antenna so that a driver can turn the >> LNA off if GPS is not needed to save battery energy. > > This reads as if you did low->high->low to turn GPS on, then > low->high->low to turn GPS off again. Is that correct? Yes, it controls a toggle switch inside the gps module. Data sheet (page 5, table 1): http://download.goldelico.com/gta04-hardware/Datasheets/W2SG0004_Datasheet_Rev1.81.pdf Well, it says it wants a "Low going pulse (two RTC ticks), for power save". So this indicates "high->low->high" and the chip responds on an unspecified edge. If I speculate about the logic behind this, I think there was the concept of a push-button at the navigator's console of a vessel (button is connected through a single long wire and grounded at the console) to turn the receiver on or off. Now the question is which edge turns it on or of. Pushing or releasing the button? high->low or low->high? There is no hint in the data sheet. If we assume it has not been changed in the w2sg0084i, we can look at page 9, figure 3 https://www.mouser.com/ds/2/437/W2SG0084i_Datasheet_Rev1%2061-1114.pdf to find that a rising edge changes the power state. Experiments with manually controlling the w2sg0004 through /sys/class/gpio have confirmed that that the rising edge is relevant. Now on power-on there seems to be a special rule. If the on/off line is permanently grounded (i.e. low), the module will turn on automatically at power-on. So there is no need for any edge. But since we don't want the module to be turned on at power-on (while U-Boot is running) we have code there to initialize the gpio line to high. Unfortunately you have not cited the code of the patch, so let me add it back: > + /* GPIO_145: trigger for on/off-impulse for w2sg0004 */ > + enable-gpios = <&gpio5 17 GPIO_ACTIVE_HIGH>; So there it is described as GPIO_ACTIVE_HIGH. This might seem to contradict the data sheet which talks about a low going pulse, but better reflects the active low->high edge. I hope this answers your question completely. BR and thanks, Nikolaus
Re: [PATCH RFC] tracing: Call triggers only if event passes filter checks
On Thu, 14 Jun 2018 18:01:13 -0700 Joel Fernandes wrote: > From: "Joel Fernandes (Google)" > > Currently, trace event triggers are called regardless of if the event > filter checks pass or fail. Thus if one were to enable event triggers > and filters at the same time, then the triggers will always be called > even if the filter checks didn't pass. > > This is a problem for a usecase I was experimenting with: measuring the > time preemption is disabled using synthetic events and dump the stack > using the stacktrace trigger if the total preempt off time was greater > than a threshold. Following are the commands for the same: > > Create synthetic event: > > echo 'preemptdisable u64 lat' >> \ > /sys/kernel/debug/tracing/synthetic_events > > echo 'hist:keys=cpu:ts0=common_timestamp.usecs:scpu=cpu' >> \ > > /sys/kernel/debug/tracing/events/preemptirq/preempt_disable/trigger > > echo 'hist:keys=cpu:wakeup_lat=common_timestamp.usecs-$ts0:\ > onmatch(preemptirq.preempt_disable).preemptdisable($wakeup_lat)' >> \ > > /sys/kernel/debug/tracing/events/preemptirq/preempt_enable/trigger > > Enable synthetic event: > > echo stacktrace > > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/trigger > echo 'lat > 400' > > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/filter Have you tried if statement as below? echo "stacktrace if lat > 400" > /sys/kernel/debug/tracing/events/synthetic/preemptdisable/trigger As my understanding, filter is used for controlling "recording the event" and trigger is out of its scope. Trigger itself has own filter as "if statement", so you should use it. Thank you, -- Masami Hiramatsu
perf tools: LIBCLANGLLVM=1 build broken with llvm 7/clang 6
Hi Wang, Yogong, While reviewing the BTF patches for pahole, I updated llvm/clang to HEAD and then building perf with clang embedded I noticed this, will investigate, posting here to document the regression, maybe this is something you came across in other scenario: $ make LIBCLANGLLVM=1 -C tools/perf/ CC /tmp/tmp.t53Qo38zci/tests/kmod-path.o util/c++/clang.cpp: In function ‘std::unique_ptr > perf::getBPFObjectFromModule(llvm::Module*)’: util/c++/clang.cpp:150:43: error: no matching function for call to ‘llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManager&, llvm::raw_svector_ostream&, llvm::TargetMachine::CodeGenFileType)’ TargetMachine::CGFT_ObjectFile)) { ^ In file included from util/c++/clang.cpp:25:0: /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate: virtual bool llvm::TargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::raw_pwrite_stream*, llvm::TargetMachine::CodeGenFileType, bool, llvm::MachineModuleInfo*) virtual bool addPassesToEmitFile(PassManagerBase &, raw_pwrite_stream &, ^~~ /usr/local/include/llvm/Target/TargetMachine.h:254:16: note: candidate expects 6 arguments, 3 provided mv: cannot stat '/tmp/tmp.t53Qo38zci/util/c++/.clang.o.tmp': No such file or directory make[7]: *** [/home/acme/git/perf/tools/build/Makefile.build:101: /tmp/tmp.t53Qo38zci/util/c++/clang.o] Error 1 make[6]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: c++] Error 2 make[5]: *** [/home/acme/git/perf/tools/build/Makefile.build:139: util] Error 2 make[5]: *** Waiting for unfinished jobs CC /tmp/tmp.t53Qo38zci/tests/thread-map.o - Arnaldo
Re: [PATCH v3 6/7] soc: qcom: Add RPMh Power domain driver
On 15 June 2018 at 23:46, David Collins wrote: > Hello Ulf, > > On 06/15/2018 02:25 AM, Ulf Hansson wrote: >> On 14 June 2018 at 20:17, David Collins wrote: >>> On 06/13/2018 11:54 PM, Rajendra Nayak wrote: On 06/14/2018 06:02 AM, David Collins wrote: > On 06/11/2018 09:40 PM, Rajendra Nayak wrote: >>> ... >> +static int rpmhpd_power_off(struct generic_pm_domain *domain) >> +{ >> + struct rpmhpd *pd = domain_to_rpmhpd(domain); >> + int ret = 0; >> + >> + mutex_lock(&rpmhpd_lock); >> + >> + if (pd->level[0] == 0) >> + ret = rpmhpd_aggregate_corner(pd, 0); > > I'm not sure that we want to have the 'pd->level[0] == 0' check, > especially when considering aggregation with the peer pd. I understand > its intention to try to keep enable state and level setting orthogonal. > However, as it stands now, the final request sent to hardware would differ > depending upon the order of calls. Consider the following example. > > Initial state: > pd->level[0] == 0 > pd->corner = 5, pd->enabled = true, pd->active_only = false > pd->peer->corner = 7, pd->peer->enabled = true, pd->peer->active_only = > true > > Outstanding requests: > RPMH_ACTIVE_ONLY_STATE = 7, RPMH_WAKE_ONLY_STATE = 7, RPMH_SLEEP_STATE = 5 > > Case A: > 1. set pd->corner = 6 > --> new value request: RPMH_SLEEP_STATE = 6 > --> duplicate value requests: RPMH_ACTIVE_ONLY_STATE = 7, > RPMH_WAKE_ONLY_STATE = 7 > 2. power_off pd->peer > --> no requests I am not sure why there would be no requests, since we do end up aggregating with pd->peer->corner = 0. So the final state would be RPMH_ACTIVE_ONLY_STATE = max(6, 0) = 6 RPMH_WAKE_ONLY_STATE = 6 RPMH_SLEEP_STATE = max(6, 0) = 6 >>> >>> Argh, my example was ruined by a one character typo. I meant to have: >>> >>> Initial state: >>> pd->level[0] != 0 >>> >>> > > Final state: > RPMH_ACTIVE_ONLY_STATE = 7 > RPMH_WAKE_ONLY_STATE = 7 > RPMH_SLEEP_STATE = 6 > > Case B: > 1. power_off pd->peer > --> no requests Here it would be again be aggregation based on pd->peer->corner = 0 so, RPMH_ACTIVE_ONLY_STATE = max(5, 0) = 5 RPMH_WAKE_ONLY_STATE = 5 RPMH_SLEEP_STATE = max(5, 0) = 5 > 2. set pd->corner = 6 > --> new value requests: RPMH_ACTIVE_ONLY_STATE = 6, > RPMH_WAKE_ONLY_STATE = 6, RPMH_SLEEP_STATE = 6 > > Final state: > RPMH_ACTIVE_ONLY_STATE = 6 > RPMH_WAKE_ONLY_STATE = 6 > RPMH_SLEEP_STATE = 6 correct, RPMH_ACTIVE_ONLY_STATE = max(6, 0) = 6 RPMH_WAKE_ONLY_STATE = 6 RPMH_SLEEP_STATE = max(6, 0) = 6 > > Without the check, Linux would vote for the lowest supported level when > power_off is called. This seems semantically reasonable given that the > consumer is ok with the power domain going fully off and that would be the > closest that we can get. So are you suggesting I replace >> + if (pd->level[0] == 0) >> + ret = rpmhpd_aggregate_corner(pd, 0); with >> + ret = rpmhpd_aggregate_corner(pd, pd->level[0]); >>> >>> Yes, this is the modification that I'm requesting. >>> >>> I can see what you said above makes sense but if its > Initial state: > pd->level[0] != 0 Was that what you meant? >>> >>> Yes. >> >> Apologize for jumping into the discussion. >> >> I have a couple of ideas, that may simplify/improve things related to the >> above. >> >> 1) Would it be easier if genpd calls ->set_performance_state(0) before >> it is about to call the ->power_off() callback? Actually Viresh wanted >> that from the start, but I thought it was useless. > > This sounds like a relatively reasonable thing to do that falls in line > with the semantics of the API. It would also necessitate genpd > aggregating performance state requests again when ->power_on() is called > so that ->set_performance_state() can be called with an appropriate value. > > I think that the issue that I identified above should be solved outright > within the rpmhpd driver though. It is a bug in the RPMh-specific active > + sleep vs active-only aggregation logic. > > The feature you are describing here seems more like a power optimization > that would help in the case of consumer disabling the power domain without > scaling down the performance level for a power domain that does not > support enable/disable. Right. Seems like this isn't needed then. The genpd driver can just implement the callbacks instead. > > Would this behavior in genpd be implemented per power domain or per consumer? > > >> 2) When device are becoming runtime suspended, the ->runtime_
/bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
Hi, I'm seeing this when I do # make menuconfig after a fresh repo clean: git clean -dqfx Might wanna silence it... /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/checklist.o /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/inputbox.o /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/menubox.o /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/textbox.o /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/util.o /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/lxdialog/yesno.o UPD scripts/kconfig/.mconf-cfg HOSTCC scripts/kconfig/mconf.o HOSTLD scripts/kconfig/mconf scripts/kconfig/mconf Kconfig Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.
Re: [Letux-kernel] BUG: drivers/pinctrl/core: races in pinctrl_groups and deferred probing
Hi Tony, > Am 15.06.2018 um 13:18 schrieb H. Nikolaus Schaller : > > Hi Tony, > >> Am 15.06.2018 um 13:13 schrieb Tony Lindgren : >> >> * Tony Lindgren [180615 07:00]: >> >> OK I posted a series to fix these issues hopefully as thread >> "[PATCH 0/5] pinctrl fixes for generic functions and groups". >> >> Can you please test and see if that is enough to fix the issues >> you're seeing? > > Yes, I'll try asap. Ok, I tried on OMAP3 (GTA04A5 board). First boot was ok, but second did show again the strcmp(NULL) :( Interestingly, adding my printk() to pinctrl_generic_add_group makes it disappear. (I think the printk adds more delay to one of the code paths and avoids the race or problematic concurrency). There is also good news: the selectors are now assigned in strict sequence. This is a big improvement: root@letux:~# dmesg|fgrep generic_add [0.739501] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_hsusb2_pins selector=0 [0.741638] pinctrl_generic_add_group: pctldev=ee481f80 name=pinmux_hsusb2_2_pins selector=0 [0.742401] pinctrl_generic_add_group: pctldev=ee481e00 name=pinmux_mcbsp1_devconf0_pins selector=0 [0.743072] pinctrl_generic_add_group: pctldev=ee481d00 name=pinmux_tv_acbias_devconf1_pins selector=0 [0.760437] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_uart1_pins selector=1 [0.762268] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_uart2_pins selector=2 [0.763610] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_uart3_pins selector=3 [1.790527] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_twl4030_pins selector=4 [1.799835] pinctrl_generic_add_group: pctldev=ee3cd000 name=pinmux_twl4030_vpins selector=0 [1.969635] pinctrl_generic_add_group: pctldev=ee481f80 name=spi_gpio_pinmux selector=1 [2.164093] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_mmc1_pins selector=5 [2.198242] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_wlan_irq_pin selector=6 [2.374328] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_gpmc_pins selector=7 [2.769989] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_wlan_pins selector=8 [2.785888] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_bt_pins selector=9 [2.802154] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_wlan_irq_pin selector=10 [5.415222] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_dss_dpi_pins selector=11 [6.080566] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_mcbsp1_pins selector=12 [6.182617] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_mcbsp2_pins selector=13 [6.271240] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_mcbsp3_pins selector=14 [6.330718] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_penirq_pins selector=15 [6.368927] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_mcbsp4_pins selector=16 [6.616546] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=17 [6.835418] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=18 [6.874694] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=19 [6.900299] pinctrl_generic_add_group: pctldev=ee3cd180 name=hdq_pins selector=20 [6.937042] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=21 [7.062744] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=22 [7.108032] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=23 [7.145080] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=24 [7.197723] pinctrl_generic_add_group: pctldev=ee3cd180 name=backlight_pins_pinmux selector=25 [7.427398] pinctrl_generic_add_group: pctldev=ee3cd180 name=modem_pins selector=26 [7.476562] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=27 [7.505981] pinctrl_generic_add_group: pctldev=ee3cd180 name=backlight_pins_pinmux selector=28 [7.564910] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=29 [7.894439] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=30 [8.207489] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=31 [8.311096] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_pps_pins selector=32 [8.340667] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=33 [8.414428] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=34 [9.231445] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=35 [9.446716] pinctrl_generic_add_group: pctldev=ee3cd180 name=pinmux_camera_pins selector=36 root@letux:~# But it looks as if we still have duplicate assignments by deferred probing, i.e. some cleanup is missin
Re: Mounting corrupted HFS+ causes kernel NULL pointer dereference
Hello, > but was the original issue solved? Yes, after removing the suggested line and applying patch [2] on top of v4.17, when I try to mount the original FS image, mount just returns Invalid argument, no kernel NULL pointer dereferences anymore: mount: mounting /dev/sda on /mnt failed: Invalid argument [4.840690] exe (993) used greatest stack depth: 12872 bytes left Thank you! ср, 13 июн. 2018 г. в 0:35, Ernesto A. Fernández : > > Hi: > > On Tue, Jun 12, 2018 at 09:43:26PM +0300, Anatoly Trosinenko wrote: > > Hello, > > > > > [1] https://www.spinics.net/lists/linux-fsdevel/msg125241.html > > > [2] https://www.spinics.net/lists/linux-fsdevel/msg126499.html > > > > If I get it right, the first patch is already upstreamed in some > > modified form and cannot be applied on top of vanilla v4.17. > > The first part of the patchset was already picked up, but your report > is related to the second part, which is the link at [1]. It should > still apply. > > > When I > > apply the second one I get > > > > $ patch -p1 < ../hfsplus-2.patch > > patching file fs/hfsplus/dir.c > > patching file fs/hfsplus/hfsplus_fs.h > > patching file fs/hfsplus/inode.c > > patching file fs/hfsplus/super.c > > Hunk #3 FAILED at 567. > > Hunk #4 succeeded at 586 (offset 1 line). > > 1 out of 4 hunks FAILED -- saving rejects to file fs/hfsplus/super.c.rej > > $ cat fs/hfsplus/super.c.rej > > --- fs/hfsplus/super.c > > +++ fs/hfsplus/super.c > > @@ -567,11 +547,6 @@ static int hfsplus_fill_super(struct super_block > > *sb, void *data, int silent) > > sbi->nls = nls; > > return 0; > > > > -out_put_hidden_dir: > > - iput(sbi->hidden_dir); > > -out_put_root: > > - dput(sb->s_root); > > - sb->s_root = NULL; > > out_put_alloc_file: > > iput(sbi->alloc_file); > > out_close_attr_tree: > > That's because a patch by Tetsuo Handa added a call to > cancel_delayed_work_sync() after the out_put_hidden_dir tag. Just remove > that line before applying the patch. > > > > > Looks, like manually removing this hunk cannot change anything > > (because of previous return), so just left as is. > > Ok, that should be enough for testing. The rest of your mail seems like a > separate bug report, though. I'll take a look at it, but was the original > issue solved? > > > > > Now, when mounting the attached hfsplus_16mb_segv to /mnt and > > performing `dd if=/dev/zero of=/mnt/xyz bs=567879 count=1` I get > > > > [1.646451] BUG: unable to handle kernel NULL pointer dereference > > at 0043 > > [1.64] PGD 1d4d2067 P4D 1d4d2067 PUD 1d4bc067 PMD 0 > > [1.646870] Oops: [#1] SMP NOPTI > > [1.647002] Modules linked in: > > [1.647209] CPU: 0 PID: 991 Comm: init Not tainted 4.17.0+ #1 > > [1.647291] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), > > BIOS 1.10.2-1ubuntu1 04/01/2014 > > [1.647456] RIP: 0010:hfsplus_bnode_put+0x9/0xc0 > > [1.647522] RSP: 0018:b750409b7a58 EFLAGS: 0282 > > [1.647607] RAX: a3b31e713000 RBX: 0a00 RCX: > > 1100 > > [1.647696] RDX: RSI: 85ca56d0 RDI: > > fffb > > [1.647787] RBP: a3b31d473288 R08: R09: > > b750409b7960 > > [1.647877] R10: R11: a3b31df0e618 R12: > > b750409b7ad0 > > [1.647967] R13: a3b31d473180 R14: a3b31d432a00 R15: > > 000a > > [1.648089] FS: 01dd48c0() GS:a3b31f80() > > knlGS: > > [1.648192] CS: 0010 DS: ES: CR0: 80050033 > > [1.648268] CR2: 0043 CR3: 1d4c4000 CR4: > > 06f0 > > [1.648406] Call Trace: > > [1.648883] hfsplus_brec_find+0x3c/0x150 > > [1.648970] ? hfsplus_brec_remove+0x160/0x160 > > [1.649037] hfsplus_ext_read_extent.part.6+0xba/0x190 > > [1.649118] ? clean_bdev_aliases+0x81/0x1d0 > > [1.649178] hfsplus_file_extend+0x16b/0x3a0 > > [1.649238] hfsplus_get_block+0x60/0x250 > > [1.649293] ? hfsplus_file_extend+0x3a0/0x3a0 > > [1.649352] __block_write_begin_int+0x134/0x550 > > [1.649414] ? hfsplus_file_extend+0x3a0/0x3a0 > > [1.649476] ? percpu_counter_add_batch+0x48/0x60 > > [1.649537] ? hfsplus_file_extend+0x3a0/0x3a0 > > [1.649596] block_write_begin+0x3f/0xa0 > > [1.649652] cont_write_begin+0x232/0x330 > > [1.649713] ? hfsplus_file_extend+0x3a0/0x3a0 > > [1.649776] hfsplus_write_begin+0x2f/0x70 > > [1.649834] ? hfsplus_file_extend+0x3a0/0x3a0 > > [1.649902] generic_perform_write+0xb1/0x1b0 > > [1.649965] __generic_file_write_iter+0xfd/0x190 > > [1.650031] generic_file_write_iter+0xe1/0x1e0 > > [1.650095] __vfs_write+0xfc/0x160 > > [1.650148] vfs_write+0xa8/0x190 > > [1.650196] ksys_write+0x4d/0xb0 > > [1.650245] do_syscall_64+0x43/0xf0 > > [1.650301] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > [1.650465] RIP: 0033:
Do You Need A Helping Hand?
I am Mavis Wanczyk i know you may not know me but am the latest largest US Powerball lottery winner of $758.7m just of recent, am currently helping out people in need of financial assistance, i know it's hard to believe anything on the internet, so if you don't need my help please don't reply to this message. Regards Mavis Wanczyk
Linux 4.4.138
I'm announcing the release of the 4.4.138 kernel. All users of the 4.4 kernel series must upgrade. The updated 4.4.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y and can be browsed at the normal kernel.org git web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary thanks, greg k-h Makefile|2 arch/x86/crypto/chacha20_glue.c |2 arch/x86/crypto/crc32c-intel_glue.c |7 - arch/x86/include/asm/cmpxchg_32.h |2 arch/x86/include/asm/cmpxchg_64.h |2 arch/x86/include/asm/cpufeature.h | 39 -- arch/x86/include/asm/fpu/internal.h |6 arch/x86/include/asm/fpu/xstate.h |2 arch/x86/include/asm/kvm_emulate.h |6 arch/x86/include/asm/smp.h |9 - arch/x86/include/asm/xor_32.h |2 arch/x86/kernel/cpu/amd.c |4 arch/x86/kernel/cpu/common.c|4 arch/x86/kernel/cpu/intel.c |3 arch/x86/kernel/cpu/intel_cacheinfo.c |6 arch/x86/kernel/cpu/mtrr/generic.c |2 arch/x86/kernel/cpu/mtrr/main.c |2 arch/x86/kernel/cpu/perf_event_amd.c|4 arch/x86/kernel/cpu/perf_event_amd_uncore.c | 11 - arch/x86/kernel/fpu/core.c | 24 +++ arch/x86/kernel/fpu/init.c | 169 ++-- arch/x86/kernel/fpu/xstate.c|3 arch/x86/kernel/hw_breakpoint.c |6 arch/x86/kernel/smpboot.c |2 arch/x86/kernel/traps.c |1 arch/x86/kernel/vm86_32.c |4 arch/x86/kvm/emulate.c | 72 +-- arch/x86/kvm/vmx.c | 23 +-- arch/x86/kvm/x86.c | 51 ++-- arch/x86/kvm/x86.h |4 arch/x86/mm/setup_nx.c |4 drivers/char/hw_random/via-rng.c|5 drivers/crypto/padlock-aes.c|2 drivers/crypto/padlock-sha.c|2 drivers/crypto/vmx/aes.c|2 drivers/crypto/vmx/aes_cbc.c|2 drivers/crypto/vmx/aes_ctr.c|2 drivers/crypto/vmx/ghash.c |2 drivers/gpio/gpiolib.c |9 + drivers/input/mouse/elan_i2c_core.c |1 drivers/input/touchscreen/goodix.c |1 drivers/iommu/intel_irq_remapping.c |2 drivers/misc/vmw_balloon.c | 23 +-- drivers/tty/serial/samsung.c|7 - fs/btrfs/disk-io.c |2 include/linux/fs.h |4 net/key/af_key.c| 45 +-- 47 files changed, 258 insertions(+), 331 deletions(-) Andy Lutomirski (6): x86/fpu: Default eagerfpu=on on all CPUs x86/fpu: Fix 'no387' regression x86/fpu: Hard-disable lazy FPU mode x86/fpu: Fix FNSAVE usage in eagerfpu mode x86/fpu: Fix math emulation in eager fpu mode x86/crypto, x86/fpu: Remove X86_FEATURE_EAGER_FPU #ifdef from the crc32c code Borislav Petkov (2): x86/cpufeature: Remove unused and seldomly used cpu_has_xx macros x86/fpu: Fix eager-FPU handling on legacy FPU machines Ethan Lee (1): Input: goodix - add new ACPI id for GPD Win 2 touch screen Gil Kupfer (1): vmw_balloon: fixing double free when batching mode is off Greg Kroah-Hartman (1): Linux 4.4.138 Johannes Wienke (1): Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Juergen Gross (1): x86: Remove unused function cpu_has_ht_siblings() Kevin Easton (1): af_key: Always verify length of provided sadb_key Linus Torvalds (1): Clarify (and fix) MAX_LFS_FILESIZE macros Linus Walleij (1): gpio: No NULL owner Marek Szyprowski (1): serial: samsung: fix maxburst parameter for DMA transactions Michael Ellerman (1): crypto: vmx - Remove overly verbose printk from AES init routines Paolo Bonzini (3): KVM: x86: introduce linear_{read,write}_system KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access Yu-cheng Yu (1): x86/fpu: Revert ("x86/fpu: Disable AVX when eagerfpu is off") yu-cheng yu (3): x86/fpu: Fix early FPU command-line parsing x86/fpu: Disable MPX when eagerfpu is off x86/fpu: Disable AVX when eagerfpu is off signature.asc Description: PGP signature
Re: Linux 4.4.138
diff --git a/Makefile b/Makefile index 44efd1252ab8..1a8c0fc6b997 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 137 +SUBLEVEL = 138 EXTRAVERSION = NAME = Blurry Fish Butt diff --git a/arch/x86/crypto/chacha20_glue.c b/arch/x86/crypto/chacha20_glue.c index 722bacea040e..8baaff5af0b5 100644 --- a/arch/x86/crypto/chacha20_glue.c +++ b/arch/x86/crypto/chacha20_glue.c @@ -125,7 +125,7 @@ static struct crypto_alg alg = { static int __init chacha20_simd_mod_init(void) { - if (!cpu_has_ssse3) + if (!boot_cpu_has(X86_FEATURE_SSSE3)) return -ENODEV; #ifdef CONFIG_AS_AVX2 diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c index 81a595d75cf5..15f5c7675d42 100644 --- a/arch/x86/crypto/crc32c-intel_glue.c +++ b/arch/x86/crypto/crc32c-intel_glue.c @@ -58,16 +58,11 @@ asmlinkage unsigned int crc_pcl(const u8 *buffer, int len, unsigned int crc_init); static int crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_EAGERFPU; -#if defined(X86_FEATURE_EAGER_FPU) #define set_pcl_breakeven_point() \ do { \ if (!use_eager_fpu()) \ crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_NOEAGERFPU; \ } while (0) -#else -#define set_pcl_breakeven_point() \ - (crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_NOEAGERFPU) -#endif #endif /* CONFIG_X86_64 */ static u32 crc32c_intel_le_hw_byte(u32 crc, unsigned char const *data, size_t length) @@ -257,7 +252,7 @@ static int __init crc32c_intel_mod_init(void) if (!x86_match_cpu(crc32c_cpu_id)) return -ENODEV; #ifdef CONFIG_X86_64 - if (cpu_has_pclmulqdq) { + if (boot_cpu_has(X86_FEATURE_PCLMULQDQ)) { alg.update = crc32c_pcl_intel_update; alg.finup = crc32c_pcl_intel_finup; alg.digest = crc32c_pcl_intel_digest; diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h index f7e142926481..e4959d023af8 100644 --- a/arch/x86/include/asm/cmpxchg_32.h +++ b/arch/x86/include/asm/cmpxchg_32.h @@ -109,6 +109,6 @@ static inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 old, u64 new) #endif -#define system_has_cmpxchg_double() cpu_has_cx8 +#define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX8) #endif /* _ASM_X86_CMPXCHG_32_H */ diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h index 1af94697aae5..caa23a34c963 100644 --- a/arch/x86/include/asm/cmpxchg_64.h +++ b/arch/x86/include/asm/cmpxchg_64.h @@ -18,6 +18,6 @@ static inline void set_64bit(volatile u64 *ptr, u64 val) cmpxchg_local((ptr), (o), (n)); \ }) -#define system_has_cmpxchg_double() cpu_has_cx16 +#define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX16) #endif /* _ASM_X86_CMPXCHG_64_H */ diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 641f0f2c2982..232621c5e859 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -104,7 +104,7 @@ #define X86_FEATURE_EXTD_APICID( 3*32+26) /* has extended APICID (8 bits) */ #define X86_FEATURE_AMD_DCM ( 3*32+27) /* multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28) /* APERFMPERF */ -#define X86_FEATURE_EAGER_FPU ( 3*32+29) /* "eagerfpu" Non lazy FPU restore */ +/* free, was #define X86_FEATURE_EAGER_FPU ( 3*32+29) * "eagerfpu" Non lazy FPU restore */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ /* Intel-defined CPU features, CPUID level 0x0001 (ecx), word 4 */ @@ -368,58 +368,29 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; #define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit) #define cpu_has_fpuboot_cpu_has(X86_FEATURE_FPU) -#define cpu_has_de boot_cpu_has(X86_FEATURE_DE) #define cpu_has_pseboot_cpu_has(X86_FEATURE_PSE) #define cpu_has_tscboot_cpu_has(X86_FEATURE_TSC) #define cpu_has_pgeboot_cpu_has(X86_FEATURE_PGE) #define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC) -#define cpu_has_sepboot_cpu_has(X86_FEATURE_SEP) -#define cpu_has_mtrr boot_cpu_has(X86_FEATURE_MTRR) -#define cpu_has_mmxboot_cpu_has(X86_FEATURE_MMX) #define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR) #define cpu_has_xmmboot_cpu_has(X86_FEATURE_XMM) #define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2) -#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3) -#define cpu_has_ssse3 boot_cpu_has(X86_FEATURE_SSSE3) #define cpu_has_aesboot_cpu_has(X86_FEATURE_AES) #define cpu_has_avxboot_cpu_has(X86_FEATURE_AVX) #define cpu_ha
Linux 4.14.50
I'm announcing the release of the 4.14.50 kernel. All users of the 4.14 kernel series must upgrade. The updated 4.14.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.y and can be browsed at the normal kernel.org git web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary thanks, greg k-h Makefile|2 arch/x86/include/asm/kvm_emulate.h |6 arch/x86/kvm/emulate.c | 76 +- arch/x86/kvm/vmx.c | 38 +++-- arch/x86/kvm/x86.c | 53 +-- arch/x86/kvm/x86.h |4 block/blk-zoned.c |8 - drivers/crypto/caam/caamalg.c | 231 ++-- drivers/crypto/caam/caamalg_qi.c| 227 --- drivers/crypto/caam/caampkc.c | 62 drivers/crypto/caam/caampkc.h |8 + drivers/crypto/cavium/zip/common.h | 21 ++ drivers/crypto/cavium/zip/zip_crypto.c | 22 +-- drivers/crypto/cavium/zip/zip_deflate.c |4 drivers/crypto/cavium/zip/zip_inflate.c |4 drivers/crypto/omap-sham.c |2 drivers/crypto/vmx/aes.c|2 drivers/crypto/vmx/aes_cbc.c|3 drivers/crypto/vmx/aes_ctr.c|2 drivers/crypto/vmx/aes_xts.c|2 drivers/crypto/vmx/ghash.c |2 drivers/gpio/gpiolib.c |9 - drivers/input/joystick/xpad.c |2 drivers/input/mouse/elan_i2c_core.c |1 drivers/input/touchscreen/goodix.c |1 drivers/misc/vmw_balloon.c | 23 --- drivers/nfc/pn533/usb.c | 42 - drivers/phy/qualcomm/phy-qcom-qusb2.c |4 drivers/staging/android/ion/ion.c |5 drivers/tty/serial/8250/8250_omap.c | 16 ++ drivers/tty/serial/amba-pl011.c | 16 ++ drivers/tty/serial/atmel_serial.c |5 drivers/tty/serial/samsung.c|7 drivers/tty/serial/sh-sci.c |4 drivers/usb/gadget/function/f_printer.c |6 drivers/usb/gadget/udc/renesas_usb3.c |7 drivers/usb/storage/uas.c |6 drivers/usb/storage/unusual_devs.h |9 + drivers/usb/storage/unusual_uas.h |9 + drivers/usb/usbip/vhci_sysfs.c | 24 ++- net/key/af_key.c| 45 -- net/netfilter/nft_ct.c | 20 +- 42 files changed, 628 insertions(+), 412 deletions(-) Alexander Kappner (2): usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver usb-storage: Add compatibility quirk flags for G-Technologies G-Drive Bart Van Assche (1): blkdev_report_zones_ioctl(): Use vmalloc() to allocate large buffers Bin Liu (1): crypto: omap-sham - fix memleak Dave Martin (1): tty: pl011: Avoid spuriously stuck-off interrupts Ethan Lee (2): Input: xpad - add GPD Win 2 Controller USB IDs Input: goodix - add new ACPI id for GPD Win 2 touch screen Felix Wilhelm (1): kvm: nVMX: Enforce cpl=0 for VMX instructions Geert Uytterhoeven (1): serial: sh-sci: Stop using printk format %pCr Gil Kupfer (1): vmw_balloon: fixing double free when batching mode is off Greg Kroah-Hartman (2): NFC: pn533: don't send USB data off of the stack Linux 4.14.50 Gustavo A. R. Silva (1): usbip: vhci_sysfs: fix potential Spectre v1 Horia Geantă (5): crypto: caam - strip input zeros from RSA input buffer crypto: caam - fix DMA mapping dir for generated IV crypto: caam - fix IV DMA mapping and updating crypto: caam/qi - fix IV DMA mapping and updating crypto: caam - fix size of RSA prime factor q Jan Glauber (2): crypto: cavium - Fix fallout from CONFIG_VMAP_STACK crypto: cavium - Limit result reading attempts Johannes Wienke (1): Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Kevin Easton (1): af_key: Always verify length of provided sadb_key Laura Abbott (1): staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Linus Walleij (1): gpio: No NULL owner Manu Gautam (1): phy: qcom-qusb2: Fix crash if nvmem cell not specified Marek Szyprowski (1): serial: samsung: fix maxburst parameter for DMA transactions Michael Ellerman (2): crypto: vmx - Remove overly verbose printk from AES init routines crypto: vmx - Remove overly verbose printk from AES XTS init Paolo Bonzini (3): KVM: x86: introduce linear_{read,write}_system KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access Sebastian Andrzej Siewior (1): tty/serial: atmel: use port->name as name in request_irq() Taehee Y
Re: Linux 4.14.50
diff --git a/Makefile b/Makefile index 480ae7ef755c..84374c5ba60e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 49 +SUBLEVEL = 50 EXTRAVERSION = NAME = Petit Gorille diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index ee23a43386a2..8493303d8b2e 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h @@ -107,11 +107,12 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address from which to read. * @val: [OUT] Value read from memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to read from memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*read_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, - struct x86_exception *fault); + struct x86_exception *fault, bool system); /* * read_phys: Read bytes of standard (non-emulated/special) memory. @@ -129,10 +130,11 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address to which to write. * @val: [OUT] Value write to memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to write to memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*write_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, -struct x86_exception *fault); +struct x86_exception *fault, bool system); /* * fetch: Read bytes of standard (non-emulated/special) memory. *Used for instruction fetch. diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index fab073b19528..5f758568fc44 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -811,6 +811,19 @@ static inline int jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) return assign_eip_near(ctxt, ctxt->_eip + rel); } +static int linear_read_system(struct x86_emulate_ctxt *ctxt, ulong linear, + void *data, unsigned size) +{ + return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception, true); +} + +static int linear_write_system(struct x86_emulate_ctxt *ctxt, + ulong linear, void *data, + unsigned int size) +{ + return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception, true); +} + static int segmented_read_std(struct x86_emulate_ctxt *ctxt, struct segmented_address addr, void *data, @@ -822,7 +835,7 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt, rc = linearize(ctxt, addr, size, false, &linear); if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception); + return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception, false); } static int segmented_write_std(struct x86_emulate_ctxt *ctxt, @@ -836,7 +849,7 @@ static int segmented_write_std(struct x86_emulate_ctxt *ctxt, rc = linearize(ctxt, addr, size, true, &linear); if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception); + return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception, false); } /* @@ -1509,8 +1522,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, return emulate_gp(ctxt, index << 3 | 0x2); addr = dt.address + index * 8; - return ctxt->ops->read_std(ctxt, addr, desc, sizeof *desc, - &ctxt->exception); + return linear_read_system(ctxt, addr, desc, sizeof *desc); } static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, @@ -1573,8 +1585,7 @@ static int read_segment_descriptor(struct x86_emulate_ctxt *ctxt, if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->read_std(ctxt, *desc_addr_p, desc, sizeof(*desc), - &ctxt->exception); + return linear_read_system(ctxt, *desc_addr_p, desc, sizeof(*desc)); } /* allowed just for 8 bytes segments */ @@ -1588,8 +1599,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt, if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->write_std(ctxt, addr, desc, sizeof *desc, - &ctxt->exception); + return linear_write_system(ctxt, addr, desc, sizeof *desc); } static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, @@ -1750,8 +1760,7 @@ static int __load_segment_descriptor(struct
Linux 4.9.109
I'm announcing the release of the 4.9.109 kernel. All users of the 4.9 kernel series must upgrade. The updated 4.9.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y and can be browsed at the normal kernel.org git web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary thanks, greg k-h Makefile |2 arch/x86/crypto/crc32c-intel_glue.c |5 - arch/x86/include/asm/cpufeatures.h |2 arch/x86/include/asm/fpu/internal.h |2 arch/x86/include/asm/kvm_emulate.h |6 +- arch/x86/kernel/fpu/init.c | 91 +-- arch/x86/kvm/emulate.c | 72 arch/x86/kvm/vmx.c | 23 +++ arch/x86/kvm/x86.c | 51 - arch/x86/kvm/x86.h |4 - drivers/crypto/omap-sham.c |2 drivers/crypto/vmx/aes.c |2 drivers/crypto/vmx/aes_cbc.c |2 drivers/crypto/vmx/aes_ctr.c |2 drivers/crypto/vmx/ghash.c |2 drivers/gpio/gpiolib.c |9 ++- drivers/input/mouse/elan_i2c_core.c |1 drivers/input/touchscreen/goodix.c |1 drivers/misc/vmw_balloon.c | 23 ++- drivers/net/bonding/bond_main.c | 22 --- drivers/nvme/host/pci.c |4 - drivers/nvme/target/admin-cmd.c | 22 --- drivers/nvme/target/core.c |5 - drivers/nvme/target/nvmet.h |2 drivers/staging/android/ion/ion.c|5 + drivers/tty/serial/8250/8250_omap.c | 16 + drivers/tty/serial/amba-pl011.c | 16 + drivers/tty/serial/atmel_serial.c|5 - drivers/tty/serial/samsung.c |7 -- drivers/tty/serial/sh-sci.c |4 - drivers/usb/gadget/udc/renesas_usb3.c|7 ++ drivers/usb/storage/uas.c|6 ++ drivers/usb/storage/unusual_devs.h |9 +++ drivers/usb/storage/unusual_uas.h|9 +++ drivers/usb/usbip/vhci_sysfs.c | 24 +--- include/net/bonding.h|5 + net/key/af_key.c | 45 +++ tools/arch/x86/include/asm/cpufeatures.h |2 38 files changed, 273 insertions(+), 244 deletions(-) Alexander Kappner (2): usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver usb-storage: Add compatibility quirk flags for G-Technologies G-Drive Andreas Born (1): bonding: require speed/duplex only for 802.3ad, alb and tlb Andy Lutomirski (2): x86/fpu: Hard-disable lazy FPU mode x86/crypto, x86/fpu: Remove X86_FEATURE_EAGER_FPU #ifdef from the crc32c code Bin Liu (1): crypto: omap-sham - fix memleak Dave Martin (1): tty: pl011: Avoid spuriously stuck-off interrupts Ethan Lee (1): Input: goodix - add new ACPI id for GPD Win 2 touch screen Geert Uytterhoeven (1): serial: sh-sci: Stop using printk format %pCr Gil Kupfer (1): vmw_balloon: fixing double free when batching mode is off Greg Kroah-Hartman (2): perf: sync up x86/.../cpufeatures.h Linux 4.9.109 Gustavo A. R. Silva (1): usbip: vhci_sysfs: fix potential Spectre v1 Johannes Thumshirn (1): nvmet: Move serial number from controller to subsystem Johannes Wienke (1): Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Keith Busch (1): nvme-pci: initialize queue memory before interrupts Kevin Easton (1): af_key: Always verify length of provided sadb_key Laura Abbott (1): staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Linus Walleij (1): gpio: No NULL owner Mahesh Bandewar (2): bonding: correctly update link status during mii-commit phase bonding: fix active-backup transition Marek Szyprowski (1): serial: samsung: fix maxburst parameter for DMA transactions Martin Wilck (2): nvmet: don't report 0-bytes in serial number nvmet: don't overwrite identify sn/fr with 0-bytes Michael Ellerman (1): crypto: vmx - Remove overly verbose printk from AES init routines Paolo Bonzini (3): KVM: x86: introduce linear_{read,write}_system KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access Sebastian Andrzej Siewior (1): tty/serial: atmel: use port->name as name in request_irq() Tony Lindgren (1): serial: 8250: omap: Fix idling of clocks for unused uarts Yoshihiro Shimoda (1): usb: gadget: udc: renesas_usb3: disable the controller's irqs for reconnecting signature.asc Description: PGP signature
Re: Linux 4.9.109
diff --git a/Makefile b/Makefile index 1fa9daf219c4..1570cc85313d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 108 +SUBLEVEL = 109 EXTRAVERSION = NAME = Roaring Lionus diff --git a/arch/x86/crypto/crc32c-intel_glue.c b/arch/x86/crypto/crc32c-intel_glue.c index 60a391b8c4a2..dd1958436591 100644 --- a/arch/x86/crypto/crc32c-intel_glue.c +++ b/arch/x86/crypto/crc32c-intel_glue.c @@ -58,16 +58,11 @@ asmlinkage unsigned int crc_pcl(const u8 *buffer, int len, unsigned int crc_init); static int crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_EAGERFPU; -#if defined(X86_FEATURE_EAGER_FPU) #define set_pcl_breakeven_point() \ do { \ if (!use_eager_fpu()) \ crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_NOEAGERFPU; \ } while (0) -#else -#define set_pcl_breakeven_point() \ - (crc32c_pcl_breakeven = CRC32C_PCL_BREAKEVEN_NOEAGERFPU) -#endif #endif /* CONFIG_X86_64 */ static u32 crc32c_intel_le_hw_byte(u32 crc, unsigned char const *data, size_t length) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index c278f276c9b3..aea30afeddb8 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -104,7 +104,7 @@ #define X86_FEATURE_EXTD_APICID( 3*32+26) /* has extended APICID (8 bits) */ #define X86_FEATURE_AMD_DCM ( 3*32+27) /* multi-node processor */ #define X86_FEATURE_APERFMPERF ( 3*32+28) /* APERFMPERF */ -#define X86_FEATURE_EAGER_FPU ( 3*32+29) /* "eagerfpu" Non lazy FPU restore */ +/* free, was #define X86_FEATURE_EAGER_FPU ( 3*32+29) * "eagerfpu" Non lazy FPU restore */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ /* Intel-defined CPU features, CPUID level 0x0001 (ecx), word 4 */ diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 2737366ea583..8852e3afa1ad 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -62,7 +62,7 @@ extern u64 fpu__get_supported_xfeatures_mask(void); */ static __always_inline __pure bool use_eager_fpu(void) { - return static_cpu_has(X86_FEATURE_EAGER_FPU); + return true; } static __always_inline __pure bool use_xsaveopt(void) diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index fc3c7e49c8e4..ae357d0afc91 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h @@ -105,11 +105,12 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address from which to read. * @val: [OUT] Value read from memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to read from memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*read_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, - struct x86_exception *fault); + struct x86_exception *fault, bool system); /* * read_phys: Read bytes of standard (non-emulated/special) memory. @@ -127,10 +128,11 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address to which to write. * @val: [OUT] Value write to memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to write to memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*write_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, -struct x86_exception *fault); +struct x86_exception *fault, bool system); /* * fetch: Read bytes of standard (non-emulated/special) memory. *Used for instruction fetch. diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 6f0ab305dd5e..9f3657891b87 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -15,10 +15,7 @@ */ static void fpu__init_cpu_ctx_switch(void) { - if (!boot_cpu_has(X86_FEATURE_EAGER_FPU)) - stts(); - else - clts(); + clts(); } /* @@ -233,42 +230,6 @@ static void __init fpu__init_system_xstate_size_legacy(void) fpu_user_xstate_size = fpu_kernel_xstate_size; } -/* - * FPU context switching strategies: - * - * Against popular belief, we don't do lazy FPU saves, due to the - * task migration complications it brings on SMP - we only do - * lazy FPU restores. - * - * 'lazy' is the traditional strategy, which is based on setting - * CR0::TS to 1 during context-switch (instead of doing a full - * restore of
Linux 4.16.16
I'm announcing the release of the 4.16.16 kernel. All users of the 4.16 kernel series must upgrade. The updated 4.16.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.16.y and can be browsed at the normal kernel.org git web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary thanks, greg k-h Makefile|2 arch/x86/include/asm/kvm_emulate.h |6 arch/x86/kvm/emulate.c | 76 +- arch/x86/kvm/vmx.c | 38 +++-- arch/x86/kvm/x86.c | 53 +-- arch/x86/kvm/x86.h |4 block/blk-zoned.c |8 - drivers/crypto/caam/caamalg.c | 231 ++-- drivers/crypto/caam/caamalg_qi.c| 227 --- drivers/crypto/caam/caampkc.c | 62 drivers/crypto/caam/caampkc.h |8 + drivers/crypto/cavium/zip/common.h | 21 ++ drivers/crypto/cavium/zip/zip_crypto.c | 22 +-- drivers/crypto/cavium/zip/zip_deflate.c |4 drivers/crypto/cavium/zip/zip_inflate.c |4 drivers/crypto/chelsio/chcr_ipsec.c | 35 ++-- drivers/crypto/omap-sham.c |2 drivers/crypto/vmx/aes.c|2 drivers/crypto/vmx/aes_cbc.c|3 drivers/crypto/vmx/aes_ctr.c|2 drivers/crypto/vmx/aes_xts.c|2 drivers/crypto/vmx/ghash.c |2 drivers/input/joystick/xpad.c |2 drivers/input/mouse/elan_i2c_core.c |1 drivers/input/touchscreen/goodix.c |1 drivers/misc/vmw_balloon.c | 23 --- drivers/nfc/pn533/usb.c | 42 - drivers/phy/qualcomm/phy-qcom-qusb2.c |4 drivers/staging/android/ion/ion.c |5 drivers/tty/serial/8250/8250_omap.c | 16 ++ drivers/tty/serial/amba-pl011.c | 16 ++ drivers/tty/serial/atmel_serial.c |5 drivers/tty/serial/samsung.c|7 drivers/tty/serial/sh-sci.c |4 drivers/usb/core/message.c |2 drivers/usb/gadget/function/f_printer.c |6 drivers/usb/gadget/udc/renesas_usb3.c | 37 +++-- drivers/usb/storage/uas.c |6 drivers/usb/storage/unusual_devs.h |9 + drivers/usb/storage/unusual_uas.h |9 + drivers/usb/typec/typec_wcove.c | 30 +++- drivers/usb/usbip/vhci_sysfs.c | 24 ++- net/key/af_key.c| 45 -- net/netfilter/nft_ct.c | 20 +- 44 files changed, 685 insertions(+), 443 deletions(-) Alexander Kappner (2): usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver usb-storage: Add compatibility quirk flags for G-Technologies G-Drive Atul Gupta (1): crypto: chelsio - request to HW should wrap Bart Van Assche (1): blkdev_report_zones_ioctl(): Use vmalloc() to allocate large buffers Bin Liu (1): crypto: omap-sham - fix memleak Dave Martin (1): tty: pl011: Avoid spuriously stuck-off interrupts Ethan Lee (2): Input: xpad - add GPD Win 2 Controller USB IDs Input: goodix - add new ACPI id for GPD Win 2 touch screen Felix Wilhelm (1): kvm: nVMX: Enforce cpl=0 for VMX instructions Geert Uytterhoeven (1): serial: sh-sci: Stop using printk format %pCr Gil Kupfer (1): vmw_balloon: fixing double free when batching mode is off Greg Kroah-Hartman (2): NFC: pn533: don't send USB data off of the stack Linux 4.16.16 Gustavo A. R. Silva (1): usbip: vhci_sysfs: fix potential Spectre v1 Heikki Krogerus (1): usb: typec: wcove: Remove dependency on HW FSM Horia Geantă (5): crypto: caam - strip input zeros from RSA input buffer crypto: caam - fix DMA mapping dir for generated IV crypto: caam - fix IV DMA mapping and updating crypto: caam/qi - fix IV DMA mapping and updating crypto: caam - fix size of RSA prime factor q Jan Glauber (2): crypto: cavium - Fix fallout from CONFIG_VMAP_STACK crypto: cavium - Limit result reading attempts Johannes Wienke (1): Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Kevin Easton (1): af_key: Always verify length of provided sadb_key Laura Abbott (1): staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Manu Gautam (1): phy: qcom-qusb2: Fix crash if nvmem cell not specified Marek Szyprowski (1): serial: samsung: fix maxburst parameter for DMA transactions Michael Ellerman (2): crypto: vmx - Remove overly verbose printk from AES init routines crypto: vmx - Remove overly verbose printk from AES XTS init Paolo Bonzini (3): KVM: x86: introduce linear_{read,write}_system KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_writ
Re: Linux 4.16.16
diff --git a/Makefile b/Makefile index e45c66b27241..4f392115 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 16 -SUBLEVEL = 15 +SUBLEVEL = 16 EXTRAVERSION = NAME = Fearless Coyote diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index b24b1c8b3979..0f82cd91cd3c 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h @@ -107,11 +107,12 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address from which to read. * @val: [OUT] Value read from memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to read from memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*read_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, - struct x86_exception *fault); + struct x86_exception *fault, bool system); /* * read_phys: Read bytes of standard (non-emulated/special) memory. @@ -129,10 +130,11 @@ struct x86_emulate_ops { * @addr: [IN ] Linear address to which to write. * @val: [OUT] Value write to memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to write to memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*write_std)(struct x86_emulate_ctxt *ctxt, unsigned long addr, void *val, unsigned int bytes, -struct x86_exception *fault); +struct x86_exception *fault, bool system); /* * fetch: Read bytes of standard (non-emulated/special) memory. *Used for instruction fetch. diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d91eaeb01034..defbce750e7c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -811,6 +811,19 @@ static inline int jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) return assign_eip_near(ctxt, ctxt->_eip + rel); } +static int linear_read_system(struct x86_emulate_ctxt *ctxt, ulong linear, + void *data, unsigned size) +{ + return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception, true); +} + +static int linear_write_system(struct x86_emulate_ctxt *ctxt, + ulong linear, void *data, + unsigned int size) +{ + return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception, true); +} + static int segmented_read_std(struct x86_emulate_ctxt *ctxt, struct segmented_address addr, void *data, @@ -822,7 +835,7 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt, rc = linearize(ctxt, addr, size, false, &linear); if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception); + return ctxt->ops->read_std(ctxt, linear, data, size, &ctxt->exception, false); } static int segmented_write_std(struct x86_emulate_ctxt *ctxt, @@ -836,7 +849,7 @@ static int segmented_write_std(struct x86_emulate_ctxt *ctxt, rc = linearize(ctxt, addr, size, true, &linear); if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception); + return ctxt->ops->write_std(ctxt, linear, data, size, &ctxt->exception, false); } /* @@ -1495,8 +1508,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, return emulate_gp(ctxt, index << 3 | 0x2); addr = dt.address + index * 8; - return ctxt->ops->read_std(ctxt, addr, desc, sizeof *desc, - &ctxt->exception); + return linear_read_system(ctxt, addr, desc, sizeof *desc); } static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, @@ -1559,8 +1571,7 @@ static int read_segment_descriptor(struct x86_emulate_ctxt *ctxt, if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->read_std(ctxt, *desc_addr_p, desc, sizeof(*desc), - &ctxt->exception); + return linear_read_system(ctxt, *desc_addr_p, desc, sizeof(*desc)); } /* allowed just for 8 bytes segments */ @@ -1574,8 +1585,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt, if (rc != X86EMUL_CONTINUE) return rc; - return ctxt->ops->write_std(ctxt, addr, desc, sizeof *desc, - &ctxt->exception); + return linear_write_system(ctxt, addr, desc, sizeof *desc); } static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, @@ -1736,8 +1746,7 @@ static int __load_segment_descriptor(stru
Linux 4.17.2
I'm announcing the release of the 4.17.2 kernel. All users of the 4.17 kernel series must upgrade. The updated 4.17.y git tree can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.17.y and can be browsed at the normal kernel.org git web browser: http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary thanks, greg k-h Documentation/ABI/stable/sysfs-bus-vmbus | 40 ++--- Makefile |2 arch/arm64/configs/defconfig |1 arch/x86/include/asm/kvm_emulate.h |6 arch/x86/kvm/emulate.c | 76 +- arch/x86/kvm/vmx.c | 38 +++-- arch/x86/kvm/x86.c | 61 +--- arch/x86/kvm/x86.h |4 block/blk-zoned.c|8 - drivers/crypto/caam/caamalg.c| 231 +-- drivers/crypto/caam/caamalg_qi.c | 227 +++--- drivers/crypto/caam/caampkc.c| 62 +++- drivers/crypto/caam/caampkc.h|8 + drivers/crypto/cavium/zip/common.h | 21 ++ drivers/crypto/cavium/zip/zip_crypto.c | 22 +- drivers/crypto/cavium/zip/zip_deflate.c |4 drivers/crypto/cavium/zip/zip_inflate.c |4 drivers/crypto/ccree/cc_debugfs.c|7 drivers/crypto/ccree/cc_driver.c |8 - drivers/crypto/ccree/cc_driver.h |2 drivers/crypto/ccree/cc_host_regs.h |6 drivers/crypto/chelsio/chcr_ipsec.c | 35 ++-- drivers/crypto/omap-sham.c |2 drivers/crypto/vmx/aes.c |2 drivers/crypto/vmx/aes_cbc.c |3 drivers/crypto/vmx/aes_ctr.c |2 drivers/crypto/vmx/aes_xts.c |2 drivers/crypto/vmx/ghash.c |2 drivers/input/joystick/xpad.c|2 drivers/input/mouse/elan_i2c_core.c |1 drivers/input/touchscreen/goodix.c |1 drivers/misc/vmw_balloon.c | 23 --- drivers/nfc/pn533/usb.c | 42 - drivers/phy/qualcomm/phy-qcom-qusb2.c|4 drivers/staging/android/ion/ion.c|5 drivers/tty/serial/8250/8250_omap.c | 16 ++ drivers/tty/serial/amba-pl011.c | 16 ++ drivers/tty/serial/atmel_serial.c|5 drivers/tty/serial/samsung.c |7 drivers/tty/serial/sh-sci.c |4 drivers/usb/core/message.c |2 drivers/usb/gadget/function/f_printer.c |6 drivers/usb/gadget/udc/renesas_usb3.c| 37 +++- drivers/usb/storage/uas.c|6 drivers/usb/storage/unusual_devs.h |9 + drivers/usb/storage/unusual_uas.h|9 + drivers/usb/typec/typec_wcove.c | 30 +++- drivers/usb/usbip/vhci_sysfs.c | 24 ++- include/uapi/linux/kvm.h |4 tools/include/uapi/linux/kvm.h |4 50 files changed, 684 insertions(+), 459 deletions(-) Alexander Kappner (2): usb-storage: Add support for FL_ALWAYS_SYNC flag in the UAS driver usb-storage: Add compatibility quirk flags for G-Technologies G-Drive Atul Gupta (1): crypto: chelsio - request to HW should wrap Bart Van Assche (1): blkdev_report_zones_ioctl(): Use vmalloc() to allocate large buffers Bin Liu (1): crypto: omap-sham - fix memleak Dave Martin (1): tty: pl011: Avoid spuriously stuck-off interrupts Ethan Lee (2): Input: xpad - add GPD Win 2 Controller USB IDs Input: goodix - add new ACPI id for GPD Win 2 touch screen Felix Wilhelm (1): kvm: nVMX: Enforce cpl=0 for VMX instructions Geert Uytterhoeven (1): serial: sh-sci: Stop using printk format %pCr Gil Kupfer (1): vmw_balloon: fixing double free when batching mode is off Gilad Ben-Yossef (1): crypto: ccree - correct host regs offset Greg Kroah-Hartman (2): NFC: pn533: don't send USB data off of the stack Linux 4.17.2 Gustavo A. R. Silva (1): usbip: vhci_sysfs: fix potential Spectre v1 Heikki Krogerus (1): usb: typec: wcove: Remove dependency on HW FSM Horia Geantă (5): crypto: caam - strip input zeros from RSA input buffer crypto: caam - fix DMA mapping dir for generated IV crypto: caam - fix IV DMA mapping and updating crypto: caam/qi - fix IV DMA mapping and updating crypto: caam - fix size of RSA prime factor q Jan Glauber (2): crypto: cavium - Fix fallout from CONFIG_VMAP_STACK crypto: cavium - Limit result reading attempts Johannes Wienke (1): Input: elan_i2c - add ELAN0612 (Lenovo v330 14IKB) ACPI ID Laura Abbott (1): staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy Manu Gautam (1): phy: qcom-qusb2: Fix crash if nvmem cell not specified Marek Szyprowski (1): serial: samsung: fix maxburst
Re: Linux 4.17.2
diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus b/Documentation/ABI/stable/sysfs-bus-vmbus index 0c9d9dcd2151..3eaffbb2d468 100644 --- a/Documentation/ABI/stable/sysfs-bus-vmbus +++ b/Documentation/ABI/stable/sysfs-bus-vmbus @@ -1,25 +1,25 @@ -What: /sys/bus/vmbus/devices/vmbus_*/id +What: /sys/bus/vmbus/devices//id Date: Jul 2009 KernelVersion: 2.6.31 Contact: K. Y. Srinivasan Description: The VMBus child_relid of the device's primary channel Users: tools/hv/lsvmbus -What: /sys/bus/vmbus/devices/vmbus_*/class_id +What: /sys/bus/vmbus/devices//class_id Date: Jul 2009 KernelVersion: 2.6.31 Contact: K. Y. Srinivasan Description: The VMBus interface type GUID of the device Users: tools/hv/lsvmbus -What: /sys/bus/vmbus/devices/vmbus_*/device_id +What: /sys/bus/vmbus/devices//device_id Date: Jul 2009 KernelVersion: 2.6.31 Contact: K. Y. Srinivasan Description: The VMBus interface instance GUID of the device Users: tools/hv/lsvmbus -What: /sys/bus/vmbus/devices/vmbus_*/channel_vp_mapping +What: /sys/bus/vmbus/devices//channel_vp_mapping Date: Jul 2015 KernelVersion: 4.2.0 Contact: K. Y. Srinivasan @@ -28,112 +28,112 @@ Description: The mapping of which primary/sub channels are bound to which Format: Users: tools/hv/lsvmbus -What: /sys/bus/vmbus/devices/vmbus_*/device +What: /sys/bus/vmbus/devices//device Date: Dec. 2015 KernelVersion: 4.5 Contact: K. Y. Srinivasan Description: The 16 bit device ID of the device Users: tools/hv/lsvmbus and user level RDMA libraries -What: /sys/bus/vmbus/devices/vmbus_*/vendor +What: /sys/bus/vmbus/devices//vendor Date: Dec. 2015 KernelVersion: 4.5 Contact: K. Y. Srinivasan Description: The 16 bit vendor ID of the device Users: tools/hv/lsvmbus and user level RDMA libraries -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN +What: /sys/bus/vmbus/devices//channels/ Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Directory for per-channel information NN is the VMBUS relid associtated with the channel. -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/cpu +What: /sys/bus/vmbus/devices//channels//cpu Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: VCPU (sub)channel is affinitized to Users: tools/hv/lsvmbus and other debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/cpu +What: /sys/bus/vmbus/devices//channels//cpu Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: VCPU (sub)channel is affinitized to Users: tools/hv/lsvmbus and other debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/in_mask +What: /sys/bus/vmbus/devices//channels//in_mask Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Host to guest channel interrupt mask Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/latency +What: /sys/bus/vmbus/devices//channels//latency Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Channel signaling latency Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/out_mask +What: /sys/bus/vmbus/devices//channels//out_mask Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Guest to host channel interrupt mask Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/pending +What: /sys/bus/vmbus/devices//channels//pending Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Channel interrupt pending state Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/read_avail +What: /sys/bus/vmbus/devices//channels//read_avail Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Bytes available to read Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/write_avail +What: /sys/bus/vmbus/devices//channels//write_avail Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemminger Description: Bytes available to write Users: Debugging tools -What: /sys/bus/vmbus/devices/vmbus_*/channels/NN/events +What: /sys/bus/vmbus/devices//channels//events Date: September. 2017 KernelVersion: 4.14 Contact: Stephen Hemmi
Re: Recall: PROBLEM: JFFS2 Empty summary info causes OOPS
> On Fri, Jun 15, 2018 at 9:13 PM, Veluthakkal, Sreeram > wrote: >> Veluthakkal, Sreeram would like to recall the message, "PROBLEM: JFFS2 >> Empty summary info causes OOPS". > > -ENOMSEXCHANGE Nom sex change? Oh, I see. No, it never works in Exchange either AFAICT. Only ever serves to draw attention to the "recalled" mail and make more people read it. Perhaps that was the intent? :) -- dwmw2
Re: can we drop the comedi serial2002 drivers from staging?
On Sat, Jun 16, 2018 at 11:06:45AM +0200, Christoph Hellwig wrote: > As far as I can tell there has been no targeted work on the driver > since merging it at all, and since 2014 even the comedi-wide > cleanups stopped, laving just drive by tree wide changes since. > > At the same time the driver badly abuses the tty layer and is one > of only two major abusers of the poll code for in-kernel waits. Yeah, it's an ugly driver. It should be rewritten to use the new serdev api instead of trying to open a tty device node from within the kernel. I don't object to dropping it. Ian and Hartley, do you know of any users of this driver anymore? thanks, greg k-h
can we drop the comedi serial2002 drivers from staging?
As far as I can tell there has been no targeted work on the driver since merging it at all, and since 2014 even the comedi-wide cleanups stopped, laving just drive by tree wide changes since. At the same time the driver badly abuses the tty layer and is one of only two major abusers of the poll code for in-kernel waits.
Re: [PATCH v2] sysfs: Fix internal_create_group() for named group updates
On Sat, Jun 16, 2018 at 01:18:37AM -0700, Rajat Jain wrote: > There are a couple of problems with named group updates in the code > today: > > * sysfs_update_group() will always fail for a named group, because > internal_create_group() will try to create a new sysfs directory > unconditionally, which will ofcourse fail with -EEXIST. > > * We can leak the kernfs_node for grp->name if some one tries to: > - rename a group (change grp->name), or > - update a named group, to an unnamed group > > It appears that the whole purpose of sysfs_update_group() was to > allow changing the permissions or visibility of attributes and not > the names. So make it clear in the comments, and allow it to update > an existing named group. > > Signed-off-by: Rajat Jain > --- > v2: Use pr_warn() instead of WARN() Looks good, I'll queue it up after 4.18-rc1 is out, thanks for the update so quickly. greg k-h
Re: Recall: PROBLEM: JFFS2 Empty summary info causes OOPS
On Fri, Jun 15, 2018 at 9:13 PM, Veluthakkal, Sreeram wrote: > Veluthakkal, Sreeram would like to recall the message, "PROBLEM: JFFS2 Empty > summary info causes OOPS". -ENOMSEXCHANGE -- Thanks, //richard
[PATCH v2] sysfs: Fix internal_create_group() for named group updates
There are a couple of problems with named group updates in the code today: * sysfs_update_group() will always fail for a named group, because internal_create_group() will try to create a new sysfs directory unconditionally, which will ofcourse fail with -EEXIST. * We can leak the kernfs_node for grp->name if some one tries to: - rename a group (change grp->name), or - update a named group, to an unnamed group It appears that the whole purpose of sysfs_update_group() was to allow changing the permissions or visibility of attributes and not the names. So make it clear in the comments, and allow it to update an existing named group. Signed-off-by: Rajat Jain --- v2: Use pr_warn() instead of WARN() fs/sysfs/group.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 4802ec0e1e3a..2b7d3536e6cb 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -119,12 +119,22 @@ static int internal_create_group(struct kobject *kobj, int update, return -EINVAL; } if (grp->name) { - kn = kernfs_create_dir(kobj->sd, grp->name, - S_IRWXU | S_IRUGO | S_IXUGO, kobj); - if (IS_ERR(kn)) { - if (PTR_ERR(kn) == -EEXIST) - sysfs_warn_dup(kobj->sd, grp->name); - return PTR_ERR(kn); + if (update) { + kn = kernfs_find_and_get(kobj->sd, grp->name); + if (!kn) { + pr_warn("Can't update unknown attr grp name: %s/%s\n", + kobj->name, grp->name); + return -EINVAL; + } + } else { + kn = kernfs_create_dir(kobj->sd, grp->name, + S_IRWXU | S_IRUGO | S_IXUGO, + kobj); + if (IS_ERR(kn)) { + if (PTR_ERR(kn) == -EEXIST) + sysfs_warn_dup(kobj->sd, grp->name); + return PTR_ERR(kn); + } } } else kn = kobj->sd; @@ -199,7 +209,8 @@ EXPORT_SYMBOL_GPL(sysfs_create_groups); * of the attribute files being created already exist. Furthermore, * if the visibility of the files has changed through the is_visible() * callback, it will update the permissions and add or remove the - * relevant files. + * relevant files. Changing a group's name (subdirectory name under + * kobj's directory in sysfs) is not allowed. * * The primary use for this function is to call it after making a change * that affects group visibility. -- 2.18.0.rc1.244.gcf134e6275-goog
Re: [PATCH v4] staging: rtl8192u: add error handling for usb_alloc_urb
I was actually OK with v1 on the theory that everything else leaked and so this didn't really introduce anything new... :P On Sat, Jun 16, 2018 at 10:01:22AM +0800, Zhouyang Jia wrote: > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -1639,8 +1639,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff > *skb) > static short rtl8192_usb_initendpoints(struct net_device *dev) > { > struct r8192_priv *priv = ieee80211_priv(dev); > + int i; > > - priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), > + priv->rx_urb = kcalloc(MAX_RX_URB + 1, sizeof(struct urb *), > GFP_KERNEL); > if (!priv->rx_urb) > return -ENOMEM; > @@ -1649,12 +1650,12 @@ static short rtl8192_usb_initendpoints(struct > net_device *dev) > for (i = 0; i < (MAX_RX_URB + 1); i++) { > priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); > if (!priv->rx_urb[i]) > - return -ENOMEM; > + goto out_release_mem; > > priv->rx_urb[i]->transfer_buffer = > kmalloc(RX_URB_SIZE, GFP_KERNEL); You need to free priv->rx_urb[i]->transfer_buffer as well and there are several other resources which are also not freed. regards, dan carpenter
Re: [PATCH] sysfs: Fix internal_create_group() for named group updates
Hi Greg, Thanks for your review. On Sat, Jun 16, 2018 at 12:11 AM, Greg Kroah-Hartman wrote: > On Fri, Jun 15, 2018 at 06:29:10PM -0700, Rajat Jain wrote: >> There are a couple of problems with named group updates in the code >> today: >> >> * sysfs_update_group() will always fail for a named group, because >> internal_create_group() will try to create a new sysfs directory >> unconditionally, which will ofcourse fail with -EEXIST. >> >> * We can leak the kernfs_node for grp->name if some one tries to: >> - rename a group (change grp->name), or >> - update a named group, to an unnamed group >> >> It appears that the whole purpose of sysfs_update_group() was to >> allow changing the permissions or visibility of attributes and not >> the names. So make it clear in the comments, and allow it to update >> an existing named group. > > Who uses sysfs_update_group() today that has these problems? Or do you > want to use it in new code? How can it be broken today so badly that it > does not work? Sorry, my bad, I need to provide more clarification: None of the existing users of this API use it on a named attribute group, thus will not see this issue. I hit this issue while writing new code (However, since then my code logic has changed so that it does not need to use this API anymore). I'm just trying to fix an issue with this API, that I stumbled upon, which might be seen in future by any new code that uses this API with named attribute groups. At the minimum, I think we should clarify in comments (or better yet, ensure) that this API cannot be misused. > >> Signed-off-by: Rajat Jain >> --- >> fs/sysfs/group.c | 26 +++--- >> 1 file changed, 19 insertions(+), 7 deletions(-) >> >> diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c >> index 4802ec0e1e3a..8bd10dc730ae 100644 >> --- a/fs/sysfs/group.c >> +++ b/fs/sysfs/group.c >> @@ -119,12 +119,23 @@ static int internal_create_group(struct kobject *kobj, >> int update, >> return -EINVAL; >> } >> if (grp->name) { >> - kn = kernfs_create_dir(kobj->sd, grp->name, >> -S_IRWXU | S_IRUGO | S_IXUGO, kobj); >> - if (IS_ERR(kn)) { >> - if (PTR_ERR(kn) == -EEXIST) >> - sysfs_warn_dup(kobj->sd, grp->name); >> - return PTR_ERR(kn); >> + if (update) { >> + kn = kernfs_find_and_get(kobj->sd, grp->name); >> + if (!kn) { >> + WARN(1, >> + "Can't update unknown attr grp name: >> %s/%s\n", >> + kobj->name, grp->name); >> + return -EINVAL; > > This is going to cause the syzbot to bug the heck out of us, as people > do run with panic-on-warning. Just make this a "normal" error message > and dump the stack if you want that. Agreed, I will turn into a normal error. > > But maybe we should just get rid of this function entirely, it feels > very ackward and I can't remember why we added it... There are a couple of existing in-tree users of this API, and I do not understand a lot about that code. Thanks & Best Regards, Rajat > > thanks, > > greg k-h
Re: [PATCH v2 6/7] vmw_balloon: update copyright message
On Fri, Jun 15, 2018 at 08:38:57PM +, Nadav Amit wrote: > at 1:35 PM, valdis.kletni...@vt.edu wrote: > > > On Thu, 14 Jun 2018 05:33:46 -, Nadav Amit said: > > > In addition, updating the year and adding a license tag. > > > +// SPDX-License-Identifier: GPL-2.0 > > > >>> You still have a lot of boiler-plate text in here that can be removed. > >>> Please do so. > > > >> But what else do you want me to remove? This is a standard GPL license. If > >> I > >> am required to remove the GPL license, I will have to run checks to ensure > >> it is appropriate. > > > > You mean the checks that you should have done when you stuck the SPDX > > tag on the file? > > > > (Hint: Think of the SPDX tag as a '#include gplv2.license.blurb" :) > > I matched the SPDX to the license we have, tut I don’t know whether my > company regards an SPDX tag as a sufficient means to protect copyrights, > which allows to remove all the rest of the text. Copyrights have nothing to do with SPDX lines, please don't get copyrights and licenses confused, they are two totally different things. Removing the license boilerplate and only using a SPDX line for the license marking does not change the copyright of a file at all. And if you use the correct SPDX line, it will not change the license of the file at all either. If your company's lawyers have any questions about this, I am glad to discuss this with them and point them at the lawyers that created the SPDX group. But really, your company lawyers already know all about this, you should not have any problems at all. If you are worried about this, please contact your open source group and they will be glad to help out. I have names if you want me to send them to you off-list :) thanks, greg k-h
[PATCH] MIPS: Octeon: add missing of_node_put()
The call to of_find_node_by_name inside the do-while-loop is returning node with refcount incremented thus it must be explicitly decremented here after usage. Signed-off-by: Nicholas Mc Guire commit 93e502b3c2d4 ("MIPS: OCTEON: Platform support for OCTEON III USB controller") --- Problem located by an experimental coccinelle script Patch was compile tested with: cavium_octeon_defconfig (implies CONFIG_USB=y) (with a number of sparse warnings - not related to the proposed change) Patch is against 4.17.0 (localversion-next is next-20180614) arch/mips/cavium-octeon/octeon-usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c index bfdfaf3..76e06b4 100644 --- a/arch/mips/cavium-octeon/octeon-usb.c +++ b/arch/mips/cavium-octeon/octeon-usb.c @@ -512,6 +512,7 @@ static int __init dwc3_octeon_device_init(void) if (of_device_is_compatible(node, compat_node_name)) { pdev = of_find_device_by_node(node); + of_node_put(node); if (!pdev) return -ENODEV; -- 2.1.4
[PATCH] MIPS: Octeon: assign bool true/false not 1/0
Booleans should be assigned true/false not 1/0 as comparison is not needed Signed-off-by: Nicholas Mc Guire --- Problem located by scripts/coccinelle/misc/boolinit.cocci ./arch/mips/cavium-octeon/octeon-irq.c:817:3-13: WARNING: Assignment of bool to 0/1 Patch was compile tested with: cavium_octeon_defconfig (with a number of sparse warnings - not related to the proposed change) Patch is against 4.17.0 (localversion-next is next-20180614) arch/mips/cavium-octeon/octeon-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index b3aec10..31be6a9 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -814,7 +814,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data, pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); if (cpumask_test_cpu(cpu, dest) && enable_one) { - enable_one = 0; + enable_one = false; __set_bit(cd->bit, pen); } else { __clear_bit(cd->bit, pen); -- 2.1.4