* [PATCH v5] ASoC: fsl_esai: Add pm runtime function
From: Nicolin Chen @ 2019-05-03 19:49 UTC (permalink / raw)
To: broonie, shengjiu.wang
Cc: alsa-devel, timur, lgirdwood, linuxppc-dev, Xiubo.Lee, tiwai,
perex, festevam, linux-kernel
From: "S.j. Wang" <shengjiu.wang@nxp.com>
Add pm runtime support and move clock handling there.
Close the clocks at suspend to reduce the power consumption.
fsl_esai_suspend is replaced by pm_runtime_force_suspend.
fsl_esai_resume is replaced by pm_runtime_force_resume.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
Changes in v5
-Replaced my Acked-by with Signed-off-by as a resend.
Changes in v4
-resend base on for-5.2
Changes in v3
-refine the commit comments.
-add acked-by
Changes in v2
-refine the commit comments.
-move regcache_mark_dirty to runtime suspend.
sound/soc/fsl/fsl_esai.c | 141 +++++++++++++++++++++------------------
1 file changed, 77 insertions(+), 64 deletions(-)
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index c7410bbfd2af..022368c8a074 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
#include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h>
@@ -466,30 +467,6 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
- int ret;
-
- /*
- * Some platforms might use the same bit to gate all three or two of
- * clocks, so keep all clocks open/close at the same time for safety
- */
- ret = clk_prepare_enable(esai_priv->coreclk);
- if (ret)
- return ret;
- if (!IS_ERR(esai_priv->spbaclk)) {
- ret = clk_prepare_enable(esai_priv->spbaclk);
- if (ret)
- goto err_spbaclk;
- }
- if (!IS_ERR(esai_priv->extalclk)) {
- ret = clk_prepare_enable(esai_priv->extalclk);
- if (ret)
- goto err_extalck;
- }
- if (!IS_ERR(esai_priv->fsysclk)) {
- ret = clk_prepare_enable(esai_priv->fsysclk);
- if (ret)
- goto err_fsysclk;
- }
if (!dai->active) {
/* Set synchronous mode */
@@ -506,16 +483,6 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
return 0;
-err_fsysclk:
- if (!IS_ERR(esai_priv->extalclk))
- clk_disable_unprepare(esai_priv->extalclk);
-err_extalck:
- if (!IS_ERR(esai_priv->spbaclk))
- clk_disable_unprepare(esai_priv->spbaclk);
-err_spbaclk:
- clk_disable_unprepare(esai_priv->coreclk);
-
- return ret;
}
static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
@@ -576,20 +543,6 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
return 0;
}
-static void fsl_esai_shutdown(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
-
- if (!IS_ERR(esai_priv->fsysclk))
- clk_disable_unprepare(esai_priv->fsysclk);
- if (!IS_ERR(esai_priv->extalclk))
- clk_disable_unprepare(esai_priv->extalclk);
- if (!IS_ERR(esai_priv->spbaclk))
- clk_disable_unprepare(esai_priv->spbaclk);
- clk_disable_unprepare(esai_priv->coreclk);
-}
-
static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
@@ -658,7 +611,6 @@ static int fsl_esai_trigger(struct snd_pcm_substream *substream, int cmd,
static const struct snd_soc_dai_ops fsl_esai_dai_ops = {
.startup = fsl_esai_startup,
- .shutdown = fsl_esai_shutdown,
.trigger = fsl_esai_trigger,
.hw_params = fsl_esai_hw_params,
.set_sysclk = fsl_esai_set_dai_sysclk,
@@ -947,6 +899,10 @@ static int fsl_esai_probe(struct platform_device *pdev)
return ret;
}
+ pm_runtime_enable(&pdev->dev);
+
+ regcache_cache_only(esai_priv->regmap, true);
+
ret = imx_pcm_dma_init(pdev, IMX_ESAI_DMABUF_SIZE);
if (ret)
dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret);
@@ -954,6 +910,13 @@ static int fsl_esai_probe(struct platform_device *pdev)
return ret;
}
+static int fsl_esai_remove(struct platform_device *pdev)
+{
+ pm_runtime_disable(&pdev->dev);
+
+ return 0;
+}
+
static const struct of_device_id fsl_esai_dt_ids[] = {
{ .compatible = "fsl,imx35-esai", },
{ .compatible = "fsl,vf610-esai", },
@@ -961,22 +924,35 @@ static const struct of_device_id fsl_esai_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, fsl_esai_dt_ids);
-#ifdef CONFIG_PM_SLEEP
-static int fsl_esai_suspend(struct device *dev)
-{
- struct fsl_esai *esai = dev_get_drvdata(dev);
-
- regcache_cache_only(esai->regmap, true);
- regcache_mark_dirty(esai->regmap);
-
- return 0;
-}
-
-static int fsl_esai_resume(struct device *dev)
+#ifdef CONFIG_PM
+static int fsl_esai_runtime_resume(struct device *dev)
{
struct fsl_esai *esai = dev_get_drvdata(dev);
int ret;
+ /*
+ * Some platforms might use the same bit to gate all three or two of
+ * clocks, so keep all clocks open/close at the same time for safety
+ */
+ ret = clk_prepare_enable(esai->coreclk);
+ if (ret)
+ return ret;
+ if (!IS_ERR(esai->spbaclk)) {
+ ret = clk_prepare_enable(esai->spbaclk);
+ if (ret)
+ goto err_spbaclk;
+ }
+ if (!IS_ERR(esai->extalclk)) {
+ ret = clk_prepare_enable(esai->extalclk);
+ if (ret)
+ goto err_extalclk;
+ }
+ if (!IS_ERR(esai->fsysclk)) {
+ ret = clk_prepare_enable(esai->fsysclk);
+ if (ret)
+ goto err_fsysclk;
+ }
+
regcache_cache_only(esai->regmap, false);
/* FIFO reset for safety */
@@ -987,22 +963,59 @@ static int fsl_esai_resume(struct device *dev)
ret = regcache_sync(esai->regmap);
if (ret)
- return ret;
+ goto err_regcache_sync;
/* FIFO reset done */
regmap_update_bits(esai->regmap, REG_ESAI_TFCR, ESAI_xFCR_xFR, 0);
regmap_update_bits(esai->regmap, REG_ESAI_RFCR, ESAI_xFCR_xFR, 0);
+ return 0;
+
+err_regcache_sync:
+ if (!IS_ERR(esai->fsysclk))
+ clk_disable_unprepare(esai->fsysclk);
+err_fsysclk:
+ if (!IS_ERR(esai->extalclk))
+ clk_disable_unprepare(esai->extalclk);
+err_extalclk:
+ if (!IS_ERR(esai->spbaclk))
+ clk_disable_unprepare(esai->spbaclk);
+err_spbaclk:
+ clk_disable_unprepare(esai->coreclk);
+
+ return ret;
+}
+
+static int fsl_esai_runtime_suspend(struct device *dev)
+{
+ struct fsl_esai *esai = dev_get_drvdata(dev);
+
+ regcache_cache_only(esai->regmap, true);
+ regcache_mark_dirty(esai->regmap);
+
+ if (!IS_ERR(esai->fsysclk))
+ clk_disable_unprepare(esai->fsysclk);
+ if (!IS_ERR(esai->extalclk))
+ clk_disable_unprepare(esai->extalclk);
+ if (!IS_ERR(esai->spbaclk))
+ clk_disable_unprepare(esai->spbaclk);
+ clk_disable_unprepare(esai->coreclk);
+
return 0;
}
-#endif /* CONFIG_PM_SLEEP */
+#endif /* CONFIG_PM */
static const struct dev_pm_ops fsl_esai_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(fsl_esai_suspend, fsl_esai_resume)
+ SET_RUNTIME_PM_OPS(fsl_esai_runtime_suspend,
+ fsl_esai_runtime_resume,
+ NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
};
static struct platform_driver fsl_esai_driver = {
.probe = fsl_esai_probe,
+ .remove = fsl_esai_remove,
.driver = {
.name = "fsl-esai-dai",
.pm = &fsl_esai_pm_ops,
--
2.17.1
^ permalink raw reply related
* Re: [EXT] Re: [PATCH V4] ASoC: fsl_esai: Add pm runtime function
From: Nicolin Chen @ 2019-05-03 19:56 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com, S.j. Wang,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20190503042731.GX14916@sirena.org.uk>
Hi Mark,
On Fri, May 03, 2019 at 01:27:31PM +0900, Mark Brown wrote:
> On Thu, May 02, 2019 at 09:13:58AM +0000, S.j. Wang wrote:
>
> > I am checking, but I don't know why this patch failed in your side. I
> > Tried to apply this patch on for-5.1, for 5.2, for-linus and for-next, all are
> > Successful. The git is git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git.
>
> > I can't reproduce your problem. Is there any my operation wrong?
>
> The error message I got was:
>
> Applying: ASoC: fsl_esai: Add pm runtime function
> error: patch failed: sound/soc/fsl/fsl_esai.c:9
> error: sound/soc/fsl/fsl_esai.c: patch does not apply
> Patch failed at 0001 ASoC: fsl_esai: Add pm runtime function
>
> which is the header addition. I can't spot any obvious issues visually
> looking at the patch, only thing I can think is some kind of whitespace
> damage somewhere.
I downloaded this v4 from patchwork and resubmitted a v5 for a
test. Would you please try to apply that one?
If my v5 works vs. having merge conflict at v4, maybe something
wrong with Git version of Shengjiu's? I compared my v5 and his
v4 using vimdiff, there is no much difference of whitespace.
Thanks
Nicolin
^ permalink raw reply
* [PATCH] mm: add account_locked_vm utility function
From: Daniel Jordan @ 2019-05-03 20:16 UTC (permalink / raw)
To: akpm
Cc: Mark Rutland, Davidlohr Bueso, kvm, Alan Tull,
Alexey Kardashevskiy, linux-fpga, linux-kernel, kvm-ppc,
Daniel Jordan, linux-mm, Alex Williamson, Jason Gunthorpe,
Moritz Fischer, Steve Sistare, Christoph Lameter, linuxppc-dev,
Wu Hao
locked_vm accounting is done roughly the same way in five places, so
unify them in a helper. Standardize the debug prints, which vary
slightly. Error codes stay the same, so user-visible behavior does too.
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Alan Tull <atull@kernel.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Steve Sistare <steven.sistare@oracle.com>
Cc: Wu Hao <hao.wu@intel.com>
Cc: linux-mm@kvack.org
Cc: kvm@vger.kernel.org
Cc: kvm-ppc@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-fpga@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Based on v5.1-rc7. Tested with the vfio type1 driver. Any feedback
welcome.
Andrew, this one patch replaces these six from [1]:
mm-change-locked_vms-type-from-unsigned-long-to-atomic64_t.patch
vfio-type1-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
vfio-spapr_tce-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
fpga-dlf-afu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
kvm-book3s-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
powerpc-mmu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
That series converts locked_vm to an atomic, but on closer inspection causes at
least one accounting race in mremap, and fixing it just for this type
conversion came with too much ugly in the core mm to justify, especially when
the right long-term fix is making these drivers use pinned_vm instead.
Christophe's suggestion of cmpxchg[2] does prevent the races he
mentioned for pinned_vm, but others would still remain. In perf_mmap
and the hfi1 driver, pinned_vm is checked against the rlimit racily and
then later increased when the pinned_vm originally read may have gone
stale. Any fixes for that, that I could think of, seem about as good as
what's there now, so I left it. I have a patch that uses cmpxchg with
pinned_vm if others feel strongly that the aforementioned races should
be fixed.
Daniel
[1] https://lore.kernel.org/linux-mm/20190402204158.27582-1-daniel.m.jordan@oracle.com/
[2] https://lore.kernel.org/linux-mm/964bd5b0-f1e5-7bf0-5c58-18e75c550841@c-s.fr/
arch/powerpc/kvm/book3s_64_vio.c | 44 +++---------------------
arch/powerpc/mm/mmu_context_iommu.c | 41 +++-------------------
drivers/fpga/dfl-afu-dma-region.c | 53 +++--------------------------
drivers/vfio/vfio_iommu_spapr_tce.c | 52 +++++-----------------------
drivers/vfio/vfio_iommu_type1.c | 23 ++++---------
include/linux/mm.h | 19 +++++++++++
mm/util.c | 48 ++++++++++++++++++++++++++
7 files changed, 94 insertions(+), 186 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index f02b04973710..f7d37fa6003a 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -30,6 +30,7 @@
#include <linux/anon_inodes.h>
#include <linux/iommu.h>
#include <linux/file.h>
+#include <linux/mm.h>
#include <asm/kvm_ppc.h>
#include <asm/kvm_book3s.h>
@@ -56,43 +57,6 @@ static unsigned long kvmppc_stt_pages(unsigned long tce_pages)
return tce_pages + ALIGN(stt_bytes, PAGE_SIZE) / PAGE_SIZE;
}
-static long kvmppc_account_memlimit(unsigned long stt_pages, bool inc)
-{
- long ret = 0;
-
- if (!current || !current->mm)
- return ret; /* process exited */
-
- down_write(¤t->mm->mmap_sem);
-
- if (inc) {
- unsigned long locked, lock_limit;
-
- locked = current->mm->locked_vm + stt_pages;
- lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
- ret = -ENOMEM;
- else
- current->mm->locked_vm += stt_pages;
- } else {
- if (WARN_ON_ONCE(stt_pages > current->mm->locked_vm))
- stt_pages = current->mm->locked_vm;
-
- current->mm->locked_vm -= stt_pages;
- }
-
- pr_debug("[%d] RLIMIT_MEMLOCK KVM %c%ld %ld/%ld%s\n", current->pid,
- inc ? '+' : '-',
- stt_pages << PAGE_SHIFT,
- current->mm->locked_vm << PAGE_SHIFT,
- rlimit(RLIMIT_MEMLOCK),
- ret ? " - exceeded" : "");
-
- up_write(¤t->mm->mmap_sem);
-
- return ret;
-}
-
static void kvm_spapr_tce_iommu_table_free(struct rcu_head *head)
{
struct kvmppc_spapr_tce_iommu_table *stit = container_of(head,
@@ -277,7 +241,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
kvm_put_kvm(stt->kvm);
- kvmppc_account_memlimit(
+ account_locked_vm(current->mm,
kvmppc_stt_pages(kvmppc_tce_pages(stt->size)), false);
call_rcu(&stt->rcu, release_spapr_tce_table);
@@ -303,7 +267,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
return -EINVAL;
npages = kvmppc_tce_pages(size);
- ret = kvmppc_account_memlimit(kvmppc_stt_pages(npages), true);
+ ret = account_locked_vm(current->mm, kvmppc_stt_pages(npages), true);
if (ret)
return ret;
@@ -359,7 +323,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
kfree(stt);
fail_acct:
- kvmppc_account_memlimit(kvmppc_stt_pages(npages), false);
+ account_locked_vm(current->mm, kvmppc_stt_pages(npages), false);
return ret;
}
diff --git a/arch/powerpc/mm/mmu_context_iommu.c b/arch/powerpc/mm/mmu_context_iommu.c
index 8330f135294f..9e7001a70570 100644
--- a/arch/powerpc/mm/mmu_context_iommu.c
+++ b/arch/powerpc/mm/mmu_context_iommu.c
@@ -19,6 +19,7 @@
#include <linux/hugetlb.h>
#include <linux/swap.h>
#include <linux/sizes.h>
+#include <linux/mm.h>
#include <asm/mmu_context.h>
#include <asm/pte-walk.h>
#include <linux/mm_inline.h>
@@ -51,40 +52,6 @@ struct mm_iommu_table_group_mem_t {
u64 dev_hpa; /* Device memory base address */
};
-static long mm_iommu_adjust_locked_vm(struct mm_struct *mm,
- unsigned long npages, bool incr)
-{
- long ret = 0, locked, lock_limit;
-
- if (!npages)
- return 0;
-
- down_write(&mm->mmap_sem);
-
- if (incr) {
- locked = mm->locked_vm + npages;
- lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
- ret = -ENOMEM;
- else
- mm->locked_vm += npages;
- } else {
- if (WARN_ON_ONCE(npages > mm->locked_vm))
- npages = mm->locked_vm;
- mm->locked_vm -= npages;
- }
-
- pr_debug("[%d] RLIMIT_MEMLOCK HASH64 %c%ld %ld/%ld\n",
- current ? current->pid : 0,
- incr ? '+' : '-',
- npages << PAGE_SHIFT,
- mm->locked_vm << PAGE_SHIFT,
- rlimit(RLIMIT_MEMLOCK));
- up_write(&mm->mmap_sem);
-
- return ret;
-}
-
bool mm_iommu_preregistered(struct mm_struct *mm)
{
return !list_empty(&mm->context.iommu_group_mem_list);
@@ -101,7 +68,7 @@ static long mm_iommu_do_alloc(struct mm_struct *mm, unsigned long ua,
unsigned long entry, chunk;
if (dev_hpa == MM_IOMMU_TABLE_INVALID_HPA) {
- ret = mm_iommu_adjust_locked_vm(mm, entries, true);
+ ret = account_locked_vm(mm, entries, true);
if (ret)
return ret;
@@ -215,7 +182,7 @@ static long mm_iommu_do_alloc(struct mm_struct *mm, unsigned long ua,
kfree(mem);
unlock_exit:
- mm_iommu_adjust_locked_vm(mm, locked_entries, false);
+ account_locked_vm(mm, locked_entries, false);
return ret;
}
@@ -315,7 +282,7 @@ long mm_iommu_put(struct mm_struct *mm, struct mm_iommu_table_group_mem_t *mem)
unlock_exit:
mutex_unlock(&mem_list_mutex);
- mm_iommu_adjust_locked_vm(mm, unlock_entries, false);
+ account_locked_vm(mm, unlock_entries, false);
return ret;
}
diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c
index e18a786fc943..059438e17193 100644
--- a/drivers/fpga/dfl-afu-dma-region.c
+++ b/drivers/fpga/dfl-afu-dma-region.c
@@ -12,6 +12,7 @@
#include <linux/dma-mapping.h>
#include <linux/sched/signal.h>
#include <linux/uaccess.h>
+#include <linux/mm.h>
#include "dfl-afu.h"
@@ -31,52 +32,6 @@ void afu_dma_region_init(struct dfl_feature_platform_data *pdata)
afu->dma_regions = RB_ROOT;
}
-/**
- * afu_dma_adjust_locked_vm - adjust locked memory
- * @dev: port device
- * @npages: number of pages
- * @incr: increase or decrease locked memory
- *
- * Increase or decrease the locked memory size with npages input.
- *
- * Return 0 on success.
- * Return -ENOMEM if locked memory size is over the limit and no CAP_IPC_LOCK.
- */
-static int afu_dma_adjust_locked_vm(struct device *dev, long npages, bool incr)
-{
- unsigned long locked, lock_limit;
- int ret = 0;
-
- /* the task is exiting. */
- if (!current->mm)
- return 0;
-
- down_write(¤t->mm->mmap_sem);
-
- if (incr) {
- locked = current->mm->locked_vm + npages;
- lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
-
- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
- ret = -ENOMEM;
- else
- current->mm->locked_vm += npages;
- } else {
- if (WARN_ON_ONCE(npages > current->mm->locked_vm))
- npages = current->mm->locked_vm;
- current->mm->locked_vm -= npages;
- }
-
- dev_dbg(dev, "[%d] RLIMIT_MEMLOCK %c%ld %ld/%ld%s\n", current->pid,
- incr ? '+' : '-', npages << PAGE_SHIFT,
- current->mm->locked_vm << PAGE_SHIFT, rlimit(RLIMIT_MEMLOCK),
- ret ? "- exceeded" : "");
-
- up_write(¤t->mm->mmap_sem);
-
- return ret;
-}
-
/**
* afu_dma_pin_pages - pin pages of given dma memory region
* @pdata: feature device platform data
@@ -92,7 +47,7 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata,
struct device *dev = &pdata->dev->dev;
int ret, pinned;
- ret = afu_dma_adjust_locked_vm(dev, npages, true);
+ ret = account_locked_vm(current->mm, npages, true);
if (ret)
return ret;
@@ -121,7 +76,7 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata,
free_pages:
kfree(region->pages);
unlock_vm:
- afu_dma_adjust_locked_vm(dev, npages, false);
+ account_locked_vm(current->mm, npages, false);
return ret;
}
@@ -141,7 +96,7 @@ static void afu_dma_unpin_pages(struct dfl_feature_platform_data *pdata,
put_all_pages(region->pages, npages);
kfree(region->pages);
- afu_dma_adjust_locked_vm(dev, npages, false);
+ account_locked_vm(current->mm, npages, false);
dev_dbg(dev, "%ld pages unpinned\n", npages);
}
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
index 6b64e45a5269..d39a1b830d82 100644
--- a/drivers/vfio/vfio_iommu_spapr_tce.c
+++ b/drivers/vfio/vfio_iommu_spapr_tce.c
@@ -22,6 +22,7 @@
#include <linux/vmalloc.h>
#include <linux/sched/mm.h>
#include <linux/sched/signal.h>
+#include <linux/mm.h>
#include <asm/iommu.h>
#include <asm/tce.h>
@@ -34,49 +35,13 @@
static void tce_iommu_detach_group(void *iommu_data,
struct iommu_group *iommu_group);
-static long try_increment_locked_vm(struct mm_struct *mm, long npages)
+static int tce_account_locked_vm(struct mm_struct *mm, unsigned long npages,
+ bool inc)
{
- long ret = 0, locked, lock_limit;
-
if (WARN_ON_ONCE(!mm))
return -EPERM;
- if (!npages)
- return 0;
-
- down_write(&mm->mmap_sem);
- locked = mm->locked_vm + npages;
- lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
- ret = -ENOMEM;
- else
- mm->locked_vm += npages;
-
- pr_debug("[%d] RLIMIT_MEMLOCK +%ld %ld/%ld%s\n", current->pid,
- npages << PAGE_SHIFT,
- mm->locked_vm << PAGE_SHIFT,
- rlimit(RLIMIT_MEMLOCK),
- ret ? " - exceeded" : "");
-
- up_write(&mm->mmap_sem);
-
- return ret;
-}
-
-static void decrement_locked_vm(struct mm_struct *mm, long npages)
-{
- if (!mm || !npages)
- return;
-
- down_write(&mm->mmap_sem);
- if (WARN_ON_ONCE(npages > mm->locked_vm))
- npages = mm->locked_vm;
- mm->locked_vm -= npages;
- pr_debug("[%d] RLIMIT_MEMLOCK -%ld %ld/%ld\n", current->pid,
- npages << PAGE_SHIFT,
- mm->locked_vm << PAGE_SHIFT,
- rlimit(RLIMIT_MEMLOCK));
- up_write(&mm->mmap_sem);
+ return account_locked_vm(mm, npages, inc);
}
/*
@@ -336,7 +301,7 @@ static int tce_iommu_enable(struct tce_container *container)
return ret;
locked = table_group->tce32_size >> PAGE_SHIFT;
- ret = try_increment_locked_vm(container->mm, locked);
+ ret = tce_account_locked_vm(container->mm, locked, true);
if (ret)
return ret;
@@ -355,7 +320,7 @@ static void tce_iommu_disable(struct tce_container *container)
container->enabled = false;
BUG_ON(!container->mm);
- decrement_locked_vm(container->mm, container->locked_pages);
+ tce_account_locked_vm(container->mm, container->locked_pages, false);
}
static void *tce_iommu_open(unsigned long arg)
@@ -658,7 +623,8 @@ static long tce_iommu_create_table(struct tce_container *container,
if (!table_size)
return -EINVAL;
- ret = try_increment_locked_vm(container->mm, table_size >> PAGE_SHIFT);
+ ret = tce_account_locked_vm(container->mm, table_size >> PAGE_SHIFT,
+ true);
if (ret)
return ret;
@@ -677,7 +643,7 @@ static void tce_iommu_free_table(struct tce_container *container,
unsigned long pages = tbl->it_allocated_size >> PAGE_SHIFT;
iommu_tce_table_put(tbl);
- decrement_locked_vm(container->mm, pages);
+ tce_account_locked_vm(container->mm, pages, false);
}
static long tce_iommu_create_window(struct tce_container *container,
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index d0f731c9920a..15ac76171ccd 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -273,25 +273,14 @@ static int vfio_lock_acct(struct vfio_dma *dma, long npage, bool async)
return -ESRCH; /* process exited */
ret = down_write_killable(&mm->mmap_sem);
- if (!ret) {
- if (npage > 0) {
- if (!dma->lock_cap) {
- unsigned long limit;
-
- limit = task_rlimit(dma->task,
- RLIMIT_MEMLOCK) >> PAGE_SHIFT;
-
- if (mm->locked_vm + npage > limit)
- ret = -ENOMEM;
- }
- }
+ if (ret)
+ goto out;
- if (!ret)
- mm->locked_vm += npage;
-
- up_write(&mm->mmap_sem);
- }
+ ret = __account_locked_vm(mm, abs(npage), npage > 0, dma->task,
+ dma->lock_cap);
+ up_write(&mm->mmap_sem);
+out:
if (async)
mmput(mm);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6b10c21630f5..7134e55ca23f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1521,6 +1521,25 @@ static inline long get_user_pages_longterm(unsigned long start,
int get_user_pages_fast(unsigned long start, int nr_pages, int write,
struct page **pages);
+int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
+ struct task_struct *task, bool bypass_rlim);
+
+static inline int account_locked_vm(struct mm_struct *mm, unsigned long pages,
+ bool inc)
+{
+ int ret;
+
+ if (pages == 0 || !mm)
+ return 0;
+
+ down_write(&mm->mmap_sem);
+ ret = __account_locked_vm(mm, pages, inc, current,
+ capable(CAP_IPC_LOCK));
+ up_write(&mm->mmap_sem);
+
+ return ret;
+}
+
/* Container for pinned pfns / pages */
struct frame_vector {
unsigned int nr_allocated; /* Number of frames we have space for */
diff --git a/mm/util.c b/mm/util.c
index 43a2984bccaa..552302665bc2 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -6,6 +6,7 @@
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/sched/mm.h>
+#include <linux/sched/signal.h>
#include <linux/sched/task_stack.h>
#include <linux/security.h>
#include <linux/swap.h>
@@ -346,6 +347,53 @@ int __weak get_user_pages_fast(unsigned long start,
}
EXPORT_SYMBOL_GPL(get_user_pages_fast);
+/**
+ * __account_locked_vm - account locked pages to an mm's locked_vm
+ * @mm: mm to account against, may be NULL
+ * @pages: number of pages to account
+ * @inc: %true if @pages should be considered positive, %false if not
+ * @task: task used to check RLIMIT_MEMLOCK
+ * @bypass_rlim: %true if checking RLIMIT_MEMLOCK should be skipped
+ *
+ * Assumes @task and @mm are valid (i.e. at least one reference on each), and
+ * that mmap_sem is held as writer.
+ *
+ * Return:
+ * * 0 on success
+ * * 0 if @mm is NULL (can happen for example if the task is exiting)
+ * * -ENOMEM if RLIMIT_MEMLOCK would be exceeded.
+ */
+int __account_locked_vm(struct mm_struct *mm, unsigned long pages, bool inc,
+ struct task_struct *task, bool bypass_rlim)
+{
+ unsigned long locked_vm, limit;
+ int ret = 0;
+
+ locked_vm = mm->locked_vm;
+ if (inc) {
+ if (!bypass_rlim) {
+ limit = task_rlimit(task, RLIMIT_MEMLOCK) >> PAGE_SHIFT;
+ if (locked_vm + pages > limit) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ }
+ mm->locked_vm = locked_vm + pages;
+ } else {
+ WARN_ON_ONCE(pages > locked_vm);
+ mm->locked_vm = locked_vm - pages;
+ }
+
+out:
+ pr_debug("%s: [%d] %c%lu %lu/%lu%s\n", __func__, task->pid,
+ (inc) ? '+' : '-', pages << PAGE_SHIFT,
+ locked_vm << PAGE_SHIFT, task_rlimit(task, RLIMIT_MEMLOCK),
+ ret ? " - exceeded" : "");
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(__account_locked_vm);
+
unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr,
unsigned long len, unsigned long prot,
unsigned long flag, unsigned long pgoff)
base-commit: 37624b58542fb9f2d9a70e6ea006ef8a5f66c30b
--
2.21.0
^ permalink raw reply related
* Re: [PATCH 14/15] um: switch to generic version of pte allocation
From: Anton Ivanov @ 2019-05-03 13:28 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton
Cc: Michal Hocko, Catalin Marinas, Palmer Dabbelt, linux-kernel,
Guo Ren, linux-hexagon, linux-riscv, linux-arch,
Richard Weinberger, Helge Deller, x86, Russell King,
Matthew Wilcox, Geert Uytterhoeven, Matt Turner, Sam Creasey,
Arnd Bergmann, linux-alpha, linux-um, linux-m68k, Greentime Hu,
Ley Foon Tan, Guan Xuetao, linux-arm-kernel, linux-parisc,
linux-mips, Richard Kuo, Paul Burton, nios2-dev, linuxppc-dev
In-Reply-To: <1556810922-20248-15-git-send-email-rppt@linux.ibm.com>
On 02/05/2019 16:28, Mike Rapoport wrote:
> um allocates PTE pages with __get_free_page() and uses
> GFP_KERNEL | __GFP_ZERO for the allocations.
>
> Switch it to the generic version that does exactly the same thing for the
> kernel page tables and adds __GFP_ACCOUNT for the user PTEs.
>
> The pte_free() and pte_free_kernel() versions are identical to the generic
> ones and can be simply dropped.
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> arch/um/include/asm/pgalloc.h | 16 ++--------------
> arch/um/kernel/mem.c | 22 ----------------------
> 2 files changed, 2 insertions(+), 36 deletions(-)
>
> diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h
> index 99eb568..d7b282e 100644
> --- a/arch/um/include/asm/pgalloc.h
> +++ b/arch/um/include/asm/pgalloc.h
> @@ -10,6 +10,8 @@
>
> #include <linux/mm.h>
>
> +#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
> +
> #define pmd_populate_kernel(mm, pmd, pte) \
> set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
>
> @@ -25,20 +27,6 @@
> extern pgd_t *pgd_alloc(struct mm_struct *);
> extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
>
> -extern pte_t *pte_alloc_one_kernel(struct mm_struct *);
> -extern pgtable_t pte_alloc_one(struct mm_struct *);
> -
> -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
> -{
> - free_page((unsigned long) pte);
> -}
> -
> -static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
> -{
> - pgtable_page_dtor(pte);
> - __free_page(pte);
> -}
> -
> #define __pte_free_tlb(tlb,pte, address) \
> do { \
> pgtable_page_dtor(pte); \
> diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
> index 99aa11b..2280374 100644
> --- a/arch/um/kernel/mem.c
> +++ b/arch/um/kernel/mem.c
> @@ -215,28 +215,6 @@ void pgd_free(struct mm_struct *mm, pgd_t *pgd)
> free_page((unsigned long) pgd);
> }
>
> -pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
> -{
> - pte_t *pte;
> -
> - pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
> - return pte;
> -}
> -
> -pgtable_t pte_alloc_one(struct mm_struct *mm)
> -{
> - struct page *pte;
> -
> - pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
> - if (!pte)
> - return NULL;
> - if (!pgtable_page_ctor(pte)) {
> - __free_page(pte);
> - return NULL;
> - }
> - return pte;
> -}
> -
> #ifdef CONFIG_3_LEVEL_PGTABLES
> pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
> {
>
Reviewed-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
--
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/
^ permalink raw reply
* Re: [PATCH] mm: add account_locked_vm utility function
From: Jason Gunthorpe @ 2019-05-03 23:28 UTC (permalink / raw)
To: Daniel Jordan
Cc: Mark Rutland, Davidlohr Bueso, kvm@vger.kernel.org, Alan Tull,
Alexey Kardashevskiy, linux-fpga@vger.kernel.org,
linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org,
linux-mm@kvack.org, Alex Williamson, Moritz Fischer,
Steve Sistare, akpm@linux-foundation.org,
linuxppc-dev@lists.ozlabs.org, Christoph Lameter, Wu Hao
In-Reply-To: <20190503201629.20512-1-daniel.m.jordan@oracle.com>
On Fri, May 03, 2019 at 01:16:30PM -0700, Daniel Jordan wrote:
> locked_vm accounting is done roughly the same way in five places, so
> unify them in a helper. Standardize the debug prints, which vary
> slightly. Error codes stay the same, so user-visible behavior does too.
>
> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
> Cc: Alan Tull <atull@kernel.org>
> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
> Cc: Davidlohr Bueso <dave@stgolabs.net>
> Cc: Jason Gunthorpe <jgg@mellanox.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Moritz Fischer <mdf@kernel.org>
> Cc: Paul Mackerras <paulus@ozlabs.org>
> Cc: Steve Sistare <steven.sistare@oracle.com>
> Cc: Wu Hao <hao.wu@intel.com>
> Cc: linux-mm@kvack.org
> Cc: kvm@vger.kernel.org
> Cc: kvm-ppc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-fpga@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
>
> Based on v5.1-rc7. Tested with the vfio type1 driver. Any feedback
> welcome.
>
> Andrew, this one patch replaces these six from [1]:
>
> mm-change-locked_vms-type-from-unsigned-long-to-atomic64_t.patch
> vfio-type1-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
> vfio-spapr_tce-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
> fpga-dlf-afu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
> kvm-book3s-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
> powerpc-mmu-drop-mmap_sem-now-that-locked_vm-is-atomic.patch
>
> That series converts locked_vm to an atomic, but on closer inspection causes at
> least one accounting race in mremap, and fixing it just for this type
> conversion came with too much ugly in the core mm to justify, especially when
> the right long-term fix is making these drivers use pinned_vm instead.
Did we ever decide what to do here? Should all these drivers be
switched to pinned_vm anyhow?
Jason
^ permalink raw reply
* [PATCH -next] ocxl: Fix return value check in afu_ioctl()
From: Wei Yongjun @ 2019-05-04 7:04 UTC (permalink / raw)
To: Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, Alastair D'Silva
Cc: linuxppc-dev, kernel-janitors, Wei Yongjun, linux-kernel
In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().
This issue was detected by using the Coccinelle software.
Fixes: 060146614643 ("ocxl: move event_fd handling to frontend")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/misc/ocxl/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 8aa22893ed76..2870c25da166 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -257,8 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
return -EINVAL;
irq_id = ocxl_irq_offset_to_id(ctx, irq_fd.irq_offset);
ev_ctx = eventfd_ctx_fdget(irq_fd.eventfd);
- if (!ev_ctx)
- return -EFAULT;
+ if (IS_ERR(ev_ctx))
+ return PTR_ERR(ev_ctx);
rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx);
break;
^ permalink raw reply related
* Re: [PATCH v6 0/1] iommu: enhance IOMMU dma mode build options
From: Leizhen (ThunderTown) @ 2019-05-04 8:44 UTC (permalink / raw)
To: Jean-Philippe Brucker, John Garry, Robin Murphy, Will Deacon,
Joerg Roedel, Jonathan Corbet, linux-doc, Sebastian Ott,
Gerald Schaefer, Martin Schwidefsky, Heiko Carstens,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Tony Luck, Fenghua Yu, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H . Peter Anvin, David Woodhouse, iommu,
linux-kernel, linux-s390, linuxppc-dev, x86, linux-ia64
Cc: Hanjun Guo
In-Reply-To: <20190418135701.24668-1-thunder.leizhen@huawei.com>
Hi all,
Can anybody review or comment?
On 2019/4/18 21:57, Zhen Lei wrote:
> v5 --> v6:
> 1. give up adding boot option iommu.dma_mode
>
> v4 --> v5:
> As Hanjun and Thomas Gleixner's suggestion:
> 1. Keep the old ARCH specific boot options no change.
> 2. Keep build option CONFIG_IOMMU_DEFAULT_PASSTHROUGH no change.
>
> v4:
> As Robin Murphy's suggestion:
> "It's also not necessarily obvious to the user how this interacts with
> IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it
> would be better to refactor the whole lot into a single selection of something
> like IOMMU_DEFAULT_MODE anyway."
>
> In this version, I tried to normalize the IOMMU dma mode boot options for all
> ARCHs. When IOMMU is enabled, there are 3 dma modes: paasthrough(bypass),
> lazy(mapping but defer the IOTLB invalidation), strict. But currently each
> ARCHs defined their private boot options, different with each other. For
> example, to enable/disable "passthrough", ARM64 use iommu.passthrough=1/0,
> X86 use iommu=pt/nopt, PPC/POWERNV use iommu=nobypass.
>
> Zhen Lei (1):
> iommu: enhance IOMMU dma mode build options
>
> arch/ia64/kernel/pci-dma.c | 2 +-
> arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++-
> arch/s390/pci/pci_dma.c | 2 +-
> arch/x86/kernel/pci-dma.c | 7 ++---
> drivers/iommu/Kconfig | 44 ++++++++++++++++++++++++++-----
> drivers/iommu/amd_iommu_init.c | 3 ++-
> drivers/iommu/intel-iommu.c | 2 +-
> drivers/iommu/iommu.c | 3 ++-
> 8 files changed, 48 insertions(+), 18 deletions(-)
>
--
Thanks!
BestRegards
^ permalink raw reply
* [PATCH -next] powerpc/book3s64: Make some symbols static
From: YueHaibing @ 2019-05-04 10:24 UTC (permalink / raw)
To: benh, paulus, mpe, christophe.leroy, aneesh.kumar
Cc: YueHaibing, linuxppc-dev, linux-kernel
Fix sparse warnings:
arch/powerpc/mm/book3s64/radix_pgtable.c:326:13: warning: symbol 'radix_init_pgtable' was not declared. Should it be static?
arch/powerpc/mm/book3s64/hash_native.c:48:1: warning: symbol 'native_tlbie_lock' was not declared. Should it be static?
arch/powerpc/mm/book3s64/hash_utils.c:988:24: warning: symbol 'init_hash_mm_context' was not declared. Should it be static?
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
arch/powerpc/mm/book3s64/hash_native.c | 2 +-
arch/powerpc/mm/book3s64/hash_utils.c | 2 +-
arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/book3s64/hash_native.c b/arch/powerpc/mm/book3s64/hash_native.c
index aaa28fd..47caecd 100644
--- a/arch/powerpc/mm/book3s64/hash_native.c
+++ b/arch/powerpc/mm/book3s64/hash_native.c
@@ -45,7 +45,7 @@
#define HPTE_LOCK_BIT (56+3)
#endif
-DEFINE_RAW_SPINLOCK(native_tlbie_lock);
+static DEFINE_RAW_SPINLOCK(native_tlbie_lock);
static inline void tlbiel_hash_set_isa206(unsigned int set, unsigned int is)
{
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 919a861..1ff4518 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -985,7 +985,7 @@ void __init hash__early_init_devtree(void)
htab_scan_page_sizes();
}
-struct hash_mm_context init_hash_mm_context;
+static struct hash_mm_context init_hash_mm_context;
void __init hash__early_init_mmu(void)
{
#ifndef CONFIG_PPC_64K_PAGES
diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
index c9bcf42..c929d31 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -323,7 +323,7 @@ static int __meminit create_physical_mapping(unsigned long start,
return 0;
}
-void __init radix_init_pgtable(void)
+static void __init radix_init_pgtable(void)
{
unsigned long rts_field;
struct memblock_region *reg;
--
2.7.4
^ permalink raw reply related
* [PATCH -next] misc: ocxl: Make ocxl_remove static
From: YueHaibing @ 2019-05-04 10:27 UTC (permalink / raw)
To: fbarrat, ajd, arnd, gregkh; +Cc: YueHaibing, linuxppc-dev, linux-kernel
Fix sparse warning:
drivers/misc/ocxl/pci.c:44:6: warning:
symbol 'ocxl_remove' was not declared. Should it be static?
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/misc/ocxl/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
index f2a3ef4..cb920aa 100644
--- a/drivers/misc/ocxl/pci.c
+++ b/drivers/misc/ocxl/pci.c
@@ -41,7 +41,7 @@ static int ocxl_probe(struct pci_dev *dev, const struct pci_device_id *id)
return 0;
}
-void ocxl_remove(struct pci_dev *dev)
+static void ocxl_remove(struct pci_dev *dev)
{
struct ocxl_fn *fn;
struct ocxl_afu *afu;
--
2.7.4
^ permalink raw reply related
* [GIT PULL] Please pull powerpc/linux.git powerpc-5.1-7 tag
From: Michael Ellerman @ 2019-05-04 14:38 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Linus,
Please pull one more powerpc fix for 5.1:
The following changes since commit 7a3a4d763837d3aa654cd1059030950410c04d77:
powerpc/mm_iommu: Allow pinning large regions (2019-04-17 21:36:51 +1000)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.1-7
for you to fetch changes up to 12f363511d47f86c49b7766c349989cb33fd61a8:
powerpc/32s: Fix BATs setting with CONFIG_STRICT_KERNEL_RWX (2019-05-02 15:33:46 +1000)
- ------------------------------------------------------------------
powerpc fixes for 5.1 #7
One regression fix.
Changes we merged to STRICT_KERNEL_RWX on 32-bit were causing crashes under
load on some machines depending on memory layout.
Thanks to:
Christophe Leroy.
- ------------------------------------------------------------------
Christophe Leroy (1):
powerpc/32s: Fix BATs setting with CONFIG_STRICT_KERNEL_RWX
arch/powerpc/mm/ppc_mmu_32.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
-----BEGIN PGP SIGNATURE-----
iQIcBAEBAgAGBQJczaPFAAoJEFHr6jzI4aWAEsoP+wbm3WGTTSULdF3PbIGEtVbQ
CNrw/LpvNsmAn6210U2ag7Fwd6/hIprIy9wgwbgNiB2kDtMNy6srl1eMlC9npsV4
y43xeJQ0E2+u10eaBNsiwJEYtmNkJMuxCu31zGH/PZ4nTi4hdvaVwUETR725vYli
LICixZ2yr1eL948D3DzWpGigBmGhq1ajBsdXxn2sHxbeqefnFesdrjPR2e2GIj7E
cyHb+7vUATLUVc405yYCyHEU3/cly12LPcsreGe/tPWSJxw8I2BU36lCCXgby62w
E1KlSb4EzFx+lFujK6ICxaflFOtkP+0Xzajq8YU0qrItkGM8DA6yTy4vU99gN1KP
pgNwbaoMQCNJvzk0cIuMZ0RMGKrkRT4y2jW+MhHALMSkyv4HGKqT/N227PMq4U94
nVv41w868b8NnTrN9pLfSR+Gyr/Q7sF8zEVv0eIpbSciB/OTcg0yqAp7V2p0cTBG
pKM/c6glvkrbfEkoRItMpVU0PbckPFjXgTVqI/rvdiAVoEQvi1U4r8Fpu5I28j1d
wuryRhjnGXgkSjBlXkSK+tASWZHcKwhnD1y9KTHtKuLdxJqjDfyX0Dii+FqU5w42
aKeU4VrlrCGX2VnLj7ViH99wzkMogP9oZWZ5bhmOva/boxo1kJ9/vQkxaiXrhVjd
NLBrlVeLtaCjY52+eEJS
=k/X8
-----END PGP SIGNATURE-----
^ permalink raw reply
* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.1-7 tag
From: pr-tracker-bot @ 2019-05-04 19:35 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <877eb6xp1q.fsf@concordia.ellerman.id.au>
The pull request you sent on Sun, 05 May 2019 00:38:41 +1000:
> https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.1-7
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/6203838dec05352bc357625b1e9ba0a10d3bca35
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
^ permalink raw reply
* [Bug 203515] New: [crypto] alg: skcipher: p8_aes_ctr encryption test failed (wrong result) on test vector 3, cfg="uneven misaligned splits, may sleep"
From: bugzilla-daemon @ 2019-05-05 0:05 UTC (permalink / raw)
To: linuxppc-dev
https://bugzilla.kernel.org/show_bug.cgi?id=203515
Bug ID: 203515
Summary: [crypto] alg: skcipher: p8_aes_ctr encryption test
failed (wrong result) on test vector 3, cfg="uneven
misaligned splits, may sleep"
Product: Platform Specific/Hardware
Version: 2.5
Kernel Version: 5.1.0-rc7
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: PPC-64
Assignee: platform_ppc-64@kernel-bugs.osdl.org
Reporter: erhard_f@mailbox.org
Regression: Yes
Created attachment 282609
--> https://bugzilla.kernel.org/attachment.cgi?id=282609&action=edit
dmesg (5.1.0-rc7, Talos II)
Seems like some POWER8/9 specific encrytion test fails in 5.1.0-rc7. This did
not happen in 5.0.x and before.
[...]
[ 5.246612] crypto_register_alg 'cbc(aes)' = 0
[ 5.254268] alg: skcipher: p8_aes_ctr encryption test failed (wrong result)
on test vector 3, cfg="uneven misaligned splits, may sleep"
[ 5.255266] xhci_hcd 0003:01:00.0: xHCI Host Controller
[ 5.255346] xhci_hcd 0003:01:00.0: new USB bus registered, assigned bus
number 1
[ 5.255522] xhci_hcd 0003:01:00.0: hcc params 0x0270f06d hci version 0x96
quirks 0x0000000004000000
[ 5.256008] crypto_register_alg 'ctr(aes)' = 0
[...]
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* [Bug 203515] [crypto] alg: skcipher: p8_aes_ctr encryption test failed (wrong result) on test vector 3, cfg="uneven misaligned splits, may sleep"
From: bugzilla-daemon @ 2019-05-05 0:06 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <bug-203515-206035@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=203515
--- Comment #1 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 282611
--> https://bugzilla.kernel.org/attachment.cgi?id=282611&action=edit
kernel .config (5.1.0-rc7, Talos II)
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* [Bug 203517] New: WARNING: inconsistent lock state. inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
From: bugzilla-daemon @ 2019-05-05 0:21 UTC (permalink / raw)
To: linuxppc-dev
https://bugzilla.kernel.org/show_bug.cgi?id=203517
Bug ID: 203517
Summary: WARNING: inconsistent lock state. inconsistent
{SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
Product: Platform Specific/Hardware
Version: 2.5
Kernel Version: 5.1.0-rc7
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: PPC-64
Assignee: platform_ppc-64@kernel-bugs.osdl.org
Reporter: erhard_f@mailbox.org
Regression: Yes
Created attachment 282613
--> https://bugzilla.kernel.org/attachment.cgi?id=282613&action=edit
dmesg (5.1.0-rc7, Talos II)
I have not seen this on my amd64 machines on the 5.1-rcX kernels I've been
running for some time, so I am filing this agains ppc64 platform specific.
I am running some zram-compressed swap space via systemd:
/sbin/zram-init -d0 -s32 -azstd -Lzram_swap 4096
Have not seen this in 5.0.x and before.
[...]
[ 313.402874] ================================
[ 313.402875] WARNING: inconsistent lock state
[ 313.402879] 5.1.0-rc7 #1 Not tainted
[ 313.402880] --------------------------------
[ 313.402882] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[ 313.402885] swapper/5/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
[ 313.402888] 0000000080d1120c (&(&wsm.lock)->rlock){+.?.}, at:
.zstd_reclaim_timer_fn+0x40/0x230
[ 313.402895] {SOFTIRQ-ON-W} state was registered at:
[ 313.402899] .lock_acquire+0xd0/0x240
[ 313.402903] ._raw_spin_lock+0x34/0x60
[ 313.402906] .zstd_get_workspace+0xd0/0x360
[ 313.402908] .end_compressed_bio_read+0x3b8/0x540
[ 313.402911] .bio_endio+0x174/0x2c0
[ 313.402914] .end_workqueue_fn+0x4c/0x70
[ 313.402917] .normal_work_helper+0x138/0x7e0
[ 313.402920] .process_one_work+0x324/0x790
[ 313.402922] .worker_thread+0x68/0x570
[ 313.402925] .kthread+0x19c/0x1b0
[ 313.402928] .ret_from_kernel_thread+0x58/0x78
[ 313.402930] irq event stamp: 2629216
[ 313.402933] hardirqs last enabled at (2629216): [<c0000000009da738>]
._raw_spin_unlock_irq+0x38/0x60
[ 313.402936] hardirqs last disabled at (2629215): [<c0000000009da4c4>]
._raw_spin_lock_irq+0x24/0x70
[ 313.402939] softirqs last enabled at (2629212): [<c0000000000af9fc>]
.irq_enter+0x8c/0xd0
[ 313.402942] softirqs last disabled at (2629213): [<c0000000000afb58>]
.irq_exit+0x118/0x170
[ 313.402944]
other info that might help us debug this:
[ 313.402945] Possible unsafe locking scenario:
[ 313.402947] CPU0
[ 313.402948] ----
[ 313.402949] lock(&(&wsm.lock)->rlock);
[ 313.402951] <Interrupt>
[ 313.402952] lock(&(&wsm.lock)->rlock);
[ 313.402954]
*** DEADLOCK ***
[ 313.402957] 1 lock held by swapper/5/0:
[ 313.402958] #0: 000000004b612042 ((&wsm.timer)){+.-.}, at:
.call_timer_fn+0x0/0x3c0
[ 313.402963]
stack backtrace:
[ 313.402967] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 5.1.0-rc7 #1
[ 313.402968] Call Trace:
[ 313.402972] [c0000007fa262e70] [c0000000009b3294] .dump_stack+0xe0/0x15c
(unreliable)
[ 313.402975] [c0000007fa262f10] [c000000000125548]
.print_usage_bug+0x348/0x390
[ 313.402978] [c0000007fa262fd0] [c000000000125cb4] .mark_lock+0x724/0x930
[ 313.402981] [c0000007fa263080] [c000000000126c20]
.__lock_acquire+0xc90/0x16a0
[ 313.402984] [c0000007fa2631b0] [c000000000128040] .lock_acquire+0xd0/0x240
[ 313.402987] [c0000007fa263280] [c0000000009da2b4] ._raw_spin_lock+0x34/0x60
[ 313.402990] [c0000007fa263300] [c00000000054b0b0]
.zstd_reclaim_timer_fn+0x40/0x230
[ 313.402993] [c0000007fa2633d0] [c000000000158b38] .call_timer_fn+0xc8/0x3c0
[ 313.402996] [c0000007fa2634a0] [c000000000158f74] .expire_timers+0x144/0x260
[ 313.402999] [c0000007fa263550] [c000000000159178]
.run_timer_softirq+0xe8/0x230
[ 313.403002] [c0000007fa263680] [c0000000009db288] .__do_softirq+0x188/0x5d4
[ 313.403004] [c0000007fa263790] [c0000000000afb58] .irq_exit+0x118/0x170
[ 313.403008] [c0000007fa263800] [c000000000028d88]
.timer_interrupt+0x158/0x430
[ 313.403012] [c0000007fa2638b0] [c0000000000091d4]
decrementer_common+0x134/0x140
[ 313.403017] --- interrupt: 901 at replay_interrupt_return+0x0/0x4
LR = .arch_local_irq_restore.part.0+0x68/0x80
[ 313.403020] [c0000007fa263bb0] [c00000000001a3ac]
.arch_local_irq_restore.part.0+0x2c/0x80 (unreliable)
[ 313.403024] [c0000007fa263c30] [c0000000007bbbcc]
.cpuidle_enter_state+0xec/0x670
[ 313.403027] [c0000007fa263d00] [c0000000000f5130] .call_cpuidle+0x40/0x90
[ 313.403031] [c0000007fa263d70] [c0000000000f554c] .do_idle+0x2dc/0x3a0
[ 313.403034] [c0000007fa263e30] [c0000000000f59ac]
.cpu_startup_entry+0x2c/0x30
[ 313.403037] [c0000007fa263ea0] [c000000000045674]
.start_secondary+0x644/0x650
[ 313.403041] [c0000007fa263f90] [c00000000000ad5c]
start_secondary_prolog+0x10/0x14
[...]
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* [Bug 203517] WARNING: inconsistent lock state. inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
From: bugzilla-daemon @ 2019-05-05 0:22 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <bug-203517-206035@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=203517
--- Comment #1 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 282615
--> https://bugzilla.kernel.org/attachment.cgi?id=282615&action=edit
kernel .config (5.1.0-rc7, Talos II
--
You are receiving this mail because:
You are watching the assignee of the bug.
^ permalink raw reply
* Re: [PATCH V4] ASoC: fsl_esai: Add pm runtime function
From: S.j. Wang @ 2019-05-05 3:28 UTC (permalink / raw)
To: Nicolin Chen, Mark Brown
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Hi
> Hi Mark,
> On Fri, May 03, 2019 at 01:27:31PM +0900, Mark Brown wrote:
> > On Thu, May 02, 2019 at 09:13:58AM +0000, S.j. Wang wrote:
> >
> > > I am checking, but I don't know why this patch failed in your side.
> > > I Tried to apply this patch on for-5.1, for 5.2, for-linus and
> > > for-next, all are Successful. The git is
> git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git.
> >
> > > I can't reproduce your problem. Is there any my operation wrong?
> >
> > The error message I got was:
> >
> > Applying: ASoC: fsl_esai: Add pm runtime function
> > error: patch failed: sound/soc/fsl/fsl_esai.c:9
> > error: sound/soc/fsl/fsl_esai.c: patch does not apply Patch failed at
> > 0001 ASoC: fsl_esai: Add pm runtime function
> >
> > which is the header addition. I can't spot any obvious issues
> > visually looking at the patch, only thing I can think is some kind of
> > whitespace damage somewhere.
>
> I downloaded this v4 from patchwork and resubmitted a v5 for a test.
> Would you please try to apply that one?
>
> If my v5 works vs. having merge conflict at v4, maybe something wrong with
> Git version of Shengjiu's? I compared my v5 and his
> v4 using vimdiff, there is no much difference of whitespace.
>
> Thanks
> Nicolin
We find that maybe it is caused by the Transfer-Encoding format.
We sent the patch by the --transfer-encoding=8bit, but in the receiver side
it shows:
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
It may be caused by our company's mail server. We are checking...
Best regards
Wang shengjiu
^ permalink raw reply
* RE: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
From: Alastair D'Silva @ 2019-05-05 4:46 UTC (permalink / raw)
To: 'Wei Yongjun', 'Frederic Barrat',
'Andrew Donnellan', 'Arnd Bergmann',
'Greg Kroah-Hartman'
Cc: kernel-janitors, linuxppc-dev, linux-kernel
In-Reply-To: <20190504070430.57008-1-weiyongjun1@huawei.com>
> -----Original Message-----
> From: Wei Yongjun <weiyongjun1@huawei.com>
> Sent: Saturday, 4 May 2019 5:05 PM
> To: Frederic Barrat <fbarrat@linux.ibm.com>; Andrew Donnellan
> <ajd@linux.ibm.com>; Arnd Bergmann <arnd@arndb.de>; Greg Kroah-
> Hartman <gregkh@linuxfoundation.org>; Alastair D'Silva <alastair@d-
> silva.org>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
>
> In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and
> never returns NULL. The NULL test in the return value check should be
> replaced with IS_ERR().
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 060146614643 ("ocxl: move event_fd handling to frontend")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/misc/ocxl/file.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index
> 8aa22893ed76..2870c25da166 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -257,8 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int
cmd,
> return -EINVAL;
> irq_id = ocxl_irq_offset_to_id(ctx, irq_fd.irq_offset);
> ev_ctx = eventfd_ctx_fdget(irq_fd.eventfd);
> - if (!ev_ctx)
> - return -EFAULT;
> + if (IS_ERR(ev_ctx))
> + return PTR_ERR(ev_ctx);
> rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler,
irq_free,
> ev_ctx);
> break;
LGTM
Acked-by: Alastair D'Silva <alastair@d-silva.org>
--
Alastair D'Silva mob: 0423 762 819
skype: alastair_dsilva msn: alastair@d-silva.org
blog: http://alastair.d-silva.org Twitter: @EvilDeece
^ permalink raw reply
* Re: [PATCH 01/15] asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel]
From: Mike Rapoport @ 2019-05-05 6:15 UTC (permalink / raw)
To: Paul Burton
Cc: Michal Hocko, Catalin Marinas, Palmer Dabbelt,
linux-mips@vger.kernel.org, Guo Ren,
linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-arch@vger.kernel.org, Helge Deller, x86@kernel.org,
Russell King, Matthew Wilcox, Geert Uytterhoeven, Matt Turner,
Sam Creasey, Arnd Bergmann, linux-alpha@vger.kernel.org,
linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org,
Greentime Hu, nios2-dev@lists.rocketboards.org, Guan Xuetao,
linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Kuo, Richard Weinberger, Ley Foon Tan, Andrew Morton,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20190502190310.voenw3pwgpelmdgw@pburton-laptop>
On Thu, May 02, 2019 at 07:03:11PM +0000, Paul Burton wrote:
> Hi Mike,
>
> On Thu, May 02, 2019 at 06:28:28PM +0300, Mike Rapoport wrote:
> > +/**
> > + * pte_free_kernel - free PTE-level user page table page
> > + * @mm: the mm_struct of the current context
> > + * @pte_page: the `struct page` representing the page table
> > + */
> > +static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
> > +{
> > + pgtable_page_dtor(pte_page);
> > + __free_page(pte_page);
> > +}
>
> Nit: the comment names the wrong function (s/pte_free_kernel/pte_free/).
Argh, evil copy-paste :)
Thanks!
> Thanks,
> Paul
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH 08/15] mips: switch to generic version of pte allocation
From: Mike Rapoport @ 2019-05-05 6:17 UTC (permalink / raw)
To: Paul Burton
Cc: Michal Hocko, Catalin Marinas, Palmer Dabbelt,
linux-mips@vger.kernel.org, Guo Ren,
linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-arch@vger.kernel.org, Helge Deller, x86@kernel.org,
Russell King, Matthew Wilcox, Geert Uytterhoeven, Matt Turner,
Sam Creasey, Arnd Bergmann, linux-alpha@vger.kernel.org,
linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org,
Greentime Hu, nios2-dev@lists.rocketboards.org, Guan Xuetao,
linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Kuo, Richard Weinberger, Ley Foon Tan, Andrew Morton,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20190502190945.rrrxfxo3rbhgc3cx@pburton-laptop>
On Thu, May 02, 2019 at 07:09:47PM +0000, Paul Burton wrote:
> Hi Mike,
>
> On Thu, May 02, 2019 at 06:28:35PM +0300, Mike Rapoport wrote:
> > MIPS allocates kernel PTE pages with
> >
> > __get_free_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER)
> >
> > and user PTE pages with
> >
> > alloc_pages(GFP_KERNEL | __GFP_ZERO, PTE_ORDER)
>
> That bit isn't quite true - we don't use __GFP_ZERO in pte_alloc_one() &
> instead call clear_highpage() on the allocated page. Not that I have a
> problem with using __GFP_ZERO - it seems like the more optimal choice.
> It just might be worth mentioning the change & expected equivalent
> behavior.
You are right, I'll fix the changelog.
> Otherwise:
>
> Acked-by: Paul Burton <paul.burton@mips.com>
Thanks.
> Thanks,
> Paul
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH 04/15] arm64: switch to generic version of pte allocation
From: Mike Rapoport @ 2019-05-05 6:19 UTC (permalink / raw)
To: Mark Rutland
Cc: Michal Hocko, Catalin Marinas, Palmer Dabbelt, linux-mips,
Guo Ren, linux-hexagon, linux-riscv, linux-arch, Helge Deller,
x86, Russell King, Matthew Wilcox, Geert Uytterhoeven,
Matt Turner, Sam Creasey, Arnd Bergmann, linux-um,
Richard Weinberger, linux-m68k, Greentime Hu, nios2-dev,
Guan Xuetao, linux-arm-kernel, linux-parisc, linux-kernel,
Richard Kuo, Paul Burton, linux-alpha, Ley Foon Tan,
Andrew Morton, linuxppc-dev
In-Reply-To: <20190503100508.GB47811@lakrids.cambridge.arm.com>
On Fri, May 03, 2019 at 11:05:09AM +0100, Mark Rutland wrote:
> Hi,
>
> On Thu, May 02, 2019 at 06:28:31PM +0300, Mike Rapoport wrote:
> > The PTE allocations in arm64 are identical to the generic ones modulo the
> > GFP flags.
> >
> > Using the generic pte_alloc_one() functions ensures that the user page
> > tables are allocated with __GFP_ACCOUNT set.
> >
> > The arm64 definition of PGALLOC_GFP is removed and replaced with
> > GFP_PGTABLE_USER for p[gum]d_alloc_one() and for KVM memory cache.
> >
> > The mappings created with create_pgd_mapping() are now using
> > GFP_PGTABLE_KERNEL.
> >
> > The conversion to the generic version of pte_free_kernel() removes the NULL
> > check for pte.
> >
> > The pte_free() version on arm64 is identical to the generic one and
> > can be simply dropped.
> >
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
> > arch/arm64/include/asm/pgalloc.h | 43 ++++------------------------------------
> > arch/arm64/mm/mmu.c | 2 +-
> > arch/arm64/mm/pgd.c | 4 ++--
> > virt/kvm/arm/mmu.c | 2 +-
> > 4 files changed, 8 insertions(+), 43 deletions(-)
>
> [...]
>
> > diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
> > index 289f911..2ef1a53 100644
> > --- a/arch/arm64/mm/pgd.c
> > +++ b/arch/arm64/mm/pgd.c
> > @@ -31,9 +31,9 @@ static struct kmem_cache *pgd_cache __ro_after_init;
> > pgd_t *pgd_alloc(struct mm_struct *mm)
> > {
> > if (PGD_SIZE == PAGE_SIZE)
> > - return (pgd_t *)__get_free_page(PGALLOC_GFP);
> > + return (pgd_t *)__get_free_page(GFP_PGTABLE_USER);
> > else
> > - return kmem_cache_alloc(pgd_cache, PGALLOC_GFP);
> > + return kmem_cache_alloc(pgd_cache, GFP_PGTABLE_USER);
> > }
>
> In efi_virtmap_init() we use pgd_alloc() to allocate a pgd for EFI
> runtime services, which we map with a special kernel page table.
>
> I'm not sure if accounting that is problematic, as it's allocated in a
> kernel thread off the back of an early_initcall.
The accounting bypasses kernel threads so there should be no problem.
> Just to check, Is that sound, or do we need a pgd_alloc_kernel()?
>
> Thanks,
> Mark.
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH 12/15] powerpc/nohash/64: switch to generic version of pte allocation
From: Mike Rapoport @ 2019-05-05 6:23 UTC (permalink / raw)
To: Christophe Leroy
Cc: Michal Hocko, Catalin Marinas, Palmer Dabbelt, linux-kernel,
Guo Ren, linux-riscv, linux-arch, Richard Weinberger,
Helge Deller, x86, Russell King, Matthew Wilcox,
Geert Uytterhoeven, Matt Turner, Sam Creasey, Arnd Bergmann,
linux-alpha, linux-um, linux-m68k, Greentime Hu, Ley Foon Tan,
Guan Xuetao, linux-arm-kernel, linux-parisc, linux-mips,
Richard Kuo, Paul Burton, linux-hexagon, nios2-dev, Andrew Morton,
linuxppc-dev
In-Reply-To: <adcb6ae6-48d9-5ba9-2732-a0ab1d96667c@c-s.fr>
On Thu, May 02, 2019 at 06:56:07PM +0200, Christophe Leroy wrote:
>
>
> Le 02/05/2019 à 17:28, Mike Rapoport a écrit :
> >The 64-bit book-E powerpc implements pte_alloc_one(),
> >pte_alloc_one_kernel(), pte_free_kernel() and pte_free() the same way as
> >the generic version.
>
> Will soon be converted to the same as the 3 other PPC subarches, see
> https://patchwork.ozlabs.org/patch/1091590/
Thanks for the heads up. I'll drop this from the next re-spin.
> Christophe
>
> >
> >Switch it to the generic version that does exactly the same thing.
> >
> >Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> >---
> > arch/powerpc/include/asm/nohash/64/pgalloc.h | 35 ++--------------------------
> > 1 file changed, 2 insertions(+), 33 deletions(-)
> >
> >diff --git a/arch/powerpc/include/asm/nohash/64/pgalloc.h b/arch/powerpc/include/asm/nohash/64/pgalloc.h
> >index 66d086f..bfb53a0 100644
> >--- a/arch/powerpc/include/asm/nohash/64/pgalloc.h
> >+++ b/arch/powerpc/include/asm/nohash/64/pgalloc.h
> >@@ -11,6 +11,8 @@
> > #include <linux/cpumask.h>
> > #include <linux/percpu.h>
> >+#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
> >+
> > struct vmemmap_backing {
> > struct vmemmap_backing *list;
> > unsigned long phys;
> >@@ -92,39 +94,6 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
> > kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
> > }
> >-
> >-static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
> >-{
> >- return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
> >-}
> >-
> >-static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
> >-{
> >- struct page *page;
> >- pte_t *pte;
> >-
> >- pte = (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO | __GFP_ACCOUNT);
> >- if (!pte)
> >- return NULL;
> >- page = virt_to_page(pte);
> >- if (!pgtable_page_ctor(page)) {
> >- __free_page(page);
> >- return NULL;
> >- }
> >- return page;
> >-}
> >-
> >-static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
> >-{
> >- free_page((unsigned long)pte);
> >-}
> >-
> >-static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
> >-{
> >- pgtable_page_dtor(ptepage);
> >- __free_page(ptepage);
> >-}
> >-
> > static inline void pgtable_free(void *table, int shift)
> > {
> > if (!shift) {
> >
>
--
Sincerely yours,
Mike.
^ permalink raw reply
* [PATCH v1] timer:clock:ptp: add support the dynamic posix clock alarm set for ptp
From: Po Liu @ 2019-05-05 5:02 UTC (permalink / raw)
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Cc: Roy Zang, richardcochran@gmail.com, Po Liu, Leo Li,
Claudiu Manoil, deepa.kernel@gmail.com, Y.b. Lu,
davem@davemloft.net, Mingkai Hu
Current kernel code do not support the dynamic posix clock alarm set.
This code would support it by the posix timer structure.
319 const struct k_clock clock_posix_dynamic = {
320 .clock_getres = pc_clock_getres,
321 .clock_set = pc_clock_settime,
322 .clock_get = pc_clock_gettime,
323 .clock_adj = pc_clock_adjtime,
324 + .timer_create = pc_timer_create,
325 + .timer_del = pc_timer_delete,
326 + .timer_set = pc_timer_set,
327 + .timer_arm = pc_timer_arm,
}
This won't change the user space system call code. Normally the user
space set alarm by timer_create() and timer_settime(). Reference code
are tools/testing/selftests/ptp/testptp.c.
Some case requiring providing the alarm set for user space by ptp clock.
Signed-off-by: Po Liu <Po.Liu@nxp.com>
---
drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 1 +
drivers/ptp/ptp_clock.c | 39 ++++++++++++++-
drivers/ptp/ptp_qoriq.c | 44 +++++++++++++++++
include/linux/fsl/ptp_qoriq.h | 3 ++
include/linux/posix-clock.h | 3 +-
include/linux/ptp_clock_kernel.h | 5 +-
kernel/time/posix-clock.c | 60 ++++++++++++++++++++++++
7 files changed, 152 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
index 8c1497e..35e2f2a 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -21,6 +21,7 @@
.gettime64 = ptp_qoriq_gettime,
.settime64 = ptp_qoriq_settime,
.enable = ptp_qoriq_enable,
+ .alarm = ptp_qoriq_alarm,
};
static int enetc_ptp_probe(struct pci_dev *pdev,
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 79bd102..72d06a8 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -23,7 +23,9 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/sched/task.h>
#include <linux/posix-clock.h>
+#include <linux/posix-timers.h>
#include <linux/pps_kernel.h>
#include <linux/slab.h>
#include <linux/syscalls.h>
@@ -166,12 +168,31 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
return err;
}
+static int ptp_clock_alarm(struct posix_clock *pc, ktime_t expires,
+ bool absolute, struct k_itimer *timr)
+{
+ struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
+ struct ptp_clock_info *ops;
+
+ ops = ptp->info;
+ if (!ops)
+ return -EINVAL;
+
+ if (!ops->alarm)
+ return -EINVAL;
+
+ ops->alarm(ops, expires, absolute, timr);
+
+ return 0;
+}
+
static struct posix_clock_operations ptp_clock_ops = {
.owner = THIS_MODULE,
.clock_adjtime = ptp_clock_adjtime,
.clock_gettime = ptp_clock_gettime,
.clock_getres = ptp_clock_getres,
.clock_settime = ptp_clock_settime,
+ .clock_alarm = ptp_clock_alarm,
.ioctl = ptp_ioctl,
.open = ptp_open,
.poll = ptp_poll,
@@ -324,6 +345,20 @@ int ptp_clock_unregister(struct ptp_clock *ptp)
}
EXPORT_SYMBOL(ptp_clock_unregister);
+int alarm_timer_event(struct k_itimer *timr, int si_private)
+{
+ int ret = -1;
+
+ timr->sigq->info.si_sys_private = si_private;
+
+ rcu_read_lock();
+ ret = send_sigqueue(timr->sigq, timr->it_pid, PIDTYPE_PID);
+ rcu_read_unlock();
+
+ /* If we failed to send the signal the timer stops. */
+ return ret > 0;
+}
+
void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
{
struct pps_event_time evt;
@@ -331,8 +366,10 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event)
switch (event->type) {
case PTP_CLOCK_ALARM:
+ if (!event->timr)
+ break;
+ alarm_timer_event(event->timr, 0);
break;
-
case PTP_CLOCK_EXTTS:
enqueue_external_timestamp(&ptp->tsevq, event);
wake_up_interruptible(&ptp->tsev_wq);
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 5377536..ce14d44 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -163,10 +163,15 @@ irqreturn_t ptp_qoriq_isr(int irq, void *priv)
if (irqs & ALM2) {
ack |= ALM2;
+ if (!ptp_qoriq->timr) {
+ ptp_qoriq->alarm_value = 0;
+ ptp_qoriq->alarm_interval = 0;
+ }
if (ptp_qoriq->alarm_value) {
event.type = PTP_CLOCK_ALARM;
event.index = 0;
event.timestamp = ptp_qoriq->alarm_value;
+ event.timr = ptp_qoriq->timr;
ptp_clock_event(ptp_qoriq->clock, &event);
}
if (ptp_qoriq->alarm_interval) {
@@ -341,6 +346,44 @@ int ptp_qoriq_enable(struct ptp_clock_info *ptp,
}
EXPORT_SYMBOL_GPL(ptp_qoriq_enable);
+int ptp_qoriq_alarm(struct ptp_clock_info *ptp, ktime_t expires,
+ bool absolute, struct k_itimer *timr)
+{
+ u64 ns, now;
+ u32 lo, hi, mask;
+
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
+
+ if (!timr)
+ return -EINVAL;
+
+ now = tmr_cnt_read(ptp_qoriq);
+ if (!absolute)
+ ns = now + ktime_to_ns(expires);
+ else if (ktime_to_ns(expires) < now)
+ ns = now;
+ else
+ ns = ktime_to_ns(expires);
+
+ hi = ns >> 32;
+ lo = ns & 0xffffffff;
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm2_l, lo);
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm2_h, hi);
+
+ spin_lock(&ptp_qoriq->lock);
+ mask = ptp_qoriq->read(®s->ctrl_regs->tmr_temask);
+ mask |= ALM2EN;
+ ptp_qoriq->write(®s->ctrl_regs->tmr_temask, mask);
+ spin_unlock(&ptp_qoriq->lock);
+
+ ptp_qoriq->alarm_value = ns;
+ ptp_qoriq->alarm_interval = ktime_to_ns(timr->it_interval);
+
+ ptp_qoriq->timr = timr;
+ return 0;
+}
+
static const struct ptp_clock_info ptp_qoriq_caps = {
.owner = THIS_MODULE,
.name = "qoriq ptp clock",
@@ -355,6 +398,7 @@ int ptp_qoriq_enable(struct ptp_clock_info *ptp,
.gettime64 = ptp_qoriq_gettime,
.settime64 = ptp_qoriq_settime,
.enable = ptp_qoriq_enable,
+ .alarm = ptp_qoriq_alarm,
};
/**
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 992bf9f..2928df4 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -143,6 +143,7 @@ struct ptp_qoriq {
spinlock_t lock; /* protects regs */
struct ptp_clock *clock;
struct ptp_clock_info caps;
+ struct k_itimer *timr;
struct resource *rsrc;
struct dentry *debugfs_root;
struct device *dev;
@@ -190,6 +191,8 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
int ptp_qoriq_settime(struct ptp_clock_info *ptp,
const struct timespec64 *ts);
+int ptp_qoriq_alarm(struct ptp_clock_info *ptp, ktime_t expires,
+ bool absolute, struct k_itimer *timr);
int ptp_qoriq_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on);
#ifdef CONFIG_DEBUG_FS
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index 18674d7..80cc214 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -59,7 +59,8 @@ struct posix_clock_operations {
int (*clock_settime)(struct posix_clock *pc,
const struct timespec64 *ts);
-
+ int (*clock_alarm)(struct posix_clock *pc, ktime_t expires,
+ bool absolute, struct k_itimer *timr);
/*
* Optional character device methods:
*/
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 7121bbe..b51f64b 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -24,7 +24,7 @@
#include <linux/device.h>
#include <linux/pps_kernel.h>
#include <linux/ptp_clock.h>
-
+#include <linux/posix-timers.h>
struct ptp_clock_request {
enum {
@@ -148,6 +148,8 @@ struct ptp_clock_info {
int (*getcrosststamp)(struct ptp_clock_info *ptp,
struct system_device_crosststamp *cts);
int (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);
+ int (*alarm)(struct ptp_clock_info *p, ktime_t expires,
+ bool absolute, struct k_itimer *timr);
int (*enable)(struct ptp_clock_info *ptp,
struct ptp_clock_request *request, int on);
int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
@@ -180,6 +182,7 @@ struct ptp_clock_event {
u64 timestamp;
struct pps_event_time pps_times;
};
+ struct k_itimer *timr;
};
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index ec960bb..ac25d17 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -8,6 +8,7 @@
#include <linux/export.h>
#include <linux/file.h>
#include <linux/posix-clock.h>
+#include <linux/posix-timers.h>
#include <linux/slab.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
@@ -314,9 +315,68 @@ static int pc_clock_settime(clockid_t id, const struct timespec64 *ts)
return err;
}
+static void pc_timer_arm(struct k_itimer *timr, ktime_t expires,
+ bool absolute, bool sigev_none)
+{
+ struct posix_clock_desc cd;
+ int err;
+
+ err = get_clock_desc(timr->it_clock, &cd);
+ if (err)
+ return;
+
+ cd.clk->ops.clock_alarm(cd.clk, expires, absolute, timr);
+}
+
+static int pc_timer_set(struct k_itimer *timr, int flags,
+ struct itimerspec64 *new_setting,
+ struct itimerspec64 *old_setting)
+{
+ const struct k_clock *kc = timr->kclock;
+ bool sigev_none;
+ ktime_t expires;
+
+ if (old_setting)
+ pr_err("old_setting not support!\n");
+
+ /* Prevent rearming by clearing the interval */
+ timr->it_interval = 0;
+
+ timr->it_active = 0;
+ timr->it_requeue_pending = (timr->it_requeue_pending + 2) &
+ ~REQUEUE_PENDING;
+ timr->it_overrun_last = 0;
+
+ /* Switch off the timer when it_value is zero */
+ if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec)
+ return 0;
+
+ timr->it_interval = timespec64_to_ktime(new_setting->it_interval);
+ expires = timespec64_to_ktime(new_setting->it_value);
+ sigev_none = timr->it_sigev_notify == SIGEV_NONE;
+
+ kc->timer_arm(timr, expires, flags & TIMER_ABSTIME, sigev_none);
+ timr->it_active = !sigev_none;
+ return 0;
+}
+
+static int pc_timer_create(struct k_itimer *new_timer)
+{
+ return 0;
+}
+
+static int pc_timer_delete(struct k_itimer *new_timer)
+{
+ return 0;
+}
+
const struct k_clock clock_posix_dynamic = {
.clock_getres = pc_clock_getres,
.clock_set = pc_clock_settime,
.clock_get = pc_clock_gettime,
.clock_adj = pc_clock_adjtime,
+ .timer_create = pc_timer_create,
+ .timer_del = pc_timer_delete,
+ .timer_set = pc_timer_set,
+ .timer_arm = pc_timer_arm,
};
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH -next] misc: ocxl: Make ocxl_remove static
From: Andrew Donnellan @ 2019-05-05 14:21 UTC (permalink / raw)
To: YueHaibing, fbarrat, arnd, gregkh; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20190504102720.42220-1-yuehaibing@huawei.com>
On 4/5/19 8:27 pm, YueHaibing wrote:
> Fix sparse warning:
>
> drivers/misc/ocxl/pci.c:44:6: warning:
> symbol 'ocxl_remove' was not declared. Should it be static?
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Good catch!
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> drivers/misc/ocxl/pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/ocxl/pci.c b/drivers/misc/ocxl/pci.c
> index f2a3ef4..cb920aa 100644
> --- a/drivers/misc/ocxl/pci.c
> +++ b/drivers/misc/ocxl/pci.c
> @@ -41,7 +41,7 @@ static int ocxl_probe(struct pci_dev *dev, const struct pci_device_id *id)
> return 0;
> }
>
> -void ocxl_remove(struct pci_dev *dev)
> +static void ocxl_remove(struct pci_dev *dev)
> {
> struct ocxl_fn *fn;
> struct ocxl_afu *afu;
>
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH -next] ocxl: Fix return value check in afu_ioctl()
From: Andrew Donnellan @ 2019-05-05 14:22 UTC (permalink / raw)
To: Wei Yongjun, Frederic Barrat, Arnd Bergmann, Greg Kroah-Hartman,
Alastair D'Silva
Cc: kernel-janitors, linuxppc-dev, linux-kernel
In-Reply-To: <20190504070430.57008-1-weiyongjun1@huawei.com>
On 4/5/19 5:04 pm, Wei Yongjun wrote:
> In case of error, the function eventfd_ctx_fdget() returns ERR_PTR() and
> never returns NULL. The NULL test in the return value check should be
> replaced with IS_ERR().
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 060146614643 ("ocxl: move event_fd handling to frontend")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> drivers/misc/ocxl/file.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
> index 8aa22893ed76..2870c25da166 100644
> --- a/drivers/misc/ocxl/file.c
> +++ b/drivers/misc/ocxl/file.c
> @@ -257,8 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
> return -EINVAL;
> irq_id = ocxl_irq_offset_to_id(ctx, irq_fd.irq_offset);
> ev_ctx = eventfd_ctx_fdget(irq_fd.eventfd);
> - if (!ev_ctx)
> - return -EFAULT;
> + if (IS_ERR(ev_ctx))
> + return PTR_ERR(ev_ctx);
> rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx);
> break;
>
>
>
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply
* Re: [PATCH v3] dpaa_eth: fix SG frame cleanup
From: David Miller @ 2019-05-05 17:31 UTC (permalink / raw)
To: laurentiu.tudor
Cc: madalin.bucur, netdev, linux-kernel, stable, leoyang.li,
camelia.groza, linuxppc-dev, linux-arm-kernel
In-Reply-To: <20190503130311.9914-1-laurentiu.tudor@nxp.com>
From: laurentiu.tudor@nxp.com
Date: Fri, 3 May 2019 16:03:11 +0300
> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>
> Fix issue with the entry indexing in the sg frame cleanup code being
> off-by-1. This problem showed up when doing some basic iperf tests and
> manifested in traffic coming to a halt.
>
> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
> Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
Applied and queued up for -stable.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox