Re: [PATCH 4.9 00/16] 4.9.245-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Sat, Nov 21, 2020 at 10:34:46AM -0800, Guenter Roeck wrote:
> On Fri, Nov 20, 2020 at 12:03:05PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.9.245 release.
> > There are 16 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 168 pass: 166 fail: 2
> Failed builds:
>   powerpc:cell_defconfig
>   powerpc:maple_defconfig
> Qemu test results:
>   total: 382 pass: 377 fail: 5
> Failed tests:
>   ppc64:mac99:ppc64_book3s_defconfig:smp:initrd
>   ppc64:mac99:ppc64_book3s_defconfig:smp:ide:rootfs
>   ppc64:mac99:ppc64_book3s_defconfig:smp:sdhci:mmc:rootfs
>   ppc64:mac99:ppc64_book3s_defconfig:smp:nvme:rootfs
>   ppc64:mac99:ppc64_book3s_defconfig:smp:scsi[DC395]:rootfs
> 
> Build failures see below. Note that the failures are different than the
> failures observed in the v4.4.y release candidate, meaning that some
> additional errors may not be reported.
> 
> Tested-by: Guenter Roeck 
> 
> Guenter
> 
> ---
> Building powerpc:cell_defconfig ... failed
> --
> Error log:
> In file included from arch/powerpc/include/asm/kup.h:10:0,
>  from arch/powerpc/include/asm/uaccess.h:12,
>  from arch/powerpc/lib/checksum_wrappers.c:24:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: data definition 
> has no type or storage class [-Werror]
>  DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
>  ^~~~
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: type defaults to 
> ‘int’ in declaration of ‘DECLARE_STATIC_KEY_FALSE’ [-Werror=implicit-int]
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: parameter names 
> (without types) in function declaration [-Werror]
> arch/powerpc/include/asm/book3s/64/kup-radix.h: In function 
> ‘prevent_user_access’:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:6: error: implicit 
> declaration of function ‘static_branch_unlikely’ 
> [-Werror=implicit-function-declaration]
>   if (static_branch_unlikely(_flush_key))
>   ^~
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:30: error: 
> ‘uaccess_flush_key’ undeclared (first use in this function); did you mean 
> ‘do_uaccess_flush’?
>   if (static_branch_unlikely(_flush_key))
>   ^
>   do_uaccess_flush
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:30: note: each undeclared 
> identifier is reported only once for each function it appears in
> cc1: all warnings being treated as errors
> make[2]: *** [arch/powerpc/lib/checksum_wrappers.o] Error 1
> make[2]: *** Waiting for unfinished jobs
> make[2]: *** wait: No child processes.  Stop.
> make[1]: *** [arch/powerpc/lib] Error 2
> make[1]: *** Waiting for unfinished jobs
> In file included from arch/powerpc/include/asm/kup.h:10:0,
>  from arch/powerpc/include/asm/uaccess.h:12,
>  from arch/powerpc/platforms/cell/spufs/syscalls.c:8:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: data definition 
> has no type or storage class [-Werror]
>  DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
>  ^~~~
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: type defaults to 
> ‘int’ in declaration of ‘DECLARE_STATIC_KEY_FALSE’ [-Werror=implicit-int]
> arch/powerpc/include/asm/book3s/64/kup-radix.h:5:1: error: parameter names 
> (without types) in function declaration [-Werror]
> arch/powerpc/include/asm/book3s/64/kup-radix.h: In function 
> ‘prevent_user_access’:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:6: error: implicit 
> declaration of function ‘static_branch_unlikely’ 
> [-Werror=implicit-function-declaration]
>   if (static_branch_unlikely(_flush_key))
>   ^~
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:30: error: 
> ‘uaccess_flush_key’ undeclared (first use in this function); did you mean 
> ‘do_uaccess_flush’?
>   if (static_branch_unlikely(_flush_key))
>   ^
>   do_uaccess_flush
> arch/powerpc/include/asm/book3s/64/kup-radix.h:18:30: note: each undeclared 
> identifier is reported only once for each function it appears in
> cc1: all warnings being treated as errors
> make[4]: *** [arch/powerpc/platforms/cell/spufs/syscalls.o] Error 1
> make[4]: *** Waiting for unfinished jobs
> In file included from arch/powerpc/include/asm/kup.h:10:0,
>  from arch/powerpc/include/asm/uaccess.h:12,
>  from include/linux/uaccess.h:8,
>  from include/linux/crypto.h:26,
>  from crypto/cipher.c:17:
> 

Re: [PATCH 4.4 00/15] 4.4.245-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Sat, Nov 21, 2020 at 10:29:03AM -0800, Guenter Roeck wrote:
> On Fri, Nov 20, 2020 at 12:02:58PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.4.245 release.
> > There are 15 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> > 
> Build results:
>   total: 165 pass: 164 fail: 1
> Failed builds:
>   powerpc:ppc64e_defconfig
> Qemu test results:
>   total: 328 pass: 323 fail: 5
> Failed tests:
>   ppc64:ppce500:corenet64_smp_defconfig:e5500:initrd
>   ppc64:ppce500:corenet64_smp_defconfig:e5500:nvme:rootfs
>   ppc64:ppce500:corenet64_smp_defconfig:e5500:sdhci:mmc:rootfs
>   ppc64:ppce500:corenet64_smp_defconfig:e5500:scsi[53C895A]:rootfs
>   ppc64:ppce500:corenet64_smp_defconfig:e5500:sata-sii3112:rootfs 
> 
> Failure in all cases is:
> 
> In file included from arch/powerpc/kernel/ppc_ksyms.c:10:0:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:11:29: error: redefinition of 
> ‘allow_user_access’
>  static __always_inline void allow_user_access(void __user *to, const void 
> __user *from,
>  ^
> In file included from arch/powerpc/include/asm/uaccess.h:12:0,
>  from arch/powerpc/kernel/ppc_ksyms.c:8:
> arch/powerpc/include/asm/kup.h:12:20: note: previous definition of 
> ‘allow_user_access’ was here
>  static inline void allow_user_access(void __user *to, const void __user 
> *from,
> ^
> In file included from arch/powerpc/kernel/ppc_ksyms.c:10:0:
> arch/powerpc/include/asm/book3s/64/kup-radix.h:16:20: error: redefinition of 
> ‘prevent_user_access’
>  static inline void prevent_user_access(void __user *to, const void __user 
> *from,
> ^~~
> In file included from arch/powerpc/include/asm/uaccess.h:12:0,
>  from arch/powerpc/kernel/ppc_ksyms.c:8:
> arch/powerpc/include/asm/kup.h:14:20: note: previous definition of 
> ‘prevent_user_access’ was here
>  static inline void prevent_user_access(void __user *to, const void __user 
> *from,
> ^~~
> 
> Tested-by: Guenter Roeck 

Thanks for testing these.

Daniel, looks like your patches broke some configurations on powerpc as
shown above.  Care to send a fix-up patch for these?

thanks,

greg k-h


[PATCH net-next 0/3] net: ptp: use common defines for PTP message types in further drivers

2020-11-22 Thread Christian Eggers
This series replaces further driver internal enumeration / uses of magic
numbers with the newly introduced PTP_MSGTYPE_* defines.

On Friday, 20 November 2020, 23:39:10 CET, Vladimir Oltean wrote:
> On Fri, Nov 20, 2020 at 09:41:03AM +0100, Christian Eggers wrote:
> > This series introduces commen defines for PTP event messages. Driver
> > internal defines are removed and some uses of magic numbers are replaced
> > by the new defines.
> > [...]
> 
> I understand that you don't want to spend a lifetime on this, but I see
> that there are more drivers which you did not touch.
> 
> is_sync() in drivers/net/phy/dp83640.c can be made to
>   return ptp_get_msgtype(hdr, type) == PTP_MSGTYPE_SYNC;
> 
> this can be removed from drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h:
> enum {
>   MLXSW_SP_PTP_MESSAGE_TYPE_SYNC,
>   MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ,
>   MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ,
>   MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP,
> };
I think that I have found an addtional one in the Microsemi VSC85xx PHY driver.





[PATCH net-next 1/3] net: phy: dp83640: use new PTP_MSGTYPE_SYNC define

2020-11-22 Thread Christian Eggers
Replace use of magic number with recently introduced define.

Signed-off-by: Christian Eggers 
Cc: Kurt Kanzenbach 
---
 drivers/net/phy/dp83640.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index f2caccaf4408..9757ca0d9633 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -964,15 +964,12 @@ static void decode_status_frame(struct dp83640_private 
*dp83640,
 static int is_sync(struct sk_buff *skb, int type)
 {
struct ptp_header *hdr;
-   u8 msgtype;
 
hdr = ptp_parse_header(skb, type);
if (!hdr)
return 0;
 
-   msgtype = ptp_get_msgtype(hdr, type);
-
-   return (msgtype & 0xf) == 0;
+   return ptp_get_msgtype(hdr, type) == PTP_MSGTYPE_SYNC;
 }
 
 static void dp83640_free_clocks(void)
-- 
Christian Eggers
Embedded software developer



[PATCH net-next 2/3] mlxsw: spectrum_ptp: use PTP wide message type definitions

2020-11-22 Thread Christian Eggers
Use recently introduced PTP wide defines instead of a driver internal
enumeration.

Signed-off-by: Christian Eggers 
Cc: Petr Machata 
Cc: Jiri Pirko 
Cc: Ido Schimmel 
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 8 
 drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h | 7 ---
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
index ca8090a28dec..d6e9ecb14681 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
@@ -828,10 +828,10 @@ struct mlxsw_sp_ptp_state *mlxsw_sp1_ptp_init(struct 
mlxsw_sp *mlxsw_sp)
goto err_hashtable_init;
 
/* Delive these message types as PTP0. */
-   message_type = BIT(MLXSW_SP_PTP_MESSAGE_TYPE_SYNC) |
-  BIT(MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ) |
-  BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ) |
-  BIT(MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP);
+   message_type = BIT(PTP_MSGTYPE_SYNC) |
+  BIT(PTP_MSGTYPE_DELAY_REQ) |
+  BIT(PTP_MSGTYPE_PDELAY_REQ) |
+  BIT(PTP_MSGTYPE_PDELAY_RESP);
err = mlxsw_sp_ptp_mtptpt_set(mlxsw_sp, MLXSW_REG_MTPTPT_TRAP_ID_PTP0,
  message_type);
if (err)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h
index 8c386571afce..1d43a3755285 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.h
@@ -11,13 +11,6 @@ struct mlxsw_sp;
 struct mlxsw_sp_port;
 struct mlxsw_sp_ptp_clock;
 
-enum {
-   MLXSW_SP_PTP_MESSAGE_TYPE_SYNC,
-   MLXSW_SP_PTP_MESSAGE_TYPE_DELAY_REQ,
-   MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_REQ,
-   MLXSW_SP_PTP_MESSAGE_TYPE_PDELAY_RESP,
-};
-
 static inline int mlxsw_sp_ptp_get_ts_info_noptp(struct ethtool_ts_info *info)
 {
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
-- 
Christian Eggers
Embedded software developer



[PATCH net-next 3/3] net: phy: mscc: use new PTP_MSGTYPE_* defines

2020-11-22 Thread Christian Eggers
Use recently introduced PTP_MSGTYPE_SYNC and PTP_MSGTYPE_DELAY_REQ
defines instead of a driver internal enumeration.

Signed-off-by: Christian Eggers 
Cc: Quentin Schulz 
Cc: Antoine Tenart 
Cc: Antoine Tenart 
---
 drivers/net/phy/mscc/mscc_ptp.c | 14 +++---
 drivers/net/phy/mscc/mscc_ptp.h |  5 -
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
index d8a61456d1ce..924ed5b034a4 100644
--- a/drivers/net/phy/mscc/mscc_ptp.c
+++ b/drivers/net/phy/mscc/mscc_ptp.c
@@ -506,9 +506,9 @@ static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, 
enum ts_blk blk)
 {
struct vsc8531_private *vsc8531 = phydev->priv;
bool base = phydev->mdio.addr == vsc8531->ts_base_addr;
-   enum vsc85xx_ptp_msg_type msgs[] = {
-   PTP_MSG_TYPE_SYNC,
-   PTP_MSG_TYPE_DELAY_REQ
+   u8 msgs[] = {
+   PTP_MSGTYPE_SYNC,
+   PTP_MSGTYPE_DELAY_REQ
};
u32 val;
u8 i;
@@ -847,9 +847,9 @@ static int vsc85xx_ts_ptp_action_flow(struct phy_device 
*phydev, enum ts_blk blk
 static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
bool one_step, bool enable)
 {
-   enum vsc85xx_ptp_msg_type msgs[] = {
-   PTP_MSG_TYPE_SYNC,
-   PTP_MSG_TYPE_DELAY_REQ
+   u8 msgs[] = {
+   PTP_MSGTYPE_SYNC,
+   PTP_MSGTYPE_DELAY_REQ
};
u32 val;
u8 i;
@@ -858,7 +858,7 @@ static int vsc85xx_ptp_conf(struct phy_device *phydev, enum 
ts_blk blk,
if (blk == INGRESS)
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   PTP_WRITE_NS);
-   else if (msgs[i] == PTP_MSG_TYPE_SYNC && one_step)
+   else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
/* no need to know Sync t when sending in one_step */
vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   PTP_WRITE_1588);
diff --git a/drivers/net/phy/mscc/mscc_ptp.h b/drivers/net/phy/mscc/mscc_ptp.h
index 3ea163af0f4f..da3465360e90 100644
--- a/drivers/net/phy/mscc/mscc_ptp.h
+++ b/drivers/net/phy/mscc/mscc_ptp.h
@@ -436,11 +436,6 @@ enum ptp_cmd {
PTP_SAVE_IN_TS_FIFO = 11, /* invalid when writing in reg */
 };
 
-enum vsc85xx_ptp_msg_type {
-   PTP_MSG_TYPE_SYNC,
-   PTP_MSG_TYPE_DELAY_REQ,
-};
-
 struct vsc85xx_ptphdr {
u8 tsmt; /* transportSpecific | messageType */
u8 ver;  /* reserved0 | versionPTP */
-- 
Christian Eggers
Embedded software developer



Re: [PATCH 044/141] net/mlx4: Fix fall-through warnings for Clang

2020-11-22 Thread Tariq Toukan




On 11/20/2020 8:31 PM, Gustavo A. R. Silva wrote:

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of just letting the code
fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva 
---
  drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c 
b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 1187ef1375e2..e6b8b8dc7894 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -2660,6 +2660,7 @@ int mlx4_FREE_RES_wrapper(struct mlx4_dev *dev, int slave,
case RES_XRCD:
err = xrcdn_free_res(dev, slave, vhcr->op_modifier, alop,
 vhcr->in_param, >out_param);
+   break;
  
  	default:

break;



Reviewed-by: Tariq Toukan 

Thanks for your patch.


Re: [PATCH -tip 01/32] sched: Wrap rq::lock access

2020-11-22 Thread Balbir Singh
On Fri, Nov 20, 2020 at 11:55:22AM -0500, Joel Fernandes wrote:
> On Fri, Nov 20, 2020 at 10:31:39AM +1100, Singh, Balbir wrote:
> > On 18/11/20 10:19 am, Joel Fernandes (Google) wrote:
> > > From: Peter Zijlstra 
> > > 
> > > In preparation of playing games with rq->lock, abstract the thing
> > > using an accessor.
> > > 
> > 
> > Could you clarify games? I presume the intention is to redefine the scope
> > of the lock based on whether core sched is enabled or not? I presume patch
> > 4/32 has the details.
> 
> Your line wrapping broke, I fixed it.
>

Sorry, I've been using thunderbird from time to time and even though
I set the options specified in the Documentation (email-clients), it's
not working as expected.

> That is in fact the game. By wrapping it, the nature of the locking is
> dynamic based on whether core sched is enabled or not (both statically and
> dynamically).
>

My point was that the word game does not do justice to the change, some
details around how this abstractions helps based on the (re)definition of rq
with coresched might help.

Balbir Singh.


Re: [Patch v2 1/1] PCI: pciehp: Add support for handling MRL events

2020-11-22 Thread Lukas Wunner
On Sat, Nov 21, 2020 at 05:42:03PM -0800, Ashok Raj wrote:
> --- a/drivers/pci/hotplug/pciehp_ctrl.c
> +++ b/drivers/pci/hotplug/pciehp_ctrl.c
>  void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 
> events)
>  {
>   int present, link_active;
> + u8 getstatus = 0;
>  
>   /*
>* If the slot is on and presence or link has changed, turn it off.
> @@ -246,6 +259,20 @@ void pciehp_handle_presence_or_link_change(struct 
> controller *ctrl, u32 events)
>   if (events & PCI_EXP_SLTSTA_PDC)
>   ctrl_info(ctrl, "Slot(%s): Card not present\n",
> slot_name(ctrl));
> + if (events & PCI_EXP_SLTSTA_MRLSC)
> + ctrl_info(ctrl, "Slot(%s): Latch %s\n",
> +   slot_name(ctrl), getstatus ? "Open" : 
> "Closed");

This message will currently always be "Latch closed".  It should be
"Latch open" instead because if the slot was up, the latch must have
been closed.  So an MRLSC event can only mean that the latch is now open.
The "getstatus" variable can be removed.


> + /*
> +  * PCIe Base Spec 5.0 Chapter 6.7.1.3 states.
> +  *
> +  * If an MRL Sensor is implemented without a corresponding MRL 
> Sensor input
> +  * on the Hot-Plug Controller, it is recommended that the MRL 
> Sensor be
> +  * routed to power fault input of the Hot-Plug Controller.
> +  * This allows an active adapter to be powered off when the MRL 
> is opened."
> +  *
> +  * This seems to suggest that the slot should be brought down 
> as soon as MRL
> +  * is opened.
> +  */
>   pciehp_disable_slot(ctrl, SURPRISE_REMOVAL);
>   break;

The code comment is not wrapped at 80 chars and a bit long.
I'd move it to the commit message and keep only a shortened version here.

The "SURPRISE_REMOVAL" may now be problematic because the card may still
be in the slot (both presence and link still up) with only the MRL open.
My suggestion would be to add a local variable "bool safe_removal"
which is initialized to "SAFE_REMOVAL".  In the two if-clauses for
DLLSC and PDC, it is set to SURPRISE_REMOVAL.


> @@ -275,6 +302,13 @@ void pciehp_handle_presence_or_link_change(struct 
> controller *ctrl, u32 events)
>   if (link_active)
>   ctrl_info(ctrl, "Slot(%s): Link Up\n",
> slot_name(ctrl));
> + /*
> +  * If slot is closed && ATTN button exists
> +  * don't continue, let the ATTN button
> +  * drive the hot-plug
> +  */
> + if (((events & PCI_EXP_SLTSTA_MRLSC) && ATTN_BUTTN(ctrl)))
> + return;
>   ctrl->request_result = pciehp_enable_slot(ctrl);
>   break;

Hm, if the Attention Button is pressed with MRL still open, the slot is
not brought up.  If the MRL is subsequently closed, it is still not
brought up.  I guess the slot keeps blinking and one has to push the
button to abort the operation, then press it once more to attempt
another slot bringup.  The spec doesn't seem to say how such a situation
should be handled. Oh well.

I'm wondering if this is the right place to bail out:  Immediately
before the above hunk, the button_work is canceled, so it can't later
trigger bringup of the slot.  Shouldn't the above check be in the
code block with the "Turn the slot on if it's occupied or link is up"
comment?

You're also not unlocking the state_lock here before bailing out of
the function.


> @@ -710,8 +710,10 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id)
>   down_read(>reset_lock);
>   if (events & DISABLE_SLOT)
>   pciehp_handle_disable_request(ctrl);
> - else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC))
> + else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC |
> +PCI_EXP_SLTSTA_MRLSC))
>   pciehp_handle_presence_or_link_change(ctrl, events);
> +
>   up_read(>reset_lock);

Unnecessary newline added.


> @@ -768,6 +770,14 @@ static void pcie_enable_notification(struct controller 
> *ctrl)
>   cmd |= PCI_EXP_SLTCTL_ABPE;
>   else
>   cmd |= PCI_EXP_SLTCTL_PDCE;
> +
> + /*
> +  * If MRL sensor is present, then subscribe for MRL
> +  * Changes to be notified as well.
> +  */
> + if (MRL_SENS(ctrl))
> + cmd |= PCI_EXP_SLTCTL_MRLSCE;
> +

The code comment doesn't add much information, so can probably be
dropped.

You need to add PCI_EXP_SLTCTL_MRLSCE to the "mask" variable in this
function (before PFDE, as in pcie_disable_notification()).
I don't think the interrupt is enabled at all if it's not added to
"mask", has this patch been tested at all?

Something else:  When pciehp probes, it should check whether the slot
is up even though 

Re: [PATCH -tip 04/32] sched: Core-wide rq->lock

2020-11-22 Thread Balbir Singh
On Tue, Nov 17, 2020 at 06:19:34PM -0500, Joel Fernandes (Google) wrote:
> From: Peter Zijlstra 
> 
> Introduce the basic infrastructure to have a core wide rq->lock.
>

Reading through the patch, it seems like all the CPUs have to be
running with sched core enabled/disabled? Is it possible to have some
cores with core sched disabled? I don't see a strong use case for it,
but I am wondering if the design will fall apart if that assumption is
broken?

Balbir Singh



Re: [PATCH 4.19 00/14] 4.19.159-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Sat, Nov 21, 2020 at 09:37:23AM +0100, Pavel Machek wrote:
> Hi!
> 
> > This is the start of the stable review cycle for the 4.19.159 release.
> > There are 14 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> 
> CIP testing did not find any problems here:
> 
> https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
> 
> But reviews indicated two patches that are problematic in 4.19:
> 
> rc-v4.19.155.list: fd2278164808 o: | memory: emif: Remove bogus
> debugfs error handling
> 
> - debugfs still returns NULL in 4.19 so this introducesbug. Itis
>   just a cleanup so it can be reverted.

This can stay, the code still works correctly with this patch applied.

> rc-v4.19.156.list: 7d5553147613 o: | drm/i915: Break up error capture
> compression loops with cond_resched()
> 
> - code still needs to be atomic in 4.19; this probably depends on
>   a42f45a2a, see _object_create(). It does not fix anything severe so
> it can be simply reverted.

It does not hurt anything either, right?  Have you noticed any
regressions with it applied?

> Tested-by: Pavel Machek (CIP) 

Thanks for testing these.

greg k-h


Re: [PATCH 5.9 00/14] 5.9.10-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Fri, Nov 20, 2020 at 03:27:28PM -0700, Shuah Khan wrote:
> On 11/20/20 4:03 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.9.10 release.
> > There are 14 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> > 
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.10-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-5.9.y
> > and the diffstat can be found below.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> Compiled and booted on my test system. No dmesg regressions.
> 
> Tested-by: Shuah Khan 

Thanks for testing all of these and letting me know.

greg k-h


Re: [PATCH 5.9 00/14] 5.9.10-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Sat, Nov 21, 2020 at 10:38:17AM -0800, Guenter Roeck wrote:
> On Fri, Nov 20, 2020 at 12:03:38PM +0100, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 5.9.10 release.
> > There are 14 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 154 pass: 154 fail: 0
> Qemu test results:
>   total: 426 pass: 426 fail: 0
> 
> Tested-by: Guenter Roeck 

Thanks for the testing.  I'll leave the powerpc build failures in as the
issue being fixed is better to have at the moment.  Hopefully the ppc
developers can fix those up soon.

thanks,

greg k-h


Re: [PATCH 5.9 00/14] 5.9.10-rc1 review

2020-11-22 Thread Greg Kroah-Hartman
On Sat, Nov 21, 2020 at 04:42:45PM +0530, Naresh Kamboju wrote:
> On Fri, 20 Nov 2020 at 16:39, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 5.9.10 release.
> > There are 14 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.9.10-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-5.9.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm, x86_64, and i386.
> 
> Tested-by: Linux Kernel Functional Testing 

Thanks for testing them all and letting me know.

greg k-h


Linux 4.4.245

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.4.245 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:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/kernel-parameters.txt|7 
 Makefile   |2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h |   23 ++
 arch/powerpc/include/asm/exception-64s.h   |   15 +
 arch/powerpc/include/asm/feature-fixups.h  |   19 ++
 arch/powerpc/include/asm/futex.h   |4 
 arch/powerpc/include/asm/kup.h |   40 
 arch/powerpc/include/asm/security_features.h   |7 
 arch/powerpc/include/asm/setup.h   |4 
 arch/powerpc/include/asm/uaccess.h |  142 +---
 arch/powerpc/kernel/exceptions-64s.S   |  210 +++--
 arch/powerpc/kernel/head_8xx.S |8 
 arch/powerpc/kernel/ppc_ksyms.c|   10 +
 arch/powerpc/kernel/setup_64.c |  138 
 arch/powerpc/kernel/vmlinux.lds.S  |   14 +
 arch/powerpc/lib/checksum_wrappers_64.c|4 
 arch/powerpc/lib/feature-fixups.c  |  104 
 arch/powerpc/lib/string.S  |2 
 arch/powerpc/lib/string_64.S   |4 
 arch/powerpc/platforms/powernv/setup.c |   15 +
 arch/powerpc/platforms/pseries/setup.c |8 
 arch/x86/kvm/emulate.c |8 
 drivers/i2c/busses/i2c-imx.c   |   25 +-
 drivers/input/keyboard/sunkbd.c|   41 +++-
 fs/xfs/xfs_icache.c|   58 ++
 net/mac80211/sta_info.c|   18 ++
 26 files changed, 781 insertions(+), 149 deletions(-)

Andrew Donnellan (1):
  powerpc: Fix __clear_user() with KUAP enabled

Christophe Leroy (3):
  powerpc: Add a framework for user access tracking
  powerpc: Implement user_access_begin and friends
  powerpc/8xx: Always fault when _PAGE_ACCESSED is not set

Daniel Axtens (2):
  powerpc/64s: Define MASKABLE_RELON_EXCEPTION_PSERIES_OOL
  powerpc/64s: move some exception handlers out of line

Dave Chinner (2):
  xfs: catch inode allocation state mismatch corruption
  xfs: validate cached inodes are free when allocated

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Greg Kroah-Hartman (1):
  Linux 4.4.245

Johannes Berg (1):
  mac80211: always wind down STA state

Krzysztof Kozlowski (1):
  i2c: imx: Fix external abort on interrupt in exit paths

Nicholas Piggin (3):
  powerpc/64s: flush L1D on kernel entry
  powerpc/uaccess: Evaluate macro arguments once, before user access is 
allowed
  powerpc/64s: flush L1D after user accesses



Linux 4.14.208

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.14.208 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:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/kernel-parameters.txt |7 +
 Makefile|2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h  |   22 +++
 arch/powerpc/include/asm/exception-64s.h|   13 +-
 arch/powerpc/include/asm/feature-fixups.h   |   19 +++
 arch/powerpc/include/asm/futex.h|4 
 arch/powerpc/include/asm/kup.h  |   40 ++
 arch/powerpc/include/asm/security_features.h|7 +
 arch/powerpc/include/asm/setup.h|4 
 arch/powerpc/include/asm/uaccess.h  |  148 ++--
 arch/powerpc/kernel/exceptions-64s.S|   96 ---
 arch/powerpc/kernel/head_8xx.S  |8 -
 arch/powerpc/kernel/setup_64.c  |  122 +++
 arch/powerpc/kernel/vmlinux.lds.S   |   14 ++
 arch/powerpc/lib/checksum_wrappers.c|4 
 arch/powerpc/lib/feature-fixups.c   |  104 
 arch/powerpc/lib/string.S   |4 
 arch/powerpc/lib/string_64.S|6 
 arch/powerpc/platforms/powernv/setup.c  |   17 ++
 arch/powerpc/platforms/pseries/setup.c  |8 +
 arch/x86/kvm/emulate.c  |8 +
 drivers/acpi/evged.c|2 
 drivers/gpio/gpio-mockup.c  |1 
 drivers/i2c/busses/i2c-imx.c|   56 ++---
 drivers/input/keyboard/sunkbd.c |   41 +-
 net/can/proc.c  |6 
 net/mac80211/sta_info.c |   18 ++
 27 files changed, 663 insertions(+), 118 deletions(-)

Andrew Donnellan (1):
  powerpc: Fix __clear_user() with KUAP enabled

Bartosz Golaszewski (1):
  gpio: mockup: fix resource leak in error path

Christophe Leroy (3):
  powerpc: Add a framework for user access tracking
  powerpc: Implement user_access_begin and friends
  powerpc/8xx: Always fault when _PAGE_ACCESSED is not set

Daniel Axtens (2):
  powerpc/64s: Define MASKABLE_RELON_EXCEPTION_PSERIES_OOL
  powerpc/64s: move some exception handlers out of line

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Greg Kroah-Hartman (1):
  Linux 4.14.208

Johannes Berg (1):
  mac80211: always wind down STA state

Krzysztof Kozlowski (1):
  i2c: imx: Fix external abort on interrupt in exit paths

Lucas Stach (1):
  i2c: imx: use clk notifier for rate changes

Nicholas Piggin (3):
  powerpc/64s: flush L1D on kernel entry
  powerpc/uaccess: Evaluate macro arguments once, before user access is 
allowed
  powerpc/64s: flush L1D after user accesses

Nick Desaulniers (1):
  ACPI: GED: fix -Wformat

Zhang Changzhong (1):
  can: proc: can_remove_proc(): silence remove_proc_entry warning



Re: Linux 4.14.208

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index e0ce14f028d8..357c64b53cdc 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2446,6 +2446,8 @@
   mds=off [X86]
   tsx_async_abort=off [X86]
   kvm.nx_huge_pages=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
Exceptions:
   This does not have any effect on
@@ -2749,6 +2751,8 @@
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -2798,6 +2802,9 @@
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index c4bb19c1e4c7..7133039972b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 207
+SUBLEVEL = 208
 EXTRAVERSION =
 NAME = Petit Gorille
 
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
new file mode 100644
index ..aa54ac2e5659
--- /dev/null
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+#define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
+/* Prototype for function defined in exceptions-64s.S */
+void do_uaccess_flush(void);
+
+static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
+ unsigned long size)
+{
+}
+
+static inline void prevent_user_access(void __user *to, const void __user 
*from,
+  unsigned long size)
+{
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
+}
+
+#endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index c3bdd2d8ec90..882545978651 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -84,11 +84,18 @@
nop;\
nop
 
+#define ENTRY_FLUSH_SLOT   \
+   ENTRY_FLUSH_FIXUP_SECTION;  \
+   nop;\
+   nop;\
+   nop;
+
 /*
  * r10 must be free to use, r13 must be paca
  */
 #define INTERRUPT_TO_KERNEL\
-   STF_ENTRY_BARRIER_SLOT
+   STF_ENTRY_BARRIER_SLOT; \
+   ENTRY_FLUSH_SLOT
 
 /*
  * Macros for annotating the expected destination of (h)rfid
@@ -645,6 +652,10 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_TEST_HV, vec);\
EXCEPTION_RELON_PROLOG_PSERIES_1(label, EXC_HV)
 
+#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL(vec, label)   \
+   EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec);  \
+   EXCEPTION_PROLOG_PSERIES_1(label, EXC_STD)
+
 /*
  * Our exception common code can be passed various "additions"
  * to specify the behaviour of interrupts, whether to kick the
diff --git a/arch/powerpc/include/asm/feature-fixups.h 
b/arch/powerpc/include/asm/feature-fixups.h
index b1d478acbaec..745c017b8de6 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -203,6 +203,22 @@ label##3:  \
FTR_ENTRY_OFFSET 955b-956b; \
.popsection;
 
+#define UACCESS_FLUSH_FIXUP_SECTION\
+959:   \
+   .pushsection __uaccess_flush_fixup,"a"; \
+   .align 2;   \
+960:   \
+   FTR_ENTRY_OFFSET 959b-960b; \
+   .popsection;
+
+#define 

Re: Linux 4.9.245

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index e51e42d9f646..713765521c45 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2527,6 +2527,8 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
   mds=off [X86]
   tsx_async_abort=off [X86]
   kvm.nx_huge_pages=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
Exceptions:
   This does not have any effect on
@@ -2833,6 +2835,8 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -2882,6 +2886,9 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index 27314b9f0fe6..b72f286d3bcd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 244
+SUBLEVEL = 245
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
new file mode 100644
index ..aa54ac2e5659
--- /dev/null
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+#define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
+/* Prototype for function defined in exceptions-64s.S */
+void do_uaccess_flush(void);
+
+static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
+ unsigned long size)
+{
+}
+
+static inline void prevent_user_access(void __user *to, const void __user 
*from,
+  unsigned long size)
+{
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
+}
+
+#endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index e2200100828d..6ffec5b18a6d 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -66,11 +66,18 @@
nop;\
nop
 
+#define ENTRY_FLUSH_SLOT   \
+   ENTRY_FLUSH_FIXUP_SECTION;  \
+   nop;\
+   nop;\
+   nop;
+
 /*
  * r10 must be free to use, r13 must be paca
  */
 #define INTERRUPT_TO_KERNEL\
-   STF_ENTRY_BARRIER_SLOT
+   STF_ENTRY_BARRIER_SLOT; \
+   ENTRY_FLUSH_SLOT
 
 /*
  * Macros for annotating the expected destination of (h)rfid
@@ -563,6 +570,10 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec);  \
EXCEPTION_PROLOG_PSERIES_1(label, EXC_HV)
 
+#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL(vec, label)   \
+   EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec);  \
+   EXCEPTION_PROLOG_PSERIES_1(label, EXC_STD)
+
 /*
  * Our exception common code can be passed various "additions"
  * to specify the behaviour of interrupts, whether to kick the
diff --git a/arch/powerpc/include/asm/feature-fixups.h 
b/arch/powerpc/include/asm/feature-fixups.h
index 175128e19025..a8e7ca27fb54 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -205,6 +205,22 @@ void setup_feature_keys(void);
FTR_ENTRY_OFFSET 955b-956b; \
.popsection;
 
+#define UACCESS_FLUSH_FIXUP_SECTION\
+959:   \
+   .pushsection __uaccess_flush_fixup,"a"; \
+   .align 2;   \
+960:   \
+   

Linux 4.9.245

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.9.245 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:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/kernel-parameters.txt|7 +
 Makefile   |2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h |   22 +++
 arch/powerpc/include/asm/exception-64s.h   |   13 ++
 arch/powerpc/include/asm/feature-fixups.h  |   19 +++
 arch/powerpc/include/asm/futex.h   |4 
 arch/powerpc/include/asm/kup.h |   40 ++
 arch/powerpc/include/asm/security_features.h   |7 +
 arch/powerpc/include/asm/setup.h   |4 
 arch/powerpc/include/asm/uaccess.h |  143 +++--
 arch/powerpc/kernel/exceptions-64s.S   |  130 --
 arch/powerpc/kernel/head_8xx.S |8 -
 arch/powerpc/kernel/setup_64.c |  120 
 arch/powerpc/kernel/vmlinux.lds.S  |   14 ++
 arch/powerpc/lib/checksum_wrappers.c   |4 
 arch/powerpc/lib/feature-fixups.c  |  104 ++
 arch/powerpc/lib/string.S  |4 
 arch/powerpc/lib/string_64.S   |6 -
 arch/powerpc/platforms/powernv/setup.c |   15 ++
 arch/powerpc/platforms/pseries/setup.c |8 +
 arch/x86/kvm/emulate.c |8 +
 drivers/acpi/evged.c   |2 
 drivers/i2c/busses/i2c-imx.c   |   56 ++---
 drivers/i2c/muxes/i2c-mux-pca954x.c|6 -
 drivers/input/keyboard/sunkbd.c|   41 +--
 net/mac80211/sta_info.c|   18 +++
 26 files changed, 672 insertions(+), 133 deletions(-)

Andrew Donnellan (1):
  powerpc: Fix __clear_user() with KUAP enabled

Christophe Leroy (3):
  powerpc: Add a framework for user access tracking
  powerpc: Implement user_access_begin and friends
  powerpc/8xx: Always fault when _PAGE_ACCESSED is not set

Daniel Axtens (2):
  powerpc/64s: Define MASKABLE_RELON_EXCEPTION_PSERIES_OOL
  powerpc/64s: move some exception handlers out of line

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Greg Kroah-Hartman (1):
  Linux 4.9.245

Johannes Berg (1):
  mac80211: always wind down STA state

Krzysztof Kozlowski (1):
  i2c: imx: Fix external abort on interrupt in exit paths

Lucas Stach (1):
  i2c: imx: use clk notifier for rate changes

Mike Looijmans (1):
  i2c: mux: pca954x: Add missing pca9546 definition to chip_desc

Nicholas Piggin (3):
  powerpc/64s: flush L1D on kernel entry
  powerpc/uaccess: Evaluate macro arguments once, before user access is 
allowed
  powerpc/64s: flush L1D after user accesses

Nick Desaulniers (1):
  ACPI: GED: fix -Wformat



Re: Linux 4.4.245

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 17747dcd0e77..a8ceef14e781 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2196,6 +2196,8 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
   spec_store_bypass_disable=off 
[X86]
   mds=off [X86]
   tsx_async_abort=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
auto (default)
Mitigate all CPU vulnerabilities, but leave SMT
@@ -2476,6 +2478,8 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -2518,6 +2522,9 @@ bytes respectively. Such letter suffixes can also be 
entirely omitted.
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index f8b9fd688781..2d9e5c4688a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 244
+SUBLEVEL = 245
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
new file mode 100644
index ..cce8e7497d72
--- /dev/null
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+#define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+#include 
+
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
+/* Prototype for function defined in exceptions-64s.S */
+void do_uaccess_flush(void);
+
+static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
+ unsigned long size)
+{
+}
+
+static inline void prevent_user_access(void __user *to, const void __user 
*from,
+  unsigned long size)
+{
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
+}
+
+#endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index 3ed536bec462..fbcfc722d109 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -65,11 +65,18 @@
nop;\
nop
 
+#define ENTRY_FLUSH_SLOT   \
+   ENTRY_FLUSH_FIXUP_SECTION;  \
+   nop;\
+   nop;\
+   nop;
+
 /*
  * r10 must be free to use, r13 must be paca
  */
 #define INTERRUPT_TO_KERNEL\
-   STF_ENTRY_BARRIER_SLOT
+   STF_ENTRY_BARRIER_SLOT; \
+   ENTRY_FLUSH_SLOT
 
 /*
  * Macros for annotating the expected destination of (h)rfid
@@ -597,6 +604,12 @@ label##_relon_hv:  
\
EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_HV, vec);  \
EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_HV);
 
+#define MASKABLE_RELON_EXCEPTION_PSERIES_OOL(vec, label)   \
+   .globl label##_relon_pSeries;   \
+label##_relon_pSeries: \
+   EXCEPTION_PROLOG_1(PACA_EXGEN, SOFTEN_NOTEST_PR, vec);  \
+   EXCEPTION_PROLOG_PSERIES_1(label##_common, EXC_STD)
+
 /*
  * Our exception common code can be passed various "additions"
  * to specify the behaviour of interrupts, whether to kick the
diff --git a/arch/powerpc/include/asm/feature-fixups.h 
b/arch/powerpc/include/asm/feature-fixups.h
index 145a37ab2d3e..83219710e904 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -200,6 +200,22 @@ label##3:  \
FTR_ENTRY_OFFSET 955b-956b; \
.popsection;
 
+#define UACCESS_FLUSH_FIXUP_SECTION  

[PATCH] Documentation: gpio: fix typo and unclear legacy API section

2020-11-22 Thread Alexandre Courbot
The "Interacting With the Legacy GPIO Subsystem" of the documentation
was unclear at best, and even included a sentence that seems to say the
opposite of what it should say about the lifetime of the return value of
the conversion functions.

Try to clarify things a bit and hopefully make that section more
readable.

Signed-off-by: Alexandre Courbot 
---
 Documentation/driver-api/gpio/consumer.rst | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/driver-api/gpio/consumer.rst 
b/Documentation/driver-api/gpio/consumer.rst
index 423492d125b9..173e4c7b037d 100644
--- a/Documentation/driver-api/gpio/consumer.rst
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -440,18 +440,20 @@ For details refer to 
Documentation/firmware-guide/acpi/gpio-properties.rst
 
 Interacting With the Legacy GPIO Subsystem
 ==
-Many kernel subsystems still handle GPIOs using the legacy integer-based
-interface. Although it is strongly encouraged to upgrade them to the safer
-descriptor-based API, the following two functions allow you to convert a GPIO
-descriptor into the GPIO integer namespace and vice-versa::
+Many kernel subsystems and drivers still handle GPIOs using the legacy
+integer-based interface. It is strongly recommended to update these to the new
+gpiod interface. For cases where both interfaces need to be used, the following
+two functions allow to convert a GPIO descriptor into the GPIO integer 
namespace
+and vice-versa::
 
int desc_to_gpio(const struct gpio_desc *desc)
struct gpio_desc *gpio_to_desc(unsigned gpio)
 
-The GPIO number returned by desc_to_gpio() can be safely used as long as the
-GPIO descriptor has not been freed. All the same, a GPIO number passed to
-gpio_to_desc() must have been properly acquired, and usage of the returned GPIO
-descriptor is only possible after the GPIO number has been released.
+The GPIO number returned by desc_to_gpio() can safely be used as a parameter of
+the gpio\_*() functions for as long as the GPIO descriptor `desc` is not freed.
+All the same, a GPIO number passed to gpio_to_desc() must first be properly
+acquired using e.g. gpio_request_one(), and the returned GPIO descriptor is 
only
+considered valid until that GPIO number is released using gpio_free().
 
 Freeing a GPIO obtained by one API with the other API is forbidden and an
 unchecked error.
-- 
2.29.2



Re: [PATCH 061/141] tee: Fix fall-through warnings for Clang

2020-11-22 Thread Jens Wiklander
On Fri, Nov 20, 2020 at 7:33 PM Gustavo A. R. Silva
 wrote:
>
> In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
> by explicitly adding a break statement instead of letting the code fall
> through to the next case.
>
> Link: https://github.com/KSPP/linux/issues/115
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/tee/tee_core.c | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Jens Wiklander 

Thanks,
Jens


Re: [PATCH] Documentation: gpio: fix typo and unclear legacy API section

2020-11-22 Thread Alexandre Courbot
On Sun, Nov 22, 2020 at 6:25 PM Alexandre Courbot  wrote:
>
> The "Interacting With the Legacy GPIO Subsystem" of the documentation
> was unclear at best, and even included a sentence that seems to say the
> opposite of what it should say about the lifetime of the return value of
> the conversion functions.
>
> Try to clarify things a bit and hopefully make that section more
> readable.
>
> Signed-off-by: Alexandre Courbot 

Realized after sending this should also have a

Reported-by: Andy Shevchenko 

Apologies for the omission Andy!

> ---
>  Documentation/driver-api/gpio/consumer.rst | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/driver-api/gpio/consumer.rst 
> b/Documentation/driver-api/gpio/consumer.rst
> index 423492d125b9..173e4c7b037d 100644
> --- a/Documentation/driver-api/gpio/consumer.rst
> +++ b/Documentation/driver-api/gpio/consumer.rst
> @@ -440,18 +440,20 @@ For details refer to 
> Documentation/firmware-guide/acpi/gpio-properties.rst
>
>  Interacting With the Legacy GPIO Subsystem
>  ==
> -Many kernel subsystems still handle GPIOs using the legacy integer-based
> -interface. Although it is strongly encouraged to upgrade them to the safer
> -descriptor-based API, the following two functions allow you to convert a GPIO
> -descriptor into the GPIO integer namespace and vice-versa::
> +Many kernel subsystems and drivers still handle GPIOs using the legacy
> +integer-based interface. It is strongly recommended to update these to the 
> new
> +gpiod interface. For cases where both interfaces need to be used, the 
> following
> +two functions allow to convert a GPIO descriptor into the GPIO integer 
> namespace
> +and vice-versa::
>
> int desc_to_gpio(const struct gpio_desc *desc)
> struct gpio_desc *gpio_to_desc(unsigned gpio)
>
> -The GPIO number returned by desc_to_gpio() can be safely used as long as the
> -GPIO descriptor has not been freed. All the same, a GPIO number passed to
> -gpio_to_desc() must have been properly acquired, and usage of the returned 
> GPIO
> -descriptor is only possible after the GPIO number has been released.
> +The GPIO number returned by desc_to_gpio() can safely be used as a parameter 
> of
> +the gpio\_*() functions for as long as the GPIO descriptor `desc` is not 
> freed.
> +All the same, a GPIO number passed to gpio_to_desc() must first be properly
> +acquired using e.g. gpio_request_one(), and the returned GPIO descriptor is 
> only
> +considered valid until that GPIO number is released using gpio_free().
>
>  Freeing a GPIO obtained by one API with the other API is forbidden and an
>  unchecked error.
> --
> 2.29.2
>


Re: [PATCH v5] zram: break the strict dependency from lzo

2020-11-22 Thread Rui Salvaterra
Hi, Minchan,

On Sat, 21 Nov 2020 at 00:44, Rui Salvaterra  wrote:
>
> Well, it's quite possible I mis{read,applied} your patch.

And I obviously did. Your kconfig suggestion does basically the same,
in a more simplified way. I guess a v6 is in order.

Thanks,
Rui


Re: [PATCH net-next 3/3] net: phy: mscc: use new PTP_MSGTYPE_* defines

2020-11-22 Thread kernel test robot
Hi Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Christian-Eggers/net-ptp-use-common-defines-for-PTP-message-types-in-further-drivers/20201122-163319
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
f9e425e99b0756c1479042afe761073779df2a30
config: sparc-randconfig-r012-20201122 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/0day-ci/linux/commit/78cc4b0e1739511ed9712c9466a48ddc6885d153
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Christian-Eggers/net-ptp-use-common-defines-for-PTP-message-types-in-further-drivers/20201122-163319
git checkout 78cc4b0e1739511ed9712c9466a48ddc6885d153
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=sparc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/net/phy/mscc/mscc_ptp.c: In function 'vsc85xx_ptp_cmp_init':
   drivers/net/phy/mscc/mscc_ptp.c:510:3: error: 'PTP_MSGTYPE_SYNC' undeclared 
(first use in this function); did you mean 'CSD_TYPE_SYNC'?
 510 |   PTP_MSGTYPE_SYNC,
 |   ^~~~
 |   CSD_TYPE_SYNC
   drivers/net/phy/mscc/mscc_ptp.c:510:3: note: each undeclared identifier is 
reported only once for each function it appears in
   drivers/net/phy/mscc/mscc_ptp.c:511:3: error: 'PTP_MSGTYPE_DELAY_REQ' 
undeclared (first use in this function)
 511 |   PTP_MSGTYPE_DELAY_REQ
 |   ^
   drivers/net/phy/mscc/mscc_ptp.c: In function 'vsc85xx_ptp_conf':
   drivers/net/phy/mscc/mscc_ptp.c:851:3: error: 'PTP_MSGTYPE_SYNC' undeclared 
(first use in this function); did you mean 'CSD_TYPE_SYNC'?
 851 |   PTP_MSGTYPE_SYNC,
 |   ^~~~
 |   CSD_TYPE_SYNC
>> drivers/net/phy/mscc/mscc_ptp.c:851:3: warning: initialization of 'unsigned 
>> char' from 'u8 *' {aka 'unsigned char *'} makes integer from pointer without 
>> a cast [-Wint-conversion]
   drivers/net/phy/mscc/mscc_ptp.c:851:3: note: (near initialization for 
'msgs[0]')
   drivers/net/phy/mscc/mscc_ptp.c:852:3: error: 'PTP_MSGTYPE_DELAY_REQ' 
undeclared (first use in this function)
 852 |   PTP_MSGTYPE_DELAY_REQ
 |   ^
   drivers/net/phy/mscc/mscc_ptp.c:852:3: warning: initialization of 'unsigned 
char' from 'u8 *' {aka 'unsigned char *'} makes integer from pointer without a 
cast [-Wint-conversion]
   drivers/net/phy/mscc/mscc_ptp.c:852:3: note: (near initialization for 
'msgs[1]')
>> drivers/net/phy/mscc/mscc_ptp.c:861:20: warning: comparison between pointer 
>> and integer
 861 |   else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
 |^~

vim +851 drivers/net/phy/mscc/mscc_ptp.c

   846  
   847  static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
   848  bool one_step, bool enable)
   849  {
   850  u8 msgs[] = {
 > 851  PTP_MSGTYPE_SYNC,
   852  PTP_MSGTYPE_DELAY_REQ
   853  };
   854  u32 val;
   855  u8 i;
   856  
   857  for (i = 0; i < ARRAY_SIZE(msgs); i++) {
   858  if (blk == INGRESS)
   859  vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   860 PTP_WRITE_NS);
 > 861  else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
   862  /* no need to know Sync t when sending in 
one_step */
   863  vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   864 PTP_WRITE_1588);
   865  else
   866  vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   867 PTP_SAVE_IN_TS_FIFO);
   868  
   869  val = vsc85xx_ts_read_csr(phydev, blk,
   870MSCC_ANA_PTP_FLOW_ENA(i));
   871  val &= ~PTP_FLOW_ENA;
   872  if (enable)
   873  val |= PTP_FLOW_ENA;
   874  vsc85xx_ts_write_csr(phydev, blk, 
MSCC_ANA_PTP_FLOW_ENA(i),
   875   val);
   876  }
   877  
   878  return 0;
   879  }
   880  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH v6] zram: break the strict dependency from lzo

