Re: [PATCH rdma-next 01/10] RDMA: Add access flags to ib_alloc_mr() and ib_mr_pool_init()

2021-04-05 Thread Leon Romanovsky
On Tue, Apr 06, 2021 at 07:27:17AM +0200, Christoph Hellwig wrote:
> On Tue, Apr 06, 2021 at 08:23:28AM +0300, Leon Romanovsky wrote:
> > The same proposal (enable unconditionally) was raised during
> > submission preparations and we decided to follow same pattern
> > as other verbs objects which receive flag parameter.
> 
> A flags argument can be added when it actually is needed.  Using it
> to pass an argument enabled by all ULPs just gets us back to the bad
> old days of complete crap APIs someone drew up on a whiteboard.

Let's wait till Jason wakes up, before jumping to conclusions.
It was his request to update all ULPs.

> 
> I think we need to:
> 
>  a) document the semantics
>  b) sort out any technical concerns
>  c) just enable the damn thing

Sure

> 
> instead of requiring some form of cargo culting.


RE: [PATCH v6 2/2] ASoC: rt715:add micmute led state control supportspo...@protonmail.com

2021-04-05 Thread Yuan, Perry
Hi Jaroslav:


> -Original Message-
> From: Yuan, Perry 
> Sent: Sunday, April 4, 2021 4:32 PM
> To: po...@protonmail.com; pierre-louis.boss...@linux.intel.com;
> oder_ch...@realtek.com; pe...@perex.cz; ti...@suse.com;
> hdego...@redhat.com; mgr...@linux.intel.com; Limonciello, Mario
> Cc: lgirdw...@gmail.com; broo...@kernel.org; alsa-de...@alsa-project.org;
> linux-kernel@vger.kernel.org; platform-driver-...@vger.kernel.org; Yuan,
> Perry; mario.limoncie...@outlook.com; Dell Client Kernel
> Subject: [PATCH v6 2/2] ASoC: rt715:add micmute led state control supports
> 
> From: Perry Yuan 
> 
> Some new Dell system is going to support audio internal micphone privacy
> setting from hardware level with micmute led state changing When micmute
> hotkey pressed by user, soft mute will need to be enabled firstly in case of
> pop noise, and codec driver need to react to mic mute event to
> EC(embedded controller) notifying that SW mute is completed Then EC will
> do the hardware mute physically within the timeout reached
> 
> This patch allow codec rt715 and rt715 sdca driver to change the local
> micmute led state. Dell privacy led trigger driver will ack EC when micmute
> key pressed through this micphone led control interface like hda_generic
> provided ACPI method defined in dell-privacy micmute led trigger will be
> called for notifying the EC that software mute has been completed, then
> hardware audio circuit solution controlled by EC will switch the audio input
> source off/on
> 
> Signed-off-by: Perry Yuan 
> 
> 
> v5 -> v6:
> * addresed review comments from Jaroslav
> * add quirks for micmute led control as short term solution to control
>   micmute led state change
> v4 -> v5:
> * rebase to latest 5.12 rc4 upstream kernel
> v3 -> v4:
> * remove unused debug log
> * remove compile flag of DELL privacy
> * move the micmute_led to local from rt715_priv
> * when Jaroslav upstream his gerneric LED trigger driver,I will rebase
>   this patch,please consider merge this at first
>   https://lore.kernel.org/alsa-devel/2021021400.1131020-1-
> pe...@perex.cz/
> v2 -> v3:
> * simplify the patch to reuse some val value
> * add more detail to the commit info
> v1 -> v2:
> * fix some format issue
> 
> ---
>  sound/soc/codecs/rt715-sdca.c | 41
> ++-
>  sound/soc/codecs/rt715.c  | 41
> +++
>  2 files changed, 81 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
> index 20528afbdc57..7bd7ad0ba7d7 100644
> --- a/sound/soc/codecs/rt715-sdca.c
> +++ b/sound/soc/codecs/rt715-sdca.c
> @@ -11,12 +11,14 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -344,6 +346,34 @@ static int rt715_sdca_get_volsw(struct snd_kcontrol
> *kcontrol,
>   return 0;
>  }
> 
> +static bool micmute_led_set;
> +static int  dmi_matched(const struct dmi_system_id *dmi) {
> + micmute_led_set = 1;
> + return 1;
> +}
> +
> +/* Some systems will need to use this to trigger mic mute LED state
> +changed */ static const struct dmi_system_id micmute_led_dmi_table[] = {
> + {
> + .callback = dmi_matched,
> + .ident = "Dell Latitude 9420",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude
> 9420"),
> + },
> + },
> + {
> + .callback = dmi_matched,
> + .ident = "Dell Latitude 9520",
> + .matches = {
> + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
> + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude
> 9520"),
> + },
> + },
> + {},
> +};
> +
>  static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
>   struct snd_ctl_elem_value *ucontrol)
>  {
> @@ -358,6 +388,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol
> *kcontrol,
>   unsigned int mask = (1 << fls(max)) - 1;
>   unsigned int invert = p->invert;
>   int err;
> + bool micmute_led;
> 
>   for (i = 0; i < 4; i++) {
>   if (ucontrol->value.integer.value[i] != rt715-
> >kctl_switch_orig[i]) { @@ -393,7 +424,15 @@ static int
> rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
>   if (err < 0)
>   return err;
>   }
> -
> + /* Micmute LED state changed by muted/unmute switch */
> + dmi_check_system(micmute_led_dmi_table);
> + if (invert && micmute_led_set) {
> + if (ucontrol->value.integer.value[0] || ucontrol-
> >value.integer.value[1])
> + micmute_led = LED_OFF;
> + else
> + micmute_led = LED_ON;
> + ledtrig_audio_set(LED_AUDIO_MICMUTE, micmute_led);
> + }
>   return k_changed;
>  }
> 
> diff --git 

Re: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Can Guo

On 2021-04-06 13:37, Can Guo wrote:

Hi Daejun,

On 2021-04-06 12:11, Daejun Park wrote:

Hi Can Guo,


+static ssize_t monitor_enable_store(struct device *dev,
+struct device_attribute *attr,
+const char *buf, size_t count)
+{
+struct ufs_hba *hba = dev_get_drvdata(dev);
+unsigned long value, flags;
+
+if (kstrtoul(buf, 0, ))
+return -EINVAL;
+
+value = !!value;
+spin_lock_irqsave(hba->host->host_lock, flags);
+if (value == hba->monitor.enabled)
+goto out_unlock;
+
+if (!value) {
+memset(>monitor, 0, sizeof(hba->monitor));
+} else {
+hba->monitor.enabled = true;
+hba->monitor.enabled_ts = ktime_get();


How about setting lat_max to and lat_min to KTIME_MAX and 0?


lat_min is already 0. What is the benefit of setting lat_max to 
KTIME_MAX?



I think lat_sum should be 0 at this point.


lat_sum is already 0 at this point, what is the problem?




+}
+
+out_unlock:
+spin_unlock_irqrestore(hba->host->host_lock, flags);
+return count;
+}



+static void ufshcd_update_monitor(struct ufs_hba *hba, struct 
ufshcd_lrb *lrbp)

+{
+int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd);
+
+if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) {
+struct request *req = lrbp->cmd->request;
+struct ufs_hba_monitor *m = >monitor;
+ktime_t now, inc, lat;
+
+now = ktime_get();


How about using lrbp->compl_time_stamp instead of getting new value?


I am expecting "now" keeps increasing and use it to update 
m->busy_start_s,
but if I use lrbp->compl_time_stamp to do that, below line ktime_sub() 
may
give me an unexpected value as lrbp->compl_time_stamp may be smaller 
than
m->busy_start_ts, because the actual requests are not completed by the 
device
in the exact same ordering as the bits set in hba->outstanding_tasks, 
but driver

is completing them from bit 0 to bit 31 in ascending order.


Sorry, I missunderstood your point... Yes, we can use 
lrbp->compl_time_stamp.


Thanks,
Can Guo.






+inc = ktime_sub(now, m->busy_start_ts[dir]);
+m->total_busy[dir] = ktime_add(m->total_busy[dir], 
inc);

+m->nr_sec_rw[dir] += blk_rq_sectors(req);
+
+/* Update latencies */
+m->nr_req[dir]++;
+lat = ktime_sub(now, lrbp->issue_time_stamp);
+m->lat_sum[dir] += lat;
+if (m->lat_max[dir] < lat || !m->lat_max[dir])
+m->lat_max[dir] = lat;
+if (m->lat_min[dir] > lat || !m->lat_min[dir])
+m->lat_min[dir] = lat;


This if statement can be shorted, by setting lat_max / lat_min as 
default value.


I don't quite get it, can you show me the code sample?

Thanks,
Can Guo




+
+m->nr_queued[dir]--;
+/* Push forward the busy start of monitor */
+m->busy_start_ts[dir] = now;
+}
+}


Thanks,
Daejun


Re: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Can Guo

Hi Daejun,

On 2021-04-06 12:11, Daejun Park wrote:

Hi Can Guo,


+static ssize_t monitor_enable_store(struct device *dev,
+struct device_attribute *attr,
+const char *buf, size_t count)
+{
+struct ufs_hba *hba = dev_get_drvdata(dev);
+unsigned long value, flags;
+
+if (kstrtoul(buf, 0, ))
+return -EINVAL;
+
+value = !!value;
+spin_lock_irqsave(hba->host->host_lock, flags);
+if (value == hba->monitor.enabled)
+goto out_unlock;
+
+if (!value) {
+memset(>monitor, 0, sizeof(hba->monitor));
+} else {
+hba->monitor.enabled = true;
+hba->monitor.enabled_ts = ktime_get();


How about setting lat_max to and lat_min to KTIME_MAX and 0?


lat_min is already 0. What is the benefit of setting lat_max to 
KTIME_MAX?



I think lat_sum should be 0 at this point.


lat_sum is already 0 at this point, what is the problem?




+}
+
+out_unlock:
+spin_unlock_irqrestore(hba->host->host_lock, flags);
+return count;
+}



+static void ufshcd_update_monitor(struct ufs_hba *hba, struct 
ufshcd_lrb *lrbp)

+{
+int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd);
+
+if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) {
+struct request *req = lrbp->cmd->request;
+struct ufs_hba_monitor *m = >monitor;
+ktime_t now, inc, lat;
+
+now = ktime_get();


How about using lrbp->compl_time_stamp instead of getting new value?


I am expecting "now" keeps increasing and use it to update 
m->busy_start_s,
but if I use lrbp->compl_time_stamp to do that, below line ktime_sub() 
may
give me an unexpected value as lrbp->compl_time_stamp may be smaller 
than
m->busy_start_ts, because the actual requests are not completed by the 
device
in the exact same ordering as the bits set in hba->outstanding_tasks, 
but driver

is completing them from bit 0 to bit 31 in ascending order.




+inc = ktime_sub(now, m->busy_start_ts[dir]);
+m->total_busy[dir] = ktime_add(m->total_busy[dir], 
inc);

+m->nr_sec_rw[dir] += blk_rq_sectors(req);
+
+/* Update latencies */
+m->nr_req[dir]++;
+lat = ktime_sub(now, lrbp->issue_time_stamp);
+m->lat_sum[dir] += lat;
+if (m->lat_max[dir] < lat || !m->lat_max[dir])
+m->lat_max[dir] = lat;
+if (m->lat_min[dir] > lat || !m->lat_min[dir])
+m->lat_min[dir] = lat;


This if statement can be shorted, by setting lat_max / lat_min as 
default value.


I don't quite get it, can you show me the code sample?

Thanks,
Can Guo




+
+m->nr_queued[dir]--;
+/* Push forward the busy start of monitor */
+m->busy_start_ts[dir] = now;
+}
+}


Thanks,
Daejun


Re: [PATCH] Staging: rtl8192u: ieee80211: fixed a trailing statements of condition.

2021-04-05 Thread dev.dragon



On 4/5/21 1:15 PM, Greg KH wrote:
> On Sun, Apr 04, 2021 at 04:26:14PM +0300, dev.dra...@bk.ru wrote:
>> From: Dmitrii Wolf 
>>
>> Fixed a coding style issue.
> 
> Really?
> 
>>
>> Signed-off-by: Dmitrii Wolf 
>> ---
>>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 8 
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
>> b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
>> index 690b664df8fa..29a6ce20e2bd 100644
>> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
>> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
>> @@ -2048,12 +2048,12 @@ void ieee80211_softmac_xmit(struct ieee80211_txb 
>> *txb, struct ieee80211_device *
>>  /* if xmit available, just xmit it immediately, else just insert it to 
>> the wait queue */
>>  for (i = 0; i < txb->nr_frags; i++) {
>>  #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
>> -if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0) ||
>> +if ((skb_queue_len(>skb_drv_aggQ[queue_index]) != 0)
>>  #else
>> -if ((skb_queue_len(>skb_waitQ[queue_index]) != 0) ||
>> +if ((skb_queue_len(>skb_waitQ[queue_index]) != 0)
>>  #endif
>> -(!ieee->check_nic_enough_desc(ieee->dev, queue_index)) || \
>> -(ieee->queue_stop)) {
>> + || (!ieee->check_nic_enough_desc(ieee->dev, queue_index)) \
>> + || (ieee->queue_stop)) {
> 
> This feels really wrong.
Reread coding style - agree with you.
> 
> The || should be on the end of the line, why is checkpatch complaining
> about this?
Looks like it was confused by preprocessor directives - excluding it by 
comments gave me positive checkpatch respond.
> 
> And that '\' is not needed at all :(
Can i fix it in my next patch?:)
> 
> thanks,
> 
> greg k-h
> 


Re: [PATCH] tty: use printk_safe context at tty_msg()

2021-04-05 Thread Tetsuo Handa
On 2021/04/06 13:51, Jiri Slaby wrote:
> On 03. 04. 21, 6:14, Tetsuo Handa wrote:
>> --- a/include/linux/tty.h
>> +++ b/include/linux/tty.h
>> @@ -14,6 +14,7 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include <../../kernel/printk/internal.h>
> 
> Including printk's internal header in linux/tty.h doesn't look correct to me.
> 

This is because this patch wants __printk_safe_enter()/__printk_safe_exit()
without #ifdef'ing CONFIG_PRINTK.

Peter and Sergey, what should we do?
Can we move printk_safe_enter_irqsave()/printk_safe_exit_irqrestore() to 
include/linux/printk.h ?



LNX, non-synesthesia version - Re: Fair Pay can be generalized as a Non-Synesthesia project.

2021-04-05 Thread Ywe Cærlyn
And taking out the synesthesia of 'Linux' we get LNX Kernel, and instead 
fair pay orientation.


Serenity,
Ywe Cærlyn

Den 03.04.2021 11:33, skrev Ywe Cærlyn:
Summarizing my posts on LKML, Fair Pay can be generalized as a 
Non-Synesthesia project, compatible with the muslim Maruf not Munkar 
principles (translated best in Cursive), and Alla'.


We support all instances of such things.

My media project always actually was this: 
https://www.youtube.com/channel/UCBzmdh-pG3_OEqNRz5Owtmw


Serenity,
Ywe Cærlyn




[PATCH] power: supply: Fix missing IRQF_ONESHOT as only threaded handler

2021-04-05 Thread zhuguangqing83
From: Guangqing Zhu 

Coccinelle noticed:
 1. drivers/power/supply/pm2301_charger.c:1089:7-27: ERROR: Threaded IRQ
with no primary handler requested without IRQF_ONESHOT
 2. drivers/power/supply/tps65090-charger.c:303:8-33: ERROR: Threaded IRQ
with no primary handler requested without IRQF_ONESHOT
 3. drivers/power/supply/tps65217_charger.c:239:8-33: ERROR: Threaded IRQ
with no primary handler requested without IRQF_ONESHOT
 4. drivers/power/supply/lp8788-charger.c:502:8-28: ERROR: Threaded IRQ
with no primary handler requested without IRQF_ONESHOT

Signed-off-by: Guangqing Zhu 
---
 drivers/power/supply/lp8788-charger.c   | 2 +-
 drivers/power/supply/pm2301_charger.c   | 2 +-
 drivers/power/supply/tps65090-charger.c | 3 ++-
 drivers/power/supply/tps65217_charger.c | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/lp8788-charger.c 
b/drivers/power/supply/lp8788-charger.c
index e7931ffb7151..397e5a03b7d9 100644
--- a/drivers/power/supply/lp8788-charger.c
+++ b/drivers/power/supply/lp8788-charger.c
@@ -501,7 +501,7 @@ static int lp8788_set_irqs(struct platform_device *pdev,
 
ret = request_threaded_irq(virq, NULL,
lp8788_charger_irq_thread,
-   0, name, pchg);
+   IRQF_ONESHOT, name, pchg);
if (ret)
break;
}
diff --git a/drivers/power/supply/pm2301_charger.c 
b/drivers/power/supply/pm2301_charger.c
index ac06ecf7fc9c..a3bfb9612b17 100644
--- a/drivers/power/supply/pm2301_charger.c
+++ b/drivers/power/supply/pm2301_charger.c
@@ -1089,7 +1089,7 @@ static int pm2xxx_wall_charger_probe(struct i2c_client 
*i2c_client,
ret = request_threaded_irq(gpio_to_irq(pm2->pdata->gpio_irq_number),
NULL,
pm2xxx_charger_irq[0].isr,
-   pm2->pdata->irq_type,
+   pm2->pdata->irq_type | IRQF_ONESHOT,
pm2xxx_charger_irq[0].name, pm2);
 
if (ret != 0) {
diff --git a/drivers/power/supply/tps65090-charger.c 
b/drivers/power/supply/tps65090-charger.c
index 6b0098e5a88b..d55bcc341854 100644
--- a/drivers/power/supply/tps65090-charger.c
+++ b/drivers/power/supply/tps65090-charger.c
@@ -301,7 +301,8 @@ static int tps65090_charger_probe(struct platform_device 
*pdev)
 
if (irq != -ENXIO) {
ret = devm_request_threaded_irq(>dev, irq, NULL,
-   tps65090_charger_isr, 0, "tps65090-charger", cdata);
+   tps65090_charger_isr, IRQF_ONESHOT,
+   "tps65090-charger", cdata);
if (ret) {
dev_err(cdata->dev,
"Unable to register irq %d err %d\n", irq,
diff --git a/drivers/power/supply/tps65217_charger.c 
b/drivers/power/supply/tps65217_charger.c
index 814c2b81fdfe..cba3967ff275 100644
--- a/drivers/power/supply/tps65217_charger.c
+++ b/drivers/power/supply/tps65217_charger.c
@@ -238,8 +238,8 @@ static int tps65217_charger_probe(struct platform_device 
*pdev)
for (i = 0; i < NUM_CHARGER_IRQS; i++) {
ret = devm_request_threaded_irq(>dev, irq[i], NULL,
tps65217_charger_irq,
-   0, "tps65217-charger",
-   charger);
+   IRQF_ONESHOT,
+   "tps65217-charger", charger);
if (ret) {
dev_err(charger->dev,
"Unable to register irq %d err %d\n", irq[i],
-- 
2.17.1



Re: [PATCH rdma-next 01/10] RDMA: Add access flags to ib_alloc_mr() and ib_mr_pool_init()

2021-04-05 Thread Christoph Hellwig
On Tue, Apr 06, 2021 at 08:23:28AM +0300, Leon Romanovsky wrote:
> The same proposal (enable unconditionally) was raised during
> submission preparations and we decided to follow same pattern
> as other verbs objects which receive flag parameter.

A flags argument can be added when it actually is needed.  Using it
to pass an argument enabled by all ULPs just gets us back to the bad
old days of complete crap APIs someone drew up on a whiteboard.

I think we need to:

 a) document the semantics
 b) sort out any technical concerns
 c) just enable the damn thing

instead of requiring some form of cargo culting.


Re: [PATCH] usb: gadget: aspeed: Remove unnecessary version.h includes

2021-04-05 Thread Greg KH
On Tue, Apr 06, 2021 at 11:59:58AM +0800, Jiapeng Chong wrote:
> "make versioncheck" shows:
> 
> ./drivers/usb/gadget/udc/aspeed-vhub/hub.c: 33 linux/version.h not
> needed.

Then you need to fix the tool, and always test-build patches before you
send them out, as this is obviously wrong :(



Re: [PATCH rdma-next 01/10] RDMA: Add access flags to ib_alloc_mr() and ib_mr_pool_init()

2021-04-05 Thread Leon Romanovsky
On Mon, Apr 05, 2021 at 03:46:18PM +0200, Christoph Hellwig wrote:
> On Mon, Apr 05, 2021 at 08:23:55AM +0300, Leon Romanovsky wrote:
> > From: Avihai Horon 
> > 
> > Add access flags parameter to ib_alloc_mr() and to ib_mr_pool_init(),
> > and refactor relevant code. This parameter is used to pass MR access
> > flags during MR allocation.
> > 
> > In the following patches, the new access flags parameter will be used
> > to enable Relaxed Ordering for ib_alloc_mr() and ib_mr_pool_init() users.
> 
> So this weirds up a new RELAXED_ORDERING flag without ever mentioning
> that flag in the commit log, never mind what it actually does.

We will improve commit messages.

Thanks


Re: [PATCH rdma-next 01/10] RDMA: Add access flags to ib_alloc_mr() and ib_mr_pool_init()

2021-04-05 Thread Leon Romanovsky
On Mon, Apr 05, 2021 at 08:27:16AM -0700, Bart Van Assche wrote:
> On 4/4/21 10:23 PM, Leon Romanovsky wrote:
> > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> > index bed4cfe50554..59138174affa 100644
> > --- a/include/rdma/ib_verbs.h
> > +++ b/include/rdma/ib_verbs.h
> > @@ -2444,10 +2444,10 @@ struct ib_device_ops {
> >struct ib_udata *udata);
> > int (*dereg_mr)(struct ib_mr *mr, struct ib_udata *udata);
> > struct ib_mr *(*alloc_mr)(struct ib_pd *pd, enum ib_mr_type mr_type,
> > - u32 max_num_sg);
> > + u32 max_num_sg, u32 access);
> > struct ib_mr *(*alloc_mr_integrity)(struct ib_pd *pd,
> > u32 max_num_data_sg,
> > -   u32 max_num_meta_sg);
> > +   u32 max_num_meta_sg, u32 access);
> > int (*advise_mr)(struct ib_pd *pd,
> >  enum ib_uverbs_advise_mr_advice advice, u32 flags,
> >  struct ib_sge *sg_list, u32 num_sge,
> > @@ -4142,11 +4142,10 @@ static inline int ib_dereg_mr(struct ib_mr *mr)
> >  }
> >  
> >  struct ib_mr *ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
> > - u32 max_num_sg);
> > + u32 max_num_sg, u32 access);
> >  
> > -struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd,
> > -   u32 max_num_data_sg,
> > -   u32 max_num_meta_sg);
> > +struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd, u32 max_num_data_sg,
> > +   u32 max_num_meta_sg, u32 access);
> >  
> >  /**
> >   * ib_update_fast_reg_key - updates the key portion of the fast_reg MR
> > diff --git a/include/rdma/mr_pool.h b/include/rdma/mr_pool.h
> > index e77123bcb43b..2a0ee791037d 100644
> > --- a/include/rdma/mr_pool.h
> > +++ b/include/rdma/mr_pool.h
> > @@ -11,7 +11,8 @@ struct ib_mr *ib_mr_pool_get(struct ib_qp *qp, struct 
> > list_head *list);
> >  void ib_mr_pool_put(struct ib_qp *qp, struct list_head *list, struct ib_mr 
> > *mr);
> >  
> >  int ib_mr_pool_init(struct ib_qp *qp, struct list_head *list, int nr,
> > -   enum ib_mr_type type, u32 max_num_sg, u32 max_num_meta_sg);
> > +   enum ib_mr_type type, u32 max_num_sg, u32 max_num_meta_sg,
> > +   u32 access);
> >  void ib_mr_pool_destroy(struct ib_qp *qp, struct list_head *list);
> >  
> >  #endif /* _RDMA_MR_POOL_H */
> 
> Does the new 'access' argument only control whether or not PCIe relaxed
> ordering is enabled? It seems wrong to me to make enabling of PCIe
> relaxed ordering configurable. I think this mechanism should be enabled
> unconditionally if the HCA supports it.

The same proposal (enable unconditionally) was raised during
submission preparations and we decided to follow same pattern
as other verbs objects which receive flag parameter.

Thanks

> 
> Thanks,
> 
> Bart.


RE: [PATCH v7 06/11] scsi: ufshpb: Region inactivation in host mode

