All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/4] ceph: always renew caps if mds_wanted is insufficient
From: Jeff Layton @ 2020-02-20 13:42 UTC (permalink / raw)
  To: Yan, Zheng, ceph-devel
In-Reply-To: <20200220122630.63170-1-zyan@redhat.com>

On Thu, 2020-02-20 at 20:26 +0800, Yan, Zheng wrote:
> Not only after mds closes session and caps get dropped. This is
> preparation patch for not requesting caps for idle open files.
> 
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>

In this kind of series, it's be nice to add a cover letter that explains
the problem you're trying to solve and how you intend to solve it. I'm
lurking on the bug that I know this involves, but not everyone on the
public mailing list will be familiar with it.

> ---
>  fs/ceph/caps.c       | 36 +++++++++++++++---------------------
>  fs/ceph/mds_client.c |  5 -----
>  fs/ceph/super.h      |  1 -
>  3 files changed, 15 insertions(+), 27 deletions(-)
> 

I do like the diffstat, and that fact that it removes a chunk of code
that I guess is no longer needed.

> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index d05717397c2a..293920d013ff 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2659,6 +2659,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
>  		}
>  	} else {
>  		int session_readonly = false;
> +		int mds_wanted;
>  		if (ci->i_auth_cap &&
>  		    (need & (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_EXCL))) {
>  			struct ceph_mds_session *s = ci->i_auth_cap->session;
> @@ -2667,32 +2668,27 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
>  			spin_unlock(&s->s_cap_lock);
>  		}
>  		if (session_readonly) {
> -			dout("get_cap_refs %p needed %s but mds%d readonly\n",
> +			dout("get_cap_refs %p need %s but mds%d readonly\n",
>  			     inode, ceph_cap_string(need), ci->i_auth_cap->mds);
>  			ret = -EROFS;
>  			goto out_unlock;
>  		}
>  
> -		if (ci->i_ceph_flags & CEPH_I_CAP_DROPPED) {
> -			int mds_wanted;
> -			if (READ_ONCE(mdsc->fsc->mount_state) ==
> -			    CEPH_MOUNT_SHUTDOWN) {
> -				dout("get_cap_refs %p forced umount\n", inode);
> -				ret = -EIO;
> -				goto out_unlock;
> -			}
> -			mds_wanted = __ceph_caps_mds_wanted(ci, false);
> -			if (need & ~(mds_wanted & need)) {
> -				dout("get_cap_refs %p caps were dropped"
> -				     " (session killed?)\n", inode);
> -				ret = -ESTALE;
> -				goto out_unlock;
> -			}
> -			if (!(file_wanted & ~mds_wanted))
> -				ci->i_ceph_flags &= ~CEPH_I_CAP_DROPPED;
> +		if (READ_ONCE(mdsc->fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) {
> +			dout("get_cap_refs %p forced umount\n", inode);
> +			ret = -EIO;
> +			goto out_unlock;
> +		}
> +		mds_wanted = __ceph_caps_mds_wanted(ci, false);
> +		if (need & ~mds_wanted) {
> +			dout("get_cap_refs %p need %s > mds_wanted %s\n",
> +			     inode, ceph_cap_string(need),
> +			     ceph_cap_string(mds_wanted));
> +			ret = -ESTALE;
> +			goto out_unlock;

Not directly related to your patch since it did this before, but why
does this cause an -ESTALE return here? ceph seems to have repurposed
the meaning of ESTALE (which usually means "I can't find this inode").

Oh, ok -- it looks like it's being used as an error when the session has
been reconnected.

I think we ought to rework ceph to use a different, more distinct error
code for this purpose that isn't used by exportfs code. I worry that
this could leak into higher layers, when it shouldn't.

include/linux/errno.h has an existing pile of errors to choose from.
Maybe EBADCOOKIE instead? That's only used by the NFS client so it
should be safe for this.

I can look at spinning up a patch for that if you don't want to do it
here.


>  		}
>  
> -		dout("get_cap_refs %p have %s needed %s\n", inode,
> +		dout("get_cap_refs %p have %s need %s\n", inode,
>  		     ceph_cap_string(have), ceph_cap_string(need));
>  	}
>  out_unlock:
> @@ -3646,8 +3642,6 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
>  		goto out_unlock;
>  
>  	if (target < 0) {
> -		if (cap->mds_wanted | cap->issued)
> -			ci->i_ceph_flags |= CEPH_I_CAP_DROPPED;
>  		__ceph_remove_cap(cap, false);
>  		goto out_unlock;
>  	}
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index fab9d6461a65..98d746b3bb53 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1411,8 +1411,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,
>  	dout("removing cap %p, ci is %p, inode is %p\n",
>  	     cap, ci, &ci->vfs_inode);
>  	spin_lock(&ci->i_ceph_lock);
> -	if (cap->mds_wanted | cap->issued)
> -		ci->i_ceph_flags |= CEPH_I_CAP_DROPPED;
>  	__ceph_remove_cap(cap, false);
>  	if (!ci->i_auth_cap) {
>  		struct ceph_cap_flush *cf;
> @@ -1578,9 +1576,6 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
>  			/* mds did not re-issue stale cap */
>  			spin_lock(&ci->i_ceph_lock);
>  			cap->issued = cap->implemented = CEPH_CAP_PIN;
> -			/* make sure mds knows what we want */
> -			if (__ceph_caps_file_wanted(ci) & ~cap->mds_wanted)
> -				ci->i_ceph_flags |= CEPH_I_CAP_DROPPED;
>  			spin_unlock(&ci->i_ceph_lock);
>  		}
>  	} else if (ev == FORCE_RO) {
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 37dc1ac8f6c3..d370f89df358 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -517,7 +517,6 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
>  #define CEPH_I_POOL_RD		(1 << 4)  /* can read from pool */
>  #define CEPH_I_POOL_WR		(1 << 5)  /* can write to pool */
>  #define CEPH_I_SEC_INITED	(1 << 6)  /* security initialized */
> -#define CEPH_I_CAP_DROPPED	(1 << 7)  /* caps were forcibly dropped */

This does a lot more than is explained in the changelog. Dropping a flag
wholesale should warrant explaning why. What did this mean before and
why is it no longer relevant?

>  #define CEPH_I_KICK_FLUSH	(1 << 8)  /* kick flushing caps */
>  #define CEPH_I_FLUSH_SNAPS	(1 << 9)  /* need flush snapss */
>  #define CEPH_I_ERROR_WRITE	(1 << 10) /* have seen write errors */

Let's collapse down the number range since you're removing the flag.
There should be no ABI concerns here.
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply

* [PATCH v2] test-vmstate: Fix memleaks in test_load_qlist
From: kuhn.chenqun @ 2020-02-20 13:41 UTC (permalink / raw)
  To: qemu-devel
  Cc: thuth, zhang.zhanghailiang, quintela, qemu-trivial, dgilbert,
	Chen Qun, ehabkost

From: Chen Qun <kuhn.chenqun@huawei.com>

There is memleak in test_load_qlist().It's not a big deal,
but test-vmstate will fail if sanitizers is enabled.

In addition, "ret" is written twice with the same value
 in test_gtree_load_iommu().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
 tests/test-vmstate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index cea363dd69..f7b3868881 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -1241,7 +1241,6 @@ static void test_gtree_load_iommu(void)
     TestGTreeIOMMU *orig_iommu = create_iommu();
     QEMUFile *fsave, *fload;
     char eof;
-    int ret;
 
     fsave = open_test_file(true);
     qemu_put_buffer(fsave, iommu_dump, sizeof(iommu_dump));
@@ -1250,10 +1249,8 @@ static void test_gtree_load_iommu(void)
 
     fload = open_test_file(false);
     vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1);
-    ret = qemu_file_get_error(fload);
     eof = qemu_get_byte(fload);
-    ret = qemu_file_get_error(fload);
-    g_assert(!ret);
+    g_assert(!qemu_file_get_error(fload));
     g_assert_cmpint(orig_iommu->id, ==, dest_iommu->id);
     g_assert_cmpint(eof, ==, QEMU_VM_EOF);
 
@@ -1395,6 +1392,7 @@ static void test_load_qlist(void)
     compare_containers(orig_container, dest_container);
     free_container(orig_container);
     free_container(dest_container);
+    qemu_fclose(fload);
 }
 
 typedef struct TmpTestStruct {
-- 
2.23.0




^ permalink raw reply related

* Re: [PATCH] xfs/030: fix test for external log device
From: Luis Chamberlain @ 2020-02-20 13:42 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: fstests, linux-xfs
In-Reply-To: <e1ce0ddb-a043-03bc-167c-c36476f0a9ee@redhat.com>

On Wed, Feb 19, 2020 at 08:20:14PM -0600, Eric Sandeen wrote:
> On 2/19/20 8:16 PM, Eric Sandeen wrote:
> > Several tests fail if an external log device is used; in this case
> > the xfs_db invocation fails with a clear indication of why, so fix
> > that as other tests do by testing for and using the external log
> > option if present.
> > 
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> hm self-NAK I didn't realize we had _scratch_xfs_db, better to go
> through and fix all of these sorts of things at once.
> 
> Luis, seems like you have an itch to scratch, no?

I didn't know it was so easy, sure! Since I test rt and logdev
on stable kernels, will give this a crack once I have my new
stable test rig running. Thanks for the proactive approach.

  Luis

^ permalink raw reply

* Re: [dpdk-dev] [dpdk-stable] [PATCH] lib/cmdline_rdline: increase command line buf size
From: Thomas Monjalon @ 2020-02-20 13:42 UTC (permalink / raw)
  To: Wisam Jaddo; +Cc: dev, rasland, stable, olivier.matz, bernard.iremonger
In-Reply-To: <1582204709-7992-1-git-send-email-wisamm@mellanox.com>

Hi,

About the title, I suggest:
cmdline: increase maximum line length

20/02/2020 14:18, Wisam Jaddo:
> The current size of buffer is not enough to fit all allowed items/actions,
> thus it will block a lot of testing.
> 
> Cc: stable@dpdk.org

+Cc maintainers of cmdline and testpmd

> Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
[...]
> -#define RDLINE_BUF_SIZE 512
> +#define RDLINE_BUF_SIZE 2048

I feel 2k is reasonable.
What is the consequence on memory usage?

How critical is this change?
Which kind of command is so long?



^ permalink raw reply

* [igt-dev] ✗ GitLab.Pipeline: failure for series starting with [i-g-t,1/2] lib: Update selftests to use dynamic subtests
From: Patchwork @ 2020-02-20 13:42 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev
In-Reply-To: <20200220125207.16423-1-petri.latvala@intel.com>

== Series Details ==

Series: series starting with [i-g-t,1/2] lib: Update selftests to use dynamic subtests
URL   : https://patchwork.freedesktop.org/series/73710/
State : failure

== Summary ==

ERROR! This series introduces new undocumented tests:

dmabuf@all
drm_mm@all
i915_selftest@live
i915_selftest@mock
i915_selftest@perf
kms_selftest@all

Can you document them as per the requirement in the [CONTRIBUTING.md]?

[Documentation] has more details on how to do this.

Here are few examples:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/commit/0316695d03aa46108296b27f3982ec93200c7a6e
https://gitlab.freedesktop.org/drm/igt-gpu-tools/commit/443cc658e1e6b492ee17bf4f4d891029eb7a205d

Thanks in advance!

[CONTRIBUTING.md]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/blob/master/CONTRIBUTING.md#L19
[Documentation]: https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-describe

Other than that, pipeline status: SUCCESS.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/110829 for the overview.

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/110829
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply

* Re: [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
From: Philippe Mathieu-Daudé @ 2020-02-20 13:43 UTC (permalink / raw)
  To: Eric Blake, Peter Maydell, qemu-devel
  Cc: Fam Zheng, Dmitry Fleytman, kvm, Michael S. Tsirkin, Jason Wang,
	Gerd Hoffmann, Edgar E. Iglesias, Stefano Stabellini,
	Matthew Rosato, qemu-block, David Hildenbrand, Halil Pasic,
	Christian Borntraeger, Hervé Poussineau, Anthony Perard,
	xen-devel, Aleksandar Rikalo, Richard Henderson, Laurent Vivier,
	Thomas Huth, Eduardo Habkost, Stefan Weil, Alistair Francis,
	Richard Henderson, Paul Durrant, Eric Auger, qemu-s390x, qemu-arm,
	Cédric Le Goater, John Snow, David Gibson, Igor Mitsyanko,
	Cornelia Huck, Michael Walle, qemu-ppc, Paolo Bonzini
In-Reply-To: <68120807-6f6b-1602-8208-fd76d64e74bc@redhat.com>

On 2/20/20 2:16 PM, Eric Blake wrote:
> On 2/20/20 7:05 AM, Philippe Mathieu-Daudé wrote:
>> Since its introduction in commit d86a77f8abb, dma_memory_read()
>> always accepted void pointer argument. Remove the unnecessary
>> casts.
>>
>> This commit was produced with the included Coccinelle script
>> scripts/coccinelle/exec_rw_const.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
>>   hw/arm/smmu-common.c                   |  3 +--
>>   hw/arm/smmuv3.c                        | 10 ++++------
>>   hw/sd/sdhci.c                          | 15 +++++----------
>>   4 files changed, 25 insertions(+), 18 deletions(-)
>>   create mode 100644 scripts/coccinelle/exec_rw_const.cocci
>>
>> diff --git a/scripts/coccinelle/exec_rw_const.cocci 
>> b/scripts/coccinelle/exec_rw_const.cocci
>> new file mode 100644
>> index 0000000000..a0054f009d
>> --- /dev/null
>> +++ b/scripts/coccinelle/exec_rw_const.cocci
>> @@ -0,0 +1,15 @@
>> +// Usage:
>> +//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
>> --in-place
> 
> This command line should also use '--macro-file 
> scripts/cocci-macro-file.h' to cover more of the code base (Coccinelle 
> skips portions of the code that uses macros it doesn't recognize).
> 
> 
>> @@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, 
>> ADMADescr *dscr)
>>           }
>>           break;
>>       case SDHC_CTRL_ADMA2_64:
>> -        dma_memory_read(s->dma_as, entry_addr,
>> -                        (uint8_t *)(&dscr->attr), 1);
>> -        dma_memory_read(s->dma_as, entry_addr + 2,
>> -                        (uint8_t *)(&dscr->length), 2);
>> +        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
>> +        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
> 
> The () around &dscr->length are now pointless.

Thanks Eric, patch updated. Peter are you OK if I change the cocci 
header using /* */ as:

-- >8 --
diff --git a/scripts/coccinelle/exec_rw_const.cocci 
b/scripts/coccinelle/exec_rw_const.cocci
index a0054f009d..7e42682240 100644
--- a/scripts/coccinelle/exec_rw_const.cocci
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -1,5 +1,13 @@
-// Usage:
-//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
--in-place
+/*
+  Usage:
+
+    spatch \
+           --macro-file scripts/cocci-macro-file.h \
+           --sp-file scripts/coccinelle/exec_rw_const.cocci \
+           --keep-comments \
+           --in-place \
+           --dir .
+*/

  // Remove useless cast
  @@
@@ -7,9 +15,9 @@ expression E1, E2, E3, E4;
  type T;
  @@
  (
-- dma_memory_read(E1, E2, (T *)E3, E4)
+- dma_memory_read(E1, E2, (T *)(E3), E4)
  + dma_memory_read(E1, E2, E3, E4)
  |
-- dma_memory_write(E1, E2, (T *)E3, E4)
+- dma_memory_write(E1, E2, (T *)(E3), E4)
  + dma_memory_write(E1, E2, E3, E4)
  )
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index d5abdaad41..de63ffb037 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -724,10 +724,10 @@ static void get_adma_description(SDHCIState *s, 
ADMADescr *dscr)
          }
          break;
      case SDHC_CTRL_ADMA2_64:
-        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
-        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
+        dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1);
+        dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2);
          dscr->length = le16_to_cpu(dscr->length);