2020-11-22 Thread Rui Salvaterra
>From the beginning, the zram block device always enabled CRYPTO_LZO, since
lzo-rle is hardcoded as the fallback compression algorithm. As a consequence, on
systems where another compression algorithm is chosen (e.g. CRYPTO_ZSTD), the
lzo kernel module becomes unused, while still having to be built/loaded.

This patch removes the hardcoded lzo-rle dependency and allows the user to
select the default compression algorithm for zram at build time. The previous
behaviour is kept, as the default algorithm is still lzo-rle.

Suggested-by: Sergey Senozhatsky 
Suggested-by: Minchan Kim 
Signed-off-by: Rui Salvaterra 
---
v6: simplify the kconfig as per Minchan's suggestion.
v5: incorporate Minchan's feedback. Allow the user to choose a default 
algorithm.
v4: incorporate Sergey's feedback and fix a small typo.
v3: fix the default selection when lzo isn't present. Rebase against 5.10-rc1.
v2: fix the dependency on CRYPTO.

 drivers/block/zram/Kconfig| 41 ++-
 drivers/block/zram/zcomp.c|  2 ++
 drivers/block/zram/zram_drv.c |  2 +-
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
index fe7a4b7d30cf..6303fe5dee88 100644
--- a/drivers/block/zram/Kconfig
+++ b/drivers/block/zram/Kconfig
@@ -2,7 +2,6 @@
 config ZRAM
tristate "Compressed RAM block device support"
depends on BLOCK && SYSFS && ZSMALLOC && CRYPTO
-   select CRYPTO_LZO
help
  Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
  Pages written to these disks are compressed and stored in memory
@@ -14,6 +13,46 @@ config ZRAM
 
  See Documentation/admin-guide/blockdev/zram.rst for more information.
 
+choice
+   prompt "Default zram compressor"
+   default ZRAM_DEF_COMP_LZORLE
+   depends on ZRAM || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || 
CRYPTO_842
+
+config ZRAM_DEF_COMP_LZORLE
+   bool "lzo-rle"
+   select CRYPTO_LZO
+
+config ZRAM_DEF_COMP_ZSTD
+   bool "zstd"
+   depends on CRYPTO_ZSTD
+
+config ZRAM_DEF_COMP_LZ4
+   bool "lz4"
+   depends on CRYPTO_LZ4
+
+config ZRAM_DEF_COMP_LZO
+   bool "lzo"
+   select CRYPTO_LZO
+
+config ZRAM_DEF_COMP_LZ4HC
+   bool "lz4hc"
+   depends on CRYPTO_LZ4HC
+
+config ZRAM_DEF_COMP_842
+   bool "842"
+   depends on CRYPTO_842
+
+endchoice
+
+config ZRAM_DEF_COMP
+   string
+   default "lzo-rle" if ZRAM_DEF_COMP_LZORLE
+   default "zstd" if ZRAM_DEF_COMP_ZSTD
+   default "lz4" if ZRAM_DEF_COMP_LZ4
+   default "lzo" if ZRAM_DEF_COMP_LZO
+   default "lz4hc" if ZRAM_DEF_COMP_LZ4HC
+   default "842" if ZRAM_DEF_COMP_842
+
 config ZRAM_WRITEBACK
bool "Write back incompressible or idle page to backing device"
depends on ZRAM
diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 33e3b76c4fa9..052aa3f65514 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -15,8 +15,10 @@
 #include "zcomp.h"
 
 static const char * const backends[] = {
+#if IS_ENABLED(CONFIG_CRYPTO_LZO)
"lzo",
"lzo-rle",
+#endif
 #if IS_ENABLED(CONFIG_CRYPTO_LZ4)
"lz4",
 #endif
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1b697208d661..9ddccb968c68 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -42,7 +42,7 @@ static DEFINE_IDR(zram_index_idr);
 static DEFINE_MUTEX(zram_index_mutex);
 
 static int zram_major;
-static const char *default_compressor = "lzo-rle";
+static const char *default_compressor = CONFIG_ZRAM_DEF_COMP;
 
 /* Module params (documentation at end) */
 static unsigned int num_devices = 1;
-- 
2.29.2



[PATCH v4 6/6] MAINTAINERS: add MT7621 CLOCK maintainer

2020-11-22 Thread Sergio Paracuellos
Adding myself as maintainer for mt7621 clock driver.

Signed-off-by: Sergio Paracuellos 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f1f088a29bc2..30822ad6837c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11142,6 +11142,12 @@ L: linux-wirel...@vger.kernel.org
 S: Maintained
 F: drivers/net/wireless/mediatek/mt7601u/
 
+MEDIATEK MT7621 CLOCK DRIVER
+M: Sergio Paracuellos 
+S: Maintained
+F: Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml
+F: drivers/clk/ralink/clk-mt7621.c
+
 MEDIATEK MT7621/28/88 I2C DRIVER
 M: Stefan Roese 
 L: linux-...@vger.kernel.org
-- 
2.25.1



[PATCH v4 3/6] clk: ralink: add clock driver for mt7621 SoC

2020-11-22 Thread Sergio Paracuellos
The documentation for this SOC only talks about two
registers regarding to the clocks:
* SYSC_REG_CPLL_CLKCFG0 - provides some information about
boostrapped refclock. PLL and dividers used for CPU and some
sort of BUS.
* SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable
clocks for all or some ip cores.

Looking into driver code, and some openWRT patched there are
another frequences which are used in some drivers (uart, sd...).
According to all of this information the clock plan for this
SoC is set as follows:
- Main top clock "xtal" from where all the rest of the world is
derived.
- CPU clock "cpu" derived from "xtal" frequencies and a bunch of
register reads and predividers.
- BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz.
- Fixed clocks from "xtal":
* "50m": 50 MHz.
* "125m": 125 MHz.
* "150m": 150 MHz.
* "250m": 250 MHz.
* "270m": 270 MHz.

We also have a buch of gate clocks with their parents:
  * "hsdma": "150m"
  * "fe": "250m"
  * "sp_divtx": "270m"
  * "timer": "50m"
  * "pcm": "270m"
  * "pio": "50m"
  * "gdma": "bus"
  * "nand": "125m"
  * "i2c": "50m"
  * "i2s": "270m"
  * "spi": "bus"
  * "uart1": "50m"
  * "uart2": "50m"
  * "uart3": "50m"
  * "eth": "50m"
  * "pcie0": "125m"
  * "pcie1": "125m"
  * "pcie2": "125m"
  * "crypto": "250m"
  * "shxc": "50m"

With this information the clk driver will provide clock and gates
functionality from a a set of hardcoded clocks allowing to define
a nice device tree without fixed clocks.

Signed-off-by: Sergio Paracuellos 
---
 drivers/clk/Kconfig |   1 +
 drivers/clk/Makefile|   1 +
 drivers/clk/ralink/Kconfig  |  14 +
 drivers/clk/ralink/Makefile |   2 +
 drivers/clk/ralink/clk-mt7621.c | 435 
 5 files changed, 453 insertions(+)
 create mode 100644 drivers/clk/ralink/Kconfig
 create mode 100644 drivers/clk/ralink/Makefile
 create mode 100644 drivers/clk/ralink/clk-mt7621.c

diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index c715d4681a0b..5f94c4329033 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -372,6 +372,7 @@ source "drivers/clk/mediatek/Kconfig"
 source "drivers/clk/meson/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
+source "drivers/clk/ralink/Kconfig"
 source "drivers/clk/renesas/Kconfig"
 source "drivers/clk/rockchip/Kconfig"
 source "drivers/clk/samsung/Kconfig"
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index da8fcf147eb1..6578e167b047 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_COMMON_CLK_NXP)+= nxp/
 obj-$(CONFIG_MACH_PISTACHIO)   += pistachio/
 obj-$(CONFIG_COMMON_CLK_PXA)   += pxa/
 obj-$(CONFIG_COMMON_CLK_QCOM)  += qcom/
+obj-y  += ralink/
 obj-y  += renesas/
 obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/
 obj-$(CONFIG_COMMON_CLK_SAMSUNG)   += samsung/