2021-04-05 Thread Avri Altman
> > -static void __ufshpb_evict_region(struct ufshpb_lu *hpb,
> > -   struct ufshpb_region *rgn)
> > +static int __ufshpb_evict_region(struct ufshpb_lu *hpb,
> > +  struct ufshpb_region *rgn)
> >  {
> >   struct victim_select_info *lru_info;
> >   struct ufshpb_subregion *srgn;
> >   int srgn_idx;
> >
> > + lockdep_assert_held(>rgn_state_lock);
> > +
> > + if (hpb->is_hcm) {
> > + unsigned long flags;
> > + int ret;
> > +
> > + spin_unlock_irqrestore(>rgn_state_lock, flags);
> 
> Never seen a usage like this... Here flags is used without being
> intialized.
> The flag is needed when spin_unlock_irqrestore ->
> local_irq_restore(flags) to
> restore the DAIF register (in terms of ARM).
OK.

Thanks,
Avri

> 
> Thanks,
> 
> Can Guo.
> 
> > + ret = ufshpb_issue_umap_single_req(hpb, rgn);
> > + spin_lock_irqsave(>rgn_state_lock, flags);
> > + if (ret)
> > + return ret;
> > + }
> > +
> >   lru_info = >lru_info;
> >
> >   dev_dbg(>sdev_ufs_lu->sdev_dev, "evict region %d\n",
> > rgn->rgn_idx);
> > @@ -1130,6 +1150,8 @@ static void __ufshpb_evict_region(struct
> > ufshpb_lu *hpb,
> >
> >   for_each_sub_region(rgn, srgn_idx, srgn)
> >   ufshpb_purge_active_subregion(hpb, srgn);
> > +
> > + return 0;
> >  }
> >
> >  static int ufshpb_evict_region(struct ufshpb_lu *hpb, struct
> > ufshpb_region *rgn)
> > @@ -1151,7 +1173,7 @@ static int ufshpb_evict_region(struct ufshpb_lu
> > *hpb, struct ufshpb_region *rgn)
> >   goto out;
> >   }
> >
> > - __ufshpb_evict_region(hpb, rgn);
> > + ret = __ufshpb_evict_region(hpb, rgn);
> >   }
> >  out:
> >   spin_unlock_irqrestore(>rgn_state_lock, flags);
> > @@ -1285,7 +1307,9 @@ static int ufshpb_add_region(struct ufshpb_lu
> > *hpb, struct ufshpb_region *rgn)
> >   "LRU full (%d), choose victim %d\n",
> >   atomic_read(_info->active_cnt),
> >   victim_rgn->rgn_idx);
> > - __ufshpb_evict_region(hpb, victim_rgn);
> > + ret = __ufshpb_evict_region(hpb, victim_rgn);
> > + if (ret)
> > + goto out;
> >   }
> >
> >   /*
> > @@ -1856,6 +1880,7 @@ ufshpb_sysfs_attr_show_func(rb_noti_cnt);
> >  ufshpb_sysfs_attr_show_func(rb_active_cnt);
> >  ufshpb_sysfs_attr_show_func(rb_inactive_cnt);
> >  ufshpb_sysfs_attr_show_func(map_req_cnt);
> > +ufshpb_sysfs_attr_show_func(umap_req_cnt);
> >
> >  static struct attribute *hpb_dev_stat_attrs[] = {
> >   _attr_hit_cnt.attr,
> > @@ -1864,6 +1889,7 @@ static struct attribute *hpb_dev_stat_attrs[] = {
> >   _attr_rb_active_cnt.attr,
> >   _attr_rb_inactive_cnt.attr,
> >   _attr_map_req_cnt.attr,
> > + _attr_umap_req_cnt.attr,
> >   NULL,
> >  };
> >
> > @@ -1988,6 +2014,7 @@ static void ufshpb_stat_init(struct ufshpb_lu
> > *hpb)
> >   hpb->stats.rb_active_cnt = 0;
> >   hpb->stats.rb_inactive_cnt = 0;
> >   hpb->stats.map_req_cnt = 0;
> > + hpb->stats.umap_req_cnt = 0;
> >  }
> >
> >  static void ufshpb_param_init(struct ufshpb_lu *hpb)
> > diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h
> > index 87495e59fcf1..1ea58c17a4de 100644
> > --- a/drivers/scsi/ufs/ufshpb.h
> > +++ b/drivers/scsi/ufs/ufshpb.h
> > @@ -191,6 +191,7 @@ struct ufshpb_stats {
> >   u64 rb_inactive_cnt;
> >   u64 map_req_cnt;
> >   u64 pre_req_cnt;
> > + u64 umap_req_cnt;
> >  };
> >
> >  struct ufshpb_lu {


linux-next: manual merge of the imx-drm tree with the drm tree

2021-04-05 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the imx-drm tree got a conflict in:

  drivers/gpu/drm/imx/ipuv3-plane.c

between commits:

  ba5c1649465d ("drm: Rename plane atomic_check state names")
  41016fe1028e ("drm: Rename plane->state variables in atomic update and 
disable")

from the drm tree and commit:

  49c826e1941a ("drm/imx: Add 8 pixel alignment fix")

from the imx-drm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/imx/ipuv3-plane.c
index fa5009705365,26f2cc832101..
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@@ -590,8 -618,8 +625,8 @@@ static void ipu_plane_atomic_update(str
if (ipu_state->use_pre) {
axi_id = ipu_chan_assign_axi_id(ipu_plane->dma);
ipu_prg_channel_configure(ipu_plane->ipu_ch, axi_id,
- drm_rect_width(_state->src) >> 16,
 -ipu_src_rect_width(state),
 -drm_rect_height(>src) >> 16,
++ipu_src_rect_width(new_state),
 +drm_rect_height(_state->src) >> 
16,
  fb->pitches[0], fb->format->format,
  fb->modifier, );
}
@@@ -623,10 -651,10 +658,10 @@@
break;
}
  
-   ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst));
+   ipu_dmfc_config_wait4eot(ipu_plane->dmfc, ALIGN(drm_rect_width(dst), 
8));
  
-   width = drm_rect_width(_state->src) >> 16;
 -  width = ipu_src_rect_width(state);
 -  height = drm_rect_height(>src) >> 16;
++  width = ipu_src_rect_width(new_state);
 +  height = drm_rect_height(_state->src) >> 16;
info = drm_format_info(fb->format->format);
ipu_calculate_bursts(width, info->cpp[0], fb->pitches[0],
 , _bursts);
@@@ -690,8 -717,8 +725,8 @@@
  
ipu_cpmem_zero(ipu_plane->alpha_ch);
ipu_cpmem_set_resolution(ipu_plane->alpha_ch,
-drm_rect_width(_state->src) >> 16,
 -   ipu_src_rect_width(state),
 -   drm_rect_height(>src) >> 16);
++   ipu_src_rect_width(new_state),
 +   drm_rect_height(_state->src) >> 
16);
ipu_cpmem_set_format_passthrough(ipu_plane->alpha_ch, 8);
ipu_cpmem_set_high_priority(ipu_plane->alpha_ch);
ipu_idmac_set_double_buffer(ipu_plane->alpha_ch, 1);


pgpyW_fYo_CxD.pgp
Description: OpenPGP digital signature


RE: [PATCH bpf-next 2/3] libbpf: selftests: refactor 'BPF_PERCPU_TYPE()' and 'bpf_percpu()' macros

2021-04-05 Thread John Fastabend
Pedro Tammela wrote:
> This macro was refactored out of the bpf selftests.
> 
> Since percpu values are rounded up to '8' in the kernel, a careless
> user in userspace might encounter unexpected values when parsing the
> output of the batched operations.
> 
> Now that both array and hash maps have support for batched ops in the
> percpu variant, let's provide a convenient macro to declare percpu map
> value types.
> 
> Updates the tests to a "reference" usage of the new macro.
> 
> Signed-off-by: Pedro Tammela 
> ---

Other than the initial patch needing a bit of description the series
looks good to me. Thanks.


Re: [PATCH v7] USB: serial: cp210x: Add support for GPIOs on CP2108

2021-04-05 Thread Greg KH
On Tue, Apr 06, 2021 at 11:02:38AM +0700, Pho Tran wrote:
> From: Pho Tran 
> 
> Similar to other CP210x devices, GPIO interfaces (gpiochip) should be
> supported for CP2108.
> 
> CP2108 has 4 serial interfaces but only 1 set of GPIO pins are shared
> to all of those interfaces. So, just need to initialize GPIOs of CP2108
> with only one interface (I use interface 0). It means just only 1 gpiochip
> device file will be created for CP2108.
> 
> CP2108 has 16 GPIOs, So data types of several variables need to be is u16
> instead of u8(in struct cp210x_serial_private). This doesn't affect other
> CP210x devices.
> 
> Because CP2108 has 16 GPIO pins, the parameter passed by cp210x functions
> will be different from other CP210x devices. So need to check part number
> of the device to use correct data format  before sending commands to
> devices.
> 
> Like CP2104, CP2108 have GPIO pins with configurable options. Therefore,
> should be mask all pins which are not in GPIO mode in cp2108_gpio_init()
> function.
> 
> Fix build test WARNING reported by kernel test robot.
> 
> Reported-by: Kernel test robot 

The kernel test robot did not report this needed support :(



Re: [PATCH v4 01/16] perf/x86/intel: Add x86_pmu.pebs_vmx for Ice Lake Servers

2021-04-05 Thread Xu, Like

Hi Xiangdong,

On 2021/4/6 11:24, Liuxiangdong (Aven, Cloud Infrastructure Service Product 
Dept.) wrote:

Hi,like.
Some questions about this new pebs patches set:
https://lore.kernel.org/kvm/20210329054137.120994-2-like...@linux.intel.com/

The new hardware facility supporting guest PEBS is only available
on Intel Ice Lake Server platforms for now.


Yes, we have documented this "EPT-friendly PEBS" capability in the SDM
18.3.10.1 Processor Event Based Sampling (PEBS) Facility

And again, this patch set doesn't officially support guest PEBS on the Skylake.




AFAIK, Icelake supports adaptive PEBS and extended PEBS which Skylake 
doesn't.
But we can still use IA32_PEBS_ENABLE MSR to indicate general-purpose 
counter in Skylake.


For Skylake, only the PMC0-PMC3 are valid for PEBS and you may
mask the other unsupported bits in the pmu->pebs_enable_mask.


Is there anything else that only Icelake supports in this patches set?


The PDIR counter on the Ice Lake is the fixed counter 0
while the PDIR counter on the Sky Lake is the gp counter 1.

You may also expose x86_pmu.pebs_vmx for Skylake in the 1st patch.




Besides, we have tried this patches set in Icelake.  We can use pebs(eg: 
"perf record -e cycles:pp")
when guest is kernel-5.11, but can't when kernel-4.18.  Is there a 
minimum guest kernel version requirement?


The Ice Lake CPU model has been added since v5.4.

You may double check whether the stable tree(s) code has
INTEL_FAM6_ICELAKE in the arch/x86/include/asm/intel-family.h.




Thanks,
Xiangdong Liu




Re: [PATCH rdma-next 00/10] Enable relaxed ordering for ULPs

2021-04-05 Thread Leon Romanovsky
On Mon, Apr 05, 2021 at 11:42:31PM +, Chuck Lever III wrote:
> 
> 
> > On Apr 5, 2021, at 4:07 PM, Jason Gunthorpe  wrote:
> > 
> > On Mon, Apr 05, 2021 at 03:41:15PM +0200, Christoph Hellwig wrote:
> >> On Mon, Apr 05, 2021 at 08:23:54AM +0300, Leon Romanovsky wrote:
> >>> From: Leon Romanovsky 
> >>> 
>  From Avihai,
> >>> 
> >>> Relaxed Ordering is a PCIe mechanism that relaxes the strict ordering
> >>> imposed on PCI transactions, and thus, can improve performance.
> >>> 
> >>> Until now, relaxed ordering could be set only by user space applications
> >>> for user MRs. The following patch series enables relaxed ordering for the
> >>> kernel ULPs as well. Relaxed ordering is an optional capability, and as
> >>> such, it is ignored by vendors that don't support it.
> >>> 
> >>> The following test results show the performance improvement achieved
> >>> with relaxed ordering. The test was performed on a NVIDIA A100 in order
> >>> to check performance of storage infrastructure over xprtrdma:
> >> 
> >> Isn't the Nvidia A100 a GPU not actually supported by Linux at all?
> >> What does that have to do with storage protocols?
> > 
> > I think it is a typo (or at least mit makes no sense to be talking
> > about NFS with a GPU chip) Probably it should be a DGX A100 which is a
> > dual socket AMD server with alot of PCIe, and xptrtrdma is a NFS-RDMA
> > workload.
> 
> We need to get a better idea what correctness testing has been done,
> and whether positive correctness testing results can be replicated
> on a variety of platforms.

I will ask to provide more details.

> 
> I have an old Haswell dual-socket system in my lab, but otherwise
> I'm not sure I have a platform that would be interesting for such a
> test.

We don't have such old systems too.

> 
> 
> > AMD dual socket systems are well known to benefit from relaxed
> > ordering, people have been doing this in userspace for a while now
> > with the opt in.
> 
> 
> --
> Chuck Lever
> 
> 
> 


[PATCH v1 3/4] drm/msm/disp/dpu1: add support to program fetch active in ctl path

2021-04-05 Thread Krishna Manikandan
A new register called CTL_FETCH_ACTIVE is introduced in
SC7280 family which is used to inform the HW about
the pipes which are active in the current ctl path.
This change adds support to program this register
based on the active pipes in the current composition.

Signed-off-by: Krishna Manikandan 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c   |  7 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 27 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h |  3 +++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 9607a76..4d2f7d7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -130,7 +130,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc 
*crtc,
uint32_t stage_idx, lm_idx;
int zpos_cnt[DPU_STAGE_MAX + 1] = { 0 };
bool bg_alpha_enable = false;
+   DECLARE_BITMAP(fetch_active, SSPP_MAX);
 
+   memset(fetch_active, 0, sizeof(fetch_active));
drm_atomic_crtc_for_each_plane(plane, crtc) {
state = plane->state;
if (!state)
@@ -140,7 +142,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc 
*crtc,
fb = state->fb;
 
dpu_plane_get_ctl_flush(plane, ctl, _mask);
-
+   set_bit(dpu_plane_pipe(plane), fetch_active);
DPU_DEBUG("crtc %d stage:%d - plane %d sspp %d fb %d\n",
crtc->base.id,
pstate->stage,
@@ -180,6 +182,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc 
*crtc,
}
}
 
+   if (ctl->ops.set_active_pipes)
+   ctl->ops.set_active_pipes(ctl, fetch_active);
+
 _dpu_crtc_program_lm_output_roi(crtc);
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
index 8981cfa..3cf489b 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
@@ -27,6 +27,7 @@
 #define   CTL_MERGE_3D_FLUSH0x100
 #define   CTL_INTF_FLUSH0x110
 #define   CTL_INTF_MASTER   0x134
+#define   CTL_FETCH_PIPE_ACTIVE 0x0FC
 
 #define CTL_MIXER_BORDER_OUTBIT(24)
 #define CTL_FLUSH_MASK_CTL  BIT(17)
@@ -34,6 +35,11 @@
 #define DPU_REG_RESET_TIMEOUT_US2000
 #define  MERGE_3D_IDX   23
 #define  INTF_IDX   31
+#define CTL_INVALID_BIT 0x
+
+static const u32 fetch_tbl[SSPP_MAX] = {CTL_INVALID_BIT, 16, 17, 18, 19,
+   CTL_INVALID_BIT, CTL_INVALID_BIT, CTL_INVALID_BIT, CTL_INVALID_BIT, 0,
+   1, 2, 3, CTL_INVALID_BIT, CTL_INVALID_BIT};
 
 static const struct dpu_ctl_cfg *_ctl_offset(enum dpu_ctl ctl,
const struct dpu_mdss_cfg *m,
@@ -344,6 +350,8 @@ static void dpu_hw_ctl_clear_all_blendstages(struct 
dpu_hw_ctl *ctx)
DPU_REG_WRITE(c, CTL_LAYER_EXT2(LM_0 + i), 0);
DPU_REG_WRITE(c, CTL_LAYER_EXT3(LM_0 + i), 0);
}
+
+   DPU_REG_WRITE(c, CTL_FETCH_PIPE_ACTIVE, 0);
 }
 
 static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx,
@@ -529,6 +537,23 @@ static void dpu_hw_ctl_intf_cfg(struct dpu_hw_ctl *ctx,
DPU_REG_WRITE(c, CTL_TOP, intf_cfg);
 }
 
+static void dpu_hw_ctl_set_fetch_pipe_active(struct dpu_hw_ctl *ctx,
+   unsigned long *fetch_active)
+{
+   int i;
+   u32 val = 0;
+
+   if (fetch_active) {
+   for (i = 0; i < SSPP_MAX; i++) {
+   if (test_bit(i, fetch_active) &&
+   fetch_tbl[i] != CTL_INVALID_BIT)
+   val |= BIT(fetch_tbl[i]);
+   }
+   }
+
+   DPU_REG_WRITE(>hw, CTL_FETCH_PIPE_ACTIVE, val);
+}
+
 static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
unsigned long cap)
 {
@@ -558,6 +583,8 @@ static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
ops->get_bitmask_sspp = dpu_hw_ctl_get_bitmask_sspp;
ops->get_bitmask_mixer = dpu_hw_ctl_get_bitmask_mixer;
ops->get_bitmask_dspp = dpu_hw_ctl_get_bitmask_dspp;
+   if (cap & BIT(DPU_CTL_FETCH_ACTIVE))
+   ops->set_active_pipes = dpu_hw_ctl_set_fetch_pipe_active;
 };
 
 static struct dpu_hw_blk_ops dpu_hw_ops;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h
index e93a42a..806c171 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h
@@ -167,6 +167,9 @@ struct dpu_hw_ctl_ops {
 */
void (*setup_blendstage)(struct dpu_hw_ctl *ctx,
enum dpu_lm lm, struct dpu_hw_stage_cfg *cfg);
+
+   void (*set_active_pipes)(struct dpu_hw_ctl *ctx,
+   unsigned long *fetch_active);
 };
 
 /**
-- 
2.7.4



[PATCH v1 1/4] drm/msm/disp/dpu1: add support for display for SC7280 target

2021-04-05 Thread Krishna Manikandan
Add required display hw catalog changes for SC7280 target.

Signed-off-by: Krishna Manikandan 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 176 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   8 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c   |   6 +-
 drivers/gpu/drm/msm/msm_drv.c  |   4 +-
 5 files changed, 177 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 189f353..ec27e6a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -43,6 +43,9 @@
 #define PINGPONG_SDM845_SPLIT_MASK \
(PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
 
+#define CTL_SC7280_MASK \
+   (BIT(DPU_CTL_ACTIVE_CFG) | BIT(DPU_CTL_FETCH_ACTIVE))
+
 #define MERGE_3D_SM8150_MASK (0)
 
 #define DSPP_SC7180_MASK BIT(DPU_DSPP_PCC)
@@ -51,6 +54,8 @@
 
 #define INTF_SC7180_MASK BIT(DPU_INTF_INPUT_CTRL) | BIT(DPU_INTF_TE)
 
+#define INTF_SC7280_MASK INTF_SC7180_MASK | BIT(DPU_DATA_HCTL_EN)
+
 #define DEFAULT_PIXEL_RAM_SIZE (50 * 1024)
 #define DEFAULT_DPU_LINE_WIDTH 2048
 #define DEFAULT_DPU_OUTPUT_LINE_WIDTH  2560
@@ -199,6 +204,18 @@ static const struct dpu_caps sm8250_dpu_caps = {
.pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
 };
 
+static const struct dpu_caps sc7280_dpu_caps = {
+   .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+   .max_mixer_blendstages = 0x7,
+   .qseed_type = DPU_SSPP_SCALER_QSEED4,
+   .smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
+   .ubwc_version = DPU_HW_UBWC_VER_30,
+   .has_dim_layer = true,
+   .has_idle_pc = true,
+   .max_linewidth = 2400,
+   .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
 static const struct dpu_mdp_cfg sdm845_mdp[] = {
{
.name = "top_0", .id = MDP_TOP,
@@ -268,6 +285,22 @@ static const struct dpu_mdp_cfg sm8250_mdp[] = {
},
 };
 
+static const struct dpu_mdp_cfg sc7280_mdp[] = {
+   {
+   .name = "top_0", .id = MDP_TOP,
+   .base = 0x0, .len = 0x2014,
+   .highest_bank_bit = 0x1,
+   .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
+   .reg_off = 0x2AC, .bit_off = 0},
+   .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
+   .reg_off = 0x2AC, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
+   .reg_off = 0x2B4, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
+   .reg_off = 0x2C4, .bit_off = 8},
+   },
+};
+
 /*
  * CTL sub blocks config
  */
@@ -350,6 +383,29 @@ static const struct dpu_ctl_cfg sm8150_ctl[] = {
},
 };
 
+static const struct dpu_ctl_cfg sc7280_ctl[] = {
+   {
+   .name = "ctl_0", .id = CTL_0,
+   .base = 0x15000, .len = 0x1E8,
+   .features = CTL_SC7280_MASK
+   },
+   {
+   .name = "ctl_1", .id = CTL_1,
+   .base = 0x16000, .len = 0x1E8,
+   .features = CTL_SC7280_MASK
+   },
+   {
+   .name = "ctl_2", .id = CTL_2,
+   .base = 0x17000, .len = 0x1E8,
+   .features = CTL_SC7280_MASK
+   },
+   {
+   .name = "ctl_3", .id = CTL_3,
+   .base = 0x18000, .len = 0x1E8,
+   .features = CTL_SC7280_MASK
+   },
+};
+
 /*
  * SSPP sub blocks config
  */
@@ -475,6 +531,17 @@ static const struct dpu_sspp_cfg sm8250_sspp[] = {
sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
 };
 
+static const struct dpu_sspp_cfg sc7280_sspp[] = {
+   SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SC7180_MASK,
+   sc7180_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
+   SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000,  DMA_SDM845_MASK,
+   sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
+   SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
+   SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
+};
+
 /*
  * MIXER sub blocks config
  */
@@ -550,6 +617,15 @@ static const struct dpu_lm_cfg sm8150_lm[] = {
_lm_sblk, PINGPONG_5, LM_4, 0),
 };
 