-        dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
+        dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8);
          dscr->addr = le64_to_cpu(dscr->addr);
          dscr->attr &= (uint8_t) ~0xC0;
          dscr->incr = 12;
---

^ permalink raw reply related

* Re: [RFC PATCH 3/3] mmc: jz4740: Use pm_sleep_ptr() macro
From: Ulf Hansson @ 2020-02-20 13:42 UTC (permalink / raw)
  To: Paul Cercueil, Rafael J . Wysocki
  Cc: Len Brown, Pavel Machek, od, Linux PM, linux-mmc@vger.kernel.org,
	Linux Kernel Mailing List
In-Reply-To: <CAPDyKFquXSB+ztXZQS4MPV20dRN_-CKJkmCF0A97pG+vJYRsbg@mail.gmail.com>

On Thu, 20 Feb 2020 at 14:38, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Tue, 11 Feb 2020 at 17:03, Paul Cercueil <paul@crapouillou.net> wrote:
> >
> > Use the newly introduced pm_sleep_ptr() macro to simplify the code.
> >
> > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> > ---
> >  drivers/mmc/host/jz4740_mmc.c | 12 +++---------
> >  1 file changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
> > index fbae87d1f017..09554f9831de 100644
> > --- a/drivers/mmc/host/jz4740_mmc.c
> > +++ b/drivers/mmc/host/jz4740_mmc.c
> > @@ -1099,24 +1099,18 @@ static int jz4740_mmc_remove(struct platform_device *pdev)
> >         return 0;
> >  }
> >
> > -#ifdef CONFIG_PM_SLEEP
> > -
> > -static int jz4740_mmc_suspend(struct device *dev)
> > +static int __maybe_unused jz4740_mmc_suspend(struct device *dev)
> >  {
> >         return pinctrl_pm_select_sleep_state(dev);
> >  }
> >
> > -static int jz4740_mmc_resume(struct device *dev)
> > +static int __maybe_unused jz4740_mmc_resume(struct device *dev)
> >  {
> >         return pinctrl_select_default_state(dev);
> >  }
> >
> >  static SIMPLE_DEV_PM_OPS(jz4740_mmc_pm_ops, jz4740_mmc_suspend,
> >         jz4740_mmc_resume);
> > -#define JZ4740_MMC_PM_OPS (&jz4740_mmc_pm_ops)
> > -#else
> > -#define JZ4740_MMC_PM_OPS NULL
> > -#endif
>
> All of the above code can be simplified in this way, without having to
> convert into using the new pm_sleep_ptr() macro, below.
>
> The only "penalty" would be that, the struct dev_pm_ops
> (jz4740_mmc_pm_ops) would then be referenced even when CONFIG_PM* is
> unset, thus the compiler would be able to throw it away.

/s/would/would not

[...]

Kind regards
Uffe

^ permalink raw reply

* Re: [Xen-devel] [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
From: Philippe Mathieu-Daudé @ 2020-02-20 13:43 UTC (permalink / raw)
  To: Eric Blake, Peter Maydell, qemu-devel
  Cc: Fam Zheng, Dmitry Fleytman, Matthew Rosato, Michael S. Tsirkin,
	Jason Wang, Gerd Hoffmann, Edgar E. Iglesias, Stefano Stabellini,
	kvm, qemu-block, David Hildenbrand, Halil Pasic,
	Christian Borntraeger, Hervé Poussineau, Anthony Perard,
	xen-devel, Aleksandar Rikalo, David Gibson, Laurent Vivier,
	Thomas Huth, Eduardo Habkost, Stefan Weil, Alistair Francis,
	Richard Henderson, Paul Durrant, Eric Auger, qemu-s390x, qemu-arm,
	Cédric Le Goater, John Snow, Richard Henderson,
	Igor Mitsyanko, Cornelia Huck, Michael Walle, qemu-ppc,
	Paolo Bonzini
In-Reply-To: <68120807-6f6b-1602-8208-fd76d64e74bc@redhat.com>

On 2/20/20 2:16 PM, Eric Blake wrote:
> On 2/20/20 7:05 AM, Philippe Mathieu-Daudé wrote:
>> Since its introduction in commit d86a77f8abb, dma_memory_read()
>> always accepted void pointer argument. Remove the unnecessary
>> casts.
>>
>> This commit was produced with the included Coccinelle script
>> scripts/coccinelle/exec_rw_const.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
>>   hw/arm/smmu-common.c                   |  3 +--
>>   hw/arm/smmuv3.c                        | 10 ++++------
>>   hw/sd/sdhci.c                          | 15 +++++----------
>>   4 files changed, 25 insertions(+), 18 deletions(-)
>>   create mode 100644 scripts/coccinelle/exec_rw_const.cocci
>>
>> diff --git a/scripts/coccinelle/exec_rw_const.cocci 
>> b/scripts/coccinelle/exec_rw_const.cocci
>> new file mode 100644
>> index 0000000000..a0054f009d
>> --- /dev/null
>> +++ b/scripts/coccinelle/exec_rw_const.cocci
>> @@ -0,0 +1,15 @@
>> +// Usage:
>> +//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
>> --in-place
> 
> This command line should also use '--macro-file 
> scripts/cocci-macro-file.h' to cover more of the code base (Coccinelle 
> skips portions of the code that uses macros it doesn't recognize).
> 
> 
>> @@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, 
>> ADMADescr *dscr)
>>           }
>>           break;
>>       case SDHC_CTRL_ADMA2_64:
>> -        dma_memory_read(s->dma_as, entry_addr,
>> -                        (uint8_t *)(&dscr->attr), 1);
>> -        dma_memory_read(s->dma_as, entry_addr + 2,
>> -                        (uint8_t *)(&dscr->length), 2);
>> +        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
>> +        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
> 
> The () around &dscr->length are now pointless.