diff --git a/drivers/clk/ralink/Kconfig b/drivers/clk/ralink/Kconfig
new file mode 100644
index ..7e8697327e0c
--- /dev/null
+++ b/drivers/clk/ralink/Kconfig
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# MediaTek Mt7621 Clock Driver
+#
+menu "Clock driver for mediatek mt7621 SoC"
+   depends on SOC_MT7621 || COMPILE_TEST
+
+config CLK_MT7621
+   bool "Clock driver for MediaTek MT7621"
+   depends on SOC_MT7621 || COMPILE_TEST
+   default SOC_MT7621
+   help
+ This driver supports MediaTek MT7621 basic clocks.
+endmenu
diff --git a/drivers/clk/ralink/Makefile b/drivers/clk/ralink/Makefile
new file mode 100644
index ..cf6f9216379d
--- /dev/null
+++ b/drivers/clk/ralink/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_CLK_MT7621) += clk-mt7621.o
diff --git a/drivers/clk/ralink/clk-mt7621.c b/drivers/clk/ralink/clk-mt7621.c
new file mode 100644
index ..4e929f13fe7c
--- /dev/null
+++ b/drivers/clk/ralink/clk-mt7621.c
@@ -0,0 +1,435 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Mediatek MT7621 Clock Driver
+ * Author: Sergio Paracuellos 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Configuration registers */
+#define SYSC_REG_SYSTEM_CONFIG0 0x10
+#define SYSC_REG_SYSTEM_CONFIG1 0x14
+#define SYSC_REG_CLKCFG0   0x2c
+#define SYSC_REG_CLKCFG1   0x30
+#define SYSC_REG_CUR_CLK_STS   0x44
+
+#define MEMC_REG_CPU_PLL   0x648
+#define XTAL_MODE_SEL_MASK 0x7
+#define XTAL_MODE_SEL_SHIFT6
+
+#define CPU_CLK_SEL_MASK   0x3
+#define CPU_CLK_SEL_SHIFT  30
+
+#define CUR_CPU_FDIV_MASK  0x1f
+#define CUR_CPU_FDIV_SHIFT 8
+#define CUR_CPU_FFRAC_MASK 0x1f
+#define CUR_CPU_FFRAC_SHIFT0
+
+#define CPU_PLL_PREDIV_MASK0x3
+#define CPU_PLL_PREDIV_SHIFT

[PATCH v4 5/6] staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid 'mtk'

2020-11-22 Thread Sergio Paracuellos
Vendor listed for mediatek in kernel vendor file 'vendor-prefixes.yaml'
contains 'mediatek' as a valid vendor string. Some nodes in the device
tree are using an invalid vendor string vfor 'mtk' instead. Fix all of
them in dts file. Update also ralink mt7621 related code to properly
match new strings. Even there are used in the device tree there are
some strings that are not referred anywhere but have been also updated
with new vendor name. These are 'mtk,mt7621-wdt', 'mtk,mt7621-nand',
'mtk,mt7621-mc', and 'mtk,mt7621-cpc'.

Signed-off-by: Sergio Paracuellos 
---
 arch/mips/ralink/mt7621.c  |  6 +++---
 drivers/staging/mt7621-dts/mt7621.dtsi | 12 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/ralink/mt7621.c b/arch/mips/ralink/mt7621.c