+static const struct dpu_lm_cfg sc7280_lm[] = {
+   LM_BLK("lm_0", LM_0, 0x44000, MIXER_SC7180_MASK,
+   _lm_sblk, PINGPONG_0, 0, 0),
+   LM_BLK("lm_2", LM_2, 0x46000, MIXER_SC7180_MASK,
+   _lm_sblk, PINGPONG_2, LM_3, 0),
+   LM_BLK("lm_3", LM_3, 0x47000, MIXER_SC7180_MASK,
+   _lm_sblk, PINGPONG_3, 

[PATCH v1 2/4] drm/msm/disp/dpu1: add intf offsets for SC7280 target

2021-04-05 Thread Krishna Manikandan
Interface block offsets are different for SC7280 family
when compared to existing targets. These offset values
are used to access the interface irq registers. This
change adds proper interface offsets for SC7280 target.

Signed-off-by: Krishna Manikandan 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
index 5c521de..c289b7e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
@@ -25,6 +25,9 @@
 #define MDP_AD4_INTR_EN_OFF0x41c
 #define MDP_AD4_INTR_CLEAR_OFF 0x424
 #define MDP_AD4_INTR_STATUS_OFF0x420
+#define MDP_INTF_0_OFF_REV_7xxx 0x34000
+#define MDP_INTF_1_OFF_REV_7xxx 0x35000
+#define MDP_INTF_5_OFF_REV_7xxx 0x39000
 
 /**
  * WB interrupt status bit definitions
@@ -242,7 +245,22 @@ static const struct dpu_intr_reg dpu_intr_set[] = {
MDP_AD4_1_OFF + MDP_AD4_INTR_CLEAR_OFF,
MDP_AD4_1_OFF + MDP_AD4_INTR_EN_OFF,
MDP_AD4_1_OFF + MDP_AD4_INTR_STATUS_OFF,
-   }
+   },
+   {
+   MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_CLEAR,
+   MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_EN,
+   MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_STATUS
+   },
+   {
+   MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_CLEAR,
+   MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_EN,
+   MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_STATUS
+   },
+   {
+   MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_CLEAR,
+   MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_EN,
+   MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_STATUS
+   },
 };
 
 /*
-- 
2.7.4



[PATCH v1 4/4] drm/msm/disp/dpu1: enable DATA_HCTL_EN for sc7280 target

2021-04-05 Thread Krishna Manikandan
The reset value of INTF_CONFIG2 register is changed
for SC7280 family. Changes are added to program
this register correctly based on the target.

DATA_HCTL_EN in INTF_CONFIG2 register allows data
to be transferred at a different rate than video
timing. When this is set, the number of data per
line follows DISPLAY_DATA_HCTL register value.
This change adds support to program these
registers for sc7280 target.

Signed-off-by: Krishna Manikandan 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 6f0f545..899f28d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -31,6 +31,8 @@
 #define INTF_TEST_CTL   0x054
 #define INTF_TP_COLOR0  0x058
 #define INTF_TP_COLOR1  0x05C
+#define INTF_CONFIG20x060
+#define INTF_DISPLAY_DATA_HCTL  0x064
 #define INTF_FRAME_LINE_COUNT_EN0x0A8
 #define INTF_FRAME_COUNT0x0AC
 #define   INTF_LINE_COUNT   0x0B0
@@ -93,7 +95,7 @@ static void dpu_hw_intf_setup_timing_engine(struct 
dpu_hw_intf *ctx,
u32 active_hctl, display_hctl, hsync_ctl;
u32 polarity_ctl, den_polarity, hsync_polarity, vsync_polarity;
u32 panel_format;
-   u32 intf_cfg;
+   u32 intf_cfg, intf_cfg2 = 0, display_data_hctl = 0;
 
/* read interface_cfg */
intf_cfg = DPU_REG_READ(c, INTF_CONFIG);
@@ -178,6 +180,13 @@ static void dpu_hw_intf_setup_timing_engine(struct 
dpu_hw_intf *ctx,
(COLOR_8BIT << 4) |
(0x21 << 8));
 
+   if (ctx->cap->features & BIT(DPU_DATA_HCTL_EN)) {
+   intf_cfg2 |= BIT(4);
+   display_data_hctl = display_hctl;
+   DPU_REG_WRITE(c, INTF_CONFIG2, intf_cfg2);
+   DPU_REG_WRITE(c, INTF_DISPLAY_DATA_HCTL, display_data_hctl);
+   }
+
DPU_REG_WRITE(c, INTF_HSYNC_CTL, hsync_ctl);
DPU_REG_WRITE(c, INTF_VSYNC_PERIOD_F0, vsync_period * hsync_period);
DPU_REG_WRITE(c, INTF_VSYNC_PULSE_WIDTH_F0,
-- 
2.7.4



[PATCH v1 0/4] Add display support for SC7280 target

2021-04-05 Thread Krishna Manikandan
The changes in this series adds all the required support for display driver for
SC7280 target. In addition to the basic catalog changes, changes are added to
accommodate new registers for SC7280 target.

SC7280 target comes under next generation targets. The register differences in
SC7280 when compared to SC7180 are mentioned below:

- SC7280 uses UBWC3.0 and changes are added to program the ubwc static
  registers properly

- Pingpong dither block offset value has changed for SC7280 family. 
Separate
  sub block is defined for sc7280 pingpong block and changes are added 
to
  handle this.

- Interface offsets are different for SC7280 family. These offset 
values are
  used to access the interface irq registers. Changes are added to 
handle
  this based on the target.

- A new register called CTL_FETCH_PIPE_ACTIVE is introduced in SC7280 
family,
  which tells the HW about the active pipes in the CTL path. Changes are
  added to program this register based on the active pipes in the
  current composition.

- Changes are added to program INTF_CONFIG2 properly since the reset 
value
  of this register has changed in SC7280 family and we need to 
explicitly program
  it with correct values to avoid wrong interface configuration.

- INTF_5 is added to intf configuration to support EDP.

Krishna Manikandan (4):
  drm/msm/disp/dpu1: add support for display for SC7280 target
  drm/msm/disp/dpu1: add intf offsets for SC7280 target
  drm/msm/disp/dpu1: add support to program fetch active in ctl path
  drm/msm/disp/dpu1: enable DATA_HCTL_EN for sc7280 target

 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c  |   7 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 176 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   8 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c|  27 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h|   3 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c |  20 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c   |  11 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c  |   6 +-
 drivers/gpu/drm/msm/msm_drv.c |   4 +-
 10 files changed, 242 insertions(+), 24 deletions(-)

-- 
2.7.4



Re: [PATCH rdma-next 00/10] Enable relaxed ordering for ULPs

2021-04-05 Thread Leon Romanovsky
On Tue, Apr 06, 2021 at 10:37:38AM +0800, Honggang LI wrote:
> On Mon, Apr 05, 2021 at 08:23:54AM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky 
> > 
> > From Avihai,
> > 
> > Relaxed Ordering is a PCIe mechanism that relaxes the strict ordering
> > imposed on PCI transactions, and thus, can improve performance.
> > 
> > Until now, relaxed ordering could be set only by user space applications
> > for user MRs. The following patch series enables relaxed ordering for the
> > kernel ULPs as well. Relaxed ordering is an optional capability, and as
> > such, it is ignored by vendors that don't support it.
> > 
> > The following test results show the performance improvement achieved
> 
> Did you test this patchset with CPU does not support relaxed ordering?

I don't think so, the CPUs that don't support RO are Intel's 
fourth/fifth-generation
and they are not interesting from performance point of view.

> 
> We observed significantly performance degradation when run perftest with
> relaxed ordering enabled over old CPU.
> 
> https://github.com/linux-rdma/perftest/issues/116

The perftest is slightly different, but you pointed to the valid point.
We forgot to call pcie_relaxed_ordering_enabled() before setting RO bit
and arguably this was needed to be done in perftest too.

Thanks

> 
> thanks
> 


Re: [PATCH 2/2] fs/epoll: restore waking from ep_done_scan()

2021-04-05 Thread Andrew Morton
On Mon, 5 Apr 2021 20:22:26 -0700 Davidlohr Bueso  wrote:

> On Mon, 05 Apr 2021, Andrew Morton wrote:
> 
> >Tricky.  339ddb53d373 was merged in December 2019.  So do we backport
> >this fix?  Could any userspace code be depending upon the
> >post-339ddb53d373 behavior?
> 
> As with previous trouble caused by this commit, I vote for restoring the 
> behavior
> backporting the fix, basically the equivalent of adding (which was my 
> intention):
> 
> Fixes: 339ddb53d373 ("fs/epoll: remove unnecessary wakeups of nested epoll")

OK, I added the Fixes: line and the cc:stable line.


Re: [PATCH linux-next v2 1/1] phy: Sparx5 Eth SerDes: Use direct register operations

2021-04-05 Thread Vinod Koul
On 29-03-21, 16:13, Steen Hegelund wrote:
> Use direct register operations instead of a table of register
> information to lower the stack usage.

Applied, thanks

-- 
~Vinod


Re: [PATCH v2] phy: hisilicon: Use the correct HiSilicon copyright

2021-04-05 Thread Vinod Koul
On 01-04-21, 20:02, Hao Fang wrote:
> s/Hisilicon/HiSilicon/g.
> It should use capital S, according to the official website.

Applied, thanks

-- 
~Vinod


Re: [PATCH -next] phy: marvell: phy-mvebu-cp11i-utmi needs USB_COMMON

2021-04-05 Thread Vinod Koul
On 01-04-21, 14:00, Randy Dunlap wrote:
> When USB and USB_COMMON are not enabled, phy-mvebu-cp110-utmi
> suffers a build error due to a missing interface that is provided
> by CONFIG_USB_COMMON, so make the driver depend on USB_COMMON.
> 
> ld: drivers/phy/marvell/phy-mvebu-cp110-utmi.o: in function 
> `mvebu_cp110_utmi_phy_probe':
> phy-mvebu-cp110-utmi.c:(.text+0x152): undefined reference to 
> `of_usb_get_dr_mode_by_phy'

Applied, thanks

-- 
~Vinod


[PATCH] parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers

2021-04-05 Thread Gao Xiang
From: Gao Xiang 

commit b344d6a83d01 ("parisc: add support for cmpxchg on u8 pointers")
can generate a sparse warningi ("cast truncates bits from constant
value"), which has been reported several times [1] [2] [3].

The original code worked as expected, but anyway, let silence such
sparse warning as what others did [4].

[1] https://lore.kernel.org/r/202104061220.nrmbwcxw-...@intel.com
[2] https://lore.kernel.org/r/202012291914.t5agcn99-...@intel.com
[3] https://lore.kernel.org/r/202008210829.kvwn7xeh%25...@intel.com
[4] https://lore.kernel.org/r/20210315131512.133720-2-jacopo+rene...@jmondi.org
Cc: Liam Beguin 
Cc: Helge Deller 
Signed-off-by: Gao Xiang 
---
 arch/parisc/include/asm/cmpxchg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/parisc/include/asm/cmpxchg.h 
b/arch/parisc/include/asm/cmpxchg.h
index cf5ee9b0b393..84ee232278a6 100644
--- a/arch/parisc/include/asm/cmpxchg.h
+++ b/arch/parisc/include/asm/cmpxchg.h
@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned 
long new_, int size)
 #endif
case 4: return __cmpxchg_u32((unsigned int *)ptr,
 (unsigned int)old, (unsigned int)new_);
-   case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
+   case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff);
}
__cmpxchg_called_with_bad_pointer();
return old;
-- 
2.20.1



[ACPI] 1a1c130ab7: BUG:kernel_NULL_pointer_dereference,address

2021-04-05 Thread kernel test robot


Greeting,

FYI, we noticed the following commit (built with gcc-9):

commit: 1a1c130ab7575498eed5bcf7220037ae09cd1f8a ("ACPI: tables: x86: Reserve 
memory occupied by ACPI tables")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master


in testcase: trinity
version: trinity-i386-4d2343bd-1_20200320
with following parameters:

number: 9
group: group-00

test-description: Trinity is a linux system call fuzz tester.
test-url: http://codemonkey.org.uk/projects/trinity/


on test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire 
log/backtrace):


+-+---++
| | v5.12-rc5 | 
1a1c130ab7 |
+-+---++
| boot_successes  | 16| 0   
   |
| BUG:kernel_NULL_pointer_dereference,address | 0 | 24  
   |
| Oops:#[##]  | 0 | 24  
   |
| EIP:get_pfnblock_flags_mask | 0 | 24  
   |
| Kernel_panic-not_syncing:Fatal_exception| 0 | 24  
   |
+-+---++


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


[0.136065] BUG: kernel NULL pointer dereference, address: 0004
[0.136596] #PF: supervisor read access in kernel mode
[0.137003] #PF: error_code(0x) - not-present page
[0.137431] *pde = 
[0.137671] Oops:  [#1]
[0.137908] CPU: 0 PID: 0 Comm: swapper Not tainted 
5.12.0-rc5-1-g1a1c130ab757 #2
[0.138567] EIP: get_pfnblock_flags_mask 
(kbuild/src/consumer/mm/page_alloc.c:490 
kbuild/src/consumer/mm/page_alloc.c:504) 
[ 0.138971] Code: 55 89 e5 83 ec 08 89 5d f8 89 cb 89 d1 89 75 fc c1 ea 0e c1 
e2 04 8b 82 84 77 95 c2 c1 e9 08 83 e1 3c 89 ce 83 e1 1f c1 ee 05 <8b> 04 b0 8b 
75 fc d3 e8 21 d8 8b 5d f8 89 ec 5d c3 e8 27 dc e4 ff
All code

   0:   55  push   %rbp
   1:   89 e5   mov%esp,%ebp
   3:   83 ec 08sub$0x8,%esp
   6:   89 5d f8mov%ebx,-0x8(%rbp)
   9:   89 cb   mov%ecx,%ebx
   b:   89 d1   mov%edx,%ecx
   d:   89 75 fcmov%esi,-0x4(%rbp)
  10:   c1 ea 0eshr$0xe,%edx
  13:   c1 e2 04shl$0x4,%edx
  16:   8b 82 84 77 95 c2   mov-0x3d6a887c(%rdx),%eax
  1c:   c1 e9 08shr$0x8,%ecx
  1f:   83 e1 3cand$0x3c,%ecx
  22:   89 ce   mov%ecx,%esi
  24:   83 e1 1fand$0x1f,%ecx
  27:   c1 ee 05shr$0x5,%esi
  2a:*  8b 04 b0mov(%rax,%rsi,4),%eax   <-- 
trapping instruction
  2d:   8b 75 fcmov-0x4(%rbp),%esi
  30:   d3 e8   shr%cl,%eax
  32:   21 d8   and%ebx,%eax
  34:   8b 5d f8mov-0x8(%rbp),%ebx
  37:   89 ec   mov%ebp,%esp
  39:   5d  pop%rbp
  3a:   c3  retq   
  3b:   e8 27 dc e4 ff  callq  0xffe4dc67

Code starting with the faulting instruction
===
   0:   8b 04 b0mov(%rax,%rsi,4),%eax
   3:   8b 75 fcmov-0x4(%rbp),%esi
   6:   d3 e8   shr%cl,%eax
   8:   21 d8   and%ebx,%eax
   a:   8b 5d f8mov-0x8(%rbp),%ebx
   d:   89 ec   mov%ebp,%esp
   f:   5d  pop%rbp
  10:   c3  retq   
  11:   e8 27 dc e4 ff  callq  0xffe4dc3d
[0.140504] EAX:  EBX: 0007 ECX: 001c EDX: 003faaa0
[0.141025] ESI: 0001 EDI:  EBP: c1c29e18 ESP: c1c29e10
[0.141544] DS: 007b ES: 007b FS:  GS:  SS: 0068 EFLAGS: 00210003
[0.142096] CR0: 80050033 CR2: 0004 CR3: 02226000 CR4: 00040690
[0.142620] DR0:  DR1:  DR2:  DR3: 
[0.143146] DR6: fffe0ff0 DR7: 0400
[0.143473] Call Trace:
[0.143698] __dump_page (kbuild/src/consumer/mm/debug.c:66) 
[0.143984] ? find_held_lock 
(kbuild/src/consumer/kernel/locking/lockdep.c:5003) 
[0.144300] ? _raw_spin_unlock 
(kbuild/src/consumer/kernel/locking/spinlock.c:184) 
[0.144633] ? console_unlock 
(kbuild/src/consumer/kernel/printk/printk.c:2561) 
[0.144960] ? __next_mem_range_rev (kbuild/src/consumer/mm/memblock.c:1106) 
[0.145339] ? memblock_insert_region+0x2a/0x45 
[0.145762] ? memblock_add_range+0x12d/0x137 
[0.146242] ? memblock_reserve 

Re: [PATCH v2] soundwire: intel_init: test link->cdns

2021-04-05 Thread Vinod Koul
On 06-04-21, 09:01, Bard Liao wrote:
> intel_link_probe() could return error and dev_get_drvdata() will return
> null in such case. So we have to test link->cdns after
> link->cdns = dev_get_drvdata(>auxdev.dev);
> Otherwise, we will meet the "kernel NULL pointer dereference" error.

Applied, thanks

-- 
~Vinod


Re: [PATCH] soundwire: qcom: handle return correctly in qcom_swrm_transport_params

2021-04-05 Thread Vinod Koul
On 01-04-21, 10:15, Srinivas Kandagatla wrote:
> Looks like return from reg_write is set but not checked.
> Fix this by adding error return path.

Applied, thanks

-- 
~Vinod


ERROR: modpost: "sba_list" [drivers/char/agp/parisc-agp.ko] undefined!

2021-04-05 Thread kernel test robot
Hi Helge,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0a50438c84363bd37fe18fe432888ae9a074dcab
commit: 00e35f2b0e8acb88d4e1aa96ff0490e3bfe46580 parisc: Enable -mlong-calls 
gcc option by default when !CONFIG_MODULES
date:   10 weeks ago
config: parisc-randconfig-r035-20210406 (attached as .config)
compiler: hppa64-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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=00e35f2b0e8acb88d4e1aa96ff0490e3bfe46580
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 00e35f2b0e8acb88d4e1aa96ff0490e3bfe46580
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=parisc 

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

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "sba_list" [drivers/char/agp/parisc-agp.ko] undefined!

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


.config.gz
Description: application/gzip


Re: [PATCH v2] soundwire: qcom: wait for fifo space to be available before read/write

2021-04-05 Thread Vinod Koul
On 01-04-21, 10:00, Srinivas Kandagatla wrote:
> If we write registers very fast we can endup in a situation where some
> of the writes will be dropped without any notice.
> 
> So wait for the fifo space to be available before reading/writing the
> soundwire registers.

Applied, thanks

-- 
~Vinod


Re: [PATCH 00/11] treewide: address gcc-11 -Wstringop-overread warnings

2021-04-05 Thread Martin K. Petersen
On Mon, 22 Mar 2021 17:02:38 +0100, Arnd Bergmann wrote:

> The coming gcc release introduces a new warning for string operations
> reading beyond the end of a fixed-length object. After testing
> randconfig kernels for a while, think I have patches for any such
> warnings that came up on x86, arm and arm64.
> 
> Most of these warnings are false-positive ones, either gcc warning
> about something that is entirely correct, or about something that
> looks suspicious but turns out to be correct after all.
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[09/11] scsi: lpfc: fix gcc -Wstringop-overread warning
https://git.kernel.org/mkp/scsi/c/ada48ba70f6b

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH][next] scsi: mptlan: Replace one-element array with flexible-array member

2021-04-05 Thread Martin K. Petersen
On Wed, 24 Mar 2021 18:33:44 -0500, Gustavo A. R. Silva wrote:

> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
> 
> Refactor the code according to the use of a flexible-array member in
> struct _SGE_TRANSACTION32 instead of one-element array.
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/1] scsi: mptlan: Replace one-element array with flexible-array member
  https://git.kernel.org/mkp/scsi/c/4e2e619f3c9e

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] soundwire: qcom: cleanup internal port config indexing

2021-04-05 Thread Vinod Koul
On 01-04-21, 10:24, Srinivas Kandagatla wrote:
> Internally used portconfig array for storing port bandwidth
> params starts from offset zero. However port zero is not really
> used and we also copy the bus parameters to offset zero.
> So basically we endup with a code which has to subtract 1 from port
> number to get to port parameters.
> 
> This is bit confusing to the reader so, make this bit more obvious by only
> copying the parameters to offset 1 instead of zero. This will avoid doing
> -1 every time when we try to get port params.
> 
> Similar thing has been recently done with din/dout_port_mask.

Applied, thanks

-- 
~Vinod


Re: [PATCH] scsi: fcoe: fix mismatched fcoe_wwn_from_mac declaration

2021-04-05 Thread Martin K. Petersen
On Mon, 22 Mar 2021 17:46:59 +0100, Arnd Bergmann wrote:

> An old cleanup changed the array size from MAX_ADDR_LEN to
> unspecified in the declaration, but now gcc-11 warns about this:
> 
> drivers/scsi/fcoe/fcoe_ctlr.c:1972:37: error: argument 1 of type ‘unsigned 
> char[32]’ with mismatched bound [-Werror=array-parameter=]
>  1972 | u64 fcoe_wwn_from_mac(unsigned char mac[MAX_ADDR_LEN],
>   |   ~~^
> In file included from /git/arm-soc/drivers/scsi/fcoe/fcoe_ctlr.c:33:
> include/scsi/libfcoe.h:252:37: note: previously declared as ‘unsigned char[]’
>   252 | u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned 
> int);
>   |   ~~^
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/1] scsi: fcoe: fix mismatched fcoe_wwn_from_mac declaration
  https://git.kernel.org/mkp/scsi/c/5b11c9d80bde

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH 1/2] aic94xx: avoid -Wempty-body warning

2021-04-05 Thread Martin K. Petersen
On Mon, 22 Mar 2021 11:25:43 +0100, Arnd Bergmann wrote:

> Building with 'make W=1' shows a harmless -Wempty-body warning:
> 
> drivers/scsi/aic94xx/aic94xx_init.c: In function 'asd_free_queues':
> drivers/scsi/aic94xx/aic94xx_init.c:858:62: error: suggest braces around 
> empty body in an 'if' statement [-Werror=empty-body]
>   858 | ASD_DPRINTK("Uh-oh! Pending is not empty!\n");
> 
> Change the empty ASD_DPRINTK() macro to no_printk(), which avoids this
> warning and adds format string checking.

Applied to 5.13/scsi-queue, thanks!

[1/2] aic94xx: avoid -Wempty-body warning
  https://git.kernel.org/mkp/scsi/c/6c26379def09
[2/2] scsi: message: fusion: avoid -Wempty-body warnings
  https://git.kernel.org/mkp/scsi/c/472c1cfb10f1

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] mvsas: avoid -Wempty-body warning

2021-04-05 Thread Martin K. Petersen
On Mon, 22 Mar 2021 11:33:09 +0100, Arnd Bergmann wrote:

> Building with 'make W=1' shows a few harmless -Wempty-body warning for
> the mvsas driver:
> 
> drivers/scsi/mvsas/mv_94xx.c: In function 'mvs_94xx_phy_reset':
> drivers/scsi/mvsas/mv_94xx.c:278:63: error: suggest braces around empty body 
> in an 'if' statement [-Werror=empty-body]
>   278 | mv_dprintk("phy hard reset failed.\n");
>   |   ^
> drivers/scsi/mvsas/mv_sas.c: In function 'mvs_task_prep':
> drivers/scsi/mvsas/mv_sas.c:723:57: error: suggest braces around empty body 
> in an 'else' statement [-Werror=empty-body]
>   723 | SAS_ADDR(dev->sas_addr));
>   | ^
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/1] mvsas: avoid -Wempty-body warning
  https://git.kernel.org/mkp/scsi/c/ae3645d29d4e

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH][next] SCSI: fusion: mpi_ioc.h: Replace one-element array with flexible-array member

2021-04-05 Thread Martin K. Petersen
On Wed, 24 Mar 2021 18:00:36 -0500, Gustavo A. R. Silva wrote:

> There is a regular need in the kernel to provide a way to declare having
> a dynamically sized set of trailing elements in a structure. Kernel code
> should always use “flexible array members”[1] for these cases. The older
> style of one-element or zero-length arrays should no longer be used[2].
> 
> Also, this helps with the ongoing efforts to enable -Warray-bounds by
> fixing the following warning:
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/1] SCSI: fusion: mpi_ioc.h: Replace one-element array with flexible-array 
member
  https://git.kernel.org/mkp/scsi/c/ed46ccc7fe76

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v7 06/11] scsi: ufshpb: Region inactivation in host mode

2021-04-05 Thread Can Guo

On 2021-03-31 15:39, Avri Altman wrote:

In host mode, the host is expected to send HPB-WRITE-BUFFER with
buffer-id = 0x1 when it inactivates a region.

Use the map-requests pool as there is no point in assigning a
designated cache for umap-requests.

Signed-off-by: Avri Altman 
---
 drivers/scsi/ufs/ufshpb.c | 35 +++
 drivers/scsi/ufs/ufshpb.h |  1 +
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshpb.c b/drivers/scsi/ufs/ufshpb.c
index aefb6dc160ee..fcc954f51bcf 100644
--- a/drivers/scsi/ufs/ufshpb.c
+++ b/drivers/scsi/ufs/ufshpb.c
@@ -914,6 +914,7 @@ static int ufshpb_execute_umap_req(struct ufshpb_lu 
*hpb,


blk_execute_rq_nowait(NULL, req, 1, ufshpb_umap_req_compl_fn);

+   hpb->stats.umap_req_cnt++;
return 0;
 }

@@ -1110,18 +,37 @@ static int ufshpb_issue_umap_req(struct 
ufshpb_lu *hpb,

return -EAGAIN;
 }

+static int ufshpb_issue_umap_single_req(struct ufshpb_lu *hpb,
+   struct ufshpb_region *rgn)
+{
+   return ufshpb_issue_umap_req(hpb, rgn);
+}
+
 static int ufshpb_issue_umap_all_req(struct ufshpb_lu *hpb)
 {
return ufshpb_issue_umap_req(hpb, NULL);
 }

-static void __ufshpb_evict_region(struct ufshpb_lu *hpb,
- struct ufshpb_region *rgn)
+static int __ufshpb_evict_region(struct ufshpb_lu *hpb,
+struct ufshpb_region *rgn)
 {
struct victim_select_info *lru_info;
struct ufshpb_subregion *srgn;
int srgn_idx;

+   lockdep_assert_held(>rgn_state_lock);
+
+   if (hpb->is_hcm) {
+   unsigned long flags;
+   int ret;
+
+   spin_unlock_irqrestore(>rgn_state_lock, flags);


Never seen a usage like this... Here flags is used without being 
intialized.
The flag is needed when spin_unlock_irqrestore -> 
local_irq_restore(flags) to

restore the DAIF register (in terms of ARM).

Thanks,

Can Guo.


+   ret = ufshpb_issue_umap_single_req(hpb, rgn);
+   spin_lock_irqsave(>rgn_state_lock, flags);
+   if (ret)
+   return ret;
+   }
+
lru_info = >lru_info;

 	dev_dbg(>sdev_ufs_lu->sdev_dev, "evict region %d\n", 
rgn->rgn_idx);
@@ -1130,6 +1150,8 @@ static void __ufshpb_evict_region(struct 
ufshpb_lu *hpb,


for_each_sub_region(rgn, srgn_idx, srgn)
ufshpb_purge_active_subregion(hpb, srgn);
+
+   return 0;
 }

 static int ufshpb_evict_region(struct ufshpb_lu *hpb, struct
ufshpb_region *rgn)
@@ -1151,7 +1173,7 @@ static int ufshpb_evict_region(struct ufshpb_lu
*hpb, struct ufshpb_region *rgn)
goto out;
}

-   __ufshpb_evict_region(hpb, rgn);
+   ret = __ufshpb_evict_region(hpb, rgn);
}
 out:
spin_unlock_irqrestore(>rgn_state_lock, flags);
@@ -1285,7 +1307,9 @@ static int ufshpb_add_region(struct ufshpb_lu
*hpb, struct ufshpb_region *rgn)
"LRU full (%d), choose victim %d\n",
atomic_read(_info->active_cnt),
victim_rgn->rgn_idx);
-   __ufshpb_evict_region(hpb, victim_rgn);
+   ret = __ufshpb_evict_region(hpb, victim_rgn);
+   if (ret)
+   goto out;
}

/*
@@ -1856,6 +1880,7 @@ ufshpb_sysfs_attr_show_func(rb_noti_cnt);
 ufshpb_sysfs_attr_show_func(rb_active_cnt);
 ufshpb_sysfs_attr_show_func(rb_inactive_cnt);
 ufshpb_sysfs_attr_show_func(map_req_cnt);
+ufshpb_sysfs_attr_show_func(umap_req_cnt);

 static struct attribute *hpb_dev_stat_attrs[] = {
_attr_hit_cnt.attr,
@@ -1864,6 +1889,7 @@ static struct attribute *hpb_dev_stat_attrs[] = {
_attr_rb_active_cnt.attr,
_attr_rb_inactive_cnt.attr,
_attr_map_req_cnt.attr,
+   _attr_umap_req_cnt.attr,
NULL,
 };

@@ -1988,6 +2014,7 @@ static void ufshpb_stat_init(struct ufshpb_lu 
*hpb)

hpb->stats.rb_active_cnt = 0;
hpb->stats.rb_inactive_cnt = 0;
hpb->stats.map_req_cnt = 0;
+   hpb->stats.umap_req_cnt = 0;
 }

 static void ufshpb_param_init(struct ufshpb_lu *hpb)
diff --git a/drivers/scsi/ufs/ufshpb.h b/drivers/scsi/ufs/ufshpb.h
index 87495e59fcf1..1ea58c17a4de 100644
--- a/drivers/scsi/ufs/ufshpb.h
+++ b/drivers/scsi/ufs/ufshpb.h
@@ -191,6 +191,7 @@ struct ufshpb_stats {
u64 rb_inactive_cnt;
u64 map_req_cnt;
u64 pre_req_cnt;
+   u64 umap_req_cnt;
 };

 struct ufshpb_lu {


Re: [PATCH -next] serial: 8250: Make symbol 'brcmuart_debugfs_root' static

2021-04-05 Thread Jiri Slaby

On 01. 04. 21, 9:49, Zucheng Zheng wrote:

symbol 'brcmuart_debugfs_root' is not used outside of 8250_bcm7271.c,
so this commit marks it static.

Signed-off-by: Zucheng Zheng 


Reviewed-by: Jiri Slaby 


---
  drivers/tty/serial/8250/8250_bcm7271.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c 
b/drivers/tty/serial/8250/8250_bcm7271.c
index 63883185fccd..ebba7f2e960c 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -239,7 +239,7 @@ struct brcmuart_priv {
u32 rx_abort;
  };
  
-struct dentry *brcmuart_debugfs_root;

+static struct dentry *brcmuart_debugfs_root;
  
  /*

   * Register access routines




--
js


Re: [PATCH] tty: use printk_safe context at tty_msg()

2021-04-05 Thread Jiri Slaby

On 03. 04. 21, 6:14, Tetsuo Handa wrote:

syzbot is reporting circular locking dependency due to calling printk()
with port lock held [1]. When this problem was reported, we worried
whether printk_safe context will remain available in future kernels [2],
and then this problem was forgotten. But in order to utilize syzbot's
resource for finding other bugs/reproducers by closing this one of top
crashers, let's apply a patch which counts on availability of printk_safe
context.

syzbot is also reporting same dependency due to memory allocation fault
injection at tty_buffer_alloc(). Although __GFP_NOWARN cannot prevent
memory allocation fault injection from calling printk(), let's use
__GFP_NOWARN at tty_buffer_alloc() in addition to using printk_safe
context, for generating many lines of messages due to warn_alloc() is
annoying. If we want to report it, we can use pr_warn() instead.

[1] 
https://syzkaller.appspot.com/bug?id=39ea6caa479af471183997376dc7e90bc7d64a6a
[2] https://lkml.kernel.org/r/20190218054649.GA26686@jagdpanzerIV

Reported-by: syzbot 
Reported-by: syzbot 
Signed-off-by: Tetsuo Handa 
Fixes: b6da31b2c07c46f2 ("tty: Fix data race in 
tty_insert_flip_string_fixed_flag")
Cc:  # 4.18+
---
  drivers/tty/tty_buffer.c | 5 -
  include/linux/tty.h  | 9 -
  2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index 6d4995a5f318..d59f7873bc49 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -156,6 +156,7 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port 
*port, size_t size)
  {
struct llist_node *free;
struct tty_buffer *p;
+   unsigned long flags;
  
  	/* Round the buffer size out */

size = __ALIGN_MASK(size, TTYB_ALIGN_MASK);
@@ -172,7 +173,9 @@ static struct tty_buffer *tty_buffer_alloc(struct tty_port 
*port, size_t size)
   have queued and recycle that ? */
if (atomic_read(>buf.mem_used) > port->buf.mem_limit)
return NULL;
-   p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
+   printk_safe_enter_irqsave(flags);
+   p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC | 
__GFP_NOWARN);
+   printk_safe_exit_irqrestore(flags);
if (p == NULL)
return NULL;
  
diff --git a/include/linux/tty.h b/include/linux/tty.h

index 95fc2f100f12..7ae8eb46fec3 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -14,6 +14,7 @@
  #include 
  #include 
  #include 
+#include <../../kernel/printk/internal.h>


Including printk's internal header in linux/tty.h doesn't look correct 
to me.



@@ -773,7 +774,13 @@ static inline void proc_tty_unregister_driver(struct 
tty_driver *d) {}
  #endif
  
  #define tty_msg(fn, tty, f, ...) \

-   fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), ##__VA_ARGS__)
+   do {\
+   unsigned long flags;\
+   \
+   printk_safe_enter_irqsave(flags);   \
+   fn("%s %s: " f, tty_driver_name(tty), tty_name(tty), 
##__VA_ARGS__); \
+   printk_safe_exit_irqrestore(flags); \
+   } while (0)
  
  #define tty_debug(tty, f, ...)	tty_msg(pr_debug, tty, f, ##__VA_ARGS__)

  #define tty_info(tty, f, ...) tty_msg(pr_info, tty, f, ##__VA_ARGS__)




--
js


[PATCH -next v2 1/2] mm/debug_vm_pgtable: Move {pmd/pud}_huge_tests out of CONFIG_TRANSPARENT_HUGEPAGE

2021-04-05 Thread Shixin Liu
v1->v2:
Modified the commit message.

The functions {pmd/pud}_set_huge and {pmd/pud}_clear_huge ars not dependent on 
THP.

Signed-off-by: Shixin Liu 
---
 mm/debug_vm_pgtable.c | 91 +++
 1 file changed, 39 insertions(+), 52 deletions(-)

diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index 05efe98a9ac2..d3cf178621d9 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -242,29 +242,6 @@ static void __init pmd_leaf_tests(unsigned long pfn, 
pgprot_t prot)
WARN_ON(!pmd_leaf(pmd));
 }
 
-#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
-static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t 
prot)
-{
-   pmd_t pmd;
-
-   if (!arch_vmap_pmd_supported(prot))
-   return;
-
-   pr_debug("Validating PMD huge\n");
-   /*
-* X86 defined pmd_set_huge() verifies that the given
-* PMD is not a populated non-leaf entry.
-*/
-   WRITE_ONCE(*pmdp, __pmd(0));
-   WARN_ON(!pmd_set_huge(pmdp, __pfn_to_phys(pfn), prot));
-   WARN_ON(!pmd_clear_huge(pmdp));
-   pmd = READ_ONCE(*pmdp);
-   WARN_ON(!pmd_none(pmd));
-}
-#else /* CONFIG_HAVE_ARCH_HUGE_VMAP */
-static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t 
prot) { }
-#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
-
 static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot)
 {
pmd_t pmd = pfn_pmd(pfn, prot);
@@ -379,30 +356,6 @@ static void __init pud_leaf_tests(unsigned long pfn, 
pgprot_t prot)
pud = pud_mkhuge(pud);
WARN_ON(!pud_leaf(pud));
 }