Thanks Eric, patch updated. Peter are you OK if I change the cocci 
header using /* */ as:

-- >8 --
diff --git a/scripts/coccinelle/exec_rw_const.cocci 
b/scripts/coccinelle/exec_rw_const.cocci
index a0054f009d..7e42682240 100644
--- a/scripts/coccinelle/exec_rw_const.cocci
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -1,5 +1,13 @@
-// Usage:
-//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
--in-place
+/*
+  Usage:
+
+    spatch \
+           --macro-file scripts/cocci-macro-file.h \
+           --sp-file scripts/coccinelle/exec_rw_const.cocci \
+           --keep-comments \
+           --in-place \
+           --dir .
+*/

  // Remove useless cast
  @@
@@ -7,9 +15,9 @@ expression E1, E2, E3, E4;
  type T;
  @@
  (
-- dma_memory_read(E1, E2, (T *)E3, E4)
+- dma_memory_read(E1, E2, (T *)(E3), E4)
  + dma_memory_read(E1, E2, E3, E4)
  |
-- dma_memory_write(E1, E2, (T *)E3, E4)
+- dma_memory_write(E1, E2, (T *)(E3), E4)
  + dma_memory_write(E1, E2, E3, E4)
  )
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index d5abdaad41..de63ffb037 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -724,10 +724,10 @@ static void get_adma_description(SDHCIState *s, 
ADMADescr *dscr)
          }
          break;
      case SDHC_CTRL_ADMA2_64:
-        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
-        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
+        dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1);
+        dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2);
          dscr->length = le16_to_cpu(dscr->length);
-        dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
+        dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8);
          dscr->addr = le64_to_cpu(dscr->addr);
          dscr->attr &= (uint8_t) ~0xC0;
          dscr->incr = 12;
---


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related

* [PATCH v1] Revert "x86: use invd instead of wbinvd in real mode start code"
From: Bin Meng @ 2020-02-20 13:43 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <20200218093724.GH10400@smile.fi.intel.com>

On Tue, Feb 18, 2020 at 5:37 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, Feb 18, 2020 at 08:24:03AM +0800, Bin Meng wrote:
> > On Mon, Feb 17, 2020 at 11:30 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > This reverts commit 0d67fac29f3187e67f4fd3ef15f73e91be2fad12.
> > >
> > > As real hardware testing (*) shows the above mentioned commit
> > > breaks U-Boot on it. Revert for the upcoming release. We may get
> > > more information in the future and optimize the code accordingly.
> > >
> > > (*) om Intel Edison board.
> >
> > on?
>
> Right. Should I resend or you can fix when apply?

No, I fixed it when applying,

>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  arch/x86/cpu/start.S   | 2 +-
> > >  arch/x86/cpu/start16.S | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> >
> > Acked-by: Bin Meng <bmeng.cn@gmail.com>

applied to u-boot-x86, thanks!

^ permalink raw reply

* Re: [PATCH] KVM: x86: enable -Werror
From: Vitaly Kuznetsov @ 2020-02-20 13:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-kernel, kvm
In-Reply-To: <1581535233-42127-1-git-send-email-pbonzini@redhat.com>

Paolo Bonzini <pbonzini@redhat.com> writes:

> Avoid more embarrassing mistakes.  

"avoid more" != "make less" :-)

> At least those that the compiler can catch.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/kvm/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
> index b19ef421084d..4654e97a05cc 100644
> --- a/arch/x86/kvm/Makefile
> +++ b/arch/x86/kvm/Makefile
> @@ -1,6 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  
>  ccflags-y += -Iarch/x86/kvm
> +ccflags-y += -Werror
>  
>  KVM := ../../../virt/kvm

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


^ permalink raw reply

* Re: [PATCH v3 02/20] hw: Remove unnecessary cast when calling dma_memory_read()
From: Philippe Mathieu-Daudé @ 2020-02-20 13:43 UTC (permalink / raw)
  To: Eric Blake, Peter Maydell, qemu-devel
  Cc: Fam Zheng, Dmitry Fleytman, Matthew Rosato, Michael S. Tsirkin,
	Jason Wang, Gerd Hoffmann, Edgar E. Iglesias, Stefano Stabellini,
	kvm, qemu-block, David Hildenbrand, Halil Pasic,
	Christian Borntraeger, Hervé Poussineau, Anthony Perard,
	xen-devel, Aleksandar Rikalo, David Gibson, Laurent Vivier,
	Thomas Huth, Eduardo Habkost, Stefan Weil, Alistair Francis,
	Richard Henderson, Paul Durrant, Eric Auger, qemu-s390x, qemu-arm,
	Cédric Le Goater, John Snow, Richard Henderson,
	Igor Mitsyanko, Cornelia Huck, Michael Walle, qemu-ppc,
	Paolo Bonzini
In-Reply-To: <68120807-6f6b-1602-8208-fd76d64e74bc@redhat.com>

On 2/20/20 2:16 PM, Eric Blake wrote:
> On 2/20/20 7:05 AM, Philippe Mathieu-Daudé wrote:
>> Since its introduction in commit d86a77f8abb, dma_memory_read()
>> always accepted void pointer argument. Remove the unnecessary
>> casts.
>>
>> This commit was produced with the included Coccinelle script
>> scripts/coccinelle/exec_rw_const.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>   scripts/coccinelle/exec_rw_const.cocci | 15 +++++++++++++++
>>   hw/arm/smmu-common.c                   |  3 +--
>>   hw/arm/smmuv3.c                        | 10 ++++------
>>   hw/sd/sdhci.c                          | 15 +++++----------
>>   4 files changed, 25 insertions(+), 18 deletions(-)
>>   create mode 100644 scripts/coccinelle/exec_rw_const.cocci
>>
>> diff --git a/scripts/coccinelle/exec_rw_const.cocci 
>> b/scripts/coccinelle/exec_rw_const.cocci
>> new file mode 100644
>> index 0000000000..a0054f009d
>> --- /dev/null
>> +++ b/scripts/coccinelle/exec_rw_const.cocci
>> @@ -0,0 +1,15 @@
>> +// Usage:
>> +//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
>> --in-place
> 
> This command line should also use '--macro-file 
> scripts/cocci-macro-file.h' to cover more of the code base (Coccinelle 
> skips portions of the code that uses macros it doesn't recognize).
> 
> 
>> @@ -726,13 +724,10 @@ static void get_adma_description(SDHCIState *s, 
>> ADMADescr *dscr)
>>           }
>>           break;
>>       case SDHC_CTRL_ADMA2_64:
>> -        dma_memory_read(s->dma_as, entry_addr,
>> -                        (uint8_t *)(&dscr->attr), 1);
>> -        dma_memory_read(s->dma_as, entry_addr + 2,
>> -                        (uint8_t *)(&dscr->length), 2);
>> +        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
>> +        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
> 
> The () around &dscr->length are now pointless.

Thanks Eric, patch updated. Peter are you OK if I change the cocci 
header using /* */ as:

-- >8 --
diff --git a/scripts/coccinelle/exec_rw_const.cocci 
b/scripts/coccinelle/exec_rw_const.cocci
index a0054f009d..7e42682240 100644
--- a/scripts/coccinelle/exec_rw_const.cocci
+++ b/scripts/coccinelle/exec_rw_const.cocci
@@ -1,5 +1,13 @@
-// Usage:
-//  spatch --sp-file scripts/coccinelle/exec_rw_const.cocci --dir . 
--in-place
+/*
+  Usage:
+
+    spatch \
+           --macro-file scripts/cocci-macro-file.h \
+           --sp-file scripts/coccinelle/exec_rw_const.cocci \
+           --keep-comments \
+           --in-place \
+           --dir .
+*/

  // Remove useless cast
  @@
@@ -7,9 +15,9 @@ expression E1, E2, E3, E4;
  type T;
  @@
  (
-- dma_memory_read(E1, E2, (T *)E3, E4)
+- dma_memory_read(E1, E2, (T *)(E3), E4)
  + dma_memory_read(E1, E2, E3, E4)
  |
-- dma_memory_write(E1, E2, (T *)E3, E4)
+- dma_memory_write(E1, E2, (T *)(E3), E4)
  + dma_memory_write(E1, E2, E3, E4)
  )
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index d5abdaad41..de63ffb037 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -724,10 +724,10 @@ static void get_adma_description(SDHCIState *s, 
ADMADescr *dscr)
          }
          break;
      case SDHC_CTRL_ADMA2_64:
-        dma_memory_read(s->dma_as, entry_addr, (&dscr->attr), 1);
-        dma_memory_read(s->dma_as, entry_addr + 2, (&dscr->length), 2);
+        dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1);
+        dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2);
          dscr->length = le16_to_cpu(dscr->length);
-        dma_memory_read(s->dma_as, entry_addr + 4, (&dscr->addr), 8);
+        dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8);
          dscr->addr = le64_to_cpu(dscr->addr);
          dscr->attr &= (uint8_t) ~0xC0;
          dscr->incr = 12;
---



^ permalink raw reply related

* Re: [PATCH rdma-next 2/2] RDMA/opa_vnic: Delete driver version
From: Leon Romanovsky @ 2020-02-20 13:44 UTC (permalink / raw)
  To: Dennis Dalessandro; +Cc: Doug Ledford, Jason Gunthorpe, RDMA mailing list
In-Reply-To: <a5b477e5-1c2b-055b-b617-76351b290adf@intel.com>

On Thu, Feb 20, 2020 at 08:32:35AM -0500, Dennis Dalessandro wrote:
> On 2/20/2020 2:12 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > The default version provided by "ethtool -i" it the correct way
> > to identify Driver version. There is no need to overwrite it.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >   drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c  | 2 --
> >   drivers/infiniband/ulp/opa_vnic/opa_vnic_internal.h | 1 -
> >   drivers/infiniband/ulp/opa_vnic/opa_vnic_vema.c     | 5 -----
> >   3 files changed, 8 deletions(-)
> >
> > diff --git a/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c b/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > index 8ad7da989a0e..42d557dff19d 100644
> > --- a/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > +++ b/drivers/infiniband/ulp/opa_vnic/opa_vnic_ethtool.c
> > @@ -125,8 +125,6 @@ static void vnic_get_drvinfo(struct net_device *netdev,
> >   			     struct ethtool_drvinfo *drvinfo)
> >   {
> >   	strlcpy(drvinfo->driver, opa_vnic_driver_name, sizeof(drvinfo->driver));
> > -	strlcpy(drvinfo->version, opa_vnic_driver_version,
> > -		sizeof(drvinfo->version));
> >   	strlcpy(drvinfo->bus_info, dev_name(netdev->dev.parent),
> >   		sizeof(drvinfo->bus_info));
> >   }
>
> Is there a patch series to get rid of drvinfo->version? Seems to me if we
> don't want drivers to set it then we don't need it to begin with do we?

Unfortunately struct ethtool_drvinfo is defined in include/uapi/linux/ethtool.h
and we can't change it without breaking ethtool.

My WIP in progress branch (based on net-next) is located here:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=ethtool

At the end of my journey, we will have checkpatch.pl patch and update of
coding style.

>
> Regardless I don't have any objections to the patch. We've been down this
> road with version numbers and I believe this was added to vnic specifically
> to fill in something for ethtool.

And now, you will be able to see real version :)

>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>

Thanks

>
> -Denny

^ permalink raw reply

* Re: [PATCH] NFS: Don't hard-code the fs_type when submounting
From: Patrick Steinhardt @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: trond.myklebust, anna.schumaker, dhowells, linux-nfs
In-Reply-To: <20200220130620.3547817-1-smayhew@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

On Thu, Feb 20, 2020 at 08:06:20AM -0500, Scott Mayhew wrote:
> Hard-coding the fstype causes "nfs4" mounts to appear as "nfs",
> which breaks scripts that do "umount -at nfs4".
> 
> Reported-by: Patrick Steinhardt <ps@pks.im>
> Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> ---
>  fs/nfs/namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
> index ad6077404947..f3ece8ed3203 100644
> --- a/fs/nfs/namespace.c
> +++ b/fs/nfs/namespace.c
> @@ -153,7 +153,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
>  	/* Open a new filesystem context, transferring parameters from the
>  	 * parent superblock, including the network namespace.
>  	 */
> -	fc = fs_context_for_submount(&nfs_fs_type, path->dentry);
> +	fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
>  	if (IS_ERR(fc))
>  		return ERR_CAST(fc);

Thanks for your fix! While this fixes the fstype with mount.nfs4(8),
it still doesn't work when using mount(8):

     $ sudo mount server:/mnt /mnt && findmnt -n -ofstype /mnt
     nfs
     $ sudo umount /mnt
     $ sudo mount.nfs4 server:/mnt /mnt && findmnt -n -ofstype /mnt
     nfs4

I guess the issue is that the kernel doesn't yet know which NFS version
the server provides at the point where `fs_context_for_submount()` is
called.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* [Ocfs2-devel] [PATCH] jbd2: fix ocfs2 corrupt when clearing block group bits
From: wangyan @ 2020-02-20 13:46 UTC (permalink / raw)
  To: jack, tytso; +Cc: linux-ext4, ocfs2-devel@oss.oracle.com, stable, piaojun

I found a NULL pointer dereference in ocfs2_block_group_clear_bits().
The running environment:
	kernel version: 4.19
	A cluster with two nodes, 5 luns mounted on two nodes, and do some
	file operations like dd/fallocate/truncate/rm on every lun with storage
	network disconnection.

The fallocate operation on dm-23-45 caused an null pointer dereference.