index ca0ac607b0f3..5d74fc1c96ac 100644
--- a/arch/mips/ralink/mt7621.c
+++ b/arch/mips/ralink/mt7621.c
@@ -112,8 +112,8 @@ phys_addr_t mips_cpc_default_phys_base(void)
 
 void __init ralink_of_remap(void)
 {
-   rt_sysc_membase = plat_of_remap_node("mtk,mt7621-sysc");
-   rt_memc_membase = plat_of_remap_node("mtk,mt7621-memc");
+   rt_sysc_membase = plat_of_remap_node("mediatek,mt7621-sysc");
+   rt_memc_membase = plat_of_remap_node("mediatek,mt7621-memc");
 
if (!rt_sysc_membase || !rt_memc_membase)
panic("Failed to remap core resources");
@@ -181,7 +181,7 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
 
if (n0 == MT7621_CHIP_NAME0 && n1 == MT7621_CHIP_NAME1) {
name = "MT7621";
-   soc_info->compatible = "mtk,mt7621-soc";
+   soc_info->compatible = "mediatek,mt7621-soc";
} else {
panic("mt7621: unknown SoC, n0:%08x n1:%08x\n", n0, n1);
}
diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 35cfda8f6faf..8fc311703beb 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -56,7 +56,7 @@ palmbus: palmbus@1E00 {
#size-cells = <1>;
 
sysc: sysc@0 {
-   compatible = "mtk,mt7621-sysc", "syscon";
+   compatible = "mediatek,mt7621-sysc", "syscon";
reg = <0x0 0x100>;
 
pll: pll {
@@ -69,7 +69,7 @@ pll: pll {
};
 
wdt: wdt@100 {
-   compatible = "mtk,mt7621-wdt";
+   compatible = "mediatek,mt7621-wdt";
reg = <0x100 0x100>;
};
 
@@ -125,17 +125,17 @@ i2s: i2s@a00 {
};
 
memc: memc@5000 {
-   compatible = "mtk,mt7621-memc";
+   compatible = "mediatek,mt7621-memc";
reg = <0x5000 0x1000>;
};
 
cpc: cpc@1fbf {
-compatible = "mtk,mt7621-cpc";
+compatible = "mediatek,mt7621-cpc";
 reg = <0x1fbf 0x8000>;
};
 
mc: mc@1fbf8000 {
-   compatible = "mtk,mt7621-mc";
+   compatible = "mediatek,mt7621-mc";
reg = <0x1fbf8000 0x8000>;
};
 
@@ -368,7 +368,7 @@ timer {
nand: nand@1e003000 {
status = "disabled";
 
-   compatible = "mtk,mt7621-nand";
+   compatible = "mediatek,mt7621-nand";
bank-width = <2>;
reg = <0x1e003000 0x800
0x1e003800 0x800>;
-- 
2.25.1



linux-next: Fixes tag needs some work in the pci tree

2020-11-22 Thread Stephen Rothwell
Hi all,

In commit

  466d79c1a470 ("PCI: Fix overflow in command-line resource alignment requests")

Fixes tag

  Fixes: 32a9a682bef2 ("PCI: allow assignment of memory resources with a

has these problem(s):

  - Subject has leading but no trailing parentheses
  - Subject has leading but no trailing quotes

Please do not split Fixes tags over more than one line.

-- 
Cheers,
Stephen Rothwell


pgp2CEDpCL3aP.pgp
Description: OpenPGP digital signature


[PATCH v4 2/6] dt: bindings: add mt7621-clk device tree binding documentation

2020-11-22 Thread Sergio Paracuellos
Adds device tree binding documentation for clocks in the
MT7621 SOC.

Signed-off-by: Sergio Paracuellos 
---
 .../bindings/clock/mediatek,mt7621-clk.yaml   | 67 +++
 1 file changed, 67 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml

diff --git a/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml 
b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml
new file mode 100644
index ..6aca4c1a4a46
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/mediatek,mt7621-clk.yaml
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/mediatek,mt7621-clk.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MT7621 Clock Device Tree Bindings
+
+maintainers:
+  - Sergio Paracuellos 
+
+description: |
+  The MT7621 has a PLL controller from where the cpu clock is provided
+  as well as derived clocks for the bus and the peripherals. It also
+  can gate SoC device clocks.
+
+  Each clock is assigned an identifier and client nodes use this identifier
+  to specify the clock which they consume.
+
+  All these identifiers could be found in:
+  [1]: .
+
+  The mt7621 clock node should be the child of a syscon node with the
+  required property:
+
+  - compatible: Should be one of the following:
+"mediatek,mt7621-sysc", "syscon"
+
+  Refer to the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+const: mediatek,mt7621-clk
+
+  "#clock-cells":
+description:
+  The first cell indicates the clock gate number, see [1] for available
+  clocks.
+const: 1
+
+  clock-output-names:
+maxItems: 8
+
+required:
+  - compatible
+  - '#clock-cells'
+  - clock-output-names
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+
+sysc: sysc@0 {
+  compatible = "mediatek,mt7621-sysc", "syscon";
+  reg = <0x0 0x100>;
+
+  pll {
+compatible = "mediatek,mt7621-clk";
+#clock-cells = <1>;
+clock-output-names = "xtal", "cpu", "bus",
+ "50m", "125m", "150m",
+ "250m", "270m";
+  };
+};
-- 
2.25.1



[PATCH v4 1/6] dt-bindings: clock: add dt binding header for mt7621 clocks

2020-11-22 Thread Sergio Paracuellos
Adds dt binding header for 'mediatek,mt7621-clk' clocks.

Acked-by: Rob Herring 
Signed-off-by: Sergio Paracuellos 
---
 include/dt-bindings/clock/mt7621-clk.h | 41 ++
 1 file changed, 41 insertions(+)
 create mode 100644 include/dt-bindings/clock/mt7621-clk.h

diff --git a/include/dt-bindings/clock/mt7621-clk.h 
b/include/dt-bindings/clock/mt7621-clk.h
new file mode 100644
index ..1422badcf9de
--- /dev/null
+++ b/include/dt-bindings/clock/mt7621-clk.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Author: Sergio Paracuellos 
+ */
+
+#ifndef _DT_BINDINGS_CLK_MT7621_H
+#define _DT_BINDINGS_CLK_MT7621_H
+
+#define MT7621_CLK_XTAL0
+#define MT7621_CLK_CPU 1
+#define MT7621_CLK_BUS 2
+#define MT7621_CLK_50M 3
+#define MT7621_CLK_125M4
+#define MT7621_CLK_150M5
+#define MT7621_CLK_250M6
+#define MT7621_CLK_270M7
+
+#define MT7621_CLK_HSDMA   8
+#define MT7621_CLK_FE  9
+#define MT7621_CLK_SP_DIVTX10
+#define MT7621_CLK_TIMER   11
+#define MT7621_CLK_PCM 12
+#define MT7621_CLK_PIO 13
+#define MT7621_CLK_GDMA14
+#define MT7621_CLK_NAND15
+#define MT7621_CLK_I2C 16
+#define MT7621_CLK_I2S 17
+#define MT7621_CLK_SPI 18
+#define MT7621_CLK_UART1   19
+#define MT7621_CLK_UART2   20
+#define MT7621_CLK_UART3   21
+#define MT7621_CLK_ETH 22
+#define MT7621_CLK_PCIE0   23
+#define MT7621_CLK_PCIE1   24
+#define MT7621_CLK_PCIE2   25
+#define MT7621_CLK_CRYPTO  26
+#define MT7621_CLK_SHXC27
+
+#define MT7621_CLK_MAX 28
+
+#endif /* _DT_BINDINGS_CLK_MT7621_H */
-- 
2.25.1



[PATCH v4 4/6] staging: mt7621-dts: make use of new 'mt7621-clk'

2020-11-22 Thread Sergio Paracuellos
Clocks for SoC mt7621 have been properly integrated so there is
no need to declare fixed clocks at all in the device tree. Remove
all of them, add new device tree nodes for mt7621-clk and update
the rest of the nodes to use them.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-dts/gbpc1.dts   | 11 
 drivers/staging/mt7621-dts/mt7621.dtsi | 75 --
 2 files changed, 35 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/mt7621-dts/gbpc1.dts 
b/drivers/staging/mt7621-dts/gbpc1.dts
index a7c0d3115d72..7716d0efe524 100644
--- a/drivers/staging/mt7621-dts/gbpc1.dts
+++ b/drivers/staging/mt7621-dts/gbpc1.dts
@@ -100,17 +100,6 @@ partition@5 {
};
 };
 
- {
-   compatible = "fixed-clock";
-   /* This is normally 1/4 of cpuclock */
-   clock-frequency = <22500>;
-};
-
- {
-   compatible = "fixed-clock";
-   clock-frequency = <9>;
-};
-
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 82aa93634eda..35cfda8f6faf 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 / {
#address-cells = <1>;
@@ -27,27 +28,6 @@ aliases {
serial0 = 
};
 
-   cpuclock: cpuclock@0 {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-
-   /* FIXME: there should be way to detect this */
-   clock-frequency = <88000>;
-   };
-
-   sysclock: sysclock@0 {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-
-   /* This is normally 1/4 of cpuclock */
-   clock-frequency = <22000>;
-   };
-
-   mmc_clock: mmc_clock@0 {
-   #clock-cells = <0>;
-   compatible = "fixed-clock";
-   clock-frequency = <4800>;
-   };
 
mmc_fixed_3v3: fixedregulator@0 {
compatible = "regulator-fixed";
@@ -76,8 +56,16 @@ palmbus: palmbus@1E00 {
#size-cells = <1>;
 
sysc: sysc@0 {
-   compatible = "mtk,mt7621-sysc";
+   compatible = "mtk,mt7621-sysc", "syscon";
reg = <0x0 0x100>;
+
+   pll: pll {
+   compatible = "mediatek,mt7621-clk";
+   #clock-cells = <1>;
+   clock-output-names = "xtal", "cpu", "bus",
+"50m", "125m", "150m",
+"250m", "270m";
+   };
};
 
wdt: wdt@100 {
@@ -100,8 +88,8 @@ i2c: i2c@900 {
compatible = "mediatek,mt7621-i2c";
reg = <0x900 0x100>;
 
-   clocks = <>;
-
+   clocks = < MT7621_CLK_I2C>;
+   clock-names = "i2c";
resets = < 16>;
reset-names = "i2c";
 
@@ -118,8 +106,8 @@ i2s: i2s@a00 {
compatible = "mediatek,mt7621-i2s";
reg = <0xa00 0x100>;
 
-   clocks = <>;
-
+   clocks = < MT7621_CLK_I2S>;
+   clock-names = "i2s";
resets = < 17>;
reset-names = "i2s";
 
@@ -155,8 +143,8 @@ uartlite: uartlite@c00 {
compatible = "ns16550a";
reg = <0xc00 0x100>;
 
-   clocks = <>;
-   clock-frequency = <5000>;
+   clocks = < MT7621_CLK_UART1>;
+   clock-names = "uart1";
 
interrupt-parent = <>;
interrupts = ;
@@ -172,7 +160,8 @@ spi0: spi@b00 {
compatible = "ralink,mt7621-spi";
reg = <0xb00 0x100>;
 
-   clocks = <>;
+   clocks = < MT7621_CLK_SPI>;
+   clock-names = "spi";
 
resets = < 18>;
reset-names = "spi";
@@ -188,6 +177,8 @@ gdma: gdma@2800 {
compatible = "ralink,rt3883-gdma";
reg = <0x2800 0x800>;
 
+   clocks = < MT7621_CLK_GDMA>;
+   clock-names = "gdma";
resets = < 14>;
reset-names = "dma";
 
@@ -205,6 +196,8 @@ hsdma: hsdma@7000 {
compatible = "mediatek,mt7621-hsdma";
reg = <0x7000 0x1000>;
 
+   clocks = < MT7621_CLK_HSDMA>;
+   

[PATCH v4 0/6] MIPS: ralink: add CPU clock detection and clock driver for MT7621

2020-11-22 Thread Sergio Paracuellos
This patchset ports CPU clock detection for MT7621 from OpenWrt
and adds a complete clock plan for the mt7621 SOC.

The documentation for this SOC only talks about two registers
regarding to the clocks:
* SYSC_REG_CPLL_CLKCFG0 - provides some information about boostrapped
refclock. PLL and dividers used for CPU and some sort of BUS (AHB?).
* SYSC_REG_CPLL_CLKCFG1 - a banch of gates to enable/disable clocks for
all or some ip cores. 

No documentation about a probably existent set of dividers for each ip
core is included in the datasheets. So we cannot make anything better,
AFAICT.

Looking into driver code, and some openWRT patched there are
another frequences which are used in some drivers (uart, sd...).
According to all of this information the clock plan for this
SoC is set as follows:
 - Main top clock "xtal" from where all the rest of the world is
   derived.
 - CPU clock "cpu" derived from "xtal" frequencies and a bunch of
   register reads and predividers.
 - BUS clock "bus" derived from "cpu" and with (cpu / 4) MHz.
 - Fixed clocks from "xtal":
* "50m": 50 MHz.
* "125m": 125 MHz.
* "150m": 150 MHz.
* "250m": 250 MHz.
* "270m": 270 MHz.

We also have a buch of gate clocks with their parents:
 - "hsdma": "150m"
 - "fe": "250m"
 - "sp_divtx": "270m"
 - "timer": "50m"
 - "pcm": "270m"
 - "pio": "50m"
 - "gdma": "bus"
 - "nand": "125m"
 - "i2c": "50m"
 - "i2s": "270m"
 - "spi": "bus"
 - "uart1": "50m"
 - "uart2": "50m"
 - "uart3": "50m"
 - "eth": "50m"
 - "pcie0": "125m"
 - "pcie1": "125m"
 - "pcie2": "125m"
 - "crypto": "250m"
 - "shxc": "50m"

There was a previous attempt of doing this here[0] but the author
(Chuanhong Guo) did not wanted to make assumptions of a clock plan
for the platform that time. It seems that now he has a better idea of
how the clocks are dispossed for this SoC so he share code[1] where
some frequencies and clock parents for the gates are coded from a
real mediatek private clock plan.

I do really want this to be upstreamed so according to the comments
in previous attempt[0] from Oleksij Rempel and the frequencies in
code[1] I have tried to do this by myself.

All of this patches have been tested in a GNUBee PC1 resulting in a
working platform.

Changes in v4:
 - Add Acked-by from Rob Herring for binding headers (PATCH 1/6).
 - Convert bindings to not use syscon phandle and declare clock as
   a child of the syscon node. Update device tree and binding doc
   accordly.
 - Make use of 'syscon_node_to_regmap' in driver code instead of
   get this using the phandle function.
 - Properly unregister clocks for the error path of the function
   'mt7621_clk_init'.
 - Include ARRAY_SIZE of fixed clocks in the 'count' to kzalloc
   of 'clk_data'.
 - Add new patch changing invalid vendor 'mtk' in favour of 'mediatek'
   which is the one listed in 'vendor-prefixes.yaml'. Update mt7621 code
   accordly. I have added this patch inside this series because clk
   binding is referring syscon node and the string for that node was
   with not listed vendor. Hence update and have all of this correct
   in the same series.

Changes in v3:
 - Fix compilation warnings reported by kernel test robot because of
   ignoring return values of 'of_clk_hw_register' in functions
   'mt7621_register_top_clocks' and 'mt7621_gate_ops_init'.
 - Fix dts file and binding documentation 'clock-output-names'.

Changes in v2:
 - Remove the following patches:
   * dt: bindings: add mt7621-pll device tree binding documentation.
   * MIPS: ralink: add clock device providing cpu/ahb/apb clock for mt7621.
 - Move all relevant clock code to 'drivers/clk/ralink/clk-mt7621.c' and
   unify there previous 'mt7621-pll' and 'mt7621-clk' into a unique driver
   and binding 'mt7621-clk'.
 - Driver is not a platform driver anymore and now make use of 'CLK_OF_DECLARE'
   because we need clocks available in 'plat_time_init' before setting up
   the timer for the GIC.
 - Use new fixed clocks as parents for different gates and deriving from 'xtal'
   using frequencies in[1].
 - Adapt dts file and bindings header and documentation for new changes.
 - Change MAINTAINERS file to only contains clk-mt7621.c code and
   mediatek,mt7621-clk.yaml file.

[0]: https://www.lkml.org/lkml/2019/7/23/1044
[1]: 
https://github.com/981213/linux/commit/2eca1f045e4c3db18c941135464c0d7422ad8133


Sergio Paracuellos (6):
  dt-bindings: clock: add dt binding header for mt7621 clocks
  dt: bindings: add mt7621-clk device tree binding documentation
  clk: ralink: add clock driver for mt7621 SoC
  staging: mt7621-dts: make use of new 'mt7621-clk'
  staging: mt7621-dts: use valid vendor 'mediatek' instead of invalid
'mtk'
  MAINTAINERS: add MT7621 CLOCK maintainer

 .../bindings/clock/mediatek,mt7621-clk.yaml   |  67 +++
 MAINTAINERS   |   6 +
 arch/mips/ralink/mt7621.c |   6 +-
 drivers/clk/Kconfig   |   1 +
 

linux-next: Fixes tag needs some work in the tip tree

2020-11-22 Thread Stephen Rothwell
Hi all,

In commit

  d1adcfbb520c ("iommu/amd: Fix IOMMU interrupt generation in X2APIC mode")

Fixes tag

  Fixes: 47bea873cf80 "x86/msi: Only use high bits of MSI address for DMAR 
unit")

has these problem(s):

  - Subject has trailing but no trailing parenthesis.

-- 
Cheers,
Stephen Rothwell


pgpmnZn9xr4rF.pgp
Description: OpenPGP digital signature


Re: [PATCH 4.4 00/15] 4.4.245-rc1 review

2020-11-22 Thread Naresh Kamboju
On Fri, 20 Nov 2020 at 16:33, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 4.4.245 release.
> There are 15 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Sun, 22 Nov 2020 10:45:32 +.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.245-rc1.gz
> or in the git tree and branch at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.4.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h


Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Tested-by: Linux Kernel Functional Testing 

Summary


kernel: 4.4.245-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 11095ab90e22ac875983239a445f6b4ad64b6e08
git describe: v4.4.244-16-g11095ab90e22
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.4.y/build/v4.4.244-16-g11095ab90e22

No regressions (compared to build v4.4.244)

No fixes (compared to build v4.4.244)


Ran 32775 total tests in the following environments and test suites.

Environments
--
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- qemu-arm64-clang
- qemu-arm64-kasan
- qemu-x86_64-clang
- qemu-x86_64-kasan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- x15 - arm
- x86_64
- x86-kasan

Test Suites
---
* build
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* perf
* v4l2-compliance
* kvm-unit-tests
* ltp-tracing-tests
* install-android-platform-tools-r2600

Summary


kernel: 4.4.245-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.245-rc1-hikey-20201120-861
git commit: a395e149575bc8d8ec23a677f979301bfefd8862
git describe: 4.4.245-rc1-hikey-20201120-861
Test details: 
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.245-rc1-hikey-20201120-861

No regressions (compared to build 4.4.244-rc1-hikey-20201117-859)

No fixes (compared to build 4.4.244-rc1-hikey-20201117-859)

Ran 1722 total tests in the following environments and test suites.

Environments
--
- hi6220-hikey - arm64

Test Suites
---
* build
* install-android-platform-tools-r2600
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance

-- 
Linaro LKFT
https://lkft.linaro.org


linux-next: Signed-off-by missing for commit in the rcu tree

2020-11-22 Thread Stephen Rothwell
Hi all,

Commit

  ca3bd09a3a49 ("rcu: Allow rcu_irq_enter_check_tick() from NMI")

is missing a Signed-off-by from its author.

Commit

  00dc4fd2297c ("tools/rcutorture: Make identify_qemu_vcpus() independent of 
local language")

is missing a Signed-off-by from its committer.

-- 
Cheers,
Stephen Rothwell


pgpF0suXe37Kv.pgp
Description: OpenPGP digital signature


Re: linux-next: Signed-off-by missing for commit in the rcu tree

2020-11-22 Thread Stephen Rothwell
Hi all,

On Sun, 22 Nov 2020 21:08:10 +1100 Stephen Rothwell  
wrote:
>
> Commit
> 
>   ca3bd09a3a49 ("rcu: Allow rcu_irq_enter_check_tick() from NMI")
> 
> is missing a Signed-off-by from its author.

Please ignore this bit.
dd

-- 
Cheers,
Stephen Rothwell


pgps8l6kVzv4f.pgp
Description: OpenPGP digital signature


Re: [PATCH v3] HID: i2c-hid: add polling mode based on connected GPIO chip's pin status

2020-11-22 Thread Coiby Xu

Hi,

On Thu, Oct 22, 2020 at 02:22:51PM +, Barnabás Pőcze wrote:

Hi,

I think this looks a lot better than the first version, the issues around
suspend/resume are sorted out as far as I can see. However, I still have a 
couple
comments, mainly minor ones.


Thank you for reviewing this patch!



[...]
+/* polling mode */
+#define I2C_HID_POLLING_DISABLED 0
+#define I2C_HID_POLLING_GPIO_PIN 1
+#define I2C_HID_POLLING_INTERVAL_ACTIVE_US 4000
+#define I2C_HID_POLLING_INTERVAL_IDLE_MS 10
+
+static u8 polling_mode;
+module_param(polling_mode, byte, 0444);
+MODULE_PARM_DESC(polling_mode, "How to poll - 0 disabled; 1 based on GPIO pin's 
status");
+


Minor thing, but maybe the default value should be documented in the parameter
description?



+static unsigned int polling_interval_active_us = 
I2C_HID_POLLING_INTERVAL_ACTIVE_US;
+module_param(polling_interval_active_us, uint, 0644);
+MODULE_PARM_DESC(polling_interval_active_us,
+"Poll every {polling_interval_active_us} us when the touchpad is 
active. Default to 4000 us");
+
+static unsigned int polling_interval_idle_ms = 
I2C_HID_POLLING_INTERVAL_IDLE_MS;


Since these two parameters are mostly read, I think the `__read_mostly`
attribute (linux/cache.h) is justified here.



+module_param(polling_interval_idle_ms, uint, 0644);
+MODULE_PARM_DESC(polling_interval_idle_ms,
+"Poll every {polling_interval_idle_ms} ms when the touchpad is 
idle. Default to 10 ms");


This is minor stylistic thing; as far as I see, the prevalent pattern is to put
the default value at the end, in parenthesis:
E.g. "some parameter description (default=X)" or "... (default: X)" or 
something similar

Maybe __stringify() (linux/stringify.h) could be used here and for the previous
module parameter?

E.g. "... (default=" __stringify(I2C_HID_POLLING_INTERVAL_IDLE_MS) ")"


Thank you for the above three suggestions! Will be applied in v4.



[...]
+static int get_gpio_pin_state(struct irq_desc *irq_desc)
+{
+   struct gpio_chip *gc = irq_data_get_irq_chip_data(_desc->irq_data);
+
+   return gc->get(gc, irq_desc->irq_data.hwirq);
+}
+
+static bool interrupt_line_active(struct i2c_client *client)
+{
+   unsigned long trigger_type = irq_get_trigger_type(client->irq);


Can the trigger type change? Because if not, then I think it'd be better to 
store
the value somewhere and not query it every time.


The irq trigger type is obtained from ACPI so I don't think it won't
change.



+   struct irq_desc *irq_desc = irq_to_desc(client->irq);


Same here.


Thank you for the reminding!



+   ssize_t status = get_gpio_pin_state(irq_desc);


`get_gpio_pin_state()` returns an `int`, so I am not sure why `ssize_t` is used 
here.



I used `ssize_t` because I found gpiolib-sysfs.c uses `ssize_t`

// drivers/gpio/gpiolib-sysfs.c
static ssize_t value_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct gpiod_data *data = dev_get_drvdata(dev);
struct gpio_desc *desc = data->desc;
ssize_t status;

mutex_lock(>mutex);

status = gpiod_get_value_cansleep(desc);
...
return status;
}

According to the book Advanced Programming in the UNIX Environment by
W. Richard Stevens,
With the 1990 POSIX.1 standard, the primitive system data type
ssize_t was introduced to provide the signed return value...

So ssize_t is fairly common, for example, the read and write syscall
return a value of type ssize_t. But I haven't found out why ssize_t is
better int.



+
+   if (status < 0) {
+   dev_warn(>dev,
+"Failed to get GPIO Interrupt line status for %s",
+client->name);


I think it's possible that the kernel message buffer is flooded with these
messages, which is not optimal in my opinion.


Thank you! Replaced with dev_dbg in v4.



+   return false;
+   }
+   /*
+* According to Windows Precsiontion Touchpad's specs
+* 
https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-device-bus-connectivity,
+* GPIO Interrupt Assertion Leve could be either ActiveLow or
+* ActiveHigh.
+*/
+   if (trigger_type & IRQF_TRIGGER_LOW)
+   return !status;
+
+   return status;
+}
+
+static int i2c_hid_polling_thread(void *i2c_hid)
+{
+   struct i2c_hid *ihid = i2c_hid;
+   struct i2c_client *client = ihid->client;
+   unsigned int polling_interval_idle;
+
+   while (1) {
+   if (kthread_should_stop())
+   break;


I think this should be `while (!kthread_should_stop())`.


This simplifies the code. Thank you!



+
+   while (interrupt_line_active(client) &&
+  !test_bit(I2C_HID_READ_PENDING, >flags) &&
+  !kthread_should_stop()) {
+   

Re: [PATCH net-next,v5 0/9] netfilter: flowtable bridge and vlan enhancements

2020-11-22 Thread Alexander Lobakin
From: Pablo Neira Ayuso 
Date: Fri, 20 Nov 2020 13:49:12 +0100

> Hi,
> 
> The following patchset augments the Netfilter flowtable fastpath to
> support for network topologies that combine IP forwarding, bridge and
> VLAN devices.
> 
> This v5 includes updates for:
> 
> - Patch #2: fix incorrect xmit type in IPv6 path, per Florian Westphal.
> - Patch #3: fix possible off by one in dev_fill_forward_path() stack logic,
> per Florian Westphal.
> - Patch #7: add a note to patch description to specify that FDB topology
> updates are not supported at this stage, per Jakub Kicinski.
> 
> A typical scenario that can benefit from this infrastructure is composed
> of several VMs connected to bridge ports where the bridge master device
> 'br0' has an IP address. A DHCP server is also assumed to be running to
> provide connectivity to the VMs. The VMs reach the Internet through
> 'br0' as default gateway, which makes the packet enter the IP forwarding
> path. Then, netfilter is used to NAT the packets before they leave
> through the wan device.
> 
> Something like this:
> 
>fast path
> ..
>/  \
>|   IP forwarding   |
>|  / \  .
>|   br0   eth0
>.   / \
>-- veth1  veth2
>.
>.
>.
>  eth0
>ab:cd:ef:ab:cd:ef
>   VM

I'm concerned about bypassing vlan and bridge's .ndo_start_xmit() in
case of this shortcut. We'll have incomplete netdevice Tx stats for
these two, as it gets updated inside this callbacks.

> The idea is to accelerate forwarding by building a fast path that takes
> packets from the ingress path of the bridge port and place them in the
> egress path of the wan device (and vice versa). Hence, skipping the
> classic bridge and IP stack paths.
> 
> This patchset is composed of:
> 
> Patch #1 adds a placeholder for the hash calculation, instead of using
>  the dir field.
> 
> Patch #2 adds the transmit path type field to the flow tuple. Two transmit
>  paths are supported so far: the neighbour and the xfrm transmit
>  paths. This patch comes in preparation to add a new direct ethernet
>  transmit path (see patch #7).
> 
> Patch #3 adds dev_fill_forward_path() and .ndo_fill_forward_path() to
>  netdev_ops. This new function describes the list of netdevice hops
>  to reach a given destination MAC address in the local network 
> topology,
>  e.g.
> 
>IP forwarding
>   / \
>br0  eth0
>/ \
>veth1 veth2
> .
> .
> .
>eth0
>  ab:cd:ef:ab:cd:ef
> 
>   where veth1 and veth2 are bridge ports and eth0 provides Internet
>   connectivity. eth0 is the interface in the VM which is connected to
>   the veth1 bridge port. Then, for packets going to br0 whose
>   destination MAC address is ab:cd:ef:ab:cd:ef, 
> dev_fill_forward_path()
>   provides the following path: br0 -> veth1.
> 
> Patch #4 adds .ndo_fill_forward_path for VLAN devices, which provides the next
>  device hop via vlan->real_dev. This annotates the VLAN id and 
> protocol.
>  This is useful to know what VLAN headers are expected from the 
> ingress
>  device. This also provides information regarding the VLAN headers
>  to be pushed in the egress path.
> 
> Patch #5 adds .ndo_fill_forward_path for bridge devices, which allows to make
>  lookups to the FDB to locate the next device hop (bridge port) in the
>  forwarding path.
> 
> Patch #6 updates the flowtable to use the dev_fill_forward_path()
>  infrastructure to obtain the ingress device in the fastpath.
> 
> Patch #7 updates the flowtable to use dev_fill_forward_path() to obtain the
>  egress device in the forwarding path. This also adds the direct
>  ethernet transmit path, which pushes the ethernet header to the
>  packet and send it through dev_queue_xmit(). This patch adds
>  support for the bridge, so bridge ports use this direct xmit path.
> 
> Patch #8 adds ingress VLAN support (up to 2 VLAN tags, QinQ). The VLAN
>  information is also provided by dev_fill_forward_path(). Store the
>  VLAN id and protocol in the flow tuple for hash lookups. The VLAN
>  support in the xmit path is achieved by annotating the first vlan
>  device found in the xmit path and by calling dev_hard_header()
>  (previous patch #7) before dev_queue_xmit().
> 
> Patch #9 extends nft_flowtable.sh selftest: This is adding a test to

Linux 4.19.159

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.19.159 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/kernel-parameters.txt |7 +
 Makefile|2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h  |   22 +++
 arch/powerpc/include/asm/exception-64s.h|9 +
 arch/powerpc/include/asm/feature-fixups.h   |   19 +++
 arch/powerpc/include/asm/futex.h|4 
 arch/powerpc/include/asm/kup.h  |   40 ++
 arch/powerpc/include/asm/security_features.h|7 +
 arch/powerpc/include/asm/setup.h|4 
 arch/powerpc/include/asm/uaccess.h  |  147 ++--
 arch/powerpc/kernel/exceptions-64s.S|   96 ---
 arch/powerpc/kernel/head_8xx.S  |8 -
 arch/powerpc/kernel/setup_64.c  |  122 +++
 arch/powerpc/kernel/vmlinux.lds.S   |   14 ++
 arch/powerpc/lib/checksum_wrappers.c|4 
 arch/powerpc/lib/feature-fixups.c   |  104 
 arch/powerpc/lib/string_32.S|4 
 arch/powerpc/lib/string_64.S|6 
 arch/powerpc/platforms/powernv/setup.c  |   17 ++
 arch/powerpc/platforms/pseries/setup.c  |8 +
 arch/x86/kvm/emulate.c  |8 +
 drivers/acpi/evged.c|2 
 drivers/input/keyboard/sunkbd.c |   41 +-
 net/can/proc.c  |6 
 net/mac80211/sta_info.c |   18 ++
 tools/perf/util/cs-etm.c|3 
 tools/perf/util/cs-etm.h|3 
 27 files changed, 622 insertions(+), 103 deletions(-)

Andrew Donnellan (1):
  powerpc: Fix __clear_user() with KUAP enabled

Christophe Leroy (3):
  powerpc: Add a framework for user access tracking
  powerpc: Implement user_access_begin and friends
  powerpc/8xx: Always fault when _PAGE_ACCESSED is not set

Daniel Axtens (1):
  powerpc/64s: move some exception handlers out of line

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Greg Kroah-Hartman (1):
  Linux 4.19.159

Johannes Berg (1):
  mac80211: always wind down STA state

Nicholas Piggin (3):
  powerpc/64s: flush L1D on kernel entry
  powerpc/uaccess: Evaluate macro arguments once, before user access is 
allowed
  powerpc/64s: flush L1D after user accesses

Nick Desaulniers (1):
  ACPI: GED: fix -Wformat

Salvatore Bonaccorso (1):
  Revert "perf cs-etm: Move definition of 'traceid_list' global variable 
from header file"

Zhang Changzhong (1):
  can: proc: can_remove_proc(): silence remove_proc_entry warning



Linux 5.4.79

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 5.4.79 kernel.

All users of the 5.4 kernel series must upgrade.

The updated 5.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.4.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/kernel-parameters.txt|7 
 Makefile   |2 
 arch/mips/pci/pci-xtalk-bridge.c   |2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h |   29 +--
 arch/powerpc/include/asm/exception-64s.h   |   12 +
 arch/powerpc/include/asm/feature-fixups.h  |   19 +
 arch/powerpc/include/asm/kup.h |   27 ++
 arch/powerpc/include/asm/security_features.h   |7 
 arch/powerpc/include/asm/setup.h   |4 
 arch/powerpc/kernel/exceptions-64s.S   |   88 -
 arch/powerpc/kernel/head_8xx.S |   14 -
 arch/powerpc/kernel/setup_64.c |  122 
 arch/powerpc/kernel/vmlinux.lds.S  |   14 +
 arch/powerpc/lib/feature-fixups.c  |  104 ++
 arch/powerpc/platforms/powernv/setup.c |   17 +
 arch/powerpc/platforms/pseries/setup.c |8 
 arch/x86/kvm/emulate.c |8 
 drivers/acpi/evged.c   |2 
 drivers/input/keyboard/sunkbd.c|   41 +++-
 drivers/net/ethernet/lantiq_xrx200.c   |2 
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c  |  109 ++-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c   |  157 +---
 drivers/net/ethernet/mellanox/mlx5/core/lib/eq.h   |2 
 include/linux/mlx5/driver.h|6 
 net/can/proc.c |6 
 net/mac80211/sta_info.c|   18 +
 tools/testing/selftests/powerpc/security/.gitignore|1 
 tools/testing/selftests/powerpc/security/Makefile  |2 
 tools/testing/selftests/powerpc/security/entry_flush.c |  163 +
 tools/testing/selftests/powerpc/security/rfi_flush.c   |   35 +++
 30 files changed, 856 insertions(+), 172 deletions(-)

Christophe Leroy (1):
  powerpc/8xx: Always fault when _PAGE_ACCESSED is not set

Daniel Axtens (1):
  selftests/powerpc: entry flush test

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Eran Ben Elisha (3):
  net/mlx5: poll cmd EQ in case of command timeout
  net/mlx5: Fix a race when moving command interface to events mode
  net/mlx5: Add retry mechanism to the command entry index allocation

Greg Kroah-Hartman (1):
  Linux 5.4.79

Hauke Mehrtens (1):
  net: lantiq: Add locking for TX DMA channel

Johannes Berg (1):
  mac80211: always wind down STA state

Michael Ellerman (1):
  powerpc: Only include kup-radix.h for 64-bit Book3S

Nicholas Piggin (2):
  powerpc/64s: flush L1D on kernel entry
  powerpc/64s: flush L1D after user accesses

Nick Desaulniers (1):
  ACPI: GED: fix -Wformat

Parav Pandit (1):
  net/mlx5: Use async EQ setup cleanup helpers for multiple EQs

Russell Currey (1):
  selftests/powerpc: rfi_flush: disable entry flush if present

Sudip Mukherjee (1):
  MIPS: PCI: Fix MIPS build

Zhang Changzhong (1):
  can: proc: can_remove_proc(): silence remove_proc_entry warning



Re: Linux 4.19.159

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 8dbc8d4ec8f0..7371643dd8d4 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2560,6 +2560,8 @@
   mds=off [X86]
   tsx_async_abort=off [X86]
   kvm.nx_huge_pages=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
Exceptions:
   This does not have any effect on
@@ -2870,6 +2872,8 @@
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -2919,6 +2923,9 @@
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index 698a9cc2864b..593fdbce712d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 158
+SUBLEVEL = 159
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
new file mode 100644
index ..aa54ac2e5659
--- /dev/null
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+#define _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H
+
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
+/* Prototype for function defined in exceptions-64s.S */
+void do_uaccess_flush(void);
+
+static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
+ unsigned long size)
+{
+}
+
+static inline void prevent_user_access(void __user *to, const void __user 
*from,
+  unsigned long size)
+{
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
+}
+
+#endif /* _ASM_POWERPC_BOOK3S_64_KUP_RADIX_H */
diff --git a/arch/powerpc/include/asm/exception-64s.h 
b/arch/powerpc/include/asm/exception-64s.h
index a86fead0..35fb5b11955a 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -90,11 +90,18 @@
nop;\
nop
 
+#define ENTRY_FLUSH_SLOT   \
+   ENTRY_FLUSH_FIXUP_SECTION;  \
+   nop;\
+   nop;\
+   nop;
+
 /*
  * r10 must be free to use, r13 must be paca
  */
 #define INTERRUPT_TO_KERNEL\
-   STF_ENTRY_BARRIER_SLOT
+   STF_ENTRY_BARRIER_SLOT; \
+   ENTRY_FLUSH_SLOT
 
 /*
  * Macros for annotating the expected destination of (h)rfid
diff --git a/arch/powerpc/include/asm/feature-fixups.h 
b/arch/powerpc/include/asm/feature-fixups.h
index 40a6c9261a6b..5bf3f0779b93 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -205,6 +205,22 @@ label##3:  \
FTR_ENTRY_OFFSET 955b-956b; \
.popsection;
 
+#define UACCESS_FLUSH_FIXUP_SECTION\
+959:   \
+   .pushsection __uaccess_flush_fixup,"a"; \
+   .align 2;   \
+960:   \
+   FTR_ENTRY_OFFSET 959b-960b; \
+   .popsection;
+
+#define ENTRY_FLUSH_FIXUP_SECTION  \
+957:   \
+   .pushsection __entry_flush_fixup,"a";   \
+   .align 2;   \
+958:   \
+   FTR_ENTRY_OFFSET 957b-958b; \
+   .popsection;
+
 #define RFI_FLUSH_FIXUP_SECTION\
 951:   \
.pushsection __rfi_flush_fixup,"a";

Linux 5.9.10

2020-11-22 Thread Greg Kroah-Hartman
I'm announcing the release of the 5.9.10 kernel.

All users of the 5.9 kernel series must upgrade.

The updated 5.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.9.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Documentation/admin-guide/kernel-parameters.txt|7 
 Makefile   |2 
 arch/powerpc/include/asm/book3s/64/kup-radix.h |   66 +++--
 arch/powerpc/include/asm/exception-64s.h   |   12 -
 arch/powerpc/include/asm/feature-fixups.h  |   19 +
 arch/powerpc/include/asm/kup.h |   26 +-
 arch/powerpc/include/asm/security_features.h   |7 
 arch/powerpc/include/asm/setup.h   |4 
 arch/powerpc/kernel/exceptions-64s.S   |   80 +++---
 arch/powerpc/kernel/setup_64.c |  122 ++
 arch/powerpc/kernel/smp.c  |2 
 arch/powerpc/kernel/syscall_64.c   |2 
 arch/powerpc/kernel/vmlinux.lds.S  |   14 +
 arch/powerpc/lib/feature-fixups.c  |  104 
 arch/powerpc/platforms/powernv/setup.c |   17 +
 arch/powerpc/platforms/pseries/setup.c |8 
 arch/x86/events/intel/uncore_snb.c |2 
 arch/x86/kvm/emulate.c |8 
 drivers/acpi/evged.c   |2 
 drivers/input/keyboard/sunkbd.c|   41 ++-
 drivers/leds/leds-lm3697.c |8 
 net/can/proc.c |6 
 net/mac80211/sta_info.c|   18 +
 tools/testing/selftests/kselftest_harness.h|2 
 tools/testing/selftests/powerpc/security/.gitignore|1 
 tools/testing/selftests/powerpc/security/Makefile  |2 
 tools/testing/selftests/powerpc/security/entry_flush.c |  198 +
 tools/testing/selftests/powerpc/security/rfi_flush.c   |   35 ++-
 28 files changed, 718 insertions(+), 97 deletions(-)

Arnd Bergmann (1):
  perf/x86/intel/uncore: Fix Add BW copypasta

Daniel Axtens (1):
  selftests/powerpc: entry flush test

David Edmondson (1):
  KVM: x86: clflushopt should be treated as a no-op by emulation

Dmitry Torokhov (1):
  Input: sunkbd - avoid use-after-free in teardown paths

Gabriel David (1):
  leds: lm3697: Fix out-of-bound access

Greg Kroah-Hartman (1):
  Linux 5.9.10

Johannes Berg (1):
  mac80211: always wind down STA state

Michael Ellerman (1):
  powerpc: Only include kup-radix.h for 64-bit Book3S

Nicholas Piggin (2):
  powerpc/64s: flush L1D on kernel entry
  powerpc/64s: flush L1D after user accesses

Nick Desaulniers (1):
  ACPI: GED: fix -Wformat

Qian Cai (1):
  powerpc/smp: Call rcu_cpu_starting() earlier

Russell Currey (1):
  selftests/powerpc: rfi_flush: disable entry flush if present

Tommi Rantala (1):
  selftests/harness: prettify SKIP message whitespace again

Zhang Changzhong (1):
  can: proc: can_remove_proc(): silence remove_proc_entry warning



Re: Linux 5.9.10

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index dca917ac21d9..12ff6ac67457 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2833,6 +2833,8 @@
   mds=off [X86]
   tsx_async_abort=off [X86]
   kvm.nx_huge_pages=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
Exceptions:
   This does not have any effect on
@@ -3157,6 +3159,8 @@
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -3206,6 +3210,9 @@
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index 59728422b9db..b9f3c6970d24 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 9
-SUBLEVEL = 9
+SUBLEVEL = 10
 EXTRAVERSION =
 NAME = Kleptomaniac Octopus
 
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
index 3ee1ec60be84..28716e2f13e3 100644
--- a/arch/powerpc/include/asm/book3s/64/kup-radix.h
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -27,6 +27,7 @@
 #endif
 .endm
 
+#ifdef CONFIG_PPC_KUAP
 .macro kuap_check_amr gpr1, gpr2
 #ifdef CONFIG_PPC_KUAP_DEBUG
BEGIN_MMU_FTR_SECTION_NESTED(67)
@@ -38,6 +39,7 @@
END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67)
 #endif
 .endm
+#endif
 
 .macro kuap_save_amr_and_lock gpr1, gpr2, use_cr, msr_pr_cr
 #ifdef CONFIG_PPC_KUAP
@@ -61,6 +63,8 @@
 
 #else /* !__ASSEMBLY__ */
 
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
 #ifdef CONFIG_PPC_KUAP
 
 #include 
@@ -103,8 +107,16 @@ static inline void kuap_check_amr(void)
 
 static inline unsigned long get_kuap(void)
 {
+   /*
+* We return AMR_KUAP_BLOCKED when we don't support KUAP because
+* prevent_user_access_return needs to return AMR_KUAP_BLOCKED to
+* cause restore_user_access to do a flush.
+*
+* This has no effect in terms of actually blocking things on hash,
+* so it doesn't break anything.
+*/
if (!early_mmu_has_feature(MMU_FTR_RADIX_KUAP))
-   return 0;
+   return AMR_KUAP_BLOCKED;
 
return mfspr(SPRN_AMR);
 }
@@ -123,6 +135,29 @@ static inline void set_kuap(unsigned long value)
isync();
 }
 
+static inline bool
+bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+{
+   return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) &&
+   (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : 
AMR_KUAP_BLOCK_READ)),
+   "Bug: %s fault blocked by AMR!", is_write ? "Write" : 
"Read");
+}
+#else /* CONFIG_PPC_KUAP */
+static inline void kuap_restore_amr(struct pt_regs *regs, unsigned long amr) { 
}
+
+static inline unsigned long kuap_get_and_check_amr(void)
+{
+   return 0UL;
+}
+
+static inline unsigned long get_kuap(void)
+{
+   return AMR_KUAP_BLOCKED;
+}
+
+static inline void set_kuap(unsigned long value) { }
+#endif /* !CONFIG_PPC_KUAP */
+
 static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
  unsigned long size, unsigned long 
dir)
 {
@@ -142,6 +177,8 @@ static inline void prevent_user_access(void __user *to, 
const void __user *from,
   unsigned long size, unsigned long dir)
 {
set_kuap(AMR_KUAP_BLOCKED);
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
 }
 
 static inline unsigned long prevent_user_access_return(void)
@@ -149,6 +186,8 @@ static inline unsigned long prevent_user_access_return(void)
unsigned long flags = get_kuap();
 
set_kuap(AMR_KUAP_BLOCKED);
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
 
return flags;
 }
@@ -156,30 +195,9 @@ static inline unsigned long 
prevent_user_access_return(void)
 static inline void restore_user_access(unsigned long flags)
 {
set_kuap(flags);
+   if (static_branch_unlikely(_flush_key) && flags == 
AMR_KUAP_BLOCKED)
+

Re: [PATCH -tip 08/32] sched/fair: Fix forced idle sibling starvation corner case

2020-11-22 Thread Balbir Singh
On Tue, Nov 17, 2020 at 06:19:38PM -0500, Joel Fernandes (Google) wrote:
> From: Vineeth Pillai 
> 
> If there is only one long running local task and the sibling is
> forced idle, it  might not get a chance to run until a schedule
> event happens on any cpu in the core.
> 
> So we check for this condition during a tick to see if a sibling
> is starved and then give it a chance to schedule.
> 
> Tested-by: Julien Desfossez 
> Reviewed-by: Joel Fernandes (Google) 
> Signed-off-by: Vineeth Pillai 
> Signed-off-by: Julien Desfossez 
> Signed-off-by: Joel Fernandes (Google) 
> ---
>  kernel/sched/core.c  | 15 ---
>  kernel/sched/fair.c  | 40 
>  kernel/sched/sched.h |  2 +-
>  3 files changed, 49 insertions(+), 8 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 1bd0b0bbb040..52d0e83072a4 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5206,16 +5206,15 @@ pick_next_task(struct rq *rq, struct task_struct 
> *prev, struct rq_flags *rf)
>  
>   /* reset state */
>   rq->core->core_cookie = 0UL;
> + if (rq->core->core_forceidle) {
> + need_sync = true;
> + rq->core->core_forceidle = false;
> + }
>   for_each_cpu(i, smt_mask) {
>   struct rq *rq_i = cpu_rq(i);
>  
>   rq_i->core_pick = NULL;
>  
> - if (rq_i->core_forceidle) {
> - need_sync = true;
> - rq_i->core_forceidle = false;
> - }
> -
>   if (i != cpu)
>   update_rq_clock(rq_i);
>   }
> @@ -5335,8 +5334,10 @@ next_class:;
>   if (!rq_i->core_pick)
>   continue;
>  
> - if (is_task_rq_idle(rq_i->core_pick) && rq_i->nr_running)
> - rq_i->core_forceidle = true;
> + if (is_task_rq_idle(rq_i->core_pick) && rq_i->nr_running &&
> + !rq_i->core->core_forceidle) {
> + rq_i->core->core_forceidle = true;
> + }
>  
>   if (i == cpu) {
>   rq_i->core_pick = NULL;
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index f53681cd263e..42965c4fd71f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10692,6 +10692,44 @@ static void rq_offline_fair(struct rq *rq)
>  
>  #endif /* CONFIG_SMP */
>  
> +#ifdef CONFIG_SCHED_CORE
> +static inline bool
> +__entity_slice_used(struct sched_entity *se, int min_nr_tasks)
> +{
> + u64 slice = sched_slice(cfs_rq_of(se), se);

I wonder if the definition of sched_slice() should be revisited for core
scheduling?

Should we use sched_slice = sched_slice / cpumask_weight(smt_mask)?
Would that resolve the issue your seeing? Effectively we need to answer
if two sched core siblings should be treated as executing one large
slice?

Balbir Singh.




Re: Linux 5.4.79

2020-11-22 Thread Greg Kroah-Hartman
diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 5b4753e602de..fea15cd49fbc 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2667,6 +2667,8 @@
   mds=off [X86]
   tsx_async_abort=off [X86]
   kvm.nx_huge_pages=off [X86]
+  no_entry_flush [PPC]
+  no_uaccess_flush [PPC]
 
Exceptions:
   This does not have any effect on
@@ -2989,6 +2991,8 @@
 
noefi   Disable EFI runtime services support.
 
+   no_entry_flush  [PPC] Don't flush the L1-D cache when entering the 
kernel.
+
noexec  [IA-64]
 
noexec  [X86]
@@ -3038,6 +3042,9 @@
nospec_store_bypass_disable
[HW] Disable all mitigations for the Speculative Store 
Bypass vulnerability
 
+   no_uaccess_flush
+   [PPC] Don't flush the L1-D cache after accessing user 
data.
+
noxsave [BUGS=X86] Disables x86 extended register state save
and restore using xsave. The kernel will fallback to
enabling legacy floating-point and sse state.
diff --git a/Makefile b/Makefile
index 5725b07aaddf..f02539be5e07 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 4
-SUBLEVEL = 78
+SUBLEVEL = 79
 EXTRAVERSION =
 NAME = Kleptomaniac Octopus
 
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
index c4b1c6cf2660..adc9f83b2c44 100644
--- a/arch/mips/pci/pci-xtalk-bridge.c
+++ b/arch/mips/pci/pci-xtalk-bridge.c
@@ -284,7 +284,7 @@ static int bridge_set_affinity(struct irq_data *d, const 
struct cpumask *mask,
ret = irq_chip_set_affinity_parent(d, mask, force);
if (ret >= 0) {
cpu = cpumask_first_and(mask, cpu_online_mask);
-   data->nnasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
+   data->nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
bridge_write(data->bc, b_int_addr[pin].addr,
 (((data->bc->intr_addr >> 30) & 0x3) |
  bit | (data->nasid << 8)));
diff --git a/arch/powerpc/include/asm/book3s/64/kup-radix.h 
b/arch/powerpc/include/asm/book3s/64/kup-radix.h
index c8d1076e0ebb..c1e45f510591 100644
--- a/arch/powerpc/include/asm/book3s/64/kup-radix.h
+++ b/arch/powerpc/include/asm/book3s/64/kup-radix.h
@@ -11,13 +11,12 @@
 
 #ifdef __ASSEMBLY__
 
-.macro kuap_restore_amrgpr
 #ifdef CONFIG_PPC_KUAP
+.macro kuap_restore_amrgpr
BEGIN_MMU_FTR_SECTION_NESTED(67)
ld  \gpr, STACK_REGS_KUAP(r1)
mtspr   SPRN_AMR, \gpr
END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67)
-#endif
 .endm
 
 .macro kuap_check_amr gpr1, gpr2
@@ -31,6 +30,7 @@
END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_RADIX_KUAP, 67)
 #endif
 .endm
+#endif
 
 .macro kuap_save_amr_and_lock gpr1, gpr2, use_cr, msr_pr_cr
 #ifdef CONFIG_PPC_KUAP
@@ -54,6 +54,8 @@
 
 #else /* !__ASSEMBLY__ */
 
+DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
+
 #ifdef CONFIG_PPC_KUAP
 
 #include 
@@ -77,6 +79,18 @@ static inline void set_kuap(unsigned long value)
isync();
 }
 
+static inline bool
+bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+{
+   return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) &&
+   (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : 
AMR_KUAP_BLOCK_READ)),
+   "Bug: %s fault blocked by AMR!", is_write ? "Write" : 
"Read");
+}
+#else /* CONFIG_PPC_KUAP */
+static inline void kuap_restore_amr(struct pt_regs *regs, unsigned long amr) { 
}
+static inline void set_kuap(unsigned long value) { }
+#endif /* !CONFIG_PPC_KUAP */
+
 static __always_inline void allow_user_access(void __user *to, const void 
__user *from,
  unsigned long size, unsigned long 
dir)
 {
@@ -94,17 +108,10 @@ static inline void prevent_user_access(void __user *to, 
const void __user *from,
   unsigned long size, unsigned long dir)
 {
set_kuap(AMR_KUAP_BLOCKED);
+   if (static_branch_unlikely(_flush_key))
+   do_uaccess_flush();
 }
 
-static inline bool
-bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
-{
-   return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) &&
-   (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : 
AMR_KUAP_BLOCK_READ)),
-   "Bug: %s fault blocked by AMR!", is_write ? "Write" : 
"Read");
-}
-#endif /* CONFIG_PPC_KUAP */
-
 #endif /* __ASSEMBLY__ 

RE:DONATION FOR YOU!!

2020-11-22 Thread Dr. Mack John
Via del Campidoglio 1 00186.
Roma RM, ITALIAN.

Hello,

How are you? Mrs Amelia Kennedy gave me your contact and asked me to contact 
you before she died, She is donating sum $6.5 million for you to help her set 
up a charity organisation in your country and use part of the money for 
yourself and your family, Get back to me so I can give you directives on how to 
contact the finance company to get the money, I am the lawyer of Mrs Amelia 
Kennedy, Reply my mail:( drmackjohn...@gmail.com ) and also whats-app me on 
this number: +17047262900, Do not call this number, It's only for whats-app.

Regards.
Dr. Mack John.


[GIT PULL] x86/urgent for v5.10-rc5

2020-11-22 Thread Borislav Petkov
Hi Linus,

please pull the x86/urgent pile for -rc5.

Thx.

---
The following changes since commit 09162bc32c880a791c6c0668ce0745cf7958f576:

  Linux 5.10-rc4 (2020-11-15 16:44:31 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
tags/x86_urgent_for_v5.10-rc5

for you to fetch changes up to 01cf158e48d2b5ce947430de5896c10f4f7c1822:

  Revert "iommu/vt-d: Take CONFIG_PCI_ATS into account" (2020-11-19 15:07:19 
+0100)


* An IOMMU VT-d build fix when CONFIG_PCI_ATS=n along with a revert of
  same because the proper one is going through the IOMMU tree. (Thomas Gleixner)

* An Intel microcode loader fix to save the correct microcode patch to
  apply during resume. (Chen Yu)

* A fix to not access user memory of other processes when dumping opcode
  bytes. (Thomas Gleixner)


Chen Yu (1):
  x86/microcode/intel: Check patch signature before saving microcode for 
early loading

Thomas Gleixner (3):
  iommu/vt-d: Take CONFIG_PCI_ATS into account
  x86/dumpstack: Do not try to access user space code of other tasks
  Revert "iommu/vt-d: Take CONFIG_PCI_ATS into account"

 arch/x86/kernel/cpu/microcode/intel.c | 63 ++-
 arch/x86/kernel/dumpstack.c   | 23 ++---
 2 files changed, 29 insertions(+), 57 deletions(-)

diff --git a/arch/x86/kernel/cpu/microcode/intel.c 
b/arch/x86/kernel/cpu/microcode/intel.c
index 6a99535d7f37..7e8e07bddd5f 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -100,53 +100,6 @@ static int has_newer_microcode(void *mc, unsigned int 
csig, int cpf, int new_rev
return find_matching_signature(mc, csig, cpf);
 }
 
-/*
- * Given CPU signature and a microcode patch, this function finds if the
- * microcode patch has matching family and model with the CPU.
- *
- * %true - if there's a match
- * %false - otherwise
- */
-static bool microcode_matches(struct microcode_header_intel *mc_header,
- unsigned long sig)
-{
-   unsigned long total_size = get_totalsize(mc_header);
-   unsigned long data_size = get_datasize(mc_header);
-   struct extended_sigtable *ext_header;
-   unsigned int fam_ucode, model_ucode;
-   struct extended_signature *ext_sig;
-   unsigned int fam, model;
-   int ext_sigcount, i;
-
-   fam   = x86_family(sig);
-   model = x86_model(sig);
-
-   fam_ucode   = x86_family(mc_header->sig);
-   model_ucode = x86_model(mc_header->sig);
-
-   if (fam == fam_ucode && model == model_ucode)
-   return true;
-
-   /* Look for ext. headers: */
-   if (total_size <= data_size + MC_HEADER_SIZE)
-   return false;
-
-   ext_header   = (void *) mc_header + data_size + MC_HEADER_SIZE;
-   ext_sig  = (void *)ext_header + EXT_HEADER_SIZE;
-   ext_sigcount = ext_header->count;
-
-   for (i = 0; i < ext_sigcount; i++) {
-   fam_ucode   = x86_family(ext_sig->sig);
-   model_ucode = x86_model(ext_sig->sig);
-
-   if (fam == fam_ucode && model == model_ucode)
-   return true;
-
-   ext_sig++;
-   }
-   return false;
-}
-
 static struct ucode_patch *memdup_patch(void *data, unsigned int size)
 {
struct ucode_patch *p;
@@ -164,7 +117,7 @@ static struct ucode_patch *memdup_patch(void *data, 
unsigned int size)
return p;
 }
 
-static void save_microcode_patch(void *data, unsigned int size)
+static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, 
unsigned int size)
 {
struct microcode_header_intel *mc_hdr, *mc_saved_hdr;
struct ucode_patch *iter, *tmp, *p = NULL;
@@ -210,6 +163,9 @@ static void save_microcode_patch(void *data, unsigned int 
size)
if (!p)
return;
 
+   if (!find_matching_signature(p->data, uci->cpu_sig.sig, 
uci->cpu_sig.pf))
+   return;
+
/*
 * Save for early loading. On 32-bit, that needs to be a physical
 * address as the APs are running from physical addresses, before
@@ -344,13 +300,14 @@ scan_microcode(void *data, size_t size, struct 
ucode_cpu_info *uci, bool save)
 
size -= mc_size;
 
-   if (!microcode_matches(mc_header, uci->cpu_sig.sig)) {
+   if (!find_matching_signature(data, uci->cpu_sig.sig,
+uci->cpu_sig.pf)) {
data += mc_size;
continue;
}
 
if (save) {
-   save_microcode_patch(data, mc_size);
+   save_microcode_patch(uci, data, mc_size);
goto next;
}
 
@@ -483,14 +440,14 @@ static void show_saved_mc(void)
  * Save this microcode 

RE:DONATION FOR YOU!!

2020-11-22 Thread Dr. Mack John
Via del Campidoglio 1 00186.
Roma RM, ITALIAN.

Hello,

How are you? Mrs Amelia Kennedy gave me your contact and asked me to contact 
you before she died, She is donating sum $6.5 million for you to help her set 
up a charity organisation in your country and use part of the money for 
yourself and your family, Get back to me so I can give you directives on how to 
contact the finance company to get the money, I am the lawyer of Mrs Amelia 
Kennedy, Reply my mail:( drmackjohn...@gmail.com ) and also whats-app me on 
this number: +17047262900, Do not call this number, It's only for whats-app.

Regards.
Dr. Mack John.


Re: [PATCH 01/38] ASoC: ak5558: drop of_match_ptr from of_device_id table

2020-11-22 Thread Krzysztof Kozlowski
On Fri, Nov 20, 2020 at 08:04:29PM +, Mark Brown wrote:
> On Fri, Nov 20, 2020 at 08:42:45PM +0100, Krzysztof Kozlowski wrote:
> > On Fri, Nov 20, 2020 at 04:56:34PM +, Mark Brown wrote:
> 
> > > It would be better to fix these by annotating the table as potentially
> > > unused, if nothing else it means if someone wants to add ACPI support
> > > (or it just works on their ACPI system with the plain old I2C ID) then
> > > they don't need to revert this change.
> 
> > The point is after this patch - removal of of_match_ptr() - they will
> > already support the ACPI matching through the PRP0001.
> 
> > Keeping of_match_ptr() and maybe_unused will prevent any ACPI re-usage
> > unless explicit ACPI table is added
> 
> Surely if that's the desired outcome the fix is to change the definition
> of of_match_ptr() such that it leaves the reference with CONFIG_ACPI,
> perhaps hidden behind a config option for PRP0001?  That seems better
> than going through the entire tree like this.

That could be indeed an easier way to achieve this.

+Cc Andy, Rafael,

I saw you were doing similar way as I did here [1] for the 698fffc2705c
("rtc: ds1307: Drop of_match_ptr and CONFIG_OF protections") with the
same reasoning as mine ("These prevent use of this driver with ACPI via
PRP0001.").

Do you have thoughts on Mark's proposal above (to change the
of_match_ptr())?

[1] https://lore.kernel.org/lkml/20201120161653.445521-1-k...@kernel.org/

Best regards,
Krzysztof



[GIT PULL] efi/urgent for v5.10-rc5

2020-11-22 Thread Borislav Petkov
Hi Linus,

please pull the (forwarded) EFI urgent fixes for -rc5.

Thx.

--
The following changes since commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec:

  Linux 5.10-rc1 (2020-10-25 15:14:11 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
tags/efi-urgent-for-v5.10-rc3

for you to fetch changes up to c2fe61d8be491ff8188edaf22e838f81146b:

  efi/x86: Free efi_pgd with free_pages() (2020-11-10 19:18:11 +0100)


Couple of EFI fixes for v5.10:
- fix memory leak in efivarfs driver
- fix HYP mode issue in 32-bit ARM version of the EFI stub when built in
  Thumb2 mode
- avoid leaking EFI pgd pages on allocation failure


Ard Biesheuvel (1):
  efi/arm: set HSCTLR Thumb2 bit correctly for HVC calls from HYP

Arvind Sankar (1):
  efi/x86: Free efi_pgd with free_pages()

Vamshi K Sthambamkadi (1):
  efivarfs: fix memory leak in efivarfs_create()

 arch/arm/boot/compressed/head.S |  3 +++
 arch/x86/platform/efi/efi_64.c  | 24 +---
 fs/efivarfs/super.c |  1 +
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 2e04ec5b5446..caa27322a0ab 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -1472,6 +1472,9 @@ ENTRY(efi_enter_kernel)
@ issued from HYP mode take us to the correct handler code. We
@ will disable the MMU before jumping to the kernel proper.
@
+ ARM(  bic r1, r1, #(1 << 30)  ) @ clear HSCTLR.TE
+ THUMB(orr r1, r1, #(1 << 30)  ) @ set HSCTLR.TE
+   mcr p15, 4, r1, c1, c0, 0
adr r0, __hyp_reentry_vectors
mcr p15, 4, r0, c12, c0, 0  @ set HYP vector base (HVBAR)
isb
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 8f5759df7776..e1e8d4e3a213 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -78,28 +78,30 @@ int __init efi_alloc_page_tables(void)
gfp_mask = GFP_KERNEL | __GFP_ZERO;
efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER);
if (!efi_pgd)
-   return -ENOMEM;
+   goto fail;
 
pgd = efi_pgd + pgd_index(EFI_VA_END);
p4d = p4d_alloc(_mm, pgd, EFI_VA_END);
-   if (!p4d) {
-   free_page((unsigned long)efi_pgd);
-   return -ENOMEM;
-   }
+   if (!p4d)
+   goto free_pgd;
 
pud = pud_alloc(_mm, p4d, EFI_VA_END);
-   if (!pud) {
-   if (pgtable_l5_enabled())
-   free_page((unsigned long) pgd_page_vaddr(*pgd));
-   free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
-   return -ENOMEM;
-   }
+   if (!pud)
+   goto free_p4d;
 
efi_mm.pgd = efi_pgd;
mm_init_cpumask(_mm);
init_new_context(NULL, _mm);
 
return 0;
+
+free_p4d:
+   if (pgtable_l5_enabled())
+   free_page((unsigned long)pgd_page_vaddr(*pgd));
+free_pgd:
+   free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
+fail:
+   return -ENOMEM;
 }
 
 /*
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c
index 15880a68faad..f943fd0b0699 100644
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@ -21,6 +21,7 @@ LIST_HEAD(efivarfs_list);
 static void efivarfs_evict_inode(struct inode *inode)
 {
clear_inode(inode);
+   kfree(inode->i_private);
 }
 
 static const struct super_operations efivarfs_ops = {
-- 
Regards/Gruss,
Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG 
Nürnberg


Re: [PATCH 5/5] memory: tegra: Complete tegra210_swgroups

2020-11-22 Thread Krzysztof Kozlowski
On Wed, Oct 07, 2020 at 05:37:46PM -0700, Nicolin Chen wrote:
> According to Tegra X1 TRM, there are missing swgroups in the
> tegra210_swgroups list. So this patch adds them to the list.
> 
> Note that the TEGRA_SWGROUP_GPU (in list) should be actually
> TEGRA_SWGROUP_GPUB (in TRM), yet TEGRA_SWGROUP_GPU (in TRM)
> is not being used -- only TEGRA_SWGROUP_GPUB (in TRM) is. So
> this patch does not add TEGRA_SWGROUP_GPU (in TRM) and keeps
> TEGRA_SWGROUP_GPU (in list) as it is.
> 
> Signed-off-by: Nicolin Chen 
> ---
>  drivers/memory/tegra/tegra210.c | 10 ++
>  1 file changed, 10 insertions(+)

Thanks, applied.

Best regards,
Krzysztof



[PATCH v5] checkpatch: add fix option for LOGICAL_CONTINUATIONS

2020-11-22 Thread Aditya Srivastava
Currently, checkpatch warns if logical continuations are placed at the
start of a line and not at the end of previous line.

E.g., running checkpatch on commit 3485507fc272 ("staging:
bcm2835-camera: Reduce length of enum names") reports:

CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the
previous line
+   if (!ret
+   && camera_port ==

Provide a simple fix by adding logical operator at the end of previous
line and removing from current line, if both the lines are additions
(ie start with '+')

Signed-off-by: Aditya Srivastava 
---
changes in v2: quote $operator at substitution

changes in v3: add a check for previous line ending with comment;
If so, insert $operator at the last non-comment, non-whitespace char of the 
previous line

changes in v4: improve the matching mechanism by matching line termination at 
comment or white space;
insert the operator before comments (if any) separated by a whitespace;
append the comment and its pre-whitespace after the inserted operator (if 
comment was present),
ie if no comment was present nothing will be inserted after the operator

changes in v5: improve regex for comment and line end with '$;'

 scripts/checkpatch.pl | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5b1a5a65e69a..708a56f31466 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3553,8 +3553,17 @@ sub process {
 
 # check for && or || at the start of a line
if ($rawline =~ /^\+\s*(&&|\|\|)/) {
-   CHK("LOGICAL_CONTINUATIONS",
-   "Logical continuations should be on the previous 
line\n" . $hereprev);
+   my $operator = $1;
+   if (CHK("LOGICAL_CONTINUATIONS",
+   "Logical continuations should be on the 
previous line\n" . $hereprev) &&
+   $fix && $prevrawline =~ /^\+/) {
+   # add logical operator to the previous line, 
remove from current line
+   if ($prevline =~ /[\s$;]*$/) {
+   my $line_end = substr($prevrawline, 
$-[0]);
+   $fixed[$fixlinenr - 1] =~ 
s/\Q$line_end\E/ $operator$line_end/;
+   }
+   $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
+   }
}
 
 # check indentation starts on a tab stop
-- 
2.17.1



RE: [PATCH net] vsock/virtio: discard packets only when socket is really closed

2020-11-22 Thread Justin He



> -Original Message-
> From: Stefano Garzarella 
> Sent: Friday, November 20, 2020 6:48 PM
> To: net...@vger.kernel.org
> Cc: Sergio Lopez ; David S. Miller ;
> Stefano Garzarella ; Justin He ;
> k...@vger.kernel.org; linux-kernel@vger.kernel.org; Stefan Hajnoczi
> ; virtualizat...@lists.linux-foundation.org; Jakub
> Kicinski 
> Subject: [PATCH net] vsock/virtio: discard packets only when socket is
> really closed
>
> Starting from commit 8692cefc433f ("virtio_vsock: Fix race condition
> in virtio_transport_recv_pkt"), we discard packets in
> virtio_transport_recv_pkt() if the socket has been released.
>
> When the socket is connected, we schedule a delayed work to wait the
> RST packet from the other peer, also if SHUTDOWN_MASK is set in
> sk->sk_shutdown.
> This is done to complete the virtio-vsock shutdown algorithm, releasing
> the port assigned to the socket definitively only when the other peer
> has consumed all the packets.
>
> If we discard the RST packet received, the socket will be closed only
> when the VSOCK_CLOSE_TIMEOUT is reached.
>
> Sergio discovered the issue while running ab(1) HTTP benchmark using
> libkrun [1] and observing a latency increase with that commit.
>
> To avoid this issue, we discard packet only if the socket is really
> closed (SOCK_DONE flag is set).
> We also set SOCK_DONE in virtio_transport_release() when we don't need
> to wait any packets from the other peer (we didn't schedule the delayed
> work). In this case we remove the socket from the vsock lists, releasing
> the port assigned.
>
> [1] https://github.com/containers/libkrun
>
> Fixes: 8692cefc433f ("virtio_vsock: Fix race condition in
> virtio_transport_recv_pkt")

Acked-by: Jia He 


--
Cheers,
Justin (Jia He)


> Cc: justin...@arm.com
> Reported-by: Sergio Lopez 
> Tested-by: Sergio Lopez 
> Signed-off-by: Stefano Garzarella 
> ---
>  net/vmw_vsock/virtio_transport_common.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/vmw_vsock/virtio_transport_common.c
> b/net/vmw_vsock/virtio_transport_common.c
> index 0edda1edf988..5956939eebb7 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -841,8 +841,10 @@ void virtio_transport_release(struct vsock_sock *vsk)
>  virtio_transport_free_pkt(pkt);
>  }
>
> -if (remove_sock)
> +if (remove_sock) {
> +sock_set_flag(sk, SOCK_DONE);
>  vsock_remove_sock(vsk);
> +}
>  }
>  EXPORT_SYMBOL_GPL(virtio_transport_release);
>
> @@ -1132,8 +1134,8 @@ void virtio_transport_recv_pkt(struct
> virtio_transport *t,
>
>  lock_sock(sk);
>
> -/* Check if sk has been released before lock_sock */
> -if (sk->sk_shutdown == SHUTDOWN_MASK) {
> +/* Check if sk has been closed before lock_sock */
> +if (sock_flag(sk, SOCK_DONE)) {
>  (void)virtio_transport_reset_no_sock(t, pkt);
>  release_sock(sk);
>  sock_put(sk);
> --
> 2.26.2

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.


Re: [PATCH v5] checkpatch: add fix option for LOGICAL_CONTINUATIONS

2020-11-22 Thread Joe Perches
On Sun, 2020-11-22 at 16:40 +0530, Aditya Srivastava wrote:
> Currently, checkpatch warns if logical continuations are placed at the
> start of a line and not at the end of previous line.
> 
> E.g., running checkpatch on commit 3485507fc272 ("staging:
> bcm2835-camera: Reduce length of enum names") reports:
> 
> CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the
> previous line
> + if (!ret
> + && camera_port ==
> 
> Provide a simple fix by adding logical operator at the end of previous
> line and removing from current line, if both the lines are additions
> (ie start with '+')
> 
> Signed-off-by: Aditya Srivastava 
> ---
> changes in v2: quote $operator at substitution
> 
> changes in v3: add a check for previous line ending with comment;
> If so, insert $operator at the last non-comment, non-whitespace char of the 
> previous line
> 
> changes in v4: improve the matching mechanism by matching line termination at 
> comment or white space;
> insert the operator before comments (if any) separated by a whitespace;
> append the comment and its pre-whitespace after the inserted operator (if 
> comment was present),
> ie if no comment was present nothing will be inserted after the operator
> 
> changes in v5: improve regex for comment and line end with '$;'
> 
>  scripts/checkpatch.pl | 13 +++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 5b1a5a65e69a..708a56f31466 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3553,8 +3553,17 @@ sub process {
>  
> 
>  # check for && or || at the start of a line
>   if ($rawline =~ /^\+\s*(&&|\|\|)/) {
> - CHK("LOGICAL_CONTINUATIONS",
> - "Logical continuations should be on the previous 
> line\n" . $hereprev);
> + my $operator = $1;
> + if (CHK("LOGICAL_CONTINUATIONS",
> + "Logical continuations should be on the 
> previous line\n" . $hereprev) &&
> + $fix && $prevrawline =~ /^\+/) {
> + # add logical operator to the previous line, 
> remove from current line
> + if ($prevline =~ /[\s$;]*$/) {
> + my $line_end = substr($prevrawline, 
> $-[0]);
> + $fixed[$fixlinenr - 1] =~ 
> s/\Q$line_end\E/ $operator$line_end/;
> + }
> + $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
> + }
>   }
>  
> 
>  # check indentation starts on a tab stop




QCOM_SCM: config option with useless prompt and no help text

2020-11-22 Thread Pavel Machek
Hi!

commit d0511b5496c03cdbcda55a9b57c32cdd751920ed
Author: John Stultz 
Date:   Fri Nov 6 04:27:10 2020 +

firmware: QCOM_SCM: Allow qcom_scm driver to be loadable as a permenent 
module

You made this into user-visible config option, but what user sees is
this:

Qcom SCM driver (QCOM_SCM) [N/m/y/?] (NEW) ?

There is no help available for this option.
Symbol: QCOM_SCM [=n]
Type  : tristate
Defined at drivers/firmware/Kconfig:237
  Prompt: Qcom SCM driver

Which is pretty sad. Please fix.

Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


Re: [PATCH v5] checkpatch: add fix option for LOGICAL_CONTINUATIONS

2020-11-22 Thread Joe Perches
On Sun, 2020-11-22 at 16:40 +0530, Aditya Srivastava wrote:
> Currently, checkpatch warns if logical continuations are placed at the
> start of a line and not at the end of previous line.
> 
> E.g., running checkpatch on commit 3485507fc272 ("staging:
> bcm2835-camera: Reduce length of enum names") reports:
> 
> CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the
> previous line
> + if (!ret
> + && camera_port ==
> 
> Provide a simple fix by adding logical operator at the end of previous
> line and removing from current line, if both the lines are additions
> (ie start with '+')

Not quite yet.

> changes in v5: improve regex for comment and line end with '$;'
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3553,8 +3553,17 @@ sub process {
>  
> 
>  # check for && or || at the start of a line
>   if ($rawline =~ /^\+\s*(&&|\|\|)/) {
> - CHK("LOGICAL_CONTINUATIONS",
> - "Logical continuations should be on the previous 
> line\n" . $hereprev);
> + my $operator = $1;
> + if (CHK("LOGICAL_CONTINUATIONS",
> + "Logical continuations should be on the 
> previous line\n" . $hereprev) &&
> + $fix && $prevrawline =~ /^\+/) {
> + # add logical operator to the previous line, 
> remove from current line
> + if ($prevline =~ /[\s$;]*$/) {

This if is misleading as it will always match at least the EOL

> + my $line_end = substr($prevrawline, 
> $-[0]);
> + $fixed[$fixlinenr - 1] =~ 
> s/\Q$line_end\E/ $operator$line_end/;

It makes it seem as if this part is only done when the test is true.
The test is always true.




Re: [PATCH] clk: samsung: allow compile testing of Exynos, S3C64xx and S5Pv210

2020-11-22 Thread Krzysztof Kozlowski
On Fri, Nov 20, 2020 at 05:36:35PM +0100, Sylwester Nawrocki wrote:
> On 11/19/20 17:45, Krzysztof Kozlowski wrote:
> > So far all Exynos, S3C64xx and S5Pv210 clock units were selected by
> > respective SOC/ARCH Kconfig option.  On a kernel built for selected
> > SoCs, this allowed to build only limited set of matching clock drivers.
> > However compile testing was not possible in such case as Makefile object
> > depent on SOC/ARCH option.
> 
> "objects depend" or "object depends" ?

"object depends"

> 
> > Add separate Kconfig options for each of them to be able to compile
> > test.
> > 
> > Signed-off-by: Krzysztof Kozlowski
> 
> The patch look good to me, thanks.
> Acked-by: Sylwester Nawrocki 
> 
> I guess it's best now to merge it through your tree as it depends on 
> patches already sent to arm-soc? Next time it might be better to use 
> immutable branches right away to keep the clk changes in the clk 
> maintainer's tree.

At that time I had only one clk patch so I did not put it on separate
branch.

Anyway, this does not depend on the clkout patches and only minor patch
adjustement is needed. Cherry-pick can solve it (you would need to apply
on next/master and then cherry pick) or I can resend you one rebased on
linus/master.

There should be no conflicts when merging later into next or linus.

I propose you should take it via clk tree.

Best regards,
Krzysztof



Re: [PATCH net-next,v5 0/9] netfilter: flowtable bridge and vlan enhancements

2020-11-22 Thread Pablo Neira Ayuso
On Sun, Nov 22, 2020 at 10:26:16AM +, Alexander Lobakin wrote:
> From: Pablo Neira Ayuso 
> Date: Fri, 20 Nov 2020 13:49:12 +0100
[...]
> > Something like this:
> > 
> >fast path
> > ..
> >/  \
> >|   IP forwarding   |
> >|  / \  .
> >|   br0   eth0
> >.   / \
> >-- veth1  veth2
> >.
> >.
> >.
> >  eth0
> >ab:cd:ef:ab:cd:ef
> >   VM
> 
> I'm concerned about bypassing vlan and bridge's .ndo_start_xmit() in
> case of this shortcut. We'll have incomplete netdevice Tx stats for
> these two, as it gets updated inside this callbacks.

TX device stats are being updated accordingly.

# ip netns exec nsr1 ip -s link
1: lo:  mtu 65536 qdisc noop state DOWN mode DEFAULT group default 
qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes  packets  errors  dropped overrun mcast   
0  00   0   0   0   
TX: bytes  packets  errors  dropped carrier collsns 
0  00   0   0   0   
2: veth0@if2:  mtu 1500 qdisc noqueue state UP 
mode DEFAULT group default qlen 1000
link/ether 82:0d:f3:b5:59:5d brd ff:ff:ff:ff:ff:ff link-netns ns1
RX: bytes  packets  errors  dropped overrun mcast   
213290848248 4869765  0   0   0   0   
TX: bytes  packets  errors  dropped carrier collsns 
315346667  4777953  0   0   0   0   
3: veth1@if2:  mtu 1500 qdisc noqueue state UP 
mode DEFAULT group default qlen 1000
link/ether 4a:81:2d:9a:02:88 brd ff:ff:ff:ff:ff:ff link-netns ns2
RX: bytes  packets  errors  dropped overrun mcast   
315337919  4777833  0   0   0   0   
TX: bytes  packets  errors  dropped carrier collsns 
213290844826 4869708  0   0   0   0   
4: br0:  mtu 1500 qdisc noqueue state UP mode 
DEFAULT group default qlen 1000
link/ether 82:0d:f3:b5:59:5d brd ff:ff:ff:ff:ff:ff
RX: bytes  packets  errors  dropped overrun mcast   
4101   73   0   0   0   0   
TX: bytes  packets  errors  dropped carrier collsns 
5256   74   0   0   0   0   
5: veth0.10@veth0:  mtu 1500 qdisc noqueue 
master br0 state UP mode DEFAULT group default qlen 1000
link/ether 82:0d:f3:b5:59:5d brd ff:ff:ff:ff:ff:ff
RX: bytes  packets  errors  dropped overrun mcast   
4101   73   0   0   0   62  
TX: bytes  packets  errors  dropped carrier collsns 
315342363  4777893  0   0   0   0   



[GIT PULL] TTY/Serial driver fixes for 5.10-rc5

2020-11-22 Thread Greg KH
The following changes since commit f8394f232b1eab649ce2df5c5f15b0e528c92091:

  Linux 5.10-rc3 (2020-11-08 16:10:16 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tags/tty-5.10-rc5

for you to fetch changes up to 425af483523b76bc78e14674a430579d38b2a593:

  serial: ar933x_uart: disable clk on error handling path in probe (2020-11-12 
09:41:07 +0100)


TTY fixes for 5.10-rc5

Here are some small tty/serial fixes for 5.10-rc5 that resolve some
reported issues:
- speakup crash when telling the kernel to use a device that
  isn't really there
- imx serial driver fixes for reported problems
- ar933x_uart driver fix for probe error handling path

All have been in linux-next for a while with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Fugang Duan (1):
  tty: serial: imx: keep console clocks always on

Sam Nobs (1):
  tty: serial: imx: fix potential deadlock

Samuel Thibault (1):
  speakup: Do not let the line discipline be used several times

Zheng Zengkai (1):
  serial: ar933x_uart: disable clk on error handling path in probe

 drivers/accessibility/speakup/spk_ttyio.c | 12 +++-
 drivers/tty/serial/ar933x_uart.c  |  6 --
 drivers/tty/serial/imx.c  | 30 +++---
 3 files changed, 26 insertions(+), 22 deletions(-)


[GIT PULL] Staging/IIO driver fixes for 5.10-rc5

2020-11-22 Thread Greg KH
The following changes since commit 3cea11cd5e3b00d91caf0b4730194039b45c5891:

  Linux 5.10-rc2 (2020-11-01 14:43:51 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
tags/staging-5.10-rc5

for you to fetch changes up to 2dde2821b57f12fa8601d35d438b5e300fcbbe1d:

  Merge tag 'iio-fixes-for-5.10a' of 
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2020-11-17 10:53:00 +0100)


Staging/IIO fixes for 5.10-rc5

Here are some small Staging and IIO driver fixes for 5.10-rc5.  They
include:
- IIO fixes for reported regressions and problems
- new device ids for IIO drivers
- new device id for rtl8723bs driver
- staging ralink driver Kconfig dependency fix
- staging mt7621-pci bus resource fix

All of these have been in linux-next all week with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Brian O'Keefe (1):
  staging: rtl8723bs: Add 024c:0627 to the list of SDIO device-ids

David Lechner (1):
  counter/ti-eqep: Fix regmap max_register

Fabien Parent (1):
  iio: adc: mediatek: fix unset field

Fabrice Gasnier (1):
  docs: ABI: testing: iio: stm32: remove re-introduced unsupported ABI

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-5.10a' of https://git.kernel.org/.../jic23/iio 
into staging-linus

Gwendal Grignou (1):
  iio: cros_ec: Use default frequencies when EC returns invalid information

Hans de Goede (2):
  iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum
  iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting 
tablet-mode

Lorenzo Bianconi (1):
  iio: imu: st_lsm6dsx: set 10ms as min shub slave timeout

Necip Fazil Yildiran (2):
  staging: ralink-gdma: fix kconfig dependency bug for DMA_RALINK
  iio: light: fix kconfig dependency bug for VCNL4035

Olivier Moysan (1):
  iio: adc: stm32-adc: fix a regression when using dma and irq

Paul Cercueil (2):
  iio/adc: ingenic: Fix battery VREF for JZ4770 SoC
  iio/adc: ingenic: Fix AUX/VBAT readings when touchscreen is used

Sergio Paracuellos (1):
  staging: mt7621-pci: avoid to request pci bus resources

 .../ABI/testing/sysfs-bus-iio-timer-stm32  | 24 --
 drivers/counter/ti-eqep.c  |  4 +-
 drivers/iio/accel/kxcjk-1013.c | 51 +++---
 drivers/iio/adc/ingenic-adc.c  | 34 ---
 drivers/iio/adc/mt6577_auxadc.c|  6 ++-
 drivers/iio/adc/stm32-adc-core.c   | 41 -
 drivers/iio/adc/stm32-adc.c| 50 -
 .../common/cros_ec_sensors/cros_ec_sensors_core.c  | 16 ---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c   |  6 ++-
 drivers/iio/light/Kconfig  |  1 +
 drivers/staging/mt7621-pci/pci-mt7621.c| 15 ++-
 drivers/staging/ralink-gdma/Kconfig|  1 +
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c   |  1 +
 13 files changed, 165 insertions(+), 85 deletions(-)


Re: [PATCH -tip 09/32] sched/fair: Snapshot the min_vruntime of CPUs on force idle

2020-11-22 Thread Balbir Singh
On Tue, Nov 17, 2020 at 06:19:39PM -0500, Joel Fernandes (Google) wrote:
> During force-idle, we end up doing cross-cpu comparison of vruntimes
> during pick_next_task. If we simply compare (vruntime-min_vruntime)
> across CPUs, and if the CPUs only have 1 task each, we will always
> end up comparing 0 with 0 and pick just one of the tasks all the time.
> This starves the task that was not picked. To fix this, take a snapshot
> of the min_vruntime when entering force idle and use it for comparison.
> This min_vruntime snapshot will only be used for cross-CPU vruntime
> comparison, and nothing else.
> 
> This resolves several performance issues that were seen in ChromeOS
> audio usecase.
> 
> NOTE: Note, this patch will be improved in a later patch. It is just
>   kept here as the basis for the later patch and to make rebasing
>   easier. Further, it may make reverting the improvement easier in
>   case the improvement causes any regression.
>

This seems cumbersome, is there no way to track the min_vruntime via
rq->core->min_vruntime?

Balbir Singh.


[PATCH] mmc: mediatek: depend on COMMON_CLK to fix compile tests

2020-11-22 Thread Krzysztof Kozlowski
The MFD_OMAP_USB_HOST uses Common Clock Framework thus it cannot be
built on platforms without it (e.g. compile test on MIPS with LANTIQ):

mips-linux-ld: drivers/mmc/host/mtk-sd.o: in function `msdc_ops_set_ios':
mtk-sd.c:(.text+0x2bbc): undefined reference to `clk_get_parent'

Reported-by: kernel test robot 
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/mmc/host/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 310e546e5898..bfe912ec8955 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -1023,6 +1023,7 @@ config MMC_BCM2835
 config MMC_MTK
tristate "MediaTek SD/MMC Card Interface support"
depends on HAS_DMA
+   depends on COMMON_CLK
select REGULATOR
select MMC_CQHCI
help
-- 
2.25.1



[PATCH] mfd: omap-usb: depend on COMMON_CLK to fix compile tests

2020-11-22 Thread Krzysztof Kozlowski
The MFD_OMAP_USB_HOST uses Common Clock Framework thus it cannot be
built on platforms without it (e.g. compile test on MIPS with LANTIQ):

mips-linux-ld: drivers/mfd/omap-usb-host.o: in function `usbhs_omap_probe':
omap-usb-host.c:(.text+0x940): undefined reference to `clk_set_parent'

Reported-by: kernel test robot 
Signed-off-by: Krzysztof Kozlowski 
---
 drivers/mfd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index cc0b73280c68..fe79e8ff4669 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1442,6 +1442,7 @@ config MFD_TI_LMU
 config MFD_OMAP_USB_HOST
bool "TI OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
+   depends on COMMON_CLK
default y
help
  This is the core driver for the OAMP EHCI and OHCI drivers.
-- 
2.25.1



Re: [PATCH next] mm/vmscan: __isolate_lru_page_prepare clean up

2020-11-22 Thread Alex Shi



在 2020/11/21 上午7:13, Andrew Morton 写道:
> On Fri, 20 Nov 2020 16:03:33 +0800 Alex Shi  
> wrote:
> 
>> The function just return 2 results, so use a 'switch' to deal with its
>> result is unnecessary, and simplify it to a bool func as Vlastimil
>> suggested.
>>
>> Also removed 'goto' in using by reusing list_move().
>>
>> ...
>>
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1540,7 +1540,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone 
>> *zone,
>>   */
>>  int __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode)
>>  {
>> -int ret = -EBUSY;
>> +int ret = false;
>>  
>>  /* Only take pages on the LRU. */
>>  if (!PageLRU(page))
>> @@ -1590,7 +1590,7 @@ int __isolate_lru_page_prepare(struct page *page, 
>> isolate_mode_t mode)
>>  if ((mode & ISOLATE_UNMAPPED) && page_mapped(page))
>>  return ret;
>>  
>> -return 0;
>> +return true;
>>  }
> 
> The resulting __isolate_lru_page_prepare() is rather unpleasing.
> 
> - Why return an int and not a bool?
> 
> - `int ret = false' is a big hint that `ret' should have bool type!
> 
> - Why not just remove `ret' and do `return false' in all those `return
>   ret' places?
> 
> - The __isolate_lru_page_prepare() kerneldoc still says "returns 0 on
>   success, -ve errno on failure".  
> 

Hi Andrew,

Thanks a lot for caching and sorry for the bad patch.
It initially a 'int' version, and change it to bool in a hurry weekend.
I am sorry.

>From 36c4fbda2d55633d3c1a3e79f045cd9877453ab7 Mon Sep 17 00:00:00 2001
From: Alex Shi 
Date: Fri, 20 Nov 2020 14:49:16 +0800
Subject: [PATCH v2 next] mm/vmscan: __isolate_lru_page_prepare clean up

The function just return 2 results, so use a 'switch' to deal with its
result is unnecessary, and simplify it to a bool func as Vlastimil
suggested.

Also remove 'goto' by reusing list_move().

Signed-off-by: Alex Shi 
Cc: Andrew Morton 
Cc: Hugh Dickins 
Cc: Yu Zhao 
Cc: Vlastimil Babka 
Cc: Michal Hocko 
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 mm/compaction.c |  2 +-
 mm/vmscan.c | 69 +++--
 2 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index b68931854253..8d71ffebe6cb 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -988,7 +988,7 @@ isolate_migratepages_block(struct compact_control *cc, 
unsigned long low_pfn,
if (unlikely(!get_page_unless_zero(page)))
goto isolate_fail;
 
-   if (__isolate_lru_page_prepare(page, isolate_mode) != 0)
+   if (!__isolate_lru_page_prepare(page, isolate_mode))
goto isolate_fail_put;
 
/* Try isolate the page */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index c6f94e55c3fe..ab2fdee0828e 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1536,19 +1536,17 @@ unsigned int reclaim_clean_pages_from_list(struct zone 
*zone,
  * page:   page to consider
  * mode:   one of the LRU isolation modes defined above
  *
- * returns 0 on success, -ve errno on failure.
+ * returns ture on success, false on failure.
  */
-int __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode)
+bool __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode)
 {
-   int ret = -EBUSY;
-
/* Only take pages on the LRU. */
if (!PageLRU(page))
-   return ret;
+   return false;
 
/* Compaction should not handle unevictable pages but CMA can do so */
if (PageUnevictable(page) && !(mode & ISOLATE_UNEVICTABLE))
-   return ret;
+   return false;
 
/*
 * To minimise LRU disruption, the caller can indicate that it only
@@ -1561,7 +1559,7 @@ int __isolate_lru_page_prepare(struct page *page, 
isolate_mode_t mode)
if (mode & ISOLATE_ASYNC_MIGRATE) {
/* All the caller can do on PageWriteback is block */
if (PageWriteback(page))
-   return ret;
+   return false;
 
if (PageDirty(page)) {
struct address_space *mapping;
@@ -1577,20 +1575,20 @@ int __isolate_lru_page_prepare(struct page *page, 
isolate_mode_t mode)
 * from the page cache.
 */
if (!trylock_page(page))
-   return ret;
+   return false;
 
mapping = page_mapping(page);
migrate_dirty = !mapping || mapping->a_ops->migratepage;
unlock_page(page);
if (!migrate_dirty)
-   return ret;
+   return false;
}
}
 
if ((mode & ISOLATE_UNMAPPED) && page_mapped(page))
-   return ret;
+   return false;
 
-   return 0;
+   return true;
 }
 
 /*
@@ 

[PATCH] driver core: cleanup kstrto*() usage

2020-11-22 Thread Alexey Dobriyan
kstrto*() functions can write result directly to target memory
if no additional checks needs to be done.

Signed-off-by: Alexey Dobriyan 
---

 drivers/base/core.c |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1701,12 +1701,10 @@ ssize_t device_store_ulong(struct device *dev,
 {
struct dev_ext_attribute *ea = to_ext_attr(attr);
int ret;
-   unsigned long new;
 
-   ret = kstrtoul(buf, 0, );
+   ret = kstrtoul(buf, 0, (unsigned long *)ea->var);
if (ret)
return ret;
-   *(unsigned long *)(ea->var) = new;
/* Always return full write size even if we didn't consume all */
return size;
 }
@@ -1726,16 +1724,12 @@ ssize_t device_store_int(struct device *dev,
 const char *buf, size_t size)
 {
struct dev_ext_attribute *ea = to_ext_attr(attr);
+   int val;
int ret;
-   long new;
 
-   ret = kstrtol(buf, 0, );
+   ret = kstrtoint(buf, 0, (int *)ea->var);
if (ret)
return ret;
-
-   if (new > INT_MAX || new < INT_MIN)
-   return -EINVAL;
-   *(int *)(ea->var) = new;
/* Always return full write size even if we didn't consume all */
return size;
 }


Droid 4 in next-20201120: cpcap-usb-phy.0: could not initialize VBUS or ID IIO:

2020-11-22 Thread Pavel Machek
Hi!

I'm getting this warning during boot:

[3.413299] gpio gpiochip1: Persistence not supported for GPIO 0
[3.419494] cpcap-usb-phy cpcap-usb-phy.0: could not initialize VBUS or ID 
IIO: -517
[3.427398] [ cut here ]
[3.432067] WARNING: CPU: 0 PID: 1 at drivers/regulator/core.c:2123 
_regulator_put.part.2+0x168/0x17c
[3.441406] Modules linked in:
[3.444519] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 
5.10.0-rc4-next-20201120-dirty #198
[3.452728] Hardware name: Generic OMAP4 (Flattened Device Tree)
[3.458801] [] (unwind_backtrace) from [] 
(show_stack+0x10/0x14)
[3.466613] [] (show_stack) from [] 
(dump_stack+0xb8/0xd4)
[3.473876] [] (dump_stack) from [] (__warn+0xa8/0xd0)
[3.480804] [] (__warn) from [] 
(warn_slowpath_fmt+0x4c/0x98)
[3.488311] [] (warn_slowpath_fmt) from [] 
(_regulator_put.part.2+0x168/0x17c)
[3.497344] [] (_regulator_put.part.2) from [] 
(regulator_put+0x28/0x38)
[3.505828] [] (regulator_put) from [] 
(release_nodes+0x1a0/0x248)
[3.513793] [] (release_nodes) from [] 
(really_probe+0x104/0x3b4)
[3.521667] [] (really_probe) from [] 
(driver_probe_device+0x58/0xb4)
[3.529907] [] (driver_probe_device) from [] 
(bus_for_each_drv+0x70/0x94)
[3.538482] [] (bus_for_each_drv) from [] 
(__device_attach+0xbc/0x128)

(and then cpcap does not work). Is my configuration missing something?

Later I get warnings about framedone interrupt not being done (IIRC)
from HDMI audio module, and I have screen freezing in framebuffer.

Any ideas?

Best regards,
Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


[PATCH] lib: cleanup kstrto*() usage

2020-11-22 Thread Alexey Dobriyan
Use proper conversion functions.
kstrto*() variants exist for all standard types.

Signed-off-by: Alexey Dobriyan 
---

 lib/test_firmware.c |9 +++--
 lib/test_kmod.c |   26 ++
 2 files changed, 13 insertions(+), 22 deletions(-)

--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -364,18 +364,15 @@ static ssize_t test_dev_config_show_int(char *buf, int 
val)
 
 static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
 {
+   u8 val;
int ret;
-   long new;
 
-   ret = kstrtol(buf, 10, );
+   ret = kstrtou8(buf, 10, );
if (ret)
return ret;
 
-   if (new > U8_MAX)
-   return -EINVAL;
-
mutex_lock(_fw_mutex);
-   *(u8 *)cfg = new;
+   *(u8 *)cfg = val;
mutex_unlock(_fw_mutex);
 
/* Always return full write size even if we didn't consume all */
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -877,20 +877,17 @@ static int test_dev_config_update_uint_sync(struct 
kmod_test_device *test_dev,
int (*test_sync)(struct 
kmod_test_device *test_dev))
 {
int ret;
-   unsigned long new;
+   unsigned int val;
unsigned int old_val;
 
-   ret = kstrtoul(buf, 10, );
+   ret = kstrtouint(buf, 10, );
if (ret)
return ret;
 
-   if (new > UINT_MAX)
-   return -EINVAL;
-
mutex_lock(_dev->config_mutex);
 
old_val = *config;
-   *(unsigned int *)config = new;
+   *(unsigned int *)config = val;
 
ret = test_sync(test_dev);
if (ret) {
@@ -914,18 +911,18 @@ static int test_dev_config_update_uint_range(struct 
kmod_test_device *test_dev,
 unsigned int min,
 unsigned int max)
 {
+   unsigned int val;
int ret;
-   unsigned long new;
 
-   ret = kstrtoul(buf, 10, );
+   ret = kstrtouint(buf, 10, );
if (ret)
return ret;
 
-   if (new < min || new > max)
+   if (val < min || val > max)
return -EINVAL;
 
mutex_lock(_dev->config_mutex);
-   *config = new;
+   *config = val;
mutex_unlock(_dev->config_mutex);
 
/* Always return full write size even if we didn't consume all */
@@ -936,18 +933,15 @@ static int test_dev_config_update_int(struct 
kmod_test_device *test_dev,
  const char *buf, size_t size,
  int *config)
 {
+   int val;
int ret;
-   long new;
 
-   ret = kstrtol(buf, 10, );
+   ret = kstrtoint(buf, 10, );
if (ret)
return ret;
 
-   if (new < INT_MIN || new > INT_MAX)
-   return -EINVAL;
-
mutex_lock(_dev->config_mutex);
-   *config = new;
+   *config = val;
mutex_unlock(_dev->config_mutex);
/* Always return full write size even if we didn't consume all */
return size;


[PATCH] mm: cleanup kstrto*() usage

2020-11-22 Thread Alexey Dobriyan
Range checks can folded into proper conversion function.
kstrto*() exist for all arithmetic types.

Signed-off-by: Alexey Dobriyan 
---

 mm/khugepaged.c |   18 +-
 mm/ksm.c|   18 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -131,11 +131,11 @@ static ssize_t scan_sleep_millisecs_store(struct kobject 
*kobj,
  struct kobj_attribute *attr,
  const char *buf, size_t count)
 {
-   unsigned long msecs;
+   unsigned int msecs;
int err;
 
-   err = kstrtoul(buf, 10, );
-   if (err || msecs > UINT_MAX)
+   err = kstrtouint(buf, 10, );
+   if (err)
return -EINVAL;
 
khugepaged_scan_sleep_millisecs = msecs;
@@ -159,11 +159,11 @@ static ssize_t alloc_sleep_millisecs_store(struct kobject 
*kobj,
   struct kobj_attribute *attr,
   const char *buf, size_t count)
 {
-   unsigned long msecs;
+   unsigned int msecs;
int err;
 
-   err = kstrtoul(buf, 10, );
-   if (err || msecs > UINT_MAX)
+   err = kstrtouint(buf, 10, );
+   if (err)
return -EINVAL;
 
khugepaged_alloc_sleep_millisecs = msecs;
@@ -186,11 +186,11 @@ static ssize_t pages_to_scan_store(struct kobject *kobj,
   struct kobj_attribute *attr,
   const char *buf, size_t count)
 {
+   unsigned int pages;
int err;
-   unsigned long pages;
 
-   err = kstrtoul(buf, 10, );
-   if (err || !pages || pages > UINT_MAX)
+   err = kstrtouint(buf, 10, );
+   if (err || !pages)
return -EINVAL;
 
khugepaged_pages_to_scan = pages;
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2840,11 +2840,11 @@ static ssize_t sleep_millisecs_store(struct kobject 
*kobj,
 struct kobj_attribute *attr,
 const char *buf, size_t count)
 {
-   unsigned long msecs;
+   unsigned int msecs;
int err;
 
-   err = kstrtoul(buf, 10, );
-   if (err || msecs > UINT_MAX)
+   err = kstrtouint(buf, 10, );
+   if (err)
return -EINVAL;
 
ksm_thread_sleep_millisecs = msecs;
@@ -2864,11 +2864,11 @@ static ssize_t pages_to_scan_store(struct kobject *kobj,
   struct kobj_attribute *attr,
   const char *buf, size_t count)
 {
+   unsigned int nr_pages;
int err;
-   unsigned long nr_pages;
 
-   err = kstrtoul(buf, 10, _pages);
-   if (err || nr_pages > UINT_MAX)
+   err = kstrtouint(buf, 10, _pages);
+   if (err)
return -EINVAL;
 
ksm_thread_pages_to_scan = nr_pages;
@@ -2886,11 +2886,11 @@ static ssize_t run_show(struct kobject *kobj, struct 
kobj_attribute *attr,
 static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr,
 const char *buf, size_t count)
 {
+   unsigned int flags;
int err;
-   unsigned long flags;
 
-   err = kstrtoul(buf, 10, );
-   if (err || flags > UINT_MAX)
+   err = kstrtouint(buf, 10, );
+   if (err)
return -EINVAL;
if (flags > KSM_RUN_UNMERGE)
return -EINVAL;


Re: [PATCH next] mm/vmscan: __isolate_lru_page_prepare clean up

2020-11-22 Thread Matthew Wilcox
On Sun, Nov 22, 2020 at 08:00:19PM +0800, Alex Shi wrote:
>  mm/compaction.c |  2 +-
>  mm/vmscan.c | 69 +++--
>  2 files changed, 34 insertions(+), 37 deletions(-)

How is it possible you're changing the signature of a function without
touching a header file?  Surely __isolate_lru_page_prepare() must be declared
in mm/internal.h ?

> +++ b/mm/vmscan.c
> @@ -1536,19 +1536,17 @@ unsigned int reclaim_clean_pages_from_list(struct 
> zone *zone,
>   * page: page to consider
>   * mode: one of the LRU isolation modes defined above
>   *
> - * returns 0 on success, -ve errno on failure.
> + * returns ture on success, false on failure.

"true".

> @@ -1674,35 +1672,34 @@ static unsigned long isolate_lru_pages(unsigned long 
> nr_to_scan,
>* only when the page is being freed somewhere else.
>*/
>   scan += nr_pages;
> - switch (__isolate_lru_page_prepare(page, mode)) {
> - case 0:
> + if (!__isolate_lru_page_prepare(page, mode)) {
> + /* else it is being freed elsewhere */

I don't think the word "else" helps here.  Just
/* It is being freed elsewhere */

> + if (!TestClearPageLRU(page)) {
>   /*
> +  * This page may in other isolation path,
> +  * but we still hold lru_lock.
>*/

I don't think this comment helps me understand what's going on here.
Maybe:

/* Another thread is already isolating this page */

> + put_page(page);
>   list_move(>lru, src);
> + continue;
>   }


[PATCH] drivers: Fix the Raspberry Pi debug version compile

2020-11-22 Thread hby
enable the DEBUG in source code, and it will compile fail,
modify the DEBUG macro, to adapt the compile

Signed-off-by: hby 
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h 
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
index 4146faeed..c2eb3aa67 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
@@ -60,7 +60,7 @@ void __brcmf_err(struct brcmf_bus *bus, const char *func, 
const char *fmt, ...);
  ##__VA_ARGS__);   \
} while (0)
 
-#if defined(DEBUG) || defined(CONFIG_BRCM_TRACING)
+#if defined(CONFIG_BRCM_TRACING) || defined(CONFIG_BRCMDBG)
 
 /* For debug/tracing purposes treat info messages as errors */
 #define brcmf_info brcmf_err
@@ -114,7 +114,7 @@ extern int brcmf_msg_level;
 
 struct brcmf_bus;
 struct brcmf_pub;
-#ifdef DEBUG
+#if defined(CONFIG_BRCMDBG)
 struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
 void brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
 int (*read_fn)(struct seq_file *seq, void *data));
-- 
2.17.1




Re: [PATCH] lseek.2: SYNOPSIS: Use correct types

2020-11-22 Thread Florian Weimer
* Alejandro Colomar:

> The Linux kernel uses 'unsigned int' instead of 'int' for 'fd' and
> 'whence'.  As glibc provides no wrapper, use the same types the
> kernel uses.

lseek is a POSIX interface, and glibc provides it.  POSIX uses int for
file descriptors (and the whence parameter in case of lseek).

The llseek system call is a different matter, that's indeed
Linux-specific.


Re: [PATCH -next] irq-chip/gic-v3-its: Fixed an issue where the ITS executes the residual commands in the queue again when the ITS wakes up from sleep mode.

2020-11-22 Thread Marc Zyngier
On Sat, 7 Nov 2020 10:42:26 +, Xu Qiang wrote:
> On my platform, ITS_FLAGS_SAVE_SUSPEND_STATE is not set,thus do nothing
> in its suspend and resuse function.On the other hand,firmware stores
> GITS_CTRL,GITS_CBASER,GITS_CWRITER and GITS_BASER in the suspend,
> and restores these registers in the resume. As a result, the ITS executes
> the residual commands in the queue.
> 
> Memory corruption may occur in the following scenarios:
> 
> [...]

Applied to irq/irqchip-next, thanks!

[1/1] irqchip/gic-v3-its: Unconditionally save/restore the ITS state on suspend
  commit: a51f7296f38f498c6f186c82ae3aa25ae10bb266

Cheers,

M.
-- 
Without deviation from the norm, progress is not possible.




Re: [PATCH] ipvs: replace atomic_add_return()

2020-11-22 Thread Pablo Neira Ayuso
On Tue, Nov 17, 2020 at 10:57:52PM +0200, Julian Anastasov wrote:
> 
>   Hello,
> 
> On Mon, 16 Nov 2020, Yejune Deng wrote:
> 
> > atomic_inc_return() looks better
> > 
> > Signed-off-by: Yejune Deng 
> 
>   Looks good to me for -next, thanks!
> 
> Acked-by: Julian Anastasov 

Applied, thanks.


Re: [PATCH] irqchip/exiu: Fix the index of fwspec for IRQ type

2020-11-22 Thread Marc Zyngier
On Tue, 17 Nov 2020 11:20:15 +0800, Chen Baozi wrote:
> Since fwspec->param_count of ACPI node is two, the index of IRQ type
> in fwspec->param[] should be 1 rather than 2.

Applied to irq/irqchip-next, thanks!

[1/1] irqchip/exiu: Fix the index of fwspec for IRQ type
  commit: d001e41e1b15716e9b759df5ef00510699f85282

I added Fixes: and Cc: stable tags for a good measure.

Cheers,

M.
-- 
Without deviation from the norm, progress is not possible.




[PATCH v6] checkpatch: add fix option for LOGICAL_CONTINUATIONS

2020-11-22 Thread Aditya Srivastava
Currently, checkpatch warns if logical continuations are placed at the
start of a line and not at the end of previous line.

E.g., running checkpatch on commit 3485507fc272 ("staging:
bcm2835-camera: Reduce length of enum names") reports:

CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the
previous line
+   if (!ret
+   && camera_port ==

Provide a simple fix by inserting logical operator at the last
non-comment, non-whitespace char of the previous line and removing from
current line, if both the lines are additions(ie start with '+')

Signed-off-by: Aditya Srivastava 
---
changes in v2: quote $operator at substitution

changes in v3: add a check for previous line ending with comment;
If so, insert $operator at the last non-comment, non-whitespace char of the 
previous line

changes in v4: improve the matching mechanism by matching line termination at 
comment or white space;
insert the operator before comments (if any) separated by a whitespace;
append the comment and its pre-whitespace after the inserted operator (if 
comment was present),
ie if no comment was present nothing will be inserted after the operator

changes in v5: improve regex for comment and line end with '$;'

changes in v6: remove if-check; modify commit message

 scripts/checkpatch.pl | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5b1a5a65e69a..dc5b031b45b9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3553,8 +3553,16 @@ sub process {
 
 # check for && or || at the start of a line
if ($rawline =~ /^\+\s*(&&|\|\|)/) {
-   CHK("LOGICAL_CONTINUATIONS",
-   "Logical continuations should be on the previous 
line\n" . $hereprev);
+   my $operator = $1;
+   if (CHK("LOGICAL_CONTINUATIONS",
+   "Logical continuations should be on the 
previous line\n" . $hereprev) &&
+   $fix && $prevrawline =~ /^\+/) {
+   # insert logical operator at last non-comment, 
non-whitepsace char on previous line
+   $prevline =~ /[\s$;]*$/;
+   my $line_end = substr($prevrawline, $-[0]);
+   $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E/ 
$operator$line_end/;
+   $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
+   }
}
 
 # check indentation starts on a tab stop
-- 
2.17.1



Re: [PATCH] Documentation/admin-guide: mark memmap parameter is supported by a few architectures

2020-11-22 Thread Mike Rapoport
On Wed, Nov 18, 2020 at 02:41:45PM +1300, Barry Song wrote:
> early_param memmap is only implemented on X86, MIPS and XTENSA. To avoid
> wasting users’ time on trying this on platform like ARM, mark it clearly.
> 
> Signed-off-by: Barry Song 

Reviewed-by: Mike Rapoport 

> ---
>  * the background was that I spent one hour on using memmap on arm64, only
>to find memmap= is not implemented on most architectures;
> 
>  Documentation/admin-guide/kernel-parameters.rst | 1 +
>  Documentation/admin-guide/kernel-parameters.txt | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.rst 
> b/Documentation/admin-guide/kernel-parameters.rst
> index 6d421694d98e..06fb1b4aa849 100644
> --- a/Documentation/admin-guide/kernel-parameters.rst
> +++ b/Documentation/admin-guide/kernel-parameters.rst
> @@ -172,6 +172,7 @@ parameter is applicable::
>   X86 Either 32-bit or 64-bit x86 (same as X86-32+X86-64)
>   X86_UV  SGI UV support is enabled.
>   XEN Xen support is enabled
> + XTENSA  xtensa architecture is enabled.
>  
>  In addition, the following text indicates that the option::
>  
> diff --git a/Documentation/admin-guide/kernel-parameters.txt 
> b/Documentation/admin-guide/kernel-parameters.txt
> index 526d65d8573a..8bdbc555f221 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -2709,7 +2709,7 @@
>   option description.
>  
>   memmap=nn[KMG]@ss[KMG]
> - [KNL] Force usage of a specific region of memory.
> + [KNL, X86, MIPS, XTENSA] Force usage of a specific 
> region of memory.
>   Region of memory to be used is from ss to ss+nn.
>   If @ss[KMG] is omitted, it is equivalent to mem=nn[KMG],
>   which limits max address to nn[KMG].
> -- 
> 2.25.1
> 

-- 
Sincerely yours,
Mike.


[PATCH] afs: Fix speculative status fetch going out of order wrt to modifications

2020-11-22 Thread David Howells
When doing a lookup in a directory, the afs filesystem uses a bulk status
fetch to speculatively retrieve the statuses of up to 48 other vnodes found
in the same directory and it will then either update extant inodes or
create new ones - effectively doing 'lookup ahead'.

To avoid the possibility of deadlocking itself, however, the filesystem
doesn't lock all of those inodes; rather just the directory inode is locked
(by the VFS).  When the operation completes, afs_inode_init_from_status()
or afs_apply_status() is called, depending on whether the inode already
exists, to commit the new status.

A case exists, however, where the speculative status fetch operation may
straddle a modification operation on one of those vnodes.  What can then
happen is that the speculative bulk status RPC retrieves the old status,
and whilst that is happening, the modification happens - which returns an
updated status, then the modification status is committed, then we attempt
to commit the speculative status.

This results in something like the following being seen in dmesg:

kAFS: vnode modified {100058:861} 8->9 YFS.InlineBulkStatus

showing that for vnode 861 on volume 100058, we saw YFS.InlineBulkStatus
say that the vnode had data version 8 when we'd already recorded version 9
due to a local modification.  This was causing the cache to be invalidated
for that vnode when it shouldn't have been.  If it happens on a data file,
this might lead to local changes being lost.

Fix this by ignoring speculative status updates if the data version doesn't
match the expected value.

Note that it is possible to get a DV regression if a volume gets restored
from a backup - but we should get a callback break in such a case that
should trigger a recheck anyway.  It might be worth checking the volume
creation time in the volsync info and, if a change is observed in that (as
would happen on a restore), invalidate all caches associated with the
volume.

Fixes: 5cf9dd55a0ec ("afs: Prospectively look up extra files when doing a 
single lookup")
Signed-off-by: David Howells 
---

 fs/afs/dir.c  |1 +
 fs/afs/inode.c|8 
 fs/afs/internal.h |1 +
 3 files changed, 10 insertions(+)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 1bb5b9d7f0a2..9068d5578a26 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -823,6 +823,7 @@ static struct inode *afs_do_lookup(struct inode *dir, 
struct dentry *dentry,
vp->cb_break_before = 
afs_calc_vnode_cb_break(vnode);
vp->vnode = vnode;
vp->put_vnode = true;
+   vp->speculative = true; /* vnode not locked */
}
}
}
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 0fe8844b4bee..b0d7b892090d 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -294,6 +294,13 @@ void afs_vnode_commit_status(struct afs_operation *op, 
struct afs_vnode_param *v
op->flags &= ~AFS_OPERATION_DIR_CONFLICT;
}
} else if (vp->scb.have_status) {
+   if (vp->dv_before + vp->dv_delta != vp->scb.status.data_version 
&&
+   vp->speculative)
+   /* Ignore the result of a speculative bulk status fetch
+* if it splits around a modification op, thereby
+* appearing to regress the data version.
+*/
+   goto out;
afs_apply_status(op, vp);
if (vp->scb.have_cb)
afs_apply_callback(op, vp);
@@ -305,6 +312,7 @@ void afs_vnode_commit_status(struct afs_operation *op, 
struct afs_vnode_param *v
}
}
 
+out:
write_sequnlock(>cb_lock);
 
if (vp->scb.have_status)
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 14d5d75f4b6e..0d150a29e39e 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -755,6 +755,7 @@ struct afs_vnode_param {
boolupdate_ctime:1; /* Need to update the ctime */
boolset_size:1; /* Must update i_size */
boolop_unlinked:1;  /* True if file was unlinked by 
op */
+   boolspeculative:1;  /* T if speculative status 
fetch (no vnode lock) */
 };
 
 /*




Re: [PATCH] lseek.2: SYNOPSIS: Use correct types

2020-11-22 Thread Alejandro Colomar (man-pages)
Hi Florian,

On 11/22/20 1:43 PM, Florian Weimer wrote:
> * Alejandro Colomar:
> 
>> The Linux kernel uses 'unsigned int' instead of 'int' for 'fd' and
>> 'whence'.  As glibc provides no wrapper, use the same types the
>> kernel uses.
> 
> lseek is a POSIX interface, and glibc provides it.  POSIX uses int for
> file descriptors (and the whence parameter in case of lseek).
> 
> The llseek system call is a different matter, that's indeed
> Linux-specific.
> 

Ahhh, true.  So many similar functions... :p

Thanks,

Alex


Re: [PATCH v5 21/21] mm/hugetlb: Disable freeing vmemmap if struct page size is not power of two

2020-11-22 Thread Mike Rapoport
On Fri, Nov 20, 2020 at 10:15:30AM +0100, David Hildenbrand wrote:
> On 20.11.20 09:25, Michal Hocko wrote:
> > On Fri 20-11-20 14:43:25, Muchun Song wrote:
> > > We only can free the unused vmemmap to the buddy system when the
> > > size of struct page is a power of two.
> > 
> > Can we actually have !power_of_2 struct pages?
> 
> AFAIK multiples of 8 bytes (56, 64, 72) are possible.

Or multiples of 4 for 32-bit (28, 32, 36). 
 
> -- 
> Thanks,
> 
> David / dhildenb
> 
> 

-- 
Sincerely yours,
Mike.


Re: [PATCH v3] HID: i2c-hid: add polling mode based on connected GPIO chip's pin status

2020-11-22 Thread Barnabás Pőcze
Hi


2020. november 22., vasárnap 11:15 keltezéssel, Coiby Xu írta:

> [...]
> >> +static int get_gpio_pin_state(struct irq_desc *irq_desc)
> >> +{
> >> +  struct gpio_chip *gc = irq_data_get_irq_chip_data(_desc->irq_data);
> >> +
> >> +  return gc->get(gc, irq_desc->irq_data.hwirq);
> >> +}
> [...]
> >> +  ssize_t status = get_gpio_pin_state(irq_desc);
> >
> >`get_gpio_pin_state()` returns an `int`, so I am not sure why `ssize_t` is 
> >used here.
> >
>
> I used `ssize_t` because I found gpiolib-sysfs.c uses `ssize_t`
>
>  // drivers/gpio/gpiolib-sysfs.c
>  static ssize_t value_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   struct gpiod_data *data = dev_get_drvdata(dev);
>   struct gpio_desc *desc = data->desc;
>   ssize_t status;
>
>   mutex_lock(>mutex);
>
>   status = gpiod_get_value_cansleep(desc);
>  ...
>   return status;
>  }
>
> According to the book Advanced Programming in the UNIX Environment by
> W. Richard Stevens,
>  With the 1990 POSIX.1 standard, the primitive system data type
>  ssize_t was introduced to provide the signed return value...
>
> So ssize_t is fairly common, for example, the read and write syscall
> return a value of type ssize_t. But I haven't found out why ssize_t is
> better int.
> >

Sorry if I wasn't clear, what prompted me to ask that question is the following:
`gc->get()` returns `int`, `get_gpio_pin_state()` returns `int`, yet you still
save the return value of `get_gpio_pin_state()` into a variable with type
`ssize_t` for no apparent reason. In the example you cited, `ssize_t` is used
because the show() callback of a sysfs attribute must return `ssize_t`, but 
here,
`interrupt_line_active()` returns `bool`, so I don't see any advantage over a
plain `int`. Anyways, I believe either one is fine, I just found it odd.


> >> +
> >> +  if (status < 0) {
> >> +  dev_warn(>dev,
> >> +   "Failed to get GPIO Interrupt line status for %s",
> >> +   client->name);
> >
> >I think it's possible that the kernel message buffer is flooded with these
> >messages, which is not optimal in my opinion.
> >
> Thank you! Replaced with dev_dbg in v4.
> [...]

Have you looked at `dev_{warn,dbg,...}_ratelimited()`?


Regards,
Barnabás Pőcze


Re: [PATCH 01/29] iov_iter: Switch to using a table of operations

2020-11-22 Thread David Howells
Linus Torvalds  wrote:

>  - I worry a bit about the indirect call overhead and spectre v2.

I don't know enough about how spectre v2 works to say if this would be a
problem for the ops-table approach, but wouldn't it also affect the chain of
conditional branches that we currently use, since it's branch-prediction
based?

David



Re: [PATCH v2 1/3] genirq/affinity: Add irq_update_affinity_desc()

2020-11-22 Thread Marc Zyngier
On Fri, 20 Nov 2020 11:52:09 +,
John Garry  wrote:
> 
> Hi Thomas,
> 
> >> Just mentioning a couple of things here, which could be a clue to what
> >> is going on:
> >> - the device is behind mbigen secondary irq controller
> >> - the flow in the LLDD is to allocate all 128 interrupts during probe,
> >> but we only register handlers for a subset with device managed API
> > Right, but if the driver is removed then the interrupts should be
> > deallocated, right?
> > 
> 
> When removing the driver we just call free_irq(), which removes the
> handler and disables the interrupt.
> 
> But about the irq_desc, this is created when the mapping is created in
> irq_create_fwspec_mapping(), and I don't see this being torn down in
> the driver removal, so persistent in that regard.

If the irq_descs are created via the platform_get_irq() calls in
platform_get_irqs_affinity(), I'd expect some equivalent helper to
tear things down as a result, calling irq_dispose_mapping() behind the
scenes.

> So for pci msi I can see that we free the irq_desc in
> pci_disable_msi() -> free_msi_irqs() -> msi_domain_free_irqs() ...
> 
> So what I am missing here?

I'm not sure the paths are strictly equivalent. On the PCI side, we
can have something that completely driver agnostic, as it is all
architectural. In your case, only the endpoint driver knows about what
happens, and needs to free things accordingly.

Finally, there is the issue in your driver that everything is
requested using devm_request_irq, which cannot play nicely with an
explicit irq_desc teardown. You'll probably need to provide the
equivalent devm helpers for your driver to safely be taken down.

Thanks,

M.

-- 
Without deviation from the norm, progress is not possible.


Re: [PATCH v2 11/24] file: Implement task_lookup_fd_rcu

2020-11-22 Thread Cyrill Gorcunov
On Sun, Nov 22, 2020 at 07:00:20AM -0600, Eric W. Biederman wrote:
> Cyrill Gorcunov  writes:
...
> That is present in files_lookup_fd_rcu, so this code should
> be good from the warning side.

Indeed, thanks!


Re: general protection fault in ieee80211_chanctx_num_assigned

2020-11-22 Thread syzbot
syzbot has found a reproducer for the following issue on:

HEAD commit:a349e4c6 Merge tag 'xfs-5.10-fixes-7' of git://git.kernel...
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=144e1e9950
kernel config:  https://syzkaller.appspot.com/x/.config?x=330f3436df12fd44
dashboard link: https://syzkaller.appspot.com/bug?extid=00ce7332120071df39b1
compiler:   gcc (GCC) 10.1.0-syz 20200507
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=153140a550
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=179bf83550

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+00ce7332120071df3...@syzkaller.appspotmail.com

general protection fault, probably for non-canonical address 
0xfbd59c20:  [#1] PREEMPT SMP KASAN
KASAN: maybe wild-memory-access in range [0xdead0100-0xdead0107]
CPU: 1 PID: 8531 Comm: syz-executor169 Not tainted 5.10.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:ieee80211_chanctx_num_assigned+0xb1/0x140 net/mac80211/chan.c:21
Code: a8 f6 ff ff 48 39 c5 74 3b 49 bd 00 00 00 00 00 fc ff df e8 c1 91 1b f9 
48 8d bb 58 09 00 00 41 83 c4 01 48 89 f8 48 c1 e8 03 <42> 80 3c 28 00 75 68 48 
8b 83 58 09 00 00 48 8d 98 a8 f6 ff ff 48
RSP: 0018:c9000169f330 EFLAGS: 00010a02
RAX: 1bd5a020 RBX: deacf7a8 RCX: 88549e6b
RDX: 888011c8b480 RSI: 88549e0f RDI: dead0100
RBP: 8880130ca720 R08:  R09: 8cecb9cf
R10:  R11:  R12: 0002
R13: dc00 R14: 8880130ca700 R15: 
FS:  0087d940() GS:8880b9f0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 006d3090 CR3: 1c20a000 CR4: 001506e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 ieee80211_assign_vif_chanctx+0x7b8/0x1230 net/mac80211/chan.c:690
 __ieee80211_vif_release_channel+0x236/0x430 net/mac80211/chan.c:1557
 ieee80211_vif_release_channel+0x117/0x220 net/mac80211/chan.c:1771
 ieee80211_ibss_disconnect+0x44e/0x7b0 net/mac80211/ibss.c:735
 ieee80211_ibss_leave+0x12/0xe0 net/mac80211/ibss.c:1871
 rdev_leave_ibss net/wireless/rdev-ops.h:545 [inline]
 __cfg80211_leave_ibss+0x19a/0x4c0 net/wireless/ibss.c:212
 cfg80211_leave_ibss+0x57/0x80 net/wireless/ibss.c:230
 cfg80211_change_iface+0x855/0xef0 net/wireless/util.c:1012
 nl80211_set_interface+0x65c/0x8d0 net/wireless/nl80211.c:3789
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739
 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 sys_sendmsg+0x6e8/0x810 net/socket.c:2353
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4429b9
Code: e8 bc fd 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 
89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 
db 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:7ffd820d0a58 EFLAGS: 0246 ORIG_RAX: 002e
RAX: ffda RBX:  RCX: 004429b9
RDX:  RSI: 2340 RDI: 0004
RBP: fbef R08: 004035b0 R09: 004035b0
R10:  R11: 0246 R12: 00403520
R13: 004035b0 R14:  R15: 
Modules linked in:
---[ end trace 4cedfcb59a8efe47 ]---
RIP: 0010:ieee80211_chanctx_num_assigned+0xb1/0x140 net/mac80211/chan.c:21
Code: a8 f6 ff ff 48 39 c5 74 3b 49 bd 00 00 00 00 00 fc ff df e8 c1 91 1b f9 
48 8d bb 58 09 00 00 41 83 c4 01 48 89 f8 48 c1 e8 03 <42> 80 3c 28 00 75 68 48 
8b 83 58 09 00 00 48 8d 98 a8 f6 ff ff 48
RSP: 0018:c9000169f330 EFLAGS: 00010a02
RAX: 1bd5a020 RBX: deacf7a8 RCX: 88549e6b
RDX: 888011c8b480 RSI: 88549e0f RDI: dead0100
RBP: 8880130ca720 R08:  R09: 8cecb9cf
R10:  R11:  R12: 0002
R13: dc00 R14: 8880130ca700 R15: 
FS:  0087d940() GS:8880b9e0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7efedefa7000 CR3: 1c20a000 CR4: 001506f0
DR0: 

RE: [PATCH 01/29] iov_iter: Switch to using a table of operations

2020-11-22 Thread David Laight
From: David Howells
> Sent: 22 November 2020 13:33
> 
> Linus Torvalds  wrote:
> 
> >  - I worry a bit about the indirect call overhead and spectre v2.
> 
> I don't know enough about how spectre v2 works to say if this would be a
> problem for the ops-table approach, but wouldn't it also affect the chain of
> conditional branches that we currently use, since it's branch-prediction
> based?

The advantage of the 'chain of branches' is that it can be converted
into a 'tree of branches' because the values are all separate bits.

So as well as putting the (expected) common one first; you can do:
if (likely((a & (A | B))) {
if (a & A) {
code for A;
} else {
code for B;
} else ...
So get better control over the branch sequence.
(Hopefully the compiler doesn't change the logic.
I want a dumb compiler that (mostly) compiles what I write!)

Part of the difficulty is deciding the common case.
There'll always be a benchmark that exercises an uncommon case.

Adding an indirect call does let you do things like adding
ITER_IOVER_SINGLE and ITER_KVEC_SINGLE that are used in the
common case of a single buffer fragment.
That might be a measurable gain.

It is also possible to optimise the common case to a direct
call (or even inline code) and use an indirect call for
everything else.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)



Re: [PATCH next] mm/vmscan: __isolate_lru_page_prepare clean up

2020-11-22 Thread Alex Shi



在 2020/11/22 下午8:35, Matthew Wilcox 写道:
> On Sun, Nov 22, 2020 at 08:00:19PM +0800, Alex Shi wrote:
>>  mm/compaction.c |  2 +-
>>  mm/vmscan.c | 69 +++--
>>  2 files changed, 34 insertions(+), 37 deletions(-)
> 
> How is it possible you're changing the signature of a function without
> touching a header file?  Surely __isolate_lru_page_prepare() must be declared
> in mm/internal.h ?
> 
>> +++ b/mm/vmscan.c
>> @@ -1536,19 +1536,17 @@ unsigned int reclaim_clean_pages_from_list(struct 
>> zone *zone,
>>   * page:page to consider
>>   * mode:one of the LRU isolation modes defined above
>>   *
>> - * returns 0 on success, -ve errno on failure.
>> + * returns ture on success, false on failure.
> 
> "true".
> 
>> @@ -1674,35 +1672,34 @@ static unsigned long isolate_lru_pages(unsigned long 
>> nr_to_scan,
>>   * only when the page is being freed somewhere else.
>>   */
>>  scan += nr_pages;
>> -switch (__isolate_lru_page_prepare(page, mode)) {
>> -case 0:
>> +if (!__isolate_lru_page_prepare(page, mode)) {
>> +/* else it is being freed elsewhere */
> 
> I don't think the word "else" helps here.  Just
>   /* It is being freed elsewhere */
> 
>> +if (!TestClearPageLRU(page)) {
>>  /*
>> + * This page may in other isolation path,
>> + * but we still hold lru_lock.
>>   */
> 
> I don't think this comment helps me understand what's going on here.
> Maybe:
> 
>   /* Another thread is already isolating this page */
> 
>> +put_page(page);
>>  list_move(>lru, src);
>> +continue;
>>  }

Hi Matthew,

Thanks a lot for all comments, I picked all up and here is the v3:

>From 167131dd106a96fd08af725df850e0da6ec899af Mon Sep 17 00:00:00 2001
From: Alex Shi 
Date: Fri, 20 Nov 2020 14:49:16 +0800
Subject: [PATCH v3 next] mm/vmscan: __isolate_lru_page_prepare clean up

The function just return 2 results, so use a 'switch' to deal with its
result is unnecessary, and simplify it to a bool func as Vlastimil
suggested.

Also remove 'goto' by reusing list_move(), and take Matthew Wilcox's
suggestion to update comments in function.

Signed-off-by: Alex Shi 
Cc: Andrew Morton 
Cc: Matthew Wilcox 
Cc: Hugh Dickins 
Cc: Yu Zhao 
Cc: Vlastimil Babka 
Cc: Michal Hocko 
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 include/linux/swap.h |  2 +-
 mm/compaction.c  |  2 +-
 mm/vmscan.c  | 68 
 3 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 596bc2f4d9b0..5bba15ac5a2e 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -356,7 +356,7 @@ extern void lru_cache_add_inactive_or_unevictable(struct 
page *page,
 extern unsigned long zone_reclaimable_pages(struct zone *zone);
 extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
gfp_t gfp_mask, nodemask_t *mask);
-extern int __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode);
+extern bool __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode);
 extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
  unsigned long nr_pages,
  gfp_t gfp_mask,
diff --git a/mm/compaction.c b/mm/compaction.c
index b68931854253..8d71ffebe6cb 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -988,7 +988,7 @@ isolate_migratepages_block(struct compact_control *cc, 
unsigned long low_pfn,
if (unlikely(!get_page_unless_zero(page)))
goto isolate_fail;
 
-   if (__isolate_lru_page_prepare(page, isolate_mode) != 0)
+   if (!__isolate_lru_page_prepare(page, isolate_mode))
goto isolate_fail_put;
 
/* Try isolate the page */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index c6f94e55c3fe..4d2703c43310 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1536,19 +1536,17 @@ unsigned int reclaim_clean_pages_from_list(struct zone 
*zone,
  * page:   page to consider
  * mode:   one of the LRU isolation modes defined above
  *
- * returns 0 on success, -ve errno on failure.
+ * returns true on success, false on failure.
  */
-int __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode)
+bool __isolate_lru_page_prepare(struct page *page, isolate_mode_t mode)
 {
-   int ret = -EBUSY;
-
/* Only take pages on the LRU. */
if (!PageLRU(page))
-   return ret;
+   return false;
 
/* Compaction should not handle unevictable pages but CMA can do so */
if (PageUnevictable(page) && 

Re: [PATCH v2 4/4] iio: hid-sensors: Add hinge sensor driver

2020-11-22 Thread Jonathan Cameron
On Sun, 22 Nov 2020 02:14:16 +
"Pandruvada, Srinivas"  wrote:

> On Sat, 2020-11-21 at 17:46 -0800, Srinivas Pandruvada wrote:
> > On Sat, 2020-11-21 at 17:56 +, Jonathan Cameron wrote:  
> > > On Thu, 19 Nov 2020 18:03:31 +0800
> > > Ye Xiang  wrote:
> > >   
> > > > The Hinge sensor is a common custom sensor on laptops. It
> > > > calculates
> > > > the angle between the lid (screen) and the base (keyboard). In
> > > > addition,
> > > > it also exposes screen and the keyboard angels with respect to
> > > > the
> > > > ground. Applications can easily get laptop's status in space
> > > > through
> > > > this sensor, in order to display appropriate user interface.  
> > > 
> > > I'm a little unclear on why the 3 axes aren't treated as a single
> > > sensor.
> > > You seem to always grab the 3 together or am I missing something?
> > > 
> > > That will greatly simplify things and get rid of the need to have
> > > a shared trigger with the problems that causes in the previous
> > > patch.  
> > 
> > They are not three axes, they are independent. Xiang did try adding
> > x,
> > y and z component to represent x as hinge, y as keyboard and z as
> > lid.
> > But I was not convinced.
> > The problem is that then what will be sysfs interface? They are
> > really
> > a three sensors. Or we create new interface to call
> > in_angl_raw_keyboard
> > in_angl_raw_screen
> > in_angl_raw_lid.
> >   
> You seem to indicate this is possible now some new "label" patch.
> Is this the patch?
> commit 2c3d0c9ffd24d9b4c62c5dfb2104695a614be28c
> Author: Phil Reid 
> Date:   Thu Sep 19 22:36:08 2019 +0800

Nope, this one 
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=1d4ef9b39ebecca827642b8897d2d79ea2026682

The one above adds a per device label which wouldn't be much use for your
case, but this one adds a per channel label.

Done via a read_label callback.

Here you'd want to use indexed channels so something like.

in_angl0_raw
in_angl1_raw
in_angl2_raw

and

in_angl0_label = keyboard
in_angl1_label = screen
in_angl2_label = lid



> 
> Ideally, one iio device here is much easy to manage as other HID
> sensors. If we can add something other that "x", "y" and "z" component.

Agreed, using axes makes no real sense here and extended_name is
just a mess from ABI point of view.  Trying to solve this was the
reason we added the _label interface.

Jonathan


> 
> Thanks,
> Srinivas
> 
> > Thanks,
> > Srinivas
> > 
> >   
> > > Thanks,
> > > 
> > > Jonathan
> > >   
> > > > Signed-off-by: Ye Xiang 
> > > > ---
> > > >  .../hid-sensors/hid-sensor-attributes.c   |   2 +
> > > >  drivers/iio/position/Kconfig  |  16 +
> > > >  drivers/iio/position/Makefile |   3 +
> > > >  .../iio/position/hid-sensor-custom-hinge.c| 412
> > > > ++  
> > > 
> > > Given it's custom probably needs a more specific name.  I guess
> > > hid-sensor-custom-intel-hinge.c might be safe?
> > > 
> > > Same for other places we need names in here.
> > >   
> > > >  4 files changed, 433 insertions(+)
> > > >  create mode 100644 drivers/iio/position/hid-sensor-custom-
> > > > hinge.c
> > > > 
> > > > diff --git a/drivers/iio/common/hid-sensors/hid-sensor-
> > > > attributes.c 
> > > > b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> > > > index 442ff787f7af..5b822a4298a0 100644
> > > > --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> > > > +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
> > > > @@ -71,6 +71,8 @@ static struct {
> > > > {HID_USAGE_SENSOR_TEMPERATURE, HID_USAGE_SENSOR_UNITS_DEGREES,
> > > > 1000, 0},
> > > >  
> > > > {HID_USAGE_SENSOR_HUMIDITY, 0, 1000, 0},
> > > > +   {HID_USAGE_SENSOR_HINGE, 0, 0, 17453293},
> > > > +   {HID_USAGE_SENSOR_HINGE, HID_USAGE_SENSOR_UNITS_DEGREES, 0,
> > > > 17453293},
> > > >  };
> > > >  
> > > >  static void simple_div(int dividend, int divisor, int *whole,
> > > > diff --git a/drivers/iio/position/Kconfig
> > > > b/drivers/iio/position/Kconfig
> > > > index eda67f008c5b..0346f6f2b422 100644
> > > > --- a/drivers/iio/position/Kconfig
> > > > +++ b/drivers/iio/position/Kconfig
> > > > @@ -16,4 +16,20 @@ config IQS624_POS
> > > >   To compile this driver as a module, choose M here: the module
> > > >   will be called iqs624-pos.
> > > >  
> > > > +config HID_SENSOR_CUSTOM_HINGE
> > > > +   depends on HID_SENSOR_HUB
> > > > +   select IIO_BUFFER
> > > > +   select IIO_TRIGGERED_BUFFER
> > > > +   select HID_SENSOR_IIO_COMMON
> > > > +   select HID_SENSOR_IIO_TRIGGER
> > > > +   tristate "HID Hinge"
> > > > +   help
> > > > + This sensor present three angles, hinge angel, screen angles
> > > > + and keyboard angle respect to horizon (ground).
> > > > + Say yes here to build support for the HID SENSOR CUSTOM
> > > > + HINGE.  
> > > 
> > > Capitalization is a bit odd looking. I'd drop it.
> > >   
> > > > 

Re: [PATCH RFC tip/core/rcu 5/5] srcu: Provide polling interfaces for Tree SRCU grace periods

2020-11-22 Thread Neeraj Upadhyay




On 11/21/2020 5:46 AM, Paul E. McKenney wrote:

On Fri, Nov 20, 2020 at 05:31:43PM +0530, Neeraj Upadhyay wrote:



On 11/17/2020 6:10 AM, paul...@kernel.org wrote:

From: "Paul E. McKenney" 

There is a need for a polling interface for SRCU grace
periods, so this commit supplies get_state_synchronize_srcu(),
start_poll_synchronize_srcu(), and poll_state_synchronize_srcu() for this
purpose.  The first can be used if future grace periods are inevitable
(perhaps due to a later call_srcu() invocation), the second if future
grace periods might not otherwise happen, and the third to check if a
grace period has elapsed since the corresponding call to either of the
first two.

As with get_state_synchronize_rcu() and cond_synchronize_rcu(),
the return value from either get_state_synchronize_srcu() or
start_poll_synchronize_srcu() must be passed in to a later call to
poll_state_synchronize_srcu().

Link: https://lore.kernel.org/rcu/20201112201547.gf3365...@moria.home.lan/
Reported-by: Kent Overstreet 
[ paulmck: Add EXPORT_SYMBOL_GPL() per kernel test robot feedback. ]
Signed-off-by: Paul E. McKenney 
---
   kernel/rcu/srcutree.c | 63 
---
   1 file changed, 60 insertions(+), 3 deletions(-)

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index d930ece..015d80e 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -810,7 +810,8 @@ static void srcu_leak_callback(struct rcu_head *rhp)
   /*
* Start an SRCU grace period, and also queue the callback if non-NULL.
*/
-static void srcu_gp_start_if_needed(struct srcu_struct *ssp, struct rcu_head 
*rhp, bool do_norm)
+static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp,
+struct rcu_head *rhp, bool do_norm)
   {
unsigned long flags;
int idx;
@@ -822,7 +823,8 @@ static void srcu_gp_start_if_needed(struct srcu_struct 
*ssp, struct rcu_head *rh
idx = srcu_read_lock(ssp);
sdp = raw_cpu_ptr(ssp->sda);
spin_lock_irqsave_rcu_node(sdp, flags);
-   rcu_segcblist_enqueue(>srcu_cblist, rhp);
+   if (rhp)
+   rcu_segcblist_enqueue(>srcu_cblist, rhp);
rcu_segcblist_advance(>srcu_cblist,
  rcu_seq_current(>srcu_gp_seq));
s = rcu_seq_snap(>srcu_gp_seq);
@@ -841,6 +843,7 @@ static void srcu_gp_start_if_needed(struct srcu_struct 
*ssp, struct rcu_head *rh
else if (needexp)
srcu_funnel_exp_start(ssp, sdp->mynode, s);
srcu_read_unlock(ssp, idx);
+   return s;
   }
   /*
@@ -882,7 +885,7 @@ static void __call_srcu(struct srcu_struct *ssp, struct 
rcu_head *rhp,
return;
}
rhp->func = func;
-   srcu_gp_start_if_needed(ssp, rhp, do_norm);
+   (void)srcu_gp_start_if_needed(ssp, rhp, do_norm);
   }
   /**
@@ -1011,6 +1014,60 @@ void synchronize_srcu(struct srcu_struct *ssp)
   }
   EXPORT_SYMBOL_GPL(synchronize_srcu);
+/**
+ * get_state_synchronize_srcu - Provide an end-of-grace-period cookie
+ * @ssp: srcu_struct to provide cookie for.
+ *
+ * This function returns a cookie that can be passed to
+ * poll_state_synchronize_srcu(), which will return true if a full grace
+ * period has elapsed in the meantime.  It is the caller's responsibility
+ * to make sure that grace period happens, for example, by invoking
+ * call_srcu() after return from get_state_synchronize_srcu().
+ */
+unsigned long get_state_synchronize_srcu(struct srcu_struct *ssp)
+{
+   // Any prior manipulation of SRCU-protected data must happen
+// before the load from ->srcu_gp_seq.
+   smp_mb();
+   return rcu_seq_snap(>srcu_gp_seq);
+}
+EXPORT_SYMBOL_GPL(get_state_synchronize_srcu);
+
+/**
+ * start_poll_synchronize_srcu - Provide cookie and start grace period
+ * @ssp: srcu_struct to provide cookie for.
+ *
+ * This function returns a cookie that can be passed to
+ * poll_state_synchronize_srcu(), which will return true if a full grace
+ * period has elapsed in the meantime.  Unlike get_state_synchronize_srcu(),
+ * this function also ensures that any needed SRCU grace period will be
+ * started.  This convenience does come at a cost in terms of CPU overhead.
+ */
+unsigned long start_poll_synchronize_srcu(struct srcu_struct *ssp)
+{
+   return srcu_gp_start_if_needed(ssp, NULL, true);
+}
+EXPORT_SYMBOL_GPL(start_poll_synchronize_srcu);
+
+/**
+ * poll_state_synchronize_srcu - Has cookie's grace period ended?
+ * @ssp: srcu_struct to provide cookie for.
+ * @cookie: Return value from get_state_synchronize_srcu() or 
start_poll_synchronize_srcu().
+ *
+ * This function takes the cookie that was returned from either
+ * get_state_synchronize_srcu() or start_poll_synchronize_srcu(), and
+ * returns @true if an SRCU grace period elapsed since the time that the
+ * cookie was created.
+ */
+bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie)
+{
+   if 

Re: [PATCH RFC tip/core/rcu 4/5] srcu: Provide polling interfaces for Tiny SRCU grace periods

2020-11-22 Thread Neeraj Upadhyay




On 11/21/2020 5:43 AM, Paul E. McKenney wrote:

On Fri, Nov 20, 2020 at 05:28:32PM +0530, Neeraj Upadhyay wrote:

Hi Paul,

On 11/17/2020 6:10 AM, paul...@kernel.org wrote:

From: "Paul E. McKenney" 

There is a need for a polling interface for SRCU grace
periods, so this commit supplies get_state_synchronize_srcu(),
start_poll_synchronize_srcu(), and poll_state_synchronize_srcu() for this
purpose.  The first can be used if future grace periods are inevitable
(perhaps due to a later call_srcu() invocation), the second if future
grace periods might not otherwise happen, and the third to check if a
grace period has elapsed since the corresponding call to either of the
first two.

As with get_state_synchronize_rcu() and cond_synchronize_rcu(),
the return value from either get_state_synchronize_srcu() or
start_poll_synchronize_srcu() must be passed in to a later call to
poll_state_synchronize_srcu().

Link: https://lore.kernel.org/rcu/20201112201547.gf3365...@moria.home.lan/
Reported-by: Kent Overstreet 
[ paulmck: Add EXPORT_SYMBOL_GPL() per kernel test robot feedback. ]
Signed-off-by: Paul E. McKenney 
---
   include/linux/rcupdate.h |  2 ++
   include/linux/srcu.h |  3 +++
   include/linux/srcutiny.h |  1 +
   kernel/rcu/srcutiny.c| 52 
++--
   4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index de08264..e09c0d8 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -33,6 +33,8 @@
   #define ULONG_CMP_GE(a, b)   (ULONG_MAX / 2 >= (a) - (b))
   #define ULONG_CMP_LT(a, b)   (ULONG_MAX / 2 < (a) - (b))
   #define ulong2long(a)(*(long *)(&(a)))
+#define USHORT_CMP_GE(a, b)(USHRT_MAX / 2 >= (unsigned short)((a) - (b)))
+#define USHORT_CMP_LT(a, b)(USHRT_MAX / 2 < (unsigned short)((a) - (b)))
   /* Exported common interfaces */
   void call_rcu(struct rcu_head *head, rcu_callback_t func);
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index e432cc9..a0895bb 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -60,6 +60,9 @@ void cleanup_srcu_struct(struct srcu_struct *ssp);
   int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp);
   void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
   void synchronize_srcu(struct srcu_struct *ssp);
+unsigned long get_state_synchronize_srcu(struct srcu_struct *ssp);
+unsigned long start_poll_synchronize_srcu(struct srcu_struct *ssp);
+bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long 
cookie);
   #ifdef CONFIG_DEBUG_LOCK_ALLOC
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h
index fed4a2d..e9bd6fb 100644
--- a/include/linux/srcutiny.h
+++ b/include/linux/srcutiny.h
@@ -16,6 +16,7 @@
   struct srcu_struct {
short srcu_lock_nesting[2]; /* srcu_read_lock() nesting depth. */
unsigned short srcu_idx;/* Current reader array element in bit 
0x2. */
+   unsigned short srcu_idx_max;/* Furthest future srcu_idx request. */
u8 srcu_gp_running; /* GP workqueue running? */
u8 srcu_gp_waiting; /* GP waiting for readers? */
struct swait_queue_head srcu_wq;
diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 3bac1db..b405811 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -34,6 +34,7 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp)
ssp->srcu_gp_running = false;
ssp->srcu_gp_waiting = false;
ssp->srcu_idx = 0;
+   ssp->srcu_idx_max = 0;
INIT_WORK(>srcu_work, srcu_drive_gp);
INIT_LIST_HEAD(>srcu_work.entry);
return 0;
@@ -114,7 +115,7 @@ void srcu_drive_gp(struct work_struct *wp)
struct srcu_struct *ssp;
ssp = container_of(wp, struct srcu_struct, srcu_work);
-   if (ssp->srcu_gp_running || !READ_ONCE(ssp->srcu_cb_head))
+   if (ssp->srcu_gp_running || USHORT_CMP_GE(ssp->srcu_idx, 
READ_ONCE(ssp->srcu_idx_max)))
return; /* Already running or nothing to do. */
/* Remove recently arrived callbacks and wait for readers. */
@@ -147,14 +148,19 @@ void srcu_drive_gp(struct work_struct *wp)
 * straighten that out.
 */
WRITE_ONCE(ssp->srcu_gp_running, false);
-   if (READ_ONCE(ssp->srcu_cb_head))
+   if (USHORT_CMP_GE(ssp->srcu_idx, READ_ONCE(ssp->srcu_idx_max)))


Should this be USHORT_CMP_LT ?


I believe that you are correct.  As is, it works but does needless
grace periods.


schedule_work(>srcu_work);
   }
   EXPORT_SYMBOL_GPL(srcu_drive_gp);
   static void srcu_gp_start_if_needed(struct srcu_struct *ssp)
   {
+   unsigned short cookie;
+
if (!READ_ONCE(ssp->srcu_gp_running)) {
+   cookie = get_state_synchronize_srcu(ssp);
+   if (USHORT_CMP_LT(READ_ONCE(ssp->srcu_idx_max), cookie))
+   WRITE_ONCE(ssp->srcu_idx_max, 

Re: [PATCH 008/141] IB/hfi1: Fix fall-through warnings for Clang

2020-11-22 Thread Mike Marciniszyn



On 11/20/2020 1:25 PM, Gustavo A. R. Silva wrote:

In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements instead of just
letting the code fall through to the next case.

Signed-off-by: Gustavo A. R. Silva 


Looks good and tested with TID rdma to cover the interlock case.

Mike

Tested-by: Mike Marciniszyn 



Re: [PATCH v2 tip/core/rcu 4/6] srcu: Provide polling interfaces for Tiny SRCU grace periods

2020-11-22 Thread Neeraj Upadhyay




On 11/21/2020 6:29 AM, paul...@kernel.org wrote:

From: "Paul E. McKenney" 

There is a need for a polling interface for SRCU grace
periods, so this commit supplies get_state_synchronize_srcu(),
start_poll_synchronize_srcu(), and poll_state_synchronize_srcu() for this
purpose.  The first can be used if future grace periods are inevitable
(perhaps due to a later call_srcu() invocation), the second if future
grace periods might not otherwise happen, and the third to check if a
grace period has elapsed since the corresponding call to either of the
first two.

As with get_state_synchronize_rcu() and cond_synchronize_rcu(),
the return value from either get_state_synchronize_srcu() or
start_poll_synchronize_srcu() must be passed in to a later call to
poll_state_synchronize_srcu().

Link: https://lore.kernel.org/rcu/20201112201547.gf3365...@moria.home.lan/
Reported-by: Kent Overstreet 
[ paulmck: Add EXPORT_SYMBOL_GPL() per kernel test robot feedback. ]
[ paulmck: Apply feedback from Neeraj Upadhyay. ]
Link: https://lore.kernel.org/lkml/20201117004017.GA7444@paulmck-ThinkPad-P72/
Signed-off-by: Paul E. McKenney 
---
  include/linux/rcupdate.h |  2 ++
  include/linux/srcu.h |  3 +++
  include/linux/srcutiny.h |  1 +
  kernel/rcu/srcutiny.c| 52 ++--
  4 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index de08264..e09c0d8 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -33,6 +33,8 @@
  #define ULONG_CMP_GE(a, b)(ULONG_MAX / 2 >= (a) - (b))
  #define ULONG_CMP_LT(a, b)(ULONG_MAX / 2 < (a) - (b))
  #define ulong2long(a) (*(long *)(&(a)))
+#define USHORT_CMP_GE(a, b)(USHRT_MAX / 2 >= (unsigned short)((a) - (b)))
+#define USHORT_CMP_LT(a, b)(USHRT_MAX / 2 < (unsigned short)((a) - (b)))
  
  /* Exported common interfaces */

  void call_rcu(struct rcu_head *head, rcu_callback_t func);
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index e432cc9..a0895bb 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -60,6 +60,9 @@ void cleanup_srcu_struct(struct srcu_struct *ssp);
  int __srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp);
  void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp);
  void synchronize_srcu(struct srcu_struct *ssp);
+unsigned long get_state_synchronize_srcu(struct srcu_struct *ssp);
+unsigned long start_poll_synchronize_srcu(struct srcu_struct *ssp);
+bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long 
cookie);
  
  #ifdef CONFIG_DEBUG_LOCK_ALLOC
  
diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h

index d9edb67..c7f0c1f 100644
--- a/include/linux/srcutiny.h
+++ b/include/linux/srcutiny.h
@@ -16,6 +16,7 @@
  struct srcu_struct {
short srcu_lock_nesting[2]; /* srcu_read_lock() nesting depth. */
unsigned short srcu_idx;/* Current reader array element in bit 
0x2. */
+   unsigned short srcu_idx_max;/* Furthest future srcu_idx request. */
u8 srcu_gp_running; /* GP workqueue running? */
u8 srcu_gp_waiting; /* GP waiting for readers? */
struct swait_queue_head srcu_wq;
diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 3bac1db..b073175 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -34,6 +34,7 @@ static int init_srcu_struct_fields(struct srcu_struct *ssp)
ssp->srcu_gp_running = false;
ssp->srcu_gp_waiting = false;
ssp->srcu_idx = 0;
+   ssp->srcu_idx_max = 0;
INIT_WORK(>srcu_work, srcu_drive_gp);
INIT_LIST_HEAD(>srcu_work.entry);
return 0;
@@ -114,7 +115,7 @@ void srcu_drive_gp(struct work_struct *wp)
struct srcu_struct *ssp;
  
  	ssp = container_of(wp, struct srcu_struct, srcu_work);

-   if (ssp->srcu_gp_running || !READ_ONCE(ssp->srcu_cb_head))
+   if (ssp->srcu_gp_running || USHORT_CMP_GE(ssp->srcu_idx, 
READ_ONCE(ssp->srcu_idx_max)))
return; /* Already running or nothing to do. */
  
  	/* Remove recently arrived callbacks and wait for readers. */

@@ -147,13 +148,18 @@ void srcu_drive_gp(struct work_struct *wp)
 * straighten that out.
 */
WRITE_ONCE(ssp->srcu_gp_running, false);
-   if (READ_ONCE(ssp->srcu_cb_head))
+   if (USHORT_CMP_GE(ssp->srcu_idx, READ_ONCE(ssp->srcu_idx_max)))


USHORT_CMP_LT ?

Thanks
Neeraj


schedule_work(>srcu_work);



  }
  EXPORT_SYMBOL_GPL(srcu_drive_gp);
  
  static void srcu_gp_start_if_needed(struct srcu_struct *ssp)

  {
+   unsigned short cookie;
+
+   cookie = get_state_synchronize_srcu(ssp);
+   if (USHORT_CMP_LT(READ_ONCE(ssp->srcu_idx_max), cookie))
+   WRITE_ONCE(ssp->srcu_idx_max, cookie);
if (!READ_ONCE(ssp->srcu_gp_running)) {
if (likely(srcu_init_done))
schedule_work(>srcu_work);
@@ -196,6 

Re: [PATCH net-next 2/3] mlxsw: spectrum_ptp: use PTP wide message type definitions

2020-11-22 Thread Ido Schimmel
On Sun, Nov 22, 2020 at 09:26:35AM +0100, Christian Eggers wrote:
> Use recently introduced PTP wide defines instead of a driver internal
> enumeration.
> 
> Signed-off-by: Christian Eggers 
> Cc: Petr Machata 
> Cc: Jiri Pirko 
> Cc: Ido Schimmel 

Reviewed-by: Ido Schimmel 

But:

1. Checkpatch complains about:
WARNING: From:/Signed-off-by: email address mismatch: 'From: Christian Eggers 
' != 'Signed-off-by: Christian Eggers '

2. This series does not build, which fails the CI [1][2] and also
required me to fetch the dependencies that are currently under review
[3]. I believe it is generally discouraged to create dependencies
between patch sets that are under review for exactly these reasons. I
don't know what are Jakub's preferences, but had this happened on our
internal patchwork instance, I would just ask the author to submit
another version with all the patches.

Anyway, I added all six patches to our regression as we have some PTP
tests. Will let you know tomorrow.

Thanks

[1] 
https://lore.kernel.org/netdev/20201122082636.12451-1-cegg...@arri.de/T/#mcef35858585d23b72b8f75450a51618d5c5d3260
[2] 
https://patchwork.hopto.org/static/nipa/389053/11923809/build_allmodconfig_warn/summary
[3] 
https://patchwork.kernel.org/project/netdevbpf/cover/20201120084106.10046-1-cegg...@arri.de/


Re: About regression caused by commit aea6cb99703e ("regulator: resolve supply after creating regulator")

2020-11-22 Thread Jan Kiszka
On 09.11.20 00:28, Qu Wenruo wrote:
> 
> 
> On 2020/11/9 上午1:18, Michał Mirosław wrote:
>> On Sun, Nov 08, 2020 at 03:35:33PM +0800, Qu Wenruo wrote:
>>> Hi Michał,
>>>
>>> Recently when testing v5.10-rc2, I found my RK3399 boards failed to boot
>>> from NVME.
>>>
>>> It turns out that, commit aea6cb99703e ("regulator: resolve supply after
>>> creating regulator") seems to be the cause.
>>>
>>> In RK3399 board, vpcie1v8 and vpcie0v9 of the pcie controller is
>>> provided by RK808 regulator.
>>> With that commit, now RK808 regulator fails to register:
>>>
>>> [1.402500] rk808-regulator rk808-regulator: there is no dvs0 gpio
>>> [1.403104] rk808-regulator rk808-regulator: there is no dvs1 gpio
>>> [1.419856] rk808 0-001b: failed to register 12 regulator
>>> [1.422801] rk808-regulator: probe of rk808-regulator failed with
>>> error -22
>>
>> Hi,
>>
>> This looks lika the problem fixed by commit cf1ad559a20d ("regulator: defer
>> probe when trying to get voltage from unresolved supply") recently accepted
>> to regulator tree [1]. Can you verify this?
> 
> Thanks, tested with that commit cherry picked to v5.10-rc2 and it solves
> the problem.
> 

We are still missing some magic fix for stable trees: On the STM32MP15x,
things are broken since 5.4.73 now. And 5.9.y is not booting as well on
that board. Reverting the original commit make it boot again.

Linus master is fine, though, but I'm tired of bisecting. Any
suggestions? Or is there something queued up already?

In any case: Is that board in no stable Q farm? It's a basic "boot
fails" regression.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


Re: [RFC] MAINTAINERS tag for cleanup robot

2020-11-22 Thread Tom Rix


On 11/21/20 7:23 PM, Matthew Wilcox wrote:
> On Sat, Nov 21, 2020 at 08:50:58AM -0800, t...@redhat.com wrote:
>> The fixer review is
>> https://reviews.llvm.org/D91789
>>
>> A run over allyesconfig for x86_64 finds 62 issues, 5 are false positives.
>> The false positives are caused by macros passed to other macros and by
>> some macro expansions that did not have an extra semicolon.
>>
>> This cleans up about 1,000 of the current 10,000 -Wextra-semi-stmt
>> warnings in linux-next.
> Are any of them not false-positives?  It's all very well to enable
> stricter warnings, but if they don't fix any bugs, they're just churn.
>
While enabling additional warnings may be a side effect of this effort

the primary goal is to set up a cleaning robot. After that a refactoring robot.

Tom



[GIT pull] sched/urgent for v5.10-rc5

2020-11-22 Thread Thomas Gleixner
Linus,

please pull the latest sched/urgent branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
sched-urgent-2020-11-22

up to:  2279f540ea7d: sched/deadline: Fix priority inheritance with multiple 
scheduling classes


A couple of scheduler fixes:

 - Make the conditional update of the overutilized state work correctly by
   caching the relevant flags state before overwriting them and checking
   them afterwards.

 - Fix a data race in the wakeup path which caused loadavg on ARM64
   platforms to become a random number generator.

 - Fix the ordering of the iowaiter accounting operations so it can't be
   decremented before it is incremented.

 - Fix a bug in the deadline scheduler vs. priority inheritance when a
   non-deadline task A has inherited the parameters of a deadline task B
   and then blocks on a non-deadline task C.

   The second inheritance step used the static deadline parameters of task
   A, which are usually 0, instead of further propagating task B's
   parameters. The zero initialized parameters trigger a bug in the
   deadline scheduler.


Thanks,

tglx

-->
Juri Lelli (1):
  sched/deadline: Fix priority inheritance with multiple scheduling classes

Peter Zijlstra (2):
  sched: Fix data-race in wakeup
  sched: Fix rq->nr_iowait ordering

Quentin Perret (1):
  sched/fair: Fix overutilized update in enqueue_task_fair()


 include/linux/sched.h   | 26 -
 kernel/sched/core.c | 26 -
 kernel/sched/deadline.c | 97 +++--
 kernel/sched/fair.c |  3 +-
 4 files changed, 95 insertions(+), 57 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index d383cf09e78f..095fdec07b38 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -551,7 +551,6 @@ struct sched_dl_entity {
 * overruns.
 */
unsigned intdl_throttled  : 1;
-   unsigned intdl_boosted: 1;
unsigned intdl_yielded: 1;
unsigned intdl_non_contending : 1;
unsigned intdl_overrun: 1;
@@ -570,6 +569,15 @@ struct sched_dl_entity {
 * time.
 */
struct hrtimer inactive_timer;
+
+#ifdef CONFIG_RT_MUTEXES
+   /*
+* Priority Inheritance. When a DEADLINE scheduling entity is boosted
+* pi_se points to the donor, otherwise points to the dl_se it belongs
+* to (the original one/itself).
+*/
+   struct sched_dl_entity *pi_se;
+#endif
 };
 
 #ifdef CONFIG_UCLAMP_TASK
@@ -769,7 +777,6 @@ struct task_struct {
unsignedsched_reset_on_fork:1;
unsignedsched_contributes_to_load:1;
unsignedsched_migrated:1;
-   unsignedsched_remote_wakeup:1;
 #ifdef CONFIG_PSI
unsignedsched_psi_wake_requeue:1;
 #endif
@@ -779,6 +786,21 @@ struct task_struct {
 
/* Unserialized, strictly 'current' */
 
+   /*
+* This field must not be in the scheduler word above due to wakelist
+* queueing no longer being serialized by p->on_cpu. However:
+*
+* p->XXX = X;  ttwu()
+* schedule() if (p->on_rq && ..) // false
+*   smp_mb__after_spinlock();if (smp_load_acquire(>on_cpu) && 
//true
+*   deactivate_task()ttwu_queue_wakelist())
+* p->on_rq = 0;p->sched_remote_wakeup = Y;
+*
+* guarantees all stores of 'current' are visible before
+* ->sched_remote_wakeup gets used, so it can be in this word.
+*/
+   unsignedsched_remote_wakeup:1;
+
/* Bit to tell LSMs we're in execve(): */
unsignedin_execve:1;
unsignedin_iowait:1;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d2003a7d5ab5..e7e453492cff 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2501,7 +2501,12 @@ ttwu_do_activate(struct rq *rq, struct task_struct *p, 
int wake_flags,
 #ifdef CONFIG_SMP
if (wake_flags & WF_MIGRATED)
en_flags |= ENQUEUE_MIGRATED;
+   else
 #endif
+   if (p->in_iowait) {
+   delayacct_blkio_end(p);
+   atomic_dec(_rq(p)->nr_iowait);
+   }
 
activate_task(rq, p, en_flags);
ttwu_do_wakeup(rq, p, wake_flags, rf);
@@ -2888,11 +2893,6 @@ try_to_wake_up(struct task_struct *p, unsigned int 
state, int wake_flags)
if (READ_ONCE(p->on_rq) && ttwu_runnable(p, wake_flags))
goto unlock;
 
-   if (p->in_iowait) {
-   delayacct_blkio_end(p);
-   atomic_dec(_rq(p)->nr_iowait);
-   }
-
 #ifdef CONFIG_SMP
/*
 * Ensure 

[GIT pull] perf/urgent for v5.10-rc5

2020-11-22 Thread Thomas Gleixner
Linus,

please pull the latest perf/urgent branch from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
perf-urgent-2020-11-22

up to:  ebd19fc372e3: perf/x86: fix sysfs type mismatches


A single fix for the x86 perf sysfs interfaces which used kobject
attributes instead of device attributes and therefore making Clangs control
flow integrity checker upset.

Thanks,

tglx

-->
Sami Tolvanen (1):
  perf/x86: fix sysfs type mismatches


 arch/x86/events/intel/cstate.c |  6 +++---
 arch/x86/events/intel/uncore.c |  4 ++--
 arch/x86/events/intel/uncore.h | 12 ++--
 arch/x86/events/rapl.c | 14 +-
 4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 442e1ed4acd4..4eb7ee5fed72 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -107,14 +107,14 @@
 MODULE_LICENSE("GPL");
 
 #define DEFINE_CSTATE_FORMAT_ATTR(_var, _name, _format)\
-static ssize_t __cstate_##_var##_show(struct kobject *kobj,\
-   struct kobj_attribute *attr,\
+static ssize_t __cstate_##_var##_show(struct device *dev,  \
+   struct device_attribute *attr,  \
char *page) \
 {  \
BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
return sprintf(page, _format "\n"); \
 }  \
-static struct kobj_attribute format_attr_##_var =  \
+static struct device_attribute format_attr_##_var =\
__ATTR(_name, 0444, __cstate_##_var##_show, NULL)
 
 static ssize_t cstate_get_attr_cpumask(struct device *dev,
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 86d012b3e0b4..80d52cbe2fde 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -94,8 +94,8 @@ struct pci2phy_map *__find_pci2phy_map(int segment)
return map;
 }
 
-ssize_t uncore_event_show(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf)
+ssize_t uncore_event_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
 {
struct uncore_event_desc *event =
container_of(attr, struct uncore_event_desc, attr);
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index 83d2a7d490e0..9efea154349d 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -157,7 +157,7 @@ struct intel_uncore_box {
 #define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2
 
 struct uncore_event_desc {
-   struct kobj_attribute attr;
+   struct device_attribute attr;
const char *config;
 };
 
@@ -179,8 +179,8 @@ struct pci2phy_map {
 struct pci2phy_map *__find_pci2phy_map(int segment);
 int uncore_pcibus_to_physid(struct pci_bus *bus);
 
-ssize_t uncore_event_show(struct kobject *kobj,
- struct kobj_attribute *attr, char *buf);
+ssize_t uncore_event_show(struct device *dev,
+ struct device_attribute *attr, char *buf);
 
 static inline struct intel_uncore_pmu *dev_to_uncore_pmu(struct device *dev)
 {
@@ -201,14 +201,14 @@ extern int __uncore_max_dies;
 }
 
 #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format)
\
-static ssize_t __uncore_##_var##_show(struct kobject *kobj,\
-   struct kobj_attribute *attr,\
+static ssize_t __uncore_##_var##_show(struct device *dev,  \
+   struct device_attribute *attr,  \
char *page) \
 {  \
BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \
return sprintf(page, _format "\n"); \
 }  \
-static struct kobj_attribute format_attr_##_var =  \
+static struct device_attribute format_attr_##_var =\
__ATTR(_name, 0444, __uncore_##_var##_show, NULL)
 
 static inline bool uncore_pmc_fixed(int idx)
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index 7c0120e2e957..7dbbeaacd995 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -93,18 +93,6 @@ static const char *const rapl_domain_names[NR_RAPL_DOMAINS] 
__initconst = {
  * any other bit is reserved
  */
 #define RAPL_EVENT_MASK0xFFULL
-
-#define DEFINE_RAPL_FORMAT_ATTR(_var, _name, _format)  \
-static ssize_t __rapl_##_var##_show(struct kobject *kobj,  \
-   struct kobj_attribute *attr,\
- 

Re: [PATCH 2/3] venus: Limit HFI sessions to the maximum supported

2020-11-22 Thread Stanimir Varbanov



On 11/21/20 3:14 AM, Fritz Koenig wrote:
> On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov
>  wrote:
>>
>> Currently we rely on firmware to return error when we reach the maximum
>> supported number of sessions. But this errors are happened at reqbuf
>> time which is a bit later. The more reasonable way looks like is to
>> return the error on driver open.
>>
>> To achieve that modify hfi_session_create to return error when we reach
>> maximum count of sessions and thus refuse open.
>>
>> Signed-off-by: Stanimir Varbanov 
>> ---
>>  drivers/media/platform/qcom/venus/core.h  |  1 +
>>  drivers/media/platform/qcom/venus/hfi.c   | 19 +++
>>  .../media/platform/qcom/venus/hfi_parser.c|  3 +++
>>  3 files changed, 19 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/core.h 
>> b/drivers/media/platform/qcom/venus/core.h
>> index db0e6738281e..3a477fcdd3a8 100644
>> --- a/drivers/media/platform/qcom/venus/core.h
>> +++ b/drivers/media/platform/qcom/venus/core.h
>> @@ -96,6 +96,7 @@ struct venus_format {
>>  #define MAX_CAP_ENTRIES32
>>  #define MAX_ALLOC_MODE_ENTRIES 16
>>  #define MAX_CODEC_NUM  32
>> +#define MAX_SESSIONS   16
>>
>>  struct raw_formats {
>> u32 buftype;
>> diff --git a/drivers/media/platform/qcom/venus/hfi.c 
>> b/drivers/media/platform/qcom/venus/hfi.c
>> index 638ed5cfe05e..8420be6d3991 100644
>> --- a/drivers/media/platform/qcom/venus/hfi.c
>> +++ b/drivers/media/platform/qcom/venus/hfi.c
>> @@ -175,6 +175,7 @@ static int wait_session_msg(struct venus_inst *inst)
>>  int hfi_session_create(struct venus_inst *inst, const struct hfi_inst_ops 
>> *ops)
>>  {
>> struct venus_core *core = inst->core;
>> +   int ret;
>>
>> if (!ops)
>> return -EINVAL;
>> @@ -183,12 +184,22 @@ int hfi_session_create(struct venus_inst *inst, const 
>> struct hfi_inst_ops *ops)
>> init_completion(>done);
>> inst->ops = ops;
>>
>> -   mutex_lock(>lock);
>> -   list_add_tail(>list, >instances);
>> -   atomic_inc(>insts_count);
>> +   ret = mutex_lock_interruptible(>lock);
>> +   if (ret)
>> +   return ret;
>> +
>> +   ret = atomic_read(>insts_count);
>> +   if (ret + 1 > core->max_sessions_supported) {
>> +   ret = -EAGAIN;
>> +   } else {
>> +   atomic_inc(>insts_count);
>> +   list_add_tail(>list, >instances);
>> +   ret = 0;
>> +   }
>> +
>> mutex_unlock(>lock);
>>
>> -   return 0;
>> +   return ret;
>>  }
>>  EXPORT_SYMBOL_GPL(hfi_session_create);
>>
>> diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c 
>> b/drivers/media/platform/qcom/venus/hfi_parser.c
>> index 363ee2a65453..52898633a8e6 100644
>> --- a/drivers/media/platform/qcom/venus/hfi_parser.c
>> +++ b/drivers/media/platform/qcom/venus/hfi_parser.c
>> @@ -276,6 +276,9 @@ u32 hfi_parser(struct venus_core *core, struct 
>> venus_inst *inst, void *buf,
>> words_count--;
>> }
>>
> 
> My understanding of the hardware is that there is a max number of
> macroblocks that can be worked on at a time.  That works out to
> nominally 16 clips.  But large clips can take more resources.  Does
> |max_sessions_supported| get updated with the amount that system can
> use?  Or is it always a constant?

The number of max sessions supported is constant.

> 
> If it changes depending on system load, then couldn't
> |core->max_sessions_supported| be 0 if all of the resources have been
> used up?  If that is the case then the below check would appear to be
> incorrect.

No, this is not the case. Changing dynamically the number of max
sessions depending on session load is possible but it would be complex
to implement. For example, think of decoder dynamic resolution change
where we don't know in advance the new resolution (session load).

> 
>> +   if (!core->max_sessions_supported)
>> +   core->max_sessions_supported = MAX_SESSIONS;
>> +
>> parser_fini(inst, codecs, domain);
>>
>> return HFI_ERR_NONE;
>> --
>> 2.17.1
>>

-- 
regards,
Stan


Re: [PATCH 3/3] media: hfi_venus: Request interrupt for sync cmds

2020-11-22 Thread Stanimir Varbanov



On 11/21/20 3:02 AM, Fritz Koenig wrote:
> On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov
>  wrote:
>>
>> From: Vikash Garodia 
>>
>> For synchronous commands, update the message queue variable.
>> This would inform video firmware to raise interrupt on host
>> CPU whenever there is a response for such commands.
>>
>> Signed-off-by: Vikash Garodia 
>> Signed-off-by: Stanimir Varbanov 
>> ---
>>  drivers/media/platform/qcom/venus/hfi_venus.c | 74 ++-
>>  1 file changed, 41 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c 
>> b/drivers/media/platform/qcom/venus/hfi_venus.c
>> index 4be4a75ddcb6..b8fdb464ba9c 100644
>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
>> @@ -372,7 +372,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)
>>  }
>>
>>  static int venus_iface_cmdq_write_nolock(struct venus_hfi_device *hdev,
>> -void *pkt)
>> +void *pkt, bool sync)
>>  {
>> struct device *dev = hdev->core->dev;
>> struct hfi_pkt_hdr *cmd_packet;
>> @@ -397,15 +397,23 @@ static int venus_iface_cmdq_write_nolock(struct 
>> venus_hfi_device *hdev,
>> if (rx_req)
>> venus_soft_int(hdev);
>>
>> +   /* Inform video firmware to raise interrupt for synchronous commands 
>> */
>> +   queue = >queues[IFACEQ_MSG_IDX];
> 
> I don't think there is any reason to scope queue outside of  the sync
> block below.

OK. I'll move into the 'if' statment.

> 
>>
>> +   if (sync) {
>> +   queue->qhdr->rx_req = 1;
>> +   /* ensure rx_req is updated in memory */
>> +   wmb();
>> +   }
>> +
>> return 0;
>>  }
>>


-- 
-- 
regards,
Stan


  1   2   3   4   5   >