-
-#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
-static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t 
prot)
-{
-   pud_t pud;
-
-   if (!arch_vmap_pud_supported(prot))
-   return;
-
-   pr_debug("Validating PUD huge\n");
-   /*
-* X86 defined pud_set_huge() verifies that the given
-* PUD is not a populated non-leaf entry.
-*/
-   WRITE_ONCE(*pudp, __pud(0));
-   WARN_ON(!pud_set_huge(pudp, __pfn_to_phys(pfn), prot));
-   WARN_ON(!pud_clear_huge(pudp));
-   pud = READ_ONCE(*pudp);
-   WARN_ON(!pud_none(pud));
-}
-#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
-static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t 
prot) { }
-#endif /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
-
 #else  /* !CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 static void __init pud_basic_tests(struct mm_struct *mm, unsigned long pfn, 
int idx) { }
 static void __init pud_advanced_tests(struct mm_struct *mm,
@@ -412,9 +365,6 @@ static void __init pud_advanced_tests(struct mm_struct *mm,
 {
 }
 static void __init pud_leaf_tests(unsigned long pfn, pgprot_t prot) { }
-static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t 
prot)
-{
-}
 #endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
 #else  /* !CONFIG_TRANSPARENT_HUGEPAGE */
 static void __init pmd_basic_tests(unsigned long pfn, int idx) { }
@@ -433,14 +383,51 @@ static void __init pud_advanced_tests(struct mm_struct 
*mm,
 }
 static void __init pmd_leaf_tests(unsigned long pfn, pgprot_t prot) { }
 static void __init pud_leaf_tests(unsigned long pfn, pgprot_t prot) { }
+static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) { }
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+
+#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
 static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t 
prot)
 {
+   pmd_t pmd;
+
+   if (!arch_vmap_pmd_supported(prot))
+   return;
+
+   pr_debug("Validating PMD huge\n");
+   /*
+* X86 defined pmd_set_huge() verifies that the given
+* PMD is not a populated non-leaf entry.
+*/
+   WRITE_ONCE(*pmdp, __pmd(0));
+   WARN_ON(!pmd_set_huge(pmdp, __pfn_to_phys(pfn), prot));
+   WARN_ON(!pmd_clear_huge(pmdp));
+   pmd = READ_ONCE(*pmdp);
+   WARN_ON(!pmd_none(pmd));
 }
+
 static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t 
prot)
 {
+   pud_t pud;
+
+   if (!arch_vmap_pud_supported(prot))
+   return;
+
+   pr_debug("Validating PUD huge\n");
+   /*
+* X86 defined pud_set_huge() verifies that the given
+* PUD is not a populated non-leaf entry.
+*/
+   WRITE_ONCE(*pudp, __pud(0));
+   WARN_ON(!pud_set_huge(pudp, __pfn_to_phys(pfn), prot));
+   WARN_ON(!pud_clear_huge(pudp));
+   pud = READ_ONCE(*pudp);
+   WARN_ON(!pud_none(pud));
 }
-static void __init pmd_savedwrite_tests(unsigned long pfn, pgprot_t prot) { }
-#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+#else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
+static void __init pmd_huge_tests(pmd_t *pmdp, unsigned long pfn, pgprot_t 
prot) { }
+static void __init pud_huge_tests(pud_t *pudp, unsigned long pfn, pgprot_t 
prot) { }
+#endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
 
 static void __init p4d_basic_tests(unsigned long pfn, pgprot_t prot)
 {
-- 
2.25.1



[PATCH -next v2 2/2] mm/debug_vm_pgtable: Remove redundant pfn_{pmd/pte}() and fix one comment mistake

2021-04-05 Thread Shixin Liu
v1->v2:
Remove redundant pfn_pte() and fold two patch to one.

Remove redundant pfn_{pmd/pte}() and fix one comment mistake.

Signed-off-by: Shixin Liu 
---
 mm/debug_vm_pgtable.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
index d3cf178621d9..e2f35db8ba69 100644
--- a/mm/debug_vm_pgtable.c
+++ b/mm/debug_vm_pgtable.c
@@ -91,7 +91,7 @@ static void __init pte_advanced_tests(struct mm_struct *mm,
  unsigned long pfn, unsigned long vaddr,
  pgprot_t prot)
 {
-   pte_t pte = pfn_pte(pfn, prot);
+   pte_t pte;
 
/*
 * Architectures optimize set_pte_at by avoiding TLB flush.
@@ -185,7 +185,7 @@ static void __init pmd_advanced_tests(struct mm_struct *mm,
  unsigned long pfn, unsigned long vaddr,
  pgprot_t prot, pgtable_t pgtable)
 {
-   pmd_t pmd = pfn_pmd(pfn, prot);
+   pmd_t pmd;
 
if (!has_transparent_hugepage())
return;
@@ -300,7 +300,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm,
  unsigned long pfn, unsigned long vaddr,
  pgprot_t prot)
 {
-   pud_t pud = pfn_pud(pfn, prot);
+   pud_t pud;
 
if (!has_transparent_hugepage())
return;
@@ -309,6 +309,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm,
/* Align the address wrt HPAGE_PUD_SIZE */
vaddr = (vaddr & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE;
 
+   pud = pfn_pud(pfn, prot);
set_pud_at(mm, vaddr, pudp, pud);
pudp_set_wrprotect(mm, vaddr, pudp);
pud = READ_ONCE(*pudp);
@@ -742,12 +743,12 @@ static void __init pmd_swap_soft_dirty_tests(unsigned 
long pfn, pgprot_t prot)
WARN_ON(!pmd_swp_soft_dirty(pmd_swp_mksoft_dirty(pmd)));
WARN_ON(pmd_swp_soft_dirty(pmd_swp_clear_soft_dirty(pmd)));
 }
-#else  /* !CONFIG_ARCH_HAS_PTE_DEVMAP */
+#else  /* !CONFIG_TRANSPARENT_HUGEPAGE */
 static void __init pmd_soft_dirty_tests(unsigned long pfn, pgprot_t prot) { }
 static void __init pmd_swap_soft_dirty_tests(unsigned long pfn, pgprot_t prot)
 {
 }
-#endif /* CONFIG_ARCH_HAS_PTE_DEVMAP */
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 
 static void __init pte_swap_tests(unsigned long pfn, pgprot_t prot)
 {
-- 
2.25.1



Re: [PATCH net-next v4 0/4] usbnet: speed reporting for devices without MDIO

2021-04-05 Thread Grant Grundler
On Tue, Apr 6, 2021 at 12:09 AM Andrew Lunn  wrote:
>
> On Mon, Apr 05, 2021 at 04:13:40PM -0700, Grant Grundler wrote:
> > This series introduces support for USB network devices that report
> > speed as a part of their protocol, not emulating an MII to be accessed
> > over MDIO.
> >
> > v2: rebased on recent upstream changes
> > v3: incorporated hints on naming and comments
> > v4: fix misplaced hunks; reword some commit messages;
> > add same change for cdc_ether
> > v4-repost: added "net-next" to subject and Andrew Lunn's Reviewed-by
> >
> > I'm reposting Oliver Neukum's  patch series with
> > fix ups for "misplaced hunks" (landed in the wrong patches).
> > Please fixup the "author" if "git am" fails to attribute the
> > patches 1-3 (of 4) to Oliver.
> >
> > I've tested v4 series with "5.12-rc3+" kernel on Intel NUC6i5SYB
> > and + Sabrent NT-S25G. Google Pixelbook Go (chromeos-4.4 kernel)
> > + Alpha Network AUE2500C were connected directly to the NT-S25G
> > to get 2.5Gbps link rate:
> > # ethtool enx002427880815
> > Settings for enx002427880815:
> > Supported ports: [  ]
> > Supported link modes:   Not reported
> > Supported pause frame use: No
> > Supports auto-negotiation: No
> > Supported FEC modes: Not reported
> > Advertised link modes:  Not reported
> > Advertised pause frame use: No
> > Advertised auto-negotiation: No
> > Advertised FEC modes: Not reported
> > Speed: 2500Mb/s
> > Duplex: Half
> > Auto-negotiation: off
> > Port: Twisted Pair
> > PHYAD: 0
> > Transceiver: internal
> > MDI-X: Unknown
> > Current message level: 0x0007 (7)
> >drv probe link
> > Link detected: yes
> >
> >
> > "Duplex" is a lie since we get no information about it.
>
> You can ask the PHY. At least those using mii or phylib.  If you are
> using mii, then mii_ethtool_get_link_ksettings() should set it
> correctly. If you are using phylib, phy_ethtool_get_link_ksettings()
> will correctly set it. If you are not using either of these, you are
> on your own.
>
> Speed: 2500Mb/s and Duplex: Half is very unlikely. You really only
> ever see 10 Half and occasionally 100 Half. Anything above that will
> be full duplex.
>
> It is probably best to admit the truth and use DUPLEX_UNKNOWN.

Agreed. I didn't notice this "lie" until I was writing the commit
message and wasn't sure off-hand how to fix it. Decided a follow on
patch could fix it up once this series lands.

You are right that DUPLEX_UNKNOWN is the safest (and usually correct) default.
Additionally, if RX and TX speed are equal, I am willing to assume
this is DUPLEX_FULL.
I can propose something like this in a patch:

grundler <1637>git diff
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 86eb1d107433..a7ad9a0fb6ae 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -978,6 +978,11 @@ int usbnet_get_link_ksettings_internal(struct
net_device *net,
else
cmd->base.speed = SPEED_UNKNOWN;

+   if (dev->rx_speed == dev->tx_speed)
+   cmd->base.duplex = DUPLEX_FULL;
+   else
+   cmd->base.duplex =DUPLEX_UNKNOWN;
+
return 0;
 }
 EXPORT_SYMBOL_GPL(usbnet_get_link_ksettings_internal);

Probably should check that link speed is > 100Mbps to be more certain
about this assumption (based on your comments above).

I can send this out later once this series lands or you are welcome to
post this with additional checks if you like.

The messy case is when RX != TX speed and I didn't want to delay
landing the current series to figure out DUPLEX.

> > I expect "Auto-Negotiation" is always true for cdc_ncm and
> > cdc_ether devices and perhaps someone knows offhand how
> > to have ethtool report "true" instead.
>
> ethtool_link_ksettings contains three bitmaps:
>
> supported: The capabilities of this device.
> advertising: What this device is telling the link peer it can do.
> lp_advertising: What the link peer is telling us it can do.
>
> So to get Supports auto-negotiation to be true you need to set bit
> ETHTOOL_LINK_MODE_Autoneg_BIT in supported.
> For Advertised auto-negotiation: you need to set the same bit in
> advertising.
>
> Auto-negotiation: off is i think from base.autoneg.

Thanks for explaining! :)  I understand the three bitmaps. I just
hadn't taken the time to figure out how to access/set those from
link_ksettings API.

If we want to assume autoneg is always on (regardless of which type of
media cdc_ncm/cdc_ether are talking to), we could set both supported
and advertising to AUTO and lp_advertising to UNKNOWN. But I would
prefer to add more checks to prove this is correct (vs making "well
intentioned" assumptions).

cheers,
grant


Re: [PATCH 04/10] tty: tty_jobctrl: Fix coding style issues of block comments

2021-04-05 Thread Jiri Slaby

On 05. 04. 21, 5:34, Xiaofei Tan wrote:

Fix coding style issues of block comments, reported by checkpatch.pl.

Signed-off-by: Xiaofei Tan 
---
  drivers/tty/tty_jobctrl.c | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
index 86070f7..4d78422 100644
--- a/drivers/tty/tty_jobctrl.c
+++ b/drivers/tty/tty_jobctrl.c
@@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct *tty, int 
exit_session)
spin_lock_irq(>sighand->siglock);
if (p->signal->tty == tty) {
p->signal->tty = NULL;
-   /* We defer the dereferences outside fo
-  the tasklist lock */
+   /*
+* We defer the dereferences outside fo
+* the tasklist lock


I don't know if it deserves its own patch, but fo -> of fix would be 
nice. And add a period at the end of the sentence.



+*/
refs++;
}
if (!p->signal->leader) {
@@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit)
   */
  void no_tty(void)
  {
-   /* FIXME: Review locking here. The tty_lock never covered any race
-  between a new association and proc_clear_tty but possible we need
-  to protect against this anyway */
+   /*
+* FIXME: Review locking here. The tty_lock never covered any race
+* between a new association and proc_clear_tty but possible we need


"possibly" or "it's possible", I think (as a non-native).


+* to protect against this anyway


Period.


+*/
struct task_struct *tsk = current;
  
  	disassociate_ctty(0);

@@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct 
tty_struct *real_tty, pid_t _
/*
 * (tty == real_tty) is a cheap way of
 * testing if the tty is NOT a master pty.
-   */
+*/
if (tty == real_tty && current->signal->tty != real_tty)
return -ENOTTY;
  




--
js


RE: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs nodes

2021-04-05 Thread Daejun Park
Hi Can Guo,

> +static ssize_t monitor_enable_store(struct device *dev,
> +struct device_attribute *attr,
> +const char *buf, size_t count)
> +{
> +struct ufs_hba *hba = dev_get_drvdata(dev);
> +unsigned long value, flags;
> +
> +if (kstrtoul(buf, 0, ))
> +return -EINVAL;
> +
> +value = !!value;
> +spin_lock_irqsave(hba->host->host_lock, flags);
> +if (value == hba->monitor.enabled)
> +goto out_unlock;
> +
> +if (!value) {
> +memset(>monitor, 0, sizeof(hba->monitor));
> +} else {
> +hba->monitor.enabled = true;
> +hba->monitor.enabled_ts = ktime_get();

How about setting lat_max to and lat_min to KTIME_MAX and 0?
I think lat_sum should be 0 at this point.

> +}
> +
> +out_unlock:
> +spin_unlock_irqrestore(hba->host->host_lock, flags);
> +return count;
> +}


> +static void ufshcd_update_monitor(struct ufs_hba *hba, struct ufshcd_lrb 
> *lrbp)
> +{
> +int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd);
> +
> +if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) {
> +struct request *req = lrbp->cmd->request;
> +struct ufs_hba_monitor *m = >monitor;
> +ktime_t now, inc, lat;
> +
> +now = ktime_get();

How about using lrbp->compl_time_stamp instead of getting new value?

> +inc = ktime_sub(now, m->busy_start_ts[dir]);
> +m->total_busy[dir] = ktime_add(m->total_busy[dir], inc);
> +m->nr_sec_rw[dir] += blk_rq_sectors(req);
> +
> +/* Update latencies */
> +m->nr_req[dir]++;
> +lat = ktime_sub(now, lrbp->issue_time_stamp);
> +m->lat_sum[dir] += lat;
> +if (m->lat_max[dir] < lat || !m->lat_max[dir])
> +m->lat_max[dir] = lat;
> +if (m->lat_min[dir] > lat || !m->lat_min[dir])
> +m->lat_min[dir] = lat;

This if statement can be shorted, by setting lat_max / lat_min as default value.

> +
> +m->nr_queued[dir]--;
> +/* Push forward the busy start of monitor */
> +m->busy_start_ts[dir] = now;
> +}
> +}

Thanks,
Daejun


Re: [PATCH V4 XRT Alveo 02/20] fpga: xrt: driver metadata helper functions

2021-04-05 Thread Lizhi Hou

Hi Tom,


On 03/28/2021 08:30 AM, Tom Rix wrote:

Do not reorder function definitions, this makes comparing changes from the 
previous patchset difficult.

A general issue with returning consistent error codes.  There are several cases 
where fdt_* code are not translated.

Sure. Will fix.


On 3/23/21 10:29 PM, Lizhi Hou wrote:

XRT drivers use device tree as metadata format to discover HW subsystems
behind PCIe BAR. Thus libfdt functions are called for the driver to parse
device tree blob.

to parse the device

Will fix

Signed-off-by: Sonal Santan 
Signed-off-by: Max Zhen 
Signed-off-by: Lizhi Hou 
---
  drivers/fpga/xrt/include/metadata.h  | 233 
  drivers/fpga/xrt/metadata/metadata.c | 545 +++
  2 files changed, 778 insertions(+)
  create mode 100644 drivers/fpga/xrt/include/metadata.h
  create mode 100644 drivers/fpga/xrt/metadata/metadata.c

diff --git a/drivers/fpga/xrt/include/metadata.h 
b/drivers/fpga/xrt/include/metadata.h
new file mode 100644
index ..479e47960c61
--- /dev/null
+++ b/drivers/fpga/xrt/include/metadata.h
@@ -0,0 +1,233 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020-2021 Xilinx, Inc.
+ *
+ * Authors:
+ *  Lizhi Hou 
+ */
+
+#ifndef _XRT_METADATA_H
+#define _XRT_METADATA_H
+
+#include 
+#include 
+#include 
+
+#define XRT_MD_INVALID_LENGTH (~0UL)
+
+/* metadata properties */
+#define XRT_MD_PROP_BAR_IDX "pcie_bar_mapping"
+#define XRT_MD_PROP_COMPATIBLE "compatible"
+#define XRT_MD_PROP_HWICAP "axi_hwicap"
+#define XRT_MD_PROP_INTERFACE_UUID "interface_uuid"
+#define XRT_MD_PROP_INTERRUPTS "interrupts"
+#define XRT_MD_PROP_IO_OFFSET "reg"
+#define XRT_MD_PROP_LOGIC_UUID "logic_uuid"
+#define XRT_MD_PROP_PDI_CONFIG "pdi_config_mem"
+#define XRT_MD_PROP_PF_NUM "pcie_physical_function"
+#define XRT_MD_PROP_VERSION_MAJOR "firmware_version_major"
+
+/* non IP nodes */
+#define XRT_MD_NODE_ENDPOINTS "addressable_endpoints"
+#define XRT_MD_NODE_FIRMWARE "firmware"
+#define XRT_MD_NODE_INTERFACES "interfaces"
+#define XRT_MD_NODE_PARTITION_INFO "partition_info"
+
+/*
+ * IP nodes
+ * AF:  AXI Firewall
+ * CMC: Card Management Controller
+ * ERT: Embedded Runtime

* EP: End Point

Will add

+ * PLP: Provider Reconfigurable Partition
+ * ULP: User Reconfigurable Partition
+ */
+#define XRT_MD_NODE_ADDR_TRANSLATOR "ep_remap_data_c2h_00"
+#define XRT_MD_NODE_AF_BLP_CTRL_MGMT "ep_firewall_blp_ctrl_mgmt_00"
+#define XRT_MD_NODE_AF_BLP_CTRL_USER "ep_firewall_blp_ctrl_user_00"
+#define XRT_MD_NODE_AF_CTRL_DEBUG "ep_firewall_ctrl_debug_00"
+#define XRT_MD_NODE_AF_CTRL_MGMT "ep_firewall_ctrl_mgmt_00"
+#define XRT_MD_NODE_AF_CTRL_USER "ep_firewall_ctrl_user_00"
+#define XRT_MD_NODE_AF_DATA_C2H "ep_firewall_data_c2h_00"

c2h ?

Card to host. I will add a comment.

+#define XRT_MD_NODE_AF_DATA_H2C "ep_firewall_data_h2c_00"
+#define XRT_MD_NODE_AF_DATA_M2M "ep_firewall_data_m2m_00"
+#define XRT_MD_NODE_AF_DATA_P2P "ep_firewall_data_p2p_00"
+#define XRT_MD_NODE_CLKFREQ_HBM "ep_freq_cnt_aclk_hbm_00"
+#define XRT_MD_NODE_CLKFREQ_K1 "ep_freq_cnt_aclk_kernel_00"
+#define XRT_MD_NODE_CLKFREQ_K2 "ep_freq_cnt_aclk_kernel_01"
+#define XRT_MD_NODE_CLK_KERNEL1 "ep_aclk_kernel_00"
+#define XRT_MD_NODE_CLK_KERNEL2 "ep_aclk_kernel_01"
+#define XRT_MD_NODE_CLK_KERNEL3 "ep_aclk_hbm_00"

hbm ?

unusual acronyms should be documented.

High bandwidth memory. I will add a comment.



+#define XRT_MD_NODE_CLK_SHUTDOWN "ep_aclk_shutdown_00"
+#define XRT_MD_NODE_CMC_FW_MEM "ep_cmc_firmware_mem_00"
+#define XRT_MD_NODE_CMC_MUTEX "ep_cmc_mutex_00"
+#define XRT_MD_NODE_CMC_REG "ep_cmc_regmap_00"
+#define XRT_MD_NODE_CMC_RESET "ep_cmc_reset_00"
+#define XRT_MD_NODE_DDR_CALIB "ep_ddr_mem_calib_00"
+#define XRT_MD_NODE_DDR4_RESET_GATE "ep_ddr_mem_srsr_gate_00"
+#define XRT_MD_NODE_ERT_BASE "ep_ert_base_address_00"
+#define XRT_MD_NODE_ERT_CQ_MGMT "ep_ert_command_queue_mgmt_00"
+#define XRT_MD_NODE_ERT_CQ_USER "ep_ert_command_queue_user_00"
+#define XRT_MD_NODE_ERT_FW_MEM "ep_ert_firmware_mem_00"
+#define XRT_MD_NODE_ERT_RESET "ep_ert_reset_00"
+#define XRT_MD_NODE_ERT_SCHED "ep_ert_sched_00"
+#define XRT_MD_NODE_FLASH "ep_card_flash_program_00"
+#define XRT_MD_NODE_FPGA_CONFIG "ep_fpga_configuration_00"
+#define XRT_MD_NODE_GAPPING "ep_gapping_demand_00"
+#define XRT_MD_NODE_GATE_PLP "ep_pr_isolate_plp_00"
+#define XRT_MD_NODE_GATE_ULP "ep_pr_isolate_ulp_00"
+#define XRT_MD_NODE_KDMA_CTRL "ep_kdma_ctrl_00"
+#define XRT_MD_NODE_MAILBOX_MGMT "ep_mailbox_mgmt_00"
+#define XRT_MD_NODE_MAILBOX_USER "ep_mailbox_user_00"
+#define XRT_MD_NODE_MAILBOX_XRT "ep_mailbox_user_to_ert_00"
+#define XRT_MD_NODE_MSIX "ep_msix_00"
+#define XRT_MD_NODE_P2P "ep_p2p_00"
+#define XRT_MD_NODE_PCIE_MON "ep_pcie_link_mon_00"
+#define XRT_MD_NODE_PMC_INTR   "ep_pmc_intr_00"
+#define XRT_MD_NODE_PMC_MUX"ep_pmc_mux_00"
+#define XRT_MD_NODE_QDMA "ep_qdma_00"
+#define XRT_MD_NODE_QDMA4 "ep_qdma4_00"
+#define XRT_MD_NODE_REMAP_P2P "ep_remap_p2p_00"
+#define XRT_MD_NODE_STM 

[PATCH] pcnet32: Use pci_resource_len to validate PCI resource

2021-04-05 Thread Guenter Roeck
pci_resource_start() is not a good indicator to determine if a PCI
resource exists or not, since the resource may start at address 0.
This is seen when trying to instantiate the driver in qemu for riscv32
or riscv64.

pci :00:01.0: reg 0x10: [io  0x-0x001f]
pci :00:01.0: reg 0x14: [mem 0x-0x001f]
...
pcnet32: card has no PCI IO resources, aborting

Use pci_resouce_len() instead.

Signed-off-by: Guenter Roeck 
---
 drivers/net/ethernet/amd/pcnet32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/pcnet32.c 
b/drivers/net/ethernet/amd/pcnet32.c
index 187b0b9a6e1d..f78daba60b35 100644
--- a/drivers/net/ethernet/amd/pcnet32.c
+++ b/drivers/net/ethernet/amd/pcnet32.c
@@ -1534,8 +1534,7 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct 
pci_device_id *ent)
}
pci_set_master(pdev);
 
-   ioaddr = pci_resource_start(pdev, 0);
-   if (!ioaddr) {
+   if (!pci_resource_len(pdev, 0)) {
if (pcnet32_debug & NETIF_MSG_PROBE)
pr_err("card has no PCI IO resources, aborting\n");
err = -ENODEV;
@@ -1548,6 +1547,8 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct 
pci_device_id *ent)
pr_err("architecture does not support 32bit PCI 
busmaster DMA\n");
goto err_disable_dev;
}
+
+   ioaddr = pci_resource_start(pdev, 0);
if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) {
if (pcnet32_debug & NETIF_MSG_PROBE)
pr_err("io address range already allocated\n");
-- 
2.17.1



[PATCH v2] MIPS: add support for buggy MT7621S core detection

2021-04-05 Thread Ilya Lipnitskiy
Most MT7621 SoCs have 2 cores, which is detected and supported properly
by CPS.

Unfortunately, MT7621 SoC has a less common S variant with only one core.
On MT7621S, GCR_CONFIG still reports 2 cores, which leads to hangs when
starting SMP. CPULAUNCH registers can be used in that case to detect the
absence of the second core and override the GCR_CONFIG PCORES field.

Rework a long-standing OpenWrt patch to override the value of
mips_cps_numcores on single-core MT7621 systems.

Tested on a dual-core MT7621 device (Ubiquiti ER-X) and a single-core
MT7621 device (Netgear R6220).

Original 4.14 OpenWrt patch:
Link: 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=4cdbc90a376dd0555201c1434a2081e055e9ceb7
Current 5.10 OpenWrt patch:
Link: 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ramips/patches-5.10/320-mt7621-core-detect-hack.patch;h=c63f0f4c1ec742e24d8480e80553863744b58f6a;hb=10267e17299806f9885d086147878f6c492cb904

Suggested-by: Felix Fietkau 
Signed-off-by: Ilya Lipnitskiy 
---
 arch/mips/include/asm/mips-cps.h | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/mips-cps.h b/arch/mips/include/asm/mips-cps.h
index fd43d876892e..9f495ffef2b7 100644
--- a/arch/mips/include/asm/mips-cps.h
+++ b/arch/mips/include/asm/mips-cps.h
@@ -10,6 +10,8 @@
 #include 
 #include 
 
+#include 
+
 extern unsigned long __cps_access_bad_size(void)
__compiletime_error("Bad size for CPS accessor");
 
@@ -165,11 +167,29 @@ static inline uint64_t mips_cps_cluster_config(unsigned 
int cluster)
  */
 static inline unsigned int mips_cps_numcores(unsigned int cluster)
 {
+   struct cpulaunch *launch;
+   unsigned int ncores;
+
if (!mips_cm_present())
return 0;
 
/* Add one before masking to handle 0xff indicating no cores */
-   return (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES;
+   ncores = (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES;
+
+   if (IS_ENABLED(CONFIG_SOC_MT7621)) {
+   /*
+* Ralink MT7621S SoC is single core, but the GCR_CONFIG method
+* always reports 2 cores. Check the second core's LAUNCH_FREADY
+* flag to detect if the second core is missing. This method
+* only works before the core has been started.
+*/
+   launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);
+   launch += 2; /* MT7621 has 2 VPEs per core */
+   if (!(launch->flags & LAUNCH_FREADY))
+   ncores = 1;
+   }
+
+   return ncores;
 }
 
 /**
-- 
2.31.1



arch/parisc/include/asm/cmpxchg.h:75:52: sparse: sparse: cast truncates bits from constant value (5f0ecafe becomes fe)

2021-04-05 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0a50438c84363bd37fe18fe432888ae9a074dcab
commit: b344d6a83d01c52fddbefa6b3b4764da5b1022a0 parisc: add support for 
cmpxchg on u8 pointers
date:   9 months ago
config: parisc-randconfig-s031-20210406 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b344d6a83d01c52fddbefa6b3b4764da5b1022a0
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b344d6a83d01c52fddbefa6b3b4764da5b1022a0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=parisc 

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


sparse warnings: (new ones prefixed by >>)
   fs/erofs/zdata.c: note: in included file (through 
arch/parisc/include/asm/atomic.h, include/linux/atomic.h, 
arch/parisc/include/asm/bitops.h, ...):
>> arch/parisc/include/asm/cmpxchg.h:75:52: sparse: sparse: cast truncates bits 
>> from constant value (5f0ecafe becomes fe)
>> arch/parisc/include/asm/cmpxchg.h:75:52: sparse: sparse: cast truncates bits 
>> from constant value (5f0ecafe becomes fe)
>> arch/parisc/include/asm/cmpxchg.h:75:61: sparse: sparse: cast truncates bits 
>> from constant value (5f0edead becomes ad)

vim +75 arch/parisc/include/asm/cmpxchg.h

64  
65  /* don't worry...optimizer will get rid of most of this */
66  static inline unsigned long
67  __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, 
int size)
68  {
69  switch (size) {
70  #ifdef CONFIG_64BIT
71  case 8: return __cmpxchg_u64((u64 *)ptr, old, new_);
72  #endif
73  case 4: return __cmpxchg_u32((unsigned int *)ptr,
74   (unsigned int)old, (unsigned 
int)new_);
  > 75  case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_);
76  }
77  __cmpxchg_called_with_bad_pointer();
78  return old;
79  }
80  

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