The information of NULL pointer dereference as follows:
	[577992.878282] JBD2: Error -5 detected when updating journal superblock for dm-23-45.
	[577992.878290] Aborting journal on device dm-23-45.
	...
	[577992.890778] JBD2: Error -5 detected when updating journal superblock for dm-24-46.
	[577992.890908] __journal_remove_journal_head: freeing b_committed_data
	[577992.890916] (fallocate,88392,52):ocfs2_extend_trans:474 ERROR: status = -30
	[577992.890918] __journal_remove_journal_head: freeing b_committed_data
	[577992.890920] (fallocate,88392,52):ocfs2_rotate_tree_right:2500 ERROR: status = -30
	[577992.890922] __journal_remove_journal_head: freeing b_committed_data
	[577992.890924] (fallocate,88392,52):ocfs2_do_insert_extent:4382 ERROR: status = -30
	[577992.890928] (fallocate,88392,52):ocfs2_insert_extent:4842 ERROR: status = -30
	[577992.890928] __journal_remove_journal_head: freeing b_committed_data
	[577992.890930] (fallocate,88392,52):ocfs2_add_clusters_in_btree:4947 ERROR: status = -30
	[577992.890933] __journal_remove_journal_head: freeing b_committed_data
	[577992.890939] __journal_remove_journal_head: freeing b_committed_data
	[577992.890949] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
	[577992.890950] Mem abort info:
	[577992.890951]   ESR = 0x96000004
	[577992.890952]   Exception class = DABT (current EL), IL = 32 bits
	[577992.890952]   SET = 0, FnV = 0
	[577992.890953]   EA = 0, S1PTW = 0
	[577992.890954] Data abort info:
	[577992.890955]   ISV = 0, ISS = 0x00000004
	[577992.890956]   CM = 0, WnR = 0
	[577992.890958] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000f8da07a9
	[577992.890960] [0000000000000020] pgd=0000000000000000
	[577992.890964] Internal error: Oops: 96000004 [#1] SMP
	[577992.890965] Process fallocate (pid: 88392, stack limit = 0x00000000013db2fd)
	[577992.890968] CPU: 52 PID: 88392 Comm: fallocate Kdump: loaded Tainted: G        W  OE     4.19.36 #1
	[577992.890969] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
	[577992.890971] pstate: 60400009 (nZCv daif +PAN -UAO)
	[577992.891054] pc : _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
	[577992.891082] lr : _ocfs2_free_suballoc_bits+0x618/0x968 [ocfs2]
	[577992.891084] sp : ffff0000c8e2b810
	[577992.891085] x29: ffff0000c8e2b820 x28: 0000000000000000
	[577992.891087] x27: 00000000000006f3 x26: ffffa07957b02e70
	[577992.891089] x25: ffff807c59d50000 x24: 00000000000006f2
	[577992.891091] x23: 0000000000000001 x22: ffff807bd39abc30
	[577992.891093] x21: ffff0000811d9000 x20: ffffa07535d6a000
	[577992.891097] x19: ffff000001681638 x18: ffffffffffffffff
	[577992.891098] x17: 0000000000000000 x16: ffff000080a03df0
	[577992.891100] x15: ffff0000811d9708 x14: 203d207375746174
	[577992.891101] x13: 73203a524f525245 x12: 20373439343a6565
	[577992.891103] x11: 0000000000000038 x10: 0101010101010101
	[577992.891106] x9 : ffffa07c68a85d70 x8 : 7f7f7f7f7f7f7f7f
	[577992.891109] x7 : 0000000000000000 x6 : 0000000000000080
	[577992.891110] x5 : 0000000000000000 x4 : 0000000000000002
	[577992.891112] x3 : ffff000001713390 x2 : 2ff90f88b1c22f00
	[577992.891114] x1 : ffff807bd39abc30 x0 : 0000000000000000
	[577992.891116] Call trace:
	[577992.891139]  _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
	[577992.891162]  _ocfs2_free_clusters+0x100/0x290 [ocfs2]
	[577992.891185]  ocfs2_free_clusters+0x50/0x68 [ocfs2]
	[577992.891206]  ocfs2_add_clusters_in_btree+0x198/0x5e0 [ocfs2]
	[577992.891227]  ocfs2_add_inode_data+0x94/0xc8 [ocfs2]
	[577992.891248]  ocfs2_extend_allocation+0x1bc/0x7a8 [ocfs2]
	[577992.891269]  ocfs2_allocate_extents+0x14c/0x338 [ocfs2]
	[577992.891290]  __ocfs2_change_file_space+0x3f8/0x610 [ocfs2]
	[577992.891309]  ocfs2_fallocate+0xe4/0x128 [ocfs2]
	[577992.891316]  vfs_fallocate+0x11c/0x250
	[577992.891317]  ksys_fallocate+0x54/0x88
	[577992.891319]  __arm64_sys_fallocate+0x28/0x38
	[577992.891323]  el0_svc_common+0x78/0x130
	[577992.891325]  el0_svc_handler+0x38/0x78
	[577992.891327]  el0_svc+0x8/0xc

My analysis process as follows:
ocfs2_fallocate
  __ocfs2_change_file_space
    ocfs2_allocate_extents
      ocfs2_extend_allocation
        ocfs2_add_inode_data
          ocfs2_add_clusters_in_btree
            ocfs2_insert_extent
              ocfs2_do_insert_extent
                ocfs2_rotate_tree_right
                  ocfs2_extend_rotate_transaction
                    ocfs2_extend_trans
                      jbd2_journal_restart
                        jbd2__journal_restart
                          /* handle->h_transaction is NULL,
                           * is_handle_aborted(handle) is true
                           */
                          handle->h_transaction = NULL;
                          start_this_handle
                            return -EROFS;
            ocfs2_free_clusters
              _ocfs2_free_clusters
                _ocfs2_free_suballoc_bits
                  ocfs2_block_group_clear_bits
                    ocfs2_journal_access_gd
                      __ocfs2_journal_access
                        jbd2_journal_get_undo_access
                          /* I think jbd2_write_access_granted() will
                           * return true, because do_get_write_access()
                           * will return -EROFS.
                           */
                          if (jbd2_write_access_granted(...)) return 0;
                          do_get_write_access
                            /* handle->h_transaction is NULL, it will
                             * return -EROFS here, so do_get_write_access()
                             * was not called.
                             */
                            if (is_handle_aborted(handle)) return -EROFS;
                    /* bh2jh(group_bh) is NULL, caused NULL
                       pointer dereference */
                    undo_bg = (struct ocfs2_group_desc *)
                                bh2jh(group_bh)->b_committed_data;

If handle->h_transaction == NULL, then jbd2_write_access_granted()
does not really guarantee that journal_head will stay around,
not even speaking of its b_committed_data. The bh2jh(group_bh)
can be removed after ocfs2_journal_access_gd() and before call
"bh2jh(group_bh)->b_committed_data". So, we should move
is_handle_aborted() check from do_get_write_access() into
jbd2_journal_get_undo_access() and jbd2_journal_get_write_access()
before the call to jbd2_write_access_granted().

Signed-off-by: Yan Wang <wangyan122@huawei.com>
Reviewed-by: Jun Piao <piaojun@huawei.com>
---
 fs/jbd2/transaction.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 2dd848a743ed..d181948c0390 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -936,8 +936,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
 	char *frozen_buffer = NULL;
 	unsigned long start_lock, time_lock;

-	if (is_handle_aborted(handle))
-		return -EROFS;
 	journal = transaction->t_journal;

 	jbd_debug(5, "journal_head %p, force_copy %d\n", jh, force_copy);
@@ -1189,6 +1187,9 @@ int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
 	struct journal_head *jh;
 	int rc;

+	if (is_handle_aborted(handle))
+		return -EROFS;
+
 	if (jbd2_write_access_granted(handle, bh, false))
 		return 0;

@@ -1326,6 +1327,9 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
 	struct journal_head *jh;
 	char *committed_data = NULL;

+	if (is_handle_aborted(handle))
+		return -EROFS;
+
 	if (jbd2_write_access_granted(handle, bh, true))
 		return 0;

-- 
2.19.1

^ permalink raw reply related

* Re: [dpdk-dev] [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
From: Raslan Darawsheh @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Suanming Mou, Slava Ovsiienko, Matan Azrad; +Cc: dev@dpdk.org
In-Reply-To: <AM0PR05MB67078070E1BA534D9A6AFB98C2130@AM0PR05MB6707.eurprd05.prod.outlook.com>

Hi,

Taking this series out of next-net-mlx,
Waiting for a v2, we are seeing a Seg. Fault due to the first patch of this series.


Kindest regards,
Raslan Darawsheh

> -----Original Message-----
> From: Raslan Darawsheh
> Sent: Thursday, February 20, 2020 2:13 PM
> To: Suanming Mou <suanmingm@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Matan Azrad <matan@mellanox.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
> 
> Hi,
> 
> > -----Original Message-----
> > From: Suanming Mou <suanmingm@mellanox.com>
> > Sent: Wednesday, February 19, 2020 4:31 PM
> > To: Slava Ovsiienko <viacheslavo@mellanox.com>; Matan Azrad
> > <matan@mellanox.com>
> > Cc: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>
> > Subject: [PATCH 0/2] net/mlx5: copy the item flags from prefix flow
> >
> > For flow split to several subflows, the match items maybe in the prefix
> > flow, and the actions are split to the suffix flow.
> >
> > In this case, for the actions need the user defined match item will not
> > create correctly.
> >
> > Copy the item layers flags to the suffix flow from prefix flow to fix
> > the issue.
> >
> > This patch series should be applied after:
> >
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> >
> es.dpdk.org%2Fproject%2Fdpdk%2Flist%2F%3Fseries%3D8613&amp;data=0
> >
> 2%7C01%7Crasland%40mellanox.com%7C18e60c79e62d40313b6008d7b5485c
> >
> df%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C6371771947191293
> >
> 09&amp;sdata=QE%2FeFbc3rp1m5KgmtmR%2Bfu5%2B2v%2BeBANO1u80R2
> > PdS9A%3D&amp;reserved=0
> >
> > Suanming Mou (2):
> >   net/mlx5: fix layer flags missing in metadata
> >   net/mlx5: fix lack of match information in meter
> >
> >  drivers/net/mlx5/mlx5_flow.c    | 41 +++++++++++++++++++-------
> >  drivers/net/mlx5/mlx5_flow_dv.c | 64
> > +++++++++++++++++++++++++++++++----------
> >  2 files changed, 79 insertions(+), 26 deletions(-)
> >
> > --
> > 1.8.3.1
> 
> 
> Series applied to next-net-mlx,
> 
> Kindest regards,
> Raslan Darawsheh

^ permalink raw reply

* [PATCH] jbd2: fix ocfs2 corrupt when clearing block group bits
From: wangyan @ 2020-02-20 13:46 UTC (permalink / raw)
  To: jack, tytso; +Cc: linux-ext4, ocfs2-devel@oss.oracle.com, stable, piaojun

I found a NULL pointer dereference in ocfs2_block_group_clear_bits().
The running environment:
	kernel version: 4.19
	A cluster with two nodes, 5 luns mounted on two nodes, and do some
	file operations like dd/fallocate/truncate/rm on every lun with storage
	network disconnection.

The fallocate operation on dm-23-45 caused an null pointer dereference.

The information of NULL pointer dereference as follows:
	[577992.878282] JBD2: Error -5 detected when updating journal superblock for dm-23-45.
	[577992.878290] Aborting journal on device dm-23-45.
	...
	[577992.890778] JBD2: Error -5 detected when updating journal superblock for dm-24-46.
	[577992.890908] __journal_remove_journal_head: freeing b_committed_data
	[577992.890916] (fallocate,88392,52):ocfs2_extend_trans:474 ERROR: status = -30
	[577992.890918] __journal_remove_journal_head: freeing b_committed_data
	[577992.890920] (fallocate,88392,52):ocfs2_rotate_tree_right:2500 ERROR: status = -30
	[577992.890922] __journal_remove_journal_head: freeing b_committed_data
	[577992.890924] (fallocate,88392,52):ocfs2_do_insert_extent:4382 ERROR: status = -30
	[577992.890928] (fallocate,88392,52):ocfs2_insert_extent:4842 ERROR: status = -30
	[577992.890928] __journal_remove_journal_head: freeing b_committed_data
	[577992.890930] (fallocate,88392,52):ocfs2_add_clusters_in_btree:4947 ERROR: status = -30
	[577992.890933] __journal_remove_journal_head: freeing b_committed_data
	[577992.890939] __journal_remove_journal_head: freeing b_committed_data
	[577992.890949] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
	[577992.890950] Mem abort info:
	[577992.890951]   ESR = 0x96000004
	[577992.890952]   Exception class = DABT (current EL), IL = 32 bits
	[577992.890952]   SET = 0, FnV = 0
	[577992.890953]   EA = 0, S1PTW = 0
	[577992.890954] Data abort info:
	[577992.890955]   ISV = 0, ISS = 0x00000004
	[577992.890956]   CM = 0, WnR = 0
	[577992.890958] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000f8da07a9
	[577992.890960] [0000000000000020] pgd=0000000000000000
	[577992.890964] Internal error: Oops: 96000004 [#1] SMP
	[577992.890965] Process fallocate (pid: 88392, stack limit = 0x00000000013db2fd)
	[577992.890968] CPU: 52 PID: 88392 Comm: fallocate Kdump: loaded Tainted: G        W  OE     4.19.36 #1
	[577992.890969] Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
	[577992.890971] pstate: 60400009 (nZCv daif +PAN -UAO)
	[577992.891054] pc : _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
	[577992.891082] lr : _ocfs2_free_suballoc_bits+0x618/0x968 [ocfs2]
	[577992.891084] sp : ffff0000c8e2b810
	[577992.891085] x29: ffff0000c8e2b820 x28: 0000000000000000
	[577992.891087] x27: 00000000000006f3 x26: ffffa07957b02e70
	[577992.891089] x25: ffff807c59d50000 x24: 00000000000006f2
	[577992.891091] x23: 0000000000000001 x22: ffff807bd39abc30
	[577992.891093] x21: ffff0000811d9000 x20: ffffa07535d6a000
	[577992.891097] x19: ffff000001681638 x18: ffffffffffffffff
	[577992.891098] x17: 0000000000000000 x16: ffff000080a03df0
	[577992.891100] x15: ffff0000811d9708 x14: 203d207375746174
	[577992.891101] x13: 73203a524f525245 x12: 20373439343a6565
	[577992.891103] x11: 0000000000000038 x10: 0101010101010101
	[577992.891106] x9 : ffffa07c68a85d70 x8 : 7f7f7f7f7f7f7f7f
	[577992.891109] x7 : 0000000000000000 x6 : 0000000000000080
	[577992.891110] x5 : 0000000000000000 x4 : 0000000000000002
	[577992.891112] x3 : ffff000001713390 x2 : 2ff90f88b1c22f00
	[577992.891114] x1 : ffff807bd39abc30 x0 : 0000000000000000
	[577992.891116] Call trace:
	[577992.891139]  _ocfs2_free_suballoc_bits+0x63c/0x968 [ocfs2]
	[577992.891162]  _ocfs2_free_clusters+0x100/0x290 [ocfs2]
	[577992.891185]  ocfs2_free_clusters+0x50/0x68 [ocfs2]
	[577992.891206]  ocfs2_add_clusters_in_btree+0x198/0x5e0 [ocfs2]
	[577992.891227]  ocfs2_add_inode_data+0x94/0xc8 [ocfs2]
	[577992.891248]  ocfs2_extend_allocation+0x1bc/0x7a8 [ocfs2]
	[577992.891269]  ocfs2_allocate_extents+0x14c/0x338 [ocfs2]
	[577992.891290]  __ocfs2_change_file_space+0x3f8/0x610 [ocfs2]
	[577992.891309]  ocfs2_fallocate+0xe4/0x128 [ocfs2]
	[577992.891316]  vfs_fallocate+0x11c/0x250
	[577992.891317]  ksys_fallocate+0x54/0x88
	[577992.891319]  __arm64_sys_fallocate+0x28/0x38
	[577992.891323]  el0_svc_common+0x78/0x130
	[577992.891325]  el0_svc_handler+0x38/0x78
	[577992.891327]  el0_svc+0x8/0xc

My analysis process as follows:
ocfs2_fallocate
  __ocfs2_change_file_space
    ocfs2_allocate_extents
      ocfs2_extend_allocation
        ocfs2_add_inode_data
          ocfs2_add_clusters_in_btree
            ocfs2_insert_extent
              ocfs2_do_insert_extent
                ocfs2_rotate_tree_right
                  ocfs2_extend_rotate_transaction
                    ocfs2_extend_trans
                      jbd2_journal_restart
                        jbd2__journal_restart
                          /* handle->h_transaction is NULL,
                           * is_handle_aborted(handle) is true
                           */
                          handle->h_transaction = NULL;
                          start_this_handle
                            return -EROFS;
            ocfs2_free_clusters
              _ocfs2_free_clusters
                _ocfs2_free_suballoc_bits
                  ocfs2_block_group_clear_bits
                    ocfs2_journal_access_gd
                      __ocfs2_journal_access
                        jbd2_journal_get_undo_access
                          /* I think jbd2_write_access_granted() will
                           * return true, because do_get_write_access()
                           * will return -EROFS.
                           */
                          if (jbd2_write_access_granted(...)) return 0;
                          do_get_write_access
                            /* handle->h_transaction is NULL, it will
                             * return -EROFS here, so do_get_write_access()
                             * was not called.
                             */
                            if (is_handle_aborted(handle)) return -EROFS;
                    /* bh2jh(group_bh) is NULL, caused NULL
                       pointer dereference */
                    undo_bg = (struct ocfs2_group_desc *)
                                bh2jh(group_bh)->b_committed_data;

If handle->h_transaction == NULL, then jbd2_write_access_granted()
does not really guarantee that journal_head will stay around,
not even speaking of its b_committed_data. The bh2jh(group_bh)
can be removed after ocfs2_journal_access_gd() and before call
"bh2jh(group_bh)->b_committed_data". So, we should move
is_handle_aborted() check from do_get_write_access() into
jbd2_journal_get_undo_access() and jbd2_journal_get_write_access()
before the call to jbd2_write_access_granted().

Signed-off-by: Yan Wang <wangyan122@huawei.com>
Reviewed-by: Jun Piao <piaojun@huawei.com>
---
 fs/jbd2/transaction.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 2dd848a743ed..d181948c0390 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -936,8 +936,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,
 	char *frozen_buffer = NULL;
 	unsigned long start_lock, time_lock;

-	if (is_handle_aborted(handle))
-		return -EROFS;
 	journal = transaction->t_journal;

 	jbd_debug(5, "journal_head %p, force_copy %d\n", jh, force_copy);
@@ -1189,6 +1187,9 @@ int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh)
 	struct journal_head *jh;
 	int rc;

+	if (is_handle_aborted(handle))
+		return -EROFS;
+
 	if (jbd2_write_access_granted(handle, bh, false))
 		return 0;

@@ -1326,6 +1327,9 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
 	struct journal_head *jh;
 	char *committed_data = NULL;

+	if (is_handle_aborted(handle))
+		return -EROFS;
+
 	if (jbd2_write_access_granted(handle, bh, true))
 		return 0;

-- 
2.19.1


^ permalink raw reply related

* Re: [PATCH rdma-next 1/2] RDMA/ipoib: Don't set constant driver version
From: Leon Romanovsky @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Dennis Dalessandro; +Cc: Doug Ledford, Jason Gunthorpe, RDMA mailing list
In-Reply-To: <dc3541f9-720c-7f6c-2073-df5f2b446fa3@intel.com>

On Thu, Feb 20, 2020 at 08:34:00AM -0500, Dennis Dalessandro wrote:
> On 2/20/2020 2:12 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > There is no need to set driver version in in-tree kernel code.
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >   drivers/infiniband/ulp/ipoib/ipoib.h         | 2 --
> >   drivers/infiniband/ulp/ipoib/ipoib_ethtool.c | 3 ---
> >   drivers/infiniband/ulp/ipoib/ipoib_main.c    | 4 ----
> >   3 files changed, 9 deletions(-)
> >
>
> Same comments as the other patch, can we just remove the field from the
> drvinfo struct altogether.

Ahh, and extra thing.

I put default version in ->version before calling to the driver. It
allows for out-of-tree drivers overwrite that field and continue to
manage their internal versions.

Thanks

>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
>

^ permalink raw reply

* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: Mark Rutland, Neil Armstrong, David Airlie, dri-devel,
	Andrzej Hajda, Thierry Reding, Sam Ravnborg, Stephen Rothwell,
	Samuel Holland, Heiko Stuebner, Chen-Yu Tsai, Icenowy Zheng,
	Stephan Gerhold, Jonas Karlman, Torsten Duwe, Rob Herring,
	Maxime Ripard, linux-arm-kernel, Jernej Skrabec, linux-kernel,
	Mark Brown
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>

Hi Vasily,

Thank you for the patch.

On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
> 
> We don't need to pass '-supply' suffix to devm_get_regulator()
> 
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
>  		DRM_DEBUG("No panel found\n");
>  
>  	/* 1.2V digital core power regulator  */
> -	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> +	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
>  	if (IS_ERR(anx6345->dvdd12)) {
>  		DRM_ERROR("dvdd12-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd12);
>  	}
>  
>  	/* 2.5V digital core power regulator  */
> -	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> +	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
>  	if (IS_ERR(anx6345->dvdd25)) {
>  		DRM_ERROR("dvdd25-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd25);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply

* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	Rob Herring, Mark Rutland, Maxime Ripard, Chen-Yu Tsai,
	Andrzej Hajda, Neil Armstrong, Jonas Karlman, Jernej Skrabec,
	Icenowy Zheng, Torsten Duwe, Heiko Stuebner, Linus Walleij,
	Stephan Gerhold, Mark Brown, Stephen Rothwell, Samuel Holland,
	dri-devel, linux-kernel, linux-arm-kernel
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>

Hi Vasily,

Thank you for the patch.

On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
> 
> We don't need to pass '-supply' suffix to devm_get_regulator()
> 
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
>  		DRM_DEBUG("No panel found\n");
>  
>  	/* 1.2V digital core power regulator  */
> -	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> +	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
>  	if (IS_ERR(anx6345->dvdd12)) {
>  		DRM_ERROR("dvdd12-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd12);
>  	}
>  
>  	/* 2.5V digital core power regulator  */
> -	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> +	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
>  	if (IS_ERR(anx6345->dvdd25)) {
>  		DRM_ERROR("dvdd25-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd25);

-- 
Regards,

Laurent Pinchart

^ permalink raw reply

* Re: [Intel-gfx] [PATCH] drm/i915: Distribute switch variables for initialization
From: Ville Syrjälä @ 2020-02-20 13:47 UTC (permalink / raw)
  To: Kees Cook; +Cc: intel-gfx, linux-kernel, Alexander Potapenko
In-Reply-To: <20200220062258.68854-1-keescook@chromium.org>

On Wed, Feb 19, 2020 at 10:22:58PM -0800, Kees Cook wrote:
> Variables declared in a switch statement before any case statements
> cannot be automatically initialized with compiler instrumentation (as
> they are not part of any execution flow). With GCC's proposed automatic
> stack variable initialization feature, this triggers a warning (and they
> don't get initialized). Clang's automatic stack variable initialization
> (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
> doesn't initialize such variables[1].

Silly compilers.

> Note that these warnings (or silent
> skipping) happen before the dead-store elimination optimization phase,
> so even when the automatic initializations are later elided in favor of
> direct initializations, the warnings remain.
> 
> To avoid these problems, move such variables into the "case" where
> they're used or lift them up into the main function body.
> 
> drivers/gpu/drm/i915/display/intel_display.c: In function ‘check_digital_port_conflicts’:
> drivers/gpu/drm/i915/display/intel_display.c:12963:17: warning: statement will never be executed [-Wswitch-unreachable]
> 12963 |    unsigned int port_mask;
>       |                 ^~~~~~~~~
> 
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_get_fifo_size’:
> drivers/gpu/drm/i915/intel_pm.c:474:7: warning: statement will never be executed [-Wswitch-unreachable]
>   474 |   u32 dsparb, dsparb2, dsparb3;
>       |       ^~~~~~
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_atomic_update_fifo’:
> drivers/gpu/drm/i915/intel_pm.c:1997:7: warning: statement will never be executed [-Wswitch-unreachable]
>  1997 |   u32 dsparb, dsparb2, dsparb3;
>       |       ^~~~~~
> 
> [1] https://bugs.llvm.org/show_bug.cgi?id=44916
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c |    6 ++++--
>  drivers/gpu/drm/i915/intel_pm.c              |    4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 064dd99bbc49..c829cd26f99e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -12960,14 +12960,15 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>  		WARN_ON(!connector_state->crtc);
>  
>  		switch (encoder->type) {
> -			unsigned int port_mask;
>  		case INTEL_OUTPUT_DDI:
>  			if (WARN_ON(!HAS_DDI(to_i915(dev))))
>  				break;
>  			/* else, fall through */
>  		case INTEL_OUTPUT_DP:
>  		case INTEL_OUTPUT_HDMI:
> -		case INTEL_OUTPUT_EDP:
> +		case INTEL_OUTPUT_EDP: {
> +			unsigned int port_mask;

This one I'd just remove and s/port_mask/BIT(encoder->port)/
everywhere. Otherwise lgtm.

> +
>  			port_mask = 1 << encoder->port;
>  
>  			/* the same port mustn't appear more than once */
> @@ -12976,6 +12977,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>  
>  			used_ports |= port_mask;
>  			break;
> +		}
>  		case INTEL_OUTPUT_DP_MST:
>  			used_mst_ports |=
>  				1 << encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index bd2d30ecc030..17d8833787c4 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -469,9 +469,9 @@ static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
>  	struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
>  	enum pipe pipe = crtc->pipe;
>  	int sprite0_start, sprite1_start;
> +	u32 dsparb, dsparb2, dsparb3;
>  
>  	switch (pipe) {
> -		u32 dsparb, dsparb2, dsparb3;
>  	case PIPE_A:
>  		dsparb = I915_READ(DSPARB);
>  		dsparb2 = I915_READ(DSPARB2);
> @@ -1969,6 +1969,7 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
>  	const struct vlv_fifo_state *fifo_state =
>  		&crtc_state->wm.vlv.fifo_state;
>  	int sprite0_start, sprite1_start, fifo_size;
> +	u32 dsparb, dsparb2, dsparb3;
>  
>  	if (!crtc_state->fifo_changed)
>  		return;
> @@ -1994,7 +1995,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
>  	spin_lock(&uncore->lock);
>  
>  	switch (crtc->pipe) {
> -		u32 dsparb, dsparb2, dsparb3;
>  	case PIPE_A:
>  		dsparb = intel_uncore_read_fw(uncore, DSPARB);
>  		dsparb2 = intel_uncore_read_fw(uncore, DSPARB2);
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply

* Re: [Intel-gfx] [PATCH] drm/i915: Distribute switch variables for initialization
From: Ville Syrjälä @ 2020-02-20 13:47 UTC (permalink / raw)
  To: Kees Cook
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, intel-gfx,
	Alexander Potapenko, linux-kernel
In-Reply-To: <20200220062258.68854-1-keescook@chromium.org>

On Wed, Feb 19, 2020 at 10:22:58PM -0800, Kees Cook wrote:
> Variables declared in a switch statement before any case statements
> cannot be automatically initialized with compiler instrumentation (as
> they are not part of any execution flow). With GCC's proposed automatic
> stack variable initialization feature, this triggers a warning (and they
> don't get initialized). Clang's automatic stack variable initialization
> (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
> doesn't initialize such variables[1].

Silly compilers.

> Note that these warnings (or silent
> skipping) happen before the dead-store elimination optimization phase,
> so even when the automatic initializations are later elided in favor of
> direct initializations, the warnings remain.
> 
> To avoid these problems, move such variables into the "case" where
> they're used or lift them up into the main function body.
> 
> drivers/gpu/drm/i915/display/intel_display.c: In function ‘check_digital_port_conflicts’:
> drivers/gpu/drm/i915/display/intel_display.c:12963:17: warning: statement will never be executed [-Wswitch-unreachable]
> 12963 |    unsigned int port_mask;
>       |                 ^~~~~~~~~
> 
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_get_fifo_size’:
> drivers/gpu/drm/i915/intel_pm.c:474:7: warning: statement will never be executed [-Wswitch-unreachable]
>   474 |   u32 dsparb, dsparb2, dsparb3;
>       |       ^~~~~~
> drivers/gpu/drm/i915/intel_pm.c: In function ‘vlv_atomic_update_fifo’:
> drivers/gpu/drm/i915/intel_pm.c:1997:7: warning: statement will never be executed [-Wswitch-unreachable]
>  1997 |   u32 dsparb, dsparb2, dsparb3;
>       |       ^~~~~~
> 
> [1] https://bugs.llvm.org/show_bug.cgi?id=44916
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c |    6 ++++--
>  drivers/gpu/drm/i915/intel_pm.c              |    4 ++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 064dd99bbc49..c829cd26f99e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -12960,14 +12960,15 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>  		WARN_ON(!connector_state->crtc);
>  
>  		switch (encoder->type) {
> -			unsigned int port_mask;
>  		case INTEL_OUTPUT_DDI:
>  			if (WARN_ON(!HAS_DDI(to_i915(dev))))
>  				break;
>  			/* else, fall through */
>  		case INTEL_OUTPUT_DP:
>  		case INTEL_OUTPUT_HDMI:
> -		case INTEL_OUTPUT_EDP:
> +		case INTEL_OUTPUT_EDP: {
> +			unsigned int port_mask;

This one I'd just remove and s/port_mask/BIT(encoder->port)/
everywhere. Otherwise lgtm.

> +
>  			port_mask = 1 << encoder->port;
>  
>  			/* the same port mustn't appear more than once */
> @@ -12976,6 +12977,7 @@ static bool check_digital_port_conflicts(struct intel_atomic_state *state)
>  
>  			used_ports |= port_mask;
>  			break;
> +		}
>  		case INTEL_OUTPUT_DP_MST:
>  			used_mst_ports |=
>  				1 << encoder->port;
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index bd2d30ecc030..17d8833787c4 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -469,9 +469,9 @@ static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
>  	struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
>  	enum pipe pipe = crtc->pipe;
>  	int sprite0_start, sprite1_start;
> +	u32 dsparb, dsparb2, dsparb3;
>  
>  	switch (pipe) {
> -		u32 dsparb, dsparb2, dsparb3;
>  	case PIPE_A:
>  		dsparb = I915_READ(DSPARB);
>  		dsparb2 = I915_READ(DSPARB2);
> @@ -1969,6 +1969,7 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
>  	const struct vlv_fifo_state *fifo_state =
>  		&crtc_state->wm.vlv.fifo_state;
>  	int sprite0_start, sprite1_start, fifo_size;
> +	u32 dsparb, dsparb2, dsparb3;
>  
>  	if (!crtc_state->fifo_changed)
>  		return;
> @@ -1994,7 +1995,6 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
>  	spin_lock(&uncore->lock);
>  
>  	switch (crtc->pipe) {
> -		u32 dsparb, dsparb2, dsparb3;
>  	case PIPE_A:
>  		dsparb = intel_uncore_read_fw(uncore, DSPARB);
>  		dsparb2 = intel_uncore_read_fw(uncore, DSPARB2);
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel

^ permalink raw reply

* Re: [PATCH 1/6] drm/bridge: anx6345: Fix getting anx6345 regulators
From: Laurent Pinchart @ 2020-02-20 13:46 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: Mark Rutland, Neil Armstrong, David Airlie, Linus Walleij,
	dri-devel, Andrzej Hajda, Thierry Reding, Sam Ravnborg,
	Stephen Rothwell, Samuel Holland, Heiko Stuebner, Chen-Yu Tsai,
	Icenowy Zheng, Stephan Gerhold, Jonas Karlman, Torsten Duwe,
	Rob Herring, Maxime Ripard, linux-arm-kernel, Jernej Skrabec,
	linux-kernel, Mark Brown, Daniel Vetter
In-Reply-To: <20200220083508.792071-2-anarsoul@gmail.com>

Hi Vasily,

Thank you for the patch.

On Thu, Feb 20, 2020 at 12:35:03AM -0800, Vasily Khoruzhick wrote:
> From: Samuel Holland <samuel@sholland.org>
> 
> We don't need to pass '-supply' suffix to devm_get_regulator()
> 
> Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> index 56f55c53abfd..0d8d083b0207 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
> @@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
>  		DRM_DEBUG("No panel found\n");
>  
>  	/* 1.2V digital core power regulator  */
> -	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
> +	anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
>  	if (IS_ERR(anx6345->dvdd12)) {
>  		DRM_ERROR("dvdd12-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd12);
>  	}
>  
>  	/* 2.5V digital core power regulator  */
> -	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
> +	anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
>  	if (IS_ERR(anx6345->dvdd25)) {
>  		DRM_ERROR("dvdd25-supply not found\n");
>  		return PTR_ERR(anx6345->dvdd25);

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH] s390/sclp: improve special wait psw logic
From: Janosch Frank @ 2020-02-20 13:47 UTC (permalink / raw)
  To: Christian Borntraeger, Cornelia Huck
  Cc: Janosch Frank, David Hildenbrand, qemu-stable, qemu-devel,
	qemu-s390x, Richard Henderson
In-Reply-To: <1582204582-22995-1-git-send-email-borntraeger@de.ibm.com>


[-- Attachment #1.1: Type: text/plain, Size: 960 bytes --]

On 2/20/20 2:16 PM, Christian Borntraeger wrote:
> There is a special quiesce PSW that we check for "shutdown". Otherwise disabled
> wait is detected as "crashed". Architecturally we must only check PSW bits
> 116-127. Fix this.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Acked-by: Janosch Frank <frankja@linux.ibm.com>

> ---
>  target/s390x/helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
> index a3a4916..6808dfd 100644
> --- a/target/s390x/helper.c
> +++ b/target/s390x/helper.c
> @@ -89,7 +89,7 @@ hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr vaddr)
>  static inline bool is_special_wait_psw(uint64_t psw_addr)
>  {
>      /* signal quiesce */
> -    return psw_addr == 0xfffUL;
> +    return (psw_addr & 0xfffUL) == 0xfffUL;
>  }
>  
>  void s390_handle_wait(S390CPU *cpu)
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64
From: Christophe Leroy @ 2020-02-20 13:48 UTC (permalink / raw)
  To: Jason Yan, mpe, linuxppc-dev, diana.craciun, benh, paulus,
	npiggin, keescook, kernel-hardening, oss
  Cc: linux-kernel, zhaohongjiang
In-Reply-To: <20200206025825.22934-4-yanaijie@huawei.com>



Le 06/02/2020 à 03:58, Jason Yan a écrit :
> The implementation for Freescale BookE64 is similar as BookE32. One
> difference is that Freescale BookE64 set up a TLB mapping of 1G during
> booting. Another difference is that ppc64 needs the kernel to be
> 64K-aligned. So we can randomize the kernel in this 1G mapping and make
> it 64K-aligned. This can save some code to creat another TLB map at
> early boot. The disadvantage is that we only have about 1G/64K = 16384
> slots to put the kernel in.
> 
> To support secondary cpu boot up, a variable __kaslr_offset was added in
> first_256B section. This can help secondary cpu get the kaslr offset
> before the 1:1 mapping has been setup.
> 
> Signed-off-by: Jason Yan <yanaijie@huawei.com>
> Cc: Scott Wood <oss@buserror.net>
> Cc: Diana Craciun <diana.craciun@nxp.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Kees Cook <keescook@chromium.org>
> ---
>   arch/powerpc/Kconfig                 |  2 +-
>   arch/powerpc/kernel/exceptions-64e.S | 10 +++++++++
>   arch/powerpc/kernel/head_64.S        |  7 ++++++
>   arch/powerpc/kernel/setup_64.c       |  4 +++-
>   arch/powerpc/mm/mmu_decl.h           | 16 +++++++-------
>   arch/powerpc/mm/nohash/kaslr_booke.c | 33 +++++++++++++++++++++++++---
>   6 files changed, 59 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c150a9d49343..754aeb96bb1c 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -568,7 +568,7 @@ config RELOCATABLE
>   
>   config RANDOMIZE_BASE
>   	bool "Randomize the address of the kernel image"
> -	depends on (FSL_BOOKE && FLATMEM && PPC32)
> +	depends on (PPC_FSL_BOOK3E && FLATMEM)
>   	depends on RELOCATABLE
>   	help
>   	  Randomizes the virtual address at which the kernel image is
> diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
> index 1b9b174bee86..c1c05b8684ca 100644
> --- a/arch/powerpc/kernel/exceptions-64e.S
> +++ b/arch/powerpc/kernel/exceptions-64e.S
> @@ -1378,6 +1378,7 @@ skpinv:	addi	r6,r6,1				/* Increment */
>   1:	mflr	r6
>   	addi	r6,r6,(2f - 1b)
>   	tovirt(r6,r6)
> +	add	r6,r6,r19
>   	lis	r7,MSR_KERNEL@h
>   	ori	r7,r7,MSR_KERNEL@l
>   	mtspr	SPRN_SRR0,r6
> @@ -1400,6 +1401,7 @@ skpinv:	addi	r6,r6,1				/* Increment */
>   
>   	/* We translate LR and return */
>   	tovirt(r8,r8)
> +	add	r8,r8,r19
>   	mtlr	r8
>   	blr
>   
> @@ -1528,6 +1530,7 @@ a2_tlbinit_code_end:
>    */
>   _GLOBAL(start_initialization_book3e)
>   	mflr	r28
> +	li	r19, 0
>   
>   	/* First, we need to setup some initial TLBs to map the kernel
>   	 * text, data and bss at PAGE_OFFSET. We don't have a real mode
> @@ -1570,6 +1573,12 @@ _GLOBAL(book3e_secondary_core_init)
>   	cmplwi	r4,0
>   	bne	2f
>   
> +	li	r19, 0
> +#ifdef CONFIG_RANDOMIZE_BASE
> +	LOAD_REG_ADDR_PIC(r19, __kaslr_offset)
> +	lwz	r19,0(r19)
> +	rlwinm  r19,r19,0,0,5
> +#endif
>   	/* Setup TLB for this core */
>   	bl	initial_tlb_book3e
>   
> @@ -1602,6 +1611,7 @@ _GLOBAL(book3e_secondary_core_init)
>   	lis	r3,PAGE_OFFSET@highest
>   	sldi	r3,r3,32
>   	or	r28,r28,r3
> +	add	r28,r28,r19
>   1:	mtlr	r28
>   	blr
>   
> diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
> index ad79fddb974d..744624140fb8 100644
> --- a/arch/powerpc/kernel/head_64.S
> +++ b/arch/powerpc/kernel/head_64.S
> @@ -104,6 +104,13 @@ __secondary_hold_acknowledge:
>   	.8byte	0x0
>   
>   #ifdef CONFIG_RELOCATABLE
> +#ifdef CONFIG_RANDOMIZE_BASE
> +	. = 0x58
> +	.globl	__kaslr_offset
> +__kaslr_offset:
> +DEFINE_FIXED_SYMBOL(__kaslr_offset)
> +	.long	0
> +#endif
>   	/* This flag is set to 1 by a loader if the kernel should run
>   	 * at the loaded address instead of the linked address.  This
>   	 * is used by kexec-tools to keep the the kdump kernel in the
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 6104917a282d..a16b970a8d1a 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -66,7 +66,7 @@
>   #include <asm/feature-fixups.h>
>   #include <asm/kup.h>
>   #include <asm/early_ioremap.h>
> -

Why remove this new line which clearly separates things in asm/ and 
things in local dir ?

> +#include <mm/mmu_decl.h>
>   #include "setup.h"
>   
>   int spinning_secondaries;
> @@ -300,6 +300,8 @@ void __init early_setup(unsigned long dt_ptr)
>   	/* Enable early debugging if any specified (see udbg.h) */
>   	udbg_early_init();
>   
> +	kaslr_early_init(__va(dt_ptr), 0);
> +
>   	udbg_printf(" -> %s(), dt_ptr: 0x%lx\n", __func__, dt_ptr);
>   
>   	/*
> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
> index 3e1c85c7d10b..bbd721d1e3d7 100644
> --- a/arch/powerpc/mm/mmu_decl.h
> +++ b/arch/powerpc/mm/mmu_decl.h
> @@ -147,14 +147,6 @@ void reloc_kernel_entry(void *fdt, long addr);
>   extern void loadcam_entry(unsigned int index);
>   extern void loadcam_multi(int first_idx, int num, int tmp_idx);
>   
> -#ifdef CONFIG_RANDOMIZE_BASE
> -void kaslr_early_init(void *dt_ptr, phys_addr_t size);
> -void kaslr_late_init(void);
> -#else
> -static inline void kaslr_early_init(void *dt_ptr, phys_addr_t size) {}
> -static inline void kaslr_late_init(void) {}
> -#endif
> -
>   struct tlbcam {
>   	u32	MAS0;
>   	u32	MAS1;
> @@ -164,6 +156,14 @@ struct tlbcam {
>   };
>   #endif
>   
> +#ifdef CONFIG_RANDOMIZE_BASE
> +void kaslr_early_init(void *dt_ptr, phys_addr_t size);
> +void kaslr_late_init(void);
> +#else
> +static inline void kaslr_early_init(void *dt_ptr, phys_addr_t size) {}
> +static inline void kaslr_late_init(void) {}
> +#endif
> +
>   #if defined(CONFIG_PPC_BOOK3S_32) || defined(CONFIG_FSL_BOOKE) || defined(CONFIG_PPC_8xx)
>   /* 6xx have BATS */
>   /* FSL_BOOKE have TLBCAM */
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
> index 07b036e98353..c6f5c1db1394 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -231,7 +231,7 @@ static __init unsigned long get_usable_address(const void *fdt,
>   	unsigned long pa;
>   	unsigned long pa_end;
>   
> -	for (pa = offset; (long)pa > (long)start; pa -= SZ_16K) {
> +	for (pa = offset; (long)pa > (long)start; pa -= SZ_64K) {

Doesn't this modify the behaviour for PPC32 too ?

>   		pa_end = pa + regions.kernel_size;
>   		if (overlaps_region(fdt, pa, pa_end))
>   			continue;
> @@ -265,14 +265,14 @@ static unsigned long __init kaslr_legal_offset(void *dt_ptr, unsigned long rando
>   {
>   	unsigned long koffset = 0;
>   	unsigned long start;
> -	unsigned long index;
>   	unsigned long offset;
>   
> +#ifdef CONFIG_PPC32

Can we use

if (IS_ENABLED(CONFIG_PPC32)) {
	/* 32 bits stuff */
} else {
	/* 64 bits stuff */
}

>   	/*
>   	 * Decide which 64M we want to start
>   	 * Only use the low 8 bits of the random seed
>   	 */
> -	index = random & 0xFF;
> +	unsigned long index = random & 0xFF;

That's not good in terms of readability, index declaration should remain 
at the top of the function, should be possible if using IS_ENABLED() instead

>   	index %= regions.linear_sz / SZ_64M;
>   
>   	/* Decide offset inside 64M */
> @@ -287,6 +287,15 @@ static unsigned long __init kaslr_legal_offset(void *dt_ptr, unsigned long rando
>   			break;
>   		index--;
>   	}
> +#else
> +	/* Decide kernel offset inside 1G */
> +	offset = random % (SZ_1G - regions.kernel_size);
> +	offset = round_down(offset, SZ_64K);
> +
> +	start = memstart_addr;
> +	offset = memstart_addr + offset;
> +	koffset = get_usable_address(dt_ptr, start, offset);
> +#endif
>   
>   	if (koffset != 0)
>   		koffset -= memstart_addr;
> @@ -325,6 +334,7 @@ static unsigned long __init kaslr_choose_location(void *dt_ptr, phys_addr_t size
>   	else
>   		pr_warn("KASLR: No safe seed for randomizing the kernel base.\n");
>   
> +#ifdef CONFIG_PPC32
>   	ram = min_t(phys_addr_t, __max_low_memory, size);
>   	ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true);
>   	linear_sz = min_t(unsigned long, ram, SZ_512M);
> @@ -332,6 +342,7 @@ static unsigned long __init kaslr_choose_location(void *dt_ptr, phys_addr_t size
>   	/* If the linear size is smaller than 64M, do not randmize */
>   	if (linear_sz < SZ_64M)
>   		return 0;
> +#endif
>   
>   	/* check for a reserved-memory node and record its cell sizes */
>   	regions.reserved_mem = fdt_path_offset(dt_ptr, "/reserved-memory");
> @@ -363,6 +374,17 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
>   	unsigned long offset;
>   	unsigned long kernel_sz;
>   
> +#ifdef CONFIG_PPC64

Same, can we use a standard C if/else sequence with 
IS_ENABLED(CONFIG_PPC64) ?

> +	unsigned int *__kaslr_offset = (unsigned int *)(KERNELBASE + 0x58);
> +	unsigned int *__run_at_load = (unsigned int *)(KERNELBASE + 0x5c);
> +
> +	if (*__run_at_load == 1)
> +		return;
> +
> +	/* Setup flat device-tree pointer */
> +	initial_boot_params = dt_ptr;
> +#endif
> +
>   	kernel_sz = (unsigned long)_end - (unsigned long)_stext;
>   
>   	offset = kaslr_choose_location(dt_ptr, size, kernel_sz);
> @@ -372,6 +394,7 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
>   	kernstart_virt_addr += offset;
>   	kernstart_addr += offset;
>   
> +#ifdef CONFIG_PPC32
>   	is_second_reloc = 1;
>   
>   	if (offset >= SZ_64M) {
> @@ -381,6 +404,10 @@ notrace void __init kaslr_early_init(void *dt_ptr, phys_addr_t size)
>   		/* Create kernel map to relocate in */
>   		create_kaslr_tlb_entry(1, tlb_virt, tlb_phys);
>   	}
> +#else
> +	*__kaslr_offset = kernstart_virt_addr - KERNELBASE;
> +	*__run_at_load = 1;
> +#endif
>   
>   	/* Copy the kernel to it's new location and run */
>   	memcpy((void *)kernstart_virt_addr, (void *)_stext, kernel_sz);
> 

Christophe

^ permalink raw reply

* [Cluster-devel] [PATCH v7 14/24] btrfs: Convert from readpages to readahead
From: Matthew Wilcox @ 2020-02-20 13:48 UTC (permalink / raw)
  To: cluster-devel.redhat.com
In-Reply-To: <SN4PR0401MB35987D7B76007B93B1C5CE5E9B130@SN4PR0401MB3598.namprd04.prod.outlook.com>

On Thu, Feb 20, 2020 at 09:42:19AM +0000, Johannes Thumshirn wrote:
> On 19/02/2020 22:03, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > 
> > Use the new readahead operation in btrfs.  Add a
> > readahead_for_each_batch() iterator to optimise the loop in the XArray.
> 
> OK I must admit I haven't followed this series closely, but what 
> happened to said readahead_for_each_batch()?
> 
> As far as I can see it's now:
> 
> [...]
> > +	while ((nr = readahead_page_batch(rac, pagepool))) {

Oops, forgot to update the changelog there.  Yes, that's exactly what it
changed to.  That discussion was here:

https://lore.kernel.org/linux-fsdevel/20200219144117.GP24185 at bombadil.infradead.org/

... and then Christoph pointed out the iterators weren't really adding
much value at that point, so they got deleted.  New changelog for
this patch:

btrfs: Convert from readpages to readahead
  
Implement the new readahead method in btrfs.  Add a readahead_page_batch()
to optimise fetching a batch of pages at once.




^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.