* Re: [PATCH v3 09/10] arm64: tegra: enable AHUB modules for few Tegra chips
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
digetx-Re5JQEeQqe8AvxtiuMwx3w, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
sharadg-DDmLM1+adcrQT0dZR+AlfA, mkumard-DDmLM1+adcrQT0dZR+AlfA,
viswanathl-DDmLM1+adcrQT0dZR+AlfA,
rlokhande-DDmLM1+adcrQT0dZR+AlfA, dramesh-DDmLM1+adcrQT0dZR+AlfA,
atalambedu-DDmLM1+adcrQT0dZR+AlfA
In-Reply-To: <1582180492-25297-10-git-send-email-spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables AHUB, ADMAIF modules for following Tegra platforms.
> Along with this specific instances of I/O modules are enabled as per
> the board design.
>
> * Jetson TX1
> - I2S1, I2S2, I2S3, I2S4 and I2S5
> - DMIC1, DMIC2 and DMIC3
>
> * Jetson TX2
> - I2S1, I2S2, I2S3, I2S4, I2S5 and I2S6
> - DMIC1, DMIC2 and DMIC3
> - DSPK2
>
> * Jetson AGX Xavier
> - I2S1, I2S2, I2S4 and I2S6
> - DMIC2 and DMIC3
> - DSPK1
>
> Signed-off-by: Sameer Pujar <spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 48 ++++++++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 36 ++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 40 ++++++++++++++++++
> 3 files changed, 124 insertions(+)
Thanks!
Reviewed-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [PATCH v3 09/10] arm64: tegra: enable AHUB modules for few Tegra chips
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex, tiwai, robh+dt
Cc: broonie, lgirdwood, thierry.reding, digetx, alsa-devel,
devicetree, linux-tegra, linux-kernel, sharadg, mkumard,
viswanathl, rlokhande, dramesh, atalambedu
In-Reply-To: <1582180492-25297-10-git-send-email-spujar@nvidia.com>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables AHUB, ADMAIF modules for following Tegra platforms.
> Along with this specific instances of I/O modules are enabled as per
> the board design.
>
> * Jetson TX1
> - I2S1, I2S2, I2S3, I2S4 and I2S5
> - DMIC1, DMIC2 and DMIC3
>
> * Jetson TX2
> - I2S1, I2S2, I2S3, I2S4, I2S5 and I2S6
> - DMIC1, DMIC2 and DMIC3
> - DSPK2
>
> * Jetson AGX Xavier
> - I2S1, I2S2, I2S4 and I2S6
> - DMIC2 and DMIC3
> - DSPK1
>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
> arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 48 ++++++++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 36 ++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 40 ++++++++++++++++++
> 3 files changed, 124 insertions(+)
Thanks!
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [PATCH v2] arm64:kgdb: Fix kernel single-stepping
From: Corey Minyard @ 2020-02-20 14:52 UTC (permalink / raw)
To: Daniel Thompson
Cc: Will Deacon, Catalin Marinas, linux-arm-kernel, linux-kernel,
Corey Minyard
In-Reply-To: <20200220140650.tryvv3ishkxduujk@holly.lan>
On Thu, Feb 20, 2020 at 02:06:50PM +0000, Daniel Thompson wrote:
> On Wed, Feb 19, 2020 at 09:24:03AM -0600, minyard@acm.org wrote:
> > From: Corey Minyard <cminyard@mvista.com>
> >
> > I was working on a single-step bug on kgdb on an ARM64 system, and I saw
> > this scenario:
> >
> > * A single step is setup to return to el1
> > * The ERET return to el1
> > * An interrupt is pending and runs before the instruction
> > * As soon as PSTATE.D (the debug disable bit) is cleared, the single
> > step happens in that location, not where it should have.
> >
> > This appears to be due to PSTATE.SS not being cleared when the exception
> > happens. Per section D.2.12.5 of the ARMv8 reference manual, that
> > appears to be incorrect, it says "As part of exception entry, the PE
> > does all of the following: ... Sets PSTATE.SS to 0."
> >
> > However, I appear to not be the first person who has noticed this. In
> > the el0-only portion of the kernel_entry macro in entry.S, I found the
> > following comment: "Ensure MDSCR_EL1.SS is clear, since we can unmask
> > debug exceptions when scheduling." Exactly the same scenario, except
> > coming from a userland single step, not a kernel one.
> >
> > As I was studying this, though, I realized that the following scenario
> > had an issue:
> >
> > * Kernel enables MDSCR.SS, MDSCR.KDE, MDSCR.MDE (unnecessary), and
> > PSTATE.SS to enable a single step in el1, for kgdb or kprobes,
> > on the current CPU's MDSCR register and the process' PSTATE.SS
> > register.
> > * Kernel returns from the exception with ERET.
> > * An interrupt or page fault happens on the instruction, causing the
> > instruction to not be run, but the exception handler runs.
> > * The exception causes the task to migrate to a new core.
> > * The return from the exception runs on a different processor now,
> > where the MDSCR values are not set up for a single step.
> > * The single step fails to happen.
> >
> > This is bad for kgdb, of course, but it seems really bad for kprobes if
> > this happens.
> >
> > To fix both these problems, rework the handling of single steps to clear
> > things out upon entry to the kernel from el1, and then to set up single
> > step when returning to el1, and not do the setup in debug-monitors.c.
> > This means that single stepping does not use
> > enable/disable_debug_monitors(); it is no longer necessary to track
> > those flags for single stepping. This is much like single stepping is
> > handled for el0. A new flag is added in pt_regs to enable single
> > stepping from el1. Unfortunately, the old value of PSTATE.SS cannot be
> > used for this because of the hardware bug mentioned earlier.
> >
> > As part of this, there is an interaction between single stepping and the
> > other users of debug monitors with the MDSCR.KDE bit. That bit has to
> > be set for both hardware breakpoints at el1 and single stepping at el1.
> > A new variable was created to store the cpu-wide value of MDSCR.KDE; the
> > single stepping code makes sure not to clear that bit on kernel entry if
> > it's set in the per-cpu variable.
> >
> > After fixing this and doing some more testing, I ran into another issue:
> >
> > * Kernel enables the pt_regs single step
> > * Kernel returns from the exception with ERET.
> > * An interrupt or page fault happens on the instruction, causing the
> > instruction to not be run, but the exception handler runs.
> > * The exception handling hits a breakpoint and stops.
> > * The user continues from the breakpoint, so the kernel is no longer
> > expecting a single step.
> > * On the return from the first exception, the single step flag in
> > pt_regs is still set, so a single step trap happens.
> > * The kernel keels over from an unexpected single step.
> >
> > There's no easy way to find the pt_regs that has the single step flag
> > set. So a thread info flag was added so that the single step could be
> > disabled in this case. Both that flag and the flag in pt_regs must be
> > set to enable a single step.
> >
> > Signed-off-by: Corey Minyard <cminyard@mvista.com>
>
> I've pointed the kgdbtest suite at this patch (and run one of the
> historically unstable test cases an extra 100 times just in case).
>
> kgdbtest hasn't got great coverage, runs the code in qemu and some
> of the strongest tests are still marked XFAIL on arm64 (for reasons
> unrelated to stepping).
>
> So the best I can say based on the above is that the test suite does not
> observe any regression (but equally no improvement). Nevertheless FWIW:
Thanks for testing this. This is not a surprise, you would either have
to have a broken processor like the one I'm using, or you would have to
have a migration occur on the instruction being single-stepped, which
would be extremely unlikely.
Since I've already gained some experience here, I'll try to look at
fixing things here for ARM64.
-corey
>
>
> Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
>
>
> Daniel.
^ permalink raw reply
* Re: [PATCH v3 10/10] arm64: defconfig: enable AHUB components for Tegra210 and later
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex-/Fr2/VpizcU, tiwai-IBi9RG/b67k,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
digetx-Re5JQEeQqe8AvxtiuMwx3w, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
sharadg-DDmLM1+adcrQT0dZR+AlfA, mkumard-DDmLM1+adcrQT0dZR+AlfA,
viswanathl-DDmLM1+adcrQT0dZR+AlfA,
rlokhande-DDmLM1+adcrQT0dZR+AlfA, dramesh-DDmLM1+adcrQT0dZR+AlfA,
atalambedu-DDmLM1+adcrQT0dZR+AlfA
In-Reply-To: <1582180492-25297-11-git-send-email-spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables following configs:
> +CONFIG_TEGRA_ACONNECT=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
>
> This patch helps to register AHUB and its clients (I2S, DMIC, DSPK, ADMAIF)
> with ASoC core. Since AHUB is child of ACONNECT, config TEGRA_ACONNECT is
> enabled as well.
>
> Signed-off-by: Sameer Pujar <spujar-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> arch/arm64/configs/defconfig | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index c8801be..784ca4f 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -207,6 +207,7 @@ CONFIG_FW_LOADER_USER_HELPER=y
> CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
> CONFIG_HISILICON_LPC=y
> CONFIG_SIMPLE_PM_BUS=y
> +CONFIG_TEGRA_ACONNECT=m
> CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_RAW_NAND=y
> @@ -590,6 +591,12 @@ CONFIG_SND_SOC_RK3399_GRU_SOUND=m
> CONFIG_SND_SOC_SAMSUNG=y
> CONFIG_SND_SOC_RCAR=m
> CONFIG_SND_SUN4I_SPDIF=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
> CONFIG_SND_SOC_AK4613=m
> CONFIG_SND_SOC_ES7134=m
> CONFIG_SND_SOC_ES7241=m
Thanks!
Reviewed-by: Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [PATCH v3 10/10] arm64: defconfig: enable AHUB components for Tegra210 and later
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex, tiwai, robh+dt
Cc: broonie, lgirdwood, thierry.reding, digetx, alsa-devel,
devicetree, linux-tegra, linux-kernel, sharadg, mkumard,
viswanathl, rlokhande, dramesh, atalambedu
In-Reply-To: <1582180492-25297-11-git-send-email-spujar@nvidia.com>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables following configs:
> +CONFIG_TEGRA_ACONNECT=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
>
> This patch helps to register AHUB and its clients (I2S, DMIC, DSPK, ADMAIF)
> with ASoC core. Since AHUB is child of ACONNECT, config TEGRA_ACONNECT is
> enabled as well.
>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
> arch/arm64/configs/defconfig | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index c8801be..784ca4f 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -207,6 +207,7 @@ CONFIG_FW_LOADER_USER_HELPER=y
> CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
> CONFIG_HISILICON_LPC=y
> CONFIG_SIMPLE_PM_BUS=y
> +CONFIG_TEGRA_ACONNECT=m
> CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_RAW_NAND=y
> @@ -590,6 +591,12 @@ CONFIG_SND_SOC_RK3399_GRU_SOUND=m
> CONFIG_SND_SOC_SAMSUNG=y
> CONFIG_SND_SOC_RCAR=m
> CONFIG_SND_SUN4I_SPDIF=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
> CONFIG_SND_SOC_AK4613=m
> CONFIG_SND_SOC_ES7134=m
> CONFIG_SND_SOC_ES7241=m
Thanks!
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [PATCH v3 09/10] arm64: tegra: enable AHUB modules for few Tegra chips
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex, tiwai, robh+dt
Cc: devicetree, alsa-devel, atalambedu, lgirdwood, linux-kernel,
viswanathl, sharadg, broonie, thierry.reding, linux-tegra, digetx,
rlokhande, mkumard, dramesh
In-Reply-To: <1582180492-25297-10-git-send-email-spujar@nvidia.com>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables AHUB, ADMAIF modules for following Tegra platforms.
> Along with this specific instances of I/O modules are enabled as per
> the board design.
>
> * Jetson TX1
> - I2S1, I2S2, I2S3, I2S4 and I2S5
> - DMIC1, DMIC2 and DMIC3
>
> * Jetson TX2
> - I2S1, I2S2, I2S3, I2S4, I2S5 and I2S6
> - DMIC1, DMIC2 and DMIC3
> - DSPK2
>
> * Jetson AGX Xavier
> - I2S1, I2S2, I2S4 and I2S6
> - DMIC2 and DMIC3
> - DSPK1
>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
> arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 48 ++++++++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 36 ++++++++++++++++
> arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 40 ++++++++++++++++++
> 3 files changed, 124 insertions(+)
Thanks!
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [PATCH v5 03/12] ceph: add infrastructure for waiting for async create to complete
From: Jeff Layton @ 2020-02-20 14:53 UTC (permalink / raw)
To: Yan, Zheng
Cc: ceph-devel, Ilya Dryomov, Sage Weil, Zheng Yan, Patrick Donnelly,
Xiubo Li
In-Reply-To: <CAAM7YAk0B5ANUT+B8sK1ddgFxBcinVXjiF9KpAdfU5chKWDX1g@mail.gmail.com>
On Thu, 2020-02-20 at 21:33 +0800, Yan, Zheng wrote:
> On Thu, Feb 20, 2020 at 9:01 PM Jeff Layton <jlayton@kernel.org> wrote:
> > On Thu, 2020-02-20 at 11:32 +0800, Yan, Zheng wrote:
> > > On Wed, Feb 19, 2020 at 9:27 PM Jeff Layton <jlayton@kernel.org> wrote:
> > > > When we issue an async create, we must ensure that any later on-the-wire
> > > > requests involving it wait for the create reply.
> > > >
> > > > Expand i_ceph_flags to be an unsigned long, and add a new bit that
> > > > MDS requests can wait on. If the bit is set in the inode when sending
> > > > caps, then don't send it and just return that it has been delayed.
> > > >
> > > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > > ---
> > > > fs/ceph/caps.c | 13 ++++++++++++-
> > > > fs/ceph/dir.c | 2 +-
> > > > fs/ceph/mds_client.c | 20 +++++++++++++++++++-
> > > > fs/ceph/mds_client.h | 7 +++++++
> > > > fs/ceph/super.h | 4 +++-
> > > > 5 files changed, 42 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> > > > index d05717397c2a..85e13aa359d2 100644
> > > > --- a/fs/ceph/caps.c
> > > > +++ b/fs/ceph/caps.c
> > > > @@ -511,7 +511,7 @@ static void __cap_delay_requeue(struct ceph_mds_client *mdsc,
> > > > struct ceph_inode_info *ci,
> > > > bool set_timeout)
> > > > {
> > > > - dout("__cap_delay_requeue %p flags %d at %lu\n", &ci->vfs_inode,
> > > > + dout("__cap_delay_requeue %p flags 0x%lx at %lu\n", &ci->vfs_inode,
> > > > ci->i_ceph_flags, ci->i_hold_caps_max);
> > > > if (!mdsc->stopping) {
> > > > spin_lock(&mdsc->cap_delay_lock);
> > > > @@ -1294,6 +1294,13 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
> > > > int delayed = 0;
> > > > int ret;
> > > >
> > > > + /* Don't send anything if it's still being created. Return delayed */
> > > > + if (ci->i_ceph_flags & CEPH_I_ASYNC_CREATE) {
> > > > + spin_unlock(&ci->i_ceph_lock);
> > > > + dout("%s async create in flight for %p\n", __func__, inode);
> > > > + return 1;
> > > > + }
> > > > +
> > >
> > > Maybe it's better to check this in ceph_check_caps(). Other callers
> > > of __send_cap() shouldn't encounter async creating inode
> > >
> >
> > I've been looking, but what actually guarantees that?
> >
> > Only ceph_check_caps calls it for UPDATE, but the other two callers call
> > it for FLUSH. I don't see what prevents the kernel from (e.g.) calling
> > write_inode before the create reply comes in, particularly if we just
> > create and then close the file.
> >
>
> I missed write_inode case. but make __send_cap() skip sending message
> can cause problem. For example, if we skip a message that flush dirty
> caps. call ceph_check_caps() again may not re-do the flush.
>
Ugh. Ok, so I guess we'll need to fix that first. I assume that making
sure the flush is redone after being delayed is the right thing to do
here?
> > As a side note, I still struggle with the fact thatthere seems to be no
> > coherent overall description of the cap protocol. What distinguishes a
> > FLUSH from an UPDATE, for instance? The MDS code and comments seem to
> > treat them somewhat interchangeably.
> >
>
> UPDATE is super set of FLUSH, UPDATE can always replace FLUSH.
>
I'll toss this note onto my jumble of notes, for my (eventual) planned
document that describes the cap protocol.
> > > > held = cap->issued | cap->implemented;
> > > > revoking = cap->implemented & ~cap->issued;
> > > > retain &= ~revoking;
> > > > @@ -2250,6 +2257,10 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
> > > > if (datasync)
> > > > goto out;
> > > >
> > > > + ret = ceph_wait_on_async_create(inode);
> > > > + if (ret)
> > > > + goto out;
> > > > +
> > > > dirty = try_flush_caps(inode, &flush_tid);
> > > > dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
> > > >
> > > > diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> > > > index a87274935a09..5b83bda57056 100644
> > > > --- a/fs/ceph/dir.c
> > > > +++ b/fs/ceph/dir.c
> > > > @@ -752,7 +752,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
> > > > struct ceph_dentry_info *di = ceph_dentry(dentry);
> > > >
> > > > spin_lock(&ci->i_ceph_lock);
> > > > - dout(" dir %p flags are %d\n", dir, ci->i_ceph_flags);
> > > > + dout(" dir %p flags are 0x%lx\n", dir, ci->i_ceph_flags);
> > > > if (strncmp(dentry->d_name.name,
> > > > fsc->mount_options->snapdir_name,
> > > > dentry->d_name.len) &&
> > > > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> > > > index 94d18e643a3d..38eb9dd5062b 100644
> > > > --- a/fs/ceph/mds_client.c
> > > > +++ b/fs/ceph/mds_client.c
> > > > @@ -2730,7 +2730,7 @@ static void kick_requests(struct ceph_mds_client *mdsc, int mds)
> > > > int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir,
> > > > struct ceph_mds_request *req)
> > > > {
> > > > - int err;
> > > > + int err = 0;
> > > >
> > > > /* take CAP_PIN refs for r_inode, r_parent, r_old_dentry */
> > > > if (req->r_inode)
> > > > @@ -2743,6 +2743,24 @@ int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir,
> > > > ceph_get_cap_refs(ceph_inode(req->r_old_dentry_dir),
> > > > CEPH_CAP_PIN);
> > > >
> > > > + if (req->r_inode) {
> > > > + err = ceph_wait_on_async_create(req->r_inode);
> > > > + if (err) {
> > > > + dout("%s: wait for async create returned: %d\n",
> > > > + __func__, err);
> > > > + return err;
> > > > + }
> > > > + }
> > > > +
> > > > + if (!err && req->r_old_inode) {
> > > > + err = ceph_wait_on_async_create(req->r_old_inode);
> > > > + if (err) {
> > > > + dout("%s: wait for async create returned: %d\n",
> > > > + __func__, err);
> > > > + return err;
> > > > + }
> > > > + }
> > > > +
> > > > dout("submit_request on %p for inode %p\n", req, dir);
> > > > mutex_lock(&mdsc->mutex);
> > > > __register_request(mdsc, req, dir);
> > > > diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
> > > > index 95ac00e59e66..8043f2b439b1 100644
> > > > --- a/fs/ceph/mds_client.h
> > > > +++ b/fs/ceph/mds_client.h
> > > > @@ -538,4 +538,11 @@ extern void ceph_mdsc_open_export_target_sessions(struct ceph_mds_client *mdsc,
> > > > extern int ceph_trim_caps(struct ceph_mds_client *mdsc,
> > > > struct ceph_mds_session *session,
> > > > int max_caps);
> > > > +static inline int ceph_wait_on_async_create(struct inode *inode)
> > > > +{
> > > > + struct ceph_inode_info *ci = ceph_inode(inode);
> > > > +
> > > > + return wait_on_bit(&ci->i_ceph_flags, CEPH_ASYNC_CREATE_BIT,
> > > > + TASK_INTERRUPTIBLE);
> > > > +}
> > > > #endif
> > > > diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> > > > index 3430d7ffe8f7..bfb03adb4a08 100644
> > > > --- a/fs/ceph/super.h
> > > > +++ b/fs/ceph/super.h
> > > > @@ -316,7 +316,7 @@ struct ceph_inode_info {
> > > > u64 i_inline_version;
> > > > u32 i_time_warp_seq;
> > > >
> > > > - unsigned i_ceph_flags;
> > > > + unsigned long i_ceph_flags;
> > > > atomic64_t i_release_count;
> > > > atomic64_t i_ordered_count;
> > > > atomic64_t i_complete_seq[2];
> > > > @@ -524,6 +524,8 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
> > > > #define CEPH_I_ERROR_WRITE (1 << 10) /* have seen write errors */
> > > > #define CEPH_I_ERROR_FILELOCK (1 << 11) /* have seen file lock errors */
> > > > #define CEPH_I_ODIRECT (1 << 12) /* inode in direct I/O mode */
> > > > +#define CEPH_ASYNC_CREATE_BIT (13) /* async create in flight for this */
> > > > +#define CEPH_I_ASYNC_CREATE (1 << CEPH_ASYNC_CREATE_BIT)
> > > >
> > > > /*
> > > > * Masks of ceph inode work.
> > > > --
> > > > 2.24.1
> > > >
> >
> > --
> > Jeff Layton <jlayton@kernel.org>
> >
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply
* [dpdk-dev] [PATCH v3] cmdline: increase maximum line length
From: Wisam Jaddo @ 2020-02-20 14:53 UTC (permalink / raw)
To: dev, rasland, thomas; +Cc: olivier.matz, bernard.iremonger, stable
In-Reply-To: <1582204709-7992-1-git-send-email-wisamm@mellanox.com>
This increase due to the usage of cmdline in dpdk applications
as config commands such as testpmd do for rte_flow rules creation.
The current size of buffer is not enough to fill
many cases of rte_flow commands validation/creation.
rte_flow now can have outer items, inner items, modify
actions, meta data actions, duplicate action, fate action and
more in one single rte flow, thus 512 char will not be enough
to validate such rte flow rules.
Such change shouldn't affect the memory since the cmdline
reading again using the same buffer.
Cc: stable@dpdk.org
Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
---
changes in v3
* Fix commit title
Previous title was not that clear of what the change is
* Add more clarification for what we need such increase
* Explain why it won't cause any memory issue
---
---
lib/librte_cmdline/cmdline_rdline.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_cmdline/cmdline_rdline.h b/lib/librte_cmdline/cmdline_rdline.h
index d217029..8193e1d 100644
--- a/lib/librte_cmdline/cmdline_rdline.h
+++ b/lib/librte_cmdline/cmdline_rdline.h
@@ -39,7 +39,7 @@ extern "C" {
#endif
/* configuration */
-#define RDLINE_BUF_SIZE 512
+#define RDLINE_BUF_SIZE 2048
#define RDLINE_PROMPT_SIZE 32
#define RDLINE_VT100_BUF_SIZE 8
#define RDLINE_HISTORY_BUF_SIZE BUFSIZ
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 2/4] ceph: consider file's last read/write when calculating wanted caps
From: Yan, Zheng @ 2020-02-20 14:53 UTC (permalink / raw)
To: Jeff Layton; +Cc: Yan, Zheng, ceph-devel
In-Reply-To: <2e6b793f2c6de6f4a8b075f9415460cb575d95df.camel@kernel.org>
On Thu, Feb 20, 2020 at 10:18 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Thu, 2020-02-20 at 20:26 +0800, Yan, Zheng wrote:
> > When getting caps for read/write, update corresponding file's last
> > read/write. If a file hasn't been read/write for 'caps_wanted_delay_max'
> > seconds, ignore the file when calculating wanted caps.
> >
>
> Please explain in the changelog how the new info is to be stored, given
> that it is quite complex.
>
> > Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> > ---
> > fs/ceph/caps.c | 149 ++++++++++++++++++++++++-----------
> > fs/ceph/file.c | 23 +++---
> > fs/ceph/inode.c | 15 +++-
> > fs/ceph/ioctl.c | 4 +-
> > fs/ceph/super.h | 16 +++-
> > include/linux/ceph/ceph_fs.h | 1 +
> > 6 files changed, 145 insertions(+), 63 deletions(-)
> >
> > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> > index 293920d013ff..ccdc47bd7cf0 100644
> > --- a/fs/ceph/caps.c
> > +++ b/fs/ceph/caps.c
> > @@ -971,18 +971,44 @@ int __ceph_caps_used(struct ceph_inode_info *ci)
> > return used;
> > }
> >
> > +#define FMODE_WAIT_BIAS 1000
> > +
> > /*
> > * wanted, by virtue of open file modes
> > */
> > int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
> > {
> > + struct ceph_mount_options *opt =
> > + ceph_inode_to_client(&ci->vfs_inode)->mount_options;
> > + unsigned long used_cutoff =
> > + round_jiffies(jiffies - opt->caps_wanted_delay_max * HZ);
> > + unsigned long idle_cutoff =
> > + round_jiffies(jiffies - opt->caps_wanted_delay_min * HZ);
> > int i, bits = 0;
> > +
> > for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
> > - if (ci->i_nr_by_mode[i])
> > + if (ci->i_file_by_mode[i].nr >= FMODE_WAIT_BIAS) {
> > + /* there are cap waiters or lots of open files */
> > bits |= 1 << i;
> > + } else if (ci->i_file_by_mode[i].nr > 0) {
> > + if (i == CEPH_FILE_MODE_PIN ||
> > + time_after(ci->i_file_by_mode[i].last_used,
> > + used_cutoff))
> > + bits |= 1 << i;
> > + } else if ((ci->i_file_by_mode[i].last_used & 1)) {
> > + if (time_after(ci->i_file_by_mode[i].last_used,
> > + idle_cutoff)) {
> > + bits |= 1 << i;
> > + } else {
> > + ci->i_file_by_mode[i].last_used &= ~1UL;
> > + }
> > + }
> > }
> > if (bits == 0)
> > return 0;
> > + if (bits == 1 && !S_ISDIR(ci->vfs_inode.i_mode))
> > + return 0;
> > +
> > return ceph_caps_for_mode(bits >> 1);
> > }
> >
> > @@ -1021,14 +1047,6 @@ int __ceph_caps_mds_wanted(struct ceph_inode_info *ci, bool check)
> > return mds_wanted;
> > }
> >
> > -/*
> > - * called under i_ceph_lock
> > - */
> > -static int __ceph_is_single_caps(struct ceph_inode_info *ci)
> > -{
> > - return rb_first(&ci->i_caps) == rb_last(&ci->i_caps);
> > -}
> > -
> > int ceph_is_any_caps(struct inode *inode)
> > {
> > struct ceph_inode_info *ci = ceph_inode(inode);
> > @@ -1856,10 +1874,6 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
> > if (ci->i_ceph_flags & CEPH_I_FLUSH)
> > flags |= CHECK_CAPS_FLUSH;
> >
> > - if (!(flags & CHECK_CAPS_AUTHONLY) ||
> > - (ci->i_auth_cap && __ceph_is_single_caps(ci)))
> > - __cap_delay_cancel(mdsc, ci);
> > -
> > goto retry_locked;
> > retry:
> > spin_lock(&ci->i_ceph_lock);
> > @@ -2081,9 +2095,16 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
> > goto retry; /* retake i_ceph_lock and restart our cap scan. */
> > }
> >
> > - /* Reschedule delayed caps release if we delayed anything */
> > - if (delayed)
> > - __cap_delay_requeue(mdsc, ci, false);
> > + if (list_empty(&ci->i_cap_delay_list)) {
> > + if (delayed) {
> > + /* Reschedule delayed caps release if we delayed anything */
> > + __cap_delay_requeue(mdsc, ci, false);
> > + } else if ((file_wanted & ~CEPH_CAP_PIN) &&
> > + !(used & (CEPH_CAP_FILE_RD | CEPH_CAP_ANY_FILE_WR))) {
> > + /* periodically re-calculate caps wanted by open files */
> > + __cap_delay_requeue(mdsc, ci, true);
> > + }
> > + }
> >
> > spin_unlock(&ci->i_ceph_lock);
> >
> > @@ -2549,8 +2570,9 @@ static void __take_cap_refs(struct ceph_inode_info *ci, int got,
> > * FIXME: how does a 0 return differ from -EAGAIN?
> > */
> > enum {
> > - NON_BLOCKING = 1,
> > - CHECK_FILELOCK = 2,
> > + /* first 8 bits are reserved for CEPH_FILE_MODE_FOO */
> > + NON_BLOCKING = (1 << 8),
> > + CHECK_FILELOCK = (1 << 9),
> > };
> >
> > static int try_get_cap_refs(struct inode *inode, int need, int want,
> > @@ -2560,7 +2582,6 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
> > struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
> > int ret = 0;
> > int have, implemented;
> > - int file_wanted;
> > bool snap_rwsem_locked = false;
> >
> > dout("get_cap_refs %p need %s want %s\n", inode,
> > @@ -2576,15 +2597,6 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
> > goto out_unlock;
> > }
> >
> > - /* make sure file is actually open */
> > - file_wanted = __ceph_caps_file_wanted(ci);
> > - if ((file_wanted & need) != need) {
> > - dout("try_get_cap_refs need %s file_wanted %s, EBADF\n",
> > - ceph_cap_string(need), ceph_cap_string(file_wanted));
> > - ret = -EBADF;
> > - goto out_unlock;
> > - }
> > -
> > /* finish pending truncate */
> > while (ci->i_truncate_pending) {
> > spin_unlock(&ci->i_ceph_lock);
> > @@ -2692,6 +2704,9 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
> > ceph_cap_string(have), ceph_cap_string(need));
> > }
> > out_unlock:
> > +
> > + __ceph_touch_fmode(ci, mdsc, flags);
> > +
> > spin_unlock(&ci->i_ceph_lock);
> > if (snap_rwsem_locked)
> > up_read(&mdsc->snap_rwsem);
> > @@ -2729,10 +2744,22 @@ static void check_max_size(struct inode *inode, loff_t endoff)
> > ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL);
> > }
> >
> > +static inline int get_used_file_mode(int need, int want)
> > +{
> > + int fmode = 0;
> > + if (need & CEPH_CAP_FILE_RD)
> > + fmode |= CEPH_FILE_MODE_RD;
> > + if (need & CEPH_CAP_FILE_WR)
> > + fmode |= CEPH_FILE_MODE_WR;
> > + if (want & CEPH_CAP_FILE_LAZYIO)
> > + fmode |= CEPH_FILE_MODE_LAZY;
> > + return fmode;
> > +}
> > +
> > int ceph_try_get_caps(struct inode *inode, int need, int want,
> > bool nonblock, int *got)
> > {
> > - int ret;
> > + int ret, flags;
> >
> > BUG_ON(need & ~CEPH_CAP_FILE_RD);
> > BUG_ON(want & ~(CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO|CEPH_CAP_FILE_SHARED));
> > @@ -2740,8 +2767,11 @@ int ceph_try_get_caps(struct inode *inode, int need, int want,
> > if (ret < 0)
> > return ret;
> >
> > - ret = try_get_cap_refs(inode, need, want, 0,
> > - (nonblock ? NON_BLOCKING : 0), got);
> > + flags = get_used_file_mode(need, want);
> > + if (nonblock)
> > + flags |= NON_BLOCKING;
> > +
> > + ret = try_get_cap_refs(inode, need, want, 0, flags, got);
> > return ret == -EAGAIN ? 0 : ret;
> > }
> >
> > @@ -2767,11 +2797,15 @@ int ceph_get_caps(struct file *filp, int need, int want,
> > fi->filp_gen != READ_ONCE(fsc->filp_gen))
> > return -EBADF;
> >
> > + flags = get_used_file_mode(need, want);
> > +
> > while (true) {
> > if (endoff > 0)
> > check_max_size(inode, endoff);
> >
> > - flags = atomic_read(&fi->num_locks) ? CHECK_FILELOCK : 0;
> > + flags &= CEPH_FILE_MODE_MASK;
> > + if (atomic_read(&fi->num_locks))
> > + flags |= CHECK_FILELOCK;
> > _got = 0;
> > ret = try_get_cap_refs(inode, need, want, endoff,
> > flags, &_got);
> > @@ -2791,6 +2825,8 @@ int ceph_get_caps(struct file *filp, int need, int want,
> > list_add(&cw.list, &mdsc->cap_wait_list);
> > spin_unlock(&mdsc->caps_list_lock);
> >
> > + /* make sure used fmode not timeout */
> > + ceph_get_fmode(ci, flags, FMODE_WAIT_BIAS);
> > add_wait_queue(&ci->i_cap_wq, &wait);
> >
> > flags |= NON_BLOCKING;
> > @@ -2804,6 +2840,7 @@ int ceph_get_caps(struct file *filp, int need, int want,
> > }
> >
> > remove_wait_queue(&ci->i_cap_wq, &wait);
> > + ceph_put_fmode(ci, flags, FMODE_WAIT_BIAS);
> >
> > spin_lock(&mdsc->caps_list_lock);
> > list_del(&cw.list);
> > @@ -2823,7 +2860,7 @@ int ceph_get_caps(struct file *filp, int need, int want,
> > if (ret < 0) {
> > if (ret == -ESTALE) {
> > /* session was killed, try renew caps */
> > - ret = ceph_renew_caps(inode);
> > + ret = ceph_renew_caps(inode, flags);
> > if (ret == 0)
> > continue;
> > }
> > @@ -4121,13 +4158,41 @@ void ceph_flush_dirty_caps(struct ceph_mds_client *mdsc)
> > dout("flush_dirty_caps done\n");
> > }
> >
> > +void __ceph_touch_fmode(struct ceph_inode_info *ci,
> > + struct ceph_mds_client *mdsc, int fmode)
> > +{
> > + int i;
> > + int bits = (fmode << 1);
> > + unsigned long now = jiffies | 1;
> > + for (i = 1; i < CEPH_FILE_MODE_BITS; i++) {
> > + if (bits & (1 << i))
> > + ci->i_file_by_mode[i].last_used = now;
> > + }
> > +
> > + /* queue periodic check */
> > + if (bits && list_empty(&ci->i_cap_delay_list))
> > + __cap_delay_requeue(mdsc, ci, true);
> > +}
> > +
> > +void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count)
> > +{
> > + int i;
> > + int bits = (fmode << 1) | 1;
> > + spin_lock(&ci->i_ceph_lock);
> > + for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
> > + if (bits & (1 << i))
> > + ci->i_file_by_mode[i].nr += count;
> > + }
> > + spin_unlock(&ci->i_ceph_lock);
> > +}
> > +
> > void __ceph_get_fmode(struct ceph_inode_info *ci, int fmode)
> > {
> > int i;
> > int bits = (fmode << 1) | 1;
> > for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
> > if (bits & (1 << i))
> > - ci->i_nr_by_mode[i]++;
> > + ci->i_file_by_mode[i].nr++;
> > }
> > }
> >
> > @@ -4136,26 +4201,18 @@ void __ceph_get_fmode(struct ceph_inode_info *ci, int fmode)
> > * we may need to release capabilities to the MDS (or schedule
> > * their delayed release).
> > */
> > -void ceph_put_fmode(struct ceph_inode_info *ci, int fmode)
> > +void ceph_put_fmode(struct ceph_inode_info *ci, int fmode, int count)
> > {
> > - int i, last = 0;
> > + int i;
> > int bits = (fmode << 1) | 1;
> > spin_lock(&ci->i_ceph_lock);
> > for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
> > if (bits & (1 << i)) {
> > - BUG_ON(ci->i_nr_by_mode[i] == 0);
> > - if (--ci->i_nr_by_mode[i] == 0)
> > - last++;
> > + BUG_ON(ci->i_file_by_mode[i].nr < count);
> > + ci->i_file_by_mode[i].nr -= count;
> > }
> > }
> > - dout("put_fmode %p fmode %d {%d,%d,%d,%d}\n",
> > - &ci->vfs_inode, fmode,
> > - ci->i_nr_by_mode[0], ci->i_nr_by_mode[1],
> > - ci->i_nr_by_mode[2], ci->i_nr_by_mode[3]);
> > spin_unlock(&ci->i_ceph_lock);
> > -
> > - if (last && ci->i_vino.snap == CEPH_NOSNAP)
> > - ceph_check_caps(ci, 0, NULL);
> > }
> >
> > /*
> > diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> > index 7e0190b1f821..f28f420bad23 100644
> > --- a/fs/ceph/file.c
> > +++ b/fs/ceph/file.c
> > @@ -213,7 +213,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
> > struct ceph_dir_file_info *dfi =
> > kmem_cache_zalloc(ceph_dir_file_cachep, GFP_KERNEL);
> > if (!dfi) {
> > - ceph_put_fmode(ci, fmode); /* clean up */
> > + ceph_put_fmode(ci, fmode, 1); /* clean up */
> > return -ENOMEM;
> > }
> >
> > @@ -224,7 +224,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
> > } else {
> > fi = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
> > if (!fi) {
> > - ceph_put_fmode(ci, fmode); /* clean up */
> > + ceph_put_fmode(ci, fmode, 1); /* clean up */
> > return -ENOMEM;
> > }
> >
> > @@ -263,7 +263,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> > case S_IFLNK:
> > dout("init_file %p %p 0%o (symlink)\n", inode, file,
> > inode->i_mode);
> > - ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
> > + ceph_put_fmode(ceph_inode(inode), fmode, 1); /* clean up */
> > break;
> >
> > default:
> > @@ -273,7 +273,7 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> > * we need to drop the open ref now, since we don't
> > * have .release set to ceph_release.
> > */
> > - ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
> > + ceph_put_fmode(ceph_inode(inode), fmode, 1); /* clean up */
> > BUG_ON(inode->i_fop->release == ceph_release);
> >
> > /* call the proper open fop */
> > @@ -285,14 +285,15 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode)
> > /*
> > * try renew caps after session gets killed.
> > */
> > -int ceph_renew_caps(struct inode *inode)
> > +int ceph_renew_caps(struct inode *inode, int fmode)
> > {
> > - struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
> > + struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
> > struct ceph_inode_info *ci = ceph_inode(inode);
> > struct ceph_mds_request *req;
> > int err, flags, wanted;
> >
> > spin_lock(&ci->i_ceph_lock);
> > + __ceph_touch_fmode(ci, mdsc, fmode);
> > wanted = __ceph_caps_file_wanted(ci);
> > if (__ceph_is_any_real_caps(ci) &&
> > (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap)) {
> > @@ -405,6 +406,7 @@ int ceph_open(struct inode *inode, struct file *file)
> > } else if (ceph_snap(inode) != CEPH_NOSNAP &&
> > (ci->i_snap_caps & wanted) == wanted) {
> > __ceph_get_fmode(ci, fmode);
> > + __ceph_touch_fmode(ci, mdsc, fmode);
> > spin_unlock(&ci->i_ceph_lock);
> > return ceph_init_file(inode, file, fmode);
> > }
> > @@ -525,7 +527,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
> > }
> > out_req:
> > if (!req->r_err && req->r_target_inode)
> > - ceph_put_fmode(ceph_inode(req->r_target_inode), req->r_fmode);
> > + ceph_put_fmode(ceph_inode(req->r_target_inode), req->r_fmode, 1);
> > ceph_mdsc_put_request(req);
> > out_ctx:
> > ceph_release_acl_sec_ctx(&as_ctx);
> > @@ -542,7 +544,7 @@ int ceph_release(struct inode *inode, struct file *file)
> > dout("release inode %p dir file %p\n", inode, file);
> > WARN_ON(!list_empty(&dfi->file_info.rw_contexts));
> >
> > - ceph_put_fmode(ci, dfi->file_info.fmode);
> > + ceph_put_fmode(ci, dfi->file_info.fmode, 1);
> >
> > if (dfi->last_readdir)
> > ceph_mdsc_put_request(dfi->last_readdir);
> > @@ -554,7 +556,8 @@ int ceph_release(struct inode *inode, struct file *file)
> > dout("release inode %p regular file %p\n", inode, file);
> > WARN_ON(!list_empty(&fi->rw_contexts));
> >
> > - ceph_put_fmode(ci, fi->fmode);
> > + ceph_put_fmode(ci, fi->fmode, 1);
> > +
> > kmem_cache_free(ceph_file_cachep, fi);
> > }
> >
> > @@ -1560,7 +1563,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
> > if (dirty)
> > __mark_inode_dirty(inode, dirty);
> > if (ceph_quota_is_max_bytes_approaching(inode, iocb->ki_pos))
> > - ceph_check_caps(ci, CHECK_CAPS_NODELAY, NULL);
> > + ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL);
> > }
> >
> > dout("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n",
> > diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> > index 094b8fc37787..b279bd8e168e 100644
> > --- a/fs/ceph/inode.c
> > +++ b/fs/ceph/inode.c
> > @@ -478,8 +478,10 @@ struct inode *ceph_alloc_inode(struct super_block *sb)
> > ci->i_head_snapc = NULL;
> > ci->i_snap_caps = 0;
> >
> > - for (i = 0; i < CEPH_FILE_MODE_BITS; i++)
> > - ci->i_nr_by_mode[i] = 0;
> > + for (i = 0; i < CEPH_FILE_MODE_BITS; i++) {
> > + ci->i_file_by_mode[i].nr = 0;
> > + ci->i_file_by_mode[i].last_used = 0;
> > + }
> >
> > mutex_init(&ci->i_truncate_mutex);
> > ci->i_truncate_seq = 0;
> > @@ -637,7 +639,7 @@ int ceph_fill_file_size(struct inode *inode, int issued,
> > if ((issued & (CEPH_CAP_FILE_CACHE|
> > CEPH_CAP_FILE_BUFFER)) ||
> > mapping_mapped(inode->i_mapping) ||
> > - __ceph_caps_file_wanted(ci)) {
> > + __ceph_is_file_opened(ci)) {
> > ci->i_truncate_pending++;
> > queue_trunc = 1;
> > }
> > @@ -1010,6 +1012,13 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
> > fill_inline = true;
> > }
> >
> > + if (cap_fmode >= 0) {
> > + if (!info_caps)
> > + pr_warn("mds issued no caps on %llx.%llx\n",
> > + ceph_vinop(inode));
> > + __ceph_touch_fmode(ci, mdsc, cap_fmode);
> > + }
> > +
> > spin_unlock(&ci->i_ceph_lock);
> >
> > if (fill_inline)
> > diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
> > index c90f03beb15d..da0ee54ae5bc 100644
> > --- a/fs/ceph/ioctl.c
> > +++ b/fs/ceph/ioctl.c
> > @@ -243,11 +243,13 @@ static long ceph_ioctl_lazyio(struct file *file)
> > struct ceph_file_info *fi = file->private_data;
> > struct inode *inode = file_inode(file);
> > struct ceph_inode_info *ci = ceph_inode(inode);
> > + struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
> >
> > if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
> > spin_lock(&ci->i_ceph_lock);
> > fi->fmode |= CEPH_FILE_MODE_LAZY;
> > - ci->i_nr_by_mode[ffs(CEPH_FILE_MODE_LAZY)]++;
> > + ci->i_file_by_mode[ffs(CEPH_FILE_MODE_LAZY)].nr++;
> > + __ceph_touch_fmode(ci, mdsc, CEPH_FILE_MODE_LAZY);
> > spin_unlock(&ci->i_ceph_lock);
> > dout("ioctl_layzio: file %p marked lazy\n", file);
> >
> > diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> > index d370f89df358..029823643b8b 100644
> > --- a/fs/ceph/super.h
> > +++ b/fs/ceph/super.h
> > @@ -361,7 +361,10 @@ struct ceph_inode_info {
> > dirty|flushing caps */
> > unsigned i_snap_caps; /* cap bits for snapped files */
> >
> > - int i_nr_by_mode[CEPH_FILE_MODE_BITS]; /* open file counts */
> > + struct {
> > + int nr;
> > + unsigned long last_used;
> > + } i_file_by_mode[CEPH_FILE_MODE_BITS]; /* open file counts */
> >
>
> Ok, so we're growing ceph_inode_info by 40 bytes here (on 64-bit arch).
>
> That's quite a bit, actually, but it turns out that there are 32 bytes
> worth of holes in ceph_inode_info now. It'd be good to reorganize the
> struct for better packing before you do this, so that this at least
> won't make memory consumption too much worse.
>
> There other ways we could approach this too that would be more space
> efficient. We don't really need to keep a timestamp for each mode bit.
> All we're really interested in is what modes were used in the last time
> interval.
>
> We could keep an active and inactive set of CEPH_FILE_MODE bits (which
> are just a single byte each), and a timestamp representing the switch
> between the two.
>
> As we use the file, we'd set bits in the active mask if the timestamp is
> less than half the time interval old. If it's more than half the
> interval, copy the active mask to the inactive one and zero out the
> active mask first.
>
> When you go to check what modes have been used you can do the switch
> again first if the timestamp is too old. To see what bits were actually
> used, you just logically or the active and inactive sets together.
>
> That would take a lot less space per inode.
The problem is there is no reliable tick for interval. besides, we can
not have patch 4 if use active bit. patch 4 simplifies code a lot. I
really like to keep it. we can just track last use of read/write,
which uses 16 bytes. this patch removes i_hold_caps_min. So only need
8 more bytes.
>
> > struct mutex i_truncate_mutex;
> > u32 i_truncate_seq; /* last truncate to smaller size */
> > @@ -673,6 +676,10 @@ extern int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
> > extern int ceph_caps_revoking(struct ceph_inode_info *ci, int mask);
> > extern int __ceph_caps_used(struct ceph_inode_info *ci);
> >
> > +static inline bool __ceph_is_file_opened(struct ceph_inode_info *ci)
> > +{
> > + return ci->i_file_by_mode[0].nr;
> > +}
> > extern int __ceph_caps_file_wanted(struct ceph_inode_info *ci);
> > extern int __ceph_caps_wanted(struct ceph_inode_info *ci);
> >
> > @@ -1074,7 +1081,10 @@ extern int ceph_try_get_caps(struct inode *inode,
> >
> > /* for counting open files by mode */
> > extern void __ceph_get_fmode(struct ceph_inode_info *ci, int mode);
> > -extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode);
> > +extern void ceph_get_fmode(struct ceph_inode_info *ci, int mode, int count);
> > +extern void ceph_put_fmode(struct ceph_inode_info *ci, int mode, int count);
> > +extern void __ceph_touch_fmode(struct ceph_inode_info *ci,
> > + struct ceph_mds_client *mdsc, int fmode);
> >
> > /* addr.c */
> > extern const struct address_space_operations ceph_aops;
> > @@ -1086,7 +1096,7 @@ extern void ceph_pool_perm_destroy(struct ceph_mds_client* mdsc);
> > /* file.c */
> > extern const struct file_operations ceph_file_fops;
> >
> > -extern int ceph_renew_caps(struct inode *inode);
> > +extern int ceph_renew_caps(struct inode *inode, int fmode);
> > extern int ceph_open(struct inode *inode, struct file *file);
> > extern int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
> > struct file *file, unsigned flags, umode_t mode);
> > diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> > index cb21c5cf12c3..8017130a08a1 100644
> > --- a/include/linux/ceph/ceph_fs.h
> > +++ b/include/linux/ceph/ceph_fs.h
> > @@ -564,6 +564,7 @@ struct ceph_filelock {
> > #define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
> > #define CEPH_FILE_MODE_LAZY 4 /* lazy io */
> > #define CEPH_FILE_MODE_BITS 4
> > +#define CEPH_FILE_MODE_MASK ((1 << CEPH_FILE_MODE_BITS) - 1)
> >
> > int ceph_flags_to_mode(int flags);
> >
>
> --
> Jeff Layton <jlayton@kernel.org>
>
^ permalink raw reply
* Re: [PATCH v3 10/10] arm64: defconfig: enable AHUB components for Tegra210 and later
From: Jon Hunter @ 2020-02-20 14:52 UTC (permalink / raw)
To: Sameer Pujar, perex, tiwai, robh+dt
Cc: devicetree, alsa-devel, atalambedu, lgirdwood, linux-kernel,
viswanathl, sharadg, broonie, thierry.reding, linux-tegra, digetx,
rlokhande, mkumard, dramesh
In-Reply-To: <1582180492-25297-11-git-send-email-spujar@nvidia.com>
On 20/02/2020 06:34, Sameer Pujar wrote:
> This patch enables following configs:
> +CONFIG_TEGRA_ACONNECT=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
>
> This patch helps to register AHUB and its clients (I2S, DMIC, DSPK, ADMAIF)
> with ASoC core. Since AHUB is child of ACONNECT, config TEGRA_ACONNECT is
> enabled as well.
>
> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
> ---
> arch/arm64/configs/defconfig | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
> index c8801be..784ca4f 100644
> --- a/arch/arm64/configs/defconfig
> +++ b/arch/arm64/configs/defconfig
> @@ -207,6 +207,7 @@ CONFIG_FW_LOADER_USER_HELPER=y
> CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
> CONFIG_HISILICON_LPC=y
> CONFIG_SIMPLE_PM_BUS=y
> +CONFIG_TEGRA_ACONNECT=m
> CONFIG_MTD=y
> CONFIG_MTD_BLOCK=y
> CONFIG_MTD_RAW_NAND=y
> @@ -590,6 +591,12 @@ CONFIG_SND_SOC_RK3399_GRU_SOUND=m
> CONFIG_SND_SOC_SAMSUNG=y
> CONFIG_SND_SOC_RCAR=m
> CONFIG_SND_SUN4I_SPDIF=m
> +CONFIG_SND_SOC_TEGRA=m
> +CONFIG_SND_SOC_TEGRA210_AHUB=m
> +CONFIG_SND_SOC_TEGRA210_DMIC=m
> +CONFIG_SND_SOC_TEGRA210_I2S=m
> +CONFIG_SND_SOC_TEGRA186_DSPK=m
> +CONFIG_SND_SOC_TEGRA210_ADMAIF=m
> CONFIG_SND_SOC_AK4613=m
> CONFIG_SND_SOC_ES7134=m
> CONFIG_SND_SOC_ES7241=m
Thanks!
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Cheers
Jon
--
nvpublic
^ permalink raw reply
* Re: [Intel-gfx] [PATCH] drm/i915/gt: Expand bad CS completion event debug
From: kbuild test robot @ 2020-02-20 14:54 UTC (permalink / raw)
To: kbuild-all
In-Reply-To: <20200211230944.1203098-1-chris@chris-wilson.co.uk>
[-- Attachment #1: Type: text/plain, Size: 15533 bytes --]
Hi Chris,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.6-rc2]
[cannot apply to drm-tip/drm-tip next-20200220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-gt-Expand-bad-CS-completion-event-debug/20200215-041958
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-c002-20200220 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/gpu/drm/i915/gt/intel_lrc.c: In function 'process_csb':
>> drivers/gpu/drm/i915/gt/intel_lrc.c:2325:16: error: unused variable 'regs' [-Werror=unused-variable]
const u32 *regs = rq->context->lrc_reg_state;
^~~~
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:arch_set_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:arch___set_bit
Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:arch_clear_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:arch_clear_bit_unlock
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:arch_test_and_set_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:__ffs
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:ffs
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
Cyclomatic Complexity 1 include/asm-generic/bitops/instrumented-atomic.h:set_bit
Cyclomatic Complexity 1 include/asm-generic/bitops/instrumented-atomic.h:clear_bit
Cyclomatic Complexity 1 include/asm-generic/bitops/instrumented-atomic.h:test_and_set_bit
Cyclomatic Complexity 1 include/asm-generic/bitops/instrumented-non-atomic.h:__set_bit
Cyclomatic Complexity 1 include/asm-generic/bitops/instrumented-lock.h:clear_bit_unlock
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
Cyclomatic Complexity 1 arch/x86/include/asm/div64.h:mul_u32_u32
Cyclomatic Complexity 1 arch/x86/include/asm/string_32.h:memset32
Cyclomatic Complexity 1 include/linux/string.h:memset_p
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_inc
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_dec
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_dec_and_test
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_fetch_add
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_fetch_sub
Cyclomatic Complexity 2 arch/x86/include/asm/atomic.h:arch_atomic_try_cmpxchg
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_fetch_add
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_fetch_sub
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_inc
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_dec
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_try_cmpxchg
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_dec_and_test
Cyclomatic Complexity 1 include/linux/atomic-fallback.h:atomic_fetch_inc
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/list.h:__list_del
Cyclomatic Complexity 1 include/linux/list.h:list_is_last
Cyclomatic Complexity 1 include/linux/list.h:list_empty
Cyclomatic Complexity 1 arch/x86/include/asm/special_insns.h:clflush
Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 include/linux/err.h:ERR_CAST
Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:native_irq_disable
Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:native_irq_enable
Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_irq_disable
Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_irq_enable
Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:rep_nop
Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:cpu_relax
Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_add
Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_sub
Cyclomatic Complexity 1 include/linux/bottom_half.h:__local_bh_disable_ip
Cyclomatic Complexity 1 include/linux/bottom_half.h:local_bh_disable
Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irqrestore
Cyclomatic Complexity 1 arch/x86/include/asm/io.h:readl
Cyclomatic Complexity 1 arch/x86/include/asm/io.h:writel
Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_lock
Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_unlock
Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_lock
Cyclomatic Complexity 1 include/linux/rbtree.h:rb_link_node
Cyclomatic Complexity 3 include/linux/overflow.h:__ab_c_size
Cyclomatic Complexity 1 include/linux/seqlock.h:raw_write_seqcount_begin
Cyclomatic Complexity 1 include/linux/seqlock.h:raw_write_seqcount_end
Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies
Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_to_ns
Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_after
Cyclomatic Complexity 1 include/linux/timer.h:timer_pending
Cyclomatic Complexity 1 include/linux/interrupt.h:tasklet_disable_nosync
Cyclomatic Complexity 1 include/linux/interrupt.h:tasklet_enable
Cyclomatic Complexity 3 include/linux/slab.h:kmalloc_type
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 4 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/linux/dma-resv.h:dma_resv_get_list
Cyclomatic Complexity 1 include/drm/drm_print.h:drm_info_printer
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_reg.h:i915_mmio_reg_offset
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_utils.h:msecs_to_jiffies_timeout
Cyclomatic Complexity 3 drivers/gpu/drm/i915/i915_utils.h:timer_expired
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_gem.h:__tasklet_is_enabled
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_gem.h:__tasklet_enable
Cyclomatic Complexity 1 drivers/gpu/drm/i915/gt/intel_engine_types.h:intel_engine_has_preemption
Cyclomatic Complexity 1 drivers/gpu/drm/i915/gt/intel_engine_types.h:intel_engine_has_semaphores
Cyclomatic Complexity 1 drivers/gpu/drm/i915/gt/intel_engine_types.h:intel_engine_has_relative_mmio
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_request.h:to_request
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_request.h:i915_seqno_passed
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_request.h:__hwsp_seqno
Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_request.h:i915_request_is_ready
vim +/regs +2325 drivers/gpu/drm/i915/gt/intel_lrc.c
2212
2213 static void process_csb(struct intel_engine_cs *engine)
2214 {
2215 struct intel_engine_execlists * const execlists = &engine->execlists;
2216 const u32 * const buf = execlists->csb_status;
2217 const u8 num_entries = execlists->csb_size;
2218 u8 head, tail;
2219
2220 /*
2221 * As we modify our execlists state tracking we require exclusive
2222 * access. Either we are inside the tasklet, or the tasklet is disabled
2223 * and we assume that is only inside the reset paths and so serialised.
2224 */
2225 GEM_BUG_ON(!tasklet_is_locked(&execlists->tasklet) &&
2226 !reset_in_progress(execlists));
2227 GEM_BUG_ON(!intel_engine_in_execlists_submission_mode(engine));
2228
2229 /*
2230 * Note that csb_write, csb_status may be either in HWSP or mmio.
2231 * When reading from the csb_write mmio register, we have to be
2232 * careful to only use the GEN8_CSB_WRITE_PTR portion, which is
2233 * the low 4bits. As it happens we know the next 4bits are always
2234 * zero and so we can simply masked off the low u8 of the register
2235 * and treat it identically to reading from the HWSP (without having
2236 * to use explicit shifting and masking, and probably bifurcating
2237 * the code to handle the legacy mmio read).
2238 */
2239 head = execlists->csb_head;
2240 tail = READ_ONCE(*execlists->csb_write);
2241 ENGINE_TRACE(engine, "cs-irq head=%d, tail=%d\n", head, tail);
2242 if (unlikely(head == tail))
2243 return;
2244
2245 /*
2246 * Hopefully paired with a wmb() in HW!
2247 *
2248 * We must complete the read of the write pointer before any reads
2249 * from the CSB, so that we do not see stale values. Without an rmb
2250 * (lfence) the HW may speculatively perform the CSB[] reads *before*
2251 * we perform the READ_ONCE(*csb_write).
2252 */
2253 rmb();
2254
2255 do {
2256 bool promote;
2257
2258 if (++head == num_entries)
2259 head = 0;
2260
2261 /*
2262 * We are flying near dragons again.
2263 *
2264 * We hold a reference to the request in execlist_port[]
2265 * but no more than that. We are operating in softirq
2266 * context and so cannot hold any mutex or sleep. That
2267 * prevents us stopping the requests we are processing
2268 * in port[] from being retired simultaneously (the
2269 * breadcrumb will be complete before we see the
2270 * context-switch). As we only hold the reference to the
2271 * request, any pointer chasing underneath the request
2272 * is subject to a potential use-after-free. Thus we
2273 * store all of the bookkeeping within port[] as
2274 * required, and avoid using unguarded pointers beneath
2275 * request itself. The same applies to the atomic
2276 * status notifier.
2277 */
2278
2279 ENGINE_TRACE(engine, "csb[%d]: status=0x%08x:0x%08x\n",
2280 head, buf[2 * head + 0], buf[2 * head + 1]);
2281
2282 if (INTEL_GEN(engine->i915) >= 12)
2283 promote = gen12_csb_parse(execlists, buf + 2 * head);
2284 else
2285 promote = gen8_csb_parse(execlists, buf + 2 * head);
2286 if (promote) {
2287 struct i915_request * const *old = execlists->active;
2288
2289 /* Point active to the new ELSP; prevent overwriting */
2290 WRITE_ONCE(execlists->active, execlists->pending);
2291
2292 if (!inject_preempt_hang(execlists))
2293 ring_set_paused(engine, 0);
2294
2295 /* cancel old inflight, prepare for switch */
2296 trace_ports(execlists, "preempted", old);
2297 while (*old)
2298 execlists_schedule_out(*old++);
2299
2300 /* switch pending to inflight */
2301 GEM_BUG_ON(!assert_pending_valid(execlists, "promote"));
2302 WRITE_ONCE(execlists->active,
2303 memcpy(execlists->inflight,
2304 execlists->pending,
2305 execlists_num_ports(execlists) *
2306 sizeof(*execlists->pending)));
2307
2308 WRITE_ONCE(execlists->pending[0], NULL);
2309 } else {
2310 GEM_BUG_ON(!*execlists->active);
2311
2312 /* port0 completed, advanced to port1 */
2313 trace_ports(execlists, "completed", execlists->active);
2314
2315 /*
2316 * We rely on the hardware being strongly
2317 * ordered, that the breadcrumb write is
2318 * coherent (visible from the CPU) before the
2319 * user interrupt and CSB is processed.
2320 */
2321 if (GEM_SHOW_DEBUG() &&
2322 !i915_request_completed(*execlists->active) &&
2323 !reset_in_progress(execlists)) {
2324 struct i915_request *rq = *execlists->active;
> 2325 const u32 *regs = rq->context->lrc_reg_state;
2326
2327 ENGINE_TRACE(engine,
2328 "ring:{start:0x%08x, head:%04x, tail:%04x, ctl:%08x, mode:%08x}\n",
2329 ENGINE_READ(engine, RING_START),
2330 ENGINE_READ(engine, RING_HEAD) & HEAD_ADDR,
2331 ENGINE_READ(engine, RING_TAIL) & TAIL_ADDR,
2332 ENGINE_READ(engine, RING_CTL),
2333 ENGINE_READ(engine, RING_MI_MODE));
2334 ENGINE_TRACE(engine,
2335 "rq:{start:%08x, head:%04x, tail:%04x, seqno:%llx:%d, hwsp:%d}, ",
2336 i915_ggtt_offset(rq->ring->vma),
2337 rq->head, rq->tail,
2338 rq->fence.context,
2339 lower_32_bits(rq->fence.seqno),
2340 hwsp_seqno(rq));
2341 ENGINE_TRACE(engine,
2342 "ctx:{start:%08x, head:%04x, tail:%04x}, ",
2343 regs[CTX_RING_START],
2344 regs[CTX_RING_HEAD],
2345 regs[CTX_RING_TAIL]);
2346
2347 GEM_BUG_ON("context completed before request");
2348 }
2349
2350 execlists_schedule_out(*execlists->active++);
2351
2352 GEM_BUG_ON(execlists->active - execlists->inflight >
2353 execlists_num_ports(execlists));
2354 }
2355 } while (head != tail);
2356
2357 execlists->csb_head = head;
2358 set_timeslice(engine);
2359
2360 /*
2361 * Gen11 has proven to fail wrt global observation point between
2362 * entry and tail update, failing on the ordering and thus
2363 * we see an old entry in the context status buffer.
2364 *
2365 * Forcibly evict out entries for the next gpu csb update,
2366 * to increase the odds that we get a fresh entries with non
2367 * working hardware. The cost for doing so comes out mostly with
2368 * the wash as hardware, working or not, will need to do the
2369 * invalidation before.
2370 */
2371 invalidate_csb_entries(&buf[0], &buf[num_entries - 1]);
2372 }
2373
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39450 bytes --]
^ permalink raw reply
* Re: [PATCH v3 2/2] qemu-cpu-models.rst: Document -noTSX, mds-no, taa-no, and tsx-ctrl
From: Paolo Bonzini @ 2020-02-20 14:52 UTC (permalink / raw)
To: Kashyap Chamarthy, qemu-devel
Cc: peter.maydell, berrange, Eduardo Habkost, Richard Henderson
In-Reply-To: <20200220142001.20774-3-kchamart@redhat.com>
Two small changes...
On 20/02/20 15:20, Kashyap Chamarthy wrote:
> + Recommended to inform the guest that it can disable the Intel TSX
> + (Transactional Synchronization Extensions) feature; or, if the
> + processor is vulnerable, use the Intel VERW instruction (a
> + processor-level instruction that performs checks on memory access) as
> + a mitigation for the TAA vulnerability. (For details, refer to this
> + `Intel's deep-dive into
> + MDS <https://software.intel.com/security-software-guidance/insights/deep-dive-intel-analysis-microarchitectural-data-sampling>`_.)
... refer to Intel's `deep dive into MDS <...>`_.
(I don't know what the trailing underscore is for. I reaffirm my
definition of rST as the Perl of markup formats).
> +
> + Expose this to the guest OS if and only if: (a) the host has TSX
> + enabled; *and* (b) the guest has ``rtm`` CPU flag enabled.
> +
> + By disabling TSX, KVM-based guests can avoid paying the price of
> + mitigting TSX-based attacks.
"mitigating"
Paolo
^ permalink raw reply
* [PATCH v6 01/16] mm/gup: Rename "nonblocking" to "locked" where proper
From: Peter Xu @ 2020-02-20 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Martin Cracauer, Mike Rapoport, Hugh Dickins, Jerome Glisse,
peterx, Kirill A . Shutemov, Matthew Wilcox, Pavel Emelyanov,
Brian Geffon, Maya Gokhale, Denis Plotnikov, Andrea Arcangeli,
Johannes Weiner, Dr . David Alan Gilbert, Linus Torvalds,
Mike Kravetz, Marty McFadden, David Hildenbrand, Bobby Powers,
Mel Gorman
In-Reply-To: <20200220145432.4561-1-peterx@redhat.com>
There's plenty of places around __get_user_pages() that has a parameter
"nonblocking" which does not really mean that "it won't block" (because
it can really block) but instead it shows whether the mmap_sem is
released by up_read() during the page fault handling mostly when
VM_FAULT_RETRY is returned.
We have the correct naming in e.g. get_user_pages_locked() or
get_user_pages_remote() as "locked", however there're still many places
that are using the "nonblocking" as name.
Renaming the places to "locked" where proper to better suite the
functionality of the variable. While at it, fixing up some of the
comments accordingly.
Reviewed-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
mm/gup.c | 44 +++++++++++++++++++++-----------------------
mm/hugetlb.c | 8 ++++----
2 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 1b521e0ac1de..1b4411bd0042 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -630,12 +630,12 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address,
}
/*
- * mmap_sem must be held on entry. If @nonblocking != NULL and
- * *@flags does not include FOLL_NOWAIT, the mmap_sem may be released.
- * If it is, *@nonblocking will be set to 0 and -EBUSY returned.
+ * mmap_sem must be held on entry. If @locked != NULL and *@flags
+ * does not include FOLL_NOWAIT, the mmap_sem may be released. If it
+ * is, *@locked will be set to 0 and -EBUSY returned.
*/
static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
- unsigned long address, unsigned int *flags, int *nonblocking)
+ unsigned long address, unsigned int *flags, int *locked)
{
unsigned int fault_flags = 0;
vm_fault_t ret;
@@ -647,7 +647,7 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
fault_flags |= FAULT_FLAG_WRITE;
if (*flags & FOLL_REMOTE)
fault_flags |= FAULT_FLAG_REMOTE;
- if (nonblocking)
+ if (locked)
fault_flags |= FAULT_FLAG_ALLOW_RETRY;
if (*flags & FOLL_NOWAIT)
fault_flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT;
@@ -673,8 +673,8 @@ static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma,
}
if (ret & VM_FAULT_RETRY) {
- if (nonblocking && !(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
- *nonblocking = 0;
+ if (locked && !(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
+ *locked = 0;
return -EBUSY;
}
@@ -751,7 +751,7 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
* only intends to ensure the pages are faulted in.
* @vmas: array of pointers to vmas corresponding to each page.
* Or NULL if the caller does not require them.
- * @nonblocking: whether waiting for disk IO or mmap_sem contention
+ * @locked: whether we're still with the mmap_sem held
*
* Returns either number of pages pinned (which may be less than the
* number requested), or an error. Details about the return value:
@@ -786,13 +786,11 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
* appropriate) must be called after the page is finished with, and
* before put_page is called.
*
- * If @nonblocking != NULL, __get_user_pages will not wait for disk IO
- * or mmap_sem contention, and if waiting is needed to pin all pages,
- * *@nonblocking will be set to 0. Further, if @gup_flags does not
- * include FOLL_NOWAIT, the mmap_sem will be released via up_read() in
- * this case.
+ * If @locked != NULL, *@locked will be set to 0 when mmap_sem is
+ * released by an up_read(). That can happen if @gup_flags does not
+ * have FOLL_NOWAIT.
*
- * A caller using such a combination of @nonblocking and @gup_flags
+ * A caller using such a combination of @locked and @gup_flags
* must therefore hold the mmap_sem for reading only, and recognize
* when it's been released. Otherwise, it must be held for either
* reading or writing and will not be released.
@@ -804,7 +802,7 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, unsigned long nr_pages,
unsigned int gup_flags, struct page **pages,
- struct vm_area_struct **vmas, int *nonblocking)
+ struct vm_area_struct **vmas, int *locked)
{
long ret = 0, i = 0;
struct vm_area_struct *vma = NULL;
@@ -850,7 +848,7 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
if (is_vm_hugetlb_page(vma)) {
i = follow_hugetlb_page(mm, vma, pages, vmas,
&start, &nr_pages, i,
- gup_flags, nonblocking);
+ gup_flags, locked);
continue;
}
}
@@ -868,7 +866,7 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
page = follow_page_mask(vma, start, foll_flags, &ctx);
if (!page) {
ret = faultin_page(tsk, vma, start, &foll_flags,
- nonblocking);
+ locked);
switch (ret) {
case 0:
goto retry;
@@ -1129,7 +1127,7 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
* @vma: target vma
* @start: start address
* @end: end address
- * @nonblocking:
+ * @locked: whether the mmap_sem is still held
*
* This takes care of mlocking the pages too if VM_LOCKED is set.
*
@@ -1137,14 +1135,14 @@ static __always_inline long __get_user_pages_locked(struct task_struct *tsk,
*
* vma->vm_mm->mmap_sem must be held.
*
- * If @nonblocking is NULL, it may be held for read or write and will
+ * If @locked is NULL, it may be held for read or write and will
* be unperturbed.
*
- * If @nonblocking is non-NULL, it must held for read only and may be
- * released. If it's released, *@nonblocking will be set to 0.
+ * If @locked is non-NULL, it must held for read only and may be
+ * released. If it's released, *@locked will be set to 0.
*/
long populate_vma_page_range(struct vm_area_struct *vma,
- unsigned long start, unsigned long end, int *nonblocking)
+ unsigned long start, unsigned long end, int *locked)
{
struct mm_struct *mm = vma->vm_mm;
unsigned long nr_pages = (end - start) / PAGE_SIZE;
@@ -1179,7 +1177,7 @@ long populate_vma_page_range(struct vm_area_struct *vma,
* not result in a stack expansion that recurses back here.
*/
return __get_user_pages(current, mm, start, nr_pages, gup_flags,
- NULL, NULL, nonblocking);
+ NULL, NULL, locked);
}
/*
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index dd8737a94bec..c84f721db020 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4266,7 +4266,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
struct page **pages, struct vm_area_struct **vmas,
unsigned long *position, unsigned long *nr_pages,
- long i, unsigned int flags, int *nonblocking)
+ long i, unsigned int flags, int *locked)
{
unsigned long pfn_offset;
unsigned long vaddr = *position;
@@ -4337,7 +4337,7 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
spin_unlock(ptl);
if (flags & FOLL_WRITE)
fault_flags |= FAULT_FLAG_WRITE;
- if (nonblocking)
+ if (locked)
fault_flags |= FAULT_FLAG_ALLOW_RETRY;
if (flags & FOLL_NOWAIT)
fault_flags |= FAULT_FLAG_ALLOW_RETRY |
@@ -4354,9 +4354,9 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
break;
}
if (ret & VM_FAULT_RETRY) {
- if (nonblocking &&
+ if (locked &&
!(fault_flags & FAULT_FLAG_RETRY_NOWAIT))
- *nonblocking = 0;
+ *locked = 0;
*nr_pages = 0;
/*
* VM_FAULT_RETRY must not return an
--
2.24.1
^ permalink raw reply related
* [PATCH v6 02/16] mm/gup: Fix __get_user_pages() on fault retry of hugetlb
From: Peter Xu @ 2020-02-20 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Martin Cracauer, Mike Rapoport, Hugh Dickins, Jerome Glisse,
peterx, Kirill A . Shutemov, Matthew Wilcox, Pavel Emelyanov,
Brian Geffon, Maya Gokhale, Denis Plotnikov, Andrea Arcangeli,
Johannes Weiner, Dr . David Alan Gilbert, Linus Torvalds,
Mike Kravetz, Marty McFadden, David Hildenbrand, Bobby Powers,
Mel Gorman
In-Reply-To: <20200220145432.4561-1-peterx@redhat.com>
When follow_hugetlb_page() returns with *locked==0, it means we've got
a VM_FAULT_RETRY within the fauling process and we've released the
mmap_sem. When that happens, we should stop and bail out.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
mm/gup.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/gup.c b/mm/gup.c
index 1b4411bd0042..76cb420c0fb7 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -849,6 +849,16 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
i = follow_hugetlb_page(mm, vma, pages, vmas,
&start, &nr_pages, i,
gup_flags, locked);
+ if (locked && *locked == 0) {
+ /*
+ * We've got a VM_FAULT_RETRY
+ * and we've lost mmap_sem.
+ * We must stop here.
+ */
+ BUG_ON(gup_flags & FOLL_NOWAIT);
+ BUG_ON(ret != 0);
+ goto out;
+ }
continue;
}
}
--
2.24.1
^ permalink raw reply related
* [PATCH v6 00/16] mm: Page fault enhancements
From: Peter Xu @ 2020-02-20 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Martin Cracauer, Mike Rapoport, Hugh Dickins, Jerome Glisse,
peterx, Kirill A . Shutemov, Matthew Wilcox, Pavel Emelyanov,
Brian Geffon, Maya Gokhale, Denis Plotnikov, Andrea Arcangeli,
Johannes Weiner, Dr . David Alan Gilbert, Linus Torvalds,
Mike Kravetz, Marty McFadden, David Hildenbrand, Bobby Powers,
Mel Gorman
This is v6 of the series. It is majorly a rebase to 5.6-rc2, nothing
else to be expected (plus some tests after the rebase). Instead of
rewrite the cover letter I decided to use what we have for v5.
Adding extra CCs for both Bobby Powers <bobbypowers@gmail.com> and
Brian Geffon <bgeffon@google.com>.
Any review comment is appreciated. Thanks,
=============== v5 cover letter ==================
This is v5 of the series. As Matthew suggested, I split the previous
patch "mm: Return faster for non-fatal signals in user mode faults"
into a few smaller ones:
1. One patch to introduce fatal_signal_pending(), and use it in
archs that can directly apply
2. A few more patches to let the rest archs to use the new helper.
With that we can have an unified entry for signal detection
3. One last patch to change fatal_signal_pending() to detect
userspace non-fatal signal
Nothing should have changed in the rest patches. Because the fault
retry patches will depend on the previous ones, I decided to simply
repost all the patches.
Here's the new patchset layout:
Patch 1-2: cleanup, and potential bugfix of hugetlbfs on fault retry
Patch 3-9: let page fault to respond to non-fatal signals faster
Patch 10: remove the userfaultfd NOPAGE emulation
Patch 11-14: allow page fault to retry more than once
Patch 15-16: let gup code to use FAULT_FLAG_KILLABLE too
I would really appreciate any review comments for the series,
especially for the first two patches which IMHO are even not related
to this patchset and they should either cleanup or fix things.
Smoke tested on x86 only.
Thanks,
v5:
- split "mm: Return faster for non-fatal signals in user mode faults"
into a few more patches, let all archs to use an unified entry for
fast signal handling (fatal_signal_pending)
v4:
- use lore.kernel.org for all the links in commit messages [Kirill]
- one more patch ("mm/gup: Fix __get_user_pages() on fault retry of
hugetlb") to fix hugetlb path on fault retry
- one more patch ("mm/gup: Allow to react to fatal signals") to:
- use down_read_killable() properly [Linus]
- pass in FAULT_FLAG_KILLABLE for all GUP [Linus]
- one more patch ("mm/userfaultfd: Honor FAULT_FLAG_KILLABLE in fault
path") to let handle_userfaultfd() respect FAULT_FLAG_KILLABLE.
Should have no functional change after previous two new patches.
v3:
- check fatal signals in __get_user_page_locked() [Linus]
- add r-bs
v2:
- resent previous version, rebase only
=============== v1 cover letter ==================
This series is split out of userfaultfd-wp series to only cover the
general page fault changes, since it seems to make sense itself.
Basically it does two things:
(a) Allows the page fault handlers to be more interactive on not
only SIGKILL, but also the rest of userspace signals (especially
for user-mode faults), and,
(b) Allows the page fault retry (VM_FAULT_RETRY) to happen for more
than once.
I'm keeping the CC list as in uffd-wp v5, hopefully I'm not sending
too much spams...
And, instead of writting again the cover letter, I'm just copy-pasting
my previous link here which has more details on why we do this:
https://patchwork.kernel.org/cover/10691991/
The major change from that latest version should be that we introduced
a new page fault flag FAULT_FLAG_INTERRUPTIBLE as suggested by Linus
[1] to represents that we would like the fault handler to respond to
non-fatal signals. Also, we're more careful now on when to do the
immediate return of the page fault for such signals. For example, now
we'll only check against signal_pending() for user-mode page faults
and we keep the kernel-mode page fault patch untouched for it. More
information can be found in separate patches.
The patchset is only lightly tested on x86.
All comments are greatly welcomed. Thanks,
[1] https://lkml.org/lkml/2019/6/25/1382
Peter Xu (16):
mm/gup: Rename "nonblocking" to "locked" where proper
mm/gup: Fix __get_user_pages() on fault retry of hugetlb
mm: Introduce fault_signal_pending()
x86/mm: Use helper fault_signal_pending()
arc/mm: Use helper fault_signal_pending()
arm64/mm: Use helper fault_signal_pending()
powerpc/mm: Use helper fault_signal_pending()
sh/mm: Use helper fault_signal_pending()
mm: Return faster for non-fatal signals in user mode faults
userfaultfd: Don't retake mmap_sem to emulate NOPAGE
mm: Introduce FAULT_FLAG_DEFAULT
mm: Introduce FAULT_FLAG_INTERRUPTIBLE
mm: Allow VM_FAULT_RETRY for multiple times
mm/gup: Allow VM_FAULT_RETRY for multiple times
mm/gup: Allow to react to fatal signals
mm/userfaultfd: Honor FAULT_FLAG_KILLABLE in fault path
arch/alpha/mm/fault.c | 6 +--
arch/arc/mm/fault.c | 35 +++++--------
arch/arm/mm/fault.c | 7 +--
arch/arm64/mm/fault.c | 26 +++------
arch/hexagon/mm/vm_fault.c | 5 +-
arch/ia64/mm/fault.c | 5 +-
arch/m68k/mm/fault.c | 7 +--
arch/microblaze/mm/fault.c | 5 +-
arch/mips/mm/fault.c | 5 +-
arch/nds32/mm/fault.c | 5 +-
arch/nios2/mm/fault.c | 7 +--
arch/openrisc/mm/fault.c | 5 +-
arch/parisc/mm/fault.c | 8 ++-
arch/powerpc/mm/fault.c | 20 ++-----
arch/riscv/mm/fault.c | 9 +---
arch/s390/mm/fault.c | 10 ++--
arch/sh/mm/fault.c | 13 +++--
arch/sparc/mm/fault_32.c | 5 +-
arch/sparc/mm/fault_64.c | 5 +-
arch/um/kernel/trap.c | 3 +-
arch/unicore32/mm/fault.c | 8 ++-
arch/x86/mm/fault.c | 30 +++++------
arch/xtensa/mm/fault.c | 5 +-
drivers/gpu/drm/ttm/ttm_bo_vm.c | 12 +++--
fs/userfaultfd.c | 62 ++++++++++------------
include/linux/mm.h | 81 ++++++++++++++++++++++++----
include/linux/sched/signal.h | 14 +++++
mm/filemap.c | 2 +-
mm/gup.c | 93 +++++++++++++++++++++------------
mm/hugetlb.c | 17 +++---
mm/internal.h | 6 +--
31 files changed, 281 insertions(+), 240 deletions(-)
--
2.24.1
^ permalink raw reply
* [PATCH v6 03/16] mm: Introduce fault_signal_pending()
From: Peter Xu @ 2020-02-20 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Martin Cracauer, Mike Rapoport, Hugh Dickins, Jerome Glisse,
peterx, Kirill A . Shutemov, Matthew Wilcox, Pavel Emelyanov,
Brian Geffon, Maya Gokhale, Denis Plotnikov, Andrea Arcangeli,
Johannes Weiner, Dr . David Alan Gilbert, Linus Torvalds,
Mike Kravetz, Marty McFadden, David Hildenbrand, Bobby Powers,
Mel Gorman
In-Reply-To: <20200220145432.4561-1-peterx@redhat.com>
For most architectures, we've got a quick path to detect fatal signal
after a handle_mm_fault(). Introduce a helper for that quick path.
It cleans the current codes a bit so we don't need to duplicate the
same check across archs. More importantly, this will be an unified
place that we handle the signal immediately right after an interrupted
page fault, so it'll be much easier for us if we want to change the
behavior of handling signals later on for all the archs.
Note that currently only part of the archs are using this new helper,
because some archs have their own way to handle signals. In the
follow up patches, we'll try to apply this helper to all the rest of
archs.
Another note is that the "regs" parameter in the new helper is not
used yet. It'll be used very soon. Now we kept it in this patch only
to avoid touching all the archs again in the follow up patches.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/alpha/mm/fault.c | 2 +-
arch/arm/mm/fault.c | 2 +-
arch/hexagon/mm/vm_fault.c | 2 +-
arch/ia64/mm/fault.c | 2 +-
arch/m68k/mm/fault.c | 2 +-
arch/microblaze/mm/fault.c | 2 +-
arch/mips/mm/fault.c | 2 +-
arch/nds32/mm/fault.c | 2 +-
arch/nios2/mm/fault.c | 2 +-
arch/openrisc/mm/fault.c | 2 +-
arch/parisc/mm/fault.c | 2 +-
arch/riscv/mm/fault.c | 2 +-
arch/s390/mm/fault.c | 3 +--
arch/sparc/mm/fault_32.c | 2 +-
arch/sparc/mm/fault_64.c | 2 +-
arch/unicore32/mm/fault.c | 2 +-
arch/xtensa/mm/fault.c | 2 +-
include/linux/sched/signal.h | 13 +++++++++++++
18 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 741e61ef9d3f..aea33b599037 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -150,7 +150,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
the fault. */
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index bd0f4821f7e1..937b81ff8649 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -295,7 +295,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
* signal first. We do not need to release the mmap_sem because
* it would already be released in __lock_page_or_retry in
* mm/filemap.c. */
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
+ if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
goto no_context;
return 0;
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index b3bc71680ae4..d19beaf11b4c 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -91,7 +91,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
/* The most common case -- we are done. */
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index c2f299fe9e04..211b4f439384 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -141,7 +141,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index e9b1d7585b43..a455e202691b 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -138,7 +138,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
fault = handle_mm_fault(vma, address, flags);
pr_debug("handle_mm_fault returns %x\n", fault);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return 0;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c
index e6a810b0c7ad..cdde01dcdfc3 100644
--- a/arch/microblaze/mm/fault.c
+++ b/arch/microblaze/mm/fault.c
@@ -217,7 +217,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 1e8d00793784..0ee6fafc57bc 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -154,7 +154,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(regs))
return;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
diff --git a/arch/nds32/mm/fault.c b/arch/nds32/mm/fault.c
index 906dfb25353c..0e63f81eff5b 100644
--- a/arch/nds32/mm/fault.c
+++ b/arch/nds32/mm/fault.c
@@ -214,7 +214,7 @@ void do_page_fault(unsigned long entry, unsigned long addr,
* signal first. We do not need to release the mmap_sem because it
* would already be released in __lock_page_or_retry in mm/filemap.c.
*/
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
+ if (fault_signal_pending(fault, regs)) {
if (!user_mode(regs))
goto no_context;
return;
diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c
index 6a2e716b959f..704ace8ca0ee 100644
--- a/arch/nios2/mm/fault.c
+++ b/arch/nios2/mm/fault.c
@@ -133,7 +133,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c
index 5d4d3a9691d0..85c7eb0c0186 100644
--- a/arch/openrisc/mm/fault.c
+++ b/arch/openrisc/mm/fault.c
@@ -161,7 +161,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index adbd5e2144a3..f9be1d1cb43f 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -304,7 +304,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index cf7248e07f43..1d3869e9ddef 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -117,7 +117,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
* signal first. We do not need to release the mmap_sem because it
* would already be released in __lock_page_or_retry in mm/filemap.c.
*/
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(tsk))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 7b0bb475c166..179cf92a56e5 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -480,8 +480,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
* the fault.
*/
fault = handle_mm_fault(vma, address, flags);
- /* No reason to continue if interrupted by SIGKILL. */
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
+ if (fault_signal_pending(fault, regs)) {
fault = VM_FAULT_SIGNAL;
if (flags & FAULT_FLAG_RETRY_NOWAIT)
goto out_up;
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index 89976c9b936c..6efbeb227644 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -237,7 +237,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
index 8b7ddbd14b65..dd1ed6555831 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -425,7 +425,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
goto exit_exception;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/arch/unicore32/mm/fault.c b/arch/unicore32/mm/fault.c
index 76342de9cf8c..59d0e6ec2cfc 100644
--- a/arch/unicore32/mm/fault.c
+++ b/arch/unicore32/mm/fault.c
@@ -250,7 +250,7 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
* signal first. We do not need to release the mmap_sem because
* it would already be released in __lock_page_or_retry in
* mm/filemap.c. */
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return 0;
if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) {
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index bee30a77cd70..59515905d4ad 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -110,7 +110,7 @@ void do_page_fault(struct pt_regs *regs)
*/
fault = handle_mm_fault(vma, address, flags);
- if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ if (fault_signal_pending(fault, regs))
return;
if (unlikely(fault & VM_FAULT_ERROR)) {
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 88050259c466..4c87ffce64d1 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -369,6 +369,19 @@ static inline int signal_pending_state(long state, struct task_struct *p)
return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
}
+/*
+ * This should only be used in fault handlers to decide whether we
+ * should stop the current fault routine to handle the signals
+ * instead, especially with the case where we've got interrupted with
+ * a VM_FAULT_RETRY.
+ */
+static inline bool fault_signal_pending(unsigned int fault_flags,
+ struct pt_regs *regs)
+{
+ return unlikely((fault_flags & VM_FAULT_RETRY) &&
+ fatal_signal_pending(current));
+}
+
/*
* Reevaluate whether the task has signals pending delivery.
* Wake the task if so.
--
2.24.1
^ permalink raw reply related
* Re: [RFC PATCH v3 03/27] qcow2: Process QCOW2_CLUSTER_ZERO_ALLOC clusters in handle_copied()
From: Eric Blake @ 2020-02-20 14:53 UTC (permalink / raw)
To: Alberto Garcia, qemu-devel
Cc: Kevin Wolf, Anton Nefedov, qemu-block, Max Reitz,
Vladimir Sementsov-Ogievskiy, Denis V . Lunev
In-Reply-To: <e327f4c1ed2f9626ce018c1fd2b9db437721b30c.1577014346.git.berto@igalia.com>
On 12/22/19 5:36 AM, Alberto Garcia wrote:
> When writing to a qcow2 file there are two functions that take a
> virtual offset and return a host offset, possibly allocating new
> clusters if necessary:
>
> - handle_copied() looks for normal data clusters that are already
> allocated and have a reference count of 1. In those clusters we
> can simply write the data and there is no need to perform any
> copy-on-write.
>
> - handle_alloc() looks for clusters that do need copy-on-write,
> either because they haven't been allocated yet, because their
> reference count is != 1 or because they are ZERO_ALLOC clusters.
>
> The ZERO_ALLOC case is a bit special because those are clusters that
> are already allocated and they could perfectly be dealt with in
> handle_copied() (as long as copy-on-write is performed when required).
>
> In fact, there is extra code specifically for them in handle_alloc()
> that tries to reuse the existing allocation if possible and frees them
> otherwise.
>
> This patch changes the handling of ZERO_ALLOC clusters so the
> semantics of these two functions are now like this:
>
> - handle_copied() looks for clusters that are already allocated and
> which we can overwrite (NORMAL and ZERO_ALLOC clusters with a
> reference count of 1).
>
> - handle_alloc() looks for clusters for which we need a new
> allocation (all other cases).
>
> One importante difference after this change is that clusters found in
important
> handle_copied() may now require copy-on-write, but this will be anyway
> necessary once we add support for subclusters.
necessary anyway
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> block/qcow2-cluster.c | 226 +++++++++++++++++++++++-------------------
> 1 file changed, 126 insertions(+), 100 deletions(-)
A bit of an increase in code size, but I think it does reduce the
overall complexity to treat ZERO_ALLOC like normal. The patch is big,
but I don't see any sane way to split it. Overall, I like it.
>
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index e078bddcc2..9387f15866 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -1069,18 +1112,20 @@ static void calculate_l2_meta(BlockDriverState *bs,
> QLIST_INSERT_HEAD(&s->cluster_allocs, *m, next_in_flight);
> }
>
> -/* Returns true if writing to a cluster requires COW */
> -static bool cluster_needs_cow(BlockDriverState *bs, uint64_t l2_entry)
> +/* Returns true if writing to the cluster pointed to by @l2_entry
> + * requires a new allocation (that is, if the cluster is unallocated
> + * or has refcount > 1 and therefore cannot be written in-place). */
syntax check wants you to wing this comment, now.
> +static bool cluster_needs_new_alloc(BlockDriverState *bs, uint64_t l2_entry)
The rename makes sense.
> @@ -1337,9 +1400,10 @@ static int do_alloc_cluster_offset(BlockDriverState *bs, uint64_t guest_offset,
> }
>
> /*
> - * Allocates new clusters for an area that either is yet unallocated or needs a
> - * copy on write. If *host_offset is not INV_OFFSET, clusters are only
> - * allocated if the new allocation can match the specified host offset.
> + * Allocates new clusters for an area that either is yet unallocated or
> + * cannot be overwritten in-place. If *host_offset is not INV_OFFSET,
s/either is yet/is either still/
> + * clusters are only allocated if the new allocation can match the specified
> + * host offset.
> *
> * Note that guest_offset may not be cluster aligned. In this case, the
> * returned *host_offset points to exact byte referenced by guest_offset and
Findings are minor and you can fix them up when dropping RFC.
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
^ permalink raw reply
* [PATCH net 0/3] s390/qeth: fixes 2020-02-20
From: Julian Wiedmann @ 2020-02-20 14:54 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Heiko Carstens, Ursula Braun, Julian Wiedmann
Hi Dave,
please apply the following patch series for qeth to netdev's net tree.
This corrects three minor issues:
1) return a more fitting errno when VNICC cmds are not supported,
2) remove a bogus WARN in the NAPI code, and
3) be _very_ pedantic about the RX copybreak.
Thanks,
Julian
Alexandra Winter (1):
s390/qeth: vnicc Fix EOPNOTSUPP precedence
Julian Wiedmann (2):
s390/qeth: don't warn for napi with 0 budget
s390/qeth: fix off-by-one in RX copybreak check
drivers/s390/net/qeth_core_main.c | 3 +--
drivers/s390/net/qeth_l2_main.c | 29 +++++++++++++----------------
2 files changed, 14 insertions(+), 18 deletions(-)
--
2.17.1
^ permalink raw reply
* Su factura eletrónica.
From: 412684 LinuxMercedes @ 2020-02-20 14:54 UTC (permalink / raw)
To: linux-nvdimm
Estimado
cliente, linux-nvdimm@lists.01.org
Se
adjunta su factura electrónica para el mes de febrero.
Factura
20.02.2020(652KB).PDF
Saludos
Cordiales!
No respondas a este correo
electrónico.
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply
* Re: [PATCH 01/19] vfs: syscall: Add fsinfo() to query filesystem information [ver #16]
From: Jann Horn @ 2020-02-20 14:54 UTC (permalink / raw)
To: David Howells
Cc: Al Viro, raven, Miklos Szeredi, Christian Brauner, Linux API,
linux-fsdevel, kernel list
In-Reply-To: <584179.1582196636@warthog.procyon.org.uk>
On Thu, Feb 20, 2020 at 12:04 PM David Howells <dhowells@redhat.com> wrote:
> Jann Horn <jannh@google.com> wrote:
>
> > > +int fsinfo_string(const char *s, struct fsinfo_context *ctx)
> > ...
> > Please add a check here to ensure that "ret" actually fits into the
> > buffer (and use WARN_ON() if you think the check should never fire).
> > Otherwise I think this is too fragile.
>
> How about:
>
> int fsinfo_string(const char *s, struct fsinfo_context *ctx)
> {
> unsigned int len;
> char *p = ctx->buffer;
> int ret = 0;
> if (s) {
> len = strlen(s);
> if (len > ctx->buf_size - 1)
> len = ctx->buf_size;
> if (!ctx->want_size_only) {
> memcpy(p, s, len);
> p[len] = 0;
I think this is off-by-one? If len was too big, it is set to
ctx->buf_size, so in that case this effectively becomes
`ctx->buffer[ctx->buf_size] = 0`, which is one byte out of bounds,
right?
Maybe use something like `len = min_t(size_t, strlen(s), ctx->buf_size-1)` ?
Looks good apart from that, I think.
> }
> ret = len;
> }
> return ret;
> }
[...]
> > > + return ctx->usage;
> >
> > It is kind of weird that you have to return the ctx->usage everywhere
> > even though the caller already has ctx...
>
> At this point, it's only used and returned by fsinfo_attributes() and really
> is only for the use of the attribute getter function.
>
> I could, I suppose, return the amount of data in ctx->usage and then preset it
> for VSTRUCT-type objects. Unfortunately, I can't make the getter return void
> since it might have to return an error.
Yeah, then you'd be passing around the error separately from the
length... I don't know whether that'd make things better or worse.
[...]
> > > +struct fsinfo_attribute {
> > > + unsigned int attr_id; /* The ID of the attribute */
> > > + enum fsinfo_value_type type:8; /* The type of the attribute's value(s) */
> > > + unsigned int flags:8;
> > > + unsigned int size:16; /* - Value size (FSINFO_STRUCT) */
> > > + unsigned int element_size:16; /* - Element size (FSINFO_LIST) */
> > > + int (*get)(struct path *path, struct fsinfo_context *params);
> > > +};
> >
> > Why the bitfields? It doesn't look like that's going to help you much,
> > you'll just end up with 6 bytes of holes on x86-64:
>
> Expanding them to non-bitfields will require an extra 10 bytes, making the
> struct 8 bytes bigger with 4 bytes of padding. I can do that if you'd rather.
Wouldn't this still have the same total size?
struct fsinfo_attribute {
unsigned int attr_id; /* 0x0-0x3 */
enum fsinfo_value_type type; /* 0x4-0x7 */
u8 flags; /* 0x8-0x8 */
/* 1-byte hole */
u16 size; /* 0xa-0xb */
u16 element_size; /* 0xc-0xd */
/* 2-byte hole */
int (*get)(...); /* 0x10-0x18 */
};
But it's not like I really care about this detail all that much, feel
free to leave it as-is.
^ permalink raw reply
* [PATCH net 3/3] s390/qeth: fix off-by-one in RX copybreak check
From: Julian Wiedmann @ 2020-02-20 14:54 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Heiko Carstens, Ursula Braun, Julian Wiedmann
In-Reply-To: <20200220145456.11571-1-jwi@linux.ibm.com>
The RX copybreak is intended as the _max_ value where the frame's data
should be copied. So for frame_len == copybreak, don't build an SG skb.
Fixes: 4a71df50047f ("qeth: new qeth device driver")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
drivers/s390/net/qeth_core_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 2264c6619def..5efcaa43615b 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5344,7 +5344,7 @@ static int qeth_extract_skb(struct qeth_card *card,
}
use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) ||
- ((skb_len >= card->options.rx_sg_cb) &&
+ (skb_len > card->options.rx_sg_cb &&
!atomic_read(&card->force_alloc_skb) &&
!IS_OSN(card));
--
2.17.1
^ permalink raw reply related
* Re: [PATCH] backlight: add led-backlight driver
From: Tony Lindgren @ 2020-02-20 14:54 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Pavel Machek, Lee Jones, kernel list, linux-arm-kernel,
linux-omap, nekit1000, mpartap, merlijn, martin_rysavy, agx,
daniel.thompson, jingoohan1, dri-devel, tomi.valkeinen, jjhiblot
In-Reply-To: <20200219234437.l6ac7usebu7rnzsy@earth.universe>
* Sebastian Reichel <sre@kernel.org> [200219 23:45]:
> Finally :)
>
> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Yeah thanks for your persistent effort on getting this working :)
Regards,
Tony
^ permalink raw reply
* [PATCH net 1/3] s390/qeth: vnicc Fix EOPNOTSUPP precedence
From: Julian Wiedmann @ 2020-02-20 14:54 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Heiko Carstens, Ursula Braun,
Alexandra Winter, Julian Wiedmann
In-Reply-To: <20200220145456.11571-1-jwi@linux.ibm.com>
From: Alexandra Winter <wintera@linux.ibm.com>
When getting or setting VNICC parameters, the error code EOPNOTSUPP
should have precedence over EBUSY.
EBUSY is used because vnicc feature and bridgeport feature are mutually
exclusive, which is a temporary condition.
Whereas EOPNOTSUPP indicates that the HW does not support all or parts of
the vnicc feature.
This issue causes the vnicc sysfs params to show 'blocked by bridgeport'
for HW that does not support VNICC at all.
Fixes: caa1f0b10d18 ("s390/qeth: add VNICC enable/disable support")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
drivers/s390/net/qeth_l2_main.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 692bd2623401..9972d96820f3 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1707,15 +1707,14 @@ int qeth_l2_vnicc_set_state(struct qeth_card *card, u32 vnicc, bool state)
QETH_CARD_TEXT(card, 2, "vniccsch");
- /* do not change anything if BridgePort is enabled */
- if (qeth_bridgeport_is_in_use(card))
- return -EBUSY;
-
/* check if characteristic and enable/disable are supported */
if (!(card->options.vnicc.sup_chars & vnicc) ||
!(card->options.vnicc.set_char_sup & vnicc))
return -EOPNOTSUPP;
+ if (qeth_bridgeport_is_in_use(card))
+ return -EBUSY;
+
/* set enable/disable command and store wanted characteristic */
if (state) {
cmd = IPA_VNICC_ENABLE;
@@ -1761,14 +1760,13 @@ int qeth_l2_vnicc_get_state(struct qeth_card *card, u32 vnicc, bool *state)
QETH_CARD_TEXT(card, 2, "vniccgch");
- /* do not get anything if BridgePort is enabled */
- if (qeth_bridgeport_is_in_use(card))
- return -EBUSY;
-
/* check if characteristic is supported */
if (!(card->options.vnicc.sup_chars & vnicc))
return -EOPNOTSUPP;
+ if (qeth_bridgeport_is_in_use(card))
+ return -EBUSY;
+
/* if card is ready, query current VNICC state */
if (qeth_card_hw_is_reachable(card))
rc = qeth_l2_vnicc_query_chars(card);
@@ -1786,15 +1784,14 @@ int qeth_l2_vnicc_set_timeout(struct qeth_card *card, u32 timeout)
QETH_CARD_TEXT(card, 2, "vniccsto");
- /* do not change anything if BridgePort is enabled */
- if (qeth_bridgeport_is_in_use(card))
- return -EBUSY;
-
/* check if characteristic and set_timeout are supported */
if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
!(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
return -EOPNOTSUPP;
+ if (qeth_bridgeport_is_in_use(card))
+ return -EBUSY;
+
/* do we need to do anything? */
if (card->options.vnicc.learning_timeout == timeout)
return rc;
@@ -1823,14 +1820,14 @@ int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout)
QETH_CARD_TEXT(card, 2, "vniccgto");
- /* do not get anything if BridgePort is enabled */
- if (qeth_bridgeport_is_in_use(card))
- return -EBUSY;
-
/* check if characteristic and get_timeout are supported */
if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) ||
!(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING))
return -EOPNOTSUPP;
+
+ if (qeth_bridgeport_is_in_use(card))
+ return -EBUSY;
+
/* if card is ready, get timeout. Otherwise, just return stored value */
*timeout = card->options.vnicc.learning_timeout;
if (qeth_card_hw_is_reachable(card))
--
2.17.1
^ permalink raw reply related
* [PATCH net 2/3] s390/qeth: don't warn for napi with 0 budget
From: Julian Wiedmann @ 2020-02-20 14:54 UTC (permalink / raw)
To: David Miller
Cc: netdev, linux-s390, Heiko Carstens, Ursula Braun, Julian Wiedmann
In-Reply-To: <20200220145456.11571-1-jwi@linux.ibm.com>
Calling napi->poll() with 0 budget is a legitimate use by netpoll.
Fixes: a1c3ed4c9ca0 ("qeth: NAPI support for l2 and l3 discipline")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
drivers/s390/net/qeth_core_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 9639938581f5..2264c6619def 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -5447,7 +5447,6 @@ static int qeth_extract_skbs(struct qeth_card *card, int budget,
{
int work_done = 0;
- WARN_ON_ONCE(!budget);
*done = false;
while (budget) {
--
2.17.1
^ permalink raw reply related
* [MODERATED] Re: [PATCH 0/2] more sampling fun 0
From: Andi Kleen @ 2020-02-20 14:55 UTC (permalink / raw)
To: speck
In-Reply-To: <20200220081420.GA3328448@kroah.com>
> Then we need to stop using RDRAND internally for our "give me a random
> number api" which has spread to more and more parts of the kernel.
Only if that API is called frequently enough. AFAIK it is not.
Normally it's used for rare rekeying of hash tables etc., which
doesn't happen very often.
> Here's a patch that does so:
> https://lore.kernel.org/lkml/20200216161836.1976-1-Jason@zx2c4.com/
> which I'm going to advise get merged now and backported to the stable
> branches.
Don't see any reason at this point. Only do it if there's an actual
indication of a problem.
-Andi
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.