.config.gz
Description: application/gzip


[PATCH 4/4] x86/sched: Enable checks of the state of SMT siblings in load balancing

2021-04-05 Thread Ricardo Neri
ITMT relies on asymmetric packing of tasks to ensure CPUs are populated in
priority order. When balancing load, the scheduler compares scheduling
groups in pairs, and compares only the priority of the CPUs of highest
priority in the group. This may result on CPUs with medium priority being
overlooked. A recent change introduced logic to also consider the idle
state of the SMT siblings of the CPU doing the load balance. Enable those
checks for x86 when using ITMT.

Cc: Aubrey Li 
Cc: Ben Segall 
Cc: Daniel Bristot de Oliveira 
Cc: Dietmar Eggemann 
Cc: Joel Fernandes (Google) 
Cc: Mel Gorman 
Cc: Quentin Perret 
Cc: Srinivas Pandruvada 
Cc: Steven Rostedt 
Cc: Tim Chen 
Reviewed-by: Len Brown 
Signed-off-by: Ricardo Neri 
---
 arch/x86/kernel/itmt.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c
index 1afbdd1dd777..1407120af82d 100644
--- a/arch/x86/kernel/itmt.c
+++ b/arch/x86/kernel/itmt.c
@@ -28,6 +28,8 @@ DEFINE_PER_CPU_READ_MOSTLY(int, sched_core_priority);
 
 /* Boolean to track if system has ITMT capabilities */
 static bool __read_mostly sched_itmt_capable;
+/* Boolean to activate checks on the state of SMT siblings */
+static bool __read_mostly sched_itmt_smt_checks;
 
 /*
  * Boolean to control whether we want to move processes to cpu capable
@@ -124,6 +126,8 @@ int sched_set_itmt_support(void)
 
sysctl_sched_itmt_enabled = 1;
 
+   sched_itmt_smt_checks = true;
+
x86_topology_update = true;
rebuild_sched_domains();
 
@@ -160,6 +164,7 @@ void sched_clear_itmt_support(void)
if (sysctl_sched_itmt_enabled) {
/* disable sched_itmt if we are no longer ITMT capable */
sysctl_sched_itmt_enabled = 0;
+   sched_itmt_smt_checks = false;
x86_topology_update = true;
rebuild_sched_domains();
}
@@ -167,6 +172,16 @@ void sched_clear_itmt_support(void)
mutex_unlock(_update_mutex);
 }
 
+bool arch_asym_check_smt_siblings(void)
+{
+   return sched_itmt_smt_checks;
+}
+
+bool arch_sched_asym_prefer_early(int a, int b)
+{
+   return sched_itmt_smt_checks;
+}
+
 int arch_asym_cpu_priority(int cpu)
 {
return per_cpu(sched_core_priority, cpu);
-- 
2.17.1



[PATCH 2/4] sched/fair: Introduce arch_sched_asym_prefer_early()

2021-04-05 Thread Ricardo Neri
Introduce arch_sched_asym_prefer_early() so that architectures with SMT
can delay the decision to label a candidate busiest group as
group_asym_packing.

When using asymmetric packing, high priority idle CPUs pull tasks from
scheduling groups with low priority CPUs. The decision on using asymmetric
packing for load balancing is done after collecting the statistics of a
candidate busiest group. However, this decision needs to consider the
state of SMT siblings of dst_cpu.

Cc: Aubrey Li 
Cc: Ben Segall 
Cc: Daniel Bristot de Oliveira 
Cc: Dietmar Eggemann 
Cc: Joel Fernandes (Google) 
Cc: Mel Gorman 
Cc: Quentin Perret 
Cc: Srinivas Pandruvada 
Cc: Steven Rostedt 
Cc: Tim Chen 
Reviewed-by: Len Brown 
Signed-off-by: Ricardo Neri 
---
 include/linux/sched/topology.h |  1 +
 kernel/sched/fair.c| 11 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 8f0f778b7c91..663b98959305 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -57,6 +57,7 @@ static inline int cpu_numa_flags(void)
 #endif
 
 extern int arch_asym_cpu_priority(int cpu);
+extern bool arch_sched_asym_prefer_early(int a, int b);
 
 struct sched_domain_attr {
int relax_domain_level;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 4ef3fa0d5e8d..e74da853b046 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -106,6 +106,15 @@ int __weak arch_asym_cpu_priority(int cpu)
return -cpu;
 }
 
+/*
+ * For asym packing, early check if CPUs with higher priority should be
+ * preferred. On some architectures, more data is needed to make a decision.
+ */
+bool __weak arch_sched_asym_prefer_early(int a, int b)
+{
+   return sched_asym_prefer(a, b);
+}
+
 /*
  * The margin used when comparing utilization with CPU capacity.
  *
@@ -8458,7 +8467,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
env->idle != CPU_NOT_IDLE &&
sgs->sum_h_nr_running &&
-   sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
+   arch_sched_asym_prefer_early(env->dst_cpu, group->asym_prefer_cpu)) 
{
sgs->group_asym_packing = 1;
}
 
-- 
2.17.1



[PATCH 1/4] sched/fair: Optimize checking for group_asym_packing

2021-04-05 Thread Ricardo Neri
By checking local_group, we can avoid additional checks and invoking
sched_asmy_prefer() when it is not needed.

Cc: Aubrey Li 
Cc: Ben Segall 
Cc: Daniel Bristot de Oliveira 
Cc: Dietmar Eggemann 
Cc: Joel Fernandes (Google) 
Cc: Mel Gorman 
Cc: Quentin Perret 
Cc: Srinivas Pandruvada 
Cc: Steven Rostedt 
Cc: Tim Chen 
Reviewed-by: Len Brown 
Signed-off-by: Ricardo Neri 
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04a3ce20da67..4ef3fa0d5e8d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8455,7 +8455,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
}
 
/* Check if dst CPU is idle and preferred to this group */
-   if (env->sd->flags & SD_ASYM_PACKING &&
+   if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
env->idle != CPU_NOT_IDLE &&
sgs->sum_h_nr_running &&
sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
-- 
2.17.1



[PATCH 3/4] sched/fair: Consider SMT in ASYM_PACKING load balance

2021-04-05 Thread Ricardo Neri
When deciding to pull tasks in ASYM_PACKING, it is necessary not only to
check for the idle state of the CPU doing the load balancing, but also of
its SMT siblings.

If the CPU doing the balancing is idle but its SMT siblings are not busy,
performance suffers if it pulls tasks from a medium priority CPU that does
not have SMT siblings. The decision to label a group for asymmetric packing
balancing is done in update_sg_lb_stats(). However, for SMT, that code does
not account for idle SMT siblings.

Implement asym_can_pull_tasks() to revisit the early decision on whether
the CPU doing the balance can pull tasks once the needed information is
available. arch_sched_asym_prefer_early() and
arch_asym_check_smt_siblings() are used to conserve the legacy behavior.

Cc: Aubrey Li 
Cc: Ben Segall 
Cc: Daniel Bristot de Oliveira 
Cc: Dietmar Eggemann 
Cc: Joel Fernandes (Google) 
Cc: Mel Gorman 
Cc: Quentin Perret 
Cc: Srinivas Pandruvada 
Cc: Steven Rostedt 
Cc: Tim Chen 
Reviewed-by: Len Brown 
Signed-off-by: Ricardo Neri 
---
 include/linux/sched/topology.h |   1 +
 kernel/sched/fair.c| 122 +
 2 files changed, 123 insertions(+)

diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
index 663b98959305..6487953b24e8 100644
--- a/include/linux/sched/topology.h
+++ b/include/linux/sched/topology.h
@@ -58,6 +58,7 @@ static inline int cpu_numa_flags(void)
 
 extern int arch_asym_cpu_priority(int cpu);
 extern bool arch_sched_asym_prefer_early(int a, int b);
+extern bool arch_asym_check_smt_siblings(void);
 
 struct sched_domain_attr {
int relax_domain_level;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e74da853b046..14b18dfea5b1 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -115,6 +115,14 @@ bool __weak arch_sched_asym_prefer_early(int a, int b)
return sched_asym_prefer(a, b);
 }
 
+/*
+ * For asym packing, first check the state of SMT siblings before deciding to
+ * pull tasks.
+ */
+bool __weak arch_asym_check_smt_siblings(void)
+{
+   return false;
+}
 /*
  * The margin used when comparing utilization with CPU capacity.
  *
@@ -8483,6 +8491,110 @@ static inline void update_sg_lb_stats(struct lb_env 
*env,
sgs->group_capacity;
 }
 
+static bool cpu_group_is_smt(int cpu, struct sched_group *sg)
+{
+#ifdef CONFIG_SCHED_SMT
+   if (!static_branch_likely(_smt_present))
+   return false;
+
+   if (sg->group_weight == 1)
+   return false;
+
+   if (cpumask_weight(cpu_smt_mask(cpu)) == 1)
+   return false;
+
+   return cpumask_equal(sched_group_span(sg), cpu_smt_mask(cpu));
+#else
+   return false;
+#endif
+}
+
+/**
+ * asym_can_pull_tasks - Check whether the load balancing CPU can pull tasks
+ * @dst_cpu:   CPU doing the load balancing
+ * @sds:   Load-balancing data with statistics of the local group
+ * @sgs:   Load-balancing statistics of the candidate busiest group
+ * @sg:The candidate busiet group
+ *
+ * Check the state of the SMT siblings of both @sds::local and @sg and decide
+ * if @dst_cpu can pull tasks. If @dst_cpu does not have SMT siblings, it can
+ * pull tasks if two or more of the SMT siblings of @sg are busy. If only one
+ * CPU in @sg is busy, pull tasks only if @dst_cpu has higher priority.
+ *
+ * If both @dst_cpu and @sg have SMT siblings. Even the number of idle CPUs
+ * between @sds::local and @sg. Thus, pull tasks from @sg if the difference
+ * between the number of busy CPUs is 2 or more. If the difference is of 1,
+ * only pull if @dst_cpu has higher priority. If @sg does not have SMT siblings
+ * only pull tasks if all of the SMT siblings of @dst_cpu are idle and @sg
+ * has lower priority.
+ */
+static bool asym_can_pull_tasks(int dst_cpu, struct sd_lb_stats *sds,
+   struct sg_lb_stats *sgs, struct sched_group *sg)
+{
+#ifdef CONFIG_SCHED_SMT
+   int cpu, local_busy_cpus, sg_busy_cpus;
+   bool local_is_smt, sg_is_smt;
+
+   if (!arch_asym_check_smt_siblings())
+   return true;
+
+   cpu = group_first_cpu(sg);
+   local_is_smt = cpu_group_is_smt(dst_cpu, sds->local);
+   sg_is_smt = cpu_group_is_smt(cpu, sg);
+
+   sg_busy_cpus = sgs->group_weight - sgs->idle_cpus;
+
+   if (!local_is_smt) {
+   /*
+* If we are here, @dst_cpu is idle and does not have SMT
+* siblings. Pull tasks if candidate group has two or more
+* busy CPUs.
+*/
+   if (sg_is_smt && sg_busy_cpus >= 2)
+   return true;
+
+   /*
+* @dst_cpu does not have SMT siblings. @sg may have SMT
+* siblings and only one is busy. In such case, @dst_cpu
+* can help if it has higher priority and is idle.
+*/
+   return !sds->local_stat.group_util &&

[PATCH 0/4] sched/fair: Fix load balancing of SMT siblings with ASYM_PACKING

2021-04-05 Thread Ricardo Neri
=== Problem statement ===
On SMT-enabled hardware, ASYM_PACKING can cause the load balancer to choose
low priority CPUs over medium priority CPUs.

When balancing load in scheduling domains with the SD_ASYM_PACKING flag,
idle CPUs of higher priority pull tasks from CPUs of lower priority. This
balancing is done by comparing pairs of scheduling groups. There may also
be scheduling groups composed of CPUs that are SMT siblings.

When using SD_ASYM_PACKING on x86 with Intel Turbo Boost Max Turbo 3.0
(ITMT), the priorities of a scheduling group of CPUs that has N SMT
siblings are assigned as N*P, N*P/2, N*P/3, ..., P, where P is the
priority assigned by the hardware to the physical core and N is the number
of SMT siblings.

Systems such as Intel Comet Lake can have some cores supporting SMT, while
others do not. As a result, it is possible to have medium non-SMT
priorities, Q, such that N*P > Q > P.

When comparing groups for load balancing, the priority of the CPU doing the
load balancing is only compared with the preferred CPU of the candidate
busiest group (N*P vs Q in the example above). Thus, scheduling groups
with a preferred CPU with priority N*P always pull tasks from the
scheduling group with priority Q and then such tasks are spread in the
“SMT” domain. Conversely, since N*P > Q, CPUs with priority Q cannot
pull tasks from a group with a preferred CPU with priority N*P, even
though Q > P.

Doing load balancing based on load (i.e. if the busiest group is of type
group_overloaded) will not help if the system is not fully busy as the
involved groups will have only one task and load balancing will
not be deemed as necessary.

The behavior described above results in leaving CPUs with medium priority
idle, while CPUs with lower priority are busy. Furthermore, such CPUs of
lower priority are SMT siblings of high priority CPUs, which are also busy.

This patchset fixes this behavior by also checking the idle state of the
SMT siblings of both the CPU doing the load balance and the busiest
candidate group.

I ran a few benchmarks with and without this patchset on an Intel(R)
Core(TM) i9-7900X CPU. I kept online both SMT siblings of two high
priority cores. I offlined the lower priority SMT siblings of three low
priority cores. I offlined the rest of the cores. The resulting priority
configuration meets the N*P > Q > P condition described above.

The baseline for the results is an unmodified v5.12-rc3 kernel. Results
show a comparative percentage of improvement (positive) or degradation
(negative). Each test case is repeated three times, and the standard
deviation among repetitions is also documented.

In order to judge only the improvements this patchset provide, Table 1
shows the results when setting the CPU's frequency at 800MHz. It can be
observed that the patches bring an overall positive impact, especially on
schench. Regressions are mostly of less than 1%.

Table 2 shows the results when using hardware-controlled performance
performance states (HWP), a common use case. In this case, the impact of
the patches is overall positive, especially on schbench. Although some
regressions are also observed.

Thanks and BR,
Ricardo

   Table 1. Test results of patches at 800MHz  
===
hackbench
=
caseloadbaseline(std%)  compare%( std%)
process-pipegroup-1  1.00 (  3.19)   +1.50 (  4.10)
process-pipegroup-2  1.00 (  1.07)   -0.82 (  0.63)
process-pipegroup-4  1.00 (  2.61)   +1.35 (  4.88)
process-pipegroup-8  1.00 (  6.81)   +0.90 ( 17.64)
process-sockets group-1  1.00 (  0.35)   +0.37 (  1.37)
process-sockets group-2  1.00 (  0.69)   -0.42 (  0.81)
process-sockets group-4  1.00 (  1.89)   -0.06 (  1.83)
process-sockets group-8  1.00 (  3.10)   -6.92 (  8.11)
threads-pipegroup-1  1.00 (  5.89)   +6.42 (  2.68)
threads-pipegroup-2  1.00 (  2.26)   +2.81 (  3.36)
threads-pipegroup-4  1.00 (  4.01)   +0.51 (  5.17)
threads-pipegroup-8  1.00 ( 16.17)  +18.85 ( 11.37)
threads-sockets group-1  1.00 (  1.00)   -3.96 (  2.34)
threads-sockets group-2  1.00 (  1.22)   +0.67 (  1.26)
threads-sockets group-4  1.00 (  0.51)   +0.39 (  0.32)
threads-sockets group-8  1.00 (  3.39)   +2.19 (  3.16)

netperf
===
caseloadbaseline(std%)  compare%( std%)
TCP_RR  thread-1 1.00 (  0.41)   -0.47 (  0.25)
TCP_RR  thread-3 1.00 (  0.41)   +2.74 (  0.29)
TCP_RR  thread-7 1.00 ( 11.00)   +0.29 ( 16.64)
TCP_RR  thread-141.00 ( 23.14)   +0.71 ( 22.57)
UDP_RR  thread-1 1.00 (  

drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: sparse: incorrect type in assignment (different base types)

2021-04-05 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0a50438c84363bd37fe18fe432888ae9a074dcab
commit: 005b73d0dd83c9cb9420a196bea8070cde30ecac m68knommu: __force type casts 
for raw IO access
date:   8 months ago
config: m68k-randconfig-s032-20210406 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=005b73d0dd83c9cb9420a196bea8070cde30ecac
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 005b73d0dd83c9cb9420a196bea8070cde30ecac
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:212:24: sparse: sparse: cast to restricted 
__le32
   drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted 
__le16
   drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted 
__le16
   drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted 
__le16
   drivers/usb/isp1760/isp1760-udc.c:214:31: sparse: sparse: cast to restricted 
__le16
   drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: sparse: incorrect type in 
argument 3 (different base types) @@ expected unsigned int [usertype] val 
@@ got restricted __le32 [usertype] @@
   drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: expected unsigned int 
[usertype] val
   drivers/usb/isp1760/isp1760-udc.c:268:53: sparse: got restricted __le32 
[usertype]
>> drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: sparse: incorrect type in 
>> assignment (different base types) @@ expected unsigned short volatile 
>> [usertype] @@ got restricted __le16 [usertype] @@
   drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: expected unsigned 
short volatile [usertype]
   drivers/usb/isp1760/isp1760-udc.c:270:17: sparse: got restricted __le16 
[usertype]
   drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: sparse: incorrect type in 
assignment (different base types) @@ expected unsigned short volatile 
[usertype] @@ got restricted __le16 [usertype] @@
   drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: expected unsigned short 
volatile [usertype]
   drivers/usb/isp1760/isp1760-udc.c:485:9: sparse: got restricted __le16 
[usertype]

vim +270 drivers/usb/isp1760/isp1760-udc.c

0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  241  
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  242  
static void isp1760_udc_transmit(struct isp1760_ep *ep,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  243  
 struct isp1760_request *req)
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  244  
{
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  245  
struct isp1760_udc *udc = ep->udc;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  246  
u32 *buf = req->req.buf + req->req.actual;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  247  
int i;
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  248  
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  249  
req->packet_size = min(req->req.length - req->req.actual,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  250  
   ep->maxpacket);
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  251  
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  252  
dev_dbg(udc->isp->dev, "%s: transferring %u bytes (%u/%u done)\n",
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  253  
__func__, req->packet_size, req->req.actual,
0316ca6319b98e drivers/usb/host/isp1760-udc.c Laurent Pinchart 2015-01-21  254  

Re: [PATCH 4.19 00/56] 4.19.185-rc1 review

2021-04-05 Thread Naresh Kamboju
On Mon, 5 Apr 2021 at 14:31, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 4.19.185 release.
> There are 56 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 Wed, 07 Apr 2021 08:50:09 +.
> 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.19.185-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.19.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 

## Build
* kernel: 4.19.185-rc1
* git: 
['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git',
'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
* git branch: linux-4.19.y
* git commit: e80ef2122d5c0531670cb281f5beea2cb469aee1
* git describe: v4.19.184-57-ge80ef2122d5c
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.184-57-ge80ef2122d5c

## No regressions (compared to v4.19.184-40-gea7c9d15cb8d)

## No fixes (compared to v4.19.184-40-gea7c9d15cb8d)

## Test result summary
 total: 69440, pass: 56308, fail: 1824, skip: 11083, xfail: 225,

## Build Summary
* arm: 97 total, 97 passed, 0 failed
* arm64: 25 total, 25 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 14 total, 14 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 39 total, 39 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 15 total, 15 passed, 0 failed

## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* 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
* ltp-tracing-tests
* network-basic-tests
* perf
* rcutorture
* ssuite
* v4l2-compliance

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


[PATCH v7] USB: serial: cp210x: Add support for GPIOs on CP2108

2021-04-05 Thread Pho Tran
From: Pho Tran 

Similar to other CP210x devices, GPIO interfaces (gpiochip) should be
supported for CP2108.

CP2108 has 4 serial interfaces but only 1 set of GPIO pins are shared
to all of those interfaces. So, just need to initialize GPIOs of CP2108
with only one interface (I use interface 0). It means just only 1 gpiochip
device file will be created for CP2108.

CP2108 has 16 GPIOs, So data types of several variables need to be is u16
instead of u8(in struct cp210x_serial_private). This doesn't affect other
CP210x devices.

Because CP2108 has 16 GPIO pins, the parameter passed by cp210x functions
will be different from other CP210x devices. So need to check part number
of the device to use correct data format  before sending commands to
devices.

Like CP2104, CP2108 have GPIO pins with configurable options. Therefore,
should be mask all pins which are not in GPIO mode in cp2108_gpio_init()
function.

Fix build test WARNING reported by kernel test robot.

Reported-by: Kernel test robot 
Signed-off-by: Pho Tran 
---

04/05/2021: Patch v6 Fix build warning reported by kernel test robot.
03/15/2021: Patch v5 Modifed code according to comment of Johan:
1. Unified the handling of CP2108 and other types and
take care about endianness.
2. Used suitable types data for variable.
3. Fixed cp2108_gpio_init and add more detail on
commit message and comment.
4. Dropped some of the ones that don't add any value.
03/12/2021: Patch v4 used git send-mail instead of send patch by manual
follow the instructions of Johan Hovold .
03/05/2021: Patch v3 modified format and contents of changelog follow feedback
from Johan Hovold .
03/04/2021: Patch v2 modified format patch as comment from
Johan Hovold :
1. Break commit message lines at 80 cols
2. Use kernel u8 and u16 instead of the c99 ones.
03/01/2021: Initialed submission of patch "Make the CP210x driver work with
GPIOs of CP2108.".

 drivers/usb/serial/cp210x.c | 253 +++-
 1 file changed, 219 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 7bec1e730b20..300e4b77c26c 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -245,9 +245,9 @@ struct cp210x_serial_private {
 #ifdef CONFIG_GPIOLIB
struct gpio_chipgc;
boolgpio_registered;
-   u8  gpio_pushpull;
-   u8  gpio_altfunc;
-   u8  gpio_input;
+   u16 gpio_pushpull;
+   u16 gpio_altfunc;
+   u16 gpio_input;
 #endif
u8  partnum;
speed_t min_speed;
@@ -399,6 +399,18 @@ static struct usb_serial_driver * const serial_drivers[] = 
{
 #define CP210X_PARTNUM_CP2102N_QFN20   0x22
 #define CP210X_PARTNUM_UNKNOWN 0xFF
 
+/*
+ * CP2108 Define bit locations for EnhancedFxn_IFCx
+ * Refer to 
https://www.silabs.com/documents/public/application-notes/an978-cp210x-usb-to-uart-api-specification.pdf
+ * for more information.
+ */
+#define EF_IFC_GPIO_TXLED  0x01
+#define EF_IFC_GPIO_RXLED  0x02
+#define EF_IFC_GPIO_RS485  0x04
+#define EF_IFC_GPIO_RS485_LOGIC 0x08
+#define EF_IFC_GPIO_CLOCK  0x10
+#define EF_IFC_DYNAMIC_SUSPEND 0x40
+
 /* CP210X_GET_COMM_STATUS returns these 0x13 bytes */
 struct cp210x_comm_status {
__le32   ulErrors;
@@ -500,6 +512,45 @@ struct cp210x_single_port_config {
u8  device_cfg;
 } __packed;
 
+/*
+ * Quad Port Config definitions
+ * Refer to 
https://www.silabs.com/documents/public/application-notes/an978-cp210x-usb-to-uart-api-specification.pdf
+ * for more information.
+ * CP210X_VENDOR_SPECIFIC, CP210X_GET_PORTCONFIG call reads these 0x49 bytes
+ * on a CP2108 chip.
+ * CP2108 Quad Port State structure(used in Quad Port Config structure)
+ */
+struct cp210x_quad_port_state {
+   __le16 gpio_mode_PB0;
+   __le16 gpio_mode_PB1;
+   __le16 gpio_mode_PB2;
+   __le16 gpio_mode_PB3;
+   __le16 gpio_mode_PB4;
+
+
+   __le16 gpio_lowpower_PB0;
+   __le16 gpio_lowpower_PB1;
+   __le16 gpio_lowpower_PB2;
+   __le16 gpio_lowpower_PB3;
+   __le16 gpio_lowpower_PB4;
+
+   __le16 gpio_latch_PB0;
+   __le16 gpio_latch_PB1;
+   __le16 gpio_latch_PB2;
+   __le16 gpio_latch_PB3;
+   __le16 gpio_latch_PB4;
+};
+
+// Cp2108 Quad Port Config structure
+struct cp210x_quad_port_config {
+   struct cp210x_quad_port_state reset_state;
+   struct cp210x_quad_port_state suspend_state;
+   u8 ipdelay_IFC[4];
+   u8 enhancedfxn_IFC[4];
+   u8 enhancedfxn_device;
+   u8 extclkfreq[4];
+} __packed;
+
 /* GPIO modes */
 #define CP210X_SCI_GPIO_MODE_OFFSET9
 #define CP210X_SCI_GPIO_MODE_MASK  GENMASK(11, 9)
@@ -510,6 +561,9 @@ struct cp210x_single_port_config {
 #define 

[PATCH] usb: gadget: aspeed: Remove unnecessary version.h includes

2021-04-05 Thread Jiapeng Chong
"make versioncheck" shows:

./drivers/usb/gadget/udc/aspeed-vhub/hub.c: 33 linux/version.h not
needed.

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/usb/gadget/udc/aspeed-vhub/hub.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c 
b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
index 5c7dea5..e5bbc0c 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
1.8.3.1



Re: [PATCH v4 3/4] locking/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32

2021-04-05 Thread Guo Ren
On Wed, Mar 31, 2021 at 3:23 PM Arnd Bergmann  wrote:
>
> On Wed, Mar 31, 2021 at 12:35 AM Stafford Horne  wrote:
> >
> > I just want to chime in here, there may be a better spot in the thread to
> > mention this but, for OpenRISC I did implement some generic 8/16-bit xchg 
> > code
> > which I have on my todo list somwhere to replace the other generic
> > implementations like that in mips.
> >
> >   arch/openrisc/include/asm/cmpxchg.h
> >
> > The idea would be that architectures just implement these methods:
> >
> >   long cmpxchg_u32(*ptr,old,new)
> >   long xchg_u32(*ptr,val)
> >
> > Then the rest of the generic header would implement cmpxchg.
>
> I like the idea of generalizing it a little further. I'd suggest staying a
> little closer to the existing naming here though, as we already have
> cmpxchg() for the type-agnostic version, and cmpxchg64() for the
> fixed-length 64-bit version.
>
> I think a nice interface between architecture-specific and architecture
> independent code would be to have architectures provide
> arch_cmpxchg32()/arch_xchg32() as the most basic version, as well
> as arch_cmpxchg8()/arch_cmpxchg16()/arch_xchg8()/arch_xchg16()
> if they have instructions for those.
>
> The common code can then build cmpxchg16()/xchg16() on top of
> either the 16-bit or the 32-bit primitives, and build the cmpxchg()/xchg()
> wrapper around those (or alternatively we can decide to have them
> only deal with fixed-32-bit and long/pointer sized atomics).
I think these emulation codes are suitable for some architectures but not riscv.

We shouldn't export xchg16/cmpxchg16(emulated by lr.w/sc.w) in riscv,
We should forbid these sub-word atomic primitive and lets the
programmers consider their atomic design.

-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/


linux-next: manual merge of the net-next tree with the net tree

2021-04-05 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

  drivers/net/ethernet/mellanox/mlx5/core/en_main.c

between commit:

  3ff3874fa0b2 ("net/mlx5e: Guarantee room for XSK wakeup NOP on async ICOSQ")

from the net tree and commits:

  c276aae8c19d ("net/mlx5: Move mlx5e hw resources into a sub object")
  b3a131c2a160 ("net/mlx5e: Move params logic into its dedicated file")

from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 5db63b9f3b70,773449c1424b..
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@@ -1090,8 -1040,7 +1040,8 @@@ static int mlx5e_alloc_icosq(struct mlx
int err;
  
sq->channel   = c;
-   sq->uar_map   = mdev->mlx5e_res.bfreg.map;
+   sq->uar_map   = mdev->mlx5e_res.hw_objs.bfreg.map;
 +  sq->reserved_room = param->stop_room;
  
param->wq.db_numa_node = cpu_to_node(c->cpu);
err = mlx5_wq_cyc_create(mdev, >wq, sqc_wq, wq, >wq_ctrl);


pgpM0u5y6b34C.pgp
Description: OpenPGP digital signature


[PATCH] sunrpc: Remove unused function ip_map_lookup

2021-04-05 Thread Jiapeng Chong
Fix the following clang warnings:

net/sunrpc/svcauth_unix.c:306:30: warning: unused function
'ip_map_lookup' [-Wunused-function].

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 net/sunrpc/svcauth_unix.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 97c0bdd..35b7966 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -303,15 +303,6 @@ static struct ip_map *__ip_map_lookup(struct cache_detail 
*cd, char *class,
return NULL;
 }
 
-static inline struct ip_map *ip_map_lookup(struct net *net, char *class,
-   struct in6_addr *addr)
-{
-   struct sunrpc_net *sn;
-
-   sn = net_generic(net, sunrpc_net_id);
-   return __ip_map_lookup(sn->ip_map_cache, class, addr);
-}
-
 static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm,
struct unix_domain *udom, time64_t expiry)
 {
-- 
1.8.3.1



Re: [PATCH 5.4 00/74] 5.4.110-rc1 review

2021-04-05 Thread Naresh Kamboju
On Mon, 5 Apr 2021 at 14:33, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 5.4.110 release.
> There are 74 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 Wed, 07 Apr 2021 08:50:09 +.
> 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.4.110-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.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 

## Build
* kernel: 5.4.110-rc1
* git: 
['https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git',
'https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc']
* git branch: linux-5.4.y
* git commit: c6f7c5a01d5a9e0d0cfb721249d5378de5f00310
* git describe: v5.4.109-75-gc6f7c5a01d5a
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.109-75-gc6f7c5a01d5a

## No regressions (compared to v5.4.109)

## No fixes (compared to v5.4.109)

## Test result summary
 total: 71104, pass: 59473, fail: 795, skip: 10620, xfail: 216,

## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 191 total, 190 passed, 1 failed
* arm64: 25 total, 25 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 14 total, 14 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 45 total, 45 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 21 total, 21 passed, 0 failed
* s390: 9 total, 9 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 1 passed, 0 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 25 total, 25 passed, 0 failed

## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-android
* kselftest-bpf
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kvm-unit-tests
* 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
* ltp-tracing-tests
* network-basic-tests
* perf
* rcutorture
* ssuite
* v4l2-compliance

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


[PATCH -next v2] speakup: i18n: Switch to kmemdup_nul() in spk_msg_set()

2021-04-05 Thread Yang Yingliang
Use kmemdup_nul() helper instead of open-coding to
simplify the code in spk_msg_set().

Reported-by: Hulk Robot 
Signed-off-by: Yang Yingliang 
---
V2:
   change the tile and commit log.
---
 drivers/accessibility/speakup/i18n.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/accessibility/speakup/i18n.c 
b/drivers/accessibility/speakup/i18n.c
index ee240d36f947..46bd50f3c3a4 100644
--- a/drivers/accessibility/speakup/i18n.c
+++ b/drivers/accessibility/speakup/i18n.c
@@ -548,12 +548,10 @@ ssize_t spk_msg_set(enum msg_index_t index, char *text, 
size_t length)
if ((index < MSG_FIRST_INDEX) || (index >= MSG_LAST_INDEX))
return -EINVAL;
 
-   newstr = kmalloc(length + 1, GFP_KERNEL);
+   newstr = kmemdup_nul(text, length, GFP_KERNEL);
if (!newstr)
return -ENOMEM;
 
-   memcpy(newstr, text, length);
-   newstr[length] = '\0';
if (index >= MSG_FORMATTED_START &&
index <= MSG_FORMATTED_END &&
!fmt_validate(speakup_default_msgs[index], newstr)) {
-- 
2.25.1



[PATCH v2] qtnfmac: remove meaningless goto statement and labels

2021-04-05 Thread samirweng1979
From: wengjianfeng 

some function's label meaningless, the label statement follows
the goto statement, no other statements, so just remove it.

Reported-by: kernel test robot 
Signed-off-by: wengjianfeng 
---
 drivers/net/wireless/quantenna/qtnfmac/commands.c | 67 ---
 1 file changed, 67 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c 
b/drivers/net/wireless/quantenna/qtnfmac/commands.c
index f3ccbd2..c68563c 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c
@@ -379,10 +379,6 @@ int qtnf_cmd_send_stop_ap(struct qtnf_vif *vif)
 
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
-
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -407,10 +403,7 @@ int qtnf_cmd_send_register_mgmt(struct qtnf_vif *vif, u16 
frame_type, bool reg)
cmd->do_register = reg;
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -446,10 +439,7 @@ int qtnf_cmd_send_frame(struct qtnf_vif *vif, u32 cookie, 
u16 flags,
qtnf_cmd_skb_put_buffer(cmd_skb, buf, len);
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -477,10 +467,6 @@ int qtnf_cmd_send_mgmt_set_appie(struct qtnf_vif *vif, u8 
frame_type,
 
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
-
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -1677,10 +1663,7 @@ int qtnf_cmd_send_update_phy_params(struct qtnf_wmac 
*mac, u32 changed)
 wiphy->retry_short);
 
ret = qtnf_cmd_send(mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(mac->bus);
 
return ret;
@@ -1772,10 +1755,7 @@ int qtnf_cmd_send_add_key(struct qtnf_vif *vif, u8 
key_index, bool pairwise,
 params->seq_len);
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -1807,10 +1787,7 @@ int qtnf_cmd_send_del_key(struct qtnf_vif *vif, u8 
key_index, bool pairwise,
cmd->pairwise = pairwise;
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -1837,10 +1814,7 @@ int qtnf_cmd_send_set_default_key(struct qtnf_vif *vif, 
u8 key_index,
cmd->multicast = multicast;
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -1864,10 +1838,7 @@ int qtnf_cmd_send_set_default_mgmt_key(struct qtnf_vif 
*vif, u8 key_index)
cmd->key_index = key_index;
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -1931,8 +1902,6 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const 
u8 *mac,
}
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
 out:
qtnf_bus_unlock(vif->mac->bus);
@@ -1966,10 +1935,7 @@ int qtnf_cmd_send_del_sta(struct qtnf_vif *vif,
cmd->reason_code = cpu_to_le16(params->reason_code);
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -2189,10 +2155,6 @@ int qtnf_cmd_send_connect(struct qtnf_vif *vif,
 
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
-
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -2218,10 +2180,6 @@ int qtnf_cmd_send_external_auth(struct qtnf_vif *vif,
 
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
-
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -2245,10 +2203,7 @@ int qtnf_cmd_send_disconnect(struct qtnf_vif *vif, u16 
reason_code)
cmd->reason = cpu_to_le16(reason_code);
 
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
 
-out:
qtnf_bus_unlock(vif->mac->bus);
 
return ret;
@@ -2271,10 +2226,6 @@ int qtnf_cmd_send_updown_intf(struct qtnf_vif *vif, bool 
up)
 
qtnf_bus_lock(vif->mac->bus);
ret = qtnf_cmd_send(vif->mac->bus, cmd_skb);
-   if (ret)
-   goto out;
-
-out:

[PATCH RESEND] qtnfmac: remove meaningless labels

2021-04-05 Thread samirweng1979
From: wengjianfeng 

some function's label meaningless, the return statement follows
the goto statement, so just remove it.

Signed-off-by: wengjianfeng 
---
 drivers/net/wireless/quantenna/qtnfmac/cfg80211.c | 27 +--
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c 
b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
index 504b4d0..84b15a6 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
@@ -680,13 +680,10 @@ static int qtnf_set_default_key(struct wiphy *wiphy, 
struct net_device *dev,
eth_zero_addr(vif->bssid);
 
ret = qtnf_cmd_send_connect(vif, sme);
-   if (ret) {
+   if (ret)
pr_err("VIF%u.%u: failed to connect\n",
   vif->mac->macid, vif->vifid);
-   goto out;
-   }
 
-out:
return ret;
 }
 
@@ -702,13 +699,10 @@ static int qtnf_set_default_key(struct wiphy *wiphy, 
struct net_device *dev,
pr_warn("unexpected bssid: %pM", auth->bssid);
 
ret = qtnf_cmd_send_external_auth(vif, auth);
-   if (ret) {
+   if (ret)
pr_err("VIF%u.%u: failed to report external auth\n",
   vif->mac->macid, vif->vifid);
-   goto out;
-   }
 
-out:
return ret;
 }
 
@@ -727,8 +721,7 @@ static int qtnf_set_default_key(struct wiphy *wiphy, struct 
net_device *dev,
}
 
if (vif->wdev.iftype != NL80211_IFTYPE_STATION) {
-   ret = -EOPNOTSUPP;
-   goto out;
+   return -EOPNOTSUPP;
}
 
ret = qtnf_cmd_send_disconnect(vif, reason_code);
@@ -742,7 +735,6 @@ static int qtnf_set_default_key(struct wiphy *wiphy, struct 
net_device *dev,
  NULL, 0, true, GFP_KERNEL);
}
 
-out:
return ret;
 }
 
@@ -935,13 +927,10 @@ static int qtnf_update_owe_info(struct wiphy *wiphy, 
struct net_device *dev,
return -EOPNOTSUPP;
 
ret = qtnf_cmd_send_update_owe(vif, owe_info);
-   if (ret) {
+   if (ret)
pr_err("VIF%u.%u: failed to update owe info\n",
   vif->mac->macid, vif->vifid);
-   goto out;
-   }
 
-out:
return ret;
 }
 
@@ -987,18 +976,14 @@ static int qtnf_resume(struct wiphy *wiphy)
vif = qtnf_mac_get_base_vif(mac);
if (!vif) {
pr_err("MAC%u: primary VIF is not configured\n", mac->macid);
-   ret = -EFAULT;
-   goto exit;
+   return -EFAULT;
}
 
ret = qtnf_cmd_send_wowlan_set(vif, NULL);
-   if (ret) {
+   if (ret)
pr_err("MAC%u: failed to reset WoWLAN triggers\n",
   mac->macid);
-   goto exit;
-   }
 
-exit:
return ret;
 }
 
-- 
1.9.1




Re: [PATCH] ext4: Fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed

2021-04-05 Thread Theodore Ts'o
On Thu, Mar 25, 2021 at 10:29:25AM +0800, Ye Bin wrote:
> We got follow bug_on:
> [130747.323114] kernel BUG at fs/ext4/extents_status.c:762!
> [130747.323117] Internal error: Oops - BUG: 0 [#1] SMP
> ..
> [130747.334329] Call trace:
> [130747.334553]  ext4_es_cache_extent+0x150/0x168 [ext4]
> [130747.334975]  ext4_cache_extents+0x64/0xe8 [ext4]
> [130747.335368]  ext4_find_extent+0x300/0x330 [ext4]
> [130747.335759]  ext4_ext_map_blocks+0x74/0x1178 [ext4]
> [130747.336179]  ext4_map_blocks+0x2f4/0x5f0 [ext4]
> [130747.336567]  ext4_mpage_readpages+0x4a8/0x7a8 [ext4]
> [130747.336995]  ext4_readpage+0x54/0x100 [ext4]
> [130747.337359]  generic_file_buffered_read+0x410/0xae8
> [130747.337767]  generic_file_read_iter+0x114/0x190
> [130747.338152]  ext4_file_read_iter+0x5c/0x140 [ext4]
> [130747.338556]  __vfs_read+0x11c/0x188
> [130747.338851]  vfs_read+0x94/0x150
> [130747.339110]  ksys_read+0x74/0xf0
> 
> If call ext4_ext_insert_extent failed but new extent already inserted, we just
> update "ex->ee_len = orig_ex.ee_len", this will lead to extent overlap, then
> cause bug on when cache extent.

How did this happen in the first place?  It sounds like if the extent
was already inserted, that would be casue there was an on-disk file
system corruption, no?

In that case, shouldn't we call ext4_error() to declare the file
system has an inconsistency, so it can be fixed by fsck?

> If call ext4_ext_insert_extent failed don't update ex->ee_len with old value.
> Maybe there will lead to block leak, but it can be fixed by fsck later.

   - Ted


Re: [PATCH v4 01/16] perf/x86/intel: Add x86_pmu.pebs_vmx for Ice Lake Servers

2021-04-05 Thread Liuxiangdong (Aven, Cloud Infrastructure Service Product Dept.)

Hi,like.
Some questions about this new pebs patches set:
https://lore.kernel.org/kvm/20210329054137.120994-2-like...@linux.intel.com/

The new hardware facility supporting guest PEBS is only available
on Intel Ice Lake Server platforms for now.


AFAIK, Icelake supports adaptive PEBS and extended PEBS which Skylake 
doesn't.
But we can still use IA32_PEBS_ENABLE MSR to indicate general-purpose 
counter in Skylake.

Is there anything else that only Icelake supports in this patches set?


Besides, we have tried this patches set in Icelake.  We can use pebs(eg: 
"perf record -e cycles:pp")
when guest is kernel-5.11, but can't when kernel-4.18.  Is there a 
minimum guest kernel version requirement?



Thanks,
Xiangdong Liu


Re: [PATCH] firmware: qcom-scm: Fix QCOM_SCM configuration

2021-04-05 Thread heying (H)

Hello,

在 2021/4/2 22:25, Greg KH 写道:

On Wed, Mar 31, 2021 at 02:49:41AM -0400, He Ying wrote:

When CONFIG_QCOM_SCM is y while CONFIG_HAVE_ARM_SMCCC
is not set, compiling errors are encountered as follows:

drivers/firmware/qcom_scm-smc.o: In function `__scm_smc_do_quirk':
qcom_scm-smc.c:(.text+0x36): undefined reference to `__arm_smccc_smc'
drivers/firmware/qcom_scm-legacy.o: In function `scm_legacy_call':
qcom_scm-legacy.c:(.text+0xe2): undefined reference to `__arm_smccc_smc'
drivers/firmware/qcom_scm-legacy.o: In function `scm_legacy_call_atomic':
qcom_scm-legacy.c:(.text+0x1f0): undefined reference to `__arm_smccc_smc'

So add dependency on HAVE_ARM_SMCCC in QCOM_SCM configuration.

Reported-by: Hulk Robot 
Signed-off-by: He Ying 
---
  drivers/firmware/Kconfig | 1 +
  1 file changed, 1 insertion(+)

What commit caused this problem to show up?  Please add a "Fixes:" tag
in here and resend.


OK. I'll resend.


Thanks.



Re: [PATCH 3/3] loop: Charge i/o to mem and blk cg

2021-04-05 Thread Ming Lei
On Sat, Apr 3, 2021 at 3:18 AM Dan Schatzberg  wrote:
>
> The current code only associates with the existing blkcg when aio is
> used to access the backing file. This patch covers all types of i/o to
> the backing file and also associates the memcg so if the backing file is
> on tmpfs, memory is charged appropriately.
>
> This patch also exports cgroup_get_e_css and int_active_memcg so it
> can be used by the loop module.
>
> Signed-off-by: Dan Schatzberg 
> Acked-by: Johannes Weiner 

Reviewed-by: Ming Lei 

-- 
Ming Lei


Re: [PATCH 2/2] fs/epoll: restore waking from ep_done_scan()

2021-04-05 Thread Davidlohr Bueso

On Mon, 05 Apr 2021, Andrew Morton wrote:


Tricky.  339ddb53d373 was merged in December 2019.  So do we backport
this fix?  Could any userspace code be depending upon the
post-339ddb53d373 behavior?


As with previous trouble caused by this commit, I vote for restoring the 
behavior
backporting the fix, basically the equivalent of adding (which was my 
intention):

Fixes: 339ddb53d373 ("fs/epoll: remove unnecessary wakeups of nested epoll")



Or do we just leave the post-339ddb53d373 code as-is?  Presumably the
issue is very rarely encountered, and changeing it back has its own
risks.


While I also consider this scenario rare (normally new ready events can become
ready and trigger new wakeups), I'm seeing reports in real applications of task
hangs due to this change of semantics. Alternatively, users can update their 
code
to timeout in such scenarios, but it is ultimately the kernel's fault. 
Furthermore
it hasn't really been all _that_ long since the commit was merged, so I don't 
think
it merits a change in behavior.

As for the risks of restoring the behavior, afaict this only fixed a double 
wakeup
in an obscure nested epoll scenario, so I'm not too worried there sacrificing
performance for functionality. That said, there are fixes, for example 
65759097d80
(epoll: call final ep_events_available() check under the lock) that would 
perhaps
be rendered unnecessary.

Thanks,
Davidlohr


[PATCH net-next] mt76: mt7921: remove unneeded semicolon

2021-04-05 Thread Qiheng Lin
Eliminate the following coccicheck warning:
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c:1402:2-3: Unneeded semicolon

Signed-off-by: Qiheng Lin 
---
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c 
b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 3f9097481a5e..e56cde3a19ec 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -1399,7 +1399,7 @@ void mt7921_mac_work(struct work_struct *work)
if (++phy->sta_work_count == 10) {
phy->sta_work_count = 0;
mt7921_mac_sta_stats_work(phy);
-   };
+   }
 
mt7921_mutex_release(phy->dev);
 
-- 
2.31.1



Re: [PATCH v5 0/5] perf/x86: Some minor changes to support guest Arch LBR

2021-04-05 Thread Like Xu

Hi all, do we have any comments on this patch set?

On 2021/3/26 9:19, Like Xu wrote:

Hi Peter,

Please help review these minor perf/x86 changes in this patch set,
and we need some of them to support Guest Architectural LBR in KVM.

This version keeps reserve_lbr_buffers() as is because the LBR xsave
buffer is a per-CPU buffer, not a per-event buffer. We only need to
allocate the buffer once when initializing the first event.

If you are interested in the KVM emulation, please check
https://lore.kernel.org/kvm/20210314155225.206661-1-like...@linux.intel.com/

Please check more details in each commit and feel free to comment.

Previous:
https://lore.kernel.org/lkml/20210322060635.821531-1-like...@linux.intel.com/

v4->v5 Changelog:
- Add "Tested-by: Kan Liang"
- Make the commit message simpler
- Make check_msr() to ignore msr==0
- Use kmem_cache_alloc_node() [Namhyung]

Like Xu (5):
   perf/x86/intel: Fix the comment about guest LBR support on KVM
   perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers
   perf/x86: Skip checking MSR for MSR 0x000
   perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region
   perf/x86: Move ARCH_LBR_CTL_MASK definition to include/asm/msr-index.h

  arch/x86/events/core.c   |  8 +---
  arch/x86/events/intel/bts.c  |  2 +-
  arch/x86/events/intel/core.c |  7 +++
  arch/x86/events/intel/lbr.c  | 29 ++---
  arch/x86/events/perf_event.h |  8 +++-
  arch/x86/include/asm/msr-index.h |  1 +
  6 files changed, 35 insertions(+), 20 deletions(-)





Re: [PATCH v4 00/11] KVM: x86/pmu: Guest Architectural LBR Enabling

2021-04-05 Thread Xu, Like

Hi all, do we have any comments on this patch set?

On 2021/3/14 23:52, Like Xu wrote:

Hi geniuses,

Please help review the new version of Arch LBR enabling patch set.

The Architectural Last Branch Records (LBRs) is publiced
in the 319433-040 release of Intel Architecture Instruction
Set Extensions and Future Features Programming Reference[0].

The main advantages for the Arch LBR users are [1]:
- Faster context switching due to XSAVES support and faster reset of
   LBR MSRs via the new DEPTH MSR
- Faster LBR read for a non-PEBS event due to XSAVES support, which
   lowers the overhead of the NMI handler.
- Linux kernel can support the LBR features without knowing the model
   number of the current CPU.

It's based on the kvm/queue tree plus two commits from kvm/intel tree:
- 'fea4ab260645 ("KVM: x86: Refresh CPUID on writes to MSR_IA32_XSS")'
- '0ccd14126cb2 ("KVM: x86: Report XSS as an MSR to be saved if there are supported 
features")'

Please check more details in each commit and feel free to comment.

[0] https://software.intel.com/content/www/us/en/develop/download/
intel-architecture-instruction-set-extensions-and-future-features-programming-reference.html
[1] 
https://lore.kernel.org/lkml/1593780569-62993-1-git-send-email-kan.li...@linux.intel.com/

---
v3->v4 Changelog:
- Add one more host patch to reuse ARCH_LBR_CTL_MASK;
- Add reserve_lbr_buffers() instead of using GFP_ATOMIC;
- Fia a bug in the arch_lbr_depth_is_valid();
- Add LBR_CTL_EN to unify DEBUGCTLMSR_LBR and ARCH_LBR_CTL_LBREN;
- Add vmx->host_lbrctlmsr to save/restore host values;
- Add KVM_SUPPORTED_XSS to refactoring supported_xss;
- Clear Arch_LBR ans its XSS bit if it's not supported;
- Add negative testing to the related kvm-unit-tests;
- Refine code and commit messages;

Previous:
https://lore.kernel.org/kvm/20210303135756.1546253-1-like...@linux.intel.com/

Like Xu (11):
   perf/x86/intel: Fix the comment about guest LBR support on KVM
   perf/x86/lbr: Simplify the exposure check for the LBR_INFO registers
   perf/x86/lbr: Skip checking for the existence of LBR_TOS for Arch LBR
   perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region
   perf/x86: Move ARCH_LBR_CTL_MASK definition to include/asm/msr-index.h
   KVM: vmx/pmu: Add MSR_ARCH_LBR_DEPTH emulation for Arch LBR
   KVM: vmx/pmu: Add MSR_ARCH_LBR_CTL emulation for Arch LBR
   KVM: vmx/pmu: Add Arch LBR emulation and its VMCS field
   KVM: x86: Expose Architectural LBR CPUID leaf
   KVM: x86: Refine the matching and clearing logic for supported_xss
   KVM: x86: Add XSAVE Support for Architectural LBRs

  arch/x86/events/core.c   |   8 ++-
  arch/x86/events/intel/bts.c  |   2 +-
  arch/x86/events/intel/core.c |   6 +-
  arch/x86/events/intel/lbr.c  |  28 +
  arch/x86/events/perf_event.h |   8 ++-
  arch/x86/include/asm/msr-index.h |   1 +
  arch/x86/include/asm/vmx.h   |   4 ++
  arch/x86/kvm/cpuid.c |  25 +++-
  arch/x86/kvm/vmx/capabilities.h  |  25 +---
  arch/x86/kvm/vmx/pmu_intel.c | 103 ---
  arch/x86/kvm/vmx/vmx.c   |  50 +--
  arch/x86/kvm/vmx/vmx.h   |   4 ++
  arch/x86/kvm/x86.c   |   6 +-
  13 files changed, 227 insertions(+), 43 deletions(-)





Re: [PATCH v4 00/16] KVM: x86/pmu: Add basic support to enable Guest PEBS via DS

2021-04-05 Thread Xu, Like

Hi all, do we have any comments on this patch set?

On 2021/3/29 13:41, Like Xu wrote:

The guest Precise Event Based Sampling (PEBS) feature can provide
an architectural state of the instruction executed after the guest
instruction that exactly caused the event. It needs new hardware
facility only available on Intel Ice Lake Server platforms. This
patch set enables the basic PEBS via DS feature for KVM guests on ICX.

We can use PEBS feature on the Linux guest like native:

   # perf record -e instructions:ppp ./br_instr a
   # perf record -c 10 -e instructions:pp ./br_instr a

To emulate guest PEBS facility for the above perf usages,
we need to implement 2 code paths:

1) Fast path

This is when the host assigned physical PMC has an identical index as
the virtual PMC (e.g. using physical PMC0 to emulate virtual PMC0).
This path is used in most common use cases.

2) Slow path

This is when the host assigned physical PMC has a different index
from the virtual PMC (e.g. using physical PMC1 to emulate virtual PMC0)
In this case, KVM needs to rewrite the PEBS records to change the
applicable counter indexes to the virtual PMC indexes, which would
otherwise contain the physical counter index written by PEBS facility,
and switch the counter reset values to the offset corresponding to
the physical counter indexes in the DS data structure.

The previous version [0] enables both fast path and slow path, which
seems a bit more complex as the first step. In this patchset, we want
to start with the fast path to get the basic guest PEBS enabled while
keeping the slow path disabled. More focused discussion on the slow
path [1] is planned to be put to another patchset in the next step.

Compared to later versions in subsequent steps, the functionality
to support host-guest PEBS both enabled and the functionality to
emulate guest PEBS when the counter is cross-mapped are missing
in this patch set (neither of these are typical scenarios).

With the basic support, the guest can retrieve the correct PEBS
information from its own PEBS records on the Ice Lake servers.
And we expect it should work when migrating to another Ice Lake
and no regression about host perf is expected.

Here are the results of pebs test from guest/host for same workload:

perf report on guest:
# Samples: 2K of event 'instructions:ppp', # Event count (approx.): 1473377250
# Overhead  Command   Shared Object  Symbol
   57.74%  br_instr  br_instr   [.] lfsr_cond
   41.40%  br_instr  br_instr   [.] cmp_end
0.21%  br_instr  [kernel.kallsyms]  [k] __lock_acquire

perf report on host:
# Samples: 2K of event 'instructions:ppp', # Event count (approx.): 1462721386
# Overhead  Command   Shared Object Symbol
   57.90%  br_instr  br_instr  [.] lfsr_cond
   41.95%  br_instr  br_instr  [.] cmp_end
0.05%  br_instr  [kernel.vmlinux]  [k] lock_acquire
Conclusion: the profiling results on the guest are similar tothat on the 
host.

Please check more details in each commit and feel free to comment.

Previous:
[0] https://lore.kernel.org/kvm/20210104131542.495413-1-like...@linux.intel.com/
[1] 
https://lore.kernel.org/kvm/20210115191113.nktlnmivc3eds...@two.firstfloor.org/

v3->v4 Changelog:
- Update this cover letter and propose a new upstream plan;
[PERF]
- Drop check host DS and move handler to handle_pmi_common();
- Pass "struct kvm_pmu *" to intel_guest_get_msrs();
- Propose new assignment logic for perf_guest_switch_msr();
- Introduce x86_pmu.pebs_vmx for future capability maintenance;
[KVM]
- Add kvm_pmu_cap to optimize perf_get_x86_pmu_capability;
- Raising PEBS PMI only when OVF_BIT 62 is not set;
- Make vmx_icl_pebs_cpu specific for PEBS-PDIR emulation;
- Fix a bug for fixed_ctr_ctrl_mask;
- Add two minor refactoring patches for reuse;

Like Xu (16):
   perf/x86/intel: Add x86_pmu.pebs_vmx for Ice Lake Servers
   perf/x86/intel: Handle guest PEBS overflow PMI for KVM guest
   perf/x86/core: Pass "struct kvm_pmu *" to determine the guest values
   KVM: x86/pmu: Set MSR_IA32_MISC_ENABLE_EMON bit when vPMU is enabled
   KVM: x86/pmu: Introduce the ctrl_mask value for fixed counter
   KVM: x86/pmu: Reprogram guest PEBS event to emulate guest PEBS counter
   KVM: x86/pmu: Add IA32_PEBS_ENABLE MSR emulation for extended PEBS
   KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to manage guest DS buffer
   KVM: x86/pmu: Add PEBS_DATA_CFG MSR emulation to support adaptive PEBS
   KVM: x86: Set PEBS_UNAVAIL in IA32_MISC_ENABLE when PEBS is enabled
   KVM: x86/pmu: Adjust precise_ip to emulate Ice Lake guest PDIR counter
   KVM: x86/pmu: Move pmc_speculative_in_use() to arch/x86/kvm/pmu.h
   KVM: x86/pmu: Disable guest PEBS before vm-entry in two cases
   KVM: x86/pmu: Add kvm_pmu_cap to optimize perf_get_x86_pmu_capability
   KVM: x86/cpuid: Refactor host/guest CPU model consistency check
   KVM: x86/pmu: Expose CPUIDs feature bits PDCM, DS, DTES64

  arch/x86/events/core.c|   5 +-
  

[PATCH net-next] netdevsim: remove unneeded semicolon

2021-04-05 Thread Qiheng Lin
Eliminate the following coccicheck warning:
 drivers/net/netdevsim/fib.c:569:2-3: Unneeded semicolon

Signed-off-by: Qiheng Lin 
---
 drivers/net/netdevsim/fib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c
index fda6f37e7055..213d3e5056c8 100644
--- a/drivers/net/netdevsim/fib.c
+++ b/drivers/net/netdevsim/fib.c
@@ -566,7 +566,7 @@ nsim_fib6_rt_create(struct nsim_fib_data *data,
 err_fib6_rt_nh_del:
for (i--; i >= 0; i--) {
nsim_fib6_rt_nh_del(fib6_rt, rt_arr[i]);
-   };
+   }
nsim_fib_rt_fini(_rt->common);
kfree(fib6_rt);
return ERR_PTR(err);
-- 
2.31.1



[syzbot] KASAN: use-after-free Write in sk_psock_stop

2021-04-05 Thread syzbot
Hello,

syzbot found the following issue on:

HEAD commit:f07669df libbpf: Remove redundant semi-colon
git tree:   bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1564f0e2d0
kernel config:  https://syzkaller.appspot.com/x/.config?x=7eff0f22b8563a5f
dashboard link: https://syzkaller.appspot.com/bug?extid=7b6548ae483d6f4c64ae
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=16462311d0

The issue was bisected to:

commit 997acaf6b4b59c6a9c259740312a69ea549cc684
Author: Mark Rutland 
Date:   Mon Jan 11 15:37:07 2021 +

lockdep: report broken irq restoration

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=12c1c9ced0
final oops: https://syzkaller.appspot.com/x/report.txt?x=11c1c9ced0
console output: https://syzkaller.appspot.com/x/log.txt?x=16c1c9ced0

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7b6548ae483d6f4c6...@syzkaller.appspotmail.com
Fixes: 997acaf6b4b5 ("lockdep: report broken irq restoration")

==
BUG: KASAN: use-after-free in __lock_acquire+0x3e6f/0x54c0 
kernel/locking/lockdep.c:4770
Read of size 8 at addr 888024f66238 by task syz-executor.1/14202

CPU: 0 PID: 14202 Comm: syz-executor.1 Not tainted 5.12.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
 __lock_acquire+0x3e6f/0x54c0 kernel/locking/lockdep.c:4770
 lock_acquire kernel/locking/lockdep.c:5510 [inline]
 lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5475
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175
 spin_lock_bh include/linux/spinlock.h:359 [inline]
 sk_psock_stop+0x2f/0x4d0 net/core/skmsg.c:750
 sock_map_close+0x172/0x390 net/core/sock_map.c:1534
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
 __sock_release+0xcd/0x280 net/socket.c:599
 sock_close+0x18/0x20 net/socket.c:1258
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:140
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
 exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x466459
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 
c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:7f1bde3a3188 EFLAGS: 0246 ORIG_RAX: 0003
RAX:  RBX: 0056bf60 RCX: 00466459
RDX:  RSI:  RDI: 0005
RBP: 004bf9fb R08:  R09: 
R10:  R11: 0246 R12: 0056bf60
R13: 7ffe6eb13bbf R14: 7f1bde3a3300 R15: 00022000

Allocated by task 14202:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 kasan_kmalloc mm/kasan/common.c:506 [inline]
 kasan_kmalloc mm/kasan/common.c:465 [inline]
 __kasan_kmalloc+0x99/0xc0 mm/kasan/common.c:515
 kmalloc_node include/linux/slab.h:572 [inline]
 kzalloc_node include/linux/slab.h:695 [inline]
 sk_psock_init+0xaf/0x730 net/core/skmsg.c:668
 sock_map_link+0xbf4/0x1020 net/core/sock_map.c:286
 sock_hash_update_common+0xe2/0xa60 net/core/sock_map.c:993
 sock_map_update_elem_sys+0x561/0x680 net/core/sock_map.c:596
 bpf_map_update_value.isra.0+0x36b/0x8d0 kernel/bpf/syscall.c:167
 map_update_elem kernel/bpf/syscall.c:1129 [inline]
 __do_sys_bpf+0x2d6e/0x4f40 kernel/bpf/syscall.c:4384
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 9712:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 kasan_slab_free mm/kasan/common.c:360 [inline]
 kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xf5/0x130 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x92/0x210 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kfree+0xe5/0x7f0 mm/slub.c:4213
 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
 kthread+0x3b1/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 

[PATCH] ASoC: tegra: fix build warning

2021-04-05 Thread Bixuan Cui
The following function may have no callers, so they're marked
__maybe_unused to avoid warning:

sound/soc/tegra/tegra30_i2s.c:50:12: warning: ‘tegra30_i2s_runtime_resume’ 
defined but not used [-Wunused-function]
 static int tegra30_i2s_runtime_resume(struct device *dev)
^~
sound/soc/tegra/tegra30_i2s.c:39:12: warning: ‘tegra30_i2s_runtime_suspend’ 
defined but not used [-Wunused-function]
 static int tegra30_i2s_runtime_suspend(struct device *dev)
^~~
sound/soc/tegra/tegra20_i2s.c:48:12: warning: ‘tegra20_i2s_runtime_resume’ 
defined but not used [-Wunused-function]
 static int tegra20_i2s_runtime_resume(struct device *dev)
^~
sound/soc/tegra/tegra20_i2s.c:37:12: warning: ‘tegra20_i2s_runtime_suspend’ 
defined but not used [-Wunused-function]
 static int tegra20_i2s_runtime_suspend(struct device *dev)
^~~
sound/soc/tegra/tegra30_ahub.c:64:12: warning: ‘tegra30_ahub_runtime_resume’ 
defined but not used [-Wunused-function]
 static int tegra30_ahub_runtime_resume(struct device *dev)
^~~
sound/soc/tegra/tegra30_ahub.c:43:12: warning: ‘tegra30_ahub_runtime_suspend’ 
defined but not used [-Wunused-function]
 static int tegra30_ahub_runtime_suspend(struct device *dev)
^~~~

Fixes: 82ef0ae46b86 ('ASoC: tegra: add runtime PM support')
Fixes: be944d42ccc1 ('ASoC: tegra: add tegra30-ahub driver')
Fixes: 4fb0384f3dc6 ('ASoC: tegra: add tegra30-i2s driver')

Reported-by: Hulk Robot 
Signed-off-by: Bixuan Cui 
---
 sound/soc/tegra/tegra20_i2s.c  | 4 ++--
 sound/soc/tegra/tegra30_ahub.c | 4 ++--
 sound/soc/tegra/tegra30_i2s.c  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index 1b27f81c10fe..b280ebd72591 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -34,7 +34,7 @@
 
 #define DRV_NAME "tegra20-i2s"
 
-static int tegra20_i2s_runtime_suspend(struct device *dev)
+static __maybe_unused int tegra20_i2s_runtime_suspend(struct device *dev)
 {
struct tegra20_i2s *i2s = dev_get_drvdata(dev);
 
@@ -45,7 +45,7 @@ static int tegra20_i2s_runtime_suspend(struct device *dev)
return 0;
 }
 
-static int tegra20_i2s_runtime_resume(struct device *dev)
+static __maybe_unused int tegra20_i2s_runtime_resume(struct device *dev)
 {
struct tegra20_i2s *i2s = dev_get_drvdata(dev);
int ret;
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index d1718f3af3cd..4692c70ed933 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -40,7 +40,7 @@ static inline void tegra30_audio_write(u32 reg, u32 val)
regmap_write(ahub->regmap_ahub, reg, val);
 }
 
-static int tegra30_ahub_runtime_suspend(struct device *dev)
+static __maybe_unused int tegra30_ahub_runtime_suspend(struct device *dev)
 {
regcache_cache_only(ahub->regmap_apbif, true);
regcache_cache_only(ahub->regmap_ahub, true);
@@ -61,7 +61,7 @@ static int tegra30_ahub_runtime_suspend(struct device *dev)
  * stopping streams should dynamically adjust the clock as required.  However,
  * this is not yet implemented.
  */
-static int tegra30_ahub_runtime_resume(struct device *dev)
+static __maybe_unused int tegra30_ahub_runtime_resume(struct device *dev)
 {
int ret;
 
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 8730ffa0f691..36344f0a64c1 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -36,7 +36,7 @@
 
 #define DRV_NAME "tegra30-i2s"
 
-static int tegra30_i2s_runtime_suspend(struct device *dev)
+static __maybe_unused int tegra30_i2s_runtime_suspend(struct device *dev)
 {
struct tegra30_i2s *i2s = dev_get_drvdata(dev);
 
@@ -47,7 +47,7 @@ static int tegra30_i2s_runtime_suspend(struct device *dev)
return 0;
 }
 
-static int tegra30_i2s_runtime_resume(struct device *dev)
+static __maybe_unused int tegra30_i2s_runtime_resume(struct device *dev)
 {
struct tegra30_i2s *i2s = dev_get_drvdata(dev);
int ret;
-- 
2.17.1



Re: [PATCH v6 00/10] KVM: selftests: some improvement and a new test for kvm page table

2021-04-05 Thread wangyanan (Y)

Kindly ping...

Hi Paolo,
Will this series be picked up soon, or is there any other work for me to do?

Regards,
Yanan


On 2021/3/30 16:08, Yanan Wang wrote:

Hi,
This v6 series can mainly include two parts.
Rebased on kvm queue branch: 
https://git.kernel.org/pub/scm/virt/kvm/kvm.git/log/?h=queue

In the first part, all the known hugetlb backing src types specified
with different hugepage sizes are listed, so that we can specify use
of hugetlb source of the exact granularity that we want, instead of
the system default ones. And as all the known hugetlb page sizes are
listed, it's appropriate for all architectures. Besides, a helper that
can get granularity of different backing src types(anonumous/thp/hugetlb)
is added, so that we can use the accurate backing src granularity for
kinds of alignment or guest memory accessing of vcpus.

In the second part, a new test is added:
This test is added to serve as a performance tester and a bug reproducer
for kvm page table code (GPA->HPA mappings), it gives guidance for the
people trying to make some improvement for kvm. And the following explains
what we can exactly do through this test.

The function guest_code() can cover the conditions where a single vcpu or
multiple vcpus access guest pages within the same memory region, in three
VM stages(before dirty logging, during dirty logging, after dirty logging).
Besides, the backing src memory type(ANONYMOUS/THP/HUGETLB) of the tested
memory region can be specified by users, which means normal page mappings
or block mappings can be chosen by users to be created in the test.

If ANONYMOUS memory is specified, kvm will create normal page mappings
for the tested memory region before dirty logging, and update attributes
of the page mappings from RO to RW during dirty logging. If THP/HUGETLB
memory is specified, kvm will create block mappings for the tested memory
region before dirty logging, and split the blcok mappings into normal page
mappings during dirty logging, and coalesce the page mappings back into
block mappings after dirty logging is stopped.

So in summary, as a performance tester, this test can present the
performance of kvm creating/updating normal page mappings, or the
performance of kvm creating/splitting/recovering block mappings,
through execution time.

When we need to coalesce the page mappings back to block mappings after
dirty logging is stopped, we have to firstly invalidate *all* the TLB
entries for the page mappings right before installation of the block entry,
because a TLB conflict abort error could occur if we can't invalidate the
TLB entries fully. We have hit this TLB conflict twice on aarch64 software
implementation and fixed it. As this test can imulate process from dirty
logging enabled to dirty logging stopped of a VM with block mappings,
so it can also reproduce this TLB conflict abort due to inadequate TLB
invalidation when coalescing tables.

Links about the TLB conflict abort:
https://lore.kernel.org/lkml/20201201201034.116760-3-wangyana...@huawei.com/

---

Change logs:

v5->v6:
- Address Andrew Jones's comments for v5 series
- Add Andrew Jones's R-b tags in some patches
- Rebased on newest kvm/queue tree
- v5: 
https://lore.kernel.org/lkml/20210323135231.24948-1-wangyana...@huawei.com/

v4->v5:
- Use synchronization(sem_wait) for time measurement
- Add a new patch about TEST_ASSERT(patch 4)
- Address Andrew Jones's comments for v4 series
- Add Andrew Jones's R-b tags in some patches
- v4: 
https://lore.kernel.org/lkml/20210302125751.19080-1-wangyana...@huawei.com/

v3->v4:
- Add a helper to get system default hugetlb page size
- Add tags of Reviewed-by of Ben in the patches
- v3: 
https://lore.kernel.org/lkml/20210301065916.11484-1-wangyana...@huawei.com/

v2->v3:
- Add tags of Suggested-by, Reviewed-by in the patches
- Add a generic micro to get hugetlb page sizes
- Some changes for suggestions about v2 series
- v2: 
https://lore.kernel.org/lkml/20210225055940.18748-1-wangyana...@huawei.com/

v1->v2:
- Add a patch to sync header files
- Add helpers to get granularity of different backing src types
- Some changes for suggestions about v1 series
- v1: 
https://lore.kernel.org/lkml/20210208090841.333724-1-wangyana...@huawei.com/

---

Yanan Wang (10):
   tools headers: sync headers of asm-generic/hugetlb_encode.h
   mm/hugetlb: Add a macro to get HUGETLB page sizes for mmap
   KVM: selftests: Use flag CLOCK_MONOTONIC_RAW for timing
   KVM: selftests: Print the errno besides error-string in TEST_ASSERT
   KVM: selftests: Make a generic helper to get vm guest mode strings
   KVM: selftests: Add a helper to get system configured THP page size
   KVM: selftests: Add a helper to get system default hugetlb page size
   KVM: selftests: List all hugetlb src types specified with page sizes
   KVM: selftests: Adapt vm_userspace_mem_region_add to new helpers
   KVM: selftests: Add a test for kvm page table code

  include/uapi/linux/mman.h |   2 +
  

[PATCH net-next] net: ethernet: mtk_eth_soc: remove unneeded semicolon

2021-04-05 Thread Qiheng Lin
Eliminate the following coccicheck warning:
 drivers/net/ethernet/mediatek/mtk_ppe.c:270:2-3: Unneeded semicolon

Signed-off-by: Qiheng Lin 
---
 drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c 
b/drivers/net/ethernet/mediatek/mtk_ppe.c
index a1a9959a2461..71e1ccea6e72 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -267,7 +267,7 @@ int mtk_foe_entry_set_ipv6_tuple(struct mtk_foe_entry 
*entry,
default:
WARN_ON_ONCE(1);
return -EINVAL;
-   };
+   }
 
for (i = 0; i < 4; i++)
src[i] = be32_to_cpu(src_addr[i]);
-- 
2.31.1



Re: [PATCH 2/2] mm: khugepaged: check MMF_DISABLE_THP ahead of iterating over vmas

2021-04-05 Thread Xu, Yanfei




On 4/6/21 10:51 AM, Xu, Yanfei wrote:



On 4/6/21 2:20 AM, Yang Shi wrote:

[Please note: This e-mail is from an EXTERNAL e-mail address]

On Sun, Apr 4, 2021 at 8:33 AM  wrote:


From: Yanfei Xu 

We could check MMF_DISABLE_THP ahead of iterating over all of vma.
Otherwise if some mm_struct contain a large number of vma, there will
be amounts meaningless cpu cycles cost.

BTW, drop an unnecessary cond_resched(), because there is a another
cond_resched() followed it and no consumed invocation between them.

Signed-off-by: Yanfei Xu 
---
  mm/khugepaged.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 2efe1d0c92ed..c293ec4a94ea 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2094,6 +2094,8 @@ static unsigned int 
khugepaged_scan_mm_slot(unsigned int pages,

  */
 if (unlikely(!mmap_read_trylock(mm)))
 goto breakouterloop_mmap_lock;
+   if (test_bit(MMF_DISABLE_THP, >flags))
+   goto breakouterloop_mmap_lock;


It is fine to check this flag. But mmap_lock has been acquired so you
should jump to breakouterloop.


Oops! It's my fault. Thank you for pointing out this.
Will fix it in v2.




 if (likely(!khugepaged_test_exit(mm)))
 vma = find_vma(mm, khugepaged_scan.address);

@@ -2101,7 +2103,6 @@ static unsigned int 
khugepaged_scan_mm_slot(unsigned int pages,

 for (; vma; vma = vma->vm_next) {
 unsigned long hstart, hend;

-   cond_resched();


I don't have a strong opinion for removing this cond_resched(). But
IIUC khugepaged is a best effort job there is no harm to keep it IMHO.



Yes, keeping it is no harm. But I think we should add it when we need.
Look at the blow codes, there are only some simple check between these
two cond_resched().  And we still have some cond_resched() in the
khugepaged_scan_file() and khugepaged_scan_pmd() which is the actual
wrok about collapsing. So I think it is unnecessary.  :)



BTW, the original author add this cond_resched() might be worry about 
the hugepage_vma_check() always return false due to the MMF_DISABLE_THP. 
But now we have moved it out of the for loop of iterating vma.


um.. That is my guess..

Thanks,
Yanfei


     for (; vma; vma = vma->vm_next) {
     unsigned long hstart, hend;

     cond_resched(); //here
     if (unlikely(khugepaged_test_exit(mm))) {
     progress++;
     break;
     }
     if (!hugepage_vma_check(vma, vma->vm_flags)) {
skip:
     progress++;
     continue;
     }
     hstart = ALIGN(vma->vm_start, HPAGE_PMD_SIZE);
     hend = ALIGN_DOWN(vma->vm_end, HPAGE_PMD_SIZE);
     if (hstart >= hend)
     goto skip;
     if (khugepaged_scan.address > hend)
     goto skip;
     if (khugepaged_scan.address < hstart)
     khugepaged_scan.address = hstart;
     VM_BUG_ON(!IS_ALIGNED(khugepaged_scan.address, 
HPAGE_PMD_SIZE));


     if (shmem_file(vma->vm_file) && !shmem_huge_enabled(vma))
     goto skip;

     while (khugepaged_scan.address < hend) {
     int ret;
     cond_resched();    //here



 if (unlikely(khugepaged_test_exit(mm))) {
 progress++;
 break;
--
2.27.0




[PATCH] pinctrl: rockchip: do coding style for mux route struct

2021-04-05 Thread Jianqun Xu
The mux route tables take many lines for each SoC, and it will be more
instances for newly SoC, that makes the file size increase larger.

This patch only do coding style for mux route struct, by adding a new
definition and replace the structs by script which supplied by
huang...@rock-chips.com

sed -i -e "
/static struct rockchip_mux_route_data /bcheck
b
:append-next-line
N
:check
/^[^;]*$/bappend-next-line
s/[[:blank:]]*.bank_num = \([[:digit:]]*,\)\n/\tRK_MUXROUTE_SAME(\1/g
s/[[:blank:]]*.pin =[[:blank:]]*0,\n/ RK_PA0,/g
s/[[:blank:]]*.pin =[[:blank:]]*1,\n/ RK_PA1,/g
s/[[:blank:]]*.pin =[[:blank:]]*2,\n/ RK_PA2,/g
s/[[:blank:]]*.pin =[[:blank:]]*3,\n/ RK_PA3,/g
s/[[:blank:]]*.pin =[[:blank:]]*4,\n/ RK_PA4,/g
s/[[:blank:]]*.pin =[[:blank:]]*5,\n/ RK_PA5,/g
s/[[:blank:]]*.pin =[[:blank:]]*6,\n/ RK_PA6,/g
s/[[:blank:]]*.pin =[[:blank:]]*7,\n/ RK_PA7,/g
s/[[:blank:]]*.pin =[[:blank:]]*8,\n/ RK_PB0,/g
s/[[:blank:]]*.pin =[[:blank:]]*9,\n/ RK_PB1,/g
s/[[:blank:]]*.pin =[[:blank:]]*10,\n/ RK_PB2,/g
s/[[:blank:]]*.pin =[[:blank:]]*11,\n/ RK_PB3,/g
s/[[:blank:]]*.pin =[[:blank:]]*12,\n/ RK_PB4,/g
s/[[:blank:]]*.pin =[[:blank:]]*13,\n/ RK_PB5,/g
s/[[:blank:]]*.pin =[[:blank:]]*14,\n/ RK_PB6,/g
s/[[:blank:]]*.pin =[[:blank:]]*15,\n/ RK_PB7,/g
s/[[:blank:]]*.pin =[[:blank:]]*16,\n/ RK_PC0,/g
s/[[:blank:]]*.pin =[[:blank:]]*17,\n/ RK_PC1,/g
s/[[:blank:]]*.pin =[[:blank:]]*18,\n/ RK_PC2,/g
s/[[:blank:]]*.pin =[[:blank:]]*19,\n/ RK_PC3,/g
s/[[:blank:]]*.pin =[[:blank:]]*20,\n/ RK_PC4,/g
s/[[:blank:]]*.pin =[[:blank:]]*21,\n/ RK_PC5,/g
s/[[:blank:]]*.pin =[[:blank:]]*22,\n/ RK_PC6,/g
s/[[:blank:]]*.pin =[[:blank:]]*23,\n/ RK_PC7,/g
s/[[:blank:]]*.pin =[[:blank:]]*24,\n/ RK_PD0,/g
s/[[:blank:]]*.pin =[[:blank:]]*25,\n/ RK_PD1,/g
s/[[:blank:]]*.pin =[[:blank:]]*26,\n/ RK_PD2,/g
s/[[:blank:]]*.pin =[[:blank:]]*27,\n/ RK_PD3,/g
s/[[:blank:]]*.pin =[[:blank:]]*28,\n/ RK_PD4,/g
s/[[:blank:]]*.pin =[[:blank:]]*29,\n/ RK_PD5,/g
s/[[:blank:]]*.pin =[[:blank:]]*30,\n/ RK_PD6,/g
s/[[:blank:]]*.pin =[[:blank:]]*31,\n/ RK_PD7,/g
s/[[:blank:]]*.func = \([[:digit:]]*,\)\n/ \1/g
s/[[:blank:]]*.route_location =[[:blank:]]*\([[:print:]]*,\)\n//g
s/[[:blank:]]*.route_offset = \(0x[[:xdigit:]]*,\)\n/ \1/g
s/[[:blank:]]*.route_val =[[:blank:]]*\([[:print:]]*\),\n/ \1),/g
s/\t{\n//g
s/\t}, {\n//g
s/\t},//g
s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),\n/\tRK_MUXROUTE_SAME(\2),
 \1\n/g
s/[[:blank:]]*\(\/\*[[:print:]]*\*\/\)\n[[:blank:]]*RK_MUXROUTE_SAME(\([[:print:]]*\)),/\tRK_MUXROUTE_SAME(\2),
 \1\n/g
" drivers/pinctrl/pinctrl-rockchip.c

Signed-off-by: Jianqun Xu 
Change-Id: Ifc823d9557605b9dfcc9c0455a739f04f3fce5be
---
 drivers/pinctrl/pinctrl-rockchip.c | 669 +
 1 file changed, 99 insertions(+), 570 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c 
b/drivers/pinctrl/pinctrl-rockchip.c
index deabfbc74a01..6ba31c66ef8b 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -292,6 +292,25 @@ struct rockchip_pin_bank {
.pull_type[3] = pull3,  \
}
 
+#define PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, FLAG)
\
+   {   \
+   .bank_num   = ID,   \
+   .pin= PIN,  \
+   .func   = FUNC, \
+   .route_offset   = REG,  \
+   .route_val  = VAL,  \
+   .route_location = FLAG, \
+   }
+
+#define RK_MUXROUTE_SAME(ID, PIN, FUNC, REG, VAL)  \
+   PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_SAME)
+
+#define RK_MUXROUTE_GRF(ID, PIN, FUNC, REG, VAL)   \
+   PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_GRF)
+
+#define RK_MUXROUTE_PMU(ID, PIN, FUNC, REG, VAL)   \
+   PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROCKCHIP_ROUTE_PMU)
+
 /**
  * struct rockchip_mux_recalced_data: represent a pin iomux data.
  * @num: bank number.
@@ -803,597 +822,107 @@ static void rockchip_get_recalced_mux(struct 
rockchip_pin_bank *bank, int pin,
 }
 
 static struct rockchip_mux_route_data px30_mux_route_data[] = {
-   {
-   /* cif-d2m0 */
-   .bank_num = 2,
-   .pin = 0,
-   .func = 1,
-   .route_offset = 0x184,
-   .route_val = BIT(16 + 7),
-   }, {
-   /* cif-d2m1 */
-   .bank_num = 3,
-   .pin = 3,
-   .func = 3,
-   .route_offset = 0x184,
-   .route_val = BIT(16 + 7) | BIT(7),
-   }, {
-   /* pdm-m0 */
-   .bank_num = 3,
-   .pin = 22,
-   .func = 2,
- 

Re: [PATCH 2/2] mm: khugepaged: check MMF_DISABLE_THP ahead of iterating over vmas

2021-04-05 Thread Xu, Yanfei




On 4/6/21 2:20 AM, Yang Shi wrote:

[Please note: This e-mail is from an EXTERNAL e-mail address]

On Sun, Apr 4, 2021 at 8:33 AM  wrote:


From: Yanfei Xu 

We could check MMF_DISABLE_THP ahead of iterating over all of vma.
Otherwise if some mm_struct contain a large number of vma, there will
be amounts meaningless cpu cycles cost.

BTW, drop an unnecessary cond_resched(), because there is a another
cond_resched() followed it and no consumed invocation between them.

Signed-off-by: Yanfei Xu 
---
  mm/khugepaged.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 2efe1d0c92ed..c293ec4a94ea 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2094,6 +2094,8 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int 
pages,
  */
 if (unlikely(!mmap_read_trylock(mm)))
 goto breakouterloop_mmap_lock;
+   if (test_bit(MMF_DISABLE_THP, >flags))
+   goto breakouterloop_mmap_lock;


It is fine to check this flag. But mmap_lock has been acquired so you
should jump to breakouterloop.


Oops! It's my fault. Thank you for pointing out this.
Will fix it in v2.




 if (likely(!khugepaged_test_exit(mm)))
 vma = find_vma(mm, khugepaged_scan.address);

@@ -2101,7 +2103,6 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int 
pages,
 for (; vma; vma = vma->vm_next) {
 unsigned long hstart, hend;

-   cond_resched();


I don't have a strong opinion for removing this cond_resched(). But
IIUC khugepaged is a best effort job there is no harm to keep it IMHO.



Yes, keeping it is no harm. But I think we should add it when we need.
Look at the blow codes, there are only some simple check between these
two cond_resched().  And we still have some cond_resched() in the
khugepaged_scan_file() and khugepaged_scan_pmd() which is the actual
wrok about collapsing. So I think it is unnecessary.  :)

for (; vma; vma = vma->vm_next) {
unsigned long hstart, hend;

cond_resched(); //here
if (unlikely(khugepaged_test_exit(mm))) {
progress++;
break;
}
if (!hugepage_vma_check(vma, vma->vm_flags)) {
skip:
progress++;
continue;
}
hstart = ALIGN(vma->vm_start, HPAGE_PMD_SIZE);
hend = ALIGN_DOWN(vma->vm_end, HPAGE_PMD_SIZE);
if (hstart >= hend)
goto skip;
if (khugepaged_scan.address > hend)
goto skip;
if (khugepaged_scan.address < hstart)
khugepaged_scan.address = hstart;
VM_BUG_ON(!IS_ALIGNED(khugepaged_scan.address, 
HPAGE_PMD_SIZE));


if (shmem_file(vma->vm_file) && !shmem_huge_enabled(vma))
goto skip;

while (khugepaged_scan.address < hend) {
int ret;
cond_resched();//here



 if (unlikely(khugepaged_test_exit(mm))) {
 progress++;
 break;
--
2.27.0




Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-05 Thread Yunsheng Lin
On 2021/4/6 9:49, Cong Wang wrote:
> On Sat, Apr 3, 2021 at 5:23 AM Jiri Kosina  wrote:
>>
>> I am still planning to have Yunsheng Lin's (CCing) fix [1] tested in the
>> coming days. If it works, then we can consider proceeding with it,
>> otherwise I am all for reverting the whole NOLOCK stuff.
>>
>> [1] 
>> https://lore.kernel.org/linux-can/1616641991-14847-1-git-send-email-linyunsh...@huawei.com/T/#u
> 
> I personally prefer to just revert that bit, as it brings more troubles
> than gains. Even with Yunsheng's patch, there are still some issues.
> Essentially, I think the core qdisc scheduling code is not ready for
> lockless, just look at those NOLOCK checks in sch_generic.c. :-/

I am also awared of the NOLOCK checks too:), and I am willing to
take care of it if that is possible.

As the number of cores in a system is increasing, it is the trend
to become lockless, right? Even there is only one cpu involved, the
spinlock taking and releasing takes about 30ns on our arm64 system
when CONFIG_PREEMPT_VOLUNTARY is enable(ip forwarding testing).

Currently I has three ideas to optimize the lockless qdisc:
1. implement the qdisc bypass for lockless qdisc too, see [1].

2. implement lockless enqueuing for lockless qdisc using the idea
   from Jason and Toke. And it has a noticable proformance increase with
   1-4 threads running using the below prototype based on ptr_ring.

static inline int __ptr_ring_multi_produce(struct ptr_ring *r, void *ptr)
{

int producer, next_producer;


do {
producer = READ_ONCE(r->producer);
if (unlikely(!r->size) || r->queue[producer])
return -ENOSPC;
next_producer = producer + 1;
if (unlikely(next_producer >= r->size))
next_producer = 0;
} while(cmpxchg_relaxed(>producer, producer, next_producer) != 
producer);

/* Make sure the pointer we are storing points to a valid data. */
/* Pairs with the dependency ordering in __ptr_ring_consume. */
smp_wmb();

WRITE_ONCE(r->queue[producer], ptr);
return 0;
}

3. Maybe it is possible to remove the netif_tx_lock for lockless qdisc
   too, because dev_hard_start_xmit is also in the protection of
   qdisc_run_begin()/qdisc_run_end()(if there is only one qdisc using
   a netdev queue, which is true for pfifo_fast, I believe).


[1]. 
https://patchwork.kernel.org/project/netdevbpf/patch/1616404156-11772-1-git-send-email-linyunsh...@huawei.com/

> 
> Thanks.
> 
> .
> 



[PATCH v3] ext4: Fix ext4_error_err save negative errno into superblock

2021-04-05 Thread Ye Bin
As write_mmp_block return 1 when buffer isn't uptodate, return -EIO is
more appropriate.

Fixes: 54d3adbc29f0 ("ext4: save all error info in save_error_info() and drop 
ext4_set_errno()")
Reported-by: Liu Zhi Qiang 
Signed-off-by: Ye Bin 
Reviewed-by: Andreas Dilger 
---
 fs/ext4/mmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 795c3ff2907c..68fbeedd627b 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -56,7 +56,7 @@ static int write_mmp_block(struct super_block *sb, struct 
buffer_head *bh)
wait_on_buffer(bh);
sb_end_write(sb);
if (unlikely(!buffer_uptodate(bh)))
-   return 1;
+   return -EIO;
 
return 0;
 }
-- 
2.25.4



Re: [PATCH] integrity/ima: Add declarations to init_once void arguments.

2021-04-05 Thread James Morris
On Tue, 6 Apr 2021, Jiele Zhao wrote:

> Ping.

Mimi Zohar is the maintainer for this code.

> 
> On 2021/3/23 9:33, Jiele Zhao wrote:
> > init_once is a callback to kmem_cache_create. The parameter
> > type of this function is void *, so it's better to give a
> > explicit cast here.
> >
> > Signed-off-by: Jiele Zhao 
> > ---
> >   security/integrity/iint.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/security/integrity/iint.c b/security/integrity/iint.c
> > index 1d20003243c3..5f3f2de997e1 100644
> > --- a/security/integrity/iint.c
> > +++ b/security/integrity/iint.c
> > @@ -152,7 +152,7 @@ void integrity_inode_free(struct inode *inode)
> >   
> >   static void init_once(void *foo)
> >   {
> > -   struct integrity_iint_cache *iint = foo;
> > +   struct integrity_iint_cache *iint = (struct integrity_iint_cache
> > *)foo;
> >   
> >memset(iint, 0, sizeof(*iint));
> >iint->ima_file_status = INTEGRITY_UNKNOWN;
> 

-- 
James Morris




[PATCH v7] mm/gup: check page hwpoison status for memory recovery failures.

2021-04-05 Thread Aili Yao
When we call get_user_pages() to pin user page in memory, there may be
hwpoison page, currently, we just handle the normal case that memory
recovery jod is correctly finished, and we will not return the hwpoison
page to callers, but for other cases like memory recovery fails and the
user process related pte is not correctly set invalid, we will still
return the hwpoison page, and may touch it and lead to panic.

In gup.c, for normal page, after we call follow_page_mask(), we will
return the related page pointer; or like another hwpoison case with pte
invalid, it will return NULL. For NULL, we will handle it in if (!page)
branch. In this patch, we will filter out the hwpoison page in
follow_page_mask() and return error code for recovery failure cases.

We will check the page hwpoison status as soon as possible and avoid doing
followed normal procedure and try not to grab related pages.

Changes since v6:
- Fix wrong page pointer check in follow_trans_huge_pmd();

Signed-off-by: Aili Yao 
Cc: David Hildenbrand 
Cc: Matthew Wilcox 
Cc: Naoya Horiguchi 
Cc: Oscar Salvador 
Cc: Mike Kravetz 
Cc: Andrew Morton 
Cc: sta...@vger.kernel.org
---
 mm/gup.c | 27 +++
 mm/huge_memory.c | 11 ---
 mm/hugetlb.c |  8 +++-
 mm/internal.h| 13 +
 4 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index e40579624f10..88a93b89c03e 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -433,6 +433,9 @@ static struct page *follow_page_pte(struct vm_area_struct 
*vma,
page = ERR_PTR(ret);
goto out;
}
+   } else if (PageHWPoison(page)) {
+   page = ERR_PTR(-EHWPOISON);
+   goto out;
}
 
if (flags & FOLL_SPLIT && PageTransCompound(page)) {
@@ -540,8 +543,13 @@ static struct page *follow_pmd_mask(struct vm_area_struct 
*vma,
page = follow_huge_pd(vma, address,
  __hugepd(pmd_val(pmdval)), flags,
  PMD_SHIFT);
-   if (page)
-   return page;
+   if (page) {
+   struct page *p = check_page_hwpoison(page);
+
+   if (p == ERR_PTR(-EHWPOISON) && flags & FOLL_GET)
+   put_page(page);
+   return p;
+   }
return no_page_table(vma, flags);
}
 retry:
@@ -643,7 +651,7 @@ static struct page *follow_pud_mask(struct vm_area_struct 
*vma,
if (pud_huge(*pud) && is_vm_hugetlb_page(vma)) {
page = follow_huge_pud(mm, address, pud, flags);
if (page)
-   return page;
+   return check_page_hwpoison(page);
return no_page_table(vma, flags);
}
if (is_hugepd(__hugepd(pud_val(*pud {
@@ -652,6 +660,13 @@ static struct page *follow_pud_mask(struct vm_area_struct 
*vma,
  PUD_SHIFT);
if (page)
return page;
+   if (page) {
+   struct page *p = check_page_hwpoison(page);
+
+   if (p == ERR_PTR(-EHWPOISON) && flags & FOLL_GET)
+   put_page(page);
+   return p;
+   }
return no_page_table(vma, flags);
}
if (pud_devmap(*pud)) {
@@ -1087,10 +1102,14 @@ static long __get_user_pages(struct mm_struct *mm,
 * struct page.
 */
goto next_page;
-   } else if (IS_ERR(page)) {
+   } else if (PTR_ERR(page) == -EHWPOISON) {
+   ret = (foll_flags & FOLL_HWPOISON) ? -EHWPOISON : 
-EFAULT;
+   goto out;
+   }  else if (IS_ERR(page)) {
ret = PTR_ERR(page);
goto out;
}
+
if (pages) {
pages[i] = page;
flush_anon_page(vma, page, start);
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index ae907a9c2050..56ff2e83b67c 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1349,6 +1349,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct 
*vma,
 {
struct mm_struct *mm = vma->vm_mm;
struct page *page = NULL;
+   struct page *tail = NULL;
 
assert_spin_locked(pmd_lockptr(mm, pmd));
 
@@ -1366,6 +1367,11 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct 
*vma,
page = pmd_page(*pmd);
VM_BUG_ON_PAGE(!PageHead(page) && !is_zone_device_page(page), page);
 
+   tail = page + ((addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT);
+
+   if (PageHWPoison(tail))
+   return ERR_PTR(-EHWPOISON);
+
if (!try_grab_page(page, flags))
return ERR_PTR(-ENOMEM);
 
@@ -1405,11 

Re: [PATCH] jbd2: avoid -Wempty-body warnings

2021-04-05 Thread Theodore Ts'o
On Tue, Mar 30, 2021 at 05:15:33PM +0200, Jan Kara wrote:
> On Mon 22-03-21 11:21:38, Arnd Bergmann wrote:
> > From: Arnd Bergmann 
> > 
> > Building with 'make W=1' shows a harmless -Wempty-body warning:
> > 
> > fs/jbd2/recovery.c: In function 'fc_do_one_pass':
> > fs/jbd2/recovery.c:267:75: error: suggest braces around empty body in an 
> > 'if' statement [-Werror=empty-body]
> >   267 | jbd_debug(3, "Fast commit replay failed, err = 
> > %d\n", err);
> >   | 
> >   ^
> > 
> > Change the empty dprintk() macros to no_printk(), which avoids this
> > warning and adds format string checking.
> > 
> > Signed-off-by: Arnd Bergmann 
> 
> Sure. Feel free to add:
> 
> Reviewed-by: Jan Kara 

Applied, thanks.

- Ted


Re: [PATCH-next 2/5] lib/test_vmalloc.c: add a new 'nr_threads' parameter

2021-04-05 Thread Andrew Morton
On Sat, 3 Apr 2021 14:31:43 +0200 Uladzislau Rezki  wrote:

> > 
> > We may need to replaced that kcalloc() with kmvalloc() though...
> >
> Yep. If we limit to USHRT_MAX, the maximum amount of memory for
> internal data would be ~12MB. Something like below:
> 
> diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c
> index d337985e4c5e..a5103e3461bf 100644
> --- a/lib/test_vmalloc.c
> +++ b/lib/test_vmalloc.c
> @@ -24,7 +24,7 @@
> MODULE_PARM_DESC(name, msg) \
> 
>  __param(int, nr_threads, 0,
> -   "Number of workers to perform tests(min: 1 max: 1024)");
> +   "Number of workers to perform tests(min: 1 max: 65536)");
> 
>  __param(bool, sequential_test_order, false,
> "Use sequential stress tests order");
> @@ -469,13 +469,13 @@ init_test_configurtion(void)
>  {
> /*
>  * A maximum number of workers is defined as hard-coded
> -* value and set to 1024. We add such gap just in case
> +* value and set to 65536. We add such gap just in case
>  * and for potential heavy stressing.
>  */
> -   nr_threads = clamp(nr_threads, 1, 1024);
> +   nr_threads = clamp(nr_threads, 1, 65536);
> 
> /* Allocate the space for test instances. */
> -   tdriver = kcalloc(nr_threads, sizeof(*tdriver), GFP_KERNEL);
> +   tdriver = kvcalloc(nr_threads, sizeof(*tdriver), GFP_KERNEL);
> if (tdriver == NULL)
> return -1;
> 
> @@ -555,7 +555,7 @@ static void do_concurrent_test(void)
> i, t->stop - t->start);
> }
> 
> -   kfree(tdriver);
> +   kvfree(tdriver);
>  }
> 
>  static int vmalloc_test_init(void)
> 
> Does it sound reasonable for you?

I think so.  It's a test thing so let's give testers more flexibility,
remembering that they don't need as much protection from their own
mistakes.



Re: [PATCH v2 2/2] ext4: Optimize match for casefolded encrypted dirs

2021-04-05 Thread Theodore Ts'o
On Fri, Mar 19, 2021 at 07:34:14AM +, Daniel Rosenberg wrote:
> Matching names with casefolded encrypting directories requires
> decrypting entries to confirm case since we are case preserving. We can
> avoid needing to decrypt if our hash values don't match.
> 
> Signed-off-by: Daniel Rosenberg 

Thanks, applied.

- Ted


Re: [PATCH v2 1/2] ext4: Handle casefolding with encryption

2021-04-05 Thread Theodore Ts'o
On Fri, Mar 19, 2021 at 07:34:13AM +, Daniel Rosenberg wrote:
> This adds support for encryption with casefolding.
> 
> Since the name on disk is case preserving, and also encrypted, we can no
> longer just recompute the hash on the fly. Additionally, to avoid
> leaking extra information from the hash of the unencrypted name, we use
> siphash via an fscrypt v2 policy.
> 
> The hash is stored at the end of the directory entry for all entries
> inside of an encrypted and casefolded directory apart from those that
> deal with '.' and '..'. This way, the change is backwards compatible
> with existing ext4 filesystems.
> 
> Signed-off-by: Daniel Rosenberg 

Applied, thanks with the following addition so that tests, e2fsprogs,
etc., can determine whether or not the currently running kernel has
this feature enabled:

diff --git a/fs/ext4/sysfs.c b/fs/ext4/sysfs.c
index a3d08276d441..7367ba406e01 100644
--- a/fs/ext4/sysfs.c
+++ b/fs/ext4/sysfs.c
@@ -313,6 +313,7 @@ EXT4_ATTR_FEATURE(verity);
 #endif
 EXT4_ATTR_FEATURE(metadata_csum_seed);
 EXT4_ATTR_FEATURE(fast_commit);
+EXT4_ATTR_FEATURE(encrypted_casefold);
 
 static struct attribute *ext4_feat_attrs[] = {
ATTR_LIST(lazy_itable_init),
@@ -330,6 +331,7 @@ static struct attribute *ext4_feat_attrs[] = {
 #endif
ATTR_LIST(metadata_csum_seed),
ATTR_LIST(fast_commit),
+   ATTR_LIST(encrypted_casefold),
NULL,
 };
 ATTRIBUTE_GROUPS(ext4_feat);


Future versions of e2fsprogs may issue a warning if tune2fs or mke2fs
tries to modify or create a file system such that both the encryption
and casefold feature is enabled if it appears that the kernel won't
support this combination.  Daniel, if you could try to get this change
into the Android kernels that are using encrypted casefold, that would
be a good thing.

- Ted


Re: [PATCH rdma-next 00/10] Enable relaxed ordering for ULPs

2021-04-05 Thread Honggang LI
On Mon, Apr 05, 2021 at 08:23:54AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky 
> 
> From Avihai,
> 
> Relaxed Ordering is a PCIe mechanism that relaxes the strict ordering
> imposed on PCI transactions, and thus, can improve performance.
> 
> Until now, relaxed ordering could be set only by user space applications
> for user MRs. The following patch series enables relaxed ordering for the
> kernel ULPs as well. Relaxed ordering is an optional capability, and as
> such, it is ignored by vendors that don't support it.
> 
> The following test results show the performance improvement achieved

Did you test this patchset with CPU does not support relaxed ordering?

We observed significantly performance degradation when run perftest with
relaxed ordering enabled over old CPU.

https://github.com/linux-rdma/perftest/issues/116

thanks



Re: [PATCH 4.9 00/35] 4.9.265-rc1 review

2021-04-05 Thread Guenter Roeck
On Mon, Apr 05, 2021 at 07:22:00PM -0700, Guenter Roeck wrote:
> On Mon, Apr 05, 2021 at 04:51:55PM -0700, Guenter Roeck wrote:
> > On Mon, Apr 05, 2021 at 10:56:29AM -0700, Guenter Roeck wrote:
> > > On Mon, Apr 05, 2021 at 10:53:35AM +0200, Greg Kroah-Hartman wrote:
> > > > This is the start of the stable review cycle for the 4.9.265 release.
> > > > There are 35 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 Wed, 07 Apr 2021 08:50:09 +.
> > > > Anything received after that time might be too late.
> > > > 
> > > 
> > > Build results:
> > >   total: 163 pass: 163 fail: 0
> > > Qemu test results:
> > >   total: 383 pass: 382 fail: 1
> > > Failed tests:
> > >   parisc:generic-32bit_defconfig:smp:net,pcnet:scsi[53C895A]:rootfs
> > > 
> > > In the failing test, the network interfcace instantiates but fails to get
> > > an IP address. This is not a new problem but a new test. For some reason
> > > it only happens with this specific network interface, this specific SCSI
> > > controller, and with v4.9.y. No reason for concern; I'll try to track down
> > > what is going on.
> > > 
> > 
> > Interesting. The problem affects all kernels up to and including
> > v4.19.y. Unlike I thought initially, the problem is not associated
> > with the SCSI controller (that was coincidental) but with pcnet
> > Ethernet interfaces. It has been fixed in the upstream kernel with
> > commit 518a2f1925c3 ("dma-mapping: zero memory returned from
> > dma_alloc_*"). This patch does not apply cleanly to any of the
> > affected kernels. I backported part of it to v4.19.y and v4.9.y
> > and confirmed that it fixes the problem in those branches.
> > 
> > Question is what we should do: try to backport 518a2f1925c3 to v4.19.y
> > and earlier, or stop testing against this specific problem.
> > 
> 
> Another update: The following code change fixes the problem as well.
> Commit 518a2f1925c3 fixes it only as side effect since it clears
> all DMA buffers.
> 
> diff --git a/drivers/net/ethernet/amd/pcnet32.c 
> b/drivers/net/ethernet/amd/pcnet32.c
> index c22bf52d3320..7a25ec8390e4 100644
> --- a/drivers/net/ethernet/amd/pcnet32.c
> +++ b/drivers/net/ethernet/amd/pcnet32.c
> @@ -1967,7 +1967,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, 
> const char *name)
> return -ENOMEM;
> }
> 
> -   lp->rx_ring = pci_alloc_consistent(lp->pci_dev,
> +   lp->rx_ring = pci_zalloc_consistent(lp->pci_dev,
>sizeof(struct pcnet32_rx_head) *
>lp->rx_ring_size,
>>rx_ring_dma_addr);
> 
> I'll submit a patch implementing that; we'll see how it goes.

Sigh. That doesn't work; upstream uses dma_alloc_coherent().
We could apply the patch making the switch, but dma_alloc_coherent()
doesn't clear memory in older kernels (we are back to commit 518a2f1925c3
which is introducing that). I'll just drop pcnet tests for kernels older
than v5.4.

Guenter


[PATCH v2] ecc: delete a useless function declaration

2021-04-05 Thread Meng Yu
This function declaration has been added in 'ecc_curve.h',
delete it in 'crypto/ecc.h'.

Fixes: 4e6602916bc6(crypto: ecdsa - Add support for ECDSA ...)
Signed-off-by: Meng Yu 
---

v1 -> v2: Modify the 'Fixes tag' from '14bb76768275' to '4e6602916bc6 '.

---
 crypto/ecc.h | 8 
 1 file changed, 8 deletions(-)

diff --git a/crypto/ecc.h b/crypto/ecc.h
index 46aa9bc..a006132 100644
--- a/crypto/ecc.h
+++ b/crypto/ecc.h
@@ -56,14 +56,6 @@ static inline void ecc_swap_digits(const u64 *in, u64 *out, 
unsigned int ndigits
 }
 
 /**
- * ecc_get_curve()  - Get a curve given its curve_id
- * @curve_id:  Id of the curve
- *
- * Returns pointer to the curve data, NULL if curve is not available
- */
-const struct ecc_curve *ecc_get_curve(unsigned int curve_id);
-
-/**
  * ecc_is_key_valid() - Validate a given ECDH private key
  *
  * @curve_id:  id representing the curve to use
-- 
2.8.1



Re: [PATCH] csky: remove unused including

2021-04-05 Thread Guo Ren
Acked by

On Tue, Apr 6, 2021 at 9:48 AM Yang Li  wrote:
>
> Fix the following versioncheck warnings:
> ./arch/csky/include/asm/io.h: 8 linux/version.h not needed.
> ./arch/csky/include/asm/uaccess.h: 14 linux/version.h not needed.
> ./arch/csky/kernel/process.c: 5 linux/version.h not needed.
> ./arch/csky/mm/dma-mapping.c: 12 linux/version.h not needed.
>
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 
> ---
>  arch/csky/include/asm/io.h  | 1 -
>  arch/csky/include/asm/uaccess.h | 1 -
>  arch/csky/kernel/process.c  | 1 -
>  arch/csky/mm/dma-mapping.c  | 1 -
>  4 files changed, 4 deletions(-)
>
> diff --git a/arch/csky/include/asm/io.h b/arch/csky/include/asm/io.h
> index f826540..ed53f0b 100644
> --- a/arch/csky/include/asm/io.h
> +++ b/arch/csky/include/asm/io.h
> @@ -5,7 +5,6 @@
>
>  #include 
>  #include 
> -#include 
>
>  /*
>   * I/O memory access primitives. Reads are ordered relative to any
> diff --git a/arch/csky/include/asm/uaccess.h b/arch/csky/include/asm/uaccess.h
> index 3dec272..841e421 100644
> --- a/arch/csky/include/asm/uaccess.h
> +++ b/arch/csky/include/asm/uaccess.h
> @@ -11,7 +11,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>
>  static inline int access_ok(const void *addr, unsigned long size)
> diff --git a/arch/csky/kernel/process.c b/arch/csky/kernel/process.c
> index 3d0ca22..5de0470 100644
> --- a/arch/csky/kernel/process.c
> +++ b/arch/csky/kernel/process.c
> @@ -2,7 +2,6 @@
>  // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
>
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/arch/csky/mm/dma-mapping.c b/arch/csky/mm/dma-mapping.c
> index c3a775a..8244702 100644
> --- a/arch/csky/mm/dma-mapping.c
> +++ b/arch/csky/mm/dma-mapping.c
> @@ -9,7 +9,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>
>  static inline void cache_op(phys_addr_t paddr, size_t size,
> --
> 1.8.3.1
>


-- 
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/


[PATCH 4/4] staging: rtl8712: add space before binary operator

2021-04-05 Thread Deborah Brouwer
Add a space before the binary operator "|" to comply with kernel coding
style.  Identified by checkpatch.

Signed-off-by: Deborah Brouwer 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index ad9ea05504db..116cb812dcb9 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -368,7 +368,7 @@ void r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
0x));
 
/* urb length in cmd_dw1 */
-   pcmd_hdr->cmd_dw1 = cpu_to_le32((pxmitbuf->aggr_nr & 0xff)|
+   pcmd_hdr->cmd_dw1 = cpu_to_le32((pxmitbuf->aggr_nr & 0xff) |
((total_length + TXDESC_SIZE) << 16));
pxmitframe->last[0] = 1;
pxmitframe->bpending[0] = false;
-- 
2.17.1



[PATCH 3/4] staging: rtl8712: remove space after cast

2021-04-05 Thread Deborah Brouwer
Remove the unnecessary space immediately after a cast. Identified by
checkpatch: CHECK: No space is necessary after a cast.

Signed-off-by: Deborah Brouwer 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index 4be81c2546fe..ad9ea05504db 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -228,9 +228,9 @@ void r8712_do_queue_select(struct _adapter *padapter,
struct dvobj_priv *pdvobj = >dvobjpriv;
 
if (pdvobj->nr_endpoint == 6) {
-   qsel = (unsigned int) pattrib->priority;
+   qsel = (unsigned int)pattrib->priority;
} else if (pdvobj->nr_endpoint == 4) {
-   qsel = (unsigned int) pattrib->priority;
+   qsel = (unsigned int)pattrib->priority;
if (qsel == 0 || qsel == 3)
qsel = 3;
else if (qsel == 1 || qsel == 2)
@@ -359,7 +359,7 @@ void r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf,
struct tx_desc *ptxdesc = pxmitbuf->pbuf;
struct cmd_hdr *pcmd_hdr = (struct cmd_hdr *)
(pxmitbuf->pbuf + TXDESC_SIZE);
-   u16 total_length = (u16) (ptxdesc->txdw0 & 0x);
+   u16 total_length = (u16)(ptxdesc->txdw0 & 0x);
 
/* use 1st xmitframe as media */
xmitframe_xmitbuf_attach(pxmitframe, pxmitbuf);
-- 
2.17.1



  1   2   3   4   5   6   7   8   9   10